diff --git a/functions.lua b/functions.lua index a263c41..f8437fe 100644 --- a/functions.lua +++ b/functions.lua @@ -12,3 +12,9 @@ function sneeker.log_debug(message) sneeker.log('[DEBUG] ' .. message) end end + +-- Spawns a sneaker entity +function sneeker.spawn(pos) + minetest.add_entity(pos, sneeker.mob_name) + sneeker.log_debug('Spawned entity "' .. sneeker.mob_name .. '" at ' .. tostring(pos.x) .. ',' .. tostring(pos.y)) +end diff --git a/spawn.lua b/spawn.lua index 49bc29e..090e419 100644 --- a/spawn.lua +++ b/spawn.lua @@ -52,6 +52,6 @@ minetest.register_abm({ end if count >= sneeker.spawn_cap then return end -- Max sneekers already exist - minetest.add_entity(pos, sneeker.mob_name) + sneeker.spawn(pos) end })