forked from VoxeLibre/VoxeLibre
Limit peaceful spawning and add configurable option
This commit is contained in:
parent
044a91e831
commit
9c2f43a242
|
@ -59,12 +59,20 @@ local mob_cap = {
|
||||||
hostile = tonumber(minetest.settings:get("mcl_mob_cap_monster")) or 70,
|
hostile = tonumber(minetest.settings:get("mcl_mob_cap_monster")) or 70,
|
||||||
passive = tonumber(minetest.settings:get("mcl_mob_cap_animal")) or 10,
|
passive = tonumber(minetest.settings:get("mcl_mob_cap_animal")) or 10,
|
||||||
ambient = tonumber(minetest.settings:get("mcl_mob_cap_ambient")) or 15,
|
ambient = tonumber(minetest.settings:get("mcl_mob_cap_ambient")) or 15,
|
||||||
water = tonumber(minetest.settings:get("mcl_mob_cap_water")) or 5,
|
water = tonumber(minetest.settings:get("mcl_mob_cap_water")) or 10,
|
||||||
water_ambient = tonumber(minetest.settings:get("mcl_mob_cap_water_ambient")) or 20, --currently unused
|
water_ambient = tonumber(minetest.settings:get("mcl_mob_cap_water_ambient")) or 20, --currently unused
|
||||||
player = tonumber(minetest.settings:get("mcl_mob_cap_player")) or 75,
|
player = tonumber(minetest.settings:get("mcl_mob_cap_player")) or 75,
|
||||||
total = tonumber(minetest.settings:get("mcl_mob_cap_total")) or 500,
|
total = tonumber(minetest.settings:get("mcl_mob_cap_total")) or 500,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local peaceful_percentage_spawned = tonumber(minetest.settings:get("mcl_mob_peaceful_percentage_spawned")) or 30
|
||||||
|
|
||||||
|
mcl_log("Mob cap hostile: " .. mob_cap.hostile)
|
||||||
|
mcl_log("Mob cap water: " .. mob_cap.water)
|
||||||
|
mcl_log("Mob cap passive: " .. mob_cap.passive)
|
||||||
|
|
||||||
|
mcl_log("Percentage of peacefuls spawned: " .. peaceful_percentage_spawned)
|
||||||
|
|
||||||
--do mobs spawn?
|
--do mobs spawn?
|
||||||
local mobs_spawn = minetest.settings:get_bool("mobs_spawn", true) ~= false
|
local mobs_spawn = minetest.settings:get_bool("mobs_spawn", true) ~= false
|
||||||
local spawn_protected = minetest.settings:get_bool("mobs_spawn_protected") ~= false
|
local spawn_protected = minetest.settings:get_bool("mobs_spawn_protected") ~= false
|
||||||
|
@ -869,14 +877,23 @@ if mobs_spawn then
|
||||||
local mob_def_ent = minetest.registered_entities[mob_def.name]
|
local mob_def_ent = minetest.registered_entities[mob_def.name]
|
||||||
--local mob_type = mob_def_ent.type
|
--local mob_type = mob_def_ent.type
|
||||||
local mob_spawn_class = mob_def_ent.spawn_class
|
local mob_spawn_class = mob_def_ent.spawn_class
|
||||||
--mcl_log("mob_spawn_class: " .. mob_spawn_class)
|
mcl_log("mob_spawn_class: " .. mob_spawn_class)
|
||||||
|
|
||||||
local cap_space_wide, cap_space_close = mob_cap_space (spawning_position, mob_spawn_class, mob_counts_close, mob_counts_wide)
|
local cap_space_wide, cap_space_close = mob_cap_space (spawning_position, mob_spawn_class, mob_counts_close, mob_counts_wide)
|
||||||
|
|
||||||
|
|
||||||
if cap_space_close > 0 and cap_space_wide > 0 then
|
if cap_space_close > 0 and cap_space_wide > 0 then
|
||||||
mcl_log("Cap space available")
|
mcl_log("Cap space available")
|
||||||
|
|
||||||
if spawn_check(spawning_position,mob_def) then
|
-- Spawn caps for animals and water creatures fill up rapidly. Need to throttle this somewhat
|
||||||
|
-- for performance and for early game challenge. We don't want to reduce hostiles though.
|
||||||
|
local spawn_hostile = (mob_spawn_class == "hostile")
|
||||||
|
local spawn_passive = (mob_spawn_class == "passive" or mob_spawn_class == "water") and math.random(100) < peaceful_percentage_spawned
|
||||||
|
-- or not hostile
|
||||||
|
mcl_log("Spawn_passive: " .. tostring(spawn_passive))
|
||||||
|
mcl_log("Spawn_hostile: " .. tostring(spawn_hostile))
|
||||||
|
|
||||||
|
if (spawn_hostile or spawn_passive) and spawn_check(spawning_position,mob_def) then
|
||||||
if mob_def.type_of_spawning == "water" then
|
if mob_def.type_of_spawning == "water" then
|
||||||
spawning_position = get_water_spawn(spawning_position)
|
spawning_position = get_water_spawn(spawning_position)
|
||||||
if not spawning_position then
|
if not spawning_position then
|
||||||
|
|
|
@ -115,6 +115,9 @@ mobs_griefing (Mobs change blocks) bool true
|
||||||
# If enabled, mobs won't damage particles when they got hurt.
|
# If enabled, mobs won't damage particles when they got hurt.
|
||||||
mobs_disable_blood (Disable mob damage particles) bool false
|
mobs_disable_blood (Disable mob damage particles) bool false
|
||||||
|
|
||||||
|
#Percentage of peaceful spawn attempts that succeed (default:30)
|
||||||
|
mcl_mob_peaceful_percentage_spawned (Peaceful percentage success) int 30 0 100
|
||||||
|
|
||||||
#Maximum amount mobs (default:500)
|
#Maximum amount mobs (default:500)
|
||||||
mcl_mob_cap_total (Global mob cap) int 500 0 2048
|
mcl_mob_cap_total (Global mob cap) int 500 0 2048
|
||||||
|
|
||||||
|
@ -127,6 +130,9 @@ mcl_mob_cap_monster (Mob cap monsters) int 70 0 2048
|
||||||
#Maximum amount of animals that will spawn near a player (default:10)
|
#Maximum amount of animals that will spawn near a player (default:10)
|
||||||
mcl_mob_cap_animal (Mob cap animals) int 10 0 1024
|
mcl_mob_cap_animal (Mob cap animals) int 10 0 1024
|
||||||
|
|
||||||
|
#Maximum amount of water mobs that will spawn near a player (default:10)
|
||||||
|
mcl_mob_cap_water (Mob cap water) int 10 0 1024
|
||||||
|
|
||||||
#Maximum amount of ambient mobs that will spawn near a player (default:15)
|
#Maximum amount of ambient mobs that will spawn near a player (default:15)
|
||||||
mcl_mob_cap_ambient (Mob cap ambient mobs) int 15 0 1024
|
mcl_mob_cap_ambient (Mob cap ambient mobs) int 15 0 1024
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue