From 387ff4e816871a21cdd966a99724068f25ed5636 Mon Sep 17 00:00:00 2001 From: EliteMasterEric Date: Fri, 2 Feb 2024 22:38:34 -0500 Subject: [PATCH] Replace multiple conditions with array. --- source/funkin/data/event/SongEventSchema.hx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/source/funkin/data/event/SongEventSchema.hx b/source/funkin/data/event/SongEventSchema.hx index ca63f62f8..9591e601e 100644 --- a/source/funkin/data/event/SongEventSchema.hx +++ b/source/funkin/data/event/SongEventSchema.hx @@ -9,6 +9,11 @@ import funkin.play.event.ScriptedSongEvent; @:forward(name, title, type, keys, min, max, step, units, defaultValue, iterator) abstract SongEventSchema(SongEventSchemaRaw) { + /** + * These units look better when placed immediately next to the value, rather than after a space. + */ + static final NO_SPACE_UNITS:Array = ['x', '°', '%']; + public function new(?fields:Array) { this = fields; @@ -80,10 +85,7 @@ abstract SongEventSchema(SongEventSchemaRaw) var unit:String = field.units; - // These units look better when placed immediately next to the value, rather than after a space. - if (unit == 'x' || unit == '°' || unit == '%') return value + '${unit}'; - - return value + ' ${unit}'; + return value + (NO_SPACE_UNITS.contains(unit) ? '' : ' ') + '${unit}'; } }