Spawn monsters/treasure by depth.
This commit is contained in:
parent
0405fb8448
commit
3fe63e8fd8
4 changed files with 94 additions and 38 deletions
26
mobs.lua
26
mobs.lua
|
@ -821,7 +821,7 @@ if fun_caves.path then
|
|||
dofile(fun_caves.path.."/demon.lua")
|
||||
end
|
||||
|
||||
fun_caves.fortress_spawns = {}
|
||||
fun_caves.dungeon_spawns = {}
|
||||
local t_mobs = {
|
||||
"mobs_monster:dungeon_master",
|
||||
"mobs_monster:lava_flan",
|
||||
|
@ -851,7 +851,27 @@ local t_mobs = {
|
|||
}
|
||||
for _, mob in pairs(t_mobs) do
|
||||
if minetest.registered_entities[mob] then
|
||||
--mobs:register_spawn(mob, {"fun_caves:dungeon_floor_1"}, 20, 0, 2000, 5, 31000)
|
||||
fun_caves.fortress_spawns[#fun_caves.fortress_spawns+1] = mob
|
||||
local obj = minetest.registered_entities[mob]
|
||||
if obj.hp_max and obj.hp_min and obj.damage then
|
||||
local hp = (obj.hp_min + obj.hp_max) / 2
|
||||
local level = math.floor(hp / 10 + obj.damage + 0.5)
|
||||
|
||||
fun_caves.dungeon_spawns[#fun_caves.dungeon_spawns+1] = {
|
||||
name = mob,
|
||||
level = level,
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
table.sort(fun_caves.dungeon_spawns, function(a, b)
|
||||
if a.level < b.level then
|
||||
return true
|
||||
elseif a.level > b.level then
|
||||
return false
|
||||
elseif a.name < b.name then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue