From fbe51b72b7b9aa4ac83a2832db58f848d8fb123b Mon Sep 17 00:00:00 2001 From: Incoming Date: Tue, 18 Apr 2017 19:12:32 -0400 Subject: [PATCH] Adds badmin abuse limits to petsplosions Event won't run if initial pet population on station is greater than 100 pets. Event won't continue after creating 400 pets. Pets off station won't be affected by the petsplosion. --- code/modules/events/wizard/petsplosion.dm | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/code/modules/events/wizard/petsplosion.dm b/code/modules/events/wizard/petsplosion.dm index d69549e2051..05582043b9f 100644 --- a/code/modules/events/wizard/petsplosion.dm +++ b/code/modules/events/wizard/petsplosion.dm @@ -4,14 +4,29 @@ typepath = /datum/round_event/wizard/petsplosion max_occurrences = 1 //Exponential growth is nothing to sneeze at! earliest_start = 0 + var/mobs_to_dupe = 0 + +/datum/round_event_control/wizard/petsplosion/preRunEvent() + for(var/mob/living/simple_animal/F in GLOB.living_mob_list) + if(!ishostile(F) && F.z == ZLEVEL_STATION) + mobs_to_dupe++ + if(mobs_to_dupe > 100 || !mobs_to_dupe) + return EVENT_CANT_RUN + + ..() /datum/round_event/wizard/petsplosion endWhen = 61 //1 minute (+1 tick for endWhen not to interfere with tick) var/countdown = 0 + var/mobs_duped = 0 /datum/round_event/wizard/petsplosion/tick() if(activeFor >= 30 * countdown) // 0 seconds : 2 animals | 30 seconds : 4 animals | 1 minute : 8 animals countdown += 1 for(var/mob/living/simple_animal/F in GLOB.living_mob_list) //If you cull the heard before the next replication, things will be easier for you - if(!ishostile(F)) - new F.type(F.loc) \ No newline at end of file + if(!ishostile(F) && F.z == ZLEVEL_STATION) + new F.type(F.loc) + mobs_duped++ + if(mobs_duped > 400) + kill() +