diff --git a/code/__DEFINES/mobs.dm b/code/__DEFINES/mobs.dm index 94b22d55ba7..7b4ec0bc36e 100644 --- a/code/__DEFINES/mobs.dm +++ b/code/__DEFINES/mobs.dm @@ -329,6 +329,9 @@ //Slime extract crossing. Controls how many extracts is required to feed to a slime to core-cross. #define SLIME_EXTRACT_CROSSING_REQUIRED 10 +//How many slimes can be on the same tile before it can no longer reproduce. +#define SLIME_OVERCROWD_AMOUNT 2 + //Slime commands defines #define SLIME_FRIENDSHIP_FOLLOW 3 //Min friendship to order it to follow #define SLIME_FRIENDSHIP_STOPEAT 5 //Min friendship to order it to stop eating someone diff --git a/code/modules/mob/living/basic/slime/actions.dm b/code/modules/mob/living/basic/slime/actions.dm index c297f48d14e..a3168d81437 100644 --- a/code/modules/mob/living/basic/slime/actions.dm +++ b/code/modules/mob/living/basic/slime/actions.dm @@ -77,6 +77,7 @@ ///Splits the slime into multiple children if possible /mob/living/basic/slime/proc/reproduce() + if(stat != CONSCIOUS) balloon_alert(src, "not conscious!") return @@ -92,6 +93,19 @@ balloon_alert(src, "need growth!") return + var/list/friends_list = list() + for(var/mob/living/basic/slime/friend in loc) + if(QDELETED(friend)) + continue + if(friend == src) + continue + friends_list += friend + + overcrowded = length(friends_list) >= SLIME_OVERCROWD_AMOUNT + if(overcrowded) + balloon_alert(src, "overcrowded!") + return + var/list/babies = list() var/new_nutrition = round(nutrition * 0.9) var/new_powerlevel = round(powerlevel / 4) diff --git a/code/modules/mob/living/basic/slime/slime.dm b/code/modules/mob/living/basic/slime/slime.dm index 8623f69b0e4..8f80e24f699 100644 --- a/code/modules/mob/living/basic/slime/slime.dm +++ b/code/modules/mob/living/basic/slime/slime.dm @@ -66,6 +66,9 @@ ///Our slime's current mood var/current_mood = SLIME_MOOD_NONE + ///If the slime is currently overcrowded and unable to reproduce. + var/overcrowded = FALSE + ///The number of /obj/item/slime_extract's the slime has left inside var/cores = 1 ///Chance of mutating, should be between 25 and 35 @@ -243,6 +246,8 @@ if(SLIME_MAX_POWER) . += span_boldwarning("It is radiating with massive levels of electrical activity!") + if(overcrowded) + . += span_warning("It seems too overcroweded to properly reproduce!") ///Changes the slime's current life state /mob/living/basic/slime/proc/set_life_stage(new_life_stage = SLIME_LIFE_STAGE_BABY)