forked from VoxeLibre/VoxeLibre
Rename "Monster Spawner" to "Mob Spawner"
This commit is contained in:
parent
cc411efe4c
commit
3cf6656df2
|
@ -3153,7 +3153,7 @@ function mobs:register_egg(mob, desc, background, addegg, no_creative)
|
||||||
groups = grp,
|
groups = grp,
|
||||||
|
|
||||||
_doc_items_longdesc = "This allows you to place a single mob.",
|
_doc_items_longdesc = "This allows you to place a single mob.",
|
||||||
_doc_items_usagehelp = "Just place it where you want the mob to appear. Animals will spawn tamed, unless you hold down the sneak key while placing. If you place this on a monster spawner, you change the monster it spawns.",
|
_doc_items_usagehelp = "Just place it where you want the mob to appear. Animals will spawn tamed, unless you hold down the sneak key while placing. If you place this on a mob spawner, you change the mob it spawns.",
|
||||||
|
|
||||||
on_place = function(itemstack, placer, pointed_thing)
|
on_place = function(itemstack, placer, pointed_thing)
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@ mcl_torches.register_torch("mesecon_torch_on", "Redstone Torch",
|
||||||
[[Redstone torches can generally be placed at the side and on the top of full solid opaque blocks. The following exceptions apply:
|
[[Redstone torches can generally be placed at the side and on the top of full solid opaque blocks. The following exceptions apply:
|
||||||
• Glass, fence, wall, hopper: Can only be placed on top
|
• Glass, fence, wall, hopper: Can only be placed on top
|
||||||
• Upside-down slab/stair: Can only be placed on top
|
• Upside-down slab/stair: Can only be placed on top
|
||||||
• Soul sand, monster spawner: Placement possible
|
• Soul sand, mob spawner: Placement possible
|
||||||
• Glowstone and pistons: No placement possible]],
|
• Glowstone and pistons: No placement possible]],
|
||||||
"jeija_torches_on.png",
|
"jeija_torches_on.png",
|
||||||
"mcl_torches_torch_floor.obj", "mcl_torches_torch_wall.obj",
|
"mcl_torches_torch_floor.obj", "mcl_torches_torch_wall.obj",
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
This mod adds a monster spawner for MineClone 2.
|
This mod adds a mob spawner for MineClone 2.
|
||||||
Monsters will appear around the monster spawner in semi-regular intervals.
|
Monsters will appear around the mob spawner in semi-regular intervals.
|
||||||
|
|
||||||
This mod is originally based on the mob spawner from Mobs Redo by TenPlus1
|
This mod is originally based on the mob spawner from Mobs Redo by TenPlus1
|
||||||
but has been modified quite a lot to fit the needs of MineClone 2.
|
but has been modified quite a lot to fit the needs of MineClone 2.
|
||||||
|
|
||||||
Players can get a monster spawner by `giveme` and is initially empty after
|
Players can get a mob spawner by `giveme` and is initially empty after
|
||||||
placing.
|
placing.
|
||||||
|
|
||||||
## Programmer notes
|
## Programmer notes
|
||||||
To set the mob spawned by a monster spawner, first place the monster spawner
|
To set the mob spawned by a mob spawner, first place the mob spawner
|
||||||
(e.g. with `minetest.set_node`), then use the function
|
(e.g. with `minetest.set_node`), then use the function
|
||||||
`mcl_mobspawners.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.
|
in `init.lua` for more info.
|
||||||
|
|
|
@ -4,7 +4,7 @@ mcl_mobspawners = {}
|
||||||
|
|
||||||
local default_mob = "mobs_mc:pig"
|
local default_mob = "mobs_mc:pig"
|
||||||
|
|
||||||
-- Monster spawner
|
-- Mob spawner
|
||||||
local spawner_default = default_mob.." 0 15 4 15"
|
local spawner_default = default_mob.." 0 15 4 15"
|
||||||
|
|
||||||
local function get_mob_textures(mob)
|
local function get_mob_textures(mob)
|
||||||
|
@ -55,7 +55,7 @@ All the arguments are optional!
|
||||||
]]
|
]]
|
||||||
|
|
||||||
function mcl_mobspawners.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
|
-- Activate mob spawner and disable editing functionality
|
||||||
if Mob == nil then Mob = default_mob end
|
if Mob == nil then Mob = default_mob end
|
||||||
if MinLight == nil then MinLight = 0 end
|
if MinLight == nil then MinLight = 0 end
|
||||||
if MaxLight == nil then MaxLight = 15 end
|
if MaxLight == nil then MaxLight = 15 end
|
||||||
|
@ -83,9 +83,9 @@ function mcl_mobspawners.setup_spawner(pos, Mob, MinLight, MaxLight, MaxMobsInAr
|
||||||
t:start(2)
|
t:start(2)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Spawn monsters around pos
|
-- Spawn mobs around pos
|
||||||
-- NOTE: The node is timer-based, rather than ABM-based.
|
-- NOTE: The node is timer-based, rather than ABM-based.
|
||||||
local spawn_monsters = function(pos, elapsed)
|
local spawn_mobs = function(pos, elapsed)
|
||||||
|
|
||||||
-- get meta
|
-- get meta
|
||||||
local meta = minetest.get_meta(pos)
|
local meta = minetest.get_meta(pos)
|
||||||
|
@ -105,7 +105,7 @@ local spawn_monsters = function(pos, elapsed)
|
||||||
|
|
||||||
-- are we spawning a registered mob?
|
-- are we spawning a registered mob?
|
||||||
if not mobs.spawning_mobs[mob] then
|
if not mobs.spawning_mobs[mob] then
|
||||||
minetest.log("error", "[mcl_mobspawners] Monster Spawner: Mob doesn't exist: "..mob)
|
minetest.log("error", "[mcl_mobspawners] Mob Spawner: Mob doesn't exist: "..mob)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -142,9 +142,9 @@ local spawn_monsters = function(pos, elapsed)
|
||||||
end
|
end
|
||||||
|
|
||||||
--[[ HACK!
|
--[[ HACK!
|
||||||
The doll may not stay spawned if the monster spawner is placed far away from
|
The doll may not stay spawned if the mob spawner is placed far away from
|
||||||
players, so we will check for its existance periodically when a player is nearby.
|
players, so we will check for its existance periodically when a player is nearby.
|
||||||
This would happen almost always when the monster spawner is placed by the mapgen.
|
This would happen almost always when the mob spawner is placed by the mapgen.
|
||||||
This is probably caused by a Minetest bug:
|
This is probably caused by a Minetest bug:
|
||||||
https://github.com/minetest/minetest/issues/4759
|
https://github.com/minetest/minetest/issues/4759
|
||||||
FIXME: Fix this horrible hack.
|
FIXME: Fix this horrible hack.
|
||||||
|
@ -203,7 +203,7 @@ local spawn_monsters = function(pos, elapsed)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- The monster spawner node.
|
-- The mob spawner node.
|
||||||
-- PLACEMENT INSTRUCTIONS:
|
-- PLACEMENT INSTRUCTIONS:
|
||||||
-- If this node is placed by a player, minetest.item_place, etc. default settings are applied
|
-- If this node is placed by a player, minetest.item_place, etc. default settings are applied
|
||||||
-- automatially.
|
-- automatially.
|
||||||
|
@ -215,9 +215,9 @@ minetest.register_node("mcl_mobspawners:spawner", {
|
||||||
paramtype = "light",
|
paramtype = "light",
|
||||||
sunlight_propagates = true,
|
sunlight_propagates = true,
|
||||||
walkable = true,
|
walkable = true,
|
||||||
description = S("Monster Spawner"),
|
description = S("Mob Spawner"),
|
||||||
_doc_items_longdesc = S("A monster spawner regularily causes mobs to appear around it while a player is nearby. Mobs are spawned regardless of the light level."),
|
_doc_items_longdesc = S("A mob spawner regularily causes mobs to appear around it while a player is nearby. Mobs are spawned regardless of the light level."),
|
||||||
_doc_items_usagehelp = S("If you have a spawn egg, you use it to change the monter to spawn. Just place the item on the monster spawner."),
|
_doc_items_usagehelp = S("If you have a spawn egg, you use it to change the monter to spawn. Just place the item on the mob spawner."),
|
||||||
groups = {pickaxey=1, material_stone=1, deco_block=1},
|
groups = {pickaxey=1, material_stone=1, deco_block=1},
|
||||||
is_ground_content = false,
|
is_ground_content = false,
|
||||||
drop = "",
|
drop = "",
|
||||||
|
@ -239,7 +239,7 @@ minetest.register_node("mcl_mobspawners:spawner", {
|
||||||
local name = placer:get_player_name()
|
local name = placer:get_player_name()
|
||||||
local privs = minetest.get_player_privs(name)
|
local privs = minetest.get_player_privs(name)
|
||||||
if not privs.maphack then
|
if not privs.maphack then
|
||||||
minetest.chat_send_player(name, "Placement denied. You need the “maphack” privilege to place monster spawners.")
|
minetest.chat_send_player(name, "Placement denied. You need the “maphack” privilege to place mob spawners.")
|
||||||
return itemstack
|
return itemstack
|
||||||
end
|
end
|
||||||
local node_under = minetest.get_node(pointed_thing.under)
|
local node_under = minetest.get_node(pointed_thing.under)
|
||||||
|
@ -264,7 +264,7 @@ minetest.register_node("mcl_mobspawners:spawner", {
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
on_timer = spawn_monsters,
|
on_timer = spawn_mobs,
|
||||||
|
|
||||||
on_receive_fields = function(pos, formname, fields, sender)
|
on_receive_fields = function(pos, formname, fields, sender)
|
||||||
|
|
||||||
|
|
|
@ -70,9 +70,8 @@ mcl_torches.register_torch = function(substring, description, doc_items_longdesc
|
||||||
-- Special allowed nodes:
|
-- Special allowed nodes:
|
||||||
-- * soul sand
|
-- * soul sand
|
||||||
-- * end portal frame (TODO)
|
-- * end portal frame (TODO)
|
||||||
-- * monster spawner
|
-- * mob spawner
|
||||||
-- * Fence, wall, glass, hopper: Only on top
|
-- * Fence, wall, glass, hopper: Only on top
|
||||||
-- * Monster spawner
|
|
||||||
-- * Slab: Only on top if upside down
|
-- * Slab: Only on top if upside down
|
||||||
-- * Stairs: Only on top if upside down
|
-- * Stairs: Only on top if upside down
|
||||||
|
|
||||||
|
@ -175,7 +174,7 @@ mcl_torches.register_torch("torch",
|
||||||
[[Torches can generally be placed on full solid opaque blocks. The following exceptions apply:
|
[[Torches can generally be placed on full solid opaque blocks. The following exceptions apply:
|
||||||
• Glass, fence, wall, hopper: Can only be placed on top
|
• Glass, fence, wall, hopper: Can only be placed on top
|
||||||
• Upside-down slab/stair: Can only be placed on top
|
• Upside-down slab/stair: Can only be placed on top
|
||||||
• Soul sand, monster spawner: Placement possible
|
• Soul sand, mob spawner: Placement possible
|
||||||
• Glowstone and pistons: No placement possible]],
|
• Glowstone and pistons: No placement possible]],
|
||||||
"default_torch_on_floor.png",
|
"default_torch_on_floor.png",
|
||||||
"mcl_torches_torch_floor.obj", "mcl_torches_torch_wall.obj",
|
"mcl_torches_torch_floor.obj", "mcl_torches_torch_wall.obj",
|
||||||
|
|
|
@ -240,7 +240,7 @@ minetest.register_on_generated(function(minp, maxp)
|
||||||
table.sort(chestSlots)
|
table.sort(chestSlots)
|
||||||
local currentChest = 1
|
local currentChest = 1
|
||||||
|
|
||||||
-- Calculate the monster spawner position, to be re-used for later
|
-- Calculate the mob spawner position, to be re-used for later
|
||||||
local spawner_pos = {x = x + math.ceil(dim.x/2), y = y+1, z = z + math.ceil(dim.z/2)}
|
local spawner_pos = {x = x + math.ceil(dim.x/2), y = y+1, z = z + math.ceil(dim.z/2)}
|
||||||
table.insert(spawner_posses, spawner_pos)
|
table.insert(spawner_posses, spawner_pos)
|
||||||
|
|
||||||
|
@ -371,7 +371,7 @@ minetest.register_on_generated(function(minp, maxp)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Monster spawners are placed seperately, too
|
-- Mob spawners are placed seperately, too
|
||||||
-- We don't want to destroy non-ground nodes
|
-- We don't want to destroy non-ground nodes
|
||||||
for s=1, #spawner_posses do
|
for s=1, #spawner_posses do
|
||||||
local sp = spawner_posses[s]
|
local sp = spawner_posses[s]
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
minetest.register_privilege("maphack", {
|
minetest.register_privilege("maphack", {
|
||||||
description = "Can place and use advanced blocks like monster spawners, command blocks and barriers.",
|
description = "Can place and use advanced blocks like mob spawners, command blocks and barriers.",
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue