small code tweaks

master
Juraj Vajda 2018-01-08 14:34:07 -05:00
parent 87b6d7a37e
commit 6b777ed9d6
2 changed files with 7 additions and 8 deletions

View File

@ -127,13 +127,16 @@ function spawners_mobs.tick(pos)
local meta = minetest.get_meta(pos)
local tick_counter = meta:get_int("tick")
local owner = meta:get_string("owner")
tick_counter = tick_counter + 1
-- print("tick_counter: "..tick_counter)
local privs = minetest.get_player_privs(owner);
if owner ~= "ADMIN" then
-- not for admin
if not privs.privs then
tick_counter = tick_counter + 1
meta:set_int("tick", tick_counter)
end
-- print("tick_counter: "..tick_counter)
-- rusty spawner
if tick_counter >= tick_max then
spawners_mobs.set_status(pos, "rusty")
@ -395,10 +398,6 @@ function spawners_mobs.set_status(pos, set_status)
if set_status == "active" then
-- remove particles and add them again - keeps particles after server restart
-- delete particles
-- print("id_flame: "..id_flame)
-- print("id_smoke: "..id_smoke)
if id_flame and id_smoke then
minetest.delete_particlespawner(id_flame)
minetest.delete_particlespawner(id_smoke)

View File

@ -126,7 +126,7 @@ function spawners_mobs.create(mob_table, idx)
minetest.register_lbm({
name = "spawners_mobs:start_nodetimer_"..mod_prefix.."_"..mob_name.."_spawner",
nodenames = "spawners_mobs:"..mod_prefix.."_"..mob_name.."_spawner",
action = function(pos, node)
action = function(pos)
spawners_mobs.tick_short(pos)
end,
})