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