Sets a Mob Cap for Giant Spiders (#15923)

* Counting and Capping for Giant Spider Spawning

* Moves magic numbers into defines

* Apply suggestions from code review

Co-authored-by: dearmochi <shenesis@gmail.com>

* Update code/controllers/subsystem/mobs.dm

Co-authored-by: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com>

* makes requested changes

* I hope to god this fixes this

* implements requested changes

* removes double parent call

Co-authored-by: dearmochi <shenesis@gmail.com>
Co-authored-by: AffectedArc07 <25063394+AffectedArc07@users.noreply.github.com>
This commit is contained in:
Sirryan2002
2021-08-05 21:23:01 +01:00
committed by GitHub
co-authored by dearmochi AffectedArc07
parent b2d46ba7bc
commit 9bf4d7ad84
4 changed files with 21 additions and 3 deletions
+1 -1
View File
@@ -2,4 +2,4 @@
"workbench.editorAssociations": {
"*.dmi": "imagePreview.previewEditor"
}
}
}
+2
View File
@@ -9,6 +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
/datum/controller/subsystem/mobs/stat_entry()
..("P:[GLOB.mob_living_list.len]")
+12 -2
View File
@@ -1,4 +1,6 @@
//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"
@@ -67,7 +69,11 @@
START_PROCESSING(SSobj, src)
/obj/structure/spider/eggcluster/process()
amount_grown += rand(0,2)
if(SSmobs.giant_spiders > SPIDER_SOFT_CAP) //eggs gonna chill out until there is less spiders
return
amount_grown += rand(0, 2)
if(amount_grown >= 100)
var/num = rand(3, 12)
for(var/i in 1 to num)
@@ -75,7 +81,7 @@
S.faction = faction.Copy()
S.master_commander = master_commander
if(player_spiders)
S.player_spiders = 1
S.player_spiders = TRUE
qdel(src)
/obj/structure/spider/spiderling
@@ -168,9 +174,13 @@
if(isturf(loc))
amount_grown += rand(0,2)
if(amount_grown >= 100)
if(SSmobs.giant_spiders > SPIDER_HARD_CAP)
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
if(player_spiders && !selecting_player)
@@ -56,6 +56,12 @@
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."