Differences From
Artifact [04ca2e071b]:
50 50
51 51 sorcery.liquid.mktrough = function(liq)
52 52 -- troughs are used for collecting liquid from the environment,
53 53 -- like rainwater and tree sap. they hold twice as much as a bucket
54 54 local Q = constants.glasses_per_bottle
55 55 local trough_mkid = function(l,i)
56 56 if type(l) == 'string' then l = sorcery.register.liquid.db[l] end
57 - if not l or not i then return 'sorcery:trough' end
57 + if (not l) or (not i) or i < 1 then return 'sorcery:trough' end
58 58 return string.format('%s:trough_%s_%u', l.mod,l.sid,i)
59 59 end
60 60 local lid = function(l) return trough_mkid(liq, l) end
61 61
62 62 local M = constants.bottles_per_trough
63 63 local mkbox = function(lvl)
64 64 local pxl = function(tbl) -- for mapping to txcoords
................................................................................
161 161 end
162 162 end
163 163 sorcery.liquid.mktrough()
164 164
165 165 sorcery.liquid.measure_default = function(amt)
166 166 return string.format('%s drams', amt*constants.drams_per_glass)
167 167 end
168 +
169 +sorcery.liquid.container = function(liq, ctr)
170 + return liq.containers[({
171 + bottle = 'vessels:glass_bottle';
172 + glass = 'vessels:drinking_glass';
173 + keg = 'sorcery:keg';
174 + trough = 'sorcery:trough';
175 + })[ctr] or ctr]
176 +end
177 +
168 178 sorcery.liquid.register = function(liq)
169 179 local fmt = string.format
170 180 local Q = constants.glasses_per_bottle
171 181 liq.sid = liq.sid or liq.id:gsub('^[^:]+:','')
172 182 liq.mod = liq.mod or liq.id:gsub('^([^:]+):.*','%1')
173 183 if not liq.measure then
174 184 liq.measure = sorcery.liquid.measure_default