Uses the new trait system on some chems (#34893)

* Uses the new trait system on some chems
This commit is contained in:
XDTM
2018-01-29 15:44:40 +01:00
committed by vuonojenmustaturska
parent add799e571
commit d679d7bee1
4 changed files with 59 additions and 29 deletions
+27 -24
View File
@@ -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 ////////////////////////////////////
@@ -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, "<span class='notice'>[high_message]</span>")
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"
@@ -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)