Add mob spawning underground

main
Bram van den Heuvel 2024-09-13 01:42:12 +02:00
parent 66a5c55ba7
commit efc7ddb4e5
3 changed files with 29 additions and 2 deletions

8
.gitignore vendored
View File

@ -1,2 +1,8 @@
# Folders
.vscode .vscode
.env .env
# Files
ns_vl_caves_schist_large.png
ns_vl_caves_gneiss_large.png
show.py

View File

@ -304,6 +304,16 @@ function internal.register_ore(def)
}) })
end end
function internal.register_monster_spawn(name, biomes, interval, chance, aoc)
return mcl_mobs:spawn_specific(
"mobs_mc:" .. name, "overworld", "ground", biomes, 0, 7,
interval, chance, aoc, mcl_vars.mg_overworld_min,
mcl_vars.mg_overworld_max, nil, function(self, pos)
minetest.debug("Spawned " .. name .. " at position " .. minetest.pos_to_string(pos))
end
)
end
-- Register a new deepslate-like stone type. -- Register a new deepslate-like stone type.
-- { -- {
-- -- Name of the deepslate type. Required. -- -- Name of the deepslate type. Required.
@ -528,6 +538,17 @@ function internal.overwrite_register_biome()
OLD_REGISTER_BIOME(slate_def) OLD_REGISTER_BIOME(slate_def)
OLD_REGISTER_BIOME(schist_def) OLD_REGISTER_BIOME(schist_def)
OLD_REGISTER_BIOME(gneiss_def) OLD_REGISTER_BIOME(gneiss_def)
local biome_names = { slate_def.name, schist_def.name, gneiss_def.name }
internal.register_monster_spawn("zombie", biome_names, 30, 1000, 4)
internal.register_monster_spawn("rover", biome_names, 30, 100, 2)
internal.register_monster_spawn("skeleton", biome_names, 20, 800, 2)
internal.register_monster_spawn("spider", biome_names, 30, 1000, 2)
internal.register_monster_spawn("stalker", biome_names, 20, 1000, 2)
internal.register_monster_spawn("villager_zombie", biome_names, 30, 50, 4)
internal.register_monster_spawn("zombie", biome_names, 30, 1000, 4)
internal.register_monster_spawn("baby_zombie", biome_names, 30, 50, 4)
else else
return OLD_REGISTER_BIOME(def) return OLD_REGISTER_BIOME(def)
end end

View File

@ -2,5 +2,5 @@ name=ns_vl_caves
description=Custom caves in VoxeLibre description=Custom caves in VoxeLibre
author=Noordstar author=Noordstar
title=VoxeLibre caves title=VoxeLibre caves
depends=mcl_core,mcl_init,mcl_raw_ores,mcl_sounds,mcl_util,ns_cavegen depends=mcl_core,mcl_init,mcl_mobs,mcl_raw_ores,mcl_sounds,mcl_util,ns_cavegen
optional_depends= optional_depends=