From 47bb16ee3d961f2dadb3e2197ff25ac8d550ce86 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Sun, 8 Aug 2021 03:41:46 +0200 Subject: [PATCH] [MIRROR] Moves most circuit component defines to files to reduce the amount of scattered code. (#7450) * Moves most circuit defines to files (#60705) Co-authored-by: Watermelon914 <3052169-Watermelon914@ users.noreply.gitlab.com> * Moves most circuit component defines to files to reduce the amount of scattered code. Co-authored-by: Watermelon914 <37270891+Watermelon914@users.noreply.github.com> Co-authored-by: Watermelon914 <3052169-Watermelon914@ users.noreply.gitlab.com> --- code/__DEFINES/wiremod.dm | 56 ------------------- code/game/machinery/computer/security.dm | 14 +++++ .../wiremod/components/action/radio.dm | 6 ++ .../wiremod/components/action/soundemitter.dm | 29 +++------- .../wiremod/components/admin/proccall.dm | 7 +++ .../wiremod/components/hud/bar_overlay.dm | 6 ++ .../wiremod/components/math/arithmetic.dm | 13 +++++ code/modules/wiremod/components/math/logic.dm | 8 +++ .../wiremod/components/string/textcase.dm | 5 ++ .../wiremod/components/utility/delay.dm | 5 ++ .../wiremod/components/utility/typecheck.dm | 6 ++ 11 files changed, 79 insertions(+), 76 deletions(-) diff --git a/code/__DEFINES/wiremod.dm b/code/__DEFINES/wiremod.dm index a27f94a08ed..7bff6f31ac8 100644 --- a/code/__DEFINES/wiremod.dm +++ b/code/__DEFINES/wiremod.dm @@ -61,65 +61,9 @@ #define COMP_COMPARISON_GREATER_THAN_OR_EQUAL ">=" #define COMP_COMPARISON_LESS_THAN_OR_EQUAL "<=" -// Delay defines -/// The minimum delay value that the delay component can have. -#define COMP_DELAY_MIN_VALUE 0.1 - -// Logic defines -#define COMP_LOGIC_AND "AND" -#define COMP_LOGIC_OR "OR" -#define COMP_LOGIC_XOR "XOR" - -// Arithmetic defines -#define COMP_ARITHMETIC_ADD "Add" -#define COMP_ARITHMETIC_SUBTRACT "Subtract" -#define COMP_ARITHMETIC_MULTIPLY "Multiply" -#define COMP_ARITHMETIC_DIVIDE "Divide" -#define COMP_ARITHMETIC_MIN "Minimum" -#define COMP_ARITHMETIC_MAX "Maximum" - -// Text defines -#define COMP_TEXT_LOWER "To Lower" -#define COMP_TEXT_UPPER "To Upper" - -// Typecheck component -#define COMP_TYPECHECK_MOB "organism" -#define COMP_TYPECHECK_HUMAN "humanoid" - // Clock component #define COMP_CLOCK_DELAY 0.9 SECONDS -// Radio component -#define COMP_RADIO_PUBLIC "public" -#define COMP_RADIO_PRIVATE "private" - -// Sound component -#define COMP_SOUND_BUZZ "Buzz" -#define COMP_SOUND_BUZZ_TWO "Buzz Twice" -#define COMP_SOUND_CHIME "Chime" -#define COMP_SOUND_HONK "Honk" -#define COMP_SOUND_PING "Ping" -#define COMP_SOUND_SAD "Sad Trombone" -#define COMP_SOUND_WARN "Warn" -#define COMP_SOUND_SLOWCLAP "Slow Clap" - -// Security Arrest Console -#define COMP_STATE_ARREST "*Arrest*" -#define COMP_STATE_PRISONER "Incarcerated" -#define COMP_STATE_PAROL "Paroled" -#define COMP_STATE_DISCHARGED "Discharged" -#define COMP_STATE_NONE "None" - -#define COMP_SECURITY_ARREST_AMOUNT_TO_FLAG 10 - -// Proccall component -#define COMP_PROC_GLOBAL "Global" -#define COMP_PROC_OBJECT "Object" - -// Bar overlay component -#define COMP_BAR_OVERLAY_VERTICAL "Vertical" -#define COMP_BAR_OVERLAY_HORIZONTAL "Horizontal" - // Shells /// Whether a circuit is stuck on a shell and cannot be removed (by a user) diff --git a/code/game/machinery/computer/security.dm b/code/game/machinery/computer/security.dm index d1f33c8976b..ae1e2c6bd4d 100644 --- a/code/game/machinery/computer/security.dm +++ b/code/game/machinery/computer/security.dm @@ -26,6 +26,13 @@ /obj/item/circuit_component/arrest_console_arrest, )) +#define COMP_STATE_ARREST "*Arrest*" +#define COMP_STATE_PRISONER "Incarcerated" +#define COMP_STATE_PAROL "Paroled" +#define COMP_STATE_DISCHARGED "Discharged" +#define COMP_STATE_NONE "None" +#define COMP_SECURITY_ARREST_AMOUNT_TO_FLAG 10 + /obj/item/circuit_component/arrest_console_data display_name = "Security Records Data" desc = "Outputs the security records data, where it can then be filtered with a Select Query component" @@ -180,6 +187,13 @@ for(var/mob/living/carbon/human/human as anything in GLOB.human_list) human.sec_hud_set_security_status() +#undef COMP_STATE_ARREST +#undef COMP_STATE_PRISONER +#undef COMP_STATE_PAROL +#undef COMP_STATE_DISCHARGED +#undef COMP_STATE_NONE +#undef COMP_SECURITY_ARREST_AMOUNT_TO_FLAG + /obj/machinery/computer/secure_data/syndie icon_keyboard = "syndie_key" diff --git a/code/modules/wiremod/components/action/radio.dm b/code/modules/wiremod/components/action/radio.dm index 7e96f9284c3..341c3adce40 100644 --- a/code/modules/wiremod/components/action/radio.dm +++ b/code/modules/wiremod/components/action/radio.dm @@ -1,3 +1,6 @@ +#define COMP_RADIO_PUBLIC "public" +#define COMP_RADIO_PRIVATE "private" + /** * # Radio Component * @@ -66,3 +69,6 @@ return trigger_output.set_output(COMPONENT_SIGNAL) + +#undef COMP_RADIO_PUBLIC +#undef COMP_RADIO_PRIVATE diff --git a/code/modules/wiremod/components/action/soundemitter.dm b/code/modules/wiremod/components/action/soundemitter.dm index 08730bb3f18..e71049efbd5 100644 --- a/code/modules/wiremod/components/action/soundemitter.dm +++ b/code/modules/wiremod/components/action/soundemitter.dm @@ -34,28 +34,17 @@ /obj/item/circuit_component/soundemitter/populate_options() var/static/component_options = list( - COMP_SOUND_BUZZ, - COMP_SOUND_BUZZ_TWO, - COMP_SOUND_CHIME, - COMP_SOUND_HONK, - COMP_SOUND_PING, - COMP_SOUND_SAD, - COMP_SOUND_WARN, - COMP_SOUND_SLOWCLAP, + "Buzz" = 'sound/machines/buzz-sigh.ogg', + "Buzz Twice" = 'sound/machines/buzz-two.ogg', + "Chime" = 'sound/machines/chime.ogg', + "Honk" = 'sound/items/bikehorn.ogg', + "Ping" = 'sound/machines/ping.ogg', + "Sad Trombone" = 'sound/misc/sadtrombone.ogg', + "Warn" = 'sound/machines/warning-buzzer.ogg', + "Slow Clap" = 'sound/machines/slowclap.ogg', ) sound_file = add_option_port("Sound Option", component_options) - - var/static/options_to_sound = list( - COMP_SOUND_BUZZ = 'sound/machines/buzz-sigh.ogg', - COMP_SOUND_BUZZ_TWO = 'sound/machines/buzz-two.ogg', - COMP_SOUND_CHIME = 'sound/machines/chime.ogg', - COMP_SOUND_HONK = 'sound/items/bikehorn.ogg', - COMP_SOUND_PING = 'sound/machines/ping.ogg', - COMP_SOUND_SAD = 'sound/misc/sadtrombone.ogg', - COMP_SOUND_WARN = 'sound/machines/warning-buzzer.ogg', - COMP_SOUND_SLOWCLAP = 'sound/machines/slowclap.ogg', - ) - options_map = options_to_sound + options_map = component_options /obj/item/circuit_component/soundemitter/input_received(datum/port/input/port) diff --git a/code/modules/wiremod/components/admin/proccall.dm b/code/modules/wiremod/components/admin/proccall.dm index 42b9f0d7f8d..eace8d45f62 100644 --- a/code/modules/wiremod/components/admin/proccall.dm +++ b/code/modules/wiremod/components/admin/proccall.dm @@ -1,3 +1,7 @@ +#define COMP_PROC_GLOBAL "Global" +#define COMP_PROC_OBJECT "Object" + + /** * # Proc Call Component * @@ -63,3 +67,6 @@ GLOB.AdminProcCaller = null output_value.set_output(result) + +#undef COMP_PROC_GLOBAL +#undef COMP_PROC_OBJECT diff --git a/code/modules/wiremod/components/hud/bar_overlay.dm b/code/modules/wiremod/components/hud/bar_overlay.dm index 52245767a32..6a58314e7cc 100644 --- a/code/modules/wiremod/components/hud/bar_overlay.dm +++ b/code/modules/wiremod/components/hud/bar_overlay.dm @@ -1,3 +1,6 @@ +#define COMP_BAR_OVERLAY_VERTICAL "Vertical" +#define COMP_BAR_OVERLAY_HORIZONTAL "Horizontal" + /** * # Bar Overlay Component * @@ -54,3 +57,6 @@ cool_overlay, owner, )) + +#undef COMP_BAR_OVERLAY_VERTICAL +#undef COMP_BAR_OVERLAY_HORIZONTAL diff --git a/code/modules/wiremod/components/math/arithmetic.dm b/code/modules/wiremod/components/math/arithmetic.dm index 61a04a52474..ebc48e5cef3 100644 --- a/code/modules/wiremod/components/math/arithmetic.dm +++ b/code/modules/wiremod/components/math/arithmetic.dm @@ -1,3 +1,10 @@ +#define COMP_ARITHMETIC_ADD "Add" +#define COMP_ARITHMETIC_SUBTRACT "Subtract" +#define COMP_ARITHMETIC_MULTIPLY "Multiply" +#define COMP_ARITHMETIC_DIVIDE "Divide" +#define COMP_ARITHMETIC_MIN "Minimum" +#define COMP_ARITHMETIC_MAX "Maximum" + /** * # Arithmetic Component * @@ -73,3 +80,9 @@ output.set_output(result) +#undef COMP_ARITHMETIC_ADD +#undef COMP_ARITHMETIC_SUBTRACT +#undef COMP_ARITHMETIC_MULTIPLY +#undef COMP_ARITHMETIC_DIVIDE +#undef COMP_ARITHMETIC_MIN +#undef COMP_ARITHMETIC_MAX diff --git a/code/modules/wiremod/components/math/logic.dm b/code/modules/wiremod/components/math/logic.dm index 5b4e8e9b49e..54f6e89ee9e 100644 --- a/code/modules/wiremod/components/math/logic.dm +++ b/code/modules/wiremod/components/math/logic.dm @@ -1,3 +1,7 @@ +#define COMP_LOGIC_AND "AND" +#define COMP_LOGIC_OR "OR" +#define COMP_LOGIC_XOR "XOR" + /** * # Logic Component * @@ -47,3 +51,7 @@ return FALSE if(.) return TRUE + +#undef COMP_LOGIC_AND +#undef COMP_LOGIC_OR +#undef COMP_LOGIC_XOR diff --git a/code/modules/wiremod/components/string/textcase.dm b/code/modules/wiremod/components/string/textcase.dm index 9af54497af9..f8219297c07 100644 --- a/code/modules/wiremod/components/string/textcase.dm +++ b/code/modules/wiremod/components/string/textcase.dm @@ -1,3 +1,6 @@ +#define COMP_TEXT_LOWER "To Lower" +#define COMP_TEXT_UPPER "To Upper" + /** * # Text Component * @@ -47,3 +50,5 @@ output.set_output(result) +#undef COMP_TEXT_LOWER +#undef COMP_TEXT_UPPER diff --git a/code/modules/wiremod/components/utility/delay.dm b/code/modules/wiremod/components/utility/delay.dm index b8ee350490a..79fafa44873 100644 --- a/code/modules/wiremod/components/utility/delay.dm +++ b/code/modules/wiremod/components/utility/delay.dm @@ -1,3 +1,6 @@ +/// The minimum delay value that the delay component can have. +#define COMP_DELAY_MIN_VALUE 0.1 + /** * # Delay Component * @@ -36,3 +39,5 @@ addtimer(CALLBACK(output, /datum/port/output.proc/set_output, trigger.input_value), delay*10) else output.set_output(trigger.input_value) + +#undef COMP_DELAY_MIN_VALUE diff --git a/code/modules/wiremod/components/utility/typecheck.dm b/code/modules/wiremod/components/utility/typecheck.dm index 58b06e537cf..40d039d70d5 100644 --- a/code/modules/wiremod/components/utility/typecheck.dm +++ b/code/modules/wiremod/components/utility/typecheck.dm @@ -1,3 +1,6 @@ +#define COMP_TYPECHECK_MOB "organism" +#define COMP_TYPECHECK_HUMAN "humanoid" + /** * # Typecheck Component * @@ -43,3 +46,6 @@ if(COMP_TYPECHECK_HUMAN) return ishuman(input_val) + +#undef COMP_TYPECHECK_MOB +#undef COMP_TYPECHECK_HUMAN