PDAs open their messenger when replying to messages through chat (#68355)

* Clicking Reply in PDA messages now opens your PDA messenger app.

* Additionally does a ton of PDA code improvement.
This commit is contained in:
distributivgesetz
2022-07-18 05:53:33 +02:00
committed by GitHub
parent a8b911a549
commit 9c0ac84ba6
18 changed files with 132 additions and 120 deletions

View File

@@ -345,7 +345,7 @@ GLOBAL_LIST_EMPTY(TabletMessengers) // a list of all active messengers, similar
user.put_in_hands(ssd)
playsound(src, 'sound/machines/card_slide.ogg', 50)
/obj/item/modular_computer/proc/turn_on(mob/user)
/obj/item/modular_computer/proc/turn_on(mob/user, open_ui = TRUE)
var/issynth = issilicon(user) // Robots and AIs get different activation messages.
if(atom_integrity <= integrity_failure * max_integrity)
if(issynth)
@@ -368,7 +368,8 @@ GLOBAL_LIST_EMPTY(TabletMessengers) // a list of all active messengers, similar
soundloop.start()
enabled = 1
update_appearance()
ui_interact(user)
if(open_ui)
ui_interact(user)
return TRUE
else // Unpowered
if(issynth)
@@ -521,6 +522,44 @@ GLOBAL_LIST_EMPTY(TabletMessengers) // a list of all active messengers, similar
INVOKE_ASYNC(src, /datum/proc/ui_interact, user) // Re-open the UI on this computer. It should show the main screen now.
update_appearance()
/obj/item/modular_computer/proc/open_program(mob/user, datum/computer_file/program/program)
if(program.computer != src)
CRASH("tried to open program that does not belong to this computer")
if(!program || !istype(program)) // Program not found or it's not executable program.
to_chat(user, span_danger("\The [src]'s screen shows \"I/O ERROR - Unable to run program\" warning."))
return FALSE
if(!program.is_supported_by_hardware(hardware_flag, 1, user))
return FALSE
// The program is already running. Resume it.
if(program in idle_threads)
program.program_state = PROGRAM_STATE_ACTIVE
active_program = program
program.alert_pending = FALSE
idle_threads.Remove(program)
update_appearance()
updateUsrDialog()
return TRUE
if(idle_threads.len > max_idle_programs)
to_chat(user, span_danger("\The [src] displays a \"Maximal CPU load reached. Unable to run another program.\" error."))
return FALSE
if(program.requires_ntnet && !get_ntnet_status(program.requires_ntnet_feature)) // The program requires NTNet connection, but we are not connected to NTNet.
to_chat(user, span_danger("\The [src]'s screen shows \"Unable to connect to NTNet. Please retry. If problem persists contact your system administrator.\" warning."))
return FALSE
if(!program.on_start(user))
return FALSE
active_program = program
program.alert_pending = FALSE
update_appearance()
updateUsrDialog()
return TRUE
// Returns 0 for No Signal, 1 for Low Signal and 2 for Good Signal. 3 is for wired connection (always-on)
/obj/item/modular_computer/proc/get_ntnet_status(specific_action = 0)
var/obj/item/computer_hardware/network_card/network_card = all_components[MC_NET]

View File

@@ -156,44 +156,11 @@
to_chat(user, span_notice("Program [P.filename].[P.filetype] with PID [rand(100,999)] has been killed."))
if("PC_runprogram")
var/prog = params["name"]
var/is_disk = params["is_disk"]
var/datum/computer_file/program/P = null
var/mob/user = usr
if(hard_drive && !is_disk)
P = hard_drive.find_file_by_name(prog)
if(!P || !istype(P)) // Program not found or it's not executable program.
to_chat(user, span_danger("\The [src]'s screen shows \"I/O ERROR - Unable to run program\" warning."))
// only function of the last implementation (?)
if(params["is_disk"])
return
P.computer = src
if(!P.is_supported_by_hardware(hardware_flag, 1, user))
return
// The program is already running. Resume it.
if(P in idle_threads)
P.program_state = PROGRAM_STATE_ACTIVE
active_program = P
P.alert_pending = FALSE
idle_threads.Remove(P)
update_appearance()
return
if(idle_threads.len > max_idle_programs)
to_chat(user, span_danger("\The [src] displays a \"Maximal CPU load reached. Unable to run another program.\" error."))
return
if(P.requires_ntnet && !get_ntnet_status(P.requires_ntnet_feature)) // The program requires NTNet connection, but we are not connected to NTNet.
to_chat(user, span_danger("\The [src]'s screen shows \"Unable to connect to NTNet. Please retry. If problem persists contact your system administrator.\" warning."))
return
if(P.run_program(user))
active_program = P
P.alert_pending = FALSE
update_appearance()
return 1
open_program(usr, hard_drive.find_file_by_name(params["name"]))
if("PC_toggle_light")
return toggle_flashlight()

View File

@@ -199,7 +199,7 @@
borgo = null
return ..()
/obj/item/modular_computer/tablet/integrated/turn_on(mob/user)
/obj/item/modular_computer/tablet/integrated/turn_on(mob/user, open_ui = FALSE)
if(borgo?.stat != DEAD)
return ..()
return FALSE