diff --git a/code/__DEFINES/rust_g.dm b/code/__DEFINES/rust_g.dm index 877d06ed19f..1fb72f050ed 100644 --- a/code/__DEFINES/rust_g.dm +++ b/code/__DEFINES/rust_g.dm @@ -95,6 +95,32 @@ */ #define rustg_acreplace_with_replacements(key, text, replacements) RUSTG_CALL(RUST_G, "acreplace_with_replacements")(key, text, json_encode(replacements)) +/** + * Generates a procedural dungeon map using BSP tree partitioning, prefab placement, + * MST corridor generation, and Cellular Automata smoothing. + * + * Returns a plain binary grid string (matching cellularnoise format): + * A width*height string of '0' (wall) and '1' (floor) characters in row-major order. + * + * Arguments: + * * width - Grid width + * * height - Grid height + * * prefabs_json - JSON array of prefab configs: [{"x":55,"y":65,"w":10,"h":10,"isEnclosed":true},...] (if none use "[]") x = bottom-left turf x, y = bottom-left turf y, w = prefab width, h = prefab height, isEnclosed = whether prefab should be treated like its wall or floor by the generation + * * min_bsp_size - Minimum BSP leaf dimension + * * max_ratio - Maximum aspect ratio for BSP splits + * * padding - Room edge padding within BSP leaf + * * room_fill_percent - How much of each BSP leaf a room fills, 1-100 + * * corridor_width - Width of corridors between rooms + * * loop_percent - Chance to add extra MST edges for loops + * * noise_percent - Initial random floor density + * * ca_steps - Cellular Automata smoothing iterations + * * birth_limit - Neighbors to create floor (>=) + * * survival_limit - Neighbors to survive as floor (>=) + * * edge_is_alive - Whether out-of-bounds cells count as ALIVE (floor) for CA neighbor counts + */ +#define rustg_cave_system_generator_generate(width, height, prefabs_json, min_bsp_size, max_ratio, padding, room_fill_percent, corridor_width, loop_percent, noise_percent, ca_steps, birth_limit, survival_limit, edge_is_alive) \ + RUSTG_CALL(RUST_G, "cave_system_generator_generate")(width, height, prefabs_json, min_bsp_size, max_ratio, padding, room_fill_percent, corridor_width, loop_percent, noise_percent, ca_steps, birth_limit, survival_limit, edge_is_alive) + /** * This proc generates a cellular automata noise grid which can be used in procedural generation methods. * @@ -203,21 +229,70 @@ #define rustg_hash_string(algorithm, text) RUSTG_CALL(RUST_G, "hash_string")(algorithm, text) #define rustg_hash_file(algorithm, fname) RUSTG_CALL(RUST_G, "hash_file")(algorithm, fname) -#define rustg_hash_generate_totp(seed) RUSTG_CALL(RUST_G, "generate_totp")(seed) -#define rustg_hash_generate_totp_tolerance(seed, tolerance) RUSTG_CALL(RUST_G, "generate_totp_tolerance")(seed, tolerance) + +/// Supported algorithms: RUSTG_HASH_SHA1, RUSTG_HASH_SHA256, RUSTG_HASH_SHA512 +/// Seed must be between 10 bytes to 64 bytes (padded or unpadded) of base32. 20 bytes is recommended. Use a CSPRNG. +/// Refresh rate is fixed at 30sec and digit count is fixed at 6 +#define rustg_hash_generate_totp(algorithm, seed) RUSTG_CALL(RUST_G, "generate_totp")(algorithm, seed) +/// Supported algorithms: RUSTG_HASH_SHA1, RUSTG_HASH_SHA256, RUSTG_HASH_SHA512 +/// Seed must be between 10 bytes to 64 bytes (padded or unpadded) of base32. 20 bytes is recommended. Use a CSPRNG. +/// Refresh rate is fixed at 30sec and digit count is fixed at 6 +/// Tolerance is the number of codes +-30sec from the current one that are allowed. +#define rustg_hash_generate_totp_tolerance(algorithm, seed, tolerance) RUSTG_CALL(RUST_G, "generate_totp_tolerance")(algorithm, seed, tolerance) + +/// Creates a cryptographically-secure pseudorandom number generator using the OS-level PRNG as a seed +/// n_bytes is the number of bytes provided to the RNG, the length of the string output varies by format +/// The output string length and characters contained in each format is as follows: +/// RUSTG_RNG_FORMAT_HEX: n_bytes * 2, [a-z0-9] +/// RUSTG_RNG_FORMAT_ALPHANUMERIC: n_bytes, [A-Za-z0-9] +/// RUSTG_RNG_FORMAT_BASE32: ceil(n_bytes / 5 * 8) [A-Z2-7] +/// RUSTG_RNG_FORMAT_BASE32_PADDED: ceil(n_bytes / 5) * 8 [A-Z2-7=] +/// RUSTG_RNG_FORMAT_BASE64: 4 * ceil(n_bytes/3), [A-Za-z0-9+/=] +/// Outputs "ERROR: [reason]" if the format string provided is invalid, or n_bytes is not a positive non-zero integer +#define rustg_csprng_chacha20(format, n_bytes) RUSTG_CALL(RUST_G, "csprng_chacha20")(format, "[n_bytes]") + +/// Creates a seeded pseudorandom number generator using the SHA256 hash output bytes of the seed string +/// Note that this function is NOT suitable for use in cryptography and is intended for high-quality **predictable** RNG +/// Use rustg_csprng_chacha20 for a cryptographically-secure PRNG. +/// n_bytes is the number of bytes provided to the RNG, the length of the string output varies by format +/// The output string length and characters contained in each format is as follows: +/// RUSTG_RNG_FORMAT_HEX: n_bytes * 2, [a-z0-9] +/// RUSTG_RNG_FORMAT_ALPHANUMERIC: n_bytes, [A-Za-z0-9] +/// RUSTG_RNG_FORMAT_BASE32: ceil(n_bytes / 5 * 8) [A-Z2-7] +/// RUSTG_RNG_FORMAT_BASE32_PADDED: ceil(n_bytes / 5) * 8 [A-Z2-7=] +/// RUSTG_RNG_FORMAT_BASE64: 4 * ceil(n_bytes/3), [A-Za-z0-9+/=] +/// Outputs "ERROR: [reason]" if the format string provided is invalid, or n_bytes is not a positive non-zero integer +#define rustg_prng_chacha20_seeded(format, n_bytes, seed) RUSTG_CALL(RUST_G, "prng_chacha20_seeded")(format, "[n_bytes]", seed) + +#define RUSTG_RNG_FORMAT_HEX "hex" +#define RUSTG_RNG_FORMAT_ALPHANUMERIC "alphanumeric" +#define RUSTG_RNG_FORMAT_BASE32 "base32_rfc4648" +#define RUSTG_RNG_FORMAT_BASE32_PADDED "base32_rfc4648_pad" +#define RUSTG_RNG_FORMAT_BASE64 "base64" #define RUSTG_HASH_MD5 "md5" #define RUSTG_HASH_SHA1 "sha1" #define RUSTG_HASH_SHA256 "sha256" #define RUSTG_HASH_SHA512 "sha512" #define RUSTG_HASH_XXH64 "xxh64" +#define RUSTG_HASH_BASE32 "base32_rfc4648" +#define RUSTG_HASH_BASE32_PADDED "base32_rfc4648_pad" #define RUSTG_HASH_BASE64 "base64" /// Encode a given string into base64 #define rustg_encode_base64(str) rustg_hash_string(RUSTG_HASH_BASE64, str) -/// Decode a given base64 string +/// Decode a given base64 string. This expects padding. +/// Returns a blank string if the string is not valid base64. #define rustg_decode_base64(str) RUSTG_CALL(RUST_G, "decode_base64")(str) +/// Encode a given string into base32 (RFC4648) +/// If padding set to FALSE, will not output padding characters. +#define rustg_encode_base32(str, padding) rustg_hash_string(padding ? RUSTG_HASH_BASE32_PADDED : RUSTG_HASH_BASE32, str) +/// Decode a given base32 (RFC4648) string +/// If padding set to FALSE, decoding will not support padding characters. +/// Returns a blank string if the string is not valid base32. +#define rustg_decode_base32(str, padding) RUSTG_CALL(RUST_G, "decode_base32")(str, "[padding ? 1 : 0]") + #ifdef RUSTG_OVERRIDE_BUILTINS #define md5(thing) (isfile(thing) ? rustg_hash_file(RUSTG_HASH_MD5, "[thing]") : rustg_hash_string(RUSTG_HASH_MD5, thing)) #endif @@ -501,3 +576,19 @@ #define url_decode(text) rustg_url_decode(text) #endif +/// Generates a version 4 UUID. +/// See https://www.ietf.org/rfc/rfc9562.html#section-5.4 for specifics on version 4 UUIDs. +#define rustg_generate_uuid_v4(...) RUSTG_CALL(RUST_G, "uuid_v4")() + +/// Generates a version 7 UUID, with the current time. +/// See https://www.ietf.org/rfc/rfc9562.html#section-5.7 for specifics on version 7 UUIDs. +#define rustg_generate_uuid_v7(...) RUSTG_CALL(RUST_G, "uuid_v7")() + +/// Generates a random version 2 CUID. +/// See https://github.com/paralleldrive/cuid2 for specifics on version 2 CUIDs. +#define rustg_generate_cuid2(...) RUSTG_CALL(RUST_G, "cuid2")() + +/// Generates a random version 2 CUID with the given length. +/// See https://github.com/paralleldrive/cuid2 for specifics on version 2 CUIDs. +#define rustg_generate_cuid2_length(length) RUSTG_CALL(RUST_G, "cuid2_len")("[length]") + diff --git a/dependencies.sh b/dependencies.sh index afb9d051292..a1a6dfae227 100644 --- a/dependencies.sh +++ b/dependencies.sh @@ -8,7 +8,7 @@ export BYOND_MAJOR=516 export BYOND_MINOR=1659 #rust_g git tag -export RUST_G_VERSION=4.2.0 +export RUST_G_VERSION=6.2.0 # node version export NODE_VERSION_LTS=22.11.0 diff --git a/icons/map_icons/clothing/_clothing.dmi b/icons/map_icons/clothing/_clothing.dmi index 6a9956844f4..77896621945 100644 Binary files a/icons/map_icons/clothing/_clothing.dmi and b/icons/map_icons/clothing/_clothing.dmi differ diff --git a/icons/map_icons/clothing/accessory.dmi b/icons/map_icons/clothing/accessory.dmi index e4199021545..55df7680741 100644 Binary files a/icons/map_icons/clothing/accessory.dmi and b/icons/map_icons/clothing/accessory.dmi differ diff --git a/icons/map_icons/clothing/head/_head.dmi b/icons/map_icons/clothing/head/_head.dmi index 40a524f88dc..bf12dcac452 100644 Binary files a/icons/map_icons/clothing/head/_head.dmi and b/icons/map_icons/clothing/head/_head.dmi differ diff --git a/icons/map_icons/clothing/head/beret.dmi b/icons/map_icons/clothing/head/beret.dmi index fb920ce8327..56e229a0bad 100644 Binary files a/icons/map_icons/clothing/head/beret.dmi and b/icons/map_icons/clothing/head/beret.dmi differ diff --git a/icons/map_icons/clothing/mask.dmi b/icons/map_icons/clothing/mask.dmi index 2841cb9effc..660a0c22370 100644 Binary files a/icons/map_icons/clothing/mask.dmi and b/icons/map_icons/clothing/mask.dmi differ diff --git a/icons/map_icons/clothing/neck.dmi b/icons/map_icons/clothing/neck.dmi index 3a5094318ef..b95176c3ded 100644 Binary files a/icons/map_icons/clothing/neck.dmi and b/icons/map_icons/clothing/neck.dmi differ diff --git a/icons/map_icons/clothing/shoes.dmi b/icons/map_icons/clothing/shoes.dmi index 6d790cf92eb..8ada1702856 100644 Binary files a/icons/map_icons/clothing/shoes.dmi and b/icons/map_icons/clothing/shoes.dmi differ diff --git a/icons/map_icons/clothing/suit/_suit.dmi b/icons/map_icons/clothing/suit/_suit.dmi index cdbb28e990c..62a890ded65 100644 Binary files a/icons/map_icons/clothing/suit/_suit.dmi and b/icons/map_icons/clothing/suit/_suit.dmi differ diff --git a/icons/map_icons/clothing/suit/costume.dmi b/icons/map_icons/clothing/suit/costume.dmi index b47fc0c68ab..b4cc21296e7 100644 Binary files a/icons/map_icons/clothing/suit/costume.dmi and b/icons/map_icons/clothing/suit/costume.dmi differ diff --git a/icons/map_icons/clothing/under/_under.dmi b/icons/map_icons/clothing/under/_under.dmi index 5fdc8b31664..1ea52de10fa 100644 Binary files a/icons/map_icons/clothing/under/_under.dmi and b/icons/map_icons/clothing/under/_under.dmi differ diff --git a/icons/map_icons/clothing/under/color.dmi b/icons/map_icons/clothing/under/color.dmi index 87189da7548..ec7ae58f833 100644 Binary files a/icons/map_icons/clothing/under/color.dmi and b/icons/map_icons/clothing/under/color.dmi differ diff --git a/icons/map_icons/clothing/under/costume.dmi b/icons/map_icons/clothing/under/costume.dmi index 17e56c8eaa1..da6eaec2611 100644 Binary files a/icons/map_icons/clothing/under/costume.dmi and b/icons/map_icons/clothing/under/costume.dmi differ diff --git a/icons/map_icons/clothing/under/dress.dmi b/icons/map_icons/clothing/under/dress.dmi index 14e11b72a7f..15861b7f358 100644 Binary files a/icons/map_icons/clothing/under/dress.dmi and b/icons/map_icons/clothing/under/dress.dmi differ diff --git a/icons/map_icons/items/_item.dmi b/icons/map_icons/items/_item.dmi index 16535bf205f..6fad912023d 100644 Binary files a/icons/map_icons/items/_item.dmi and b/icons/map_icons/items/_item.dmi differ diff --git a/icons/map_icons/items/encryptionkey.dmi b/icons/map_icons/items/encryptionkey.dmi index 360180773f3..4c6cd37c691 100644 Binary files a/icons/map_icons/items/encryptionkey.dmi and b/icons/map_icons/items/encryptionkey.dmi differ diff --git a/icons/map_icons/items/pda.dmi b/icons/map_icons/items/pda.dmi index c28a9b7043f..40ca680e0f6 100644 Binary files a/icons/map_icons/items/pda.dmi and b/icons/map_icons/items/pda.dmi differ diff --git a/icons/map_icons/mobs.dmi b/icons/map_icons/mobs.dmi index 6a9956844f4..77896621945 100644 Binary files a/icons/map_icons/mobs.dmi and b/icons/map_icons/mobs.dmi differ diff --git a/icons/map_icons/objects.dmi b/icons/map_icons/objects.dmi index dd3a926e2a7..c6f765f81e8 100644 Binary files a/icons/map_icons/objects.dmi and b/icons/map_icons/objects.dmi differ diff --git a/icons/map_icons/turfs.dmi b/icons/map_icons/turfs.dmi index 6a9956844f4..77896621945 100644 Binary files a/icons/map_icons/turfs.dmi and b/icons/map_icons/turfs.dmi differ diff --git a/icons/map_icons/unsorted.dmi b/icons/map_icons/unsorted.dmi index 6a9956844f4..77896621945 100644 Binary files a/icons/map_icons/unsorted.dmi and b/icons/map_icons/unsorted.dmi differ diff --git a/rust_g.dll b/rust_g.dll index 62c8ba24f01..3fafd146ec8 100644 Binary files a/rust_g.dll and b/rust_g.dll differ