From 88b02c71709ccdde6991f65554cb656ba5fba53a Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 25 May 2017 02:06:36 +0200 Subject: [PATCH] Move mob spawner into new mod --- mods/ENTITIES/mcl_monster_spawner/depends.txt | 3 +++ .../init.lua} | 22 +++++++++--------- mods/ENTITIES/mcl_monster_spawner/mod.conf | 1 + .../textures/mob_spawner.png | Bin mods/ENTITIES/mobs/init.lua | 2 +- 5 files changed, 16 insertions(+), 12 deletions(-) create mode 100644 mods/ENTITIES/mcl_monster_spawner/depends.txt rename mods/ENTITIES/{mobs/spawner.lua => mcl_monster_spawner/init.lua} (93%) create mode 100644 mods/ENTITIES/mcl_monster_spawner/mod.conf rename mods/ENTITIES/{mobs => mcl_monster_spawner}/textures/mob_spawner.png (100%) diff --git a/mods/ENTITIES/mcl_monster_spawner/depends.txt b/mods/ENTITIES/mcl_monster_spawner/depends.txt new file mode 100644 index 000000000..e565568a1 --- /dev/null +++ b/mods/ENTITIES/mcl_monster_spawner/depends.txt @@ -0,0 +1,3 @@ +mobs +mobs_mc +mcl_sounds diff --git a/mods/ENTITIES/mobs/spawner.lua b/mods/ENTITIES/mcl_monster_spawner/init.lua similarity index 93% rename from mods/ENTITIES/mobs/spawner.lua rename to mods/ENTITIES/mcl_monster_spawner/init.lua index fbb94ca66..07e671ff4 100644 --- a/mods/ENTITIES/mobs/spawner.lua +++ b/mods/ENTITIES/mcl_monster_spawner/init.lua @@ -13,7 +13,7 @@ end local function find_doll(pos) for _,obj in ipairs(minetest.env:get_objects_inside_radius(pos, 1)) do if not obj:is_player() then - if obj ~= nil and obj:get_luaentity().name == "mobs:spawner_mob_doll" then + if obj ~= nil and obj:get_luaentity().name == "mcl_monster_spawner:doll" then return obj end end @@ -71,11 +71,11 @@ function mobs.setup_spawner(pos, Mob, MinLight, MaxLight, MaxMobsInArea, PlayerD meta:set_string("command", "") -- Create doll - local doll = minetest.add_entity({x=pos.x, y=pos.y-0.3, z=pos.z}, "mobs:spawner_mob_doll") + local doll = minetest.add_entity({x=pos.x, y=pos.y-0.3, z=pos.z}, "mcl_monster_spawner:doll") set_doll_properties(doll, Mob) end -minetest.register_node("mobs:spawner", { +minetest.register_node("mcl_monster_spawner:spawner", { tiles = {"mob_spawner.png"}, drawtype = "glasslike", paramtype = "light", @@ -158,7 +158,7 @@ minetest.register_node("mobs:spawner", { -- Mob spawner doll (rotating icon inside cage) -local spawner_mob_doll_def = { +local doll_def = { hp_max = 1, physical = true, collisionbox = {0,0,0,0,0,0}, @@ -170,11 +170,11 @@ local spawner_mob_doll_def = { _mob = default_mob, -- name of the mob this doll represents } -spawner_mob_doll_def.get_staticdata = function(self) +doll_def.get_staticdata = function(self) return self._mob end -spawner_mob_doll_def.on_activate = function(self, staticdata, dtime_s) +doll_def.on_activate = function(self, staticdata, dtime_s) local mob = staticdata if mob == "" or mob == nil then mob = default_mob @@ -186,20 +186,20 @@ spawner_mob_doll_def.on_activate = function(self, staticdata, dtime_s) end -spawner_mob_doll_def.on_step = function(self, dtime) +doll_def.on_step = function(self, dtime) -- Check if spawner is still present. If not, delete the entity self.timer = self.timer + 0.01 local n = minetest.get_node_or_nil(self.object:getpos()) if self.timer > 1 then - if n and n.name and n.name ~= "mobs:spawner" then + if n and n.name and n.name ~= "mcl_monster_spawner:spawner" then self.object:remove() end end end -spawner_mob_doll_def.on_punch = function(self, hitter) end +doll_def.on_punch = function(self, hitter) end -minetest.register_entity("mobs:spawner_mob_doll", spawner_mob_doll_def) +minetest.register_entity("mcl_monster_spawner:doll", doll_def) @@ -208,7 +208,7 @@ local max_per_block = tonumber(minetest.setting_get("max_objects_per_block") or -- spawner abm minetest.register_abm({ label = "Monster Spawner spawning a monster", - nodenames = {"mobs:spawner"}, + nodenames = {"mcl_monster_spawner:spawner"}, interval = 10, chance = 4, catch_up = false, diff --git a/mods/ENTITIES/mcl_monster_spawner/mod.conf b/mods/ENTITIES/mcl_monster_spawner/mod.conf new file mode 100644 index 000000000..a05823914 --- /dev/null +++ b/mods/ENTITIES/mcl_monster_spawner/mod.conf @@ -0,0 +1 @@ +name = mcl_monster_spawner diff --git a/mods/ENTITIES/mobs/textures/mob_spawner.png b/mods/ENTITIES/mcl_monster_spawner/textures/mob_spawner.png similarity index 100% rename from mods/ENTITIES/mobs/textures/mob_spawner.png rename to mods/ENTITIES/mcl_monster_spawner/textures/mob_spawner.png diff --git a/mods/ENTITIES/mobs/init.lua b/mods/ENTITIES/mobs/init.lua index 52dadeeeb..6c6908bbe 100644 --- a/mods/ENTITIES/mobs/init.lua +++ b/mods/ENTITIES/mobs/init.lua @@ -8,7 +8,7 @@ dofile(path .. "/api.lua") dofile(path .. "/crafts.lua") -- Mob Spawner -dofile(path .. "/spawner.lua") +-- moved into other mod (MCL2 change) -- Lucky Blocks dofile(path .. "/lucky_block.lua")