Files
fulpstation/code/modules/events/heart_attack.dm
MrDoomBringer 8c156a99fe Makes events ghost-announce their spawned atom much more consistently (#41278)
Fixes #41217

cl MrDoomBringer
fix: Events now announce follow-able atoms to ghosts much more reliably
/cl

Implements @ShizCalev's suggestion to just have the event ghost-announce normally, then call a separate ghost announcement for the "atom of interest" as it is created.
2018-11-14 22:27:35 +13:00

23 lines
947 B
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)
announce_to_ghosts(winner)