Flammable eggcorn sprouts, plantlike_rooted ignite API

This commit is contained in:
Aaron Suen 2023-05-21 19:53:22 -04:00
parent 205ff184fa
commit 49e649349d
2 changed files with 14 additions and 3 deletions

View File

@ -77,7 +77,7 @@ function nodecore.fire_ignite(pos, node)
local ign = def.on_ignite
if type(ign) == "function" then
ign = ign(pos, node)
if ign == true then return end
if ign == true then return true end
end
burneject(pos, ign)
end
@ -101,6 +101,16 @@ function nodecore.fire_ignite(pos, node)
return true
end
function nodecore.fire_on_ignite_plantlike_rooted(replace)
if type(replace) == "string" then replace = {name = replace} end
return function(pos)
minetest.set_node(pos, replace)
local above = {x = pos.x, y = pos.y + 1, z = pos.z}
nodecore.fire_ignite(above)
return true
end
end
function nodecore.fire_check_ignite(pos, node, force, ...)
if not force then
node = node or minetest.get_node(pos)

View File

@ -90,12 +90,13 @@ local ldname = "nc_terrain:dirt_loose"
local epdef = nodecore.underride({
description = "Sprout",
drawtype = "plantlike_rooted",
falling_visual = "nc_terrain:dirt_loose",
falling_visual = ldname,
special_tiles = {modname .. "_eggcorn_planted.png"},
drop = ldname,
no_self_repack = true,
paramtype = "light",
groups = {grassable = 0}
groups = {grassable = 0, flammable = 35},
on_ignite = nodecore.fire_on_ignite_plantlike_rooted(ldname)
}, minetest.registered_items[ldname] or {})
epdef.groups.soil = nil
minetest.register_node(epname, epdef)