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
@@ -16,7 +16,7 @@
base_active_power_usage = 500
max_hardware_size = 3
steel_sheet_cost = 20
light_strength = 2
light_range = 2
screensaver_light_range = 1.4
screensaver_light_color = "#0099ff"
is_holographic = TRUE
@@ -11,7 +11,6 @@
hardware_flag = PROGRAM_TABLET
max_hardware_size = 1
w_class = ITEMSIZE_SMALL
light_strength = 2 // Same as PDAs
/obj/item/modular_computer/handheld/Initialize()
. = ..()
@@ -15,7 +15,7 @@
base_active_power_usage = 200
message_output_range = 1
max_hardware_size = 2
light_strength = 3
light_range = 3
max_damage = 50
broken_damage = 25
var/icon_state_closed = "laptop-closed"
@@ -1,5 +1,5 @@
/obj/item/modular_computer/handheld/pda
name = "\improper PDA"
name = "PDA"
desc = "The latest in portable microcomputer solutions from Thinktronic Systems, LTD."
icon = 'icons/obj/pda.dmi'
icon_state = "pda"
@@ -53,4 +53,29 @@
/obj/item/modular_computer/silicon/install_default_programs()
hard_drive.store_file(new /datum/computer_file/program/filemanager(src))
hard_drive.store_file(new /datum/computer_file/program/ntnetdownload(src))
hard_drive.store_file(new /datum/computer_file/program/chatclient(src))
hard_drive.remove_file(hard_drive.find_file_by_name("clientmanager"))
addtimer(CALLBACK(src, .proc/register_chat), 1 SECOND)
/obj/item/modular_computer/silicon/proc/register_chat()
set_autorun("ntnrc_client")
enable_computer(null, TRUE) // passing null because we don't want the UI to open
minimize_program()
/obj/item/modular_computer/silicon/verb/send_pda_message()
set category = "AI IM"
set name = "Send Direct Message"
set src in usr
if (usr.stat == DEAD)
to_chat(usr, "You can't send PDA messages because you are dead!")
return
var/datum/computer_file/program/chatclient/CL = hard_drive.find_file_by_name("ntnrc_client")
if(!istype(CL))
output_error("Chat client not installed!")
return
else if(CL.program_state == PROGRAM_STATE_KILLED)
run_program("ntnrc_client")
CL.direct_message()
if(CL.channel)
CL.add_message(CL.send_message())
@@ -14,7 +14,7 @@
message_output_range = 1
max_hardware_size = 2
steel_sheet_cost = 10
light_strength = 4
light_range = 4
w_class = ITEMSIZE_HUGE
is_holographic = TRUE
@@ -11,7 +11,6 @@
slot_flags = SLOT_GLOVES|SLOT_ID
can_reset = TRUE
max_hardware_size = 1
light_strength = 1
menu_light_color = COLOR_GREEN
/obj/item/modular_computer/handheld/wristbound/set_icon()
@@ -38,6 +38,7 @@
card_slot = new /obj/item/computer_hardware/card_slot(src)
card_slot.stored_item = new /obj/item/pen
tesla_link = new /obj/item/computer_hardware/tesla_link/charging_cable(src)
flashlight = new /obj/item/computer_hardware/flashlight(src)
battery_module.charge_to_full()
/obj/item/modular_computer/handheld/preset/civilian
@@ -7,8 +7,12 @@
card_slot = new /obj/item/computer_hardware/card_slot(src)
card_slot.stored_item = new /obj/item/pen
tesla_link = new /obj/item/computer_hardware/tesla_link/charging_cable(src)
flashlight = new /obj/item/computer_hardware/flashlight(src)
battery_module.charge_to_full()
/obj/item/modular_computer/handheld/pda
_app_preset_type = /datum/modular_computer_app_presets/civilian
// Civilian
/obj/item/modular_computer/handheld/pda/civilian
@@ -5,6 +5,7 @@
network_card = new /obj/item/computer_hardware/network_card(src)
battery_module = new /obj/item/computer_hardware/battery_module/nano(src)
tesla_link = new /obj/item/computer_hardware/tesla_link/charging_cable(src)
flashlight = new /obj/item/computer_hardware/flashlight(src)
battery_module.charge_to_full()
/obj/item/modular_computer/handheld/wristbound/preset/cheap/generic
@@ -19,6 +20,7 @@
card_slot = new /obj/item/computer_hardware/card_slot(src)
battery_module = new /obj/item/computer_hardware/battery_module/hotswap(src)
tesla_link = new /obj/item/computer_hardware/tesla_link/charging_cable(src)
flashlight = new /obj/item/computer_hardware/flashlight(src)
battery_module.charge_to_full()
/obj/item/modular_computer/handheld/wristbound/preset/advanced/cargo
@@ -87,6 +89,7 @@
card_slot = new /obj/item/computer_hardware/card_slot(src)
card_slot.stored_item = new /obj/item/pen
tesla_link = new /obj/item/computer_hardware/tesla_link/charging_cable(src)
flashlight = new /obj/item/computer_hardware/flashlight(src)
battery_module.charge_to_full()
/obj/item/modular_computer/handheld/wristbound/preset/pda/civilian