From bb004c87e37ce22c4b6096e8a4d3537333360609 Mon Sep 17 00:00:00 2001 From: Fikou <23585223+Fikou@users.noreply.github.com> Date: Sat, 5 Jul 2025 01:02:37 +0200 Subject: [PATCH] sdql wrapper for generators and getting list output from generators (#91954) --- code/__HELPERS/generators.dm | 10 ++++++++++ code/modules/admin/verbs/SDQL2/SDQL_2_wrappers.dm | 3 +++ 2 files changed, 13 insertions(+) diff --git a/code/__HELPERS/generators.dm b/code/__HELPERS/generators.dm index 85f6de3a090..7eecc866f85 100644 --- a/code/__HELPERS/generators.dm +++ b/code/__HELPERS/generators.dm @@ -9,3 +9,13 @@ string_repr = copytext(string_repr, 11, length(string_repr)) // strips extraneous data string_repr = replacetext(string_repr, "\"", "") // removes the " around the type return splittext(string_repr, ", ") + +/generator/proc/RandList() + var/possible_vector = Rand() + var/vector_length = length(possible_vector) + if(vector_length == 0) + return possible_vector + . = list() + for(var/i in 1 to vector_length) + . += possible_vector[i] + return . diff --git a/code/modules/admin/verbs/SDQL2/SDQL_2_wrappers.dm b/code/modules/admin/verbs/SDQL2/SDQL_2_wrappers.dm index f7d96506588..5000608f21c 100644 --- a/code/modules/admin/verbs/SDQL2/SDQL_2_wrappers.dm +++ b/code/modules/admin/verbs/SDQL2/SDQL_2_wrappers.dm @@ -289,6 +289,9 @@ /proc/_viewers(Dist, Center = usr) return viewers(Dist, Center) +/proc/_generator(type = "num", A = 0, B = 1, rand = UNIFORM_RAND) + return generator(type, A, B, rand) + /// Auxtools REALLY doesn't know how to handle filters as values; /// when passed as arguments to auxtools-called procs, they aren't simply treated as nulls - /// they don't even count towards the length of args.