mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-17 12:35:26 +00:00
## About The Pull Request It turns out the messenger circuit wasn't working as intended, because list components tend to convert datum keys into weakrefs, creating incoherence between composite datum/atom and simple datum/atom datatypes, which at least just spares us from the headache of clearing the refs on del from lists too. So, taking the shortest path, I decided to adapt the messenger to the weak ref usage. Another thing, instead of refusing altogether to send message that trigger the pda filter regexes, the messenger circuit will instead replace the matches with grawlix, since we have no way to inform whoever's responsible for said message about the filters in an orthodox way. Beside that, I've noticed several of the circuits from my PR were lacking trigger outputs or similar when needed, pretty making them only as half as functional, at least to a noob like me. And another small issue with missing ports from the status display circuit. One more suggestion from moocow is to add a cooldown to the ringtone trigger for the messenger circuit, because he said it's pretty spammy and some admins are fickle. ## Why It's Good For The Game Bugfixing and improvements. ## Changelog 🆑 fix: Fixed the messenger circuit not sending messages. fix: Added several ports to modpc circuits that were missing or needing them. fix: Fixes ever-expanding ports whenever circuits are re-inserted in a modular computer. /🆑
72 lines
2.6 KiB
Plaintext
72 lines
2.6 KiB
Plaintext
/datum/computer_file/program/notepad
|
|
filename = "notepad"
|
|
filedesc = "Notepad"
|
|
downloader_category = PROGRAM_CATEGORY_DEVICE
|
|
program_open_overlay = "generic"
|
|
extended_desc = "Jot down your work-safe thoughts and what not."
|
|
size = 2
|
|
tgui_id = "NtosNotepad"
|
|
program_icon = "book"
|
|
can_run_on_flags = PROGRAM_ALL
|
|
circuit_comp_type = /obj/item/circuit_component/mod_program/notepad
|
|
|
|
var/written_note = "Congratulations on your station upgrading to the new NtOS and Thinktronic based collaboration effort, \
|
|
bringing you the best in electronics and software since 2467!\n\
|
|
To help with navigation, we have provided the following definitions:\n\
|
|
Fore - Toward front of ship\n\
|
|
Aft - Toward back of ship\n\
|
|
Port - Left side of ship\n\
|
|
Starboard - Right side of ship\n\
|
|
Quarter - Either sides of Aft\n\
|
|
Bow - Either sides of Fore"
|
|
|
|
/datum/computer_file/program/notepad/ui_act(action, list/params, datum/tgui/ui, datum/tgui/ui, datum/ui_state/state)
|
|
. = ..()
|
|
switch(action)
|
|
if("UpdateNote")
|
|
written_note = params["newnote"]
|
|
return TRUE
|
|
|
|
/datum/computer_file/program/notepad/ui_data(mob/user)
|
|
var/list/data = list()
|
|
|
|
data["note"] = written_note
|
|
|
|
return data
|
|
|
|
/obj/item/circuit_component/mod_program/notepad
|
|
associated_program = /datum/computer_file/program/notepad
|
|
///When the input is received, the written note will be set to its value.
|
|
var/datum/port/input/set_text
|
|
///The written note output, sent everytime notes are updated.
|
|
var/datum/port/output/updated_text
|
|
///Pinged whenever the text is updated
|
|
var/datum/port/output/updated
|
|
|
|
/obj/item/circuit_component/mod_program/notepad/populate_ports()
|
|
. = ..()
|
|
set_text = add_input_port("Set Notes", PORT_TYPE_STRING)
|
|
updated_text = add_output_port("Notes", PORT_TYPE_STRING)
|
|
updated = add_output_port("Updated", PORT_TYPE_SIGNAL)
|
|
|
|
/obj/item/circuit_component/mod_program/notepad/register_shell(atom/movable/shell)
|
|
. = ..()
|
|
RegisterSignal(associated_program, COMSIG_UI_ACT, PROC_REF(on_note_updated))
|
|
|
|
/obj/item/circuit_component/mod_program/notepad/unregister_shell()
|
|
UnregisterSignal(associated_program, COMSIG_UI_ACT)
|
|
return ..()
|
|
|
|
/obj/item/circuit_component/mod_program/notepad/proc/on_note_updated(datum/source, mob/user, action, list/params)
|
|
SIGNAL_HANDLER
|
|
if(action == "UpdateNote")
|
|
updated_text.set_output(params["newnote"])
|
|
updated.set_output(COMPONENT_SIGNAL)
|
|
|
|
/obj/item/circuit_component/mod_program/notepad/input_received(datum/port/port)
|
|
var/datum/computer_file/program/notepad/pad = associated_program
|
|
pad.written_note = set_text.value
|
|
SStgui.update_uis(pad.computer)
|
|
updated_text.set_output(pad.written_note)
|
|
updated.set_output(COMPONENT_SIGNAL)
|