Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regenerative slime extract rework #2275

Merged
merged 20 commits into from
Jul 14, 2024
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
Absolucy marked this conversation as resolved.
Show resolved Hide resolved
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
55 changes: 30 additions & 25 deletions code/modules/research/xenobiology/crossbreeding/regenerative.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
Regenerative extracts:
Work like a legion regenerative core.
Has a unique additional effect.

HEAVILY REWORKED BY MONKESTATION, SEE [monkestation\code\modules\slimecore\crossbreeding\regenerative]
*/
/obj/item/slimecross/regenerative
name = "regenerative extract"
Expand All @@ -14,6 +16,7 @@ Regenerative extracts:
/obj/item/slimecross/regenerative/proc/core_effect_before(mob/living/carbon/human/target, mob/user)
return

/* monkestation edit: overriden in [monkestation\code\modules\slimecore\crossbreeding\regenerative\extract.dm]
/obj/item/slimecross/regenerative/afterattack(atom/target,mob/user,prox)
. = ..()
if(!prox || !isliving(target))
Expand All @@ -29,34 +32,34 @@ Regenerative extracts:
user.visible_message(span_notice("[user] crushes [src] over [user.p_them()]self, the milky goo quickly regenerating all of [user.p_their()] injuries!"),
span_notice("You squeeze [src], and it bursts in your hand, splashing you with milky goo which quickly regenerates your injuries!"))
core_effect_before(H, user)
H.revive(HEAL_ALL)
Absolucy marked this conversation as resolved.
Show resolved Hide resolved
core_effect(H, user)
playsound(target, 'sound/effects/splat.ogg', 40, TRUE)
qdel(src)
*/

/obj/item/slimecross/regenerative/grey
colour = "grey" //Has no bonus effect.
effect_desc = "Fully heals the target and does nothing else."
effect_desc = "Rapidly heals the target and does nothing else." // monkestation edit: updates effect_desc to reflect the rework

/obj/item/slimecross/regenerative/orange
colour = "orange"

/obj/item/slimecross/regenerative/orange/core_effect_before(mob/living/target, mob/user)
target.visible_message(span_warning("The [src] boils over!"))
target.visible_message(span_warning("\The [src] boils over!"))
for(var/turf/targetturf in RANGE_TURFS(1,target))
if(!locate(/obj/effect/hotspot) in targetturf)
new /obj/effect/hotspot(targetturf)

/obj/item/slimecross/regenerative/purple
colour = "purple"
effect_desc = "Fully heals the target and injects them with some regen jelly."
effect_desc = "Rapidly heals the target at an even greater rate, and injects them with some regenerative jelly." // monkestation edit: updates effect_desc to reflect the rework

/obj/item/slimecross/regenerative/purple/core_effect(mob/living/target, mob/user)
target.reagents.add_reagent(/datum/reagent/medicine/regen_jelly,10)

/obj/item/slimecross/regenerative/blue
colour = "blue"
effect_desc = "Fully heals the target and makes the floor wet."
effect_desc = "Rapidly heals the target and makes the floor wet." // monkestation edit: updates effect_desc to reflect the rework

/obj/item/slimecross/regenerative/blue/core_effect(mob/living/target, mob/user)
if(isturf(target.loc))
Expand All @@ -66,7 +69,7 @@ Regenerative extracts:

/obj/item/slimecross/regenerative/metal
colour = "metal"
effect_desc = "Fully heals the target and encases the target in a locker."
effect_desc = "Rapidly heals the target and encases the target in a locker." // monkestation edit: updates effect_desc to reflect the rework

/obj/item/slimecross/regenerative/metal/core_effect(mob/living/target, mob/user)
target.visible_message(span_warning("The milky goo hardens and reshapes itself, encasing [target]!"))
Expand All @@ -77,7 +80,7 @@ Regenerative extracts:

/obj/item/slimecross/regenerative/yellow
colour = "yellow"
effect_desc = "Fully heals the target and fully recharges a single item on the target."
effect_desc = "Rapidly heals the target and fully recharges a single item on the target." // monkestation edit: updates effect_desc to reflect the rework

/obj/item/slimecross/regenerative/yellow/core_effect(mob/living/target, mob/user)
var/list/batteries = list()
Expand All @@ -91,7 +94,7 @@ Regenerative extracts:

/obj/item/slimecross/regenerative/darkpurple
colour = "dark purple"
effect_desc = "Fully heals the target and gives them purple clothing if they are naked."
effect_desc = "Rapidly heals the target and gives them purple clothing if they are naked." // monkestation edit: updates effect_desc to reflect the rework

/obj/item/slimecross/regenerative/darkpurple/core_effect(mob/living/target, mob/user)
var/equipped = 0
Expand All @@ -104,7 +107,7 @@ Regenerative extracts:

/obj/item/slimecross/regenerative/darkblue
colour = "dark blue"
effect_desc = "Fully heals the target and fireproofs their clothes."
effect_desc = "Rapidly heals the target and fireproofs their clothes." // monkestation edit: updates effect_desc to reflect the rework

/obj/item/slimecross/regenerative/darkblue/core_effect(mob/living/target, mob/user)
if(!ishuman(target))
Expand Down Expand Up @@ -132,15 +135,17 @@ Regenerative extracts:

/obj/item/slimecross/regenerative/silver
colour = "silver"
effect_desc = "Fully heals the target and makes their belly feel round and full."
effect_desc = "Rapidly heals the target, regenerating their nutrition at a far greater rate than normal" // monkestation edit: updates effect_desc to reflect the rework

/* monkestation edit: replaced in [monkestation\code\modules\slimecore\crossbreeding\regenerative\extract.dm]
/obj/item/slimecross/regenerative/silver/core_effect(mob/living/target, mob/user)
target.set_nutrition(NUTRITION_LEVEL_FULL - 1)
to_chat(target, span_notice("You feel satiated."))
*/

/obj/item/slimecross/regenerative/bluespace
colour = "bluespace"
effect_desc = "Fully heals the target and teleports them to where this core was created."
effect_desc = "Rapidly heals the target and teleports them to where this core was created." // monkestation edit: updates effect_desc to reflect the rework
var/turf/open/T

/obj/item/slimecross/regenerative/bluespace/core_effect(mob/living/target, mob/user)
Expand All @@ -156,64 +161,64 @@ Regenerative extracts:

/obj/item/slimecross/regenerative/sepia
colour = "sepia"
effect_desc = "Fully heals the target. After 10 seconds, relocate the target to the initial position the core was used with their previous health status."
effect_desc = "Rapidly heals the target. After 10 seconds, relocate the target to the initial position the core was used with their previous health status." // monkestation edit: updates effect_desc to reflect the rework

/obj/item/slimecross/regenerative/sepia/core_effect_before(mob/living/target, mob/user)
to_chat(target, span_notice("You try to forget how you feel."))
target.AddComponent(/datum/component/dejavu)

/obj/item/slimecross/regenerative/cerulean
colour = "cerulean"
effect_desc = "Fully heals the target and makes a second regenerative core with no special effects."
effect_desc = "Rapidly heals the target and makes a second regenerative core with no special effects." // monkestation edit: updates effect_desc to reflect the rework

/obj/item/slimecross/regenerative/cerulean/core_effect(mob/living/target, mob/user)
src.forceMove(user.loc)
var/obj/item/slimecross/X = new /obj/item/slimecross/regenerative(user.loc)
var/obj/item/slimecross/X = new /obj/item/slimecross/regenerative(user.drop_location())
X.name = name
X.desc = desc
user.put_in_active_hand(X)
to_chat(user, span_notice("Some of the milky goo congeals in your hand!"))

/obj/item/slimecross/regenerative/pyrite
colour = "pyrite"
effect_desc = "Fully heals and randomly colors the target."
effect_desc = "Rapidly heals and randomly colors the target." // monkestation edit: updates effect_desc to reflect the rework

/obj/item/slimecross/regenerative/pyrite/core_effect(mob/living/target, mob/user)
target.visible_message(span_warning("The milky goo coating [target] leaves [target.p_them()] a different color!"))
target.add_atom_colour(rgb(rand(0,255),rand(0,255),rand(0,255)),WASHABLE_COLOUR_PRIORITY)

/obj/item/slimecross/regenerative/red
colour = "red"
effect_desc = "Fully heals the target and injects them with some ephedrine."
effect_desc = "Rapidly heals the target and injects them with some ephedrine." // monkestation edit: updates effect_desc to reflect the rework

/obj/item/slimecross/regenerative/red/core_effect(mob/living/target, mob/user)
to_chat(target, span_notice("You feel... <i>faster.</i>"))
target.reagents.add_reagent(/datum/reagent/medicine/ephedrine,3)

/obj/item/slimecross/regenerative/green
colour = "green"
effect_desc = "Fully heals the target and changes the spieces or color of a slime or jellyperson."
effect_desc = "Rapidly heals the target and changes the species or color of a slime or jellyperson." // monkestation edit: updates effect_desc to reflect the rework

/obj/item/slimecross/regenerative/green/core_effect(mob/living/target, mob/user)
if(isslime(target))
target.visible_message(span_warning("The [target] suddenly changes color!"))
target.visible_message(span_warning("\The [target] suddenly changes color!"))
var/mob/living/basic/slime/S = target
S.start_mutating(TRUE)
if(isjellyperson(target))
target.reagents.add_reagent(/datum/reagent/mutationtoxin/jelly,5)
target.reagents.add_reagent(/datum/reagent/mutationtoxin/jelly, 5)


/obj/item/slimecross/regenerative/pink
colour = "pink"
effect_desc = "Fully heals the target and injects them with some krokodil."
effect_desc = "Rapidly heals the target and injects them with some krokodil." // monkestation edit: updates effect_desc to reflect the rework

/obj/item/slimecross/regenerative/pink/core_effect(mob/living/target, mob/user)
to_chat(target, span_notice("You feel more calm."))
target.reagents.add_reagent(/datum/reagent/drug/krokodil,4)

/obj/item/slimecross/regenerative/gold
colour = "gold"
effect_desc = "Fully heals the target and produces a random coin."
effect_desc = "Rapidly heals the target and produces a random coin." // monkestation edit: updates effect_desc to reflect the rework

/obj/item/slimecross/regenerative/gold/core_effect(mob/living/target, mob/user)
var/newcoin = pick(/obj/item/coin/silver, /obj/item/coin/iron, /obj/item/coin/gold, /obj/item/coin/diamond, /obj/item/coin/plasma, /obj/item/coin/uranium)
Expand All @@ -223,7 +228,7 @@ Regenerative extracts:

/obj/item/slimecross/regenerative/oil
colour = "oil"
effect_desc = "Fully heals the target and flashes everyone in sight."
effect_desc = "Rapidly heals the target and flashes everyone in sight." // monkestation edit: updates effect_desc to reflect the rework

/obj/item/slimecross/regenerative/oil/core_effect(mob/living/target, mob/user)
playsound(src, 'sound/weapons/flash.ogg', 100, TRUE)
Expand All @@ -232,7 +237,7 @@ Regenerative extracts:

/obj/item/slimecross/regenerative/black
colour = "black"
effect_desc = "Fully heals the target and creates an imperfect duplicate of them made of slime, that fakes their death."
effect_desc = "Rapidly heals the target and creates an imperfect duplicate of them made of slime, that fakes their death." // monkestation edit: updates effect_desc to reflect the rework

/obj/item/slimecross/regenerative/black/core_effect_before(mob/living/target, mob/user)
var/dummytype = target.type
Expand All @@ -255,7 +260,7 @@ Regenerative extracts:

/obj/item/slimecross/regenerative/lightpink
colour = "light pink"
effect_desc = "Fully heals the target and also heals the user."
effect_desc = "Rapidly heals the target and also heals the user." // monkestation edit: updates effect_desc to reflect the rework

/obj/item/slimecross/regenerative/lightpink/core_effect(mob/living/target, mob/user)
if(!isliving(user))
Expand All @@ -268,7 +273,7 @@ Regenerative extracts:

/obj/item/slimecross/regenerative/adamantine
colour = "adamantine"
effect_desc = "Fully heals the target and boosts their armor."
effect_desc = "Rapidly heals the target, while boosts their armor and general resilience." // monkestation edit: updates effect_desc to reflect the rework
Absolucy marked this conversation as resolved.
Show resolved Hide resolved

/obj/item/slimecross/regenerative/adamantine/core_effect(mob/living/target, mob/user) //WIP - Find out why this doesn't work.
target.apply_status_effect(/datum/status_effect/slimeskin)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/datum/status_effect/regenerative_extract/purple
base_healing_amt = 10
diminishing_multiplier = 0.5
diminish_time = 1.5 MINUTES
extra_traits = list(TRAIT_NOCRITOVERLAY, TRAIT_NOSOFTCRIT)

/datum/status_effect/regenerative_extract/silver
base_healing_amt = 4
nutrition_heal_cap = NUTRITION_LEVEL_WELL_FED + 50
diminishing_multiplier = 0.8
diminish_time = 30 SECONDS
extra_traits = list(TRAIT_NOFAT)

/datum/status_effect/regenerative_extract/yellow
extra_traits = list(TRAIT_SHOCKIMMUNE, TRAIT_TESLA_SHOCKIMMUNE, TRAIT_AIRLOCK_SHOCKIMMUNE)

/datum/status_effect/regenerative_extract/adamantine
extra_traits = list(TRAIT_FEARLESS, TRAIT_HARDLY_WOUNDED)

// rainbow extracts are similar to old regen extract effects, albeit it won't replace your organs, and won't heal limbs (unless you're an oozeling)
#define RAINBOW_HEAL_FLAGS ~(HEAL_ADMIN | HEAL_RESTRAINTS | HEAL_LIMBS | HEAL_REFRESH_ORGANS)

/datum/status_effect/regenerative_extract/rainbow
alert_type = null
diminishing_multiplier = 0 // you can't use other extracts at all during this time
tick_interval = -1

/datum/status_effect/regenerative_extract/rainbow/on_apply()
var/heal_flags = RAINBOW_HEAL_FLAGS
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should probably just be on regenerative_extract in case people want to change the effects of a regen extract to do something like heal organs or heal limbs.

if(isoozeling(owner)) // have some mercy on oozelings
heal_flags |= HEAL_LIMBS
owner.revive(heal_flags)
return FALSE // return false so we immediately clear the effect and start the cooldown

#undef RAINBOW_HEAL_FLAGS
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/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
heal_flag_necessary = HEAL_ADMIN
/// The multiplier applied to the effect of a regen extract while this cooldown is active.
/// As multiple cooldowns can be active at the same time, these multipliers stack, resulting in exponentially diminishing returns.
var/multiplier = 1
Absolucy marked this conversation as resolved.
Show resolved Hide resolved

/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,84 @@
/datum/status_effect/regenerative_extract
id = "Slime Regeneration"
status_type = STATUS_EFFECT_UNIQUE
duration = 15 SECONDS
tick_interval = 0.2 SECONDS
alert_type = /atom/movable/screen/alert/status_effect/regen_extract
/// The damage healed (for each type) per tick.
/// This is multipled against the multiplier derived from cooldowns.
var/base_healing_amt = 5
/// The number multiplied against the base healing amount,
/// used for the "diminishing returns" cooldown effect.
var/multiplier = 1
/// The multiplier that the cooldown applied after the effect ends will use.
var/diminishing_multiplier = 0.75
/// How long the subsequent cooldown effect will last.
var/diminish_time = 45 SECONDS
/// The maximum nutrition level this regenerative extract can heal up to.
var/nutrition_heal_cap = NUTRITION_LEVEL_FED - 50
/// Base traits given to the owner.
var/list/given_traits = list(TRAIT_ANALGESIA, TRAIT_NOCRITDAMAGE)
Absolucy marked this conversation as resolved.
Show resolved Hide resolved
/// Extra traits given to the owner, added to the base traits.
var/list/extra_traits = list()
Absolucy marked this conversation as resolved.
Show resolved Hide resolved

/datum/status_effect/regenerative_extract/on_apply()
// So this seems weird, but this allows us to have multiple things affect the regen multiplier,
// without doing something like hardcoding a `for(var/datum/status_effect/slime_regen_cooldown/cooldown in owner.status_effects)`
// Instead, cooldown effects register the [COMSIG_SLIME_REGEN_CALC] signal, and can affect our multiplier via the pointer we pass.
SEND_SIGNAL(owner, COMSIG_SLIME_REGEN_CALC, &multiplier)
Absolucy marked this conversation as resolved.
Show resolved Hide resolved
if(multiplier < 1)
Absolucy marked this conversation as resolved.
Show resolved Hide resolved
to_chat(owner, span_warning("The previous regenerative goo hasn't fully evaporated yet, weakening the new regenerative effect!"))
owner.add_traits(given_traits + extra_traits, id)
Absolucy marked this conversation as resolved.
Show resolved Hide resolved
return TRUE

/datum/status_effect/regenerative_extract/on_remove()
owner.remove_traits(given_traits + extra_traits, id)
Absolucy marked this conversation as resolved.
Show resolved Hide resolved
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."

/atom/movable/screen/alert/status_effect/regen_extract
name = "Slime Regeneration"
desc = "A milky slime covers your skin, soothing and regenerating your injuries!"
icon_state = "regenerative_core"
Loading
Loading