Skip to content

Commit

Permalink
xenos can now fully evo pre-shutters (#16215)
Browse files Browse the repository at this point in the history
  • Loading branch information
Xander3359 authored Jul 9, 2024
1 parent fb8969f commit f46715d
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
14 changes: 11 additions & 3 deletions code/modules/mob/living/carbon/xenomorph/evo_datum.dm
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,23 @@

/// Some data to update the UI with the current evolution status
/datum/evolution_panel/ui_data(mob/living/carbon/xenomorph/xeno)
. = list()
var/list/data = list()

data["bypass_evolution_checks"] = SSresinshaping.active

.["can_evolve"] = !xeno.is_ventcrawling && !xeno.incapacitated(TRUE) && xeno.health >= xeno.maxHealth && xeno.plasma_stored >= (xeno.xeno_caste.plasma_max * xeno.xeno_caste.plasma_regen_limit)
data["can_evolve"] = \
!xeno.is_ventcrawling && \
!xeno.incapacitated(TRUE) && \
xeno.health >= xeno.maxHealth && \
xeno.plasma_stored >= (xeno.xeno_caste.plasma_max * xeno.xeno_caste.plasma_regen_limit)

.["evolution"] = list(
data["evolution"] = list(
"current" = xeno.evolution_stored,
"max" = xeno.xeno_caste.evolution_threshold
)

return data

/// Handles actuually evolving
/datum/evolution_panel/ui_act(action, list/params)
. = ..()
Expand Down
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/xenomorph/evolution.dm
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@
else if(isxenodrone(src) && new_caste_type != /datum/xeno_caste/shrike)
to_chat(src, span_xenonotice("The hive currently has no sister able to become a ruler! The survival of the hive requires from us to be a Shrike!"))
return FALSE
if(!CHECK_BITFIELD(new_caste_flags, CASTE_INSTANT_EVOLUTION) && xeno_caste.evolution_threshold && evolution_stored < xeno_caste.evolution_threshold)
if(!CHECK_BITFIELD(new_caste_flags, CASTE_INSTANT_EVOLUTION) && xeno_caste.evolution_threshold && evolution_stored < xeno_caste.evolution_threshold && !SSresinshaping.active)
to_chat(src, span_warning("We must wait before evolving. Currently at: [evolution_stored] / [xeno_caste.evolution_threshold]."))
return FALSE
return TRUE
Expand Down
16 changes: 13 additions & 3 deletions tgui/packages/tgui/interfaces/HiveEvolveScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,17 @@ const CasteView = (props) => {
export const HiveEvolveScreen = (props) => {
const { act, data } = useBackend();

const { name, evolution, abilities, evolves_to, can_evolve } =
data as ByondData;
const {
name,
evolution,
abilities,
evolves_to,
can_evolve,
bypass_evolution_checks,
} = data as ByondData;

const canEvolve = can_evolve && evolution.current >= evolution.max;
const bypassEvolution = can_evolve && bypass_evolution_checks;
// Most checks are skipped for shrike and queen so we except them below.
const evolvesInto = Object.values(evolves_to);

Expand All @@ -66,7 +73,9 @@ export const HiveEvolveScreen = (props) => {
title={`${evolve.name} (click for details)`}
buttons={
<Button
disabled={!canEvolve && !evolve.instant_evolve}
disabled={
!canEvolve && !evolve.instant_evolve && !bypassEvolution
}
onClick={() => act('evolve', { path: evolve.type_path })}
>
Evolve
Expand Down Expand Up @@ -95,6 +104,7 @@ type ByondData = {
abilities: XenoAbility[];
evolves_to: EvolveCaste[];
can_evolve: boolean;
bypass_evolution_checks: boolean;
};

type EvolveCaste = {
Expand Down

0 comments on commit f46715d

Please sign in to comment.