From 398971d08cb97d8f20755a56898900a8059fd5d2 Mon Sep 17 00:00:00 2001 From: AntumDeluge Date: Mon, 29 May 2017 00:06:18 -0700 Subject: [PATCH] Put mob & spawnegg names in 'sneeker' attributes --- init.lua | 15 +++++++++------ spawn.lua | 4 ++-- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/init.lua b/init.lua index cf7dfe4..2633ffc 100644 --- a/init.lua +++ b/init.lua @@ -14,6 +14,9 @@ end dofile(sneeker.modpath .. '/settings.lua') dofile(sneeker.modpath .. '/functions.lua') +sneeker.mob_name = sneeker.modname .. ':' .. sneeker.modname +sneeker.spawnegg_name = sneeker.modname .. ':spawnegg' + if log_mods then sneeker.log('Spawn cap: ' .. tostring(sneeker.spawn_cap)) end @@ -342,18 +345,18 @@ def.get_staticdata = function(self) }) end -minetest.register_entity('sneeker:sneeker',def) +minetest.register_entity(sneeker.mob_name, def) if minetest.get_modpath('spawneggs') and minetest.get_modpath('tnt') then - minetest.register_craftitem('sneeker:spawnegg',{ + minetest.register_craftitem(sneeker.spawnegg_name, { description = 'Sneeker Spawn Egg', inventory_image = 'sneeker_spawnegg.png', stack_max = 64, - on_place = function(itemstack,placer,pointed_thing) + on_place = function(itemstack, placer, pointed_thing) if pointed_thing.type == 'node' then local pos = pointed_thing.above pos.y = pos.y+1 - minetest.add_entity(pos,'sneeker:sneeker') + minetest.add_entity(pos, sneeker.mob_name) if not minetest.setting_getbool('creative_mode') then itemstack:take_item() end @@ -363,12 +366,12 @@ if minetest.get_modpath('spawneggs') and minetest.get_modpath('tnt') then }) minetest.register_craft({ - output = 'sneeker:spawnegg', + output = sneeker.spawnegg_name, type = 'shapeless', recipe = { 'spawneggs:egg', 'tnt:tnt', }, }) - minetest.register_alias('spawneggs:sneeker', 'sneeker:spawnegg') + minetest.register_alias('spawneggs:sneeker', sneeker.spawnegg_name) end diff --git a/spawn.lua b/spawn.lua index 3e3f153..101b626 100644 --- a/spawn.lua +++ b/spawn.lua @@ -14,7 +14,7 @@ if minetest.setting_getbool('log_mods') then end minetest.register_abm({ - nodenames = {'default:dirt_with_grass','default:stone'}, + nodenames = {'default:dirt_with_grass', 'default:stone'}, neighbors = {'air'}, interval = spawn_interval, chance = spawn_chance, @@ -42,6 +42,6 @@ minetest.register_abm({ if minetest.get_node(pos).name ~= 'air' then return end - minetest.add_entity(pos,'sneeker:sneeker') + minetest.add_entity(pos, sneeker.mob_name) end })