Fix type and add some nil checks
This commit is contained in:
parent
503c718a7a
commit
15466f92f3
@ -43,8 +43,13 @@ local function place_spawner(param)
|
|||||||
pos.y = pos.y + 1
|
pos.y = pos.y + 1
|
||||||
end
|
end
|
||||||
|
|
||||||
local spawner_name = spawners_env.registered_spawners_names[math.random(1, #spawners_mobs.registered_spawners_names)]
|
local spawner_name
|
||||||
|
|
||||||
|
if #spawners_env.registered_spawners_names > 0 then
|
||||||
|
spawner_name = spawners_env.registered_spawners_names[math.random(1, #spawners_env.registered_spawners_names)]
|
||||||
|
end
|
||||||
|
|
||||||
|
if spawner_name then
|
||||||
if gen_obj == 'dungeon' then
|
if gen_obj == 'dungeon' then
|
||||||
minetest.set_node(pos, { name = spawner_name })
|
minetest.set_node(pos, { name = spawner_name })
|
||||||
minetest.log('action', '[Spawners] dungeon spawner ' .. spawner_name .. ' placed at: ' .. minetest.pos_to_string(pos))
|
minetest.log('action', '[Spawners] dungeon spawner ' .. spawner_name .. ' placed at: ' .. minetest.pos_to_string(pos))
|
||||||
@ -53,6 +58,7 @@ local function place_spawner(param)
|
|||||||
minetest.log('action', '[Spawners] temple spawner ' .. spawner_name .. ' placed at: ' .. minetest.pos_to_string(pos))
|
minetest.log('action', '[Spawners] temple spawner ' .. spawner_name .. ' placed at: ' .. minetest.pos_to_string(pos))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
minetest.set_gen_notify('dungeon')
|
minetest.set_gen_notify('dungeon')
|
||||||
|
Loading…
Reference in New Issue
Block a user