Modular PDA tweaks and bugfixes (#10440)

rscadd: "Handheld modular computers now use flashlights as a light source. They may be turned on/off via a button in the PC header, and have their brightness adjusted in Hardware Configuration."
    tweak: Message notifications should be much larger.
    tweak: "Chat messages are now logged to the NTNet Monitoring program."
    bugfix: "IDs are now unregistered from computers when the computer is destroyed."
    bugfix: "Fix Eject Battery having a global view range."
    bugfix: "Chat Clients are no longer set to 'silent' by default."
    backend: "Added a new slider component for VueUIs."

Closes #10439
This commit is contained in:
JohnWildkins
2020-11-10 01:12:51 -05:00
committed by GitHub
parent 566b624d53
commit 44664fc90d
30 changed files with 351 additions and 69 deletions
@@ -97,6 +97,9 @@
/obj/item/modular_computer/Destroy()
kill_program(TRUE)
if(registered_id)
registered_id.chat_registered = FALSE
registered_id = null
for(var/obj/item/computer_hardware/CH in src.get_all_components())
uninstall_component(null, CH)
qdel(CH)
@@ -133,8 +136,8 @@
else
add_overlay(icon_state_screensaver)
if (screensaver_light_range && working)
set_light(screensaver_light_range, 1, screensaver_light_color ? screensaver_light_color : "#FFFFFF")
if (screensaver_light_range && working && !flashlight)
set_light(screensaver_light_range, light_power, screensaver_light_color ? screensaver_light_color : "#FFFFFF")
else
set_light(0)
return
@@ -144,13 +147,15 @@
holographic_overlay(src, src.icon, state)
else
add_overlay(state)
set_light(light_strength, l_color = active_program.color)
if(!flashlight)
set_light(light_range, light_power, l_color = active_program.color)
else
if (is_holographic)
holographic_overlay(src, src.icon, icon_state_menu)
else
add_overlay(icon_state_menu)
set_light(light_strength, l_color = menu_light_color)
if(!flashlight)
set_light(light_range, light_power, l_color = menu_light_color)
/obj/item/modular_computer/proc/turn_on(var/mob/user)
if(tesla_link)
@@ -425,18 +430,18 @@
/obj/item/modular_computer/proc/register_account(var/datum/computer_file/program/PRG = null)
var/obj/item/card/id/id = GetID()
if(PRG)
output_message(SPAN_NOTICE("\The [src] shows a notice: \"[PRG.filedesc] requires a registered NTNRC account. Registering automatically...\""))
output_notice("[PRG.filedesc] requires a registered NTNRC account. Registering automatically...")
if(!istype(id))
output_message(SPAN_WARNING("\The [src] shows an error: \"No ID card found!\""))
output_error("No ID card found!")
return FALSE
if(id.chat_registered)
output_message(SPAN_WARNING("\The [src] shows an error: \"This card is already registered to another account!\""))
output_error("This card is already registered to another account!")
return FALSE
id.chat_registered = TRUE
registered_id = id
output_message(SPAN_NOTICE("\The [src] beeps: \"Registration successful!\""))
playsound(get_turf(src), 'sound/machines/ping.ogg', 20, 0)
output_notice("Registration successful!")
playsound(get_turf(src), 'sound/machines/ping.ogg', 10, 0)
return registered_id
/obj/item/modular_computer/proc/unregister_account()
@@ -110,6 +110,9 @@
else if(tesla_link == H)
tesla_link = null
found = TRUE
else if(flashlight == H)
flashlight = null
found = TRUE
else if(personal_ai == H)
if(user)
to_chat(user, SPAN_NOTICE("You remove \the [H] from \the [src]."))
@@ -156,6 +159,8 @@
return personal_ai
if(tesla_link && (initial(tesla_link.name) == name))
return tesla_link
if(flashlight && initial(flashlight.name) == name)
return flashlight
return null
// Returns list of all components
@@ -181,4 +186,6 @@
all_components.Add(personal_ai)
if(tesla_link)
all_components.Add(tesla_link)
if(flashlight)
all_components.Add(flashlight)
return all_components
@@ -70,7 +70,7 @@
verbs -= /obj/item/modular_computer/proc/eject_item
to_chat(usr, SPAN_NOTICE("You remove \the [I] from \the [src]."))
/obj/item/modular_computer/proc/eject_battery(mob/usr = usr)
/obj/item/modular_computer/proc/eject_battery()
set name = "Eject Battery"
set category = "Object"
set src in view(1)
@@ -68,12 +68,16 @@
if(href_list["PC_enable_component"])
var/obj/item/computer_hardware/H = find_hardware_by_name(href_list["PC_enable_component"])
if(H && istype(H) && !H.enabled)
H.enabled = TRUE
H.enable()
. = TRUE
if(href_list["PC_disable_component"])
var/obj/item/computer_hardware/H = find_hardware_by_name(href_list["PC_disable_component"])
if(H && istype(H) && H.enabled)
H.enabled = 0
H.disable()
. = TRUE
if(href_list["PC_togglelight"])
if(flashlight)
flashlight.toggle()
. = TRUE
if(href_list["PC_shutdown"])
shutdown_computer()
@@ -47,7 +47,8 @@
var/message_output_range = 0 // Adds onto the output_message proc's range
var/max_hardware_size = 0 // Maximal hardware size. Currently, tablets have 1, laptops 2 and consoles 3. Limits what hardware types can be installed.
var/steel_sheet_cost = 5 // Amount of steel sheets refunded when disassembling an empty frame of this computer.
var/light_strength = 0 // Intensity of light this computer emits. Comparable to numbers light fixtures use.
light_range = 0 // Tile range of lighting emitted by the computer.
light_power = 0 // Intensity of lighting emitted by the computer. Valid range between 0 and 1.
var/list/idle_threads = list() // Idle programs on background. They still receive process calls but can't be interacted with.
var/list/enabled_services = list() // Enabled services that run in background and handle things pasively. Supported on all CPUs.
var/power_has_failed = FALSE
@@ -71,6 +72,7 @@
var/obj/item/computer_hardware/ai_slot/ai_slot // AI slot, an intellicard housing that allows modifications of AIs.
var/obj/item/computer_hardware/tesla_link/tesla_link // Tesla Link, Allows remote charging from nearest APC.
var/obj/item/device/paicard/personal_ai // Personal AI, can control the device via a verb when installed
var/obj/item/computer_hardware/flashlight/flashlight
var/listener/listener //Listener needed for things