diff --git a/code/__DEFINES/traits.dm b/code/__DEFINES/traits.dm index eae05dcc5d1..6be22cb9635 100644 --- a/code/__DEFINES/traits.dm +++ b/code/__DEFINES/traits.dm @@ -17,6 +17,7 @@ #define TRAIT_DISFIGURED "disfigured" #define TRAIT_XENO_HOST "xeno_host" //Tracks whether we're gonna be a baby alien's mummy. #define TRAIT_STUNIMMUNE "stun_immunity" +#define TRAIT_SLEEPIMMUNE "sleep_immunity" #define TRAIT_PUSHIMMUNE "push_immunity" #define TRAIT_SHOCKIMMUNE "shock_immunity" diff --git a/code/modules/mob/status_procs.dm b/code/modules/mob/status_procs.dm index 53095045f65..87eddde125c 100644 --- a/code/modules/mob/status_procs.dm +++ b/code/modules/mob/status_procs.dm @@ -68,32 +68,35 @@ return S.duration - world.time return 0 -/mob/living/proc/Sleeping(amount, updating = TRUE) //Can't go below remaining duration - var/datum/status_effect/incapacitating/sleeping/S = IsSleeping() - if(S) - S.duration = max(world.time + amount, S.duration) - else if(amount > 0) - S = apply_status_effect(STATUS_EFFECT_SLEEPING, amount, updating) - return S - -/mob/living/proc/SetSleeping(amount, updating = TRUE) //Sets remaining duration - var/datum/status_effect/incapacitating/sleeping/S = IsSleeping() - if(amount <= 0) +/mob/living/proc/Sleeping(amount, updating = TRUE, ignore_sleepimmune = FALSE) //Can't go below remaining duration + if((!has_trait(TRAIT_SLEEPIMMUNE)) || ignore_sleepimmune) + var/datum/status_effect/incapacitating/sleeping/S = IsSleeping() if(S) - qdel(S) - else if(S) - S.duration = world.time + amount - else - S = apply_status_effect(STATUS_EFFECT_SLEEPING, amount, updating) - return S + S.duration = max(world.time + amount, S.duration) + else if(amount > 0) + S = apply_status_effect(STATUS_EFFECT_SLEEPING, amount, updating) + return S -/mob/living/proc/AdjustSleeping(amount, updating = TRUE) //Adds to remaining duration - var/datum/status_effect/incapacitating/sleeping/S = IsSleeping() - if(S) - S.duration += amount - else if(amount > 0) - S = apply_status_effect(STATUS_EFFECT_SLEEPING, amount, updating) - return S +/mob/living/proc/SetSleeping(amount, updating = TRUE, ignore_sleepimmune = FALSE) //Sets remaining duration + if((!has_trait(TRAIT_SLEEPIMMUNE)) || ignore_sleepimmune) + var/datum/status_effect/incapacitating/sleeping/S = IsSleeping() + if(amount <= 0) + if(S) + qdel(S) + else if(S) + S.duration = world.time + amount + else + S = apply_status_effect(STATUS_EFFECT_SLEEPING, amount, updating) + return S + +/mob/living/proc/AdjustSleeping(amount, updating = TRUE, ignore_sleepimmune = FALSE) //Adds to remaining duration + if((!has_trait(TRAIT_SLEEPIMMUNE)) || ignore_sleepimmune) + var/datum/status_effect/incapacitating/sleeping/S = IsSleeping() + if(S) + S.duration += amount + else if(amount > 0) + S = apply_status_effect(STATUS_EFFECT_SLEEPING, amount, updating) + return S /////////////////////////////////// RESTING //////////////////////////////////// diff --git a/code/modules/reagents/chemistry/reagents/drug_reagents.dm b/code/modules/reagents/chemistry/reagents/drug_reagents.dm index 5e5493df18a..0886aacb061 100644 --- a/code/modules/reagents/chemistry/reagents/drug_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/drug_reagents.dm @@ -245,21 +245,31 @@ /datum/reagent/drug/bath_salts name = "Bath Salts" id = "bath_salts" - description = "Makes you nearly impervious to stuns and grants a stamina regeneration buff, but you will be a nearly uncontrollable tramp-bearded raving lunatic." + description = "Makes you impervious to stuns and grants a stamina regeneration buff, but you will be a nearly uncontrollable tramp-bearded raving lunatic." reagent_state = LIQUID color = "#FAFAFA" overdose_threshold = 20 addiction_threshold = 10 taste_description = "salt" // because they're bathsalts? +/datum/reagent/drug/bath_salts/on_mob_add(mob/M) + ..() + if(isliving(M)) + var/mob/living/L = M + L.add_trait(TRAIT_STUNIMMUNE, id) + L.add_trait(TRAIT_SLEEPIMMUNE, id) + +/datum/reagent/drug/bath_salts/on_mob_delete(mob/M) + if(isliving(M)) + var/mob/living/L = M + L.remove_trait(TRAIT_STUNIMMUNE, id) + L.remove_trait(TRAIT_SLEEPIMMUNE, id) + ..() /datum/reagent/drug/bath_salts/on_mob_life(mob/living/M) var/high_message = pick("You feel amped up.", "You feel ready.", "You feel like you can push it to the limit.") if(prob(5)) to_chat(M, "[high_message]") - M.AdjustStun(-60, 0) - M.AdjustKnockdown(-60, 0) - M.AdjustUnconscious(-60, 0) M.adjustStaminaLoss(-5, 0) M.adjustBrainLoss(0.5) M.adjustToxLoss(0.1, 0) @@ -333,7 +343,7 @@ /datum/reagent/drug/aranesp name = "Aranesp" id = "aranesp" - description = "Amps you up and gets you going, fixes all stamina damage you might have but can cause toxin and oxygen damage.." + description = "Amps you up and gets you going, fixes all stamina damage you might have but can cause toxin and oxygen damage." reagent_state = LIQUID color = "#78FFF0" diff --git a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm index ae396f4ea41..8fc9134b4aa 100644 --- a/code/modules/reagents/chemistry/reagents/medicine_reagents.dm +++ b/code/modules/reagents/chemistry/reagents/medicine_reagents.dm @@ -1205,6 +1205,22 @@ overdose_threshold = 20 addiction_threshold = 5 +/datum/reagent/medicine/ketrazine/on_mob_add(mob/M) + ..() + if(isliving(M)) + var/mob/living/L = M + L.add_trait(TRAIT_SLEEPIMMUNE, id) + L.add_trait(TRAIT_IGNORESLOWDOWN, id) + L.add_trait(TRAIT_GOTTAGOFAST, id) + +/datum/reagent/medicine/ketrazine/on_mob_delete(mob/M) + if(isliving(M)) + var/mob/living/L = M + L.remove_trait(TRAIT_SLEEPIMMUNE, id) + L.remove_trait(TRAIT_IGNORESLOWDOWN, id) + L.remove_trait(TRAIT_GOTTAGOFAST, id) + ..() + /datum/reagent/medicine/ketrazine/on_mob_life(mob/living/M) M.adjustToxLoss(-3*REM, 0) M.adjustBruteLoss(-5*REM, 0)