sorcery  Diff

Differences From Artifact [7230727dfc]:

To Artifact [db73c43862]:


1
2
3
4
5











6
7
8

9
10
11
12

13
14






15
16
17
18
19
20
21
...
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
-- liquid.lua
-- the liquid registry is used to keep track of abstract liquids,
-- their properties, and their representation in-game.

sorcery.registry.mk('liquid', false)











sorcery.liquid = {
	constants = {
		drams_per_glass = 64;

		glasses_per_bottle = 3;
		bottles_per_bucket = 3;
		bottles_per_trough = 6;
	}

}
local constants = sorcery.liquid.constants







local L = sorcery.lib
local log = sorcery.logger('liquid')

sorcery.liquid.fill_from_basin = function(ctr, liquid, basin)
	local liq = sorcery.register.liquid.db[liquid]
	local filled
................................................................................
				}
			};
		})
	end
end
sorcery.liquid.mktrough()

sorcery.liquid.measure_default = function(amt)
	return string.format('%s drams', amt*constants.drams_per_glass)
end

sorcery.liquid.container = function(liq, ctr)
	return liq.containers[({
		bottle = 'vessels:glass_bottle';
		glass = 'vessels:drinking_glass';
		keg = 'sorcery:keg';
		trough = 'sorcery:trough';





>
>
>
>
>
>
>
>
>
>
>



>



|
>


>
>
>
>
>
>







 







|
<
<







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
...
183
184
185
186
187
188
189
190


191
192
193
194
195
196
197
-- liquid.lua
-- the liquid registry is used to keep track of abstract liquids,
-- their properties, and their representation in-game.

sorcery.registry.mk('liquid', false)
local mkunit = function(unit,fac)
	return function(amt)
		-- allow division for more accurate results
		if fac >= 0 then
			amt = amt * fac
		else
			amt = amt / (-fac)
		end
		return string.format('%s %s%s', amt, unit, (amt == 1) and '' or 's')
	end
end
sorcery.liquid = {
	constants = {
		drams_per_glass = 64;
		pints_per_glass = 0.5;
		glasses_per_bottle = 3;
		bottles_per_bucket = 3;
		bottles_per_trough = 6;
	};
	unit = mkunit;
}
local constants = sorcery.liquid.constants
sorcery.liquid.units = {
	dram = mkunit('dram', constants.drams_per_glass);
	pint = mkunit('pint', constants.pints_per_glass);
	draught = mkunit('draught', -3);
	drink = mkunit('drink', 1);
};

local L = sorcery.lib
local log = sorcery.logger('liquid')

sorcery.liquid.fill_from_basin = function(ctr, liquid, basin)
	local liq = sorcery.register.liquid.db[liquid]
	local filled
................................................................................
				}
			};
		})
	end
end
sorcery.liquid.mktrough()

sorcery.liquid.measure_default = sorcery.liquid.units.dram



sorcery.liquid.container = function(liq, ctr)
	return liq.containers[({
		bottle = 'vessels:glass_bottle';
		glass = 'vessels:drinking_glass';
		keg = 'sorcery:keg';
		trough = 'sorcery:trough';