mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-06-17 20:23:21 +01:00
a24c6f260f
* Fixed cooldowns for speech and soundemitter circuit components. Brought speech component more in line with other components. (#59958) Fixes to the cooldowns. Also circuits now use an input trigger/output trigger system which the speech component hadn't yet adopted because it was made before that system was introduced and left out when changing most components to use this system. Also temporarily disables input/output signal ports for the prebuilt speech relay circuit until I can properly code in a way to load circuits. * Fixed cooldowns for speech and soundemitter circuit components. Brought speech component more in line with other components. Co-authored-by: Watermelon914 <37270891+Watermelon914@users.noreply.github.com>
46 lines
1.2 KiB
Plaintext
46 lines
1.2 KiB
Plaintext
/**
|
|
* # Speech Component
|
|
*
|
|
* Sends a message. Requires a shell.
|
|
*/
|
|
/obj/item/circuit_component/speech
|
|
display_name = "Speech"
|
|
display_desc = "A component that sends a message. Requires a shell."
|
|
circuit_flags = CIRCUIT_FLAG_INPUT_SIGNAL|CIRCUIT_FLAG_OUTPUT_SIGNAL
|
|
|
|
/// The message to send
|
|
var/datum/port/input/message
|
|
|
|
/// The cooldown for this component of how often it can send speech messages.
|
|
var/speech_cooldown = 1 SECONDS
|
|
|
|
/obj/item/circuit_component/speech/get_ui_notices()
|
|
. = ..()
|
|
. += create_ui_notice("Speech Cooldown: [DisplayTimeText(speech_cooldown)]", "orange", "stopwatch")
|
|
|
|
/obj/item/circuit_component/speech/Initialize()
|
|
. = ..()
|
|
message = add_input_port("Message", PORT_TYPE_STRING, FALSE)
|
|
|
|
|
|
/obj/item/circuit_component/speech/Destroy()
|
|
message = null
|
|
return ..()
|
|
|
|
/obj/item/circuit_component/speech/input_received(datum/port/input/port)
|
|
. = ..()
|
|
if(.)
|
|
return
|
|
|
|
if(TIMER_COOLDOWN_CHECK(parent, COOLDOWN_CIRCUIT_SPEECH))
|
|
return
|
|
|
|
if(message.input_value)
|
|
var/atom/movable/shell = parent.shell
|
|
// Prevents appear as the individual component if there is a shell.
|
|
if(shell)
|
|
shell.say(message.input_value)
|
|
else
|
|
say(message.input_value)
|
|
TIMER_COOLDOWN_START(parent, COOLDOWN_CIRCUIT_SPEECH, speech_cooldown)
|