2019-02-21 14:27:06 -05:00
|
|
|
-- 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 = {
|
2019-02-23 02:05:41 -05:00
|
|
|
groups = {firestick = true}
|
2019-02-21 14:27:06 -05:00
|
|
|
},
|
|
|
|
nodes = {
|
|
|
|
{match = {groups = {firestick = true}}}
|
|
|
|
},
|
|
|
|
consumewield = 1,
|
|
|
|
duration = 5,
|
2019-08-24 06:31:27 -04:00
|
|
|
before = function(pos, data)
|
2019-02-21 14:27:06 -05:00
|
|
|
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)
|
2019-03-31 20:54:38 -04:00
|
|
|
|
2019-02-21 14:27:06 -05:00
|
|
|
if math_random(1, 4) > fs then return end
|
|
|
|
minetest.set_node(pos, {name = "nc_fire:fire"})
|
2019-03-31 20:54:38 -04:00
|
|
|
|
2019-02-21 14:27:06 -05:00
|
|
|
if math_random(1, 4) > fs then return end
|
|
|
|
local dir = nodecore.pickrand(nodecore.dirs())
|
2019-03-31 20:54:38 -04:00
|
|
|
return nodecore.fire_check_ignite({
|
|
|
|
x = pos.x + dir.x,
|
|
|
|
y = pos.y + dir.y,
|
|
|
|
z = pos.z + dir.z
|
|
|
|
})
|
2019-02-21 14:27:06 -05:00
|
|
|
end
|
|
|
|
})
|