1
0
mirror of https://codeberg.org/tenplus1/mobs_monster.git synced 2024-12-22 17:00:26 +01:00

place lava flan death flame in air position only

This commit is contained in:
tenplus1 2022-08-21 08:01:07 +01:00
parent a097ee9388
commit 4d88f45109

View File

@ -75,17 +75,21 @@ mobs:register_mob("mobs_monster:lava_flan", {
if math.random(4) == 1 then if math.random(4) == 1 then
mobs:add_mob(pos, {name = "mobs_monster:obsidian_flan"}) mobs:add_mob(pos, {name = "mobs_monster:obsidian_flan"})
end end
else -- place flame if position empty and flame exists else
local nod = minetest.get_node(pos) mobs:effect(pos, 40, "fire_basic_flame.png", 2, 3, 2, 5, 10, nil)
local def = nod.name and minetest.registered_nodes[nod.name]
if def and def.buildable_to == true local nods = minetest.find_nodes_in_area(
{x = pos.x, y = pos.y + 1, z = pos.z},
{x = pos.x, y = pos.y, z = pos.z}, "air")
-- place flame if position empty and flame exists
if nods and #nods > 0
and minetest.registered_nodes["fire:basic_flame"] then and minetest.registered_nodes["fire:basic_flame"] then
pos = nods[math.random(#nods)]
minetest.set_node(pos, {name = "fire:basic_flame"}) minetest.set_node(pos, {name = "fire:basic_flame"})
end end
mobs:effect(pos, 40, "fire_basic_flame.png", 2, 3, 2, 5, 10, nil)
self.object:remove() self.object:remove()
end end
end, end,