Skip to content

Commit

Permalink
place lava flan death flame in air position only
Browse files Browse the repository at this point in the history
  • Loading branch information
tenplus1 committed Aug 21, 2022
1 parent a097ee9 commit 4d88f45
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions lava_flan.lua
Original file line number Diff line number Diff line change
Expand Up @@ -75,17 +75,21 @@ mobs:register_mob("mobs_monster:lava_flan", {
if math.random(4) == 1 then
mobs:add_mob(pos, {name = "mobs_monster:obsidian_flan"})
end
else -- place flame if position empty and flame exists
local nod = minetest.get_node(pos)
local def = nod.name and minetest.registered_nodes[nod.name]
else
mobs:effect(pos, 40, "fire_basic_flame.png", 2, 3, 2, 5, 10, nil)

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")

if def and def.buildable_to == true
-- place flame if position empty and flame exists
if nods and #nods > 0
and minetest.registered_nodes["fire:basic_flame"] then

pos = nods[math.random(#nods)]
minetest.set_node(pos, {name = "fire:basic_flame"})
end

mobs:effect(pos, 40, "fire_basic_flame.png", 2, 3, 2, 5, 10, nil)

self.object:remove()
end
end,
Expand Down

0 comments on commit 4d88f45

Please sign in to comment.