From 8df0c06d6ab8a839d685b588df5002339761e1a8 Mon Sep 17 00:00:00 2001 From: Juraj Vajda Date: Sun, 7 Jan 2018 14:04:27 -0500 Subject: [PATCH] cleanup and improvements --- spawners_mobs/api.lua | 12 ++++++++---- spawners_mobs/spawners_mobs.lua | 2 ++ 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/spawners_mobs/api.lua b/spawners_mobs/api.lua index f67eaad..421428b 100644 --- a/spawners_mobs/api.lua +++ b/spawners_mobs/api.lua @@ -188,7 +188,7 @@ function spawners_mobs.start_spawning(spawn_area_random_pos, mob_name, mod_prefi minetest.sound_play(sound_name, { pos = spawn_area_random_pos[i], max_hear_distance = 8, - gain = 0.3 + gain = 0.5 }) end end @@ -385,7 +385,11 @@ 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 - if id_flame and id_smoke and id_flame ~= nil and id_smoke ~= nil then + + -- 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) end @@ -410,7 +414,7 @@ function spawners_mobs.set_status(pos, set_status) -- elseif set_status == "waiting" and meta_status ~= set_status then -- delete particles - if id_flame and id_smoke and id_flame ~= nil and id_smoke ~= nil then + if id_flame and id_smoke then minetest.delete_particlespawner(id_flame) minetest.delete_particlespawner(id_smoke) end @@ -434,7 +438,7 @@ function spawners_mobs.set_status(pos, set_status) -- elseif set_status == "rusty" and meta_status ~= set_status then -- delete particles - if id_flame and id_smoke and id_flame ~= nil and id_smoke ~= nil then + if id_flame and id_smoke then minetest.delete_particlespawner(id_flame) minetest.delete_particlespawner(id_smoke) end diff --git a/spawners_mobs/spawners_mobs.lua b/spawners_mobs/spawners_mobs.lua index 8705b4e..abf5bd9 100644 --- a/spawners_mobs/spawners_mobs.lua +++ b/spawners_mobs/spawners_mobs.lua @@ -63,6 +63,8 @@ function spawners_mobs.create(mob_table, idx) after_place_node = function(pos, placer, itemstack, pointed_thing) local meta = minetest.get_meta(pos) meta:set_string("owner", placer:get_player_name()) + + meta:set_string("infotext", mob_name.." spawner\nowner: "..placer:get_player_name().."\nspawner is active") end, on_destruct = function(pos)