fbff15e2fe
- Expanded fire api, added "check" varieties of things that also perform relevant checks for eligibility. Standardized testing for ventilation. - Snuff embers to coals as fuel. - Fuel is consumed randomly by flames. This means that fuel that are surrounded by flame burn out quicker, while flames surrounded by fuel consume fuel from each node slower. This adds subtlety to furnace design for efficiency.
40 lines
1.1 KiB
Lua
40 lines
1.1 KiB
Lua
-- LUALOCALS < ---------------------------------------------------------
|
|
local ItemStack, math, minetest, nodecore
|
|
= ItemStack, math, minetest, nodecore
|
|
local math_random
|
|
= math.random
|
|
-- LUALOCALS > ---------------------------------------------------------
|
|
|
|
nodecore.register_craft({
|
|
label = "stick fire starting",
|
|
action = "pummel",
|
|
wield = {
|
|
groups = {firestick = true}
|
|
},
|
|
nodes = {
|
|
{match = {groups = {firestick = true}}}
|
|
},
|
|
consumewield = 1,
|
|
duration = 5,
|
|
before = function(pos, rel, data)
|
|
local w = data.wield and ItemStack(data.wield):get_name() or ""
|
|
local wd = minetest.registered_items[w] or {}
|
|
local wg = wd.groups or {}
|
|
local fs = wg.firestick or 1
|
|
local nd = minetest.registered_items[data.node.name] or {}
|
|
local ng = nd.groups or {}
|
|
fs = fs * (ng.firestick or 1)
|
|
|
|
if math_random(1, 4) > fs then return end
|
|
minetest.set_node(pos, {name = "nc_fire:fire"})
|
|
|
|
if math_random(1, 4) > fs then return end
|
|
local dir = nodecore.pickrand(nodecore.dirs())
|
|
return nodecore.fire_check_ignite({
|
|
x = pos.x + dir.x,
|
|
y = pos.y + dir.y,
|
|
z = pos.z + dir.z
|
|
})
|
|
end
|
|
})
|