From 4b4035932fa328e5d6617d6eac6a6d6871ba15f0 Mon Sep 17 00:00:00 2001 From: Mechoid Date: Sun, 14 Apr 2019 13:38:10 -0700 Subject: [PATCH] Modifier integration. --- code/modules/mob/_modifiers/modifiers.dm | 2 ++ code/modules/mob/_modifiers/modifiers_misc.dm | 13 ++++++- code/modules/mob/living/carbon/human/life.dm | 36 ++++++++++++++++--- code/modules/reagents/Chemistry-Reagents.dm | 2 +- 4 files changed, 47 insertions(+), 6 deletions(-) diff --git a/code/modules/mob/_modifiers/modifiers.dm b/code/modules/mob/_modifiers/modifiers.dm index 115acb1b3e..6e738094a1 100644 --- a/code/modules/mob/_modifiers/modifiers.dm +++ b/code/modules/mob/_modifiers/modifiers.dm @@ -45,6 +45,8 @@ var/icon_scale_percent // Makes the holder's icon get scaled up or down. var/attack_speed_percent // Makes the holder's 'attack speed' (click delay) shorter or longer. var/pain_immunity // Makes the holder not care about pain while this is on. Only really useful to human mobs. + var/pulse_modifier // Modifier for pulse, will be rounded on application, then added to the normal 'pulse' multiplier which ranges between 0 and 5 normally. Only applied if they're living. + var/pulse_set_level // Positive number. If this is non-null, it will hard-set the pulse level to this. Pulse ranges from 0 to 5 normally. /datum/modifier/New(var/new_holder, var/new_origin) holder = new_holder diff --git a/code/modules/mob/_modifiers/modifiers_misc.dm b/code/modules/mob/_modifiers/modifiers_misc.dm index 61386ce6d6..64be119d7c 100644 --- a/code/modules/mob/_modifiers/modifiers_misc.dm +++ b/code/modules/mob/_modifiers/modifiers_misc.dm @@ -267,4 +267,15 @@ the artifact triggers the rage. return FALSE if(L.get_poison_protection() >= 1) return FALSE - return TRUE \ No newline at end of file + return TRUE + +// Pulse modifier. +/datum/modifier/false_pulse + name = "false pulse" + desc = "Your blood flows, despite all other factors." + + on_created_text = "You feel alive." + on_expired_text = "You feel.. different." + stacks = MODIFIER_STACK_EXTEND + + pulse_set_level = PULSE_NORM diff --git a/code/modules/mob/living/carbon/human/life.dm b/code/modules/mob/living/carbon/human/life.dm index 987ab3ff68..5c0f80ec45 100644 --- a/code/modules/mob/living/carbon/human/life.dm +++ b/code/modules/mob/living/carbon/human/life.dm @@ -1539,16 +1539,39 @@ /mob/living/carbon/human/proc/handle_pulse() if(life_tick % 5) return pulse //update pulse every 5 life ticks (~1 tick/sec, depending on server load) + var/temp = PULSE_NORM + + var/modifier_shift = 0 + var/modifier_set + + if(modifiers && modifiers.len) + for(var/datum/modifier/mod in modifiers) + if(isnull(modifier_set) && !isnull(mod.pulse_set_level)) + modifier_set = round(mod.pulse_set_level) // Should be a whole number, but let's not take chances. + else if(mod.pulse_set_level > modifier_set) + modifier_set = round(mod.pulse_set_level) + + modifier_set = max(0, modifier_set) // No setting to negatives. + + if(mod.pulse_modifier) + modifier_shift += mod.pulse_modifier + + modifier_shift = round(modifier_shift) + if(!internal_organs_by_name[O_HEART]) - return PULSE_NONE //No blood, no pulse. + temp = PULSE_NONE + if(!isnull(modifier_set)) + temp = modifier_set + return temp //No blood, no pulse. if(stat == DEAD) - return PULSE_NONE //that's it, you're dead, nothing can influence your pulse + temp = PULSE_NONE + if(!isnull(modifier_set)) + temp = modifier_set + return temp //that's it, you're dead, nothing can influence your pulse, aside from outside means. var/obj/item/organ/internal/heart/Pump = internal_organs_by_name[O_HEART] - var/temp = PULSE_NORM - if(Pump) temp += Pump.standard_pulse_level - PULSE_NORM @@ -1558,6 +1581,11 @@ if(status_flags & FAKEDEATH) temp = PULSE_NONE //pretend that we're dead. unlike actual death, can be inflienced by meds + if(!isnull(modifier_set)) + temp = modifier_set + + temp = max(0, temp + modifier_shift) // No negative pulses. + if(Pump) for(var/datum/reagent/R in reagents.reagent_list) if(R.id in bradycardics) diff --git a/code/modules/reagents/Chemistry-Reagents.dm b/code/modules/reagents/Chemistry-Reagents.dm index bf34512eef..8ad8b6486d 100644 --- a/code/modules/reagents/Chemistry-Reagents.dm +++ b/code/modules/reagents/Chemistry-Reagents.dm @@ -76,7 +76,7 @@ var/obj/item/organ/internal/heart/Pump = H.internal_organs_by_name[O_HEART] if(!Pump) removed *= 0.1 - else if(Pump.standard_pulse_level == PULSE_NONE) // No pulse means chemicals process a little bit slower than normal. + else if(Pump.standard_pulse_level == PULSE_NONE) // No pulse normally means chemicals process a little bit slower than normal. removed *= 0.8 else // Otherwise, chemicals process as per percentage of your current pulse, or, if you have no pulse but are alive, by a miniscule amount. removed *= max(0.1, H.pulse / Pump.standard_pulse_level)