Files
GS13/code/modules/events/heart_attack.dm
JaySparrow 41f9ebc80a Dynamic tweaks
And a couple bugfixes.
Heart attacks only target the station z level.
Diseases now only spawn once.
2020-11-08 13:56:58 -06: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.z != SSmapping.station_start || 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)