12/21 modernizations from TG live (#103)
* sync (#3) * shuttle auto call * Merge /vore into /master (#39) * progress * Compile errors fixed No idea if it's test worthy tho as conflicts with race overhaul and narky removal. * Update admins.txt * efforts continue Fuck grab code, seriously * grab code is cancer * Execute the Narkism Do not hesitate. Show no mercy. * holy shit grab code is awful * have I bitched about grab code My bitching, let me show you it * código de agarre es una mierda No really it is * yeah I don't even know anymore. * Lolnope. Fuck grab code * I'm not even sure what to fix anymore * Self eating is not an acceptable fate * Taste the void, son. * My code doesn't pass it's own sanity check. Maybe it's a sign of things to come. * uncommented and notes * It Works and I Don't Know Why (#38) * shuttle auto call * it works and I don't know why * Subsystem 12/21 Most Recent TG subsystem folder * globalvars 12/21 Tossed out the flavor_misc and parallax files * Onclick 12/21 as well as .dme updates * _defines 12/21 ommited old _MC.dm * _HELPERS 12/21 Preserved snowflake placement of furry sprites * _defeines/genetics reapplied narkism holdover for snowflake races. * Oops forgot mutant colors * modules porting 12/21 + Sounds/icons Admin, Client and most of mob life files ommitted * enviroment file * Admin optimizations ahelp log system kept * Mob ports 12/21 Flavor text preserved * datums ported 12/21 * Game ported 12/21 * batch of duplicate fixes/dogborg work Dogborgs need to be modernized to refractored borg standards. * moar fixes * Maps and futher compile fixes
This commit is contained in:
@@ -0,0 +1,125 @@
|
||||
|
||||
|
||||
/datum/computer_file/program/aidiag
|
||||
filename = "aidiag"
|
||||
filedesc = "AI Maintenance Utility"
|
||||
program_icon_state = "generic"
|
||||
extended_desc = "This program is capable of reconstructing damaged AI systems. Requires direct AI connection via intellicard slot."
|
||||
size = 12
|
||||
requires_ntnet = 0
|
||||
usage_flags = PROGRAM_CONSOLE
|
||||
transfer_access = access_heads
|
||||
available_on_ntnet = 1
|
||||
var/restoring = FALSE
|
||||
|
||||
/datum/computer_file/program/aidiag/proc/get_ai(cardcheck)
|
||||
|
||||
var/obj/item/weapon/computer_hardware/ai_slot/ai_slot
|
||||
|
||||
if(computer)
|
||||
ai_slot = computer.all_components[MC_AI]
|
||||
|
||||
if(computer && ai_slot && ai_slot.check_functionality())
|
||||
if(cardcheck == 1)
|
||||
return ai_slot
|
||||
if(ai_slot.enabled && ai_slot.stored_card)
|
||||
if(cardcheck == 2)
|
||||
return ai_slot.stored_card
|
||||
if(ai_slot.stored_card.AI)
|
||||
return ai_slot.stored_card.AI
|
||||
|
||||
return null
|
||||
|
||||
/datum/computer_file/program/aidiag/ui_act(action, params)
|
||||
if(..())
|
||||
return TRUE
|
||||
|
||||
var/mob/living/silicon/ai/A = get_ai()
|
||||
if(!A)
|
||||
restoring = FALSE
|
||||
|
||||
switch(action)
|
||||
if("PRG_beginReconstruction")
|
||||
if(A && A.health < 100)
|
||||
restoring = TRUE
|
||||
return TRUE
|
||||
if("PRG_eject")
|
||||
if(computer.all_components[MC_AI])
|
||||
var/obj/item/weapon/computer_hardware/ai_slot/ai_slot = computer.all_components[MC_AI]
|
||||
if(ai_slot && ai_slot.stored_card)
|
||||
ai_slot.try_eject(0,usr)
|
||||
return TRUE
|
||||
|
||||
/datum/computer_file/program/aidiag/process_tick()
|
||||
..()
|
||||
if(!restoring) //Put the check here so we don't check for an ai all the time
|
||||
return
|
||||
var/obj/item/device/aicard/cardhold = get_ai(2)
|
||||
|
||||
var/obj/item/weapon/computer_hardware/ai_slot/ai_slot = get_ai(1)
|
||||
|
||||
|
||||
var/mob/living/silicon/ai/A = get_ai()
|
||||
if(!A || !cardhold)
|
||||
restoring = FALSE // If the AI was removed, stop the restoration sequence.
|
||||
if(ai_slot)
|
||||
ai_slot.locked = FALSE
|
||||
return
|
||||
|
||||
if(cardhold.flush)
|
||||
ai_slot.locked = FALSE
|
||||
restoring = FALSE
|
||||
return
|
||||
ai_slot.locked =TRUE
|
||||
A.adjustOxyLoss(-1, 0)
|
||||
A.adjustFireLoss(-1, 0)
|
||||
A.adjustToxLoss(-1, 0)
|
||||
A.adjustBruteLoss(-1, 0)
|
||||
A.updatehealth()
|
||||
if(A.health >= 0 && A.stat == DEAD)
|
||||
A.revive()
|
||||
// Finished restoring
|
||||
if(A.health >= 100)
|
||||
ai_slot.locked = FALSE
|
||||
restoring = FALSE
|
||||
|
||||
return TRUE
|
||||
|
||||
|
||||
/datum/computer_file/program/aidiag/ui_data(mob/user)
|
||||
var/list/data = get_header_data()
|
||||
var/mob/living/silicon/ai/AI
|
||||
// A shortcut for getting the AI stored inside the computer. The program already does necessary checks.
|
||||
AI = get_ai()
|
||||
|
||||
var/obj/item/device/aicard/aicard = get_ai(2)
|
||||
|
||||
if(!aicard)
|
||||
data["nocard"] = TRUE
|
||||
data["error"] = "Please insert an intelliCard."
|
||||
else
|
||||
if(!AI)
|
||||
data["error"] = "No AI located"
|
||||
else
|
||||
var/obj/item/device/aicard/cardhold = AI.loc
|
||||
if(cardhold.flush)
|
||||
data["error"] = "Flush in progress"
|
||||
else
|
||||
data["name"] = AI.name
|
||||
data["restoring"] = restoring
|
||||
data["laws"] = AI.laws.get_law_list(include_zeroth = 1)
|
||||
data["health"] = (AI.health + 100) / 2
|
||||
data["isDead"] = AI.stat == DEAD
|
||||
data["ai_laws"] = AI.laws.get_law_list(include_zeroth = 1)
|
||||
|
||||
return data
|
||||
|
||||
/datum/computer_file/program/aidiag/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, datum/tgui/master_ui = null, datum/ui_state/state = default_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "ai_restorer", "Integrity Restorer", 600, 400, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
/datum/computer_file/program/aidiag/kill_program(forced)
|
||||
restoring = FALSE
|
||||
return ..(forced)
|
||||
Reference in New Issue
Block a user