environmental spawners - inital commit
@ -1,5 +1,5 @@
|
||||
-- main tables
|
||||
spawners = {}
|
||||
spawners_env = {}
|
||||
spawners_env.mob_tables = {}
|
||||
|
||||
-- check if mods exists and build tables
|
||||
@ -10,8 +10,6 @@ for k, mob_mod in ipairs(ENABLED_MODS) do
|
||||
for j, mob in ipairs(MOBS_PROPS[mob_mod]) do
|
||||
local mob_egg = nil
|
||||
|
||||
if mob_mod == "mobs" and not (mobs.mod == "redo") then goto continue end
|
||||
|
||||
table.insert(spawners_env.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})
|
||||
|
||||
-- use custom egg or create a default egg
|
||||
@ -20,20 +18,6 @@ for k, mob_mod in ipairs(ENABLED_MODS) do
|
||||
else
|
||||
mob_egg = mob_mod..":"..mob.name
|
||||
end
|
||||
|
||||
-- recipes - not for environmental spawners
|
||||
if not mob.env then
|
||||
minetest.register_craft({
|
||||
output = "spawners_env:"..mob_mod.."_"..mob.name.."_spawner",
|
||||
recipe = {
|
||||
{"default:diamondblock", "fire:flint_and_steel", "default:diamondblock"},
|
||||
{"xpanes:bar_flat", mob_egg, "xpanes:bar_flat"},
|
||||
{"default:diamondblock", "xpanes:bar_flat", "default:diamondblock"},
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
::continue::
|
||||
end
|
||||
else
|
||||
-- print something ?
|
||||
@ -46,7 +30,7 @@ function spawners_env.start_spawning(pos, how_many, mob_name, mod_prefix, sound_
|
||||
|
||||
local sound_name
|
||||
-- remove 'spawners_env:' from the string
|
||||
local mob_name = string.sub(mob_name,10)
|
||||
local mob_name = string.sub(mob_name,14)
|
||||
|
||||
-- use custom sounds
|
||||
if sound_custom ~= "" then
|
||||
@ -65,6 +49,10 @@ function spawners_env.start_spawning(pos, how_many, mob_name, mod_prefix, sound_
|
||||
mob_name = mob_name1.."_"..sheep_colours[random_colour]
|
||||
end
|
||||
|
||||
if how_many == nil then
|
||||
how_many = math.random(0,4)
|
||||
end
|
||||
|
||||
for i=1,how_many do
|
||||
pos.y = pos.y+1
|
||||
local obj = minetest.add_entity(pos, mod_prefix..":"..mob_name)
|
||||
@ -73,77 +61,14 @@ function spawners_env.start_spawning(pos, how_many, mob_name, mod_prefix, sound_
|
||||
if sound_name then
|
||||
minetest.sound_play(sound_name, {
|
||||
pos = pos,
|
||||
max_hear_distance = 32,
|
||||
gain = 10,
|
||||
max_hear_distance = 100,
|
||||
gain = 5,
|
||||
})
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function spawners_env.add_effects(pos, radius)
|
||||
minetest.add_particlespawner({
|
||||
amount = 32,
|
||||
time = 2,
|
||||
minpos = vector.subtract({x=pos.x, y=pos.y+1, z=pos.z}, radius / 2),
|
||||
maxpos = vector.add({x=pos.x, y=pos.y+1, z=pos.z}, radius / 2),
|
||||
minvel = {x=-0.5, y=3, z=-0.5},
|
||||
maxvel = {x=0.5, y=10, z=0.5},
|
||||
minacc = vector.new(),
|
||||
maxacc = vector.new(),
|
||||
minexptime = .5,
|
||||
maxexptime = 2,
|
||||
minsize = .5,
|
||||
maxsize = 8,
|
||||
texture = "spawners_smoke_particle.png",
|
||||
})
|
||||
end
|
||||
|
||||
-- start spawning ores
|
||||
function spawners_env.start_spawning_ores(pos, ore_name, sound_custom, spawners_pos)
|
||||
if not pos or not ore_name then return end
|
||||
local sound_name
|
||||
local player_near = false
|
||||
|
||||
-- use custom sounds
|
||||
if sound_custom ~= "" then
|
||||
sound_name = sound_custom
|
||||
else
|
||||
sound_name = false
|
||||
end
|
||||
|
||||
local how_many = math.random(1,2)
|
||||
-- how_many = how_many+1
|
||||
|
||||
for i=1, how_many do
|
||||
|
||||
if i > 1 then
|
||||
player_near, pos = spawners_env.check_around_radius_ores(pos, "default:stone")
|
||||
|
||||
if not pos then return end
|
||||
|
||||
minetest.sound_play(sound_name, {
|
||||
pos = pos,
|
||||
max_hear_distance = 32,
|
||||
gain = 20,
|
||||
})
|
||||
|
||||
minetest.set_node(pos, {name=ore_name})
|
||||
spawners_env.add_effects(pos, 1)
|
||||
else
|
||||
minetest.sound_play(sound_name, {
|
||||
pos = pos,
|
||||
max_hear_distance = 32,
|
||||
gain = 20,
|
||||
})
|
||||
|
||||
minetest.set_node(pos, {name=ore_name})
|
||||
spawners_env.add_effects(pos, 1)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function spawners_env.check_around_radius(pos)
|
||||
local player_near = false
|
||||
local radius = 21
|
||||
@ -158,27 +83,11 @@ function spawners_env.check_around_radius(pos)
|
||||
return player_near
|
||||
end
|
||||
|
||||
function spawners_env.check_around_radius_ores(pos, check_node)
|
||||
local player_near = spawners_env.check_around_radius(pos);
|
||||
local found_node = false
|
||||
local node_ore_pos = nil
|
||||
if check_node then
|
||||
|
||||
node_ore_pos = minetest.find_node_near(pos, 2, {check_node})
|
||||
|
||||
if node_ore_pos then
|
||||
found_node = node_ore_pos
|
||||
end
|
||||
end
|
||||
|
||||
return player_near, found_node
|
||||
end
|
||||
|
||||
function spawners_env.check_node_status(pos, mob, night_only)
|
||||
local player_near = spawners_env.check_around_radius(pos)
|
||||
|
||||
if player_near then
|
||||
local random_pos = false
|
||||
local spawn_pos = minetest.find_node_near(pos, 2, {"air"})
|
||||
local min_node_light = 10
|
||||
local tod = minetest.get_timeofday() * 24000
|
||||
local node_light = minetest.get_node_light(pos)
|
||||
@ -187,57 +96,9 @@ function spawners_env.check_node_status(pos, mob, night_only)
|
||||
return false
|
||||
end
|
||||
|
||||
local spawn_positions = {}
|
||||
local right = minetest.get_node({x=pos.x+1, y=pos.y, z=pos.z})
|
||||
local front = minetest.get_node({x=pos.x, y=pos.y, z=pos.z+1})
|
||||
local left = minetest.get_node({x=pos.x-1, y=pos.y, z=pos.z})
|
||||
local back = minetest.get_node({x=pos.x, y=pos.y, z=pos.z-1})
|
||||
local top = minetest.get_node({x=pos.x, y=pos.y+1, z=pos.z})
|
||||
local bottom = minetest.get_node({x=pos.x, y=pos.y-1, z=pos.z})
|
||||
|
||||
-- make sure that at least one side of the spawner is open
|
||||
if right.name == "air" then
|
||||
table.insert(spawn_positions, {x=pos.x+1.5, y=pos.y, z=pos.z})
|
||||
end
|
||||
if front.name == "air" then
|
||||
table.insert(spawn_positions, {x=pos.x, y=pos.y, z=pos.z+1.5})
|
||||
end
|
||||
if left.name == "air" then
|
||||
table.insert(spawn_positions, {x=pos.x-1.5, y=pos.y, z=pos.z})
|
||||
end
|
||||
if back.name == "air" then
|
||||
table.insert(spawn_positions, {x=pos.x, y=pos.y, z=pos.z-1.5})
|
||||
end
|
||||
if top.name == "air" then
|
||||
table.insert(spawn_positions, {x=pos.x, y=pos.y+1.5, z=pos.z})
|
||||
end
|
||||
if bottom.name == "air" then
|
||||
table.insert(spawn_positions, {x=pos.x, y=pos.y-1.5, z=pos.z})
|
||||
end
|
||||
|
||||
if #spawn_positions < 1 then
|
||||
-- spawner is cloed from all sides
|
||||
return false
|
||||
else
|
||||
-- pick random from the open sides
|
||||
local pick_random
|
||||
|
||||
if #spawn_positions == 1 then
|
||||
pick_random = #spawn_positions
|
||||
else
|
||||
pick_random = math.random(1,#spawn_positions)
|
||||
end
|
||||
|
||||
for k, v in pairs (spawn_positions) do
|
||||
if k == pick_random then
|
||||
random_pos = v
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- check the node above and below the found air node
|
||||
local node_above = minetest.get_node({x=random_pos.x, y=random_pos.y+1, z=random_pos.z}).name
|
||||
local node_below = minetest.get_node({x=random_pos.x, y=random_pos.y-1, z=random_pos.z}).name
|
||||
local node_above = minetest.get_node({x=spawn_pos.x, y=spawn_pos.y+1, z=spawn_pos.z}).name
|
||||
local node_below = minetest.get_node({x=spawn_pos.x, y=spawn_pos.y-1, z=spawn_pos.z}).name
|
||||
|
||||
if not (node_above == "air" or node_below == "air") then
|
||||
return false
|
||||
@ -252,27 +113,15 @@ function spawners_env.check_node_status(pos, mob, night_only)
|
||||
-- spawn only at night
|
||||
if night_only then
|
||||
if not (19359 > tod and tod > 5200) or node_light < min_node_light then
|
||||
return random_pos
|
||||
return spawn_pos
|
||||
else
|
||||
return false, true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return random_pos, false
|
||||
return spawn_pos, false
|
||||
else
|
||||
return false, true
|
||||
end
|
||||
end
|
||||
|
||||
function spawners_env.check_node_status_ores(pos, ore_name, check_node)
|
||||
if not check_node then return end
|
||||
|
||||
local player_near, found_node = spawners_env.check_around_radius_ores(pos, check_node)
|
||||
|
||||
if player_near and found_node then
|
||||
return true, found_node
|
||||
else
|
||||
return true, false
|
||||
end
|
||||
end
|
@ -221,20 +221,20 @@ if minetest.get_modpath("mobs") ~= nil then
|
||||
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"},
|
||||
dummy_mesh="spawners_env_mummy.b3d",
|
||||
dummy_texture={"spawners_env_mummy.png"},
|
||||
night_only="disable",
|
||||
sound_custom="spawners_mob_mummy"
|
||||
sound_custom="spawners_env_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"},
|
||||
dummy_mesh="spawners_env_mummy.b3d",
|
||||
dummy_texture={"spawners_env_mummy.png"},
|
||||
night_only="disable",
|
||||
sound_custom="spawners_mob_mummy",
|
||||
sound_custom="spawners_env_mummy",
|
||||
env=true
|
||||
}
|
||||
}
|
||||
|
3
spawners_env/depends.txt
Normal file
@ -0,0 +1,3 @@
|
||||
default
|
||||
mobs?
|
||||
creatures?
|
@ -9,13 +9,22 @@ dofile(minetest.get_modpath(MOD_NAME).."/config.lua")
|
||||
-- API
|
||||
dofile(minetest.get_modpath(MOD_NAME).."/api.lua")
|
||||
|
||||
-- Spawners Pyramids
|
||||
-- Spawners for mobs
|
||||
dofile(minetest.get_modpath(MOD_NAME).."/spawners_env.lua")
|
||||
|
||||
-- Spawners Pyramids - works best with mapgen v6
|
||||
if SPAWN_PYRAMIDS then
|
||||
dofile(minetest.get_modpath(MOD_NAME).."/pyramids.lua")
|
||||
|
||||
print("[Mod][spawners] Pyramids enabled")
|
||||
end
|
||||
|
||||
-- include mummy mobs redo addon (mob)
|
||||
if minetest.get_modpath("mobs") then
|
||||
dofile(minetest.get_modpath(MOD_NAME).."/mob_env_mummy.lua")
|
||||
dofile(minetest.get_modpath(MOD_NAME).."/nodes_env_additional.lua")
|
||||
end
|
||||
|
||||
-- Add Spawners to dungeons, temples..
|
||||
if SPAWNERS_GENERATE then
|
||||
dofile(minetest.get_modpath(MOD_NAME).."/spawners_gen.lua")
|
||||
@ -30,4 +39,4 @@ if CHESTS_GENERATE then
|
||||
print("[Mod][spawners] Chests generate enabled")
|
||||
end
|
||||
|
||||
print ("[Mod] Spawners Environmental 0.6 Loaded.")
|
||||
print ("[Mod] Spawners Environmental 0.7 Loaded.")
|
65
spawners_env/mob_env_mummy.lua
Normal file
@ -0,0 +1,65 @@
|
||||
-- modified Sand Monster by PilzAdam with Mummy by BlockMen
|
||||
|
||||
local mummy_def = {
|
||||
type = "monster",
|
||||
passive = false,
|
||||
attack_type = "dogfight",
|
||||
pathfinding = true,
|
||||
reach = 2,
|
||||
damage = 4,
|
||||
hp_min = 25,
|
||||
hp_max = 35,
|
||||
armor = 100,
|
||||
collisionbox = {-0.4, -1, -0.4, 0.4, 0.8, 0.4},
|
||||
visual = "mesh",
|
||||
mesh = "spawners_env_mummy.b3d",
|
||||
textures = {
|
||||
{"spawners_env_mummy.png"},
|
||||
},
|
||||
makes_footstep_sound = true,
|
||||
sounds = {
|
||||
random = "spawners_env_mummy",
|
||||
damage = "spawners_env_mummy_hit",
|
||||
},
|
||||
walk_velocity = .75,
|
||||
run_velocity = 1.5,
|
||||
view_range = 8,
|
||||
jump = true,
|
||||
floats = 0,
|
||||
drops = {
|
||||
{name = "default:sandstone", chance = 1, min = 1, max = 3},
|
||||
{name = "default:sandstonebrick", chance = 2, min = 1, max = 2},
|
||||
{name = "spawners_env:deco_stone_eye", chance = 15, min = 1, max = 1},
|
||||
{name = "spawners_env:deco_stone_men", chance = 15, min = 1, max = 1},
|
||||
{name = "spawners_env:deco_stone_sun", chance = 15, min = 1, max = 1},
|
||||
},
|
||||
water_damage = 4,
|
||||
lava_damage = 8,
|
||||
light_damage = 0,
|
||||
fear_height = 4,
|
||||
animation = {
|
||||
speed_normal = 15,
|
||||
speed_run = 15,
|
||||
stand_start = 0,
|
||||
stand_end = 39,
|
||||
walk_start = 41,
|
||||
walk_end = 72,
|
||||
run_start = 74,
|
||||
run_end = 105,
|
||||
punch_start = 74,
|
||||
punch_end = 105,
|
||||
},
|
||||
on_die = function(self, pos)
|
||||
minetest.sound_play("spawners_env_mummy_death", {
|
||||
object = self.object,
|
||||
pos = pos,
|
||||
max_hear_distance = 10
|
||||
})
|
||||
end,
|
||||
}
|
||||
|
||||
mobs:register_mob("spawners_env:mummy", mummy_def)
|
||||
|
||||
mobs:register_spawn("spawners_env:mummy", {"default:desert_sand", "default:desert_stone"}, 20, 0, 14000, 2, 31000)
|
||||
|
||||
mobs:register_egg("spawners_env:mummy", "Mummy Monster", "default_sandstone_brick.png", 1)
|
BIN
spawners_env/models/spawners_env_mummy.b3d
Normal file
11
spawners_env/nodes_env_additional.lua
Normal file
@ -0,0 +1,11 @@
|
||||
local img = {"eye", "men", "sun"}
|
||||
|
||||
for i=1,3 do
|
||||
minetest.register_node("spawners_env:deco_stone_"..img[i], {
|
||||
description = "Sandstone with "..img[i],
|
||||
tiles = {"default_sandstone.png^spawners_env_"..img[i]..".png"},
|
||||
is_ground_content = true,
|
||||
groups = {crumbly=2,cracky=3},
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
})
|
||||
end
|
BIN
spawners_env/sounds/spawners_env_bunny.ogg
Normal file
BIN
spawners_env/sounds/spawners_env_mummy.1.ogg
Normal file
BIN
spawners_env/sounds/spawners_env_mummy.2.ogg
Normal file
BIN
spawners_env/sounds/spawners_env_mummy_death.1.ogg
Normal file
BIN
spawners_env/sounds/spawners_env_mummy_hit.1.ogg
Normal file
258
spawners_env/spawners_env.lua
Normal file
@ -0,0 +1,258 @@
|
||||
local max_obj_per_mapblock = tonumber(minetest.setting_get("max_objects_per_block"))
|
||||
|
||||
--
|
||||
-- * CREATE ALL SPAWNERS NODES *
|
||||
--
|
||||
|
||||
function spawners_env.create(mob_name, mod_prefix, size, offset, mesh, texture, night_only, sound_custom)
|
||||
|
||||
--
|
||||
-- DUMMY INSIDE THE SPAWNER
|
||||
--
|
||||
|
||||
local dummy_definition = {
|
||||
hp_max = 1,
|
||||
physical = true,
|
||||
collisionbox = {0,0,0,0,0,0},
|
||||
visual = "mesh",
|
||||
visual_size = size,
|
||||
mesh = mesh,
|
||||
textures = texture,
|
||||
makes_footstep_sound = false,
|
||||
timer = 0,
|
||||
automatic_rotate = math.pi * -3,
|
||||
m_name = "dummy"
|
||||
}
|
||||
|
||||
dummy_definition.on_activate = function(self)
|
||||
self.object:setvelocity({x=0, y=0, z=0})
|
||||
self.object:setacceleration({x=0, y=0, z=0})
|
||||
self.object:set_armor_groups({immortal=1})
|
||||
end
|
||||
|
||||
-- remove dummy after dug up the spawner
|
||||
dummy_definition.on_step = function(self, dtime)
|
||||
self.timer = self.timer + dtime
|
||||
local n = minetest.get_node_or_nil(self.object:getpos())
|
||||
if self.timer > 2 then
|
||||
if n and n.name and n.name ~= "spawners_env:"..mod_prefix.."_"..mob_name.."_spawner_active" then
|
||||
self.object:remove()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
minetest.register_entity("spawners_env:dummy_"..mod_prefix.."_"..mob_name, dummy_definition)
|
||||
|
||||
--
|
||||
-- ACTIVE SPAWNER ENV
|
||||
--
|
||||
|
||||
minetest.register_node("spawners_env:"..mod_prefix.."_"..mob_name.."_spawner_active", {
|
||||
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_env_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_env:"..mod_prefix.."_"..mob_name.."_spawner"}, rarity = 20}
|
||||
}
|
||||
},
|
||||
on_construct = function(pos)
|
||||
pos.y = pos.y + offset
|
||||
minetest.add_entity(pos,"spawners_env: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_env:"..mod_prefix.."_"..mob_name.."_spawner_waiting", {
|
||||
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_env_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_env:"..mod_prefix.."_"..mob_name.."_spawner"}, rarity = 20}
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
--
|
||||
-- INACTIVE SPAWNER (DEFAULT) ENV
|
||||
--
|
||||
|
||||
minetest.register_node("spawners_env:"..mod_prefix.."_"..mob_name.."_spawner", {
|
||||
description = mod_prefix.."_"..mob_name.." spawner env",
|
||||
paramtype = "light",
|
||||
drawtype = "allfaces",
|
||||
walkable = true,
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
sunlight_propagates = true,
|
||||
tiles = {"spawners_env_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_env:"..mod_prefix.."_"..mob_name.."_spawner"}, rarity = 20}
|
||||
}
|
||||
},
|
||||
on_construct = function(pos)
|
||||
local random_pos, waiting = spawners_env.check_node_status(pos, mob_name, night_only)
|
||||
|
||||
if random_pos then
|
||||
minetest.set_node(pos, {name="spawners_env:"..mod_prefix.."_"..mob_name.."_spawner_active"})
|
||||
elseif waiting then
|
||||
minetest.set_node(pos, {name="spawners_env:"..mod_prefix.."_"..mob_name.."_spawner_waiting"})
|
||||
else
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
--
|
||||
-- OVERHEATED SPAWNER ENV
|
||||
--
|
||||
|
||||
minetest.register_node("spawners_env:"..mod_prefix.."_"..mob_name.."_spawner_overheat", {
|
||||
description = mod_prefix.."_"..mob_name.." spawner overheated env",
|
||||
paramtype = "light",
|
||||
light_source = 2,
|
||||
drawtype = "allfaces",
|
||||
walkable = true,
|
||||
sounds = default.node_sound_stone_defaults(),
|
||||
damage_per_second = 4,
|
||||
sunlight_propagates = true,
|
||||
tiles = {"spawners_env_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_env:"..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_env:"..mod_prefix.."_"..mob_name.."_spawner"})
|
||||
end,
|
||||
})
|
||||
|
||||
--
|
||||
-- * ABM *
|
||||
--
|
||||
|
||||
minetest.register_abm({
|
||||
nodenames = {
|
||||
"spawners_env:"..mod_prefix.."_"..mob_name.."_spawner",
|
||||
"spawners_env:"..mod_prefix.."_"..mob_name.."_spawner_active",
|
||||
"spawners_env:"..mod_prefix.."_"..mob_name.."_spawner_overheat",
|
||||
"spawners_env:"..mod_prefix.."_"..mob_name.."_spawner_waiting"
|
||||
},
|
||||
neighbors = {"air"},
|
||||
interval = 3.0,
|
||||
chance = 3,
|
||||
catch_up = false,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
|
||||
local random_pos, waiting = spawners_env.check_node_status(pos, mob_name, night_only)
|
||||
|
||||
-- minetest.log("action", "[Mod][Spawners] checking for: "..mob_name.." at "..minetest.pos_to_string(pos))
|
||||
|
||||
if random_pos then
|
||||
|
||||
-- do not spawn if too many active entities in map block and call cooldown
|
||||
if active_object_count_wider > max_obj_per_mapblock then
|
||||
|
||||
-- make sure the right node status is shown
|
||||
if node.name ~= "spawners_env:"..mob_name.."_spawner_overheat" then
|
||||
minetest.set_node(pos, {name="spawners_env:"..mod_prefix.."_"..mob_name.."_spawner_overheat"})
|
||||
end
|
||||
|
||||
-- extend the timeout if still too many entities in map block
|
||||
if node.name == "spawners_env:"..mod_prefix.."_"..mob_name.."_spawner_overheat" then
|
||||
minetest.get_node_timer(pos):stop()
|
||||
minetest.get_node_timer(pos):start(60)
|
||||
end
|
||||
|
||||
return
|
||||
end
|
||||
-- make sure the right node status is shown
|
||||
if node.name ~= "spawners_env:"..mod_prefix.."_"..mob_name.."_spawner_active" then
|
||||
minetest.set_node(pos, {name="spawners_env:"..mod_prefix.."_"..mob_name.."_spawner_active"})
|
||||
end
|
||||
|
||||
-- enough place to spawn more mobs
|
||||
spawners_env.start_spawning(random_pos, 1, "spawners_env:"..mob_name, mod_prefix, sound_custom)
|
||||
|
||||
elseif waiting then
|
||||
-- waiting status
|
||||
if node.name ~= "spawners_env:"..mod_prefix.."_"..mob_name.."_spawner_waiting" then
|
||||
minetest.set_node(pos, {name="spawners_env:"..mod_prefix.."_"..mob_name.."_spawner_waiting"})
|
||||
end
|
||||
else
|
||||
-- no random_pos found
|
||||
if minetest.get_node_timer(pos):is_started() then
|
||||
minetest.get_node_timer(pos):stop()
|
||||
end
|
||||
|
||||
if node.name ~= "spawners_env:"..mod_prefix.."_"..mob_name.."_spawner" then
|
||||
minetest.set_node(pos, {name="spawners_env:"..mod_prefix.."_"..mob_name.."_spawner"})
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
})
|
||||
|
||||
end
|
||||
|
||||
--
|
||||
-- CALL 'CREATE' FOR ALL SPAWNERS
|
||||
--
|
||||
|
||||
for i, mob_table in ipairs(spawners_env.mob_tables) do
|
||||
if mob_table then
|
||||
|
||||
spawners_env.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)
|
||||
end
|
||||
end
|
@ -14,11 +14,11 @@ local function place_spawner(param)
|
||||
if gen_obj == "dungeon" then
|
||||
minetest.log("action", "[Mod][Spawners] dungeon spawner placed at: "..minetest.pos_to_string(pos))
|
||||
|
||||
minetest.set_node(pos, {name = "spawners_env:spawners_mummy_spawner_env"})
|
||||
minetest.set_node(pos, {name = "spawners_env:spawners_env_mummy_spawner"})
|
||||
else
|
||||
minetest.log("action", "[Mod][Spawners] temple spawner placed at: "..minetest.pos_to_string(pos))
|
||||
|
||||
minetest.set_node(pos, {name = "spawners_env:mobs_spider_spawner_env"})
|
||||
minetest.set_node(pos, {name = "spawners_env:mobs_spider_spawner"})
|
||||
end
|
||||
|
||||
end
|
||||
|
BIN
spawners_env/textures/spawners_env_crack.png
Normal file
After Width: | Height: | Size: 390 B |
BIN
spawners_env/textures/spawners_env_eye.png
Normal file
After Width: | Height: | Size: 248 B |
BIN
spawners_env/textures/spawners_env_men.png
Normal file
After Width: | Height: | Size: 240 B |
BIN
spawners_env/textures/spawners_env_mummy.png
Normal file
After Width: | Height: | Size: 1.9 KiB |
BIN
spawners_env/textures/spawners_env_spawner.png
Normal file
After Width: | Height: | Size: 535 B |
BIN
spawners_env/textures/spawners_env_spawner_16.png
Normal file
After Width: | Height: | Size: 329 B |
BIN
spawners_env/textures/spawners_env_spawner_animated.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
spawners_env/textures/spawners_env_spawner_normal.png
Normal file
After Width: | Height: | Size: 7.8 KiB |
BIN
spawners_env/textures/spawners_env_spawner_waiting_animated.png
Normal file
After Width: | Height: | Size: 4.6 KiB |
BIN
spawners_env/textures/spawners_env_sun.png
Normal file
After Width: | Height: | Size: 231 B |
@ -15,4 +15,4 @@ if minetest.get_modpath("mobs") then
|
||||
dofile(minetest.get_modpath(MOD_NAME).."/nodes_additional.lua")
|
||||
end
|
||||
|
||||
print ("[Mod] Spawners Mobs 0.6 Loaded.")
|
||||
print ("[Mod] Spawners Mobs 0.7 Loaded.")
|
||||
|
@ -6,4 +6,4 @@ dofile(minetest.get_modpath(MOD_NAME).."/api.lua")
|
||||
-- Spawners for ores
|
||||
dofile(minetest.get_modpath(MOD_NAME).."/spawners_ores.lua")
|
||||
|
||||
print ("[Mod] Spawners Ores 0.6 Loaded.")
|
||||
print ("[Mod] Spawners Ores 0.7 Loaded.")
|
||||
|