mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-13 11:43:31 +00:00
Besrserkjuice doesn't spam chat (#6893)
This commit is contained in:
@@ -59,7 +59,7 @@
|
|||||||
|
|
||||||
// Checks if the modifier should be allowed to be applied to the mob before attaching it.
|
// Checks if the modifier should be allowed to be applied to the mob before attaching it.
|
||||||
// Override for special criteria, e.g. forbidding robots from receiving it.
|
// Override for special criteria, e.g. forbidding robots from receiving it.
|
||||||
/datum/modifier/proc/can_apply(var/mob/living/L)
|
/datum/modifier/proc/can_apply(var/mob/living/L, var/suppress_output = FALSE)
|
||||||
return TRUE
|
return TRUE
|
||||||
|
|
||||||
// Checks to see if this datum should continue existing.
|
// Checks to see if this datum should continue existing.
|
||||||
@@ -113,7 +113,8 @@
|
|||||||
// Call this to add a modifier to a mob. First argument is the modifier type you want, second is how long it should last, in ticks.
|
// Call this to add a modifier to a mob. First argument is the modifier type you want, second is how long it should last, in ticks.
|
||||||
// Third argument is the 'source' of the modifier, if it's from someone else. If null, it will default to the mob being applied to.
|
// Third argument is the 'source' of the modifier, if it's from someone else. If null, it will default to the mob being applied to.
|
||||||
// The SECONDS/MINUTES macro is very helpful for this. E.g. M.add_modifier(/datum/modifier/example, 5 MINUTES)
|
// The SECONDS/MINUTES macro is very helpful for this. E.g. M.add_modifier(/datum/modifier/example, 5 MINUTES)
|
||||||
/mob/living/proc/add_modifier(var/modifier_type, var/expire_at = null, var/mob/living/origin = null)
|
// The fourth argument is a boolean to suppress failure messages, set it to true if the modifier is repeatedly applied (as chem-based modifiers are) to prevent chat-spam
|
||||||
|
/mob/living/proc/add_modifier(var/modifier_type, var/expire_at = null, var/mob/living/origin = null, var/suppress_failure = FALSE)
|
||||||
// First, check if the mob already has this modifier.
|
// First, check if the mob already has this modifier.
|
||||||
for(var/datum/modifier/M in modifiers)
|
for(var/datum/modifier/M in modifiers)
|
||||||
if(ispath(modifier_type, M))
|
if(ispath(modifier_type, M))
|
||||||
@@ -130,7 +131,7 @@
|
|||||||
|
|
||||||
// If we're at this point, the mob doesn't already have it, or it does but stacking is allowed.
|
// If we're at this point, the mob doesn't already have it, or it does but stacking is allowed.
|
||||||
var/datum/modifier/mod = new modifier_type(src, origin)
|
var/datum/modifier/mod = new modifier_type(src, origin)
|
||||||
if(!mod.can_apply(src))
|
if(!mod.can_apply(src, suppress_failure))
|
||||||
qdel(mod)
|
qdel(mod)
|
||||||
return
|
return
|
||||||
if(expire_at)
|
if(expire_at)
|
||||||
|
|||||||
@@ -112,8 +112,9 @@ the artifact triggers the rage.
|
|||||||
var/mob/living/carbon/human/H = holder
|
var/mob/living/carbon/human/H = holder
|
||||||
H.shock_stage = last_shock_stage
|
H.shock_stage = last_shock_stage
|
||||||
|
|
||||||
/datum/modifier/berserk/can_apply(var/mob/living/L)
|
/datum/modifier/berserk/can_apply(var/mob/living/L, var/suppress_failure = FALSE)
|
||||||
if(L.stat)
|
if(L.stat)
|
||||||
|
if(!suppress_failure)
|
||||||
to_chat(L, "<span class='warning'>You can't be unconscious or dead to berserk.</span>")
|
to_chat(L, "<span class='warning'>You can't be unconscious or dead to berserk.</span>")
|
||||||
return FALSE // It would be weird to see a dead body get angry all of a sudden.
|
return FALSE // It would be weird to see a dead body get angry all of a sudden.
|
||||||
|
|
||||||
@@ -121,6 +122,7 @@ the artifact triggers the rage.
|
|||||||
return FALSE // Drones don't feel anything.
|
return FALSE // Drones don't feel anything.
|
||||||
|
|
||||||
if(L.has_modifier_of_type(/datum/modifier/berserk_exhaustion))
|
if(L.has_modifier_of_type(/datum/modifier/berserk_exhaustion))
|
||||||
|
if(!suppress_failure)
|
||||||
to_chat(L, "<span class='warning'>You recently berserked, and cannot do so again while exhausted.</span>")
|
to_chat(L, "<span class='warning'>You recently berserked, and cannot do so again while exhausted.</span>")
|
||||||
return FALSE // On cooldown.
|
return FALSE // On cooldown.
|
||||||
|
|
||||||
@@ -135,6 +137,7 @@ the artifact triggers the rage.
|
|||||||
return FALSE // Happy trees aren't affected by blood rages.
|
return FALSE // Happy trees aren't affected by blood rages.
|
||||||
|
|
||||||
if(L.nutrition < nutrition_cost)
|
if(L.nutrition < nutrition_cost)
|
||||||
|
if(!suppress_failure)
|
||||||
to_chat(L, "<span class='warning'>You are too hungry to berserk.</span>")
|
to_chat(L, "<span class='warning'>You are too hungry to berserk.</span>")
|
||||||
return FALSE // Too hungry to enrage.
|
return FALSE // Too hungry to enrage.
|
||||||
|
|
||||||
|
|||||||
@@ -12,12 +12,13 @@
|
|||||||
metabolism = REM
|
metabolism = REM
|
||||||
|
|
||||||
var/modifier_to_add = /datum/modifier/berserk
|
var/modifier_to_add = /datum/modifier/berserk
|
||||||
var/modifier_duration = 2 SECONDS // How long, per unit dose, will this last?
|
var/modifier_duration = 3 SECONDS // How long, per unit dose, will this last?
|
||||||
|
// 2 SECONDS is the resolution of life code, and the modifier will expire before chemical processing tries to re-add it
|
||||||
|
|
||||||
/datum/reagent/modapplying/affect_blood(var/mob/living/carbon/M, var/alien, var/removed)
|
/datum/reagent/modapplying/affect_blood(var/mob/living/carbon/M, var/alien, var/removed)
|
||||||
if(alien == IS_DIONA)
|
if(alien == IS_DIONA)
|
||||||
return
|
return
|
||||||
M.add_modifier(modifier_to_add, dose * modifier_duration)
|
M.add_modifier(modifier_to_add, modifier_duration, suppress_failure = TRUE)
|
||||||
|
|
||||||
/datum/reagent/modapplying/cryofluid
|
/datum/reagent/modapplying/cryofluid
|
||||||
name = "cryogenic slurry"
|
name = "cryogenic slurry"
|
||||||
|
|||||||
Reference in New Issue
Block a user