Makes resurrecting and killing intellicarded AIs less painful (#47362)

* Update airestorer.dm

* Update aifixer.dm

* Update aicard.dm

* Update airestorer.dm

* Update aifixer.dm
This commit is contained in:
ATH1909
2019-10-31 02:20:17 -05:00
committed by Rob Bailey
parent 88059521b1
commit fe3d6d42a2
3 changed files with 165 additions and 162 deletions

View File

@@ -1,157 +1,160 @@
/obj/machinery/computer/aifixer /obj/machinery/computer/aifixer
name = "\improper AI system integrity restorer" name = "\improper AI system integrity restorer"
desc = "Used with intelliCards containing nonfunctional AIs to restore them to working order." desc = "Used with intelliCards containing nonfunctional AIs to restore them to working order."
req_access = list(ACCESS_CAPTAIN, ACCESS_ROBOTICS, ACCESS_HEADS) req_access = list(ACCESS_CAPTAIN, ACCESS_ROBOTICS, ACCESS_HEADS)
var/mob/living/silicon/ai/occupier = null var/mob/living/silicon/ai/occupier = null
var/active = 0 var/active = 0
circuit = /obj/item/circuitboard/computer/aifixer circuit = /obj/item/circuitboard/computer/aifixer
icon_keyboard = "tech_key" icon_keyboard = "tech_key"
icon_screen = "ai-fixer" icon_screen = "ai-fixer"
light_color = LIGHT_COLOR_PINK light_color = LIGHT_COLOR_PINK
/obj/machinery/computer/aifixer/screwdriver_act(mob/living/user, obj/item/I) /obj/machinery/computer/aifixer/screwdriver_act(mob/living/user, obj/item/I)
if(occupier) if(occupier)
if(stat & (NOPOWER|BROKEN)) if(stat & (NOPOWER|BROKEN))
to_chat(user, "<span class='warning'>The screws on [name]'s screen won't budge.</span>") to_chat(user, "<span class='warning'>The screws on [name]'s screen won't budge.</span>")
else else
to_chat(user, "<span class='warning'>The screws on [name]'s screen won't budge and it emits a warning beep.</span>") to_chat(user, "<span class='warning'>The screws on [name]'s screen won't budge and it emits a warning beep.</span>")
else else
return ..() return ..()
/obj/machinery/computer/aifixer/ui_interact(mob/user) /obj/machinery/computer/aifixer/ui_interact(mob/user)
. = ..() . = ..()
var/dat = "" var/dat = ""
if (src.occupier) if (src.occupier)
var/laws var/laws
dat += "<h3>Stored AI: [src.occupier.name]</h3>" dat += "<h3>Stored AI: [src.occupier.name]</h3>"
dat += "<b>System integrity:</b> [(src.occupier.health+100)/2]%<br>" dat += "<b>System integrity:</b> [(src.occupier.health+100)/2]%<br>"
if (src.occupier.laws.zeroth) if (src.occupier.laws.zeroth)
laws += "<b>0:</b> [src.occupier.laws.zeroth]<BR>" laws += "<b>0:</b> [src.occupier.laws.zeroth]<BR>"
for (var/index = 1, index <= src.occupier.laws.hacked.len, index++) for (var/index = 1, index <= src.occupier.laws.hacked.len, index++)
var/law = src.occupier.laws.hacked[index] var/law = src.occupier.laws.hacked[index]
if (length(law) > 0) if (length(law) > 0)
var/num = ionnum() var/num = ionnum()
laws += "<b>[num]:</b> [law]<BR>" laws += "<b>[num]:</b> [law]<BR>"
for (var/index = 1, index <= src.occupier.laws.ion.len, index++) for (var/index = 1, index <= src.occupier.laws.ion.len, index++)
var/law = src.occupier.laws.ion[index] var/law = src.occupier.laws.ion[index]
if (length(law) > 0) if (length(law) > 0)
var/num = ionnum() var/num = ionnum()
laws += "<b>[num]:</b> [law]<BR>" laws += "<b>[num]:</b> [law]<BR>"
var/number = 1 var/number = 1
for (var/index = 1, index <= src.occupier.laws.inherent.len, index++) for (var/index = 1, index <= src.occupier.laws.inherent.len, index++)
var/law = src.occupier.laws.inherent[index] var/law = src.occupier.laws.inherent[index]
if (length(law) > 0) if (length(law) > 0)
laws += "<b>[number]:</b> [law]<BR>" laws += "<b>[number]:</b> [law]<BR>"
number++ number++
for (var/index = 1, index <= src.occupier.laws.supplied.len, index++) for (var/index = 1, index <= src.occupier.laws.supplied.len, index++)
var/law = src.occupier.laws.supplied[index] var/law = src.occupier.laws.supplied[index]
if (length(law) > 0) if (length(law) > 0)
laws += "<b>[number]:</b> [law]<BR>" laws += "<b>[number]:</b> [law]<BR>"
number++ number++
dat += "<b>Laws:</b><br>[laws]<br>" dat += "<b>Laws:</b><br>[laws]<br>"
if (src.occupier.stat == DEAD) if (src.occupier.stat == DEAD)
dat += "<span class='bad'>AI non-functional</span>" dat += "<span class='bad'>AI non-functional</span>"
else else
dat += "<span class='good'>AI functional</span>" dat += "<span class='good'>AI functional</span>"
if (!src.active) if (!src.active)
dat += {"<br><br><A href='byond://?src=[REF(src)];fix=1'>Begin Reconstruction</A>"} dat += {"<br><br><A href='byond://?src=[REF(src)];fix=1'>Begin Reconstruction</A>"}
else else
dat += "<br><br>Reconstruction in process, please wait.<br>" dat += "<br><br>Reconstruction in process, please wait.<br>"
dat += {"<br><A href='?src=[REF(user)];mach_close=computer'>Close</A>"} dat += {"<br><A href='?src=[REF(user)];mach_close=computer'>Close</A>"}
var/datum/browser/popup = new(user, "computer", "AI System Integrity Restorer", 400, 500) var/datum/browser/popup = new(user, "computer", "AI System Integrity Restorer", 400, 500)
popup.set_content(dat) popup.set_content(dat)
popup.set_title_image(user.browse_rsc_icon(src.icon, src.icon_state)) popup.set_title_image(user.browse_rsc_icon(src.icon, src.icon_state))
popup.open() popup.open()
return return
/obj/machinery/computer/aifixer/proc/Fix() /obj/machinery/computer/aifixer/proc/Fix()
use_power(1000) use_power(1000)
occupier.adjustOxyLoss(-1, 0) occupier.adjustOxyLoss(-5, 0)
occupier.adjustFireLoss(-1, 0) occupier.adjustFireLoss(-5, 0)
occupier.adjustToxLoss(-1, 0) occupier.adjustToxLoss(-5, 0)
occupier.adjustBruteLoss(-1, 0) occupier.adjustBruteLoss(-5, 0)
occupier.updatehealth() occupier.updatehealth()
if(occupier.health >= 0 && occupier.stat == DEAD) if(occupier.health >= 0 && occupier.stat == DEAD)
occupier.revive(full_heal = FALSE, admin_revive = FALSE) occupier.revive(full_heal = FALSE, admin_revive = FALSE)
return occupier.health < 100 if(!occupier.radio_enabled)
occupier.radio_enabled = TRUE
/obj/machinery/computer/aifixer/process() to_chat(occupier, "<span class='warning'>Your Subspace Transceiver has been enabled!</span>")
if(..()) return occupier.health < 100
if(active)
var/oldstat = occupier.stat /obj/machinery/computer/aifixer/process()
active = Fix() if(..())
if(oldstat != occupier.stat) if(active)
update_icon() var/oldstat = occupier.stat
updateDialog() active = Fix()
if(oldstat != occupier.stat)
/obj/machinery/computer/aifixer/Topic(href, href_list) update_icon()
if(..()) updateDialog()
return
if(href_list["fix"]) /obj/machinery/computer/aifixer/Topic(href, href_list)
to_chat(usr, "<span class='notice'>Reconstruction in progress. This will take several minutes.</span>") if(..())
playsound(src, 'sound/machines/terminal_prompt_confirm.ogg', 25, FALSE) return
active = TRUE if(href_list["fix"])
if(occupier) to_chat(usr, "<span class='notice'>Reconstruction in progress. This will take several minutes.</span>")
var/mob/living/silicon/ai/A = occupier playsound(src, 'sound/machines/terminal_prompt_confirm.ogg', 25, FALSE)
A.notify_ghost_cloning("Your core files are being restored!", source = src) active = TRUE
add_fingerprint(usr) if(occupier)
updateUsrDialog() var/mob/living/silicon/ai/A = occupier
A.notify_ghost_cloning("Your core files are being restored!", source = src)
/obj/machinery/computer/aifixer/update_icon() add_fingerprint(usr)
..() updateUsrDialog()
if(stat & (NOPOWER|BROKEN))
return /obj/machinery/computer/aifixer/update_icon()
else ..()
if(active) if(stat & (NOPOWER|BROKEN))
add_overlay("ai-fixer-on") return
if (occupier) else
switch (occupier.stat) if(active)
if (0) add_overlay("ai-fixer-on")
add_overlay("ai-fixer-full") if (occupier)
if (2) switch (occupier.stat)
add_overlay("ai-fixer-404") if (0)
else add_overlay("ai-fixer-full")
add_overlay("ai-fixer-empty") if (2)
add_overlay("ai-fixer-404")
/obj/machinery/computer/aifixer/transfer_ai(interaction, mob/user, mob/living/silicon/ai/AI, obj/item/aicard/card) else
if(!..()) add_overlay("ai-fixer-empty")
return
//Downloading AI from card to terminal. /obj/machinery/computer/aifixer/transfer_ai(interaction, mob/user, mob/living/silicon/ai/AI, obj/item/aicard/card)
if(interaction == AI_TRANS_FROM_CARD) if(!..())
if(stat & (NOPOWER|BROKEN)) return
to_chat(user, "<span class='alert'>[src] is offline and cannot take an AI at this time.</span>") //Downloading AI from card to terminal.
return if(interaction == AI_TRANS_FROM_CARD)
AI.forceMove(src) if(stat & (NOPOWER|BROKEN))
occupier = AI to_chat(user, "<span class='alert'>[src] is offline and cannot take an AI at this time.</span>")
AI.control_disabled = TRUE return
AI.radio_enabled = FALSE AI.forceMove(src)
to_chat(AI, "<span class='alert'>You have been uploaded to a stationary terminal. Sadly, there is no remote access from here.</span>") occupier = AI
to_chat(user, "<span class='notice'>Transfer successful</span>: [AI.name] ([rand(1000,9999)].exe) installed and executed successfully. Local copy has been removed.") AI.control_disabled = TRUE
card.AI = null AI.radio_enabled = FALSE
update_icon() to_chat(AI, "<span class='alert'>You have been uploaded to a stationary terminal. Sadly, there is no remote access from here.</span>")
to_chat(user, "<span class='notice'>Transfer successful</span>: [AI.name] ([rand(1000,9999)].exe) installed and executed successfully. Local copy has been removed.")
else //Uploading AI from terminal to card card.AI = null
if(occupier && !active) update_icon()
to_chat(occupier, "<span class='notice'>You have been downloaded to a mobile storage device. Still no remote access.</span>")
to_chat(user, "<span class='notice'>Transfer successful</span>: [occupier.name] ([rand(1000,9999)].exe) removed from host terminal and stored within local memory.") else //Uploading AI from terminal to card
occupier.forceMove(card) if(occupier && !active)
card.AI = occupier to_chat(occupier, "<span class='notice'>You have been downloaded to a mobile storage device. Still no remote access.</span>")
occupier = null to_chat(user, "<span class='notice'>Transfer successful</span>: [occupier.name] ([rand(1000,9999)].exe) removed from host terminal and stored within local memory.")
update_icon() occupier.forceMove(card)
else if (active) card.AI = occupier
to_chat(user, "<span class='alert'>ERROR: Reconstruction in progress.</span>") occupier = null
else if (!occupier) update_icon()
to_chat(user, "<span class='alert'>ERROR: Unable to locate artificial intelligence.</span>") else if (active)
to_chat(user, "<span class='alert'>ERROR: Reconstruction in progress.</span>")
/obj/machinery/computer/aifixer/on_deconstruction() else if (!occupier)
if(occupier) to_chat(user, "<span class='alert'>ERROR: Unable to locate artificial intelligence.</span>")
QDEL_NULL(occupier)
/obj/machinery/computer/aifixer/on_deconstruction()
if(occupier)
QDEL_NULL(occupier)

View File

@@ -88,7 +88,7 @@
if(AI && AI.loc == src) if(AI && AI.loc == src)
to_chat(AI, "<span class='userdanger'>Your core files are being wiped!</span>") to_chat(AI, "<span class='userdanger'>Your core files are being wiped!</span>")
while(AI.stat != DEAD && flush) while(AI.stat != DEAD && flush)
AI.adjustOxyLoss(1) AI.adjustOxyLoss(5)
AI.updatehealth() AI.updatehealth()
sleep(5) sleep(5)
flush = FALSE flush = FALSE

View File

@@ -74,10 +74,10 @@
restoring = FALSE restoring = FALSE
return return
ai_slot.locked =TRUE ai_slot.locked =TRUE
A.adjustOxyLoss(-1, 0) A.adjustOxyLoss(-5, 0)
A.adjustFireLoss(-1, 0) A.adjustFireLoss(-5, 0)
A.adjustToxLoss(-1, 0) A.adjustToxLoss(-5, 0)
A.adjustBruteLoss(-1, 0) A.adjustBruteLoss(-5, 0)
A.updatehealth() A.updatehealth()
if(A.health >= 0 && A.stat == DEAD) if(A.health >= 0 && A.stat == DEAD)
A.revive(full_heal = FALSE, admin_revive = FALSE) A.revive(full_heal = FALSE, admin_revive = FALSE)