mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-23 21:18:37 +01:00
[MIRROR] Adds USB port to status display [MDB IGNORE] (#11740)
* Adds USB port to status display (#65127) * Adds USB port to status display Co-authored-by: Tastyfish <crazychris32@gmail.com>
This commit is contained in:
@@ -296,6 +296,10 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/status_display/evac, 32)
|
||||
. = ..()
|
||||
// register for radio system
|
||||
SSradio.add_object(src, frequency)
|
||||
// Circuit USB
|
||||
AddComponent(/datum/component/usb_port, list(
|
||||
/obj/item/circuit_component/status_display,
|
||||
))
|
||||
|
||||
/obj/machinery/status_display/evac/Destroy()
|
||||
SSradio.remove_object(src,frequency)
|
||||
@@ -497,6 +501,78 @@ MAPPING_DIRECTIONAL_HELPERS(/obj/machinery/status_display/ai, 32)
|
||||
set_picture(emotion_map[emotion])
|
||||
return PROCESS_KILL
|
||||
|
||||
/obj/item/circuit_component/status_display
|
||||
display_name = "Status Display"
|
||||
desc = "Output text and pictures to a status display."
|
||||
circuit_flags = CIRCUIT_FLAG_INPUT_SIGNAL|CIRCUIT_FLAG_OUTPUT_SIGNAL
|
||||
|
||||
var/datum/port/input/option/command
|
||||
var/datum/port/input/option/picture
|
||||
var/datum/port/input/message1
|
||||
var/datum/port/input/message2
|
||||
|
||||
var/obj/machinery/status_display/connected_display
|
||||
|
||||
var/list/command_map
|
||||
var/list/picture_map
|
||||
|
||||
/obj/item/circuit_component/status_display/populate_ports()
|
||||
message1 = add_input_port("Message 1", PORT_TYPE_STRING)
|
||||
message2 = add_input_port("Message 2", PORT_TYPE_STRING)
|
||||
|
||||
/obj/item/circuit_component/status_display/populate_options()
|
||||
var/static/list/command_options = list(
|
||||
"Blank" = "blank",
|
||||
"Shuttle" = "shuttle",
|
||||
"Message" = "message",
|
||||
"Alert" = "alert"
|
||||
)
|
||||
|
||||
var/static/list/picture_options = list(
|
||||
"Default" = "default",
|
||||
"Red Alert" = "redalert",
|
||||
"Biohazard" = "biohazard",
|
||||
"Lockdown" = "lockdown",
|
||||
"Happy" = "ai_happy",
|
||||
"Neutral" = "ai_neutral",
|
||||
"Very Happy" = "ai_veryhappy",
|
||||
"Sad" = "ai_sad",
|
||||
"Unsure" = "ai_unsure",
|
||||
"Confused" = "ai_confused",
|
||||
"Surprised" = "ai_surprised",
|
||||
"BSOD" = "ai_bsod"
|
||||
)
|
||||
|
||||
command = add_option_port("Command", command_options)
|
||||
command_map = command_options
|
||||
|
||||
picture = add_option_port("Picture", picture_options)
|
||||
picture_map = picture_options
|
||||
|
||||
/obj/item/circuit_component/status_display/register_usb_parent(atom/movable/shell)
|
||||
. = ..()
|
||||
if(istype(shell, /obj/machinery/status_display))
|
||||
connected_display = shell
|
||||
|
||||
/obj/item/circuit_component/status_display/unregister_usb_parent(atom/movable/parent)
|
||||
connected_display = null
|
||||
return ..()
|
||||
|
||||
/obj/item/circuit_component/status_display/input_received(datum/port/input/port)
|
||||
// Just use command handling built into status display.
|
||||
// The option inputs thankfully sanitize command and picture for us.
|
||||
|
||||
var/command_value = command_map[command.value]
|
||||
var/datum/signal/status_signal = new(list("command" = command_value))
|
||||
switch(command_value)
|
||||
if("message")
|
||||
status_signal.data["msg1"] = message1.value
|
||||
status_signal.data["msg2"] = message2.value
|
||||
if("alert")
|
||||
status_signal.data["picture_state"] = picture_map[picture.value]
|
||||
|
||||
connected_display.receive_signal(status_signal)
|
||||
|
||||
#undef CHARS_PER_LINE
|
||||
#undef FONT_SIZE
|
||||
#undef FONT_COLOR
|
||||
|
||||
Reference in New Issue
Block a user