Files
CHOMPStation2/code/game/machinery/computer/aifixer.dm
ShadowLarkens 951f37d2e3 TGUI Engineering: Squashed Edition (Commits Below)
TGUI APCs

 TGUI vending machines

 Fix AI default_tgui_interaction

 TGUI Airlocks

 Station & Atmospheric Alert TGUI + Misc NTOS-TGUI Fixes

 TGUI Air Alarms & Central Atmospheric Control

 Airlock TGUI

 TG... got rid of UI for fire alarm. í´·

 TGUI Gas Heating/Cooling System

 TGUI Gas Pump & Passive Gate + Fixes

 TGUI Omni Atmospherics

 TGUI Pipe Dispensers & RPD

 TGUI IntelliCore & Vending Fix

 TGUI Handheld Tanks

 TGUI Portable Pump & Scrubber

 TGUI Tank Dispenser & Canisters

 TGUI Radios

 TGUI SMES & Air Alarm adjustment

 Tweak vending machine interfaces a tad

 TGUI Algae Farm

 TGUI general_air_control

 - Distro & Waste Console
 - Riot Control Console
 - Atmos Intake Console
 - Engine Cooling Console

 TGUI Heavy Scrubber Control (and body scanner fix)

 TGUI trinary devices & shutoff monitor

 TGUI Telecomms Log Browser

 TGUI Telecomms Machine Browser

 TGUI Spaceheater Internal Panel

 TGUI Gravity Generator

 TGUI Id Cards & Fix ID Card Images

 TGUI Id Card Redesign

 TGUI Turbolift

 TGUI Suit Cycler & Suit Storage Unit & Vending Fixes

 TGUI Power Monitor

 TGUI Signalers

 TGUI Employment Records

 TGUI Drone Console

 TGUI RIGSuits

 TGUI PA & PACMAN, and Margin Fix

 TGUI Solar Panels & Fix Power Monitor

 Adjust TGUI modules & their interaction with NTOS

 TGUI RCON

 TGUI Message Monitor

 Bump TGUI line limit to 120 (ParadiseSS13/Paradise#14002)

 TGUI Exonet & NTNet Relay

 TGUI Telecomms Multitool Menu

 TGUI Shield Capacitor & Shield Generator

 TGUI Supermatter-everything & Refactors
2020-08-09 04:46:31 -07:00

135 lines
4.3 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_one_access = list(access_robotics, access_heads)
circuit = /obj/item/weapon/circuitboard/aifixer
icon_keyboard = "tech_key"
icon_screen = "ai-fixer"
light_color = LIGHT_COLOR_PINK
active_power_usage = 1000
/// 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/attackby(obj/item/I, mob/living/user)
if(I.is_screwdriver())
if(occupier)
if(stat & (NOPOWER|BROKEN))
to_chat(user, "<span class='warning'>The screws on [name]'s screen won't budge.</span>")
else
to_chat(user, "<span class='warning'>The screws on [name]'s screen won't budge and it emits a warning beep.</span>")
return
if(istype(I, /obj/item/device/aicard))
if(stat & (NOPOWER|BROKEN))
to_chat(user, "<span class='warning'>This terminal isn't functioning right now.</span>")
return
if(restoring)
to_chat(user, "<span class='danger'>Terminal is busy restoring [occupier] right now.</span>")
return
var/obj/item/device/aicard/card = I
if(occupier)
if(card.grab_ai(occupier, user))
occupier = null
else if(card.carded_ai)
var/mob/living/silicon/ai/new_occupant = card.carded_ai
to_chat(new_occupant, "<span class='notice'>You have been transferred into a stationary terminal. Sadly there is no remote access from here.</span>")
to_chat(user, "<span class='notice'>Transfer Successful:</span> [new_occupant] placed within stationary terminal.")
new_occupant.forceMove(src)
new_occupant.cancel_camera()
new_occupant.control_disabled = TRUE
occupier = new_occupant
card.clear()
update_icon()
else
to_chat(user, "<span class='notice'>There is no AI loaded onto this computer, and no AI loaded onto [I]. What exactly are you trying to do here?</span>")
return ..()
/obj/machinery/computer/aifixer/attack_hand(mob/user)
if(stat & (NOPOWER|BROKEN))
return
tgui_interact(user)
/obj/machinery/computer/aifixer/tgui_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/tgui_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
var/list/laws = list()
for(var/datum/ai_law/law in occupier.laws.all_laws())
laws += "[law.get_index()]: [law.law]"
data["laws"] = laws
return data
/obj/machinery/computer/aifixer/tgui_act(action, params)
if(..())
return TRUE
if(!occupier)
restoring = FALSE
if(action)
playsound(src, "terminal_type", 50, 1)
switch(action)
if("PRG_beginReconstruction")
if(occupier?.health < 100)
to_chat(usr, "<span class='notice'>Reconstruction in progress. This will take several minutes.</span>")
playsound(src, 'sound/machines/terminal_prompt_confirm.ogg', 25, FALSE)
restoring = TRUE
var/mob/observer/dead/ghost = occupier.get_ghost()
if(ghost)
ghost.notify_revive("Your core files are being restored!", source = src)
. = TRUE
/obj/machinery/computer/aifixer/proc/Fix()
use_power(active_power_usage)
occupier.adjustOxyLoss(-5, 0, FALSE)
occupier.adjustFireLoss(-5, 0, FALSE)
occupier.adjustBruteLoss(-5, 0)
if(occupier.health >= 0 && occupier.stat == DEAD)
occupier.revive()
return occupier.health < 100
/obj/machinery/computer/aifixer/process()
if(..())
if(restoring)
var/oldstat = occupier.stat
restoring = Fix()
if(oldstat != occupier.stat)
update_icon()
/obj/machinery/computer/aifixer/update_icon()
. = ..()
if(stat & (NOPOWER|BROKEN))
return
if(restoring)
. += "ai-fixer-on"
if (occupier)
switch (occupier.stat)
if (CONSCIOUS)
. += "ai-fixer-full"
if (UNCONSCIOUS)
. += "ai-fixer-404"
else
. += "ai-fixer-empty"