Ports TG Fake virus event (#20573)

* Ports TG Fake virus event

* weight and comments

* GDN review

* Splitting into four different fake viruses

* Apply suggestions from code review

Co-authored-by: S34N <12197162+S34NW@users.noreply.github.com>

* Update code/__DEFINES/status_effects.dm

Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>

* Sirryan review

* Apply suggestions from code review

Co-authored-by: Farie82 <farie82@users.noreply.github.com>

* create_log for the fake virus

* using lists inside of lists

* Apply suggestions from code review

Co-authored-by: S34N <12197162+S34NW@users.noreply.github.com>

* Apply suggestions from code review

Co-authored-by: Farie82 <farie82@users.noreply.github.com>

* farie review

* Checking fake_emote length

---------

Co-authored-by: S34N <12197162+S34NW@users.noreply.github.com>
Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>
Co-authored-by: Farie82 <farie82@users.noreply.github.com>
This commit is contained in:
Henri215
2023-03-18 11:44:55 +01:00
committed by GitHub
co-authored by S34N Ryan Farie82
parent 5557f6ae32
commit 2a40482e58
5 changed files with 129 additions and 0 deletions
+3
View File
@@ -156,3 +156,6 @@
#define STATUS_EFFECT_OFFERING_ITEM /datum/status_effect/offering_item
#define STATUS_EFFECT_BLOB_BURST /datum/status_effect/blob_burst
/// gives you fluff messages for cough, sneeze, headache, etc but without an actual virus
#define STATUS_EFFECT_FAKE_VIRUS /datum/status_effect/fake_virus
+98
View File
@@ -824,3 +824,101 @@
/datum/status_effect/transient/drugged/on_remove()
owner.update_druggy_effects()
#define FAKE_COLD 1
#define FAKE_FOOD_POISONING 2
#define FAKE_RETRO_VIRUS 3
#define FAKE_TURBERCULOSIS 4
/datum/status_effect/fake_virus
id = "fake_virus"
duration = 3 MINUTES
status_type = STATUS_EFFECT_REPLACE
tick_interval = 2
alert_type = null
/// So you dont get the most intense messages immediately
var/msg_stage = 0
/// Which disease we are going to fake?
var/current_fake_disease
/// Fake virus messages by with three stages
var/list/fake_msg
/// Fake virus emotes with three stages
var/list/fake_emote
/datum/status_effect/fake_virus/on_creation()
current_fake_disease = pick(FAKE_COLD, FAKE_FOOD_POISONING, FAKE_RETRO_VIRUS, FAKE_TURBERCULOSIS)
switch(current_fake_disease)
if(FAKE_COLD)
fake_msg = list(
list("<span class='danger'>Your throat feels sore.</span>", "<span class='danger'>Mucous runs down the back of your throat.</span>"),
list("<span class='danger'>Your muscles ache.</span>", "<span class='danger'>Your stomach hurts.</span>"),
list("<span class='danger'>Your muscles ache.</span>", "<span class='danger'>Your stomach hurts.</span>")
)
fake_emote = list(
list("sneeze", "cough"),
list("sneeze", "cough"),
list("sneeze", "cough")
)
if(FAKE_FOOD_POISONING)
fake_msg = list(
list("<span class='danger'>Your stomach feels weird.</span>", "<span class='danger'>You feel queasy.</span>"),
list("<span class='danger'>Your stomach aches.</span>", "<span class='danger'>You feel nauseous.</span>"),
list("<span class='danger'>Your stomach hurts.</span>", "<span class='danger'>You feel sick.</span>")
)
fake_emote = list(
list(),
list("groan"),
list("groan", "moan")
)
if(FAKE_RETRO_VIRUS)
fake_msg = list(
list("<span class='danger'>Your head hurts.</span>", "You feel a tingling sensation in your chest.", "<span class='danger'>You feel angry.</span>"),
list("<span class='danger'>Your skin feels loose.</span>", "You feel very strange.", "<span class='danger'>You feel a stabbing pain in your head!</span>", "<span class='danger'>Your stomach churns.</span>"),
list("<span class='danger'>Your entire body vibrates.</span>")
)
else
fake_msg = list(
list("<span class='danger'>Your chest hurts.</span>", "<span class='danger'>Your stomach violently rumbles!</span>", "<span class='danger'>You feel a cold sweat form.</span>"),
list("<span class='danger'>You feel a sharp pain from your lower chest!</span>", "<span class='danger'>You feel air escape from your lungs painfully.</span>"),
list("<span class='danger'>You feel uncomfortably hot...</span>", "<span class='danger'>You feel like unzipping your jumpsuit</span>", "<span class='danger'>You feel like taking off some clothes...</span>")
)
fake_emote = list(
list("cough"),
list("gasp"),
list()
)
. = ..()
/datum/status_effect/fake_virus/tick()
var/selected_fake_msg
var/selected_fake_emote
switch(msg_stage)
if(0 to 300)
if(prob(1)) // First stage starts slow, stage 2 and 3 trigger fake msgs/emotes twice as often
if(prob(50) || !length(fake_emote[1])) // 50% chance to trigger either a msg or emote, 100% if it doesnt have an emote
selected_fake_msg = safepick(fake_msg[1])
else
selected_fake_emote = safepick(fake_emote[1])
if(301 to 600)
if(prob(2))
if(prob(50) || !length(fake_emote[2]))
selected_fake_msg = safepick(fake_msg[2])
else
selected_fake_emote = safepick(fake_emote[2])
else
if(prob(2))
if(prob(50) || !length(fake_emote[3]))
selected_fake_msg = safepick(fake_msg[3])
else
selected_fake_emote = safepick(fake_emote[3])
if(selected_fake_msg)
to_chat(owner, selected_fake_msg)
else if(selected_fake_emote)
owner.emote(selected_fake_emote)
msg_stage++
#undef FAKE_COLD
#undef FAKE_FOOD_POISONING
#undef FAKE_RETRO_VIRUS
#undef FAKE_TURBERCULOSIS
+1
View File
@@ -140,6 +140,7 @@ GLOBAL_LIST_EMPTY(event_last_fired)
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Sentience", /datum/event/sentience, 50),
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Wallrot", /datum/event/wallrot, 0, list(ASSIGNMENT_ENGINEER = 30, ASSIGNMENT_GARDENER = 50)),
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Koi School", /datum/event/carp_migration/koi, 80),
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Fake Virus", /datum/event/fake_virus, 50),
new /datum/event_meta(EVENT_LEVEL_MUNDANE, "Disease Outbreak", /datum/event/disease_outbreak, 50, list(ASSIGNMENT_MEDICAL = 25), TRUE)
)
+26
View File
@@ -0,0 +1,26 @@
/datum/event/fake_virus/start()
var/list/fake_virus_victims = list()
for(var/mob/living/carbon/human/victim in shuffle(GLOB.player_list))
if(victim.stat == DEAD || victim.InCritical() || victim.mind?.assigned_role == victim.mind?.special_role || victim.mind?.offstation_role)
continue
fake_virus_victims += victim
//first we do hard status effect victims
var/defacto_min = min(3, length(fake_virus_victims))
if(defacto_min) // event will hit 1-3 people by default, but will do 1-2 or just 1 if only those many candidates are available
for(var/i in 1 to rand(1, defacto_min))
var/mob/living/carbon/human/hypochondriac = pick(fake_virus_victims)
hypochondriac.apply_status_effect(STATUS_EFFECT_FAKE_VIRUS)
hypochondriac.create_log(MISC_LOG, "[hypochondriac] has contracted a fake virus.")
fake_virus_victims -= hypochondriac
notify_ghosts("[hypochondriac] now has a fake virus!")
//then we do light one-message victims who simply cough or whatever once (have to repeat the process since the last operation modified our candidates list)
defacto_min = min(5, length(fake_virus_victims))
if(defacto_min)
for(var/i in 1 to rand(1, defacto_min))
var/mob/living/carbon/human/onecoughman = pick(fake_virus_victims)
if(prob(25)) //1/4 odds to get a spooky message instead of coughing out loud
addtimer(CALLBACK(GLOBAL_PROC, PROC_REF(to_chat), onecoughman, "<span class='warning'>[pick("Your head hurts.", "Your head pounds.")]</span>"), rand(30, 150))
else
addtimer(CALLBACK(onecoughman, TYPE_PROC_REF(/mob/, emote), pick("cough", "sniff", "sneeze")), rand(30, 150)) //deliver the message with a slightly randomized time interval so there arent multiple people coughing at the exact same time
fake_virus_victims -= onecoughman
+1
View File
@@ -1624,6 +1624,7 @@
#include "code\modules\events\event.dm"
#include "code\modules\events\event_container.dm"
#include "code\modules\events\event_procs.dm"
#include "code\modules\events\fake_virus.dm"
#include "code\modules\events\false_alarm.dm"
#include "code\modules\events\floorcluwne.dm"
#include "code\modules\events\immovable_rod.dm"