pyramids spawning (BlockMen), environmental spawners
This commit is contained in:
parent
80f72575fa
commit
2d2c12aa2c
28
API.lua
28
API.lua
@ -12,10 +12,7 @@ for k, mob_mod in ipairs(ENABLED_MODS) do
|
|||||||
|
|
||||||
if mob_mod == "mobs" and not (mobs.mod == "redo") then goto continue end
|
if mob_mod == "mobs" and not (mobs.mod == "redo") then goto continue end
|
||||||
|
|
||||||
-- include spawners mob addons
|
table.insert(spawners.mob_tables, {name=mob.name, mod_prefix=mob_mod, egg_name_custom=mob.egg_name_custom, dummy_size=mob.dummy_size, dummy_offset=mob.dummy_offset, dummy_mesh=mob.dummy_mesh, dummy_texture=mob.dummy_texture, night_only=mob.night_only, sound_custom=mob.sound_custom, env=mob.env})
|
||||||
dofile(minetest.get_modpath("spawners").."/mob_mummy.lua")
|
|
||||||
|
|
||||||
table.insert(spawners.mob_tables, {name=mob.name, mod_prefix=mob_mod, egg_name_custom=mob.egg_name_custom, dummy_size=mob.dummy_size, dummy_offset=mob.dummy_offset, dummy_mesh=mob.dummy_mesh, dummy_texture=mob.dummy_texture, night_only=mob.night_only, sound_custom=mob.sound_custom})
|
|
||||||
|
|
||||||
-- use custom egg or create a default egg
|
-- use custom egg or create a default egg
|
||||||
if mob.egg_name_custom ~= "" then
|
if mob.egg_name_custom ~= "" then
|
||||||
@ -24,25 +21,28 @@ for k, mob_mod in ipairs(ENABLED_MODS) do
|
|||||||
mob_egg = mob_mod..":"..mob.name
|
mob_egg = mob_mod..":"..mob.name
|
||||||
end
|
end
|
||||||
|
|
||||||
-- recipes
|
-- recipes - not for environmental spawners
|
||||||
minetest.register_craft({
|
if not mob.env then
|
||||||
output = "spawners:"..mob_mod.."_"..mob.name.."_spawner",
|
minetest.register_craft({
|
||||||
recipe = {
|
output = "spawners:"..mob_mod.."_"..mob.name.."_spawner",
|
||||||
{"default:diamondblock", "fake_fire:flint_and_steel", "default:diamondblock"},
|
recipe = {
|
||||||
{"xpanes:bar", mob_egg, "xpanes:bar"},
|
{"default:diamondblock", "fake_fire:flint_and_steel", "default:diamondblock"},
|
||||||
{"default:diamondblock", "xpanes:bar", "default:diamondblock"},
|
{"xpanes:bar", mob_egg, "xpanes:bar"},
|
||||||
}
|
{"default:diamondblock", "xpanes:bar", "default:diamondblock"},
|
||||||
})
|
}
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
::continue::
|
::continue::
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
-- print something ?
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- start spawning mobs
|
-- start spawning mobs
|
||||||
function spawners.start_spawning(pos, how_many, mob_name, mod_prefix, sound_custom)
|
function spawners.start_spawning(pos, how_many, mob_name, mod_prefix, sound_custom)
|
||||||
if not pos or not how_many or not mob_name then return end
|
if not (pos or how_many or mob_name) then return end
|
||||||
|
|
||||||
local sound_name
|
local sound_name
|
||||||
-- remove 'spawners:' from the string
|
-- remove 'spawners:' from the string
|
||||||
|
50
config.lua
50
config.lua
@ -17,24 +17,11 @@
|
|||||||
-- [*] -> MANDATORY - has to be filled in!
|
-- [*] -> MANDATORY - has to be filled in!
|
||||||
|
|
||||||
-- mods what should be enabled and loded, remove/add the one you want to load
|
-- mods what should be enabled and loded, remove/add the one you want to load
|
||||||
ENABLED_MODS = {"mobs", "pyramids", "creatures", "spawners"}
|
ENABLED_MODS = {"mobs", "pyramids", "creatures"}
|
||||||
|
|
||||||
-- mobs properties - setup all you mobs here
|
-- mobs properties - setup all you mobs here
|
||||||
MOBS_PROPS = {
|
MOBS_PROPS = {
|
||||||
|
|
||||||
["spawners"] = { -- SPAWNERS (THIS) MOD CONFIG
|
|
||||||
{
|
|
||||||
name="mummy",
|
|
||||||
egg_name_custom="",
|
|
||||||
dummy_size={x=0.4,y=0.4},
|
|
||||||
dummy_offset=0,
|
|
||||||
dummy_mesh="spawners_mob_mummy.b3d",
|
|
||||||
dummy_texture={"spawners_mob_mummy.png"},
|
|
||||||
night_only="disable",
|
|
||||||
sound_custom="spawners_mob_mummy"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
["mobs"] = { -- MOBS REDO CONFIG
|
["mobs"] = { -- MOBS REDO CONFIG
|
||||||
{
|
{
|
||||||
name="sheep_white",
|
name="sheep_white",
|
||||||
@ -204,3 +191,38 @@ MOBS_PROPS = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
-- check for 3rd party dependencies
|
||||||
|
--
|
||||||
|
|
||||||
|
-- include mummy mobs redo addon (spawner)
|
||||||
|
if minetest.get_modpath("mobs") then
|
||||||
|
-- enable spawner
|
||||||
|
table.insert(ENABLED_MODS, "spawners")
|
||||||
|
|
||||||
|
-- configure spawner
|
||||||
|
MOBS_PROPS["spawners"] = {
|
||||||
|
{
|
||||||
|
name="mummy",
|
||||||
|
egg_name_custom="",
|
||||||
|
dummy_size={x=0.4,y=0.4},
|
||||||
|
dummy_offset=0,
|
||||||
|
dummy_mesh="spawners_mob_mummy.b3d",
|
||||||
|
dummy_texture={"spawners_mob_mummy.png"},
|
||||||
|
night_only="disable",
|
||||||
|
sound_custom="spawners_mob_mummy"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name="mummy",
|
||||||
|
egg_name_custom="",
|
||||||
|
dummy_size={x=0.4,y=0.4},
|
||||||
|
dummy_offset=0,
|
||||||
|
dummy_mesh="spawners_mob_mummy.b3d",
|
||||||
|
dummy_texture={"spawners_mob_mummy.png"},
|
||||||
|
night_only="disable",
|
||||||
|
sound_custom="spawners_mob_mummy",
|
||||||
|
env=true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
end
|
@ -1,6 +1,5 @@
|
|||||||
default
|
default
|
||||||
mobs?
|
mobs?
|
||||||
creatures?
|
creatures?
|
||||||
pyramids?
|
|
||||||
fake_fire?
|
fake_fire?
|
||||||
xpanes?
|
xpanes?
|
||||||
|
8
init.lua
8
init.lua
@ -1,10 +1,16 @@
|
|||||||
-- user settings
|
-- user settings
|
||||||
dofile(minetest.get_modpath("spawners").."/config.lua")
|
dofile(minetest.get_modpath("spawners").."/config.lua")
|
||||||
|
|
||||||
-- API
|
-- API
|
||||||
dofile(minetest.get_modpath("spawners").."/API.lua")
|
dofile(minetest.get_modpath("spawners").."/API.lua")
|
||||||
|
|
||||||
-- Spawners for mobs
|
-- Spawners for mobs
|
||||||
dofile(minetest.get_modpath("spawners").."/spawners_mobs.lua")
|
dofile(minetest.get_modpath("spawners").."/spawners_mobs.lua")
|
||||||
|
|
||||||
-- Spawners for ores
|
-- Spawners for ores
|
||||||
dofile(minetest.get_modpath("spawners").."/spawners_ores.lua")
|
dofile(minetest.get_modpath("spawners").."/spawners_ores.lua")
|
||||||
|
|
||||||
print ("[Mod] Spawners 0.5 Loaded.")
|
-- Spawners Pyramids
|
||||||
|
dofile(minetest.get_modpath("spawners").."/pyramids.lua")
|
||||||
|
|
||||||
|
print ("[Mod] Spawners 0.6 Loaded.")
|
247
pyramids.lua
Normal file
247
pyramids.lua
Normal file
@ -0,0 +1,247 @@
|
|||||||
|
-- Pyramids by BlockMen
|
||||||
|
|
||||||
|
pyramids = {}
|
||||||
|
|
||||||
|
dofile(minetest.get_modpath("spawners").."/pyramids_nodes.lua")
|
||||||
|
dofile(minetest.get_modpath("spawners").."/pyramids_room.lua")
|
||||||
|
|
||||||
|
-- include mummy mobs redo addon
|
||||||
|
if minetest.get_modpath("mobs") then
|
||||||
|
dofile(minetest.get_modpath("spawners").."/mob_mummy.lua")
|
||||||
|
end
|
||||||
|
|
||||||
|
local chest_stuff = {
|
||||||
|
{name="default:apple", max = 3},
|
||||||
|
{name="default:torch", max = 10},
|
||||||
|
{name="default:aspen_sapling", max = 5},
|
||||||
|
{name="farming:bread", max = 3},
|
||||||
|
{name="default:steel_ingot", max = 2},
|
||||||
|
{name="default:gold_ingot", max = 2},
|
||||||
|
{name="default:bronze_ingot", max = 2},
|
||||||
|
{name="default:copper_ingot", max = 2},
|
||||||
|
{name="default:diamond", max = 1},
|
||||||
|
{name="default:pick_steel", max = 1},
|
||||||
|
{name="default:pick_diamond", max = 1},
|
||||||
|
{name="default:pick_bronze", max = 1},
|
||||||
|
{name="default:pick_mese", max = 1},
|
||||||
|
{name="default:pick_stone", max = 1},
|
||||||
|
{name="default:pick_wood", max = 1},
|
||||||
|
{name="default:sword_bronze", max = 1},
|
||||||
|
{name="default:sword_diamond", max = 1},
|
||||||
|
{name="default:sword_mese", max = 1},
|
||||||
|
{name="default:sword_steel", max = 1},
|
||||||
|
{name="default:sword_stone", max = 1},
|
||||||
|
{name="default:sword_wood", max = 1},
|
||||||
|
{name="default:shovel_bronze", max = 1},
|
||||||
|
{name="default:shovel_diamond", max = 1},
|
||||||
|
{name="default:shovel_mese", max = 1},
|
||||||
|
{name="default:shovel_steel", max = 1},
|
||||||
|
{name="default:shovel_stone", max = 1},
|
||||||
|
{name="default:shovel_wood", max = 1},
|
||||||
|
{name="default:axe_bronze", max = 1},
|
||||||
|
{name="default:axe_diamond", max = 1},
|
||||||
|
{name="default:axe_mese", max = 1},
|
||||||
|
{name="default:axe_steel", max = 1},
|
||||||
|
{name="default:axe_stone", max = 1},
|
||||||
|
{name="default:axe_wood", max = 1},
|
||||||
|
}
|
||||||
|
|
||||||
|
function pyramids.fill_chest(pos)
|
||||||
|
minetest.after(2, function()
|
||||||
|
local n = minetest.get_node(pos)
|
||||||
|
if n and n.name and n.name == "default:chest" then
|
||||||
|
local meta = minetest.get_meta(pos)
|
||||||
|
local inv = meta:get_inventory()
|
||||||
|
inv:set_size("main", 8*4)
|
||||||
|
if math.random(1,10) < 5 then return end
|
||||||
|
for i=0,2,1 do
|
||||||
|
local stuff = chest_stuff[math.random(1,#chest_stuff)]
|
||||||
|
if stuff.name == "farming:bread" and not minetest.get_modpath("farming") then stuff = chest_stuff[1] end
|
||||||
|
local stack = {name=stuff.name, count = math.random(1,stuff.max)}
|
||||||
|
if not inv:contains_item("main", stack) then
|
||||||
|
inv:set_stack("main", math.random(1,32), stack)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
|
function pyramids.spawn_mummy(pos, number)
|
||||||
|
-- needs mobs redo
|
||||||
|
if minetest.get_modpath("mobs") then
|
||||||
|
for i=0,number do
|
||||||
|
minetest.add_entity(pos,"spawners:mummy")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function add_spawner(pos)
|
||||||
|
-- needs mobs redo
|
||||||
|
if minetest.get_modpath("mobs") then
|
||||||
|
minetest.set_node(pos, {name="spawners:spawners_mummy_spawner_env"})
|
||||||
|
|
||||||
|
if not minetest.setting_getbool("only_peaceful_mobs") then pyramids.spawn_mummy({x=pos.x,y=pos.y,z=pos.z-2},2)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function can_replace(pos)
|
||||||
|
local n = minetest.get_node_or_nil(pos)
|
||||||
|
if n and n.name and minetest.registered_nodes[n.name] and not minetest.registered_nodes[n.name].walkable then
|
||||||
|
return true
|
||||||
|
elseif not n then
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function underground(pos)
|
||||||
|
local p2 = pos
|
||||||
|
local cnt = 0
|
||||||
|
local mat = "desert_sand"
|
||||||
|
p2.y = p2.y-1
|
||||||
|
while can_replace(p2)==true do
|
||||||
|
cnt = cnt+1
|
||||||
|
if cnt > 25 then break end
|
||||||
|
if cnt>math.random(2,4) then mat = "desert_stone"end
|
||||||
|
minetest.set_node(p2, {name="default:"..mat})
|
||||||
|
p2.y = p2.y-1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function make_entrance(pos)
|
||||||
|
local gang = {x=pos.x+10,y=pos.y, z=pos.z}
|
||||||
|
for iy=2,3,1 do
|
||||||
|
for iz=0,6,1 do
|
||||||
|
minetest.remove_node({x=gang.x+1,y=gang.y+iy,z=gang.z+iz})
|
||||||
|
if iz >=3 and iy == 3 then
|
||||||
|
minetest.set_node({x=gang.x,y=gang.y+iy+1,z=gang.z+iz}, {name="default:sandstonebrick"})
|
||||||
|
minetest.set_node({x=gang.x+1,y=gang.y+iy+1,z=gang.z+iz}, {name="default:sandstonebrick"})
|
||||||
|
minetest.set_node({x=gang.x+2,y=gang.y+iy+1,z=gang.z+iz}, {name="default:sandstonebrick"})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local function make(pos)
|
||||||
|
minetest.log("action", "Created pyramid at ("..pos.x..","..pos.y..","..pos.z..")")
|
||||||
|
for iy=0,10,1 do
|
||||||
|
for ix=iy,22-iy,1 do
|
||||||
|
for iz=iy,22-iy,1 do
|
||||||
|
if iy <1 then underground({x=pos.x+ix,y=pos.y,z=pos.z+iz}) end
|
||||||
|
minetest.set_node({x=pos.x+ix,y=pos.y+iy,z=pos.z+iz}, {name="default:sandstonebrick"})
|
||||||
|
for yy=1,10-iy,1 do
|
||||||
|
local n = minetest.get_node({x=pos.x+ix,y=pos.y+iy+yy,z=pos.z+iz})
|
||||||
|
if n and n.name and n.name == "default:desert_stone" then minetest.set_node({x=pos.x+ix,y=pos.y+iy+yy,z=pos.z+iz},{name="default:desert_sand"}) end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
pyramids.make_room(pos)
|
||||||
|
minetest.after(2, pyramids.make_traps, pos)
|
||||||
|
|
||||||
|
-- needs mobs redo
|
||||||
|
if minetest.get_modpath("mobs") then
|
||||||
|
add_spawner({x=pos.x+11,y=pos.y+2, z=pos.z+16})
|
||||||
|
end
|
||||||
|
|
||||||
|
make_entrance({x=pos.x,y=pos.y, z=pos.z})
|
||||||
|
end
|
||||||
|
|
||||||
|
local perl1 = {SEED1 = 9130, OCTA1 = 3, PERS1 = 0.5, SCAL1 = 250} -- Values should match minetest mapgen V6 desert noise.
|
||||||
|
|
||||||
|
local function hlp_fnct(pos, name)
|
||||||
|
local n = minetest.get_node_or_nil(pos)
|
||||||
|
if n and n.name and n.name == name then
|
||||||
|
return true
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local function ground(pos, old)
|
||||||
|
local p2 = pos
|
||||||
|
while hlp_fnct(p2, "air") do
|
||||||
|
p2.y = p2.y -1
|
||||||
|
end
|
||||||
|
if p2.y < old.y then
|
||||||
|
return p2
|
||||||
|
else
|
||||||
|
return old
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_on_generated(function(minp, maxp, seed)
|
||||||
|
if maxp.y < 0 then return end
|
||||||
|
math.randomseed(seed)
|
||||||
|
local cnt = 0
|
||||||
|
|
||||||
|
local perlin1 = minetest.get_perlin(perl1.SEED1, perl1.OCTA1, perl1.PERS1, perl1.SCAL1)
|
||||||
|
local noise1 = perlin1:get2d({x=minp.x,y=minp.y})--,z=minp.z})
|
||||||
|
|
||||||
|
if noise1 > 0.25 or noise1 < -0.26 then
|
||||||
|
local mpos = {x=math.random(minp.x,maxp.x), y=math.random(minp.y,maxp.y), z=math.random(minp.z,maxp.z)}
|
||||||
|
|
||||||
|
local p2 = minetest.find_node_near(mpos, 25, {"default:desert_sand"})
|
||||||
|
while p2 == nil and cnt < 5 do
|
||||||
|
cnt = cnt+1
|
||||||
|
mpos = {x=math.random(minp.x,maxp.x), y=math.random(minp.y,maxp.y), z=math.random(minp.z,maxp.z)}
|
||||||
|
p2 = minetest.find_node_near(mpos, 25, {"default:desert_sand"})
|
||||||
|
end
|
||||||
|
if p2 == nil then return end
|
||||||
|
if p2.y < 0 then return end
|
||||||
|
|
||||||
|
local off = 0
|
||||||
|
local opos1 = {x=p2.x+22,y=p2.y-1,z=p2.z+22}
|
||||||
|
local opos2 = {x=p2.x+22,y=p2.y-1,z=p2.z}
|
||||||
|
local opos3 = {x=p2.x,y=p2.y-1,z=p2.z+22}
|
||||||
|
local opos1_n = minetest.get_node_or_nil(opos1)
|
||||||
|
local opos2_n = minetest.get_node_or_nil(opos2)
|
||||||
|
local opos3_n = minetest.get_node_or_nil(opos3)
|
||||||
|
if opos1_n and opos1_n.name and opos1_n.name == "air" then
|
||||||
|
p2 = ground(opos1, p2)
|
||||||
|
end
|
||||||
|
if opos2_n and opos2_n.name and opos2_n.name == "air" then
|
||||||
|
p2 = ground(opos2, p2)
|
||||||
|
end
|
||||||
|
if opos3_n and opos3_n.name and opos3_n.name == "air" then
|
||||||
|
p2 = ground(opos3, p2)
|
||||||
|
end
|
||||||
|
p2.y = p2.y - 3
|
||||||
|
if p2.y < 0 then p2.y = 0 end
|
||||||
|
if minetest.find_node_near(p2, 25, {"default:water_source"}) ~= nil or minetest.find_node_near(p2, 22, {"default:dirt_with_grass"}) ~= nil or minetest.find_node_near(p2, 52, {"default:sandstonebrick"}) ~= nil then return end
|
||||||
|
|
||||||
|
if math.random(0,10) > 7 then return end
|
||||||
|
minetest.after(0.8,make,p2)
|
||||||
|
end
|
||||||
|
end)
|
||||||
|
|
||||||
|
--
|
||||||
|
-- backwards compatibility
|
||||||
|
--
|
||||||
|
|
||||||
|
-- spawner mummy
|
||||||
|
minetest.register_alias("pyramids:spawner_mummy", "spawners:spawners_mummy_spawner_env")
|
||||||
|
-- minetest.register_alias("pyramids:mummy_spawner", "spawners:spawners_mummy_spawner_env")
|
||||||
|
|
||||||
|
-- spawn egg
|
||||||
|
minetest.register_alias("pyramids:spawn_egg", "spawners:mummy")
|
||||||
|
|
||||||
|
-- mummy entity
|
||||||
|
minetest.register_alias("pyramids:mummy", "spawners:mummy")
|
||||||
|
|
||||||
|
-- deco stone 1
|
||||||
|
minetest.register_alias("pyramids:deco_stone1", "spawners:deco_stone1")
|
||||||
|
|
||||||
|
-- deco stone 2
|
||||||
|
minetest.register_alias("pyramids:deco_stone2", "spawners:deco_stone2")
|
||||||
|
|
||||||
|
-- deco stone 3
|
||||||
|
minetest.register_alias("pyramids:deco_stone3", "spawners:deco_stone3")
|
||||||
|
|
||||||
|
-- deco trap
|
||||||
|
minetest.register_alias("pyramids:trap", "spawners:trap")
|
||||||
|
|
||||||
|
-- deco trap 2
|
||||||
|
minetest.register_alias("pyramids:trap_2", "spawners:trap_2")
|
50
pyramids_nodes.lua
Normal file
50
pyramids_nodes.lua
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
local img = {"eye", "men", "sun"}
|
||||||
|
|
||||||
|
for i=1,3 do
|
||||||
|
minetest.register_node("spawners:deco_stone"..i, {
|
||||||
|
description = "Sandstone with "..img[i],
|
||||||
|
tiles = {"default_sandstone.png^pyramids_"..img[i]..".png"},
|
||||||
|
is_ground_content = true,
|
||||||
|
groups = {crumbly=2,cracky=3},
|
||||||
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
trap_on_timer = function (pos, elapsed)
|
||||||
|
local objs = minetest.get_objects_inside_radius(pos, 2)
|
||||||
|
for i, obj in pairs(objs) do
|
||||||
|
if obj:is_player() then
|
||||||
|
local n = minetest.get_node(pos)
|
||||||
|
if n and n.name then
|
||||||
|
if minetest.registered_nodes[n.name].crack and minetest.registered_nodes[n.name].crack < 2 then
|
||||||
|
minetest.set_node(pos, {name="spawners:trap_2"})
|
||||||
|
nodeupdate(pos)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return true
|
||||||
|
end
|
||||||
|
|
||||||
|
minetest.register_node("spawners:trap", {
|
||||||
|
description = "Cracked sandstone brick",
|
||||||
|
tiles = {"default_sandstone_brick.png^pyramids_crack.png"},
|
||||||
|
is_ground_content = true,
|
||||||
|
groups = {crumbly=2,cracky=3},
|
||||||
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
on_construct = function(pos)
|
||||||
|
minetest.get_node_timer(pos):start(0.1)
|
||||||
|
end,
|
||||||
|
crack = 1,
|
||||||
|
on_timer = trap_on_timer,
|
||||||
|
drop = "",
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_node("spawners:trap_2", {
|
||||||
|
description = "trapstone",
|
||||||
|
tiles = {"default_sandstone_brick.png^pyramids_crack.png^[transformR90"},
|
||||||
|
is_ground_content = true,
|
||||||
|
groups = {crumbly=2,cracky=3,falling_node=1,not_in_creative_inventory=1},
|
||||||
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
drop = "",
|
||||||
|
})
|
78
pyramids_room.lua
Normal file
78
pyramids_room.lua
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
local room = {"a","a","a","a","a","a","a","a","a",
|
||||||
|
"a","c","a","c","a","c","a","c","a",
|
||||||
|
"a","s","a","s","a","s","a","s","a",
|
||||||
|
"a","a","a","a","a","a","a","a","a",
|
||||||
|
"a","a","a","a","a","a","a","a","a",
|
||||||
|
"a","a","a","a","a","a","a","a","a",
|
||||||
|
"a","s","a","s","a","s","a","s","a",
|
||||||
|
"a","c","a","c","a","c","a","c","a",
|
||||||
|
"a","a","a","a","a","a","a","a","a"}
|
||||||
|
|
||||||
|
local trap = {"b","b","b","b","b","b","b","b","b",
|
||||||
|
"l","b","l","b","l","b","l","b","b",
|
||||||
|
"l","b","l","b","l","b","l","b","b",
|
||||||
|
"l","b","l","l","l","b","l","l","b",
|
||||||
|
"l","l","b","l","b","l","l","b","b",
|
||||||
|
"l","b","l","l","l","l","l","l","b",
|
||||||
|
"l","b","l","b","l","b","l","b","b",
|
||||||
|
"l","b","l","b","l","b","l","b","b",
|
||||||
|
"b","b","b","b","b","b","b","b","b"}
|
||||||
|
|
||||||
|
local code = {}
|
||||||
|
code["s"] = "sandstone"
|
||||||
|
code["eye"] = "deco_stone1"
|
||||||
|
code["men"] = "deco_stone2"
|
||||||
|
code["sun"] = "deco_stone3"
|
||||||
|
code["c"] = "chest"
|
||||||
|
code["b"] = "sandstonebrick"
|
||||||
|
code["a"] = "air"
|
||||||
|
code["l"] = "lava_source"
|
||||||
|
code["t"] = "trap"
|
||||||
|
|
||||||
|
local function replace(str,iy)
|
||||||
|
local out = "default:"
|
||||||
|
if iy < 4 and str == "c" then str = "a" end
|
||||||
|
if iy == 0 and str == "s" then out = "spawners:" str = "sun" end
|
||||||
|
if iy == 3 and str == "s" then out = "spawners:" str = "men" end
|
||||||
|
if str == "a" then out = "" end
|
||||||
|
return out..code[str]
|
||||||
|
end
|
||||||
|
|
||||||
|
local function replace2(str,iy)
|
||||||
|
local out = "default:"
|
||||||
|
if iy == 0 and str == "l" then out = "spawners:" str = "t"
|
||||||
|
elseif iy < 3 and str == "l" then str = "a" end
|
||||||
|
|
||||||
|
if str == "a" then out = "" end
|
||||||
|
return out..code[str]
|
||||||
|
end
|
||||||
|
|
||||||
|
function pyramids.make_room(pos)
|
||||||
|
local loch = {x=pos.x+7,y=pos.y+5, z=pos.z+7}
|
||||||
|
for iy=0,4,1 do
|
||||||
|
for ix=0,8,1 do
|
||||||
|
for iz=0,8,1 do
|
||||||
|
local n_str = room[tonumber(ix*9+iz+1)]
|
||||||
|
local p2 = 0
|
||||||
|
if n_str == "c" then
|
||||||
|
if ix < 3 then p2 = 1 else p2 = 3 end
|
||||||
|
pyramids.fill_chest({x=loch.x+ix,y=loch.y-iy,z=loch.z+iz})
|
||||||
|
end
|
||||||
|
minetest.set_node({x=loch.x+ix,y=loch.y-iy,z=loch.z+iz}, {name=replace(n_str,iy), param2=p2})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function pyramids.make_traps(pos)
|
||||||
|
local loch = {x=pos.x+7,y=pos.y, z=pos.z+7}
|
||||||
|
for iy=0,4,1 do
|
||||||
|
for ix=0,8,1 do
|
||||||
|
for iz=0,8,1 do
|
||||||
|
local n_str = trap[tonumber(ix*9+iz+1)]
|
||||||
|
local p2 = 0
|
||||||
|
minetest.set_node({x=loch.x+ix,y=loch.y-iy,z=loch.z+iz}, {name=replace2(n_str,iy), param2=p2})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -1,7 +1,15 @@
|
|||||||
local max_obj_per_mapblock = tonumber(minetest.setting_get("max_objects_per_block"))
|
local max_obj_per_mapblock = tonumber(minetest.setting_get("max_objects_per_block"))
|
||||||
|
|
||||||
function spawners.create(mob_name, mod_prefix, size, offset, mesh, texture, night_only, sound_custom)
|
--
|
||||||
-- dummy inside the spawner
|
-- * CREATE ALL SPAWNERS NODES *
|
||||||
|
--
|
||||||
|
|
||||||
|
function spawners.create(mob_name, mod_prefix, size, offset, mesh, texture, night_only, sound_custom, env)
|
||||||
|
|
||||||
|
--
|
||||||
|
-- DUMMY INSIDE THE SPAWNER
|
||||||
|
--
|
||||||
|
|
||||||
local dummy_definition = {
|
local dummy_definition = {
|
||||||
hp_max = 1,
|
hp_max = 1,
|
||||||
physical = true,
|
physical = true,
|
||||||
@ -27,7 +35,7 @@ function spawners.create(mob_name, mod_prefix, size, offset, mesh, texture, nigh
|
|||||||
self.timer = self.timer + dtime
|
self.timer = self.timer + dtime
|
||||||
local n = minetest.get_node_or_nil(self.object:getpos())
|
local n = minetest.get_node_or_nil(self.object:getpos())
|
||||||
if self.timer > 2 then
|
if self.timer > 2 then
|
||||||
if n and n.name and n.name ~= "spawners:"..mod_prefix.."_"..mob_name.."_spawner_active" then
|
if n and n.name and n.name ~= "spawners:"..mod_prefix.."_"..mob_name.."_spawner_active" and n.name ~= "spawners:"..mod_prefix.."_"..mob_name.."_spawner_active_env" then
|
||||||
self.object:remove()
|
self.object:remove()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -35,111 +43,289 @@ function spawners.create(mob_name, mod_prefix, size, offset, mesh, texture, nigh
|
|||||||
|
|
||||||
minetest.register_entity("spawners:dummy_"..mod_prefix.."_"..mob_name, dummy_definition)
|
minetest.register_entity("spawners:dummy_"..mod_prefix.."_"..mob_name, dummy_definition)
|
||||||
|
|
||||||
-- node spawner active
|
--
|
||||||
minetest.register_node("spawners:"..mod_prefix.."_"..mob_name.."_spawner_active", {
|
-- * CRAFTING SPAWNERS *
|
||||||
description = mod_prefix.."_"..mob_name.." spawner active",
|
--
|
||||||
paramtype = "light",
|
|
||||||
light_source = 4,
|
|
||||||
drawtype = "allfaces",
|
|
||||||
walkable = true,
|
|
||||||
sounds = default.node_sound_stone_defaults(),
|
|
||||||
damage_per_second = 4,
|
|
||||||
sunlight_propagates = true,
|
|
||||||
tiles = {
|
|
||||||
{
|
|
||||||
name = "spawners_spawner_animated.png",
|
|
||||||
animation = {
|
|
||||||
type = "vertical_frames",
|
|
||||||
aspect_w = 32,
|
|
||||||
aspect_h = 32,
|
|
||||||
length = 2.0
|
|
||||||
},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
is_ground_content = true,
|
|
||||||
groups = {cracky=1,level=2,igniter=1,not_in_creative_inventory=1},
|
|
||||||
drop = "spawners:"..mod_prefix.."_"..mob_name.."_spawner",
|
|
||||||
on_construct = function(pos)
|
|
||||||
pos.y = pos.y + offset
|
|
||||||
minetest.add_entity(pos,"spawners:dummy_"..mod_prefix.."_"..mob_name)
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
-- node spawner waiting for light - everything is ok but too much light or not enough light
|
if not env then
|
||||||
minetest.register_node("spawners:"..mod_prefix.."_"..mob_name.."_spawner_waiting", {
|
|
||||||
description = mod_prefix.."_"..mob_name.." spawner waiting",
|
|
||||||
paramtype = "light",
|
|
||||||
light_source = 2,
|
|
||||||
drawtype = "allfaces",
|
|
||||||
walkable = true,
|
|
||||||
sounds = default.node_sound_stone_defaults(),
|
|
||||||
sunlight_propagates = true,
|
|
||||||
tiles = {
|
|
||||||
{
|
|
||||||
name = "spawners_spawner_waiting_animated.png",
|
|
||||||
animation = {
|
|
||||||
type = "vertical_frames",
|
|
||||||
aspect_w = 32,
|
|
||||||
aspect_h = 32,
|
|
||||||
length = 2.0
|
|
||||||
},
|
|
||||||
}
|
|
||||||
},
|
|
||||||
is_ground_content = true,
|
|
||||||
groups = {cracky=1,level=2,not_in_creative_inventory=1},
|
|
||||||
drop = "spawners:"..mod_prefix.."_"..mob_name.."_spawner",
|
|
||||||
})
|
|
||||||
|
|
||||||
-- node spawner inactive (default)
|
-- print("[Mod][Spawners] Registering Crafting Spawner.")
|
||||||
minetest.register_node("spawners:"..mod_prefix.."_"..mob_name.."_spawner", {
|
|
||||||
description = mod_prefix.."_"..mob_name.." spawner",
|
|
||||||
paramtype = "light",
|
|
||||||
drawtype = "allfaces",
|
|
||||||
walkable = true,
|
|
||||||
sounds = default.node_sound_stone_defaults(),
|
|
||||||
sunlight_propagates = true,
|
|
||||||
tiles = {"spawners_spawner.png"},
|
|
||||||
is_ground_content = true,
|
|
||||||
groups = {cracky=1,level=2},
|
|
||||||
stack_max = 1,
|
|
||||||
on_construct = function(pos)
|
|
||||||
local random_pos, waiting = spawners.check_node_status(pos, mob_name, night_only)
|
|
||||||
|
|
||||||
if random_pos then
|
--
|
||||||
minetest.set_node(pos, {name="spawners:"..mod_prefix.."_"..mob_name.."_spawner_active"})
|
-- ACTIVE SPAWNER
|
||||||
elseif waiting then
|
--
|
||||||
minetest.set_node(pos, {name="spawners:"..mod_prefix.."_"..mob_name.."_spawner_waiting"})
|
|
||||||
else
|
|
||||||
end
|
|
||||||
end,
|
|
||||||
})
|
|
||||||
|
|
||||||
-- node spawner overheated
|
minetest.register_node("spawners:"..mod_prefix.."_"..mob_name.."_spawner_active", {
|
||||||
minetest.register_node("spawners:"..mod_prefix.."_"..mob_name.."_spawner_overheat", {
|
description = mod_prefix.."_"..mob_name.." spawner active",
|
||||||
description = mod_prefix.."_"..mob_name.." spawner overheated",
|
paramtype = "light",
|
||||||
paramtype = "light",
|
light_source = 4,
|
||||||
light_source = 2,
|
drawtype = "allfaces",
|
||||||
drawtype = "allfaces",
|
walkable = true,
|
||||||
walkable = true,
|
sounds = default.node_sound_stone_defaults(),
|
||||||
sounds = default.node_sound_stone_defaults(),
|
damage_per_second = 4,
|
||||||
catch_up = false,
|
sunlight_propagates = true,
|
||||||
damage_per_second = 4,
|
tiles = {
|
||||||
sunlight_propagates = true,
|
{
|
||||||
tiles = {"spawners_spawner.png^[colorize:#FF000030"},
|
name = "spawners_spawner_animated.png",
|
||||||
is_ground_content = true,
|
animation = {
|
||||||
groups = {cracky=1,level=2,igniter=1,not_in_creative_inventory=1},
|
type = "vertical_frames",
|
||||||
drop = "spawners:"..mod_prefix.."_"..mob_name.."_spawner",
|
aspect_w = 32,
|
||||||
on_construct = function(pos)
|
aspect_h = 32,
|
||||||
minetest.get_node_timer(pos):start(60)
|
length = 2.0
|
||||||
end,
|
},
|
||||||
on_timer = function(pos, elapsed)
|
}
|
||||||
minetest.set_node(pos, {name="spawners:"..mod_prefix.."_"..mob_name.."_spawner"})
|
},
|
||||||
end,
|
is_ground_content = true,
|
||||||
})
|
groups = {cracky=1,level=2,igniter=1,not_in_creative_inventory=1},
|
||||||
|
drop = "spawners:"..mod_prefix.."_"..mob_name.."_spawner",
|
||||||
|
on_construct = function(pos)
|
||||||
|
pos.y = pos.y + offset
|
||||||
|
minetest.add_entity(pos,"spawners:dummy_"..mod_prefix.."_"..mob_name)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
--
|
||||||
|
-- WAITING SPAWNER
|
||||||
|
--
|
||||||
|
|
||||||
|
-- waiting for light - everything is ok but too much light or not enough light
|
||||||
|
minetest.register_node("spawners:"..mod_prefix.."_"..mob_name.."_spawner_waiting", {
|
||||||
|
description = mod_prefix.."_"..mob_name.." spawner waiting",
|
||||||
|
paramtype = "light",
|
||||||
|
light_source = 2,
|
||||||
|
drawtype = "allfaces",
|
||||||
|
walkable = true,
|
||||||
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
sunlight_propagates = true,
|
||||||
|
tiles = {
|
||||||
|
{
|
||||||
|
name = "spawners_spawner_waiting_animated.png",
|
||||||
|
animation = {
|
||||||
|
type = "vertical_frames",
|
||||||
|
aspect_w = 32,
|
||||||
|
aspect_h = 32,
|
||||||
|
length = 2.0
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
is_ground_content = true,
|
||||||
|
groups = {cracky=1,level=2,not_in_creative_inventory=1},
|
||||||
|
drop = "spawners:"..mod_prefix.."_"..mob_name.."_spawner",
|
||||||
|
})
|
||||||
|
|
||||||
|
--
|
||||||
|
-- INACTIVE SPAWNER (DEFAULT)
|
||||||
|
--
|
||||||
|
|
||||||
|
minetest.register_node("spawners:"..mod_prefix.."_"..mob_name.."_spawner", {
|
||||||
|
description = mod_prefix.."_"..mob_name.." spawner",
|
||||||
|
paramtype = "light",
|
||||||
|
drawtype = "allfaces",
|
||||||
|
walkable = true,
|
||||||
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
sunlight_propagates = true,
|
||||||
|
tiles = {"spawners_spawner.png"},
|
||||||
|
is_ground_content = true,
|
||||||
|
groups = {cracky=1,level=2},
|
||||||
|
stack_max = 1,
|
||||||
|
on_construct = function(pos)
|
||||||
|
local random_pos, waiting = spawners.check_node_status(pos, mob_name, night_only)
|
||||||
|
|
||||||
|
if random_pos then
|
||||||
|
minetest.set_node(pos, {name="spawners:"..mod_prefix.."_"..mob_name.."_spawner_active"})
|
||||||
|
elseif waiting then
|
||||||
|
minetest.set_node(pos, {name="spawners:"..mod_prefix.."_"..mob_name.."_spawner_waiting"})
|
||||||
|
else
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
--
|
||||||
|
-- OVERHEATED SPAWNER
|
||||||
|
--
|
||||||
|
|
||||||
|
minetest.register_node("spawners:"..mod_prefix.."_"..mob_name.."_spawner_overheat", {
|
||||||
|
description = mod_prefix.."_"..mob_name.." spawner overheated",
|
||||||
|
paramtype = "light",
|
||||||
|
light_source = 2,
|
||||||
|
drawtype = "allfaces",
|
||||||
|
walkable = true,
|
||||||
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
catch_up = false,
|
||||||
|
damage_per_second = 4,
|
||||||
|
sunlight_propagates = true,
|
||||||
|
tiles = {"spawners_spawner.png^[colorize:#FF000030"},
|
||||||
|
is_ground_content = true,
|
||||||
|
groups = {cracky=1,level=2,igniter=1,not_in_creative_inventory=1},
|
||||||
|
drop = "spawners:"..mod_prefix.."_"..mob_name.."_spawner",
|
||||||
|
on_construct = function(pos)
|
||||||
|
minetest.get_node_timer(pos):start(60)
|
||||||
|
end,
|
||||||
|
on_timer = function(pos, elapsed)
|
||||||
|
minetest.set_node(pos, {name="spawners:"..mod_prefix.."_"..mob_name.."_spawner"})
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
else
|
||||||
|
|
||||||
|
--
|
||||||
|
-- * ENVIRONMENTAL SPAWNERS *
|
||||||
|
--
|
||||||
|
|
||||||
|
-- minetest.log("action", "[Mod][Spawners] Registering Environmental Spawner.")
|
||||||
|
|
||||||
|
--
|
||||||
|
-- ACTIVE SPAWNER ENV
|
||||||
|
--
|
||||||
|
|
||||||
|
minetest.register_node("spawners:"..mod_prefix.."_"..mob_name.."_spawner_active_env", {
|
||||||
|
description = mod_prefix.."_"..mob_name.." spawner active env",
|
||||||
|
paramtype = "light",
|
||||||
|
light_source = 4,
|
||||||
|
drawtype = "allfaces",
|
||||||
|
walkable = true,
|
||||||
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
damage_per_second = 4,
|
||||||
|
sunlight_propagates = true,
|
||||||
|
tiles = {
|
||||||
|
{
|
||||||
|
name = "spawners_spawner_animated.png",
|
||||||
|
animation = {
|
||||||
|
type = "vertical_frames",
|
||||||
|
aspect_w = 32,
|
||||||
|
aspect_h = 32,
|
||||||
|
length = 2.0
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
is_ground_content = true,
|
||||||
|
groups = {cracky=1,level=2,igniter=1,not_in_creative_inventory=1},
|
||||||
|
drop = {
|
||||||
|
max_items = 1,
|
||||||
|
items = {
|
||||||
|
{items = {"spawners:"..mod_prefix.."_"..mob_name.."_spawner"}, rarity = 20}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
on_construct = function(pos)
|
||||||
|
pos.y = pos.y + offset
|
||||||
|
minetest.add_entity(pos,"spawners:dummy_"..mod_prefix.."_"..mob_name)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
--
|
||||||
|
-- WAITING SPAWNER ENV
|
||||||
|
--
|
||||||
|
|
||||||
|
-- waiting for light - everything is ok but too much light or not enough light
|
||||||
|
minetest.register_node("spawners:"..mod_prefix.."_"..mob_name.."_spawner_waiting_env", {
|
||||||
|
description = mod_prefix.."_"..mob_name.." spawner waiting env",
|
||||||
|
paramtype = "light",
|
||||||
|
light_source = 2,
|
||||||
|
drawtype = "allfaces",
|
||||||
|
walkable = true,
|
||||||
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
sunlight_propagates = true,
|
||||||
|
tiles = {
|
||||||
|
{
|
||||||
|
name = "spawners_spawner_waiting_animated.png",
|
||||||
|
animation = {
|
||||||
|
type = "vertical_frames",
|
||||||
|
aspect_w = 32,
|
||||||
|
aspect_h = 32,
|
||||||
|
length = 2.0
|
||||||
|
},
|
||||||
|
}
|
||||||
|
},
|
||||||
|
is_ground_content = true,
|
||||||
|
groups = {cracky=1,level=2,not_in_creative_inventory=1},
|
||||||
|
drop = {
|
||||||
|
max_items = 1,
|
||||||
|
items = {
|
||||||
|
{items = {"spawners:"..mod_prefix.."_"..mob_name.."_spawner"}, rarity = 20}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
--
|
||||||
|
-- INACTIVE SPAWNER (DEFAULT) ENV
|
||||||
|
--
|
||||||
|
|
||||||
|
minetest.register_node("spawners:"..mod_prefix.."_"..mob_name.."_spawner_env", {
|
||||||
|
description = mod_prefix.."_"..mob_name.." spawner env",
|
||||||
|
paramtype = "light",
|
||||||
|
drawtype = "allfaces",
|
||||||
|
walkable = true,
|
||||||
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
sunlight_propagates = true,
|
||||||
|
tiles = {"spawners_spawner.png"},
|
||||||
|
is_ground_content = true,
|
||||||
|
groups = {cracky=1,level=2,not_in_creative_inventory=1},
|
||||||
|
stack_max = 1,
|
||||||
|
drop = {
|
||||||
|
max_items = 1,
|
||||||
|
items = {
|
||||||
|
{items = {"spawners:"..mod_prefix.."_"..mob_name.."_spawner"}, rarity = 20}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
on_construct = function(pos)
|
||||||
|
local random_pos, waiting = spawners.check_node_status(pos, mob_name, night_only)
|
||||||
|
|
||||||
|
if random_pos then
|
||||||
|
minetest.set_node(pos, {name="spawners:"..mod_prefix.."_"..mob_name.."_spawner_active_env"})
|
||||||
|
elseif waiting then
|
||||||
|
minetest.set_node(pos, {name="spawners:"..mod_prefix.."_"..mob_name.."_spawner_waiting_env"})
|
||||||
|
else
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
|
--
|
||||||
|
-- OVERHEATED SPAWNER ENV
|
||||||
|
--
|
||||||
|
|
||||||
|
minetest.register_node("spawners:"..mod_prefix.."_"..mob_name.."_spawner_overheat_env", {
|
||||||
|
description = mod_prefix.."_"..mob_name.." spawner overheated env",
|
||||||
|
paramtype = "light",
|
||||||
|
light_source = 2,
|
||||||
|
drawtype = "allfaces",
|
||||||
|
walkable = true,
|
||||||
|
sounds = default.node_sound_stone_defaults(),
|
||||||
|
catch_up = false,
|
||||||
|
damage_per_second = 4,
|
||||||
|
sunlight_propagates = true,
|
||||||
|
tiles = {"spawners_spawner.png^[colorize:#FF000030"},
|
||||||
|
is_ground_content = true,
|
||||||
|
groups = {cracky=1,level=2,igniter=1,not_in_creative_inventory=1},
|
||||||
|
drop = {
|
||||||
|
max_items = 1,
|
||||||
|
items = {
|
||||||
|
{items = {"spawners:"..mod_prefix.."_"..mob_name.."_spawner"}, rarity = 20}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
on_construct = function(pos)
|
||||||
|
minetest.get_node_timer(pos):start(60)
|
||||||
|
end,
|
||||||
|
on_timer = function(pos, elapsed)
|
||||||
|
minetest.set_node(pos, {name="spawners:"..mod_prefix.."_"..mob_name.."_spawner_env"})
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
--
|
||||||
|
-- * ABM *
|
||||||
|
--
|
||||||
|
|
||||||
-- abm
|
|
||||||
minetest.register_abm({
|
minetest.register_abm({
|
||||||
nodenames = {"spawners:"..mod_prefix.."_"..mob_name.."_spawner", "spawners:"..mod_prefix.."_"..mob_name.."_spawner_active", "spawners:"..mod_prefix.."_"..mob_name.."_spawner_overheat", "spawners:"..mod_prefix.."_"..mob_name.."_spawner_waiting"},
|
nodenames = {
|
||||||
|
"spawners:"..mod_prefix.."_"..mob_name.."_spawner",
|
||||||
|
"spawners:"..mod_prefix.."_"..mob_name.."_spawner_active",
|
||||||
|
"spawners:"..mod_prefix.."_"..mob_name.."_spawner_overheat",
|
||||||
|
"spawners:"..mod_prefix.."_"..mob_name.."_spawner_waiting",
|
||||||
|
"spawners:"..mod_prefix.."_"..mob_name.."_spawner_env",
|
||||||
|
"spawners:"..mod_prefix.."_"..mob_name.."_spawner_active_env",
|
||||||
|
"spawners:"..mod_prefix.."_"..mob_name.."_spawner_overheat_env",
|
||||||
|
"spawners:"..mod_prefix.."_"..mob_name.."_spawner_waiting_env"
|
||||||
|
},
|
||||||
neighbors = {"air"},
|
neighbors = {"air"},
|
||||||
interval = 10.0,
|
interval = 10.0,
|
||||||
chance = 5,
|
chance = 5,
|
||||||
@ -147,18 +333,25 @@ function spawners.create(mob_name, mod_prefix, size, offset, mesh, texture, nigh
|
|||||||
|
|
||||||
local random_pos, waiting = spawners.check_node_status(pos, mob_name, night_only)
|
local random_pos, waiting = spawners.check_node_status(pos, mob_name, night_only)
|
||||||
|
|
||||||
|
local ext = ""
|
||||||
|
|
||||||
|
-- additional name extention for environmental spawners
|
||||||
|
if env and env ~= nil then
|
||||||
|
ext = "_env"
|
||||||
|
end
|
||||||
|
|
||||||
if random_pos then
|
if random_pos then
|
||||||
|
|
||||||
-- do not spawn if too many active entities in map block and call cooldown
|
-- do not spawn if too many active entities in map block and call cooldown
|
||||||
if active_object_count_wider > max_obj_per_mapblock then
|
if active_object_count_wider > max_obj_per_mapblock then
|
||||||
|
|
||||||
-- make sure the right node status is shown
|
-- make sure the right node status is shown
|
||||||
if node.name ~= "spawners:"..mob_name.."_spawner_overheat" then
|
if node.name ~= "spawners:"..mob_name.."_spawner_overheat"..ext then
|
||||||
minetest.set_node(pos, {name="spawners:"..mod_prefix.."_"..mob_name.."_spawner_overheat"})
|
minetest.set_node(pos, {name="spawners:"..mod_prefix.."_"..mob_name.."_spawner_overheat"..ext})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- extend the timeout if still too many entities in map block
|
-- extend the timeout if still too many entities in map block
|
||||||
if node.name == "spawners:"..mod_prefix.."_"..mob_name.."_spawner_overheat" then
|
if node.name == "spawners:"..mod_prefix.."_"..mob_name.."_spawner_overheat"..ext then
|
||||||
minetest.get_node_timer(pos):stop()
|
minetest.get_node_timer(pos):stop()
|
||||||
minetest.get_node_timer(pos):start(60)
|
minetest.get_node_timer(pos):start(60)
|
||||||
end
|
end
|
||||||
@ -167,8 +360,8 @@ function spawners.create(mob_name, mod_prefix, size, offset, mesh, texture, nigh
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- make sure the right node status is shown
|
-- make sure the right node status is shown
|
||||||
if node.name ~= "spawners:"..mod_prefix.."_"..mob_name.."_spawner_active" then
|
if node.name ~= "spawners:"..mod_prefix.."_"..mob_name.."_spawner_active"..ext then
|
||||||
minetest.set_node(pos, {name="spawners:"..mod_prefix.."_"..mob_name.."_spawner_active"})
|
minetest.set_node(pos, {name="spawners:"..mod_prefix.."_"..mob_name.."_spawner_active"..ext})
|
||||||
end
|
end
|
||||||
|
|
||||||
-- enough place to spawn more mobs
|
-- enough place to spawn more mobs
|
||||||
@ -176,8 +369,8 @@ function spawners.create(mob_name, mod_prefix, size, offset, mesh, texture, nigh
|
|||||||
|
|
||||||
elseif waiting then
|
elseif waiting then
|
||||||
-- waiting status
|
-- waiting status
|
||||||
if node.name ~= "spawners:"..mod_prefix.."_"..mob_name.."_spawner_waiting" then
|
if node.name ~= "spawners:"..mod_prefix.."_"..mob_name.."_spawner_waiting"..ext then
|
||||||
minetest.set_node(pos, {name="spawners:"..mod_prefix.."_"..mob_name.."_spawner_waiting"})
|
minetest.set_node(pos, {name="spawners:"..mod_prefix.."_"..mob_name.."_spawner_waiting"..ext})
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
-- no random_pos found
|
-- no random_pos found
|
||||||
@ -185,8 +378,8 @@ function spawners.create(mob_name, mod_prefix, size, offset, mesh, texture, nigh
|
|||||||
minetest.get_node_timer(pos):stop()
|
minetest.get_node_timer(pos):stop()
|
||||||
end
|
end
|
||||||
|
|
||||||
if node.name ~= "spawners:"..mod_prefix.."_"..mob_name.."_spawner" then
|
if node.name ~= "spawners:"..mod_prefix.."_"..mob_name.."_spawner"..ext then
|
||||||
minetest.set_node(pos, {name="spawners:"..mod_prefix.."_"..mob_name.."_spawner"})
|
minetest.set_node(pos, {name="spawners:"..mod_prefix.."_"..mob_name.."_spawner"..ext})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -195,10 +388,13 @@ function spawners.create(mob_name, mod_prefix, size, offset, mesh, texture, nigh
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
-- create all spawners
|
--
|
||||||
|
-- CALL 'CREATE' FOR ALL SPAWNERS
|
||||||
|
--
|
||||||
|
|
||||||
for i, mob_table in ipairs(spawners.mob_tables) do
|
for i, mob_table in ipairs(spawners.mob_tables) do
|
||||||
if mob_table then
|
if mob_table then
|
||||||
|
|
||||||
spawners.create(mob_table.name, mob_table.mod_prefix, mob_table.dummy_size, mob_table.dummy_offset, mob_table.dummy_mesh, mob_table.dummy_texture, mob_table.night_only, mob_table.sound_custom)
|
spawners.create(mob_table.name, mob_table.mod_prefix, mob_table.dummy_size, mob_table.dummy_offset, mob_table.dummy_mesh, mob_table.dummy_texture, mob_table.night_only, mob_table.sound_custom, mob_table.env)
|
||||||
end
|
end
|
||||||
end
|
end
|
BIN
textures/pyramids_crack.png
Normal file
BIN
textures/pyramids_crack.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 390 B |
BIN
textures/pyramids_eye.png
Normal file
BIN
textures/pyramids_eye.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 248 B |
BIN
textures/pyramids_men.png
Normal file
BIN
textures/pyramids_men.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 240 B |
BIN
textures/pyramids_sun.png
Normal file
BIN
textures/pyramids_sun.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 231 B |
Loading…
Reference in New Issue
Block a user