Skip to content

Commit

Permalink
Regenerative slime extract rework
Browse files Browse the repository at this point in the history
  • Loading branch information
Absolucy committed Jun 24, 2024
1 parent c2acaab commit 720f743
Show file tree
Hide file tree
Showing 7 changed files with 108 additions and 1 deletion.
2 changes: 2 additions & 0 deletions code/__DEFINES/~monkestation/dcs/signals/signals_mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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"
3 changes: 3 additions & 0 deletions code/__HELPERS/~monkestation-helpers/cmp.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/carbon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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."
Original file line number Diff line number Diff line change
@@ -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)
3 changes: 3 additions & 0 deletions tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 720f743

Please sign in to comment.