Skip to content

Commit

Permalink
[MIRROR] Fix lings spending double the chemicals for reviving stasis …
Browse files Browse the repository at this point in the history
…(30->15) (#2741)

* Fix lings spending double the chemicals for reviving stasis (30->15) (#82412)

## About The Pull Request

Currently, reviving stasis is bugged to force lings to spend the
chemical cost twice. This change refactors the fakedeath code to instead
reset the chemical cost after the revival ability resolves, instead of
resetting it in the middle of their revival before the chemical
adjustment is resolved.
## Why It's Good For The Game

Fixes #82394 
## Changelog

Changelings now only have to pay the intended 15 chemicals for reviving
stasis.
:cl: Bisar
fix: Adjusted the code for changeling reviving stasis to only make them
spend chemicals once.
/:cl:

* Fix lings spending double the chemicals for reviving stasis (30->15)

---------

Co-authored-by: NovaBot <[email protected]>
Co-authored-by: Joshua Kidder <[email protected]>
  • Loading branch information
3 people authored Apr 5, 2024
1 parent 6dedaf4 commit 50f502a
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions code/modules/antagonists/changeling/powers/fakedeath.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
..()
if(revive_ready)
INVOKE_ASYNC(src, PROC_REF(revive), user)
disable_revive(user) // this should be already called via signal, but just incase something wacky happens
return TRUE

var/death_duration_mod = 1
Expand Down Expand Up @@ -47,18 +46,21 @@
RegisterSignal(changeling, COMSIG_MOB_STATCHANGE, PROC_REF(on_stat_change))
return TRUE

/// Sets [revive_ready] to FALSE and updates the button icons.
/// Can be called mid-revival if the process is being cancelled
/datum/action/changeling/fakedeath/proc/disable_revive(mob/living/changeling)
if(revive_ready)
chemical_cost = 15
revive_ready = FALSE
build_all_button_icons(UPDATE_BUTTON_NAME|UPDATE_BUTTON_ICON)

/// Removes the signals for fakedeath and listening for hapless doctors
/// healing a changeling who went into stasis after actually dying, and
/// also removes changeling stasis
/datum/action/changeling/fakedeath/proc/disable_stasis_and_fakedeath(mob/living/changeling)
REMOVE_TRAIT(changeling, TRAIT_STASIS, CHANGELING_TRAIT)
UnregisterSignal(changeling, SIGNAL_REMOVETRAIT(TRAIT_DEATHCOMA))
UnregisterSignal(changeling, COMSIG_MOB_STATCHANGE)

/// This proc is called to reset the chemical cost of the revival
/// as well as the revive ready flag and button states.
/datum/action/changeling/fakedeath/proc/reset_chemical_cost()
chemical_cost = 15
revive_ready = FALSE
build_all_button_icons(UPDATE_BUTTON_NAME|UPDATE_BUTTON_ICON)

/// Sets [revive_ready] to TRUE and updates the button icons.
/datum/action/changeling/fakedeath/proc/enable_revive(mob/living/changeling)
if(revive_ready)
Expand All @@ -75,7 +77,7 @@
if(HAS_TRAIT_FROM(source, TRAIT_DEATHCOMA, CHANGELING_TRAIT))
return

disable_revive(source)
disable_stasis_and_fakedeath(source)

/// Signal proc to exit fakedeath early if we're revived from being previously dead
/datum/action/changeling/fakedeath/proc/on_stat_change(mob/living/source, new_stat, old_stat)
Expand All @@ -86,6 +88,7 @@

source.cure_fakedeath(CHANGELING_TRAIT)
to_chat(source, span_changeling("We exit our stasis early."))
reset_chemical_cost()

/datum/action/changeling/fakedeath/proc/revive(mob/living/carbon/user)
if(!istype(user))
Expand Down Expand Up @@ -142,6 +145,14 @@

return ..()

/// We wait until after we actually deduct chemical cost (or don't deduct
/// if it's the 0 cost we get for revival) before we reset the chemical cost
/datum/action/changeling/fakedeath/try_to_sting(mob/living/user)
. = ..()
if (!. || !revive_ready)
return
reset_chemical_cost()

/datum/action/changeling/fakedeath/proc/can_enter_stasis(mob/living/user)
if(HAS_TRAIT_FROM(user, TRAIT_DEATHCOMA, CHANGELING_TRAIT))
user.balloon_alert(user, "already reviving!")
Expand Down

0 comments on commit 50f502a

Please sign in to comment.