-
Notifications
You must be signed in to change notification settings - Fork 580
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add de-evolve cooldown per caste & De-evolve fixes (#7633)
# About the pull request This PR adds a 5 minute cooldown to go to the same caste again after a de-evolution. It also fixes various oversights between the self de-evolve vs the queen de-evolve (they really ought to be unified, but there's also various subtle differences between them). Also fixes the Mature Larva name never getting applied. # Explain why it's good for the game Normally I would not expect a player needing to de-evolve and re-evolve to the same caste, but there are edge cases where this can be used to reset conditions so it should be discouraged. # Testing Photographs and Procedure <details> <summary>Screenshots & Videos</summary> https://youtu.be/ScnsdwFa4yo After fixes/refactoring: https://youtu.be/LxlmKzN9QkU </details> # Changelog :cl: Drathek add: Added 5 minute cooldown when de-evolving to evolve into the same caste fix: Fixed queen de-evolve deleting her own organ rather than target xeno's fix: Fixed queen de-evolve not transferring built_structures list fix: Fixed regular de-evolve not stopping stat tracking on old xeno fix: Fixed de-evolve verb getting restored if it was taken away (Wouldn't without admin intervention currently) fix: Fixed mature larva name never getting applied when full evo threshold del: De-evolving to larva is now never bloodied (bloody used to only depend on evolution points to determine bloody status) /:cl:
- Loading branch information
Showing
13 changed files
with
120 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#define XENO_DEEVOLVE_COOLDOWN 5 MINUTES | ||
|
||
/** | ||
* A component that should be on all xenos that should be prevented from de-evolution manipulation. | ||
*/ | ||
/datum/component/deevolve_cooldown | ||
/// The xeno that we are bound to | ||
var/mob/living/carbon/xenomorph/parent_xeno | ||
/// Assoc list of caste define to timerid of recent de-evolves this xeno has performed that are still on cooldown | ||
var/list/deevolves_on_cooldown = list() | ||
|
||
/datum/component/deevolve_cooldown/Initialize(mob/living/carbon/xenomorph/old_xeno) | ||
parent_xeno = parent | ||
if(!istype(parent_xeno)) | ||
return COMPONENT_INCOMPATIBLE | ||
var/datum/component/deevolve_cooldown/old_component = old_xeno?.GetComponent(/datum/component/deevolve_cooldown) | ||
if(old_component) | ||
deevolves_on_cooldown = old_component.deevolves_on_cooldown | ||
|
||
/datum/component/deevolve_cooldown/RegisterWithParent() | ||
RegisterSignal(parent_xeno, COMSIG_XENO_DEEVOLVE, PROC_REF(on_deevolve)) | ||
RegisterSignal(parent_xeno, COMSIG_XENO_TRY_EVOLVE, PROC_REF(on_try_evolve)) | ||
|
||
/datum/component/deevolve_cooldown/UnregisterFromParent() | ||
UnregisterSignal(parent_xeno, list(COMSIG_XENO_DEEVOLVE, COMSIG_XENO_TRY_EVOLVE)) | ||
|
||
/// Signal handler for COMSIG_XENO_DEEVOLVE to add the current xeno as a de-evolution | ||
/datum/component/deevolve_cooldown/proc/on_deevolve() | ||
deevolves_on_cooldown[parent_xeno.caste_type] = addtimer(VARSET_LIST_REMOVE_CALLBACK(deevolves_on_cooldown, "[parent_xeno.caste_type]"), XENO_DEEVOLVE_COOLDOWN, TIMER_STOPPABLE) | ||
return | ||
|
||
/// Signal handler for COMSIG_XENO_TRY_EVOLVE to determine is the evolution is allowed | ||
/datum/component/deevolve_cooldown/proc/on_try_evolve(mob/living/carbon/xenomorph/old_xeno, castepick) | ||
var/on_cooldown_timer = deevolves_on_cooldown[castepick] | ||
if(on_cooldown_timer) | ||
to_chat(old_xeno, SPAN_WARNING("We cannot evolve into this caste again yet! ([DisplayTimeText(timeleft(on_cooldown_timer), 1)] remaining)")) | ||
return COMPONENT_OVERRIDE_EVOLVE | ||
return FALSE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.