mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-22 12:41:09 +01:00
[MIRROR] Misc PDA code improvements [MDB IGNORE] (#17026)
* Misc PDA code improvements (#70555) * How to conflict with PRs: A guide * Removes unnecessary support for the now-removed job disks from Tablet's TGUI menu, and tablet's ui_act. * Adds autodoc comments to computer files * Removes the unused 'unsendable' var on computer files * Generally improves code on tablets, now process isn't looping through every idle thread twice! * Moves the check for program in idle_threads above checking if supported by hardware, because it's already running, so there's no need to check. * eh * revert a scipaper change * Misc PDA code improvements * updated contract_uplink Co-authored-by: John Willard <53777086+JohnFulpWillard@users.noreply.github.com> Co-authored-by: Tastyfish <crazychris32@gmail.com>
This commit is contained in:
co-authored by
John Willard
Tastyfish
parent
eff29609cd
commit
c023767b25
@@ -177,7 +177,7 @@ GLOBAL_LIST_EMPTY(TabletMessengers) // a list of all active messengers, similar
|
||||
if(!istype(src, /obj/item/modular_computer/tablet))
|
||||
return FALSE
|
||||
|
||||
// Gets IDs/access levels from card slot. Would be useful when/if PDAs would become modular PCs.
|
||||
// Gets IDs/access levels from card slot. Would be useful when/if PDAs would become modular PCs. //guess what
|
||||
/obj/item/modular_computer/GetAccess()
|
||||
var/obj/item/computer_hardware/card_slot/card_slot = all_components[MC_CARD]
|
||||
if(card_slot)
|
||||
@@ -423,7 +423,7 @@ GLOBAL_LIST_EMPTY(TabletMessengers) // a list of all active messengers, similar
|
||||
to_chat(user, span_notice("You press the power button and start up \the [src]."))
|
||||
if(looping_sound)
|
||||
soundloop.start()
|
||||
enabled = 1
|
||||
enabled = TRUE
|
||||
update_appearance()
|
||||
if(open_ui)
|
||||
ui_interact(user)
|
||||
@@ -446,26 +446,23 @@ GLOBAL_LIST_EMPTY(TabletMessengers) // a list of all active messengers, similar
|
||||
return
|
||||
|
||||
if(active_program && active_program.requires_ntnet && !get_ntnet_status(active_program.requires_ntnet_feature))
|
||||
active_program.event_networkfailure(0) // Active program requires NTNet to run but we've just lost connection. Crash.
|
||||
active_program.event_networkfailure(FALSE) // Active program requires NTNet to run but we've just lost connection. Crash.
|
||||
|
||||
for(var/I in idle_threads)
|
||||
var/datum/computer_file/program/P = I
|
||||
if(P.requires_ntnet && !get_ntnet_status(P.requires_ntnet_feature))
|
||||
P.event_networkfailure(1)
|
||||
for(var/datum/computer_file/program/idle_programs as anything in idle_threads)
|
||||
if(idle_programs.program_state == PROGRAM_STATE_KILLED)
|
||||
idle_threads.Remove(idle_programs)
|
||||
continue
|
||||
idle_programs.process_tick(delta_time)
|
||||
idle_programs.ntnet_status = get_ntnet_status(idle_programs.requires_ntnet_feature)
|
||||
if(idle_programs.requires_ntnet && !idle_programs.ntnet_status)
|
||||
idle_programs.event_networkfailure(TRUE)
|
||||
|
||||
if(active_program)
|
||||
if(active_program.program_state != PROGRAM_STATE_KILLED)
|
||||
if(active_program.program_state == PROGRAM_STATE_KILLED)
|
||||
active_program = null
|
||||
else
|
||||
active_program.process_tick(delta_time)
|
||||
active_program.ntnet_status = get_ntnet_status()
|
||||
else
|
||||
active_program = null
|
||||
|
||||
for(var/datum/computer_file/program/P as anything in idle_threads)
|
||||
if(P.program_state != PROGRAM_STATE_KILLED)
|
||||
P.process_tick(delta_time)
|
||||
P.ntnet_status = get_ntnet_status()
|
||||
else
|
||||
idle_threads.Remove(P)
|
||||
|
||||
handle_power(delta_time) // Handles all computer power interaction
|
||||
//check_update_ui_need()
|
||||
@@ -506,6 +503,7 @@ GLOBAL_LIST_EMPTY(TabletMessengers) // a list of all active messengers, similar
|
||||
|
||||
var/obj/item/computer_hardware/battery/battery_module = all_components[MC_CELL]
|
||||
|
||||
data["PC_showbatteryicon"] = !!battery_module
|
||||
if(battery_module && battery_module.battery)
|
||||
switch(battery_module.battery.percent())
|
||||
if(80 to 200) // 100 should be maximal but just in case..
|
||||
@@ -521,11 +519,9 @@ GLOBAL_LIST_EMPTY(TabletMessengers) // a list of all active messengers, similar
|
||||
else
|
||||
data["PC_batteryicon"] = "batt_5.gif"
|
||||
data["PC_batterypercent"] = "[round(battery_module.battery.percent())]%"
|
||||
data["PC_showbatteryicon"] = 1
|
||||
else
|
||||
data["PC_batteryicon"] = "batt_5.gif"
|
||||
data["PC_batterypercent"] = "N/C"
|
||||
data["PC_showbatteryicon"] = battery_module ? 1 : 0
|
||||
|
||||
switch(get_ntnet_status())
|
||||
if(NTNET_NO_SIGNAL)
|
||||
@@ -539,19 +535,15 @@ GLOBAL_LIST_EMPTY(TabletMessengers) // a list of all active messengers, similar
|
||||
|
||||
if(length(idle_threads))
|
||||
var/list/program_headers = list()
|
||||
for(var/I in idle_threads)
|
||||
var/datum/computer_file/program/P = I
|
||||
if(!P.ui_header)
|
||||
for(var/datum/computer_file/program/idle_programs as anything in idle_threads)
|
||||
if(!idle_programs.ui_header)
|
||||
continue
|
||||
program_headers.Add(list(list(
|
||||
"icon" = P.ui_header
|
||||
)))
|
||||
program_headers.Add(list(list("icon" = idle_programs.ui_header)))
|
||||
|
||||
data["PC_programheaders"] = program_headers
|
||||
|
||||
data["PC_stationtime"] = station_time_timestamp()
|
||||
data["PC_hasheader"] = 1
|
||||
data["PC_showexitprogram"] = active_program ? 1 : 0 // Hides "Exit Program" button on mainscreen
|
||||
data["PC_showexitprogram"] = !!active_program // Hides "Exit Program" button on mainscreen
|
||||
return data
|
||||
|
||||
///Wipes the computer's current program. Doesn't handle any of the niceties around doing this
|
||||
@@ -578,9 +570,6 @@ GLOBAL_LIST_EMPTY(TabletMessengers) // a list of all active messengers, similar
|
||||
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
|
||||
@@ -591,6 +580,9 @@ GLOBAL_LIST_EMPTY(TabletMessengers) // a list of all active messengers, similar
|
||||
updateUsrDialog()
|
||||
return TRUE
|
||||
|
||||
if(!program.is_supported_by_hardware(hardware_flag, 1, user))
|
||||
return FALSE
|
||||
|
||||
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
|
||||
@@ -613,7 +605,6 @@ GLOBAL_LIST_EMPTY(TabletMessengers) // a list of all active messengers, similar
|
||||
if(!SSnetworks.station_network || !SSnetworks.station_network.check_function(specific_action)) // NTNet is down and we are not connected via wired connection. No signal.
|
||||
return NTNET_NO_SIGNAL
|
||||
|
||||
|
||||
// computers are connected through ethernet
|
||||
if(hardware_flag & PROGRAM_CONSOLE)
|
||||
return NTNET_ETHERNET_SIGNAL
|
||||
|
||||
@@ -64,14 +64,10 @@
|
||||
data["device_theme"] = device_theme
|
||||
data["login"] = list()
|
||||
|
||||
data["disk"] = null
|
||||
|
||||
var/obj/item/computer_hardware/card_slot/cardholder = all_components[MC_CARD]
|
||||
data["cardholder"] = FALSE
|
||||
data["cardholder"] = !!cardholder
|
||||
|
||||
if(cardholder)
|
||||
data["cardholder"] = TRUE
|
||||
|
||||
var/stored_name = saved_identification
|
||||
var/stored_title = saved_job
|
||||
if(!stored_name)
|
||||
@@ -105,7 +101,13 @@
|
||||
if(P in idle_threads)
|
||||
running = TRUE
|
||||
|
||||
data["programs"] += list(list("name" = P.filename, "desc" = P.filedesc, "running" = running, "icon" = P.program_icon, "alert" = P.alert_pending))
|
||||
data["programs"] += list(list(
|
||||
"name" = P.filename,
|
||||
"desc" = P.filedesc,
|
||||
"running" = running,
|
||||
"icon" = P.program_icon,
|
||||
"alert" = P.alert_pending,
|
||||
))
|
||||
|
||||
data["has_light"] = has_light
|
||||
data["light_on"] = light_on
|
||||
@@ -155,10 +157,6 @@
|
||||
to_chat(user, span_notice("Program [P.filename].[P.filetype] with PID [rand(100,999)] has been killed."))
|
||||
|
||||
if("PC_runprogram")
|
||||
// only function of the last implementation (?)
|
||||
if(params["is_disk"])
|
||||
return
|
||||
|
||||
open_program(usr, hard_drive.find_file_by_name(params["name"]))
|
||||
|
||||
if("PC_toggle_light")
|
||||
|
||||
Reference in New Issue
Block a user