forked from VoxeLibre/VoxeLibre
Add settings for percentage of hostile and peaceful groups spawned
This commit is contained in:
parent
86b1d8bc3e
commit
cfa276f722
|
@ -46,7 +46,7 @@ local FIND_SPAWN_POS_RETRIES = 10
|
||||||
|
|
||||||
local MOB_SPAWN_ZONE_INNER = 24
|
local MOB_SPAWN_ZONE_INNER = 24
|
||||||
local MOB_SPAWN_ZONE_MIDDLE = 32
|
local MOB_SPAWN_ZONE_MIDDLE = 32
|
||||||
local MOB_SPAWN_ZONE_OUTER = 128 --TODO not used yet. Should replace aoc
|
local MOB_SPAWN_ZONE_OUTER = 128
|
||||||
|
|
||||||
-- range for mob count
|
-- range for mob count
|
||||||
local MOB_CAP_INNER_RADIUS = 32
|
local MOB_CAP_INNER_RADIUS = 32
|
||||||
|
@ -68,12 +68,16 @@ local mob_cap = {
|
||||||
}
|
}
|
||||||
|
|
||||||
local peaceful_percentage_spawned = tonumber(minetest.settings:get("mcl_mob_peaceful_percentage_spawned")) or 30
|
local peaceful_percentage_spawned = tonumber(minetest.settings:get("mcl_mob_peaceful_percentage_spawned")) or 30
|
||||||
|
local peaceful_group_percentage_spawned = tonumber(minetest.settings:get("mcl_mob_peaceful_group_percentage_spawned")) or 15
|
||||||
|
local hostile_group_percentage_spawned = tonumber(minetest.settings:get("mcl_mob_hostile_group_percentage_spawned")) or 20
|
||||||
|
|
||||||
mcl_log("Mob cap hostile: " .. mob_cap.hostile)
|
mcl_log("Mob cap hostile: " .. mob_cap.hostile)
|
||||||
mcl_log("Mob cap water: " .. mob_cap.water)
|
mcl_log("Mob cap water: " .. mob_cap.water)
|
||||||
mcl_log("Mob cap passive: " .. mob_cap.passive)
|
mcl_log("Mob cap passive: " .. mob_cap.passive)
|
||||||
|
|
||||||
mcl_log("Percentage of peacefuls spawned: " .. peaceful_percentage_spawned)
|
mcl_log("Percentage of peacefuls spawned: " .. peaceful_percentage_spawned)
|
||||||
|
mcl_log("Percentage of peaceful spawns are group: " .. peaceful_group_percentage_spawned)
|
||||||
|
mcl_log("Percentage of hostile spawns are group: " .. hostile_group_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
|
||||||
|
@ -734,19 +738,10 @@ if mobs_spawn then
|
||||||
|
|
||||||
local function mob_cap_space (pos, mob_type, mob_counts_close, mob_counts_wide)
|
local function mob_cap_space (pos, mob_type, mob_counts_close, mob_counts_wide)
|
||||||
|
|
||||||
--type = "monster",
|
-- Some mob examples
|
||||||
--spawn_class = "hostile",
|
--type = "monster", spawn_class = "hostile",
|
||||||
--type = "animal",
|
--type = "animal", spawn_class = "passive",
|
||||||
--spawn_class = "passive",
|
--local cod = { type = "animal", spawn_class = "water",
|
||||||
--local cod = {
|
|
||||||
-- type = "animal",
|
|
||||||
-- spawn_class = "water",
|
|
||||||
|
|
||||||
--if mob_type == "animal" then
|
|
||||||
--end
|
|
||||||
|
|
||||||
--mcl_log("spawn_class: " .. spawn_class)
|
|
||||||
|
|
||||||
|
|
||||||
local type_cap = mob_cap[mob_type] or MISSING_CAP_DEFAULT
|
local type_cap = mob_cap[mob_type] or MISSING_CAP_DEFAULT
|
||||||
local close_zone_cap = MOBS_CAP_CLOSE
|
local close_zone_cap = MOBS_CAP_CLOSE
|
||||||
|
@ -773,6 +768,8 @@ if mobs_spawn then
|
||||||
cap_space_close = 0
|
cap_space_close = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
--mcl_log("spawn_class: " .. spawn_class)
|
||||||
|
|
||||||
if false and mob_type == "water" then
|
if false and mob_type == "water" then
|
||||||
mcl_log("mob_type: " .. mob_type .. " and pos: " .. minetest.pos_to_string(pos))
|
mcl_log("mob_type: " .. mob_type .. " and pos: " .. minetest.pos_to_string(pos))
|
||||||
mcl_log("wide: " .. mob_total_wide .. "/" .. type_cap)
|
mcl_log("wide: " .. mob_total_wide .. "/" .. type_cap)
|
||||||
|
@ -922,8 +919,14 @@ if mobs_spawn then
|
||||||
--everything is correct, spawn mob
|
--everything is correct, spawn mob
|
||||||
local spawn_in_group = mob_def_ent.spawn_in_group or 4
|
local spawn_in_group = mob_def_ent.spawn_in_group or 4
|
||||||
|
|
||||||
|
local spawn_group_hostile = (mob_spawn_class == "hostile") and (math.random(100) < hostile_group_percentage_spawned)
|
||||||
|
local spawn_group_passive = (mob_spawn_class ~= "hostile") and (math.random(100) < peaceful_group_percentage_spawned)
|
||||||
|
|
||||||
|
mcl_log("spawn_group_hostile: " .. tostring(spawn_group_hostile))
|
||||||
|
mcl_log("spawn_group_passive: " .. tostring(spawn_group_passive))
|
||||||
|
|
||||||
local spawned
|
local spawned
|
||||||
if spawn_in_group and (math.random(5) == 1) then
|
if spawn_in_group and (spawn_group_hostile or spawn_group_passive) then
|
||||||
local group_min = mob_def_ent.spawn_in_group_min or 1
|
local group_min = mob_def_ent.spawn_in_group_min or 1
|
||||||
if not group_min then group_min = 1 end
|
if not group_min then group_min = 1 end
|
||||||
|
|
||||||
|
|
|
@ -118,6 +118,12 @@ mobs_disable_blood (Disable mob damage particles) bool false
|
||||||
#Percentage of peaceful spawn attempts that succeed (default:30)
|
#Percentage of peaceful spawn attempts that succeed (default:30)
|
||||||
mcl_mob_peaceful_percentage_spawned (Peaceful percentage success) int 30 0 100
|
mcl_mob_peaceful_percentage_spawned (Peaceful percentage success) int 30 0 100
|
||||||
|
|
||||||
|
#Percentage of peaceful spawn attempts that are group spawns (default:15)
|
||||||
|
mcl_mob_peaceful_group_percentage_spawned (Peaceful group percentage) int 15 0 100
|
||||||
|
|
||||||
|
#Percentage of hostile spawn attempts that are group spawns (default:20)
|
||||||
|
mcl_mob_hostile_group_percentage_spawned (Hostile group percentage) int 20 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
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue