From 720f7437c3940f5e42f9e772d274338cf7e339f4 Mon Sep 17 00:00:00 2001 From: Lucy Date: Fri, 14 Jun 2024 18:15:28 -0400 Subject: [PATCH] Regenerative slime extract rework --- .../~monkestation/dcs/signals/signals_mob.dm | 2 + code/__HELPERS/~monkestation-helpers/cmp.dm | 3 + code/modules/mob/living/carbon/carbon.dm | 2 +- .../crossbreeding/regenerative/_cooldown.dm | 23 +++++++ .../crossbreeding/regenerative/_effect.dm | 64 +++++++++++++++++++ .../crossbreeding/regenerative/colors.dm | 12 ++++ tgstation.dme | 3 + 7 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 monkestation/code/modules/slimecore/crossbreeding/regenerative/_cooldown.dm create mode 100644 monkestation/code/modules/slimecore/crossbreeding/regenerative/_effect.dm create mode 100644 monkestation/code/modules/slimecore/crossbreeding/regenerative/colors.dm diff --git a/code/__DEFINES/~monkestation/dcs/signals/signals_mob.dm b/code/__DEFINES/~monkestation/dcs/signals/signals_mob.dm index 2030e073340f..97350562fb5d 100644 --- a/code/__DEFINES/~monkestation/dcs/signals/signals_mob.dm +++ b/code/__DEFINES/~monkestation/dcs/signals/signals_mob.dm @@ -23,3 +23,5 @@ #define COMSIG_STACK_MOVE "stack_move" #define COMSIG_CHECK_CAN_ADD_NEW_STACK "check_stack_add" #define COMSIG_MOBSTACKER_DESTROY "mobstack_destroy_stack" + +#define COMSIG_SLIME_REGEN_CALC "slime_regen_calc" diff --git a/code/__HELPERS/~monkestation-helpers/cmp.dm b/code/__HELPERS/~monkestation-helpers/cmp.dm index eea5c3be71a7..5aa9c5bbb063 100644 --- a/code/__HELPERS/~monkestation-helpers/cmp.dm +++ b/code/__HELPERS/~monkestation-helpers/cmp.dm @@ -3,3 +3,6 @@ /proc/cmp_mob_playtime_dsc(mob/a, mob/b) return cmp_numeric_dsc(a?.client?.get_exp_living(TRUE), b?.client?.get_exp_living(TRUE)) + +/proc/cmp_wound_severity_dsc(datum/wound/a, datum/wound/b) + return cmp_numeric_dsc(a.severity, b.severity) diff --git a/code/modules/mob/living/carbon/carbon.dm b/code/modules/mob/living/carbon/carbon.dm index ad10167adec1..40f1546a0c6b 100644 --- a/code/modules/mob/living/carbon/carbon.dm +++ b/code/modules/mob/living/carbon/carbon.dm @@ -885,7 +885,7 @@ set_handcuffed(null) update_handcuffed() - stamina.adjust(stamina.maximum, TRUE) + stamina.revitalize(forced = TRUE) return ..() /mob/living/carbon/can_be_revived() diff --git a/monkestation/code/modules/slimecore/crossbreeding/regenerative/_cooldown.dm b/monkestation/code/modules/slimecore/crossbreeding/regenerative/_cooldown.dm new file mode 100644 index 000000000000..eeaab8aec707 --- /dev/null +++ b/monkestation/code/modules/slimecore/crossbreeding/regenerative/_cooldown.dm @@ -0,0 +1,23 @@ +/datum/status_effect/slime_regen_cooldown + id = "slime_regen_cooldown" + status_type = STATUS_EFFECT_MULTIPLE + tick_interval = -1 + alert_type = null + remove_on_fullheal = TRUE + var/multiplier = 1 + +/datum/status_effect/slime_regen_cooldown/on_creation(mob/living/new_owner, multiplier = 1, duration = 45 SECONDS) + src.multiplier = multiplier + src.duration = duration + return ..() + +/datum/status_effect/slime_regen_cooldown/on_apply() + RegisterSignal(owner, COMSIG_SLIME_REGEN_CALC, PROC_REF(apply_multiplier)) + return TRUE + +/datum/status_effect/slime_regen_cooldown/on_remove() + UnregisterSignal(owner, COMSIG_SLIME_REGEN_CALC) + +/datum/status_effect/slime_regen_cooldown/proc/apply_multiplier(datum/source, multiplier_ptr) + SIGNAL_HANDLER + *multiplier_ptr *= multiplier diff --git a/monkestation/code/modules/slimecore/crossbreeding/regenerative/_effect.dm b/monkestation/code/modules/slimecore/crossbreeding/regenerative/_effect.dm new file mode 100644 index 000000000000..8a692c1d2f5b --- /dev/null +++ b/monkestation/code/modules/slimecore/crossbreeding/regenerative/_effect.dm @@ -0,0 +1,64 @@ +/datum/status_effect/regenerative_extract + id = "Slime Regeneration" + status_type = STATUS_EFFECT_UNIQUE + duration = 15 SECONDS + tick_interval = 0.5 SECONDS + alert_type = null + var/base_healing_amt = 2 + var/multiplier = 1 + var/diminishing_multiplier = 0.75 + var/diminish_time = 45 SECONDS + var/nutrition_heal_cap = NUTRITION_LEVEL_FED - 50 + var/list/given_traits = list(TRAIT_ANALGESIA, TRAIT_NOCRITDAMAGE) + +/datum/status_effect/regenerative_extract/on_apply() + SEND_SIGNAL(owner, COMSIG_SLIME_REGEN_CALC, &multiplier) + owner.add_traits(given_traits, id) + return TRUE + +/datum/status_effect/regenerative_extract/on_remove() + owner.remove_traits(given_traits, id) + owner.apply_status_effect(/datum/status_effect/slime_regen_cooldown, diminishing_multiplier, diminish_time) + +/datum/status_effect/regenerative_extract/tick(seconds_per_tick, times_fired) + var/heal_amt = base_healing_amt * seconds_per_tick * multiplier + heal_act(heal_amt) + owner.updatehealth() + +/datum/status_effect/regenerative_extract/proc/heal_act(heal_amt) + if(!heal_amt) + return + heal_damage(heal_amt) + heal_misc(heal_amt) + if(iscarbon(owner)) + heal_organs(heal_amt) + heal_wounds() + +/datum/status_effect/regenerative_extract/proc/heal_damage(heal_amt) + owner.heal_overall_damage(brute = heal_amt, burn = heal_amt, updating_health = FALSE) + owner.stamina?.adjust(-heal_amt, forced = TRUE) + owner.adjustOxyLoss(-heal_amt, updating_health = FALSE) + owner.adjustToxLoss(-heal_amt, updating_health = FALSE, forced = TRUE) + owner.adjustCloneLoss(-heal_amt, updating_health = FALSE) + +/datum/status_effect/regenerative_extract/proc/heal_misc(heal_amt) + owner.adjust_disgust(-heal_amt) + if(owner.blood_volume < BLOOD_VOLUME_NORMAL) + owner.blood_volume = min(owner.blood_volume + heal_amt, BLOOD_VOLUME_NORMAL) + if((owner.nutrition < nutrition_heal_cap) && !HAS_TRAIT(owner, TRAIT_NOHUNGER)) + owner.nutrition = min(owner.nutrition + heal_amt, nutrition_heal_cap) + +/datum/status_effect/regenerative_extract/proc/heal_organs(heal_amt) + var/mob/living/carbon/carbon_owner = owner + for(var/obj/item/organ/organ in carbon_owner.organs) + organ.apply_organ_damage(-heal_amt) + carbon_owner.cure_trauma_type(resilience = TRAUMA_RESILIENCE_MAGIC) + +/datum/status_effect/regenerative_extract/proc/heal_wounds() + var/mob/living/carbon/carbon_owner = owner + if(length(carbon_owner.all_wounds)) + var/list/datum/wound/ordered_wounds = sort_list(carbon_owner.all_wounds, GLOBAL_PROC_REF(cmp_wound_severity_dsc)) + ordered_wounds[1]?.remove_wound() + +/datum/status_effect/regenerative_extract/get_examine_text() + return "[owner.p_They()] have a subtle, gentle glow to [owner.p_their()] skin, with slime soothing [owner.p_their()] wounds." diff --git a/monkestation/code/modules/slimecore/crossbreeding/regenerative/colors.dm b/monkestation/code/modules/slimecore/crossbreeding/regenerative/colors.dm new file mode 100644 index 000000000000..8b0c2d33cf2b --- /dev/null +++ b/monkestation/code/modules/slimecore/crossbreeding/regenerative/colors.dm @@ -0,0 +1,12 @@ +/datum/status_effect/regenerative_extract/purple + base_healing_amt = 4 + diminishing_multiplier = 0.5 + diminish_time = 1.5 MINUTES + given_traits = list(TRAIT_ANALGESIA, TRAIT_NOCRITDAMAGE, TRAIT_NOCRITOVERLAY, TRAIT_NOSOFTCRIT) + +/datum/status_effect/regenerative_extract/silver + base_healing_amt = 1.5 + nutrition_heal_cap = NUTRITION_LEVEL_WELL_FED + 50 + diminishing_multiplier = 0.8 + diminish_time = 30 SECONDS + given_traits = list(TRAIT_ANALGESIA, TRAIT_NOCRITDAMAGE, TRAIT_NOCRITOVERLAY, TRAIT_NOFAT) diff --git a/tgstation.dme b/tgstation.dme index 86d1803b041b..2653d06e3fd4 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -7044,6 +7044,9 @@ #include "monkestation\code\modules\slimecore\corral\upgrades\human_docility_upgrade.dm" #include "monkestation\code\modules\slimecore\corral\upgrades\obliteration_upgrade.dm" #include "monkestation\code\modules\slimecore\crossbreeding\industrial.dm" +#include "monkestation\code\modules\slimecore\crossbreeding\regenerative\_cooldown.dm" +#include "monkestation\code\modules\slimecore\crossbreeding\regenerative\_effect.dm" +#include "monkestation\code\modules\slimecore\crossbreeding\regenerative\colors.dm" #include "monkestation\code\modules\slimecore\items\crossbreeds.dm" #include "monkestation\code\modules\slimecore\items\mutation_syringe.dm" #include "monkestation\code\modules\slimecore\items\vacuum_pack.dm"