From 6b777ed9d6dcb2b29d0f53b1607be5fdf71b320b Mon Sep 17 00:00:00 2001 From: Juraj Vajda Date: Mon, 8 Jan 2018 14:34:07 -0500 Subject: [PATCH] small code tweaks --- spawners_mobs/api.lua | 13 ++++++------- spawners_mobs/spawners_mobs.lua | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/spawners_mobs/api.lua b/spawners_mobs/api.lua index 97a33d7..4cc1a72 100644 --- a/spawners_mobs/api.lua +++ b/spawners_mobs/api.lua @@ -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) diff --git a/spawners_mobs/spawners_mobs.lua b/spawners_mobs/spawners_mobs.lua index abf5bd9..c371f29 100644 --- a/spawners_mobs/spawners_mobs.lua +++ b/spawners_mobs/spawners_mobs.lua @@ -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, })