diff --git a/code/controllers/configuration.dm b/code/controllers/configuration.dm
index e481fe92e16..8ae35d52179 100644
--- a/code/controllers/configuration.dm
+++ b/code/controllers/configuration.dm
@@ -242,6 +242,9 @@
// Lavaland
var/lavaland_budget = 60
+ //cube monkey limit
+ var/cubemonkeycap = 20
+
// Makes gamemodes respect player limits
var/enable_gamemode_player_limit = 0
@@ -787,6 +790,8 @@
config.enable_night_shifts = TRUE
if("lavaland_budget")
config.lavaland_budget = text2num(value)
+ if("cubemonkey_cap")
+ config.cubemonkeycap = text2num(value)
else
log_config("Unknown setting in configuration: '[name]'")
diff --git a/code/controllers/subsystem/mobs.dm b/code/controllers/subsystem/mobs.dm
index 17edb6410fa..a8a1fb72ceb 100644
--- a/code/controllers/subsystem/mobs.dm
+++ b/code/controllers/subsystem/mobs.dm
@@ -7,6 +7,7 @@ SUBSYSTEM_DEF(mobs)
var/list/currentrun = list()
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 z2 is created and new_players can login before that.
+ var/static/list/cubemonkeys = list()
/datum/controller/subsystem/mobs/stat_entry()
..("P:[GLOB.mob_list.len]")
diff --git a/code/modules/food_and_drinks/food/foods/meat.dm b/code/modules/food_and_drinks/food/foods/meat.dm
index c18f06c64af..f218955f3ae 100644
--- a/code/modules/food_and_drinks/food/foods/meat.dm
+++ b/code/modules/food_and_drinks/food/foods/meat.dm
@@ -271,6 +271,12 @@
return 1
/obj/item/reagent_containers/food/snacks/monkeycube/proc/Expand()
+ if(LAZYLEN(SSmobs.cubemonkeys) >= config.cubemonkeycap)
+ if(fingerprintslast)
+ to_chat(get_mob_by_ckey(fingerprintslast), "Bluespace harmonics prevent the spawning of more than [config.cubemonkeycap] monkeys on the station at one time!")
+ else
+ visible_message("[src] fails to expand!")
+ return
if(!QDELETED(src))
visible_message("[src] expands!")
if(fingerprintslast)
@@ -283,6 +289,7 @@
if(LAZYLEN(fingerprintshidden))
creature.fingerprintshidden = fingerprintshidden.Copy()
creature.set_species(monkey_type)
+ SSmobs.cubemonkeys += creature
qdel(src)
/obj/item/reagent_containers/food/snacks/monkeycube/syndicate
diff --git a/code/modules/mob/living/carbon/human/death.dm b/code/modules/mob/living/carbon/human/death.dm
index 64d06dac4db..4ceedc5b49c 100644
--- a/code/modules/mob/living/carbon/human/death.dm
+++ b/code/modules/mob/living/carbon/human/death.dm
@@ -101,11 +101,11 @@
return FALSE
set_heartattack(FALSE)
-
+ SSmobs.cubemonkeys -= src
if(dna.species)
dna.species.handle_hud_icons(src)
//Handle species-specific deaths.
- dna.species.handle_death(src)
+ dna.species.handle_death(gibbed, src)
if(ishuman(LAssailant))
var/mob/living/carbon/human/H=LAssailant
diff --git a/code/modules/mob/living/carbon/human/species/_species.dm b/code/modules/mob/living/carbon/human/species/_species.dm
index 87c9c90359b..b658124bb8f 100644
--- a/code/modules/mob/living/carbon/human/species/_species.dm
+++ b/code/modules/mob/living/carbon/human/species/_species.dm
@@ -304,10 +304,7 @@
/datum/species/proc/handle_dna(mob/living/carbon/human/H, remove) //Handles DNA mutations, as that doesn't work at init. Make sure you call genemutcheck on any blocks changed here
return
-/datum/species/proc/handle_death(mob/living/carbon/human/H) //Handles any species-specific death events (such as dionaea nymph spawns).
- return
-
-/datum/species/proc/spec_death(gibbed, mob/living/carbon/human/C)
+/datum/species/proc/handle_death(gibbed, mob/living/carbon/human/H) //Handles any species-specific death events (such as dionaea nymph spawns).
return
/datum/species/proc/apply_damage(damage = 0, damagetype = BRUTE, def_zone = null, blocked = 0, mob/living/carbon/human/H, sharp = 0, obj/used_weapon = null)
diff --git a/code/modules/mob/living/carbon/human/species/golem.dm b/code/modules/mob/living/carbon/human/species/golem.dm
index 9d74e7e2130..81211b1c4b9 100644
--- a/code/modules/mob/living/carbon/human/species/golem.dm
+++ b/code/modules/mob/living/carbon/human/species/golem.dm
@@ -410,7 +410,7 @@
prefix = "Sand"
special_names = list("Castle", "Bag", "Dune", "Worm", "Storm")
-/datum/species/golem/sand/handle_death(mob/living/carbon/human/H)
+/datum/species/golem/sand/handle_death(gibbed, mob/living/carbon/human/H)
H.visible_message("[H] turns into a pile of sand!")
for(var/obj/item/W in H)
H.unEquip(W)
@@ -442,7 +442,7 @@
prefix = "Glass"
special_names = list("Lens", "Prism", "Fiber", "Bead")
-/datum/species/golem/glass/handle_death(mob/living/carbon/human/H)
+/datum/species/golem/glass/handle_death(gibbed, mob/living/carbon/human/H)
playsound(H, "shatter", 70, 1)
H.visible_message("[H] shatters!")
for(var/obj/item/W in H)
@@ -679,7 +679,7 @@
active = null
..()
-/datum/species/golem/bananium/handle_death(mob/living/carbon/human/H)
+/datum/species/golem/bananium/handle_death(gibbed, mob/living/carbon/human/H)
playsound(get_turf(H), 'sound/misc/sadtrombone.ogg', 70, 0)
/datum/unarmed_attack/golem/bananium
diff --git a/code/modules/mob/living/carbon/human/species/machine.dm b/code/modules/mob/living/carbon/human/species/machine.dm
index 4f5a65c82a2..65852786b11 100644
--- a/code/modules/mob/living/carbon/human/species/machine.dm
+++ b/code/modules/mob/living/carbon/human/species/machine.dm
@@ -90,7 +90,7 @@
if(monitor)
monitor.Remove(H)
-/datum/species/machine/handle_death(mob/living/carbon/human/H)
+/datum/species/machine/handle_death(gibbed, mob/living/carbon/human/H)
var/obj/item/organ/external/head/head_organ = H.get_organ("head")
if(!head_organ)
return
diff --git a/code/modules/mob/living/carbon/human/species/nucleation.dm b/code/modules/mob/living/carbon/human/species/nucleation.dm
index fe8a5587017..cf9f5846193 100644
--- a/code/modules/mob/living/carbon/human/species/nucleation.dm
+++ b/code/modules/mob/living/carbon/human/species/nucleation.dm
@@ -34,7 +34,7 @@
H.light_color = "#1C1C00"
H.set_light(2)
-/datum/species/nucleation/handle_death(mob/living/carbon/human/H)
+/datum/species/nucleation/handle_death(gibbed, mob/living/carbon/human/H)
var/turf/T = get_turf(H)
H.visible_message("[H]'s body explodes, leaving behind a pile of microscopic crystals!")
explosion(T, 0, 0, 2, 2) // Create a small explosion burst upon death
diff --git a/code/modules/mob/living/carbon/human/species/tajaran.dm b/code/modules/mob/living/carbon/human/species/tajaran.dm
index f441d4fab4d..ee12ba34afe 100644
--- a/code/modules/mob/living/carbon/human/species/tajaran.dm
+++ b/code/modules/mob/living/carbon/human/species/tajaran.dm
@@ -55,5 +55,5 @@
"is twisting their own neck!",
"is holding their breath!")
-/datum/species/tajaran/handle_death(mob/living/carbon/human/H)
+/datum/species/tajaran/handle_death(gibbed, mob/living/carbon/human/H)
H.stop_tail_wagging(1)
\ No newline at end of file
diff --git a/code/modules/mob/living/carbon/human/species/unathi.dm b/code/modules/mob/living/carbon/human/species/unathi.dm
index 6146f00fa6f..7ab0f9cbec9 100644
--- a/code/modules/mob/living/carbon/human/species/unathi.dm
+++ b/code/modules/mob/living/carbon/human/species/unathi.dm
@@ -102,7 +102,7 @@
to_chat(user, "You run out of momentum!")
return
-/datum/species/unathi/handle_death(mob/living/carbon/human/H)
+/datum/species/unathi/handle_death(gibbed, mob/living/carbon/human/H)
H.stop_tail_wagging(1)
/datum/species/unathi/ashwalker
diff --git a/code/modules/mob/living/carbon/human/species/vox.dm b/code/modules/mob/living/carbon/human/species/vox.dm
index f8485e8f9e9..3bbd732145b 100644
--- a/code/modules/mob/living/carbon/human/species/vox.dm
+++ b/code/modules/mob/living/carbon/human/species/vox.dm
@@ -81,7 +81,7 @@
speciesbox = /obj/item/storage/box/survival_vox
-/datum/species/vox/handle_death(mob/living/carbon/human/H)
+/datum/species/vox/handle_death(gibbed, mob/living/carbon/human/H)
H.stop_tail_wagging(1)
/datum/species/vox/after_equip_job(datum/job/J, mob/living/carbon/human/H)
diff --git a/code/modules/mob/living/carbon/human/species/vulpkanin.dm b/code/modules/mob/living/carbon/human/species/vulpkanin.dm
index 2ff707ee020..15e25fa2ff5 100644
--- a/code/modules/mob/living/carbon/human/species/vulpkanin.dm
+++ b/code/modules/mob/living/carbon/human/species/vulpkanin.dm
@@ -49,5 +49,5 @@
"is twisting their own neck!",
"is holding their breath!")
-/datum/species/vulpkanin/handle_death(mob/living/carbon/human/H)
+/datum/species/vulpkanin/handle_death(gibbed, mob/living/carbon/human/H)
H.stop_tail_wagging(1)
\ No newline at end of file
diff --git a/code/modules/mob/living/carbon/human/species/wryn.dm b/code/modules/mob/living/carbon/human/species/wryn.dm
index 6069da28f84..450da31b591 100644
--- a/code/modules/mob/living/carbon/human/species/wryn.dm
+++ b/code/modules/mob/living/carbon/human/species/wryn.dm
@@ -49,7 +49,7 @@
default_hair = "Antennae"
-/datum/species/wryn/handle_death(mob/living/carbon/human/H)
+/datum/species/wryn/handle_death(gibbed, mob/living/carbon/human/H)
for(var/mob/living/carbon/C in GLOB.living_mob_list)
if(C.get_int_organ(/obj/item/organ/internal/wryn/hivenode))
to_chat(C, "Your antennae tingle as you are overcome with pain...")
diff --git a/code/modules/mob/living/carbon/human/species/zombies.dm b/code/modules/mob/living/carbon/human/species/zombies.dm
index 34dc3355f16..81a462d9fab 100644
--- a/code/modules/mob/living/carbon/human/species/zombies.dm
+++ b/code/modules/mob/living/carbon/human/species/zombies.dm
@@ -67,7 +67,7 @@
playsound(H, pick(spooks), 50, TRUE, 10)
//Congrats you somehow died so hard you stopped being a zombie
-/datum/species/zombie/infectious/spec_death(gibbed, mob/living/carbon/C)
+/datum/species/zombie/infectious/handle_death(gibbed, mob/living/carbon/C)
. = ..()
var/obj/item/organ/internal/zombie_infection/infection
infection = C.get_organ_slot("zombie_infection")
diff --git a/code/modules/research/xenobiology/xenobio_camera.dm b/code/modules/research/xenobiology/xenobio_camera.dm
index b695ca3a1b4..2889a68c75b 100644
--- a/code/modules/research/xenobiology/xenobio_camera.dm
+++ b/code/modules/research/xenobiology/xenobio_camera.dm
@@ -217,8 +217,12 @@
var/obj/machinery/computer/camera_advanced/xenobio/X = target
if(cameranet.checkTurfVis(remote_eye.loc))
- if(X.monkeys >= 1)
+ if(LAZYLEN(SSmobs.cubemonkeys) >= config.cubemonkeycap)
+ to_chat(owner, "Bluespace harmonics prevent the spawning of more than [config.cubemonkeycap] monkeys on the station at one time!")
+ return
+ else if(X.monkeys >= 1)
var/mob/living/carbon/human/monkey/food = new /mob/living/carbon/human/monkey(remote_eye.loc)
+ SSmobs.cubemonkeys += food
food.LAssailant = C
X.monkeys --
to_chat(owner, "[X] now has [X.monkeys] monkeys left.")
diff --git a/config/example/game_options.txt b/config/example/game_options.txt
index 31ee950243a..b05023098a1 100644
--- a/config/example/game_options.txt
+++ b/config/example/game_options.txt
@@ -72,4 +72,8 @@ ENABLE_NIGHT_SHIFTS
# a less lootfilled or smaller or less round effecting ruin costs less to
# spawn, while the converse is true. Alter this number to affect the amount
# of ruins.
-LAVALAND_BUDGET 60
\ No newline at end of file
+LAVALAND_BUDGET 60
+
+## Cube monkey limit
+# Amount of cube monkeys that can be spawned before the game limits them
+CUBEMONKEY_CAP 32
\ No newline at end of file