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 08:12:51 +02:00
committed by GitHub
parent 566b624d53
commit 44664fc90d
30 changed files with 351 additions and 69 deletions
@@ -13,6 +13,19 @@
var/damage_failure = 50 // "Failure" threshold. When damage exceeds this value the hardware piece will not work at all.
var/malfunction_probability = 10 // Chance of malfunction when the component is damaged
// Default handling of hardware enable/disable. Override for specific functionality.
/obj/item/computer_hardware/proc/enable()
. = enabled = TRUE
/obj/item/computer_hardware/proc/disable()
. = enabled = FALSE
/obj/item/computer_hardware/proc/toggle()
if(enabled)
return disable()
return enable()
/obj/item/computer_hardware/attackby(obj/item/W, mob/living/user)
// Multitool. Runs diagnostics
if(W.ismultitool())
@@ -0,0 +1,35 @@
/obj/item/computer_hardware/flashlight
name = "flashlight"
desc = "A small pen-sized flashlight used to illuminate a small area."
icon = 'icons/obj/lighting.dmi'
icon_state = "headlights"
power_usage = 50
enabled = FALSE
critical = FALSE
var/range = 2
var/power = 1
var/flashlight_color = LIGHT_COLOR_HALOGEN
/obj/item/computer_hardware/flashlight/enable()
. = ..()
if(parent_computer)
parent_computer.light_range = range
parent_computer.light_power = power
tweak_light(parent_computer)
/obj/item/computer_hardware/flashlight/disable()
. = ..()
if(parent_computer)
parent_computer.light_range = initial(parent_computer.light_range)
parent_computer.light_power = initial(parent_computer.light_power)
tweak_light(parent_computer)
/obj/item/computer_hardware/flashlight/proc/tweak_brightness(var/new_power)
. = power = Clamp(0, new_power, 1)
parent_computer.light_power = power
tweak_light(parent_computer)
/obj/item/computer_hardware/flashlight/proc/tweak_light(var/obj/item/modular_computer/C)
if(!istype(C))
return
C.set_light(C.light_range, C.light_power, l_color = flashlight_color)
@@ -29,7 +29,7 @@
deactivate()
return ..()
/obj/item/computer_hardware/tesla_link/charging_cable/proc/toggle(var/obj/machinery/power/power_source, mob/user)
/obj/item/computer_hardware/tesla_link/charging_cable/toggle(var/obj/machinery/power/power_source, mob/user)
if(!source)
if(in_range(power_source, src))
to_chat(user, SPAN_NOTICE("You connect \the [src] to \the [power_source]."))