mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-30 00:29:02 +01:00
Refactors port types completely and adds the option type. Refactors options to use this new type (#60571)
Co-authored-by: Watermelon914 <3052169-Watermelon914@users.noreply.gitlab.com>
This commit is contained in:
co-authored by
Watermelon914
parent
7d1c9d112b
commit
13296f5f74
@@ -7,6 +7,9 @@
|
||||
display_name = "Radio"
|
||||
desc = "A component that can listen and send frequencies. If set to private, the component will only receive signals from other components attached to circuitboards with the same owner id."
|
||||
|
||||
/// The publicity options. Controls whether it's public or private.
|
||||
var/datum/port/input/option/public_options
|
||||
|
||||
/// Frequency input
|
||||
var/datum/port/input/freq
|
||||
/// Signal input
|
||||
@@ -22,7 +25,7 @@
|
||||
COMP_RADIO_PUBLIC,
|
||||
COMP_RADIO_PRIVATE,
|
||||
)
|
||||
options = component_options
|
||||
public_options = add_option_port("Encryption Options", component_options)
|
||||
|
||||
/obj/item/circuit_component/radio/Initialize()
|
||||
. = ..()
|
||||
@@ -59,7 +62,7 @@
|
||||
if(signal.data["code"] != round(code.input_value || 0))
|
||||
return
|
||||
|
||||
if(current_option == COMP_RADIO_PRIVATE && parent?.owner_id != signal.data["key"])
|
||||
if(public_options.input_value == COMP_RADIO_PRIVATE && parent?.owner_id != signal.data["key"])
|
||||
return
|
||||
|
||||
trigger_output.set_output(COMPONENT_SIGNAL)
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
desc = "A component that emits a sound when it receives an input. The frequency is a multiplier which determines the speed at which the sound is played"
|
||||
circuit_flags = CIRCUIT_FLAG_INPUT_SIGNAL|CIRCUIT_FLAG_OUTPUT_SIGNAL
|
||||
|
||||
/// Sound to play
|
||||
var/datum/port/input/option/sound_file
|
||||
|
||||
/// Volume of the sound when played
|
||||
var/datum/port/input/volume
|
||||
|
||||
@@ -40,7 +43,7 @@
|
||||
COMP_SOUND_WARN,
|
||||
COMP_SOUND_SLOWCLAP,
|
||||
)
|
||||
options = component_options
|
||||
sound_file = add_option_port("Sound Option", component_options)
|
||||
|
||||
var/static/options_to_sound = list(
|
||||
COMP_SOUND_BUZZ = 'sound/machines/buzz-sigh.ogg',
|
||||
@@ -65,7 +68,7 @@
|
||||
if(TIMER_COOLDOWN_CHECK(parent, COOLDOWN_CIRCUIT_SOUNDEMITTER))
|
||||
return
|
||||
|
||||
var/sound_to_play = options_map[current_option]
|
||||
var/sound_to_play = options_map[sound_file.input_value]
|
||||
if(!sound_to_play)
|
||||
return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user