Files
f8511ea227 You can install B.O.R.I.S. in circuits with MMI components (+other MMI component changes) (#92002)
## About The Pull Request

This PR adds the ability to install a B.O.R.I.S. in a circuit that
contains an MMI component. These circuits can then be remotely connected
to by an AI by clicking on them or anything they are inside of. To
indicate that a circuit allows remote AI connection, an indicator is
given to the circuit and anything containing it.

Additionally:
- Refactors the MMI component to use `item_interaction`, since it was
pertinent.
- You cannot insert an MMI/B.O.R.I.S. into a locked circuit.
- You can no longer hotswap MMIs/B.O.R.I.S.es - you must manually eject
the inserted one.

Let me know what changelog labels I should use for the hotswap removal
and the prevention of insertion into locked circuits.

## Why It's Good For The Game

If you can put an MMI or posibrain in a circuit, why not allow an AI to
use it using a B.O.R.I.S.?

## Changelog

🆑
add: B.O.R.I.S.es can be installed inside of integrated circuits with
MMI components, allowing an AI to remotely interface with them the same
way an MMI or posibrain could.
refactor: The MMI component now uses item interaction behavior for
inserting MMIs/B.O.R.I.S.es.
/🆑

---------

Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
2025-09-03 23:25:50 -07:00

146 lines
4.8 KiB
Plaintext

/obj/machinery/computer/aifixer
name = "\improper AI system integrity restorer"
desc = "Used with intelliCards containing nonfunctional AIs to restore them to working order."
req_access = list(ACCESS_CAPTAIN, ACCESS_ROBOTICS, ACCESS_COMMAND)
circuit = /obj/item/circuitboard/computer/aifixer
icon_keyboard = "tech_key"
icon_screen = "ai-fixer"
light_color = LIGHT_COLOR_PINK
/// Variable containing transferred AI
var/mob/living/silicon/ai/occupier
/// Variable dictating if we are in the process of restoring the occupier AI
var/restoring = FALSE
/obj/machinery/computer/aifixer/screwdriver_act(mob/living/user, obj/item/I)
if(occupier)
if(machine_stat & (NOPOWER|BROKEN))
to_chat(user, span_warning("The screws on [name]'s screen won't budge."))
else
to_chat(user, span_warning("The screws on [name]'s screen won't budge and it emits a warning beep."))
else
return ..()
/obj/machinery/computer/aifixer/ui_interact(mob/user, datum/tgui/ui)
. = ..()
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "AiRestorer", name)
ui.open()
/obj/machinery/computer/aifixer/ui_data(mob/user)
var/list/data = list()
data["ejectable"] = FALSE
data["AI_present"] = FALSE
data["error"] = null
if(!occupier)
data["error"] = "Please transfer an AI unit."
else
data["AI_present"] = TRUE
data["name"] = occupier.name
data["restoring"] = restoring
data["health"] = (occupier.health + 100) / 2
data["isDead"] = occupier.stat == DEAD
data["laws"] = occupier.laws.get_law_list(include_zeroth = TRUE, render_html = FALSE)
return data
/obj/machinery/computer/aifixer/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
. = ..()
if(.)
return
if(!occupier)
restoring = FALSE
switch(action)
if("PRG_beginReconstruction")
if(occupier?.health < 100)
to_chat(usr, span_notice("Reconstruction in progress. This will take several minutes."))
playsound(src, 'sound/machines/terminal/terminal_prompt_confirm.ogg', 25, FALSE)
restoring = TRUE
occupier.notify_revival("Your core files are being restored!", source = src)
. = TRUE
/obj/machinery/computer/aifixer/proc/Fix()
if(!use_energy(active_power_usage, force = TRUE))
say("Not enough energy. Restoration cancelled.")
return FALSE
var/need_mob_update = FALSE
need_mob_update += occupier.adjustOxyLoss(-5, updating_health = FALSE)
need_mob_update += occupier.adjustFireLoss(-5, updating_health = FALSE)
need_mob_update += occupier.adjustBruteLoss(-5, updating_health = FALSE)
if(need_mob_update)
occupier.updatehealth()
if(occupier.health >= 0 && occupier.stat == DEAD)
occupier.revive()
if(!occupier.radio_enabled)
occupier.radio_enabled = TRUE
to_chat(occupier, span_warning("Your Subspace Transceiver has been enabled!"))
return occupier.health < 100
/obj/machinery/computer/aifixer/process()
if(..())
if(restoring)
var/oldstat = occupier.stat
restoring = Fix()
if(oldstat != occupier.stat)
update_appearance()
/obj/machinery/computer/aifixer/update_overlays()
. = ..()
if(machine_stat & (NOPOWER|BROKEN))
return
if(restoring)
. += "ai-fixer-on"
if(!occupier)
. += "ai-fixer-empty"
return
switch(occupier.stat)
if(CONSCIOUS)
. += "ai-fixer-full"
if(UNCONSCIOUS, HARD_CRIT)
. += "ai-fixer-404"
/obj/machinery/computer/aifixer/transfer_ai(interaction, mob/user, mob/living/silicon/ai/AI, obj/item/aicard/card)
if(!..())
return
//Downloading AI from card to terminal.
if(interaction == AI_TRANS_FROM_CARD)
if(machine_stat & (NOPOWER|BROKEN))
to_chat(user, span_alert("[src] is offline and cannot take an AI at this time."))
return
AI.forceMove(src)
occupier = AI
AI.set_control_disabled(TRUE)
AI.radio_enabled = FALSE
to_chat(AI, span_alert("You have been uploaded to a stationary terminal. Sadly, there is no remote access from here."))
to_chat(user, "[span_notice("Transfer successful")]: [AI.name] ([rand(1000,9999)].exe) installed and executed successfully. Local copy has been removed.")
card.AI = null
update_appearance()
else //Uploading AI from terminal to card
if(occupier && !restoring)
to_chat(occupier, span_notice("You have been downloaded to a mobile storage device. Still no remote access."))
to_chat(user, "[span_notice("Transfer successful")]: [occupier.name] ([rand(1000,9999)].exe) removed from host terminal and stored within local memory.")
occupier.forceMove(card)
card.AI = occupier
occupier = null
update_appearance()
else if (restoring)
to_chat(user, span_alert("ERROR: Reconstruction in progress."))
else if (!occupier)
to_chat(user, span_alert("ERROR: Unable to locate artificial intelligence."))
/obj/machinery/computer/aifixer/Destroy()
if(occupier)
QDEL_NULL(occupier)
return ..()
/obj/machinery/computer/aifixer/on_deconstruction(disassembled)
if(occupier)
QDEL_NULL(occupier)