From c1c15eb60bd568fadf9f5698bf31c9613638f580 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 25 May 2017 06:09:03 +0200 Subject: [PATCH] Rename mcl_monster_spawners to mcl_mobspawners. Sorry for the trouble, but the long name annoyed me. :P --- README.md | 2 +- mods/ENTITIES/mobs/api.lua | 2 ++ mods/ITEMS/REDSTONE/mesecons_mvps/init.lua | 2 +- .../README.md | 2 +- .../depends.txt | 0 .../init.lua | 18 +++++++++--------- mods/ITEMS/mcl_mobspawners/mod.conf | 1 + .../textures/mob_spawner.png | Bin mods/ITEMS/mcl_monster_spawners/mod.conf | 1 - mods/ITEMS/mcl_torches/init.lua | 2 +- mods/MAPGEN/mcl_dungeons/depends.txt | 2 +- mods/MAPGEN/mcl_dungeons/init.lua | 4 ++-- mods/MISC/mcl_wip/depends.txt | 1 - mods/MISC/mcl_wip/init.lua | 1 - 14 files changed, 19 insertions(+), 19 deletions(-) rename mods/ITEMS/{mcl_monster_spawners => mcl_mobspawners}/README.md (88%) rename mods/ITEMS/{mcl_monster_spawners => mcl_mobspawners}/depends.txt (100%) rename mods/ITEMS/{mcl_monster_spawners => mcl_mobspawners}/init.lua (92%) create mode 100644 mods/ITEMS/mcl_mobspawners/mod.conf rename mods/ITEMS/{mcl_monster_spawners => mcl_mobspawners}/textures/mob_spawner.png (100%) delete mode 100644 mods/ITEMS/mcl_monster_spawners/mod.conf diff --git a/README.md b/README.md index 68e7c547f1..18eb671435 100644 --- a/README.md +++ b/README.md @@ -62,7 +62,7 @@ map builders. They can not be obtained in-game or in the creative inventory. * Barrier: `mcl_core:barrier` * Command Block: `mesecons_commandblock:commandblock_off` -* Monster Spawner (WIP): `mcl_monster_spawners:spawner` +* Monster Spawner (WIP): `mcl_mobspawners:spawner` * Huge mushroom blocks: See `mods/ITEMS/mcl_mushrooms/README.md` Use the `/giveme` chat command to obtain them. See the in-game help for diff --git a/mods/ENTITIES/mobs/api.lua b/mods/ENTITIES/mobs/api.lua index a9c290e7b3..367b499803 100644 --- a/mods/ENTITIES/mobs/api.lua +++ b/mods/ENTITIES/mobs/api.lua @@ -2842,6 +2842,8 @@ function mobs:register_egg(mob, desc, background, addegg, no_creative) inventory_image = invimg, groups = grp, + _mobs_spawns_mob = mob, + on_place = function(itemstack, placer, pointed_thing) -- Call on_rightclick if the pointed node defines it diff --git a/mods/ITEMS/REDSTONE/mesecons_mvps/init.lua b/mods/ITEMS/REDSTONE/mesecons_mvps/init.lua index 6037ea6c16..1a2facce16 100644 --- a/mods/ITEMS/REDSTONE/mesecons_mvps/init.lua +++ b/mods/ITEMS/REDSTONE/mesecons_mvps/init.lua @@ -192,7 +192,7 @@ mesecon:register_mvps_stopper("mcl_anvils:anvil") mesecon:register_mvps_stopper("mcl_anvils:anvil_damage_1") mesecon:register_mvps_stopper("mcl_anvils:anvil_damage_2") mesecon:register_mvps_stopper("mcl_jukebox:jukebox") -mesecon:register_mvps_stopper("mcl_monster_spawners:spawner") +mesecon:register_mvps_stopper("mcl_mobspawners:spawner") mesecon:register_mvps_stopper("signs:sign_yard") mesecon:register_mvps_stopper("signs:sign_wall") mesecon:register_mvps_stopper("mesecons_commandblock:commandblock_off") diff --git a/mods/ITEMS/mcl_monster_spawners/README.md b/mods/ITEMS/mcl_mobspawners/README.md similarity index 88% rename from mods/ITEMS/mcl_monster_spawners/README.md rename to mods/ITEMS/mcl_mobspawners/README.md index 311b664e7a..12cc5aee3b 100644 --- a/mods/ITEMS/mcl_monster_spawners/README.md +++ b/mods/ITEMS/mcl_mobspawners/README.md @@ -10,7 +10,7 @@ placing. ## Programmer notes To set the mob spawned by a monster spawner, first place the monster spawner (e.g. with `minetest.set_node`), then use the function -`mcl_monster_spawner.setup_spawner` to set its attributes. See the comment +`mcl_mobspawners.setup_spawner` to set its attributes. See the comment in `init.lua` for more info. ## License (code and texture) diff --git a/mods/ITEMS/mcl_monster_spawners/depends.txt b/mods/ITEMS/mcl_mobspawners/depends.txt similarity index 100% rename from mods/ITEMS/mcl_monster_spawners/depends.txt rename to mods/ITEMS/mcl_mobspawners/depends.txt diff --git a/mods/ITEMS/mcl_monster_spawners/init.lua b/mods/ITEMS/mcl_mobspawners/init.lua similarity index 92% rename from mods/ITEMS/mcl_monster_spawners/init.lua rename to mods/ITEMS/mcl_mobspawners/init.lua index efa4ba5ac5..0e5dd8eb63 100644 --- a/mods/ITEMS/mcl_monster_spawners/init.lua +++ b/mods/ITEMS/mcl_mobspawners/init.lua @@ -1,6 +1,6 @@ local S = mobs.intllib -mcl_monster_spawners = {} +mcl_mobspawners = {} local default_mob = "mobs_mc:pig" @@ -15,7 +15,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 == "mcl_monster_spawners:doll" then + if obj ~= nil and obj:get_luaentity().name == "mcl_mobspawners:doll" then return obj end end @@ -52,7 +52,7 @@ All the arguments are optional! * YOffset: Y offset to spawn mobs; 0 to disable (default: 0) ]] -function mcl_monster_spawners.setup_spawner(pos, Mob, MinLight, MaxLight, MaxMobsInArea, PlayerDistance, YOffset) +function mcl_mobspawners.setup_spawner(pos, Mob, MinLight, MaxLight, MaxMobsInArea, PlayerDistance, YOffset) -- Activate monster spawner and disable editing functionality if Mob == nil then Mob = default_mob end if MinLight == nil then MinLight = 0 end @@ -69,7 +69,7 @@ function mcl_monster_spawners.setup_spawner(pos, Mob, MinLight, MaxLight, MaxMob meta:set_int("YOffset", YOffset) -- Create doll - local doll = minetest.add_entity({x=pos.x, y=pos.y-0.3, z=pos.z}, "mcl_monster_spawners:doll") + local doll = minetest.add_entity({x=pos.x, y=pos.y-0.3, z=pos.z}, "mcl_mobspawners:doll") set_doll_properties(doll, Mob) -- Start spawning very soon @@ -183,7 +183,7 @@ local spawn_monsters = function(pos, elapsed) end -minetest.register_node("mcl_monster_spawners:spawner", { +minetest.register_node("mcl_mobspawners:spawner", { tiles = {"mob_spawner.png"}, drawtype = "glasslike", paramtype = "light", @@ -195,7 +195,7 @@ minetest.register_node("mcl_monster_spawners:spawner", { is_ground_content = false, drop = "", - on_construct = mcl_monster_spawners.setup_spawner, + on_construct = mcl_mobspawners.setup_spawner, on_destruct = function(pos) local meta = minetest.get_meta(pos) @@ -236,7 +236,7 @@ minetest.register_node("mcl_monster_spawners:spawner", { and pla and pla >=0 and pla <= 20 and yof and yof > -10 and yof < 10 then - mcl_monster_spawners.setup_spawner(pos, mob, mlig, xlig, num, pla, yof) + mcl_mobspawners.setup_spawner(pos, mob, mlig, xlig, num, pla, yof) else minetest.chat_send_player(name, S("Mob Spawner settings failed!")) minetest.chat_send_player(name, @@ -283,7 +283,7 @@ doll_def.on_step = function(self, dtime) 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 ~= "mcl_monster_spawners:spawner" then + if n and n.name and n.name ~= "mcl_mobspawners:spawner" then self.object:remove() end end @@ -291,7 +291,7 @@ end doll_def.on_punch = function(self, hitter) end -minetest.register_entity("mcl_monster_spawners:doll", doll_def) +minetest.register_entity("mcl_mobspawners:doll", doll_def) diff --git a/mods/ITEMS/mcl_mobspawners/mod.conf b/mods/ITEMS/mcl_mobspawners/mod.conf new file mode 100644 index 0000000000..36112bf369 --- /dev/null +++ b/mods/ITEMS/mcl_mobspawners/mod.conf @@ -0,0 +1 @@ +name = mcl_mobspawners diff --git a/mods/ITEMS/mcl_monster_spawners/textures/mob_spawner.png b/mods/ITEMS/mcl_mobspawners/textures/mob_spawner.png similarity index 100% rename from mods/ITEMS/mcl_monster_spawners/textures/mob_spawner.png rename to mods/ITEMS/mcl_mobspawners/textures/mob_spawner.png diff --git a/mods/ITEMS/mcl_monster_spawners/mod.conf b/mods/ITEMS/mcl_monster_spawners/mod.conf deleted file mode 100644 index 5ec12b8063..0000000000 --- a/mods/ITEMS/mcl_monster_spawners/mod.conf +++ /dev/null @@ -1 +0,0 @@ -name = mcl_monster_spawners diff --git a/mods/ITEMS/mcl_torches/init.lua b/mods/ITEMS/mcl_torches/init.lua index 3160f7cf0f..eaf680c52f 100644 --- a/mods/ITEMS/mcl_torches/init.lua +++ b/mods/ITEMS/mcl_torches/init.lua @@ -79,7 +79,7 @@ mcl_torches.register_torch = function(substring, description, doc_items_longdesc -- * Piston -- * Sticky piston if not def.buildable_to then - if node.name ~= "mcl_nether:soul_sand" and node.name ~= "mcl_monster_spawners:spawner" and + if node.name ~= "mcl_nether:soul_sand" and node.name ~= "mcl_mobspawners:spawner" and ((not def.groups.solid) or (not def.groups.opaque)) then -- Only allow top placement on these nodes if def.groups.glass or node.name == "mcl_hoppers:hopper" or node.name == "mcl_hoppers:hopper_side" or def.groups.fence or def.groups.wall then diff --git a/mods/MAPGEN/mcl_dungeons/depends.txt b/mods/MAPGEN/mcl_dungeons/depends.txt index 9ae82209cb..9f3c4e9f16 100644 --- a/mods/MAPGEN/mcl_dungeons/depends.txt +++ b/mods/MAPGEN/mcl_dungeons/depends.txt @@ -1,5 +1,5 @@ mcl_init mcl_core mcl_chests -mcl_monster_spawners +mcl_mobspawners mobs_mc diff --git a/mods/MAPGEN/mcl_dungeons/init.lua b/mods/MAPGEN/mcl_dungeons/init.lua index dbc92f844b..b48b5ba118 100644 --- a/mods/MAPGEN/mcl_dungeons/init.lua +++ b/mods/MAPGEN/mcl_dungeons/init.lua @@ -329,7 +329,7 @@ minetest.register_on_generated(function(minp, maxp) if minetest.registered_nodes[n].is_ground_content then -- ... and place it and select a random mob - minetest.set_node(sp, {name = "mcl_monster_spawners:spawner"}) + minetest.set_node(sp, {name = "mcl_mobspawners:spawner"}) local mobs = { "mobs_mc:zombie", "mobs_mc:zombie", @@ -338,7 +338,7 @@ minetest.register_on_generated(function(minp, maxp) } local spawner_mob = mobs[math.random(1, #mobs)] - mcl_monster_spawners.setup_spawner(sp, spawner_mob) + mcl_mobspawners.setup_spawner(sp, spawner_mob) end end diff --git a/mods/MISC/mcl_wip/depends.txt b/mods/MISC/mcl_wip/depends.txt index 4a7f58cd2d..b73aea4360 100644 --- a/mods/MISC/mcl_wip/depends.txt +++ b/mods/MISC/mcl_wip/depends.txt @@ -11,4 +11,3 @@ gemalde signs mcl_observers doc_identifier -mcl_monster_spawners diff --git a/mods/MISC/mcl_wip/init.lua b/mods/MISC/mcl_wip/init.lua index bccaa2cc3b..e094550dc1 100644 --- a/mods/MISC/mcl_wip/init.lua +++ b/mods/MISC/mcl_wip/init.lua @@ -26,7 +26,6 @@ local wip_items = { "mcl_observers:observer", "mcl_chests:trapped_chest", "mcl_core:cobweb", - "mcl_monster_spawners:spawner", } for i=1,#wip_items do