11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
..
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
...
189
190
191
192
193
194
195
|
local liq = sorcery.register.liquid.db[liqid]
if not liq then log.err('missing entry for liquid',liqid) return end
local measure = liq.measure or function(u)
return string.format('%s drams', u*63.9)
end
return {
title = string.format('Keg of %s', liq.name);
color = sorcery.lib.color(liq.color);
props = {
{title = 'Contains', desc = measure(m:get_int('charge'))};
}
};
else return { title = 'Empty Keg', props = {} } end
end
local log = sorcery.logger('keg')
minetest.register_node('sorcery:keg', {
description = 'Keg';
drawtype = 'mesh';
................................................................................
m:set_string('infotext', 'Empty Keg')
end;
on_rightclick = function(pos, node, user, stack)
local m = minetest.get_meta(pos)
local update = function()
local c = kegcaption(m)
local str = c.title
for _,p in pairs(c.props) do
str = str .. string.format('\n(%s: %s)', p.title, p.desc)
end
m:set_string('infotext', str)
end
local noise = function(amt)
minetest.sound_play('default_water_footstep', {
gain = 0.5 + amt / 9.0;
pitch = 1.3 - amt / 12.0;
pos = pos;
................................................................................
}
end
end
end
end;
})
|
|
<
|
<
>
|
|
>
>
>
>
>
>
>
>
>
>
>
>
|
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
..
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
...
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
|
local liq = sorcery.register.liquid.db[liqid]
if not liq then log.err('missing entry for liquid',liqid) return end
local measure = liq.measure or function(u)
return string.format('%s drams', u*63.9)
end
return {
title = string.format('%s Keg', sorcery.lib.str.capitalize(liq.name));
color = sorcery.lib.color(liq.color);
desc = string.format('%s of %s', measure(m:get_int('charge')), liq.name);
};
else return { title = 'Empty Keg', props = {} } end
end
local log = sorcery.logger('keg')
minetest.register_node('sorcery:keg', {
description = 'Keg';
drawtype = 'mesh';
................................................................................
m:set_string('infotext', 'Empty Keg')
end;
on_rightclick = function(pos, node, user, stack)
local m = minetest.get_meta(pos)
local update = function()
local c = kegcaption(m)
local str = c.title
if c.desc then str = str .. '\n(' .. c.desc .. ')' end
if c.props then for _,p in pairs(c.props) do -- future-proofing
str = str .. string.format('\n(%s: %s)', p.title, p.desc)
end end
m:set_string('infotext', str)
end
local noise = function(amt)
minetest.sound_play('default_water_footstep', {
gain = 0.5 + amt / 9.0;
pitch = 1.3 - amt / 12.0;
pos = pos;
................................................................................
}
end
end
end
end;
})
minetest.register_craft {
output = "sorcery:keg";
recipe = {
{'', 'basic_materials:steel_bar', 'screwdriver:screwdriver'};
{'sorcery:screw_bronze', 'default:bronze_ingot', 'sorcery:screw_bronze'};
{'', 'xdecor:barrel', ''};
};
replacements = {
{'screwdriver:screwdriver', 'screwdriver:screwdriver'};
};
}
|