From 4cc524265bfc10aa57c7e0355416da6eec0ed377 Mon Sep 17 00:00:00 2001 From: PsiOmega Date: Wed, 22 Apr 2015 12:27:28 +0200 Subject: [PATCH] Change of random virus targets. The random virus event will now only infect mobs on station and which currently have a player that has been active in the last 5 minutes. Placeholder until a more indepth discussion about what to do about the random event is concluded. --- code/modules/events/viral_infection.dm | 12 +++++++----- code/modules/mob/mob_helpers.dm | 4 ++++ html/changelogs/PsiOmegaDelta-GoingViral.yml | 5 +++++ 3 files changed, 16 insertions(+), 5 deletions(-) create mode 100644 html/changelogs/PsiOmegaDelta-GoingViral.yml diff --git a/code/modules/events/viral_infection.dm b/code/modules/events/viral_infection.dm index 55dbe2b8239..639cea4d5e9 100644 --- a/code/modules/events/viral_infection.dm +++ b/code/modules/events/viral_infection.dm @@ -4,12 +4,12 @@ datum/event/viral_infection datum/event/viral_infection/setup() announceWhen = rand(0, 3000) endWhen = announceWhen + 1 - + //generate 1-3 viruses. This way there's an upper limit on how many individual diseases need to be cured if many people are initially infected var/num_diseases = rand(1,3) for (var/i=0, i < num_diseases, i++) var/datum/disease2/disease/D = new /datum/disease2/disease - + var/strength = 1 //whether the disease is of the greater or lesser variety if (severity >= EVENT_LEVEL_MAJOR && prob(75)) strength = 2 @@ -24,7 +24,7 @@ datum/event/viral_infection/announce() level = pick("one", "two", "three", "four") else level = "five" - + if (severity == EVENT_LEVEL_MAJOR || prob(60)) command_announcement.Announce("Confirmed outbreak of level [level] biohazard aboard [station_name()]. All personnel must contain the outbreak.", "Biohazard Alert", new_sound = 'sound/AI/outbreak5.ogg') @@ -33,8 +33,10 @@ datum/event/viral_infection/start() var/list/candidates = list() //list of candidate keys for(var/mob/living/carbon/human/G in player_list) - if(G.client && G.stat != DEAD) - candidates += G + if(G.stat != DEAD && G.is_client_active(5)) + var/turf/T = get_turf(G) + if(T.z in config.station_levels) + candidates += G if(!candidates.len) return candidates = shuffle(candidates)//Incorporating Donkie's list shuffle diff --git a/code/modules/mob/mob_helpers.dm b/code/modules/mob/mob_helpers.dm index a6585ff0dec..7c220076bb5 100644 --- a/code/modules/mob/mob_helpers.dm +++ b/code/modules/mob/mob_helpers.dm @@ -587,3 +587,7 @@ proc/is_blind(A) eyeobj.setLoc(C) return 1 + +// Returns true if the mob has a client which has been active in the last given X minutes. +/mob/proc/is_client_active(var/active = 1) + return client && client.inactivity < active MINUTES diff --git a/html/changelogs/PsiOmegaDelta-GoingViral.yml b/html/changelogs/PsiOmegaDelta-GoingViral.yml new file mode 100644 index 00000000000..02e569c78df --- /dev/null +++ b/html/changelogs/PsiOmegaDelta-GoingViral.yml @@ -0,0 +1,5 @@ +author: PsiOmegaDelta +delete-after: True + +changes: + - bugfix: "The virus event will now only infect mobs on the station, currently controlled by player that has been active in the last 5 minutes."