Skip to content

Commit

Permalink
Mech-dominating Malf AIs will have their Doomsday timer stopped when …
Browse files Browse the repository at this point in the history
…their deactivated core is destroyed (tgstation#88528)
  • Loading branch information
Rhials authored Dec 29, 2024
1 parent c588e8f commit e8962b0
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 9 deletions.
15 changes: 14 additions & 1 deletion code/game/objects/structures/ai_core.dm
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,13 @@
icon_state = "ai-empty"
anchored = TRUE
state = AI_READY_CORE
var/mob/living/silicon/ai/attached_ai

/obj/structure/ai_core/deactivated/Initialize(mapload, skip_mmi_creation = FALSE, posibrain = FALSE)
/obj/structure/ai_core/deactivated/Initialize(mapload, skip_mmi_creation = FALSE, posibrain = FALSE, linked_ai)
. = ..()
circuit = new(src)
if(linked_ai)
attached_ai = linked_ai
if(skip_mmi_creation)
return
if(posibrain)
Expand All @@ -90,6 +93,16 @@
core_mmi.brain = new(core_mmi)
core_mmi.update_appearance()

/obj/structure/ai_core/deactivated/Destroy()
if(attached_ai)
attached_ai.linked_core = null
attached_ai = null
. = ..()

/obj/structure/ai_core/deactivated/proc/disable_doomsday(datum/source)
SIGNAL_HANDLER
attached_ai.ShutOffDoomsdayDevice()

/obj/structure/ai_core/latejoin_inactive
name = "networked AI core"
desc = "This AI core is connected by bluespace transmitters to NTNet, allowing for an AI personality to be downloaded to it on the fly mid-shift."
Expand Down
3 changes: 1 addition & 2 deletions code/modules/antagonists/blob/blobstrains/_blobstrain.dm
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ GLOBAL_LIST_INIT(valid_blobstrains, subtypesof(/datum/blobstrain) - list(/datum/
var/message_living = null
/// Stores world.time to figure out when to next give resources
var/resource_delay = 0
/// For blob-mobs and extinguishing-based effects
var/fire_based = FALSE
///The blob overmind eye mob used to control the spread
var/mob/eye/blob/overmind
/// The amount of health regenned on core_process
var/base_core_regen = BLOB_CORE_HP_REGEN
Expand Down
1 change: 0 additions & 1 deletion code/modules/antagonists/blob/blobstrains/blazing_oil.dm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
message = "The blob splashes you with burning oil"
message_living = ", and you feel your skin char and melt"
reagent = /datum/reagent/blob/blazing_oil
fire_based = TRUE

/datum/blobstrain/reagent/blazing_oil/extinguish_reaction(obj/structure/blob/B)
B.take_damage(4.5, BURN, ENERGY)
Expand Down
6 changes: 3 additions & 3 deletions code/modules/antagonists/malf_ai/malf_ai_modules.dm
Original file line number Diff line number Diff line change
Expand Up @@ -904,12 +904,12 @@ GLOBAL_LIST_INIT(malf_modules, subtypesof(/datum/ai_module/malf))
/datum/ai_module/malf/upgrade/mecha_domination
name = "Unlock Mech Domination"
description = "Allows you to hack into a mech's onboard computer, shunting all processes into it and ejecting any occupants. \
Do not allow the mech to leave the station's vicinity or allow it to be destroyed. \
Upgrade is done immediately upon purchase."
Upgrade is done immediately upon purchase. Do not allow the mech to leave the station's vicinity or allow it to be destroyed. \
If your core is destroyed, you will be lose connection with the Doomsday Device and the countdown will cease."
cost = 30
upgrade = TRUE
unlock_text = span_notice("Virus package compiled. Select a target mech at any time. <b>You must remain on the station at all times. \
Loss of signal will result in total system lockout.</b>")
Loss of signal will result in total system lockout. If your inactive core is destroyed, you will be lose connection with the Doomsday Device and the countdown will cease.</b>")
unlock_sound = 'sound/vehicles/mecha/nominal.ogg'

/datum/ai_module/malf/upgrade/mecha_domination/upgrade(mob/living/silicon/ai/AI)
Expand Down
5 changes: 4 additions & 1 deletion code/modules/antagonists/nukeop/equipment/pinpointer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@
for(var/V in GLOB.ai_list)
var/mob/living/silicon/ai/A = V
if(A.nuking)
target = A
if(A.linked_core)
target = A.linked_core
else
target = A
for(var/obj/machinery/power/apc/apc as anything in SSmachines.get_machines_by_type_and_subtypes(/obj/machinery/power/apc))
if(apc.malfhack && apc.occupier)
target = apc
Expand Down
4 changes: 3 additions & 1 deletion code/modules/vehicles/mecha/mecha_ai_interaction.dm
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@
return

if(AI_MECH_HACK) //Called by AIs on the mech
AI.linked_core = new /obj/structure/ai_core/deactivated(AI.loc)
var/obj/structure/ai_core/deactivated/deactivated_core = new(AI.loc, FALSE, FALSE, AI)
AI.linked_core = deactivated_core
AI.linked_core.RegisterSignal(deactivated_core, COMSIG_ATOM_DESTRUCTION, TYPE_PROC_REF(/obj/structure/ai_core/deactivated, disable_doomsday)) //Protect that core! The structure goes bye-bye when we re-shunt back in so no need for cleanup.
AI.linked_core.remote_ai = AI
if(AI.can_dominate_mechs && LAZYLEN(occupants)) //Oh, I am sorry, were you using that?
to_chat(AI, span_warning("Occupants detected! Forced ejection initiated!"))
Expand Down

0 comments on commit e8962b0

Please sign in to comment.