Adds a cap to Xenobiology Mobs and Allows Sentient Giant Spider prompts to be disabled (#17316)

Co-authored-by: dearmochi <1496804+dearmochi@users.noreply.github.com>
This commit is contained in:
Sirryan2002
2022-01-16 18:54:10 +01:00
committed by GitHub
co-authored by dearmochi
parent 41ac99506d
commit 1da61d4d27
7 changed files with 39 additions and 19 deletions
+3
View File
@@ -184,6 +184,9 @@
#define HOSTILE_SPAWN 1
#define FRIENDLY_SPAWN 2
///Max amount of living Xenobio mobs allowed at any given time (excluding slimes).
#define MAX_GOLD_CORE_MOBS 45
#define TINT_IMPAIR 2 //Threshold of tint level to apply weld mask overlay
#define TINT_BLIND 3 //Threshold of tint level to obscure vision fully
#define EYE_SHINE_THRESHOLD 6 //dark_view threshold past which a humanoid's eyes will 'shine' in the dark.
+2 -2
View File
@@ -9,8 +9,8 @@ SUBSYSTEM_DEF(mobs)
var/static/list/clients_by_zlevel[][]
var/static/list/dead_players_by_zlevel[][] = list(list()) // Needs to support zlevel 1 here, MaxZChanged only happens when CC is created and new_players can login before that.
var/static/list/cubemonkeys = list()
/// The amount of giant spiders that exist in the world. Used for mob capping.
var/giant_spiders = 0
/// The amount of Xenobiology mobs (and their offspring) that exist in the world. Used for mob capping. Excludes Slimes
var/xenobiology_mobs = 0
/datum/controller/subsystem/mobs/get_metrics()
. = ..()
+11 -7
View File
@@ -1,6 +1,3 @@
//generic procs copied from obj/effect/alien
#define SPIDER_SOFT_CAP 30
#define SPIDER_HARD_CAP 40
/obj/structure/spider
name = "web"
desc = "it's stringy and sticky"
@@ -60,6 +57,8 @@
icon_state = "eggs"
var/amount_grown = 0
var/player_spiders = 0
///Was this egg laid by a xenobiology mob? Used for mob capping
var/xenobiology_spawned = FALSE
var/list/faction = list("spiders")
/obj/structure/spider/eggcluster/Initialize(mapload)
@@ -69,7 +68,7 @@
START_PROCESSING(SSobj, src)
/obj/structure/spider/eggcluster/process()
if(SSmobs.giant_spiders > SPIDER_SOFT_CAP) //eggs gonna chill out until there is less spiders
if(SSmobs.xenobiology_mobs > MAX_GOLD_CORE_MOBS - 10) //eggs gonna chill out until there is less spiders
return
amount_grown += rand(0, 2)
@@ -80,6 +79,7 @@
var/obj/structure/spider/spiderling/S = new /obj/structure/spider/spiderling(loc)
S.faction = faction.Copy()
S.master_commander = master_commander
S.xenobiology_spawned = xenobiology_spawned
if(player_spiders)
S.player_spiders = TRUE
qdel(src)
@@ -98,6 +98,8 @@
var/player_spiders = 0
var/list/faction = list("spiders")
var/selecting_player = 0
///Is this spiderling created from a xenobiology mob?
var/xenobiology_spawned = FALSE
/obj/structure/spider/spiderling/Initialize(mapload)
. = ..()
@@ -174,19 +176,21 @@
if(isturf(loc))
amount_grown += rand(0,2)
if(amount_grown >= 100)
if(SSmobs.giant_spiders > SPIDER_HARD_CAP)
if(SSmobs.xenobiology_mobs > MAX_GOLD_CORE_MOBS && xenobiology_spawned)
qdel(src)
return
if(!grow_as)
grow_as = pick(typesof(/mob/living/simple_animal/hostile/poison/giant_spider))
var/mob/living/simple_animal/hostile/poison/giant_spider/S = new grow_as(loc)
SSmobs.giant_spiders++
S.faction = faction.Copy()
S.master_commander = master_commander
S.xenobiology_spawned = xenobiology_spawned
if(xenobiology_spawned)
SSmobs.xenobiology_mobs++
if(player_spiders && !selecting_player)
selecting_player = 1
spawn()
var/list/candidates = SSghost_spawns.poll_candidates("Do you want to play as a giant spider?", ROLE_GSPIDER, TRUE, source = S)
var/list/candidates = SSghost_spawns.poll_candidates("Do you want to play as a giant spider?", ROLE_SENTIENT, TRUE, source = S)
if(length(candidates) && !QDELETED(S))
var/mob/C = pick(candidates)
@@ -56,12 +56,6 @@
for(var/obj/structure/spider/S in range(1, get_turf(src)))
return S
/mob/living/simple_animal/hostile/poison/giant_spider/death(gibbed)
. = ..()
if(!.)
return FALSE
SSmobs.giant_spiders--
//nursemaids - these create webs and eggs
/mob/living/simple_animal/hostile/poison/giant_spider/nurse
desc = "Furry and black, it makes you shudder to look at it. This one has brilliant green eyes."
@@ -263,6 +257,7 @@
var/obj/structure/spider/eggcluster/C = new /obj/structure/spider/eggcluster(src.loc)
C.faction = faction.Copy()
C.master_commander = master_commander
C.xenobiology_spawned = xenobiology_spawned
if(ckey)
C.player_spiders = 1
fed--
@@ -80,6 +80,8 @@
var/max_offspring = DEFAULT_MAX_OFFSPRING
var/buffed = 0 //In the event that you want to have a buffing effect on the mob, but don't want it to stack with other effects, any outside force that applies a buff to a simple mob should at least set this to 1, so we have something to check against
///Was this mob spawned by xenobiology magic? Used for mobcapping.
var/xenobiology_spawned = FALSE
var/gold_core_spawnable = NO_SPAWN //If the mob can be spawned with a gold slime core. HOSTILE_SPAWN are spawned with plasma, FRIENDLY_SPAWN are spawned with blood
var/mob/living/carbon/human/master_commander = null //holding var for determining who own/controls a sentient simple animal (for sentience potions).
@@ -374,6 +376,8 @@
visible_message("<span class='danger'>\The [src] [deathmessage]</span>")
else if(!del_on_death)
visible_message("<span class='danger'>\The [src] stops moving...</span>")
if(xenobiology_spawned)
SSmobs.xenobiology_mobs--
if(del_on_death)
//Prevent infinite loops if the mob Destroy() is overridden in such
//a manner as to cause a call to death() again
+3 -1
View File
@@ -21,7 +21,7 @@
return
/datum/chemical_reaction/proc/chemical_mob_spawn(datum/reagents/holder, amount_to_spawn, reaction_name, mob_class = HOSTILE_SPAWN, mob_faction = "chemicalsummon", random = TRUE)
/datum/chemical_reaction/proc/chemical_mob_spawn(datum/reagents/holder, amount_to_spawn, reaction_name, mob_class = HOSTILE_SPAWN, mob_faction = "chemicalsummon", random = TRUE, gold_core_spawn = FALSE)
if(holder && holder.my_atom)
var/atom/A = holder.my_atom
var/turf/T = get_turf(A)
@@ -48,6 +48,8 @@
S = create_random_mob(get_turf(holder.my_atom), mob_class)
else
S = new mob_class(get_turf(holder.my_atom))//Spawn our specific mob_class
if(gold_core_spawn) //For tracking xenobiology mobs
S.xenobiology_spawned = TRUE
S.faction |= mob_faction
if(prob(50))
for(var/j = 1, j <= rand(1, 3), j++)
@@ -102,7 +102,11 @@
/datum/chemical_reaction/slimemobspawn/proc/summon_mobs(datum/reagents/holder, turf/T)
T.visible_message("<span class='danger'>The slime extract begins to vibrate violently!</span>")
addtimer(CALLBACK(src, .proc/chemical_mob_spawn, holder, 5, "Gold Slime", HOSTILE_SPAWN), 50)
if(SSmobs.xenobiology_mobs < MAX_GOLD_CORE_MOBS)
addtimer(CALLBACK(src, .proc/chemical_mob_spawn, holder, 5, "Gold Slime", HOSTILE_SPAWN, "chemicalsummon", TRUE, TRUE), 50)
SSmobs.xenobiology_mobs += 5
else
T.visible_message("<span class='danger'>The slime extract sputters out, there's too many mobs to make any more!</span>")
/datum/chemical_reaction/slimemobspawn/lesser
name = "Slime Crit Lesser"
@@ -111,7 +115,11 @@
/datum/chemical_reaction/slimemobspawn/lesser/summon_mobs(datum/reagents/holder, turf/T)
T.visible_message("<span class='danger'>The slime extract begins to vibrate violently!</span>")
addtimer(CALLBACK(src, .proc/chemical_mob_spawn, holder, 3, "Lesser Gold Slime", HOSTILE_SPAWN, "neutral"), 50)
if(SSmobs.xenobiology_mobs < MAX_GOLD_CORE_MOBS)
addtimer(CALLBACK(src, .proc/chemical_mob_spawn, holder, 3, "Lesser Gold Slime", HOSTILE_SPAWN, "neutral", TRUE, TRUE), 50)
SSmobs.xenobiology_mobs += 3
else
T.visible_message("<span class='danger'>The slime extract sputters out, there's too many mobs to make any more!</span>")
/datum/chemical_reaction/slimemobspawn/friendly
name = "Slime Crit Friendly"
@@ -120,7 +128,11 @@
/datum/chemical_reaction/slimemobspawn/friendly/summon_mobs(datum/reagents/holder, turf/T)
T.visible_message("<span class='danger'>The slime extract begins to vibrate adorably!</span>")
addtimer(CALLBACK(src, .proc/chemical_mob_spawn, holder, 1, "Friendly Gold Slime", FRIENDLY_SPAWN, "neutral"), 50)
if(SSmobs.xenobiology_mobs < MAX_GOLD_CORE_MOBS)
addtimer(CALLBACK(src, .proc/chemical_mob_spawn, holder, 1, "Friendly Gold Slime", FRIENDLY_SPAWN, "neutral", TRUE, TRUE), 50)
SSmobs.xenobiology_mobs += 1
else
T.visible_message("<span class='danger'>The slime extract sputters out, there's too many mobs to make any more!</span>")
//Silver
/datum/chemical_reaction/slimebork