From 0d4b96fc76cf4aef38807e77dbf128790002d79d Mon Sep 17 00:00:00 2001 From: kevinz000 <2003111+kevinz000@users.noreply.github.com> Date: Mon, 30 Dec 2019 00:26:19 -0800 Subject: [PATCH] Excludes certain ghost roles from being affected by health events --- code/__DEFINES/traits.dm | 2 ++ code/game/objects/structures/ghost_role_spawners.dm | 8 ++++++++ code/modules/events/disease_outbreak.dm | 2 ++ code/modules/events/heart_attack.dm | 2 +- code/modules/events/mass_hallucination.dm | 4 +++- code/modules/events/spontaneous_appendicitis.dm | 2 ++ .../code/game/objects/structures/ghost_role_spawners.dm | 6 ++++++ hyperstation/code/modules/mob/mob_helpers.dm | 1 + 8 files changed, 25 insertions(+), 2 deletions(-) diff --git a/code/__DEFINES/traits.dm b/code/__DEFINES/traits.dm index ed5e5dea..1dd7ce26 100644 --- a/code/__DEFINES/traits.dm +++ b/code/__DEFINES/traits.dm @@ -142,6 +142,7 @@ #define TRAIT_NORUNNING "norunning" // You walk! #define TRAIT_NOMARROW "nomarrow" // You don't make blood, with chemicals or nanites. #define TRAIT_NOPULSE "nopulse" // Your heart doesn't beat. +#define TRAIT_EXEMPT_HEALTH_EVENTS "exempt-health-events" //non-mob traits #define TRAIT_PARALYSIS "paralysis" //Used for limb-based paralysis, where replacing the limb will fix it @@ -220,6 +221,7 @@ #define ABSTRACT_ITEM_TRAIT "abstract-item" #define STATUS_EFFECT_TRAIT "status-effect" #define ROUNDSTART_TRAIT "roundstart" //cannot be removed without admin intervention +#define GHOSTROLE_TRAIT "ghostrole" // unique trait sources, still defines #define STATUE_MUTE "statue" diff --git a/code/game/objects/structures/ghost_role_spawners.dm b/code/game/objects/structures/ghost_role_spawners.dm index 23e2ef8f..54498c2f 100644 --- a/code/game/objects/structures/ghost_role_spawners.dm +++ b/code/game/objects/structures/ghost_role_spawners.dm @@ -32,6 +32,8 @@ new/obj/structure/fluff/empty_terrarium(get_turf(src)) return ..() +/obj/effect/mob_spawn/human/seed_vault/special(mob/living/carbon/human/new_spawn) + ADD_TRAIT(new_spawn,TRAIT_EXEMPT_HEALTH_EVENTS,GHOSTROLE_TRAIT) //Ash walker eggs: Spawns in ash walker dens in lavaland. Ghosts become unbreathing lizards that worship the Necropolis and are advised to retrieve corpses to create more ash walkers. /obj/effect/mob_spawn/human/ash_walker @@ -262,6 +264,9 @@ new/obj/structure/fluff/empty_cryostasis_sleeper(get_turf(src)) return ..() +/obj/effect/mob_spawn/human/hermit/special(mob/living/carbon/human/new_spawn) + ADD_TRAIT(new_spawn,TRAIT_EXEMPT_HEALTH_EVENTS,GHOSTROLE_TRAIT) + //Broken rejuvenation pod: Spawns in animal hospitals in lavaland. Ghosts become disoriented interns and are advised to search for help. /obj/effect/mob_spawn/human/doctor/alive/lavaland name = "broken rejuvenation pod" @@ -371,6 +376,9 @@ new/obj/structure/fluff/empty_sleeper/syndicate(get_turf(src)) ..() +/obj/effect/mob_spawn/human/hotel_staff/special(mob/living/carbon/human/new_spawn) + ADD_TRAIT(new_spawn,TRAIT_EXEMPT_HEALTH_EVENTS,GHOSTROLE_TRAIT) + /obj/effect/mob_spawn/human/demonic_friend name = "Essence of friendship" desc = "Oh boy! Oh boy! A friend!" diff --git a/code/modules/events/disease_outbreak.dm b/code/modules/events/disease_outbreak.dm index 5883bdfb..2f220b17 100644 --- a/code/modules/events/disease_outbreak.dm +++ b/code/modules/events/disease_outbreak.dm @@ -37,6 +37,8 @@ continue if(!H.client) continue + if(HAS_TRAIT(H,TRAIT_EXEMPT_HEALTH_EVENTS)) + continue if(H.stat == DEAD) continue if(HAS_TRAIT(H, TRAIT_VIRUSIMMUNE)) //Don't pick someone who's virus immune, only for it to not do anything. diff --git a/code/modules/events/heart_attack.dm b/code/modules/events/heart_attack.dm index 7b7c2aa0..6042550d 100644 --- a/code/modules/events/heart_attack.dm +++ b/code/modules/events/heart_attack.dm @@ -8,7 +8,7 @@ /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()) + 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() || HAS_TRAIT(H,TRAIT_EXEMPT_HEALTH_EVENTS)) continue if(H.satiety <= -60) //Multiple junk food items recently heart_attack_contestants[H] = 3 diff --git a/code/modules/events/mass_hallucination.dm b/code/modules/events/mass_hallucination.dm index b38f34d4..627fd1b2 100644 --- a/code/modules/events/mass_hallucination.dm +++ b/code/modules/events/mass_hallucination.dm @@ -35,4 +35,6 @@ /datum/hallucination/delusion, /datum/hallucination/oh_yeah) for(var/mob/living/carbon/C in GLOB.alive_mob_list) - new picked_hallucination(C, TRUE) \ No newline at end of file + if(HAS_TRAIT(C,TRAIT_EXEMPT_HEALTH_EVENTS)) + continue + new picked_hallucination(C, TRUE) diff --git a/code/modules/events/spontaneous_appendicitis.dm b/code/modules/events/spontaneous_appendicitis.dm index 6bb3027b..64828123 100644 --- a/code/modules/events/spontaneous_appendicitis.dm +++ b/code/modules/events/spontaneous_appendicitis.dm @@ -17,6 +17,8 @@ continue if(H.z != SSmapping.station_start) //Let's not fucking give Appendicitis to ghost roles or people not on station, shall we? continue + if(HAS_TRAIT(H,TRAIT_EXEMPT_HEALTH_EVENTS)) //Do they have the trait that makes them exempt from health conditions? + continue if(!H.getorgan(/obj/item/organ/appendix)) //Don't give the disease to some who lacks it, only for it to be auto-cured continue if(!(MOB_ORGANIC & H.mob_biotypes)) //biotype sleeper bugs strike again, once again making appendicitis pick a target that can't take it diff --git a/hyperstation/code/game/objects/structures/ghost_role_spawners.dm b/hyperstation/code/game/objects/structures/ghost_role_spawners.dm index c43c19de..d70714d4 100644 --- a/hyperstation/code/game/objects/structures/ghost_role_spawners.dm +++ b/hyperstation/code/game/objects/structures/ghost_role_spawners.dm @@ -47,6 +47,9 @@ new/obj/structure/fluff/empty_cryostasis_sleeper(get_turf(src)) return ..() +/obj/effect/mob_spawn/human/duohermit/special(mob/living/carbon/human/new_spawn) + ADD_TRAIT(new_spawn,TRAIT_EXEMPT_HEALTH_EVENTS,GHOSTROLE_TRAIT) + //Exiles: Stranded exiles that have been left in Snowdin. Can be easily adapted for other roles as well. /obj/effect/mob_spawn/human/exiled name = "used bed" @@ -105,3 +108,6 @@ /obj/effect/mob_spawn/human/exiled/Destroy() new/obj/structure/bed(get_turf(src)) return ..() + +/obj/effect/mob_spawn/human/exiled/special(mob/living/carbon/human/new_spawn) + ADD_TRAIT(new_spawn,TRAIT_EXEMPT_HEALTH_EVENTS,GHOSTROLE_TRAIT) diff --git a/hyperstation/code/modules/mob/mob_helpers.dm b/hyperstation/code/modules/mob/mob_helpers.dm index a02975fc..f0d9d6fc 100644 --- a/hyperstation/code/modules/mob/mob_helpers.dm +++ b/hyperstation/code/modules/mob/mob_helpers.dm @@ -18,6 +18,7 @@ mob/proc/checkloadappearance() idCard.update_label(H.real_name, idCard.assignment) idCard.registered_name = H.real_name H.mirrorcanloadappearance = FALSE //Prevents them from using the mirror again. + ADD_TRAIT(H,TRAIT_EXEMPT_HEALTH_EVENTS,GHOSTROLE_TRAIT) //Makes them exempt from health events and adds gives them the ghostrole trait. This is a special tool we'll use later. SEND_SOUND(H, 'sound/magic/charge.ogg') //Fluff to_chat(H, "Your head aches for a second. You feel like this is how things should have been.") log_game("[key_name(H)] has loaded their default appearance for a ghost role.")