Skip to content

Commit

Permalink
other comms stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
BeagleGaming1 committed Nov 30, 2023
1 parent 778e13f commit 889d9ba
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 31 deletions.
39 changes: 23 additions & 16 deletions code/game/machinery/telecomms/presets.dm
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,8 @@ GLOBAL_LIST_EMPTY(all_static_telecomms_towers)
freq_listening = list(COLONY_FREQ)
var/toggle_cooldown = 0

///if xenos can bypass XENO_COMM_ACQUISITION_TIME to corrupt the tower
var/bypass_round_time_requirements = FALSE
/// Tower has been taken over by xenos, is not usable
var/corrupted = FALSE

Expand Down Expand Up @@ -318,50 +320,55 @@ GLOBAL_LIST_EMPTY(all_static_telecomms_towers)
if(!weeded_turf.weeds.parent)
return

if(!istype(weeded_turf.weeds.parent, /obj/effect/alien/weeds/node/pylon/cluster))
if(istypestrict(weeded_turf.weeds.parent, /obj/effect/alien/weeds/node/pylon/core) || !istype(weeded_turf.weeds.parent, /obj/effect/alien/weeds/node/pylon))
return

if(SSticker.mode.is_in_endgame)
return

if(ROUND_TIME < XENO_COMM_ACQUISITION_TIME)
addtimer(CALLBACK(src, PROC_REF(handle_xeno_acquisition), weeded_turf), (XENO_COMM_ACQUISITION_TIME - ROUND_TIME))
return
if(!bypass_round_time_requirements)
if(ROUND_TIME < XENO_COMM_ACQUISITION_TIME)
addtimer(CALLBACK(src, PROC_REF(handle_xeno_acquisition), weeded_turf), (XENO_COMM_ACQUISITION_TIME - ROUND_TIME))
return

if(!COOLDOWN_FINISHED(src, corruption_delay))
addtimer(CALLBACK(src, PROC_REF(handle_xeno_acquisition), weeded_turf), (COOLDOWN_TIMELEFT(src, corruption_delay)))
return

var/obj/effect/alien/weeds/node/pylon/cluster/parent_node = weeded_turf.weeds.parent
var/obj/effect/alien/weeds/node/pylon/parent_node = weeded_turf.weeds.parent

var/obj/effect/alien/resin/special/cluster/cluster_parent = parent_node.resin_parent
var/obj/effect/alien/resin/special/pylon_node_parent = parent_node.resin_parent

var/list/held_children_weeds = parent_node.children
var/cluster_loc = cluster_parent.loc
var/linked_hive = cluster_parent.linked_hive
var/cluster_loc = pylon_node_parent.loc
var/linked_hive = pylon_node_parent.linked_hive

parent_node.children = list()

qdel(cluster_parent)

var/obj/effect/alien/resin/special/pylon/endgame/new_pylon = new(cluster_loc, linked_hive)
new_pylon.node.children = held_children_weeds
var/obj/effect/alien/resin/special/pylon/endgame/pylon
if(istypestrict(parent_node.resin_parent, /obj/effect/alien/resin/special/pylon/endgame)) //if its already a pylon, just add the new tower
pylon = parent_node.resin_parent
else
qdel(pylon_node_parent)
pylon = new(cluster_loc, linked_hive)
pylon.node.children = held_children_weeds

for(var/obj/effect/alien/weeds/weed in new_pylon.node.children)
weed.parent = new_pylon.node
for(var/obj/effect/alien/weeds/weed in pylon.node.children)
weed.parent = pylon.node
weed.spread_on_semiweedable = TRUE
weed.weed_expand()

RegisterSignal(new_pylon, COMSIG_PARENT_QDELETING, PROC_REF(uncorrupt))
RegisterSignal(pylon, COMSIG_PARENT_QDELETING, PROC_REF(uncorrupt))

corrupted = TRUE
pylon.connected_towers += src

corruption_image = image(icon, icon_state = "resin_growing")

flick_overlay(src, corruption_image, (2 SECONDS))
addtimer(CALLBACK(src, PROC_REF(switch_to_idle_corruption)), (2 SECONDS))

new_pylon.comms_relay_connection()
pylon.comms_relay_connection(src)

/// Handles removing corruption effects from the comms relay
/obj/structure/machinery/telecomms/relay/preset/tower/mapcomms/proc/uncorrupt(datum/deleting_datum)
Expand Down
30 changes: 17 additions & 13 deletions code/modules/cm_aliens/structures/special/pylon_core.dm
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@

/obj/effect/alien/resin/special/pylon/endgame
cover_range = WEED_RANGE_CORE
var/list/connected_towers = list()
var/activated = FALSE

/obj/effect/alien/resin/special/pylon/endgame/Destroy()
Expand All @@ -148,33 +149,36 @@
if(hijack_delete)
return ..()

marine_announcement("ALERT.\n\nEnergy build up around communication relay at [get_area(src)] halted.", "[MAIN_AI_SYSTEM] Biological Scanner")
for(var/tower in connected_towers)
marine_announcement("ALERT.\n\nEnergy build up around communication relay at [get_area(tower)] halted.", "[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
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 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)
if(checked_hive == linked_hive)
xeno_announcement(SPAN_XENOANNOUNCE("We have lost our control of the tall's communication relay at [get_area(tower)]."), hivenumber, XENO_GENERAL_ANNOUNCE)
else
xeno_announcement(SPAN_XENOANNOUNCE("Another hive has lost control of the tall's communication relay at [get_area(tower)]."), hivenumber, XENO_GENERAL_ANNOUNCE)

connected_towers -= tower

return ..()

/// Checks if all comms towers are connected and then starts end game content on all pylons if they are
/obj/effect/alien/resin/special/pylon/endgame/proc/comms_relay_connection()
marine_announcement("ALERT.\n\nIrregular build up of energy around communication relays at [get_area(src)], biological hazard detected.\n\nDANGER: Hazard is generating new xenomorph entities, advise urgent termination of hazard by ground forces.", "[MAIN_AI_SYSTEM] Biological Scanner")
/obj/effect/alien/resin/special/pylon/endgame/proc/comms_relay_connection(corrupted_tower)
marine_announcement("ALERT.\n\nIrregular build up of energy around communication relays at [get_area(corrupted_tower)], biological hazard detected.\n\nDANGER: Hazard is generating new xenomorph entities, advise urgent 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 have harnessed the tall's communication relay at [get_area(src)].\n\nWe will now grow more of our number from this pylon. Hold it!"), hivenumber, XENO_GENERAL_ANNOUNCE)
xeno_announcement(SPAN_XENOANNOUNCE("We have harnessed the tall's communication relay at [get_area(corrupted_tower)].\n\nWe will now grow more of our number from this pylon. Hold it!"), hivenumber, XENO_GENERAL_ANNOUNCE)
else
xeno_announcement(SPAN_XENOANNOUNCE("Another hive has harnessed the tall's communication relay at [get_area(src)].[linked_hive.faction_is_ally(checked_hive.name) ? "" : " Stop them!"]"), hivenumber, XENO_GENERAL_ANNOUNCE)
xeno_announcement(SPAN_XENOANNOUNCE("Another hive has harnessed the tall's communication relay at [get_area(corrupted_tower)].[linked_hive.faction_is_ally(checked_hive.name) ? "" : " Stop them!"]"), hivenumber, XENO_GENERAL_ANNOUNCE)

activated = TRUE
addtimer(CALLBACK(src, PROC_REF(give_larva)), XENO_PYLON_ACTIVATION_COOLDOWN, TIMER_UNIQUE|TIMER_OVERRIDE|TIMER_LOOP|TIMER_DELETE_ME)
Expand Down
4 changes: 2 additions & 2 deletions maps/map_files/Ice_Colony_v1/Ice_Colony_v1.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -3208,7 +3208,7 @@
},
/area/ice_colony/surface/clinic/storage)
"eno" = (
/turf/closed/wall/r_wall/unmeltable,
/turf/closed/wall/r_wall,
/area/ice_colony/exterior/surface/valley/southeast/apc_support)
"eob" = (
/turf/open/floor/plating/icefloor{
Expand Down Expand Up @@ -8081,7 +8081,7 @@
},
/area/ice_colony/underground/research/work)
"ldy" = (
/turf/closed/wall/r_wall/unmeltable,
/turf/closed/wall/r_wall,
/area/ice_colony/exterior/surface/valley/northeast/apc_support)
"lev" = (
/obj/structure/machinery/vending/coffee,
Expand Down

0 comments on commit 889d9ba

Please sign in to comment.