Fixes some modular computer stuff (#13365)

* Fixes some modular computer stuff

- Laptops now have the correct icons when opened
- You can no longer use programs when the computer lid is shut (RIP laptops being used ever)
- Fixes roundstart runtimes caused by updating icons when the physical is null
- Adds an interact sound to a few buttons I missed

* Missed these

Oops
This commit is contained in:
nmajask
2022-03-07 06:35:32 -05:00
committed by GitHub
parent e7ad3baf5b
commit c06ce396e7
4 changed files with 21 additions and 12 deletions

View File

@@ -197,7 +197,9 @@
/datum/computer_file/program/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if (!computer.can_show_ui(user, ui))
if (!computer.can_show_ui(user))
if(ui)
ui.close()
return
if(!ui && tgui_id)
ui = new(user, src, tgui_id, filedesc)
@@ -214,10 +216,12 @@
if(computer)
switch(action)
if("PC_exit")
computer.play_interact_sound()
computer.kill_program()
ui.close()
return TRUE
if("PC_shutdown")
computer.play_interact_sound()
computer.shutdown_computer()
ui.close()
return TRUE
@@ -225,7 +229,7 @@
var/mob/user = usr
if(!computer.active_program || !computer.all_components[MC_CPU])
return
computer.play_interact_sound()
computer.idle_threads.Add(computer.active_program)
program_state = PROGRAM_STATE_BACKGROUND // Should close any existing UIs
@@ -246,4 +250,6 @@
/datum/computer_file/program/ui_status(mob/user)
if(program_state != PROGRAM_STATE_ACTIVE) // Our program was closed. Close the ui if it exists.
return UI_CLOSE
if(!computer.can_show_ui(user))
return UI_CLOSE
return ..()