Compare commits

...

1 Commits

Author SHA1 Message Date
JoseDouglas26 b187288687 Updated set_fire and placement checks 2024-06-15 11:21:31 +02:00
3 changed files with 9 additions and 9 deletions

View File

@ -27,18 +27,19 @@ minetest.register_craftitem("mcl_fire:fire_charge", {
end
-- Ignite/light fire
local used = nil
local node = get_node(pointed_thing.under)
if pointed_thing.type == "node" then
local nodedef = minetest.registered_nodes[node.name]
if nodedef and nodedef._on_ignite then
local overwrite = nodedef._on_ignite(user, pointed_thing)
if not overwrite then
mcl_fire.set_fire(pointed_thing, user, false)
used = mcl_fire.set_fire(pointed_thing, user, false)
end
else
mcl_fire.set_fire(pointed_thing, user, false)
used = mcl_fire.set_fire(pointed_thing, user, false)
end
if not minetest.is_creative_enabled(user:get_player_name()) then
if not minetest.is_creative_enabled(user:get_player_name()) and used then
itemstack:take_item()
end
end

View File

@ -31,23 +31,22 @@ minetest.register_tool("mcl_fire:flint_and_steel", {
{pos = pointed_thing.above, gain = 0.5, max_hear_distance = 8},
true
)
local used = false
local used = nil
if pointed_thing.type == "node" then
local nodedef = minetest.registered_nodes[get_node(pointed_thing.under).name]
if nodedef and nodedef._on_ignite then
local overwrite = nodedef._on_ignite(user, pointed_thing)
if not overwrite then
mcl_fire.set_fire(pointed_thing, user, false)
used = mcl_fire.set_fire(pointed_thing, user, false)
end
else
mcl_fire.set_fire(pointed_thing, user, false)
used = mcl_fire.set_fire(pointed_thing, user, false)
end
used = true
end
if itemstack:get_count() == 0 and idef.sound and idef.sound.breaks then
minetest.sound_play(idef.sound.breaks, {pos=user:get_pos(), gain=0.5}, true)
end
if (not minetest.is_creative_enabled(user:get_player_name())) and used == true then
if (not minetest.is_creative_enabled(user:get_player_name())) and used then
itemstack:add_wear(65535/65) -- 65 uses
end
return itemstack

View File

@ -469,7 +469,7 @@ function mcl_fire.set_fire(pointed_thing, player, allow_on_fire)
return
end
add_node(pointed_thing.above, {name="mcl_fire:fire"})
return add_node(pointed_thing.above, {name="mcl_fire:fire"})
end
minetest.register_lbm({