Files
Yogstation/code/modules/events/heart_attack.dm
Cruix dedf5f5ed9 Disease antagonist (#35988)
* Virus antagonist initial commit

* Updated disease code

* Sentient virus improvements

* Renamed /mob/living/var/viruses to diseases, and /mob/living/var/resistances to disease_resistances

* Added sentient virus event

* Renamed VIRUS defines to DISEASE defines

* Fixed bugs in rewritten disease code

* Fixed advanced disease Copy()

* Finalized disease antagonist

* Made cooldown buttons stop processing if they are removed from an owner.
Made sentient disease active sneeze and cough not available if the host is unconscious.
Made sentient disease menu refresh when adaptations are ready or hosts are added or removed.
Made sentient disease following use movement signals instead of fastprocess.

* Added better icons to sentient disease abilities
2018-03-05 13:55:10 +01:00

23 lines
1.1 KiB
Plaintext

/datum/round_event_control/heart_attack
name = "Random Heart Attack"
typepath = /datum/round_event/heart_attack
weight = 20
max_occurrences = 2
min_players = 40 // To avoid shafting lowpop
/datum/round_event/heart_attack/start()
var/list/heart_attack_contestants = list()
for(var/mob/living/carbon/human/H in shuffle(GLOB.player_list))
if(!H.client || H.stat == DEAD || H.InCritical() || !H.can_heartattack() || H.has_status_effect(STATUS_EFFECT_EXERCISED) || (/datum/disease/heart_failure in H.diseases) || H.undergoing_cardiac_arrest())
continue
if(H.satiety <= -60) //Multiple junk food items recently
heart_attack_contestants[H] = 3
else
heart_attack_contestants[H] = 1
if(LAZYLEN(heart_attack_contestants))
var/mob/living/carbon/human/winner = pickweight(heart_attack_contestants)
var/datum/disease/D = new /datum/disease/heart_failure()
winner.ForceContractDisease(D, FALSE, TRUE)
notify_ghosts("[winner] is beginning to have a heart attack!", enter_link="<a href=?src=[REF(src)];orbit=1>(Click to orbit)</a>", source=winner, action=NOTIFY_ORBIT)