[MIRROR] Adds SHOULD_NOT_SLEEP to Destroy. Why didn't we do this before. [MDB IGNORE] (#8714)

* Adds SHOULD_NOT_SLEEP to Destroy. Why didn't we do this before. (#61943)

* Adds SHOULD_NOT_SLEEP to Destroy. Why didn't we do this before.

Co-authored-by: LemonInTheDark <58055496+LemonInTheDark@users.noreply.github.com>
This commit is contained in:
SkyratBot
2021-10-09 15:11:52 +02:00
committed by GitHub
parent d3f9b7720e
commit 95ab2d2efb
11 changed files with 54 additions and 32 deletions
@@ -64,7 +64,7 @@
update_appearance()
/obj/item/modular_computer/Destroy()
kill_program(forced = TRUE)
wipe_program(forced = TRUE)
STOP_PROCESSING(SSobj, src)
for(var/port in all_components)
var/obj/item/computer_hardware/component = all_components[port]
@@ -410,14 +410,20 @@
data["PC_showexitprogram"] = active_program ? 1 : 0 // Hides "Exit Program" button on mainscreen
return data
///Wipes the computer's current program. Doesn't handle any of the niceties around doing this
/obj/item/modular_computer/proc/wipe_program(forced)
if(!active_program)
return
active_program.kill_program(forced)
active_program = null
// Relays kill program request to currently active program. Use this to quit current program.
/obj/item/modular_computer/proc/kill_program(forced = FALSE)
if(active_program)
active_program.kill_program(forced)
active_program = null
wipe_program(forced)
var/mob/user = usr
if(user && istype(user))
ui_interact(user) // Re-open the UI on this computer. It should show the main screen now.
//Here to prevent programs sleeping in destroy
INVOKE_ASYNC(src, /datum/proc/ui_interact, user) // Re-open the UI on this computer. It should show the main screen now.
update_appearance()
// Returns 0 for No Signal, 1 for Low Signal and 2 for Good Signal. 3 is for wired connection (always-on)