Refresh mobs spawners

This commit is contained in:
Juraj Vajda 2023-04-25 00:34:49 -04:00
parent e3b5825b49
commit 81a7a2189c
13 changed files with 619 additions and 832 deletions

View File

@ -26,6 +26,7 @@ function spawners_env.register_spawner(name, def)
local mob_name = name:split(':')[2]
-- Entity inside the spawner
local ent_name = 'spawners_env:dummy_' .. mod_prefix .. '_' .. mob_name
local ent_def = {
hp_max = 1,
physical = true,
@ -37,28 +38,24 @@ function spawners_env.register_spawner(name, def)
makes_footstep_sound = false,
timer = 0,
automatic_rotate = math.pi * -3,
m_name = 'dummy'
}
local ent_name = 'spawners_env:dummy_' .. mod_prefix .. '_' .. mob_name
on_activate = function(self)
self.object:set_velocity({ x = 0, y = 0, z = 0 })
self.object:set_acceleration({ x = 0, y = 0, z = 0 })
self.object:set_armor_groups({ immortal = 1 })
end,
on_step = function(self, dtime)
-- remove dummy after dig the spawner
self.timer = self.timer + dtime
ent_def.on_activate = function(self)
self.object:set_velocity({ x = 0, y = 0, z = 0 })
self.object:set_acceleration({ x = 0, y = 0, z = 0 })
self.object:set_armor_groups({ immortal = 1 })
end
-- remove dummy after dig the spawner
ent_def.on_step = function(self, dtime)
self.timer = self.timer + dtime
if self.timer > 2 then
local n = minetest.get_node_or_nil(self.object:get_pos())
if n and n.name ~= 'spawners_env:' .. mod_prefix .. '_' .. mob_name .. '_spawner_active'
then
self.object:remove()
if self.timer > 2 then
local n = minetest.get_node_or_nil(self.object:get_pos())
if n and n.name ~= 'spawners_env:' .. mod_prefix .. '_' .. mob_name .. '_spawner_active'
then
self.object:remove()
end
end
end
end
}
minetest.register_entity('spawners_env:dummy_' .. mod_prefix .. '_' .. mob_name, ent_def)
@ -166,9 +163,8 @@ function spawners_env.register_spawner(name, def)
minetest.register_node(node_name, node_def_active)
--
-- * LBM *
-- LBM
--
minetest.register_lbm({
name = 'spawners_env:check_for_spawning_timer_' .. mob_name,
nodenames = {

View File

@ -27,8 +27,8 @@ if minetest.get_modpath('animalia') then
dofile(path .. '/mod_support_animalia.lua')
end
if minetest.get_modpath('mobs') then
dofile(path .. '/mod_support_mobs_redo.lua')
if minetest.get_modpath('mobs') and minetest.get_modpath('spawners_mobs') then
dofile(path .. '/mod_support_spawners_mobs.lua')
end
if minetest.get_modpath('mobs_animal') then

View File

@ -18,70 +18,166 @@
-- main tables
spawners_mobs = {
ENABLED_MODS = {},
MOBS_PROPS = {},
registered_spawners_names = {}
registered_spawners = {}
}
spawners_mobs.mob_tables = {}
local max_obj_per_mapblock = tonumber(minetest.settings:get('max_objects_per_block'))
local enable_particles = minetest.settings:get_bool('enable_particles')
local tick_max = 30
local tick_short_max = 20
function spawners_mobs.register_spawners()
-- check if mods exists and build tables
for k, mob_mod in ipairs(spawners_mobs.ENABLED_MODS) do
local modpath = minetest.get_modpath(mob_mod)
-- list of mobs and their info
if (modpath) then
for j, mob in ipairs(spawners_mobs.MOBS_PROPS[mob_mod]) do
local mob_egg
function spawners_mobs.register_spawner(name, def)
def.mod_prefix = name:split(':')[1]
def.mob_name = name:split(':')[2]
-- disabled extra check for mobs redo due to incompatibility with Lua 5.1, this method is available from Lua 5.2
-- if mob_mod == 'mobs' and not (mobs.mod == 'redo') then goto continue end
table.insert(spawners_mobs.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
if mob.egg_name_custom ~= '' then
mob_egg = mob.egg_name_custom
else
mob_egg = mob_mod .. ':' .. mob.name
end
-- recipes
minetest.register_craft({
output = 'spawners_mobs:' .. 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' },
}
})
-- Lua > 5.1
-- ::continue::
end
-- Entity inside the spawner
local ent_name = 'spawners_mobs:dummy_' .. def.mod_prefix .. '_' .. def.mob_name
local ent_def = {
hp_max = 1,
visual = def.dummy_visual or 'mesh',
visual_size = def.dummy_size,
collisionbox = { 0, 0, 0, 0, 0, 0 },
mesh = def.dummy_mesh,
textures = def.dummy_texture,
physical = false,
makes_footstep_sound = false,
automatic_rotate = math.pi * -3,
static_save = false,
timer = 0,
on_activate = function(self, staticdata, dtime_s)
self.object:set_velocity({ x = 0, y = 0, z = 0 })
self.object:set_acceleration({ x = 0, y = 0, z = 0 })
self.object:set_armor_groups({ immortal = 1 })
end
}
minetest.register_entity(ent_name, ent_def)
-- Default spawner (active)
local node_def = {}
node_def.description = def.mod_prefix .. '_' .. def.mob_name .. ' spawner'
node_def.paramtype = 'light'
node_def.paramtype2 = 'glasslikeliquidlevel'
node_def.drawtype = 'glasslike_framed_optional'
node_def.walkable = true
node_def.sounds = default.node_sound_metal_defaults()
node_def.sunlight_propagates = true
node_def.tiles = { 'spawners_mobs_spawner_16.png' }
node_def.is_ground_content = false
node_def.groups = {
-- MTG
cracky = 1,
level = 2
}
node_def.stack_max = 1
node_def.light_source = 6
node_def.on_timer = spawners_mobs.on_timer
node_def.on_construct = function(pos)
-- set meta
local meta = minetest.get_meta(pos)
meta:set_int('tick', 0)
meta:set_int('tick_short', 0)
spawners_mobs.set_status(pos, 'active')
spawners_mobs.tick_short(pos)
end
node_def.after_place_node = function(pos, placer, itemstack, pointed_thing)
local meta = minetest.get_meta(pos)
meta:set_string('owner', placer:get_player_name())
meta:set_string('infotext', def.mob_name .. ' spawner\nowner: ' .. placer:get_player_name() .. '\nspawner is active')
end
node_def.on_destruct = function(pos)
-- delete particles and remove dummy
spawners_mobs.set_status(pos, 'waiting')
end
local node_name = 'spawners_mobs:' .. def.mod_prefix .. '_' .. def.mob_name .. '_spawner'
minetest.register_node(node_name, node_def)
spawners_mobs.registered_spawners[node_name] = def
-- Waiting spawner
local node_def_waiting = table.copy(node_def)
node_name = 'spawners_mobs:' .. def.mod_prefix .. '_' .. def.mob_name .. '_spawner_waiting'
node_def_waiting.description = def.mod_prefix .. '_' .. def.mob_name .. ' spawner waiting'
node_def_waiting.tiles = {
{
name = 'spawners_mobs_spawner_waiting_animated_16.png',
animation = {
type = 'vertical_frames',
aspect_w = 16,
aspect_h = 16,
length = 2.0
}
}
}
node_def_waiting.groups = { cracky = 1, level = 2, not_in_creative_inventory = 1 }
node_def_waiting.light_source = 4
node_def_waiting.drop = 'spawners_mobs:' .. def.mod_prefix .. '_' .. def.mob_name .. '_spawner'
node_def_waiting.on_timer = spawners_mobs.on_timer
node_def_waiting.on_construct = nil
node_def_waiting.after_place_node = nil
node_def_waiting.on_destruct = nil
minetest.register_node(node_name, node_def_waiting)
spawners_mobs.registered_spawners[node_name] = def
-- Rusty spawner
local node_def_rusty = table.copy(node_def)
node_name = 'spawners_mobs:' .. def.mod_prefix .. '_' .. def.mob_name .. '_spawner_rusty'
node_def_rusty.description = def.mod_prefix .. '_' .. def.mob_name .. ' spawner rusty'
node_def_rusty.tiles = { 'spawners_mobs_spawner_rusty.png' }
node_def_rusty.groups = { cracky = 1, level = 2, not_in_creative_inventory = 1 }
node_def_rusty.drop = 'spawners_mobs:' .. def.mod_prefix .. '_' .. def.mob_name .. '_spawner'
node_def_rusty.on_timer = nil
node_def_rusty.on_construct = nil
node_def_rusty.after_place_node = nil
node_def_rusty.on_destruct = nil
minetest.register_node(node_name, node_def_rusty)
spawners_mobs.registered_spawners[node_name] = def
-- Recipes
local mob_egg = name
if def.egg_name_custom and def.egg_name_custom ~= '' then
mob_egg = def.egg_name_custom
end
if minetest.registered_items[mob_egg] then
-- recipes
minetest.register_craft({
output = 'spawners_mobs:' .. def.mod_prefix .. '_' .. def.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
--
-- LBM
--
minetest.register_lbm({
name = 'spawners_mobs:start_nodetimer_' .. def.mod_prefix .. '_' .. def.mob_name .. '_spawner',
nodenames = 'spawners_mobs:' .. def.mod_prefix .. '_' .. def.mob_name .. '_spawner',
action = function(pos)
spawners_mobs.tick_short(pos)
end,
})
end
--
-- Particles
--
function spawners_mobs.cloud_booom(pos)
if not enable_particles then return end
if not enable_particles then
return
end
minetest.add_particlespawner({
amount = 5,
@ -110,7 +206,9 @@ function spawners_mobs.cloud_booom(pos)
end
function spawners_mobs.add_flame_effects(pos)
if not enable_particles then return end
if not enable_particles then
return
end
return minetest.add_particlespawner({
amount = 6,
@ -130,7 +228,9 @@ function spawners_mobs.add_flame_effects(pos)
end
function spawners_mobs.add_smoke_effects(pos)
if not enable_particles then return end
if not enable_particles then
return
end
return minetest.add_particlespawner({
amount = 1,
@ -173,8 +273,7 @@ function spawners_mobs.tick(pos)
return
end
minetest.get_node_timer(pos):start(math.random(72, 193))
-- minetest.get_node_timer(pos):start(math.random(20, 30))
minetest.get_node_timer(pos):start(math.random(30, 60))
end
-- how often a spawn failure tick is retried (e.g. too dark)
@ -212,7 +311,7 @@ function spawners_mobs.start_spawning(spawn_area_random_pos, mob_name, mod_prefi
-- use random colors for sheeps
if mob_name == 'sheep_white' then
local sheep_colors = { 'black', 'blue', 'brown', 'cyan', 'dark_green', 'dark_grey', 'green', 'grey', 'magenta', 'orange', 'pink', 'red', 'violet', 'white', 'yellow' }
mob_name = 'sheep_' .. sheep_colors[math.random(#sheep_colors)]
mob_name = 'sheep_' .. sheep_colors[math.random(1, #sheep_colors)]
end
for i = 1, #spawn_area_random_pos do
@ -239,10 +338,12 @@ end
function spawners_mobs.on_timer(pos, elapsed)
local meta = minetest.get_meta(pos)
local idx = meta:get_int('idx') or nil
local mob_table = spawners_mobs.mob_tables[idx] or false
local node = minetest.get_node(pos)
local mob_table = spawners_mobs.registered_spawners[node.name]
if not mob_table then return end
if not mob_table then
return
end
local posmin = { x = pos.x - 3, y = pos.y - 1, z = pos.z - 3 }
local posmax = { x = pos.x + 4, y = pos.y + 1, z = pos.z + 4 }
@ -253,7 +354,7 @@ function spawners_mobs.on_timer(pos, elapsed)
local owner = meta:get_string('owner') or ''
local mod_prefix = mob_table.mod_prefix
local mob_name = mob_table.name
local mob_name = mob_table.mob_name
local sound_custom = mob_table.sound_custom
local night_only = mob_table.night_only
local max_objects = max_obj_per_mapblock / 4
@ -428,13 +529,15 @@ end
--
function spawners_mobs.set_status(pos, set_status)
local meta = minetest.get_meta(pos)
local idx = meta:get_int('idx')
local mob_table = spawners_mobs.mob_tables[idx] or false
local node = minetest.get_node(pos)
local mob_table = spawners_mobs.registered_spawners[node.name]
if not mob_table then return end
if not mob_table then
return
end
local mod_prefix = mob_table.mod_prefix
local mob_name = mob_table.name
local mob_name = mob_table.mob_name
local offset = mob_table.dummy_offset
-- get meta

View File

@ -1,242 +0,0 @@
--[[
Let the player craft Mob Spawners. Mobs are spawning randomly in a short intervals, giving the option of creating mob farms and grinders.
Copyright (C) 2016 - 2023 SaKeL <juraj.vajda@gmail.com>
This library is free software; you can redistribute it and/or
modify it pos the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to juraj.vajda@gmail.com
--]]
-- * [name : string] - Name of the mob used in the mod.
-- [egg_name_custom : string] - Custom name for the egg item. If empty default name will be used i.e. 'mobs:chicken'.
-- * [dummy_size : table] - Size of the rotating dummy inside the node.
-- * [dummy_offset : integer] - Offset on Y axis of the dummy inside the node.
-- * [dummy_mesh : string] - Filename of the model used fot he mob.
-- * [dummy_texture : table] - Textures used for the mob.
-- * [night_only : boolean : string] - If true mobs will spawn only during the night or in dark areas, default:true. Writing 'disable' will disable light check and it will spawn in both states (night and day)
-- [sound_custom : string] - Custom name for the sound file name if differ from default: i.e 'mobs_cow'.
-- [*] -> MANDATORY - has to be filled in!
-- mods what should be enabled and loded, remove/add the one you want to load
spawners_mobs.ENABLED_MODS = { 'mobs', 'creatures' }
-- mobs properties - setup all you mobs here
spawners_mobs.MOBS_PROPS = {
['mobs'] = { -- MOBS REDO CONFIG
{
name = 'sheep_white',
egg_name_custom = '',
dummy_size = { x = 0.52, y = 0.52 },
dummy_offset = 0.2,
dummy_mesh = 'mobs_sheep.b3d',
dummy_texture = { 'mobs_sheep_wool.png^mobs_sheep_base.png' },
night_only = false,
sound_custom = 'mobs_sheep'
},
{
name = 'cow',
egg_name_custom = '',
dummy_size = { x = 0.3, y = 0.3 },
dummy_offset = -0.3,
dummy_mesh = 'mobs_cow.x',
dummy_texture={ 'mobs_cow.png' },
night_only = false,
sound_custom = ''
},
{
name = 'chicken',
egg_name_custom = '',
dummy_size = { x = 0.9, y = 0.9 },
dummy_offset = 0.2,
dummy_mesh = 'mobs_chicken.x',
dummy_texture = { 'mobs_chicken.png', 'mobs_chicken.png', 'mobs_chicken.png', 'mobs_chicken.png', 'mobs_chicken.png', 'mobs_chicken.png', 'mobs_chicken.png', 'mobs_chicken.png', 'mobs_chicken.png' },
night_only = false,
sound_custom = ''
},
{
name = 'pumba',
egg_name_custom = '',
dummy_size = { x = 0.62, y = 0.62 },
dummy_offset = 0.3,
dummy_mesh = 'mobs_pumba.x',
dummy_texture = { 'mobs_pumba.png' },
night_only = false,
sound_custom = 'mobs_pig'
},
{
name = 'bunny',
egg_name_custom = '',
dummy_size = { x = 1, y = 1 },
dummy_offset = 0.2,
dummy_mesh = 'mobs_bunny.b3d',
dummy_texture = { 'mobs_bunny_brown.png' },
night_only = false,
sound_custom = 'spawners_mobs_bunny'
},
{
name = 'kitten',
egg_name_custom = '',
dummy_size = { x = 0.32, y = 0.32 },
dummy_offset = 0,
dummy_mesh = 'mobs_kitten.b3d',
dummy_texture = { 'mobs_kitten_ginger.png' },
night_only = false,
sound_custom = ''
},
{
name = 'spider',
egg_name_custom = '',
dummy_size = { x = 2, y = 2 },
dummy_offset = -0.2,
dummy_mesh = 'mobs_spider.x',
dummy_texture = { 'mobs_spider.png' },
night_only = 'disable',
sound_custom = '',
env = true
},
{
name = 'stone_monster',
egg_name_custom = '',
dummy_size = { x = 0.5, y = 0.5 },
dummy_offset = 0.05,
dummy_mesh = 'mobs_stone_monster.b3d',
dummy_texture = { 'mobs_stone_monster.png' },
night_only = true,
sound_custom = 'mobs_stonemonster'
},
{
name = 'oerkki',
egg_name_custom = '',
dummy_size = { x = 0.5, y = 0.5 },
dummy_offset = 0.05,
dummy_mesh = 'mobs_oerkki.b3d',
dummy_texture = { 'mobs_oerkki.png' },
night_only = true,
sound_custom = ''
},
{
name = 'tree_monster',
egg_name_custom = '',
dummy_size = { x = 0.4, y = 0.4} ,
dummy_offset = 0.05,
dummy_mesh = 'mobs_tree_monster.b3d',
dummy_texture = { 'mobs_tree_monster.png' },
night_only = true,
sound_custom = 'mobs_treemonster'
}
},
['creatures'] = { -- CREATURES MOD CONFIG
{
name = 'chicken',
egg_name_custom = 'creatures:chicken_spawn_egg',
dummy_size = { x = 0.9, y = 0.9 },
dummy_offset = -0.3,
dummy_mesh = 'creatures_chicken.b3d',
dummy_texture = { 'creatures_chicken.png' },
night_only = false,
sound_custom = ''
},
{
name = 'ghost',
egg_name_custom = 'creatures:ghost_spawn_egg',
dummy_size = { x = 0.7, y = 0.7 },
dummy_offset = -0.5,
dummy_mesh = 'creatures_ghost.b3d',
dummy_texture = { 'creatures_ghost.png' },
night_only = true,
sound_custom = ''
},
{
name = 'sheep',
egg_name_custom = 'creatures:sheep_spawn_egg',
dummy_size = { x = 0.6, y = 0.6 },
dummy_offset = -0.3,
dummy_mesh = 'creatures_sheep.b3d',
dummy_texture = { 'creatures_sheep.png^creatures_sheep_white.png' },
night_only = false,
sound_custom = ''
},
{
name = 'zombie',
egg_name_custom = 'creatures:zombie_spawn_egg',
dummy_size = { x = 0.5, y = 0.5 },
dummy_offset = -0.5,
dummy_mesh = 'creatures_zombie.b3d',
dummy_texture = { 'creatures_zombie.png' },
night_only = false,
sound_custom = ''
},
{
name = 'oerrki',
egg_name_custom = 'creatures:oerrki_spawn_egg',
dummy_size = { x = 0.4, y = 0.4 },
dummy_offset = -0.5,
dummy_mesh = 'creatures_oerrki.b3d',
dummy_texture = { 'creatures_oerrki.png' },
night_only = false,
sound_custom = 'creatures_oerrki_idle'
}
}
}
--
-- check for 3rd party dependencies
--
-- include mummy mobs redo addon (spawner)
if minetest.get_modpath('mobs') ~= nil then
-- enable spawner
table.insert(spawners_mobs.ENABLED_MODS, 'spawners_mobs')
-- configure spawner
spawners_mobs.MOBS_PROPS['spawners_mobs'] = {
{
name = 'mummy',
egg_name_custom = '',
dummy_size = { x = 0.4, y = 0.4 },
dummy_offset = 0,
dummy_mesh = 'spawners_mobs_mummy.b3d',
dummy_texture = { 'spawners_mobs_mummy.png' },
night_only = true,
sound_custom = 'spawners_mobs_mummy'
},
{
name = 'bunny_evil',
egg_name_custom = '',
dummy_size = { x = 1, y = 1 },
dummy_offset = 0.2,
dummy_mesh = 'spawners_mobs_evil_bunny.b3d',
dummy_texture = { 'spawners_mobs_evil_bunny.png' },
night_only = true,
sound_custom = 'spawners_mobs_bunny'
},
{
name = 'uruk_hai',
egg_name_custom = '',
dummy_size = { x = 0.5, y = 0.5 },
dummy_offset = 0,
dummy_mesh = 'spawners_mobs_character.b3d',
dummy_texture = { 'spawners_mobs_uruk_hai.png', 'spawners_mobs_trans.png','spawners_mobs_galvornsword.png', 'spawners_mobs_trans.png' },
night_only = 'disable',
sound_custom = 'spawners_mobs_barbarian_yell2',
env = true
}
}
end

View File

@ -1,331 +0,0 @@
--[[
Let the player craft Mob Spawners. Mobs are spawning randomly in a short intervals, giving the option of creating mob farms and grinders.
Copyright (C) 2016 - 2023 SaKeL <juraj.vajda@gmail.com>
This library is free software; you can redistribute it and/or
modify it pos the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to juraj.vajda@gmail.com
--]]
-- * [name : string] - Name of the mob used in the mod.
-- [egg_name_custom : string] - Custom name for the egg item. If empty default name will be used i.e. 'mobs:chicken'.
-- * [dummy_size : table] - Size of the rotating dummy inside the node.
-- * [dummy_offset : integer] - Offset on Y axis of the dummy inside the node.
-- * [dummy_mesh : string] - Filename of the model used fot he mob.
-- * [dummy_texture : table] - Textures used for the mob.
-- * [night_only : boolean : string] - If true mobs will spawn 'only' during the night or in dark areas, default:true. Writing 'disable' will disable light check and it will spawn in both states (night and day)
-- [sound_custom : string] - Custom name for the sound file name if differ from default: i.e 'mobs_cow'.
-- [*] -> MANDATORY - has to be filled in!
-- mods what should be enabled and loded, remove/add the one you want to load
spawners_mobs.ENABLED_MODS = { 'mobs', 'creatures', 'animalia' }
-- mobs properties - setup all you mobs here
spawners_mobs.MOBS_PROPS = {
['mobs'] = { -- MOBS REDO CONFIG
{
name = 'sheep_white',
egg_name_custom = '',
dummy_size = { x = 0.52, y = 0.52 },
dummy_offset = 0.2,
dummy_mesh = 'mobs_sheep.b3d',
dummy_texture = { 'mobs_sheep_wool.png^mobs_sheep_base.png' },
night_only = false,
sound_custom = 'mobs_sheep'
},
{
name = 'cow',
egg_name_custom = '',
dummy_size = { x = 0.25, y = 0.25 },
dummy_offset = -0.3,
dummy_mesh = 'mobs_cow.b3d',
dummy_texture = { 'mobs_cow.png' },
night_only = false,
sound_custom = ''
},
{
name = 'chicken',
egg_name_custom = '',
dummy_size = { x = 0.9, y = 0.9 },
dummy_offset = 0.2,
dummy_mesh = 'mobs_chicken.b3d',
dummy_texture = { 'mobs_chicken.png', 'mobs_chicken.png', 'mobs_chicken.png', 'mobs_chicken.png', 'mobs_chicken.png', 'mobs_chicken.png', 'mobs_chicken.png', 'mobs_chicken.png', 'mobs_chicken.png' },
night_only = false,
sound_custom = 'mobs_chicken'
},
{
name = 'pumba',
egg_name_custom = '',
dummy_size = { x = 0.62, y = 0.62 },
dummy_offset = -0.3,
dummy_mesh = 'mobs_pumba.b3d',
dummy_texture = { 'mobs_pumba.png' },
night_only = false,
sound_custom = 'mobs_pig'
},
-- {
-- name = 'bunny',
-- egg_name_custom = '',
-- dummy_size = { x = 1, y = 1},
-- dummy_offset = 0.2,
-- dummy_mesh = 'mobs_bunny.b3d',
-- dummy_texture = { 'mobs_bunny_brown.png' },
-- night_only = false,
-- sound_custom = 'spawners_mobs_bunny'
-- },
-- {
-- name = 'kitten',
-- egg_name_custom = '',
-- dummy_size = { x = 0.32, y = 0.32},
-- dummy_offset = 0,
-- dummy_mesh = 'mobs_kitten.b3d',
-- dummy_texture = { 'mobs_kitten_ginger.png' },
-- night_only = false,
-- sound_custom = ''
-- },
{
name = 'spider',
egg_name_custom = '',
dummy_size = { x = 0.4, y = 0.4 },
dummy_offset = 0.1,
dummy_mesh = 'mobs_spider.b3d',
dummy_texture = { 'mobs_spider_orange.png' },
night_only = true,
env = true,
sound_custom = 'mobs_spider_neutral'
},
{
name = 'stone_monster',
egg_name_custom = '',
dummy_size = { x = 0.5, y = 0.5 },
dummy_offset = 0.05,
dummy_mesh = 'mobs_stone_monster.b3d',
dummy_texture = { 'mobs_stone_monster.png' },
night_only = true,
sound_custom = 'mobs_stonemonster_neutral'
},
{
name = 'oerkki',
egg_name_custom = '',
dummy_size = { x = 0.4, y = 0.4 },
dummy_offset = 0.05,
dummy_mesh = 'mobs_oerkki.b3d',
dummy_texture = { 'mobs_oerkki.png' },
night_only = true,
sound_custom = ''
},
{
name = 'tree_monster',
egg_name_custom = '',
dummy_size = { x = 0.4, y = 0.4 },
dummy_offset = 0.05,
dummy_mesh = 'mobs_tree_monster.b3d',
dummy_texture = { 'mobs_tree_monster.png' },
night_only = true,
sound_custom = 'mobs_treemonster_neutral'
}
},
['creatures'] = { -- CREATURES MOD CONFIG
{
name = 'chicken',
egg_name_custom = 'creatures:chicken_spawn_egg',
dummy_size = { x = 0.9, y = 0.9 },
dummy_offset = -0.3,
dummy_mesh = 'creatures_chicken.b3d',
dummy_texture = { 'creatures_chicken.png' },
night_only = false,
sound_custom = ''
},
{
name = 'ghost',
egg_name_custom = 'creatures:ghost_spawn_egg',
dummy_size = { x = 0.7, y = 0.7 },
dummy_offset = -0.5,
dummy_mesh = 'creatures_ghost.b3d',
dummy_texture = { 'creatures_ghost.png' },
night_only = true,
sound_custom = ''
},
{
name = 'sheep',
egg_name_custom = 'creatures:sheep_spawn_egg',
dummy_size = { x = 0.6, y = 0.6 },
dummy_offset = -0.3,
dummy_mesh = 'creatures_sheep.b3d',
dummy_texture = { 'creatures_sheep.png^creatures_sheep_white.png' },
night_only = false,
sound_custom = ''
},
{
name = 'zombie',
egg_name_custom = 'creatures:zombie_spawn_egg',
dummy_size = { x = 0.5, y = 0.5 },
dummy_offset = -0.5,
dummy_mesh = 'creatures_zombie.b3d',
dummy_texture = { 'creatures_zombie.png' },
night_only = false,
sound_custom = ''
},
{
name = 'oerrki',
egg_name_custom = 'creatures:oerrki_spawn_egg',
dummy_size = { x = 0.4, y = 0.4 },
dummy_offset = -0.5,
dummy_mesh = 'creatures_oerrki.b3d',
dummy_texture = { 'creatures_oerrki.png' },
night_only = false,
sound_custom = 'creatures_oerrki_idle'
}
},
['animalia'] = { -- MOBS REDO CONFIG
{
name = 'chicken',
egg_name_custom = '',
dummy_size = { x = 7, y = 7 },
dummy_offset = -0.3,
dummy_mesh = 'animalia_chicken.b3d',
dummy_texture = { 'animalia_chicken_1.png' },
night_only = false,
sound_custom = 'animalia_chicken'
},
{
name = 'cow',
egg_name_custom = '',
dummy_size = { x = 3, y = 3 },
dummy_offset = -0.3,
dummy_mesh = 'animalia_cow.b3d',
dummy_texture = { 'animalia_cow_1.png' },
night_only = false,
sound_custom = 'animalia_cow'
},
{
name = 'fox',
egg_name_custom = '',
dummy_size = { x = 7, y = 7 },
dummy_offset = -0.3,
dummy_mesh = 'animalia_fox.b3d',
dummy_texture = { 'animalia_fox_1.png' },
night_only = false,
sound_custom = 'animalia_fox'
},
{
name = 'horse',
egg_name_custom = '',
dummy_size = { x = 2.5, y = 2.5 },
dummy_offset = -0.3,
dummy_mesh = 'animalia_horse.b3d',
dummy_texture = { 'animalia_horse_1.png' },
night_only = false,
sound_custom = 'animalia_horse'
},
{
name = 'frog',
egg_name_custom = '',
dummy_size = { x = 7, y = 7 },
dummy_offset = -0.3,
dummy_mesh = 'animalia_frog.b3d',
dummy_texture = { 'animalia_tree_frog.png' },
night_only = false,
sound_custom = 'animalia_frog'
},
{
name = 'pig',
egg_name_custom = '',
dummy_size = { x = 6, y = 6 },
dummy_offset = -0.3,
dummy_mesh = 'animalia_pig.b3d',
dummy_texture = { 'animalia_pig_1.png' },
night_only = false,
sound_custom = 'animalia_pig'
},
{
name = 'sheep',
egg_name_custom = '',
dummy_size = { x = 4.5, y = 4.5 },
dummy_offset = -0.3,
dummy_mesh = 'animalia_sheep.b3d',
dummy_texture = { 'animalia_sheep.png^animalia_sheep_wool.png' },
night_only = false,
sound_custom = 'animalia_sheep'
},
}
}
--
-- check for 3rd party dependencies
--
-- include mummy mobs redo addon (spawner)
if minetest.get_modpath('mobs') ~= nil then
-- enable spawner
table.insert(spawners_mobs.ENABLED_MODS, 'spawners_mobs')
-- configure spawner
spawners_mobs.MOBS_PROPS['spawners_mobs'] = {
{
name = 'mummy',
egg_name_custom = '',
dummy_size = { x = 0.4, y = 0.4 },
dummy_offset = 0,
dummy_mesh = 'spawners_mobs_mummy.b3d',
dummy_texture = { 'spawners_mobs_mummy.png' },
night_only = true,
sound_custom = 'spawners_mobs_mummy_neutral'
},
{
name = 'bunny_evil',
egg_name_custom = '',
dummy_size = { x = 1, y = 1 },
dummy_offset = 0.2,
dummy_mesh = 'spawners_mobs_evil_bunny.b3d',
dummy_texture = { 'spawners_mobs_evil_bunny.png' },
night_only = true,
sound_custom = 'spawners_mobs_bunny'
},
{
name = 'uruk_hai',
egg_name_custom = '',
dummy_size = { x = 0.5, y = 0.5 },
dummy_offset = 0,
dummy_mesh = 'spawners_mobs_character.b3d',
dummy_texture = { 'spawners_mobs_uruk_hai.png', 'spawners_mobs_trans.png','spawners_mobs_galvornsword.png', 'spawners_mobs_trans.png' },
night_only = true,
sound_custom = 'spawners_mobs_uruk_hai_neutral',
env = true
},
{
name = 'balrog',
egg_name_custom = '',
dummy_size = { x = 0.2, y = 0.2 },
dummy_offset = 0,
dummy_mesh = 'spawners_mobs_balrog.b3d',
dummy_texture = { 'spawners_mobs_balrog.png' },
night_only = 'disable',
sound_custom = 'spawners_mobs_balrog_neutral',
env = true,
boss = true
}
}
end
spawners_mobs.register_spawners()

View File

@ -22,19 +22,30 @@ local path = minetest.get_modpath('spawners_mobs')
-- API
dofile(path .. '/api.lua')
-- Spawners configurations
dofile(path .. '/config.lua')
-- Spawners for mobs
dofile(path .. '/spawners_mobs.lua')
-- include mummy mobs redo addon (mob)
-- custom mobs
if minetest.get_modpath('mobs') then
dofile(path .. '/nodes.lua')
dofile(path .. '/mob_mummy.lua')
dofile(path .. '/mob_bunny_evil.lua')
dofile(path .. '/mob_uruk_hai.lua')
dofile(path .. '/mob_balrog.lua')
dofile(path .. '/nodes_additional.lua')
end
-- Register spawners
if minetest.get_modpath('animalia') then
dofile(path .. '/mod_support_animalia.lua')
end
if minetest.get_modpath('mobs') then
dofile(path .. '/mod_support_spawners_mobs.lua')
end
if minetest.get_modpath('mobs_animal') then
dofile(path .. '/mod_support_mobs_animal.lua')
end
if minetest.get_modpath('mobs_monster') then
dofile(path .. '/mod_support_mobs_monster.lua')
end
local mod_end_time = (minetest.get_us_time() - mod_start_time) / 1000000

View File

@ -0,0 +1,148 @@
--[[
Adds environmental spawners to the map. When enabled, the spawners will be added to newly generated Dungeons and Temples. They are dropping a real mob spawner by change (small chance).
Copyright (C) 2016 - 2023 SaKeL <juraj.vajda@gmail.com>
This library is free software; you can redistribute it and/or
modify it pos the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to juraj.vajda@gmail.com
--]]
spawners_mobs.register_spawner('animalia:chicken', {
dummy_size = { x = 7, y = 7 },
dummy_offset = -0.3,
dummy_mesh = 'animalia_chicken.b3d',
dummy_texture = { 'animalia_chicken_1.png' },
night_only = false,
sound_custom = 'animalia_chicken'
})
spawners_mobs.register_spawner('animalia:cow', {
dummy_size = { x = 3, y = 3 },
dummy_offset = -0.3,
dummy_mesh = 'animalia_cow.b3d',
dummy_texture = { 'animalia_cow_1.png' },
night_only = false,
sound_custom = 'animalia_cow'
})
spawners_mobs.register_spawner('animalia:fox', {
dummy_size = { x = 7, y = 7 },
dummy_offset = -0.3,
dummy_mesh = 'animalia_fox.b3d',
dummy_texture = { 'animalia_fox_1.png' },
night_only = false,
sound_custom = 'animalia_fox'
})
spawners_mobs.register_spawner('animalia:horse', {
dummy_size = { x = 2.5, y = 2.5 },
dummy_offset = -0.3,
dummy_mesh = 'animalia_horse.b3d',
dummy_texture = { 'animalia_horse_1.png' },
night_only = false,
sound_custom = 'animalia_horse'
})
spawners_mobs.register_spawner('animalia:frog', {
dummy_size = { x = 7, y = 7 },
dummy_offset = -0.3,
dummy_mesh = 'animalia_frog.b3d',
dummy_texture = { 'animalia_tree_frog.png' },
night_only = false,
sound_custom = 'animalia_frog'
})
spawners_mobs.register_spawner('animalia:pig', {
dummy_size = { x = 6, y = 6 },
dummy_offset = -0.3,
dummy_mesh = 'animalia_pig.b3d',
dummy_texture = { 'animalia_pig_1.png' },
night_only = false,
sound_custom = 'animalia_pig'
})
spawners_mobs.register_spawner('animalia:sheep', {
dummy_size = { x = 4.5, y = 4.5 },
dummy_offset = -0.3,
dummy_mesh = 'animalia_sheep.b3d',
dummy_texture = { 'animalia_sheep.png^animalia_sheep_wool.png' },
night_only = false,
sound_custom = 'animalia_sheep'
})
spawners_mobs.register_spawner('animalia:bat', {
dummy_size = { x = 8, y = 8 },
dummy_offset = -0.1,
dummy_mesh = 'animalia_bat.b3d',
dummy_texture = { 'animalia_bat_1.png' },
night_only = true,
sound_custom = 'animalia_bat'
})
spawners_mobs.register_spawner('animalia:cat', {
dummy_size = { x = 5.5, y = 5.5 },
dummy_offset = -0.2,
dummy_mesh = 'animalia_cat.b3d',
dummy_texture = { 'animalia_cat_1.png' },
night_only = false,
sound_custom = 'animalia_cat'
})
spawners_mobs.register_spawner('animalia:owl', {
dummy_size = { x = 5, y = 5 },
dummy_offset = -0.3,
dummy_mesh = 'animalia_owl.b3d',
dummy_texture = { 'animalia_owl.png' },
night_only = true,
})
spawners_mobs.register_spawner('animalia:rat', {
dummy_size = { x = 8, y = 8 },
dummy_offset = -0.1,
dummy_mesh = 'animalia_rat.b3d',
dummy_texture = { 'animalia_rat_1.png' },
night_only = false,
})
spawners_mobs.register_spawner('animalia:reindeer', {
dummy_size = { x = 3, y = 3 },
dummy_offset = -0.3,
dummy_mesh = 'animalia_reindeer.b3d',
dummy_texture = { 'animalia_reindeer.png' },
night_only = false,
})
spawners_mobs.register_spawner('animalia:song_bird', {
dummy_size = { x = 8, y = 8 },
dummy_offset = -0.3,
dummy_mesh = 'animalia_bird.b3d',
dummy_texture = { 'animalia_cardinal.png' },
night_only = false,
sound_custom = 'animalia_cardinal'
})
spawners_mobs.register_spawner('animalia:turkey', {
dummy_size = { x = 4.5, y = 4.5 },
dummy_offset = -0.3,
dummy_mesh = 'animalia_turkey.b3d',
dummy_texture = { 'animalia_turkey_tom.png' },
night_only = false,
sound_custom = 'animalia_turkey'
})
spawners_mobs.register_spawner('animalia:wolf', {
dummy_size = { x = 4.5, y = 4.5 },
dummy_offset = -0.3,
dummy_mesh = 'animalia_wolf.b3d',
dummy_texture = { 'animalia_wolf_1.png' },
night_only = true,
})

View File

@ -0,0 +1,106 @@
--[[
Adds environmental spawners to the map. When enabled, the spawners will be added to newly generated Dungeons and Temples. They are dropping a real mob spawner by change (small chance).
Copyright (C) 2016 - 2023 SaKeL <juraj.vajda@gmail.com>
This library is free software; you can redistribute it and/or
modify it pos the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to juraj.vajda@gmail.com
--]]
spawners_mobs.register_spawner('mobs_animal:sheep_white', {
dummy_size = { x = 0.52, y = 0.52 },
dummy_offset = 0.2,
dummy_mesh = 'mobs_sheep.b3d',
dummy_texture = { 'mobs_sheep_wool.png^mobs_sheep_base.png' },
night_only = false,
sound_custom = 'mobs_sheep'
})
spawners_mobs.register_spawner('mobs_animal:cow', {
dummy_size = { x = 0.25, y = 0.25 },
dummy_offset = -0.3,
dummy_mesh = 'mobs_cow.b3d',
dummy_texture = { 'mobs_cow.png' },
night_only = false,
sound_custom = ''
})
spawners_mobs.register_spawner('mobs_animal:chicken', {
dummy_size = { x = 0.9, y = 0.9 },
dummy_offset = 0.2,
dummy_mesh = 'mobs_chicken.b3d',
dummy_texture = { 'mobs_chicken.png', 'mobs_chicken.png', 'mobs_chicken.png', 'mobs_chicken.png', 'mobs_chicken.png', 'mobs_chicken.png', 'mobs_chicken.png', 'mobs_chicken.png', 'mobs_chicken.png' },
night_only = false,
sound_custom = ''
})
spawners_mobs.register_spawner('mobs_animal:pumba', {
dummy_size = { x = 0.62, y = 0.62 },
dummy_offset = -0.3,
dummy_mesh = 'mobs_pumba.b3d',
dummy_texture = { 'mobs_pumba.png' },
night_only = false,
sound_custom = 'mobs_pig'
})
spawners_mobs.register_spawner('mobs_animal:bee', {
dummy_size = { x = 1.5, y = 1.5 },
dummy_offset = -0.5,
dummy_mesh = 'mobs_bee.b3d',
dummy_texture = { 'mobs_bee.png' },
night_only = false,
sound_custom = 'mobs_bee'
})
spawners_mobs.register_spawner('mobs_animal:bunny', {
dummy_size = { x = 1, y = 1 },
dummy_offset = 0.2,
dummy_mesh = 'mobs_bunny.b3d',
dummy_texture = { 'mobs_bunny_white.png' },
night_only = false,
})
spawners_mobs.register_spawner('mobs_animal:kitten', {
dummy_size = { x = 0.25, y = 0.25 },
dummy_offset = 0,
dummy_mesh = 'mobs_kitten.b3d',
dummy_texture = { 'mobs_kitten_striped.png' },
night_only = false,
sound_custom = 'mobs_kitten'
})
spawners_mobs.register_spawner('mobs_animal:panda', {
dummy_size = { x = 0.5, y = 0.5 },
dummy_offset = 0,
dummy_mesh = 'mobs_panda.b3d',
dummy_texture = { 'mobs_panda.png' },
night_only = false,
sound_custom = 'mobs_panda'
})
spawners_mobs.register_spawner('mobs_animal:penguin', {
dummy_size = { x = 0.2, y = 0.2 },
dummy_offset = -0.15,
dummy_mesh = 'mobs_penguin.b3d',
dummy_texture = { 'mobs_penguin.png' },
night_only = false,
})
spawners_mobs.register_spawner('mobs_animal:rat', {
dummy_size = { x = 0.9, y = 0.9 },
dummy_offset = 0.8,
dummy_mesh = 'mobs_rat.b3d',
dummy_texture = { 'mobs_rat.png' },
night_only = false,
sound_custom = 'mobs_rat'
})

View File

@ -0,0 +1,107 @@
--[[
Adds environmental spawners to the map. When enabled, the spawners will be added to newly generated Dungeons and Temples. They are dropping a real mob spawner by change (small chance).
Copyright (C) 2016 - 2023 SaKeL <juraj.vajda@gmail.com>
This library is free software; you can redistribute it and/or
modify it pos the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to juraj.vajda@gmail.com
--]]
spawners_mobs.register_spawner('mobs_monster:spider', {
dummy_size = { x = 0.4, y = 0.4 },
dummy_offset = 0.1,
dummy_mesh = 'mobs_spider.b3d',
dummy_texture = { 'mobs_spider_orange.png' },
night_only = true,
sound_custom = 'mobs_spider_neutral'
})
spawners_mobs.register_spawner('mobs_monster:stone_monster', {
dummy_size = { x = 0.5, y = 0.5 },
dummy_offset = 0.05,
dummy_mesh = 'mobs_stone_monster.b3d',
dummy_texture = { 'mobs_stone_monster.png' },
night_only = true,
sound_custom = 'mobs_stonemonster_neutral'
})
spawners_mobs.register_spawner('mobs_monster:oerkki', {
dummy_size = { x = 0.4, y = 0.4 },
dummy_offset = 0.05,
dummy_mesh = 'mobs_oerkki.b3d',
dummy_texture = { 'mobs_oerkki.png' },
night_only = true,
sound_custom = ''
})
spawners_mobs.register_spawner('mobs_monster:tree_monster', {
dummy_size = { x = 0.4, y = 0.4 },
dummy_offset = 0.05,
dummy_mesh = 'mobs_tree_monster.b3d',
dummy_texture = { 'mobs_tree_monster.png' },
night_only = true,
sound_custom = 'mobs_treemonster_neutral'
})
spawners_mobs.register_spawner('mobs_monster:dirt_monster', {
dummy_size = { x = 0.4, y = 0.4 },
dummy_offset = 0.05,
dummy_mesh = 'mobs_stone_monster.b3d',
dummy_texture = { 'mobs_dirt_monster.png' },
night_only = true,
sound_custom = 'mobs_dirtmonster'
})
spawners_mobs.register_spawner('mobs_monster:dungeon_master', {
dummy_size = { x = 0.3, y = 0.3 },
dummy_offset = -0.1,
dummy_mesh = 'mobs_dungeon_master.b3d',
dummy_texture = { 'mobs_dungeon_master.png' },
night_only = true,
sound_custom = 'mobs_dungeonmaster'
})
spawners_mobs.register_spawner('mobs_monster:land_guard', {
dummy_size = { x = 0.3, y = 0.3 },
dummy_offset = -0.1,
dummy_mesh = 'mobs_dungeon_master.b3d',
dummy_texture = { 'mobs_land_guard.png' },
night_only = true,
sound_custom = 'mobs_dungeonmaster'
})
spawners_mobs.register_spawner('mobs_monster:lava_flan', {
dummy_size = { x = 0.4, y = 0.4 },
dummy_offset = -0.1,
dummy_mesh = 'zmobs_lava_flan.x',
dummy_texture = { 'zmobs_lava_flan.png' },
night_only = true,
sound_custom = 'mobs_lavaflan'
})
spawners_mobs.register_spawner('mobs_monster:mese_monster', {
dummy_size = { x = 2.5, y = 2.5 },
dummy_offset = -0.3,
dummy_mesh = 'mobs_mese_monster.b3d',
dummy_texture = { 'mobs_mese_monster_purple.png' },
night_only = true,
sound_custom = 'mobs_mesemonster'
})
spawners_mobs.register_spawner('mobs_monster:sand_monster', {
dummy_size = { x = 0.4, y = 0.4 },
dummy_offset = 0.05,
dummy_mesh = 'mobs_sand_monster.b3d',
dummy_texture = { 'mobs_sand_monster.png' },
night_only = true,
sound_custom = 'mobs_sandmonster'
})

View File

@ -0,0 +1,54 @@
--[[
Adds environmental spawners to the map. When enabled, the spawners will be added to newly generated Dungeons and Temples. They are dropping a real mob spawner by change (small chance).
Copyright (C) 2016 - 2023 SaKeL <juraj.vajda@gmail.com>
This library is free software; you can redistribute it and/or
modify it pos the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to juraj.vajda@gmail.com
--]]
spawners_mobs.register_spawner('spawners_mobs:mummy', {
dummy_size = { x = 0.4, y = 0.4 },
dummy_offset = 0,
dummy_mesh = 'spawners_mobs_mummy.b3d',
dummy_texture = { 'spawners_mobs_mummy.png' },
night_only = true,
sound_custom = 'spawners_mobs_mummy_neutral'
})
spawners_mobs.register_spawner('spawners_mobs:bunny_evil', {
dummy_size = { x = 1, y = 1 },
dummy_offset = 0.2,
dummy_mesh = 'spawners_mobs_evil_bunny.b3d',
dummy_texture = { 'spawners_mobs_evil_bunny.png' },
night_only = true,
sound_custom = 'spawners_mobs_bunny'
})
spawners_mobs.register_spawner('spawners_mobs:uruk_hai', {
dummy_size = { x = 0.5, y = 0.5 },
dummy_offset = 0,
dummy_mesh = 'spawners_mobs_character.b3d',
dummy_texture = { 'spawners_mobs_uruk_hai.png', 'spawners_mobs_trans.png', 'spawners_mobs_galvornsword.png', 'spawners_mobs_trans.png' },
night_only = true,
sound_custom = 'spawners_mobs_uruk_hai_neutral',
})
-- spawners_mobs.register_spawner('spawners_mobs:balrog', {
-- dummy_size = { x = 0.2, y = 0.2 },
-- dummy_offset = 0,
-- dummy_mesh = 'spawners_mobs_balrog.b3d',
-- dummy_texture = { 'spawners_mobs_balrog.png' },
-- night_only = 'disable',
-- sound_custom = 'spawners_mobs_balrog_neutral',
-- boss = true
-- })

View File

@ -27,7 +27,7 @@ for i = 1, #img do
description = 'Sandstone with ' .. img[i],
tiles = { 'spawners_mobs_sandstone_carved_' .. img[i] .. '.png' },
is_ground_content = false,
groups = { cracky = 2 },
groups = { cracky = 2, stone = 1 },
sounds = default.node_sound_stone_defaults(),
})
end

View File

@ -1,165 +0,0 @@
--[[
Let the player craft Mob Spawners. Mobs are spawning randomly in a short intervals, giving the option of creating mob farms and grinders.
Copyright (C) 2016 - 2023 SaKeL <juraj.vajda@gmail.com>
This library is free software; you can redistribute it and/or
modify it pos the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to juraj.vajda@gmail.com
--]]
--
-- CREATE ALL SPAWNERS NODES
--
function spawners_mobs.create(mob_table, idx)
local mob_name = mob_table.name
local mod_prefix = mob_table.mod_prefix
local size = mob_table.dummy_size
local mesh = mob_table.dummy_mesh
local texture = mob_table.dummy_texture
--
-- DUMMY INSIDE THE SPAWNER
--
minetest.register_entity('spawners_mobs:dummy_' .. mod_prefix .. '_' .. mob_name, {
hp_max = 1,
visual = 'mesh',
visual_size = size,
collisionbox = { 0, 0, 0, 0, 0, 0 },
mesh = mesh,
textures = texture,
physical = false,
makes_footstep_sound = false,
automatic_rotate = math.pi * -3,
static_save = false,
on_activate = function(self, staticdata, dtime_s)
self.object:set_velocity({ x = 0, y = 0, z = 0 })
self.object:set_acceleration({ x = 0, y = 0, z = 0 })
self.object:set_armor_groups({ immortal = 1 })
end
})
--
-- DEFAULT SPAWNER
--
minetest.register_node('spawners_mobs:' .. mod_prefix .. '_' .. mob_name .. '_spawner', {
description = mod_prefix .. '_' .. mob_name .. ' spawner',
paramtype = 'light',
paramtype2 = 'glasslikeliquidlevel',
drawtype = 'glasslike_framed_optional',
walkable = true,
sounds = default.node_sound_metal_defaults(),
sunlight_propagates = true,
tiles = { 'spawners_mobs_spawner_16.png' },
is_ground_content = false,
groups = { cracky = 1, level = 2 },
stack_max = 1,
light_source = 6,
on_timer = spawners_mobs.on_timer,
on_construct = function(pos)
-- set meta
local meta = minetest.get_meta(pos)
meta:set_int('idx', idx)
meta:set_int('tick', 0)
meta:set_int('tick_short', 0)
spawners_mobs.set_status(pos, 'active')
spawners_mobs.tick_short(pos)
end,
after_place_node = function(pos, placer, itemstack, pointed_thing)
local meta = minetest.get_meta(pos)
meta:set_string('owner', placer:get_player_name())
meta:set_string('infotext', mob_name .. ' spawner\nowner: ' .. placer:get_player_name() .. '\nspawner is active')
end,
on_destruct = function(pos)
-- delete particles and remove dummy
spawners_mobs.set_status(pos, 'waiting')
end
})
table.insert(spawners_mobs.registered_spawners_names, 'spawners_mobs:' .. mod_prefix .. '_' .. mob_name .. '_spawner')
--
-- WAITING SPAWNER
--
minetest.register_node('spawners_mobs:' .. mod_prefix .. '_' .. mob_name .. '_spawner_waiting', {
description = mod_prefix .. '_' .. mob_name .. ' spawner waiting',
paramtype = 'light',
paramtype2 = 'glasslikeliquidlevel',
drawtype = 'glasslike_framed_optional',
sounds = default.node_sound_metal_defaults(),
walkable = true,
sunlight_propagates = true,
tiles = {
{
name = 'spawners_mobs_spawner_waiting_animated_16.png',
animation = {
type = 'vertical_frames',
aspect_w = 16,
aspect_h = 16,
length = 2.0
},
}
},
is_ground_content = false,
groups = { cracky = 1, level = 2, not_in_creative_inventory = 1 },
light_source = 4,
drop = 'spawners_mobs:' .. mod_prefix .. '_' .. mob_name .. '_spawner',
on_timer = spawners_mobs.on_timer
})
--
-- RUSTY SPAWNER
--
minetest.register_node('spawners_mobs:' .. mod_prefix .. '_' .. mob_name .. '_spawner_rusty', {
description = mod_prefix .. '_' .. mob_name .. ' spawner rusty',
paramtype = 'light',
paramtype2 = 'glasslikeliquidlevel',
drawtype = 'glasslike_framed_optional',
sounds = default.node_sound_metal_defaults(),
walkable = true,
sunlight_propagates = true,
tiles = { 'spawners_mobs_spawner_rusty.png' },
is_ground_content = false,
groups = { cracky = 1, level = 2, not_in_creative_inventory = 1 },
drop = 'spawners_mobs:' .. mod_prefix .. '_' .. mob_name .. '_spawner'
})
--
-- replacement LBM for pre-nodetimer spawners
--
minetest.register_lbm({
name = 'spawners_mobs:start_nodetimer_' .. mod_prefix .. '_' .. mob_name .. '_spawner',
nodenames = 'spawners_mobs:' .. mod_prefix .. '_' .. mob_name .. '_spawner',
action = function(pos)
spawners_mobs.tick_short(pos)
end,
})
--
-- COMPATIBILITY
--
minetest.register_alias('spawners_mobs:' .. mod_prefix .. '_' .. mob_name .. '_spawner_active', 'spawners_mobs:' .. mod_prefix .. '_' .. mob_name .. '_spawner')
end
--
-- INIT 'CREATE' FOR ALL SPAWNERS
--
for i, mob_table in ipairs(spawners_mobs.mob_tables) do
spawners_mobs.create(mob_table, i)
end