mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2024-12-25 19:02:26 +01:00
Prevent placement of fire into nodes above water
This addresses the edge case where fire is set to the top of a non-water block that represents water (such as kelp). Note this is forbidding theoretically legitimate setups for fire over water where fire is set to the side of a block diagonally from the water. Fire is still permitted next to water (so it can be set to the face of a block diagonally from a water column).
This commit is contained in:
parent
c08153fa7f
commit
b121d0f804
@ -448,18 +448,28 @@ function mcl_fire.set_fire(pointed_thing, player, allow_on_fire)
|
|||||||
else
|
else
|
||||||
pname = player:get_player_name()
|
pname = player:get_player_name()
|
||||||
end
|
end
|
||||||
local n = get_node(pointed_thing.above)
|
|
||||||
local nu = get_node(pointed_thing.under)
|
|
||||||
if allow_on_fire == false and get_item_group(nu.name, "fire") ~= 0 then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
if minetest.is_protected(pointed_thing.above, pname) then
|
if minetest.is_protected(pointed_thing.above, pname) then
|
||||||
minetest.record_protection_violation(pointed_thing.above, pname)
|
minetest.record_protection_violation(pointed_thing.above, pname)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if n.name == "air" then
|
|
||||||
add_node(pointed_thing.above, {name="mcl_fire:fire"})
|
local n_pointed = minetest.get_node(pointed_thing.under)
|
||||||
|
if allow_on_fire == false and get_item_group(n_pointed.name, "fire") ~= 0 then
|
||||||
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local n_fire_pos = minetest.get_node(pointed_thing.above)
|
||||||
|
if n_fire_pos.name ~= "air" then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
local n_below = minetest.get_node(vector.offset(pointed_thing.above, 0, -1, 0))
|
||||||
|
if minetest.get_item_group(n_below.name, "water") ~= 0 then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
add_node(pointed_thing.above, {name="mcl_fire:fire"})
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.register_lbm({
|
minetest.register_lbm({
|
||||||
|
Loading…
Reference in New Issue
Block a user