Skip to content

Commit

Permalink
adds pylon integration
Browse files Browse the repository at this point in the history
  • Loading branch information
GrrrKitten committed Mar 22, 2024
1 parent 3b6470c commit 9506eb6
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 5 deletions.
6 changes: 6 additions & 0 deletions code/__DEFINES/xeno.dm
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,12 @@
/// The time until you can re-corrupt a comms relay after the last pylon was destroyed
#define XENO_PYLON_DESTRUCTION_DELAY (5 MINUTES)

/// The time it takes for the double pylon bonus to be activated
#define XENO_DOUBLE_PYLON_BONUS_STARTUP_COOLDOWN (10 MINUTES)

/// The time it takes for the double pylon bonus to be upgraded
#define XENO_DOUBLE_PYLON_BONUS_UPGRADE_COOLDOWN (7.5 MINUTES)

/// Evolution boost during hijack
#define XENO_HIJACK_EVILUTION_BUFF 10

Expand Down
4 changes: 2 additions & 2 deletions code/controllers/subsystem/x_evolution.dm
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ SUBSYSTEM_DEF(xevolution)
continue

if(!HS.dynamic_evolution)
boost_power[HS.hivenumber] = HS.evolution_rate + HS.evolution_bonus
boost_power[HS.hivenumber] = HS.evolution_rate + HS.evolution_bonus + (HS.double_pylon_bonus * 0.5)
HS.hive_ui.update_burrowed_larva()
continue

Expand All @@ -49,7 +49,7 @@ SUBSYSTEM_DEF(xevolution)

boost_power_new = clamp(boost_power_new, BOOST_POWER_MIN, BOOST_POWER_MAX)

boost_power_new += HS.evolution_bonus
boost_power_new += HS.evolution_bonus + (HS.double_pylon_bonus * 0.5)
if(!force_boost_power)
boost_power[HS.hivenumber] = boost_power_new

Expand Down
54 changes: 52 additions & 2 deletions code/modules/cm_aliens/structures/special/pylon_core.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#define PYLON_REPAIR_TIME (4 SECONDS)
#define PYLON_WEEDS_REGROWTH_TIME (15 SECONDS)
#define DOUBLE_PYLON_BONUS_MAX 3

//Hive Pylon - Remote building location for other structures, generates strong weeds

Expand Down Expand Up @@ -49,8 +50,8 @@

/obj/effect/alien/resin/special/pylon/process(delta_time)
if(lesser_drone_spawns < lesser_drone_spawn_limit)
// One every 10 seconds while on ovi, one every 120-ish seconds while off ovi
lesser_drone_spawns = min(lesser_drone_spawns + ((linked_hive.living_xeno_queen?.ovipositor ? 0.1 : 0.008) * delta_time), lesser_drone_spawn_limit)
// One every 10 seconds while on ovi, one every 120-ish seconds while off ovi, every double pylon bonus takes off ~30 seconds
lesser_drone_spawns = min(lesser_drone_spawns + (linked_hive.living_xeno_queen?.ovipositor ? 0.1 : (0.008 + (linked_hive.double_pylon_bonus * 0.03)) * delta_time), lesser_drone_spawn_limit)

/obj/effect/alien/resin/special/pylon/attack_alien(mob/living/carbon/xenomorph/M)
if(isxeno_builder(M) && M.a_intent == INTENT_HELP && M.hivenumber == linked_hive.hivenumber)
Expand Down Expand Up @@ -159,6 +160,7 @@
xeno_announcement(SPAN_XENOANNOUNCE("We have lost our control of the tall's communication relay at [get_area(src)]."), hivenumber, XENO_GENERAL_ANNOUNCE)
else
xeno_announcement(SPAN_XENOANNOUNCE("Another hive has lost control of the tall's communication relay at [get_area(src)]."), hivenumber, XENO_GENERAL_ANNOUNCE)
double_pylon(FALSE)
linked_hive.hive_ui.update_pylon_status()
return ..()

Expand All @@ -178,7 +180,11 @@

activated = TRUE
linked_hive.check_if_hit_larva_from_pylon_limit()
linked_hive.hive_ui.update_pylon_status()
addtimer(CALLBACK(src, PROC_REF(give_larva)), XENO_PYLON_ACTIVATION_COOLDOWN, TIMER_UNIQUE|TIMER_OVERRIDE|TIMER_LOOP|TIMER_DELETE_ME)
if(linked_hive.get_structure_count(XENO_STRUCTURE_PYLON) >= 2)
addtimer(CALLBACK(src, PROC_REF(double_pylon)), XENO_DOUBLE_PYLON_BONUS_STARTUP_COOLDOWN, TIMER_UNIQUE|TIMER_OVERRIDE|TIMER_DELETE_ME)


/// Looped proc via timer to give larva after time
/obj/effect/alien/resin/special/pylon/endgame/proc/give_larva()
Expand All @@ -195,6 +201,50 @@
linked_hive.convert_partial_larva_to_full_larva()
linked_hive.hive_ui.update_burrowed_larva()

/// Handles the both adding and removing double_pylon_bonus
// After 10 minutes of holding both pylons, it gets upgraded to stage 1, with stages being upgraded every 7.5 minutes until it maxes at stage 3
// Every stage gives a bonus to lesser generation time, larva generation, and evilution
/obj/effect/alien/resin/special/pylon/endgame/proc/double_pylon(double_pylon_check)
if(double_pylon_check == FALSE || linked_hive.get_structure_count(XENO_STRUCTURE_PYLON) < 2)
linked_hive.double_pylon_bonus = 0
return

if(linked_hive.double_pylon_bonus < 2)
linked_hive.double_pylon_bonus++
linked_hive.hive_ui.update_pylon_status()

marine_announcement("ALERT.\n\nEnergy readings have spiked at the communication relays! \n\nDANGER: Biological Hazards have increased their utilization the relays, advising immediate termination of hazard by ground forces.", "[MAIN_AI_SYSTEM] Biological Scanner")

for(var/hivenumber in GLOB.hive_datum)
var/datum/hive_status/checked_hive = GLOB.hive_datum[hivenumber]
if(!length(checked_hive.totalXenos))
continue

if(checked_hive == linked_hive)
xeno_announcement(SPAN_XENOANNOUNCE("Our grip over the communication relays has tightened, continue holding them!"), hivenumber, XENO_GENERAL_ANNOUNCE)
else
xeno_announcement(SPAN_XENOANNOUNCE("Another hive has tightened their grip over the tall's communication relays.[linked_hive.faction_is_ally(checked_hive.name) ? "" : " Stop them!"]"), hivenumber, XENO_GENERAL_ANNOUNCE)

addtimer(CALLBACK(src, PROC_REF(double_pylon)), XENO_DOUBLE_PYLON_BONUS_UPGRADE_COOLDOWN, TIMER_UNIQUE|TIMER_OVERRIDE|TIMER_DELETE_ME) // in 7.5 minutes it will call again to upgrade
return

if(linked_hive.double_pylon_bonus == DOUBLE_PYLON_BONUS_MAX - 1)
linked_hive.double_pylon_bonus++
linked_hive.hive_ui.update_pylon_status()

marine_announcement("ALERT.\n\nEnergy readings have spiked at the communication relays! \n\nDANGER: Biological Hazards have now fully utilized the relays, advising immediate termination of hazard by ground forces.", "[MAIN_AI_SYSTEM] Biological Scanner")

for(var/hivenumber in GLOB.hive_datum)
var/datum/hive_status/checked_hive = GLOB.hive_datum[hivenumber]
if(!length(checked_hive.totalXenos))
continue

if(checked_hive == linked_hive)
xeno_announcement(SPAN_XENOANNOUNCE("We are now fully utilizing the communication relays, continue holding them!"), hivenumber, XENO_GENERAL_ANNOUNCE)
else
xeno_announcement(SPAN_XENOANNOUNCE("Another hive is now fully utilizing the tall's communication relays.[linked_hive.faction_is_ally(checked_hive.name) ? "" : " Stop them!"]"), hivenumber, XENO_GENERAL_ANNOUNCE)
return

//Hive Core - Generates strong weeds, supports other buildings
/obj/effect/alien/resin/special/pylon/core
name = XENO_STRUCTURE_CORE
Expand Down
5 changes: 4 additions & 1 deletion code/modules/mob/living/carbon/xenomorph/hive_status.dm
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,9 @@
/// If hit limit of larva from pylons
var/hit_larva_pylon_limit = FALSE

/// Bonus from having both pylons held for a time
var/double_pylon_bonus = 0

var/see_humans_on_tacmap = FALSE

var/list/hive_inherant_traits
Expand Down Expand Up @@ -951,7 +954,7 @@
var/turf/turf = get_turf(current_human)
if(is_ground_level(turf?.z))
groundside_humans_weighted_count += GLOB.RoleAuthority.calculate_role_weight(job)
hit_larva_pylon_limit = (get_real_total_xeno_count() + stored_larva) > (groundside_humans_weighted_count * ENDGAME_LARVA_CAP_MULTIPLIER)
hit_larva_pylon_limit = (get_real_total_xeno_count() + stored_larva) > (groundside_humans_weighted_count * ENDGAME_LARVA_CAP_MULTIPLIER + (0.03 * double_pylon_bonus))
hive_ui.update_pylon_status()
return hit_larva_pylon_limit

Expand Down
2 changes: 2 additions & 0 deletions code/modules/mob/living/carbon/xenomorph/hive_status_ui.dm
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@
pylon_status = "The hive's power has surpassed what the pylons can provide."
else
pylon_status = "Pylons are strengthening our numbers!"
if(assoc_hive.get_structure_count(XENO_STRUCTURE_PYLON) >= 2)
pylon_status += " Pylon Integration: [assoc_hive.double_pylon_bonus]/[DOUBLE_PYLON_BONUS_MAX]"
if(send_update)
SStgui.update_uis(src)

Expand Down

0 comments on commit 9506eb6

Please sign in to comment.