Skip to content

Commit

Permalink
Splitting off apply_strain()
Browse files Browse the repository at this point in the history
Mainly just so that `update_icons()` can be called after it.
  • Loading branch information
SabreML committed Jan 24, 2024
1 parent d566cfe commit f4a153a
Show file tree
Hide file tree
Showing 17 changed files with 14 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
behavior_delegate_type = /datum/behavior_delegate/boiler_trapper

/datum/xeno_strain/trapper/apply_strain(mob/living/carbon/xenomorph/boiler/boiler)
. = ..()
if(!istype(boiler))
return FALSE

Expand All @@ -35,7 +34,6 @@

boiler.speed_modifier += XENO_SPEED_SLOWMOD_TIER_5 // compensating for base buffs
boiler.recalculate_everything()
return TRUE

/datum/behavior_delegate/boiler_trapper
name = "Boiler Trapper Behavior Delegate"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
behavior_delegate_type = /datum/behavior_delegate/carrier_eggsac

/datum/xeno_strain/eggsac/apply_strain(mob/living/carbon/xenomorph/carrier/carrier)
. = ..()

carrier.plasma_types = list(PLASMA_EGG)
carrier.phero_modifier += XENO_PHERO_MOD_LARGE // praetorian level pheremones
Expand All @@ -32,7 +31,6 @@
carrier.eggs_max = 12
carrier.egg_planting_range = 2
carrier.update_eggsac_overlays()
return TRUE

#define EGGSAC_OFF_WEED_EGGCAP 4
#define EGGSAC_EGG_SUSTAIN_DISTANCE 14
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@
behavior_delegate_type = /datum/behavior_delegate/crusher_charger

/datum/xeno_strain/charger/apply_strain(mob/living/carbon/xenomorph/crusher/crusher)
. = ..()

crusher.small_explosives_stun = FALSE
crusher.health_modifier += XENO_HEALTH_MOD_LARGE
crusher.speed_modifier += XENO_SPEED_FASTMOD_TIER_3
Expand All @@ -42,7 +40,6 @@
crusher.ignore_aura = "frenzy" // no funny crushers going 7 morbillion kilometers per second
crusher.phero_modifier = -crusher.caste.aura_strength
crusher.recalculate_everything()
return TRUE

/datum/behavior_delegate/crusher_charger
name = "Charger Crusher Behavior Delegate"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
behavior_delegate_type = /datum/behavior_delegate/defender_steel_crest

/datum/xeno_strain/steel_crest/apply_strain(mob/living/carbon/xenomorph/defender/defender)
. = ..()

defender.damage_modifier -= XENO_DAMAGE_MOD_VERY_SMALL
if(defender.fortify)
defender.ability_speed_modifier += 2.5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
behavior_delegate_type = /datum/behavior_delegate/drone_gardener

/datum/xeno_strain/gardener/apply_strain(mob/living/carbon/xenomorph/drone/drone)
. = ..()

drone.available_fruits = list(
/obj/effect/alien/resin/fruit/greater,
/obj/effect/alien/resin/fruit/unstable,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
behavior_delegate_type = /datum/behavior_delegate/drone_healer

/datum/xeno_strain/healer/apply_strain(mob/living/carbon/xenomorph/drone/drone)
. = ..()

drone.phero_modifier += XENO_PHERO_MOD_LARGE
drone.plasma_types += PLASMA_PHEROMONE
drone.damage_modifier -= XENO_DAMAGE_MOD_VERY_SMALL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,8 @@
behavior_delegate_type = /datum/behavior_delegate/facehugger_watcher

/datum/xeno_strain/watcher/apply_strain(mob/living/carbon/xenomorph/facehugger/huggy)
. = ..()

huggy.viewsize = 10
huggy.layer = initial(huggy.layer)
return TRUE

// This has no special effects, it's just here to skip `/datum/behavior_delegate/facehugger_base/on_life()`.
/datum/behavior_delegate/facehugger_watcher
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
)

/datum/xeno_strain/resin_whisperer/apply_strain(mob/living/carbon/xenomorph/hivelord/hivelord)
. = ..()

hivelord.plasmapool_modifier = 0.8 // -20% plasma pool
hivelord.extra_build_dist = 12 // 1 + 12 = 13 tile build range
hivelord.can_stack_builds = TRUE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@
)

/datum/xeno_strain/vampire/apply_strain(mob/living/carbon/xenomorph/lurker/lurker)
. = ..()

lurker.plasmapool_modifier = 0
lurker.health_modifier -= XENO_HEALTH_MOD_MED
lurker.speed_modifier += XENO_SPEED_FASTMOD_TIER_1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
behavior_delegate_type = /datum/behavior_delegate/praetorian_dancer

/datum/xeno_strain/dancer/apply_strain(mob/living/carbon/xenomorph/praetorian/prae)
. = ..()

prae.armor_modifier -= XENO_ARMOR_MOD_VERY_SMALL
prae.speed_modifier += XENO_SPEED_FASTMOD_TIER_5
prae.plasma_types = list(PLASMA_CATECHOLAMINE)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
behavior_delegate_type = /datum/behavior_delegate/oppressor_praetorian

/datum/xeno_strain/oppressor/apply_strain(mob/living/carbon/xenomorph/praetorian/prae)
. = ..()

prae.damage_modifier -= XENO_DAMAGE_MOD_SMALL
prae.explosivearmor_modifier += XENO_EXPOSIVEARMOR_MOD_SMALL
prae.small_explosives_stun = FALSE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
behavior_delegate_type = /datum/behavior_delegate/praetorian_vanguard

/datum/xeno_strain/vanguard/apply_strain(mob/living/carbon/xenomorph/praetorian/prae)
. = ..()

prae.speed_modifier += XENO_SPEED_FASTMOD_TIER_3
prae.health_modifier -= XENO_HEALTH_MOD_MED
prae.claw_type = CLAW_TYPE_SHARP
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
behavior_delegate_type = /datum/behavior_delegate/praetorian_warden

/datum/xeno_strain/warden/apply_strain(mob/living/carbon/xenomorph/praetorian/prae)
. = ..()

// Make a 'halftank'
prae.speed_modifier += XENO_SPEED_SLOWMOD_TIER_5
prae.damage_modifier -= XENO_DAMAGE_MOD_SMALL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
behavior_delegate_type = /datum/behavior_delegate/ravager_berserker

/datum/xeno_strain/berserker/apply_strain(mob/living/carbon/xenomorph/ravager/ravager)
. = ..()

ravager.plasma_max = 0
ravager.health_modifier -= XENO_HEALTH_MOD_MED
ravager.armor_modifier += XENO_ARMOR_MOD_VERY_SMALL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
behavior_delegate_type = /datum/behavior_delegate/ravager_hedgehog

/datum/xeno_strain/hedgehog/apply_strain(mob/living/carbon/xenomorph/ravager/ravager)
. = ..()

ravager.plasma_max = 0
ravager.small_explosives_stun = FALSE
ravager.explosivearmor_modifier += XENO_EXPOSIVEARMOR_MOD_SMALL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,12 @@
behavior_delegate_type = /datum/behavior_delegate/runner_acider

/datum/xeno_strain/acider/apply_strain(mob/living/carbon/xenomorph/runner/runner)
. = ..()

runner.speed_modifier += XENO_SPEED_SLOWMOD_TIER_5
runner.armor_modifier += XENO_ARMOR_MOD_MED
runner.health_modifier += XENO_HEALTH_MOD_ACIDER

runner.recalculate_everything()


/datum/behavior_delegate/runner_acider
var/acid_amount = 0

Expand Down
21 changes: 14 additions & 7 deletions code/modules/mob/living/carbon/xenomorph/strains/xeno_strain.dm
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
*
* Returns a bool indicating if the strain was successfully applied.
*/
/datum/xeno_strain/proc/apply_strain(mob/living/carbon/xenomorph/xeno)
SHOULD_CALL_PARENT(TRUE)
/datum/xeno_strain/proc/_add_to_xeno(mob/living/carbon/xenomorph/xeno)
// Override `apply_changes()`, not this! (Unless you know what you're doing.)
SHOULD_NOT_OVERRIDE(TRUE)

xeno.strain = src
register_signals(xeno)

// Update the xeno's actions.
for(var/action_path in actions_to_remove)
Expand All @@ -41,17 +41,24 @@
xeno.behavior_delegate.bound_xeno = xeno
xeno.behavior_delegate.add_to_xeno()

apply_strain()

xeno.update_icons()
xeno.hive.hive_ui.update_xeno_info()

// Give them all the info about the strain.
// Give them all of the info about the strain.
to_chat(xeno, SPAN_XENOANNOUNCE(description))
if(flavor_description)
to_chat(xeno, SPAN_XENOLEADER(flavor_description))
return TRUE

/// TODO: documentation
/datum/xeno_strain/proc/register_signals(mob/living/carbon/xenomorph/xeno)
/**
* Adds any special modifiers/changes from this strain to `xeno`.
*
* Called when the strain is first added to the player.
*/
/datum/xeno_strain/proc/apply_strain(mob/living/carbon/xenomorph/xeno)
// Override with custom behaviour.
return


Expand Down Expand Up @@ -85,7 +92,7 @@

// Create the strain datum and apply it to the xeno.
var/datum/xeno_strain/strain_instance = new chosen_strain()
if(strain_instance.apply_strain(src))
if(strain_instance._add_to_xeno(src))
xeno_jitter(1.5 SECONDS)
// If it applied successfully, add it to the logs.
log_strain("[name] purchased strain '[strain_instance.type]'")
Expand Down

0 comments on commit f4a153a

Please sign in to comment.