Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TTS port fix #7

Closed
wants to merge 40 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
5495a9c
Initial Modularity Support (#1)
PhantornRU Nov 1, 2024
b1da1ae
Modular defines, helpers, signals, singletons (#2)
PhantornRU Nov 1, 2024
80a430e
chat fix for cyr symbs (#3)
PhantornRU Nov 1, 2024
659c432
Update README.md -> DiscordLink
PhantornRU Nov 2, 2024
341862c
TTS initialize port
PhantornRU Nov 2, 2024
2e7d602
world_topic initialize port
PhantornRU Nov 2, 2024
52e8e3a
world topic
PhantornRU Nov 2, 2024
987ecf9
change to paradise tts
PhantornRU Nov 2, 2024
4658ae3
spans, surgery, vv
PhantornRU Nov 2, 2024
8394389
off megaphone and announcer
PhantornRU Nov 2, 2024
2480cca
SHELLEO
PhantornRU Nov 2, 2024
addd6f7
defines clear
PhantornRU Nov 6, 2024
bd3a4ed
pref clear
PhantornRU Nov 6, 2024
78a68fe
Config Get (without config)
PhantornRU Nov 6, 2024
3ff9d70
port rust_utils
PhantornRU Nov 9, 2024
d48abf1
redefines, rerust + sounds channels
PhantornRU Nov 9, 2024
878545a
off donator level
PhantornRU Nov 9, 2024
cae83af
dna remove
PhantornRU Nov 9, 2024
02abb6e
громкость ТТС
PhantornRU Nov 9, 2024
44fbd0e
subsystem fix - volume prefs TTS code
PhantornRU Nov 9, 2024
6cb2dee
remove responce team member tts
PhantornRU Nov 9, 2024
43f1335
remove UpdateAppearance(list/UI)
PhantornRU Nov 9, 2024
c1b3319
config entry string
PhantornRU Nov 10, 2024
52639ce
Copy To
PhantornRU Nov 10, 2024
9962d01
ui, sound, pref saves
PhantornRU Nov 10, 2024
67264d4
preference - remove active character
PhantornRU Nov 10, 2024
8bb3751
flag enabled to SStts220
PhantornRU Nov 10, 2024
7be24f0
replace combine message to treat_tts_message
PhantornRU Nov 10, 2024
970bcb0
TGUI interface add
PhantornRU Nov 10, 2024
9640ef8
TGUI Fix by Aylongo
PhantornRU Nov 11, 2024
714b2bd
vv change tts topic
PhantornRU Nov 11, 2024
0fcdb5e
rust_g move
PhantornRU Nov 11, 2024
38ab4a5
Aylong0 .tsx TGUI interface fix
PhantornRU Nov 17, 2024
120f43b
rust update?
PhantornRU Nov 17, 2024
def5aa2
librust_utils.dll
PhantornRU Nov 17, 2024
e0ec7d1
request silero http test rework
PhantornRU Nov 24, 2024
663c5fd
ttsServer
PhantornRU Nov 24, 2024
c0f6897
SStts220 SS_INIT_SUCCESS
PhantornRU Nov 24, 2024
11f310b
modpack SS_INIT_SUCCESS
PhantornRU Nov 24, 2024
3a296c2
tts fixes
Perohai Jan 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci_suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ jobs:
bash tools/ci/check_filedirs.sh colonialmarines.dme
bash tools/ci/check_changelogs.sh
bash tools/ci/check_grep.sh
bash tools/bandastation_check_grep.sh # BANDASTATION EDIT ADDITION - checking modular code
bash tools/ci/check_misc.sh
tools/bootstrap/python tools/ci/validate_dme.py < colonialmarines.dme
tools/bootstrap/python -m tools.maplint.source --github
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/conflicts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:
types: [ready_for_review, opened, synchronize, reopened]
jobs:
triage:
permissions:
contents: read
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: eps1lon/[email protected]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</p>

<p align="center">
<a href="https://discord.gg/cmss13">
<a href="https://discord.gg/ss220">
<picture>
<source media="(prefers-color-scheme: dark)" srcset=".github/assets/discord-light.png">
<source media="(prefers-color-scheme: light)" srcset=".github/assets/discord-dark.png">
Expand Down
240 changes: 232 additions & 8 deletions code/__DEFINES/__rust_g.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,21 +19,21 @@
/* This comment bypasses grep checks */ /var/__rust_g

/proc/__detect_rust_g()
if (world.system_type == UNIX)
if (fexists("./librust_g.so"))
if(world.system_type == UNIX)
if(fexists("./librust_g.so"))
// No need for LD_LIBRARY_PATH badness.
return __rust_g = "./librust_g.so"
else if (fexists("./rust_g"))
else if(fexists("./rust_g"))
// Old dumb filename.
return __rust_g = "./rust_g"
else if (fexists("[world.GetConfig("env", "HOME")]/.byond/bin/rust_g"))
else if(fexists("[world.GetConfig("env", "HOME")]/.byond/bin/rust_g"))
// Old dumb filename in `~/.byond/bin`.
return __rust_g = "rust_g"
else
// It's not in the current directory, so try others
return __rust_g = "librust_g.so"
else
return __rust_g = "rust_g"
return __rust_g = "rust_g.dll"

#define RUST_G (__rust_g || __detect_rust_g())
#endif
Expand All @@ -45,6 +45,55 @@
#define RUSTG_CALL call
#endif

/// Gets the version of rust_g
/proc/rustg_get_version() return RUSTG_CALL(RUST_G, "get_version")()

// Aho-Corasick Replace //

/**
* Sets up the Aho-Corasick automaton with its default options.
*
* The search patterns list and the replacements must be of the same length when replace is run, but an empty replacements list is allowed if replacements are supplied with the replace call
* Arguments:
* * key - The key for the automaton, to be used with subsequent rustg_acreplace/rustg_acreplace_with_replacements calls
* * patterns - A non-associative list of strings to search for
* * replacements - Default replacements for this automaton, used with rustg_acreplace
*/
#define rustg_setup_acreplace(key, patterns, replacements) RUSTG_CALL(RUST_G, "setup_acreplace")(key, json_encode(patterns), json_encode(replacements))

/**
* Sets up the Aho-Corasick automaton using supplied options.
*
* The search patterns list and the replacements must be of the same length when replace is run, but an empty replacements list is allowed if replacements are supplied with the replace call
* Arguments:
* * key - The key for the automaton, to be used with subsequent rustg_acreplace/rustg_acreplace_with_replacements calls
* * options - An associative list like list("anchored" = 0, "ascii_case_insensitive" = 0, "match_kind" = "Standard"). The values shown on the example are the defaults, and default values may be omitted. See the identically named methods at https://docs.rs/aho-corasick/latest/aho_corasick/struct.AhoCorasickBuilder.html to see what the options do.
* * patterns - A non-associative list of strings to search for
* * replacements - Default replacements for this automaton, used with rustg_acreplace
*/
#define rustg_setup_acreplace_with_options(key, options, patterns, replacements) RUSTG_CALL(RUST_G, "setup_acreplace")(key, json_encode(options), json_encode(patterns), json_encode(replacements))

/**
* Run the specified replacement engine with the provided haystack text to replace, returning replaced text.
*
* Arguments:
* * key - The key for the automaton
* * text - Text to run replacements on
*/
#define rustg_acreplace(key, text) RUSTG_CALL(RUST_G, "acreplace")(key, text)

/**
* Run the specified replacement engine with the provided haystack text to replace, returning replaced text.
*
* Arguments:
* * key - The key for the automaton
* * text - Text to run replacements on
* * replacements - Replacements for this call. Must be the same length as the set-up patterns
*/
#define rustg_acreplace_with_replacements(key, text, replacements) RUSTG_CALL(RUST_G, "acreplace_with_replacements")(key, text, json_encode(replacements))

// Cellular Noise //

/**
* This proc generates a cellular automata noise grid which can be used in procedural generation methods.
*
Expand All @@ -61,9 +110,38 @@
#define rustg_cnoise_generate(percentage, smoothing_iterations, birth_limit, death_limit, width, height) \
RUSTG_CALL(RUST_G, "cnoise_generate")(percentage, smoothing_iterations, birth_limit, death_limit, width, height)

// Grid Perlin Noise //

/**
* This proc generates a grid of perlin-like noise
*
* Returns a single string that goes row by row, with values of 1 representing an turned on cell, and a value of 0 representing a turned off cell.
*
* Arguments:
* * seed: seed for the function
* * accuracy: how close this is to the original perlin noise, as accuracy approaches infinity, the noise becomes more and more perlin-like
* * stamp_size: Size of a singular stamp used by the algorithm, think of this as the same stuff as frequency in perlin noise
* * world_size: size of the returned grid.
* * lower_range: lower bound of values selected for. (inclusive)
* * upper_range: upper bound of values selected for. (exclusive)
*/
#define rustg_dbp_generate(seed, accuracy, stamp_size, world_size, lower_range, upper_range) \
RUSTG_CALL(RUST_G, "dbp_generate")(seed, accuracy, stamp_size, world_size, lower_range, upper_range)


// DMI Operations //

#define rustg_dmi_strip_metadata(fname) RUSTG_CALL(RUST_G, "dmi_strip_metadata")(fname)
#define rustg_dmi_create_png(path, width, height, data) RUSTG_CALL(RUST_G, "dmi_create_png")(path, width, height, data)
#define rustg_dmi_resize_png(path, width, height, resizetype) RUSTG_CALL(RUST_G, "dmi_resize_png")(path, width, height, resizetype)
/**
* input: must be a path, not an /icon; you have to do your own handling if it is one, as icon objects can't be directly passed to rustg.
*
* output: json_encode'd list. json_decode to get a flat list with icon states in the order they're in inside the .dmi
*/
#define rustg_dmi_icon_states(fname) RUSTG_CALL(RUST_G, "dmi_icon_states")(fname)

// File Operations //

#define rustg_file_read(fname) RUSTG_CALL(RUST_G, "file_read")(fname)
#define rustg_file_exists(fname) RUSTG_CALL(RUST_G, "file_exists")(fname)
Expand All @@ -77,9 +155,31 @@
#define text2file(text, fname) rustg_file_append(text, "[fname]")
#endif

// Git Operations //

#define rustg_git_revparse(rev) RUSTG_CALL(RUST_G, "rg_git_revparse")(rev)
#define rustg_git_commit_date(rev) RUSTG_CALL(RUST_G, "rg_git_commit_date")(rev)

// Hashing Functions //

#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)

#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_BASE64 "base64"

#ifdef RUSTG_OVERRIDE_BUILTINS
#define md5(thing) (isfile(thing) ? rustg_hash_file(RUSTG_HASH_MD5, "[thing]") : rustg_hash_string(RUSTG_HASH_MD5, thing))
#endif

// HTTP Operations //

#define RUSTG_HTTP_METHOD_GET "get"
#define RUSTG_HTTP_METHOD_PUT "put"
#define RUSTG_HTTP_METHOD_DELETE "delete"
Expand All @@ -89,18 +189,66 @@
#define rustg_http_request_blocking(method, url, body, headers, options) RUSTG_CALL(RUST_G, "http_request_blocking")(method, url, body, headers, options)
#define rustg_http_request_async(method, url, body, headers, options) RUSTG_CALL(RUST_G, "http_request_async")(method, url, body, headers, options)
#define rustg_http_check_request(req_id) RUSTG_CALL(RUST_G, "http_check_request")(req_id)
/proc/rustg_create_async_http_client() return RUSTG_CALL(RUST_G, "start_http_client")()
/proc/rustg_close_async_http_client() return RUSTG_CALL(RUST_G, "shutdown_http_client")()

// Jobs Defines //

#define RUSTG_JOB_NO_RESULTS_YET "NO RESULTS YET"
#define RUSTG_JOB_NO_SUCH_JOB "NO SUCH JOB"
#define RUSTG_JOB_ERROR "JOB PANICKED"

// JSON Operations //

#define rustg_json_is_valid(text) (RUSTG_CALL(RUST_G, "json_is_valid")(text) == "true")

// Logging Operations //

#define rustg_log_write(fname, text, format) RUSTG_CALL(RUST_G, "log_write")(fname, text, format)
//#define rustg_log_write(fname, text) RUSTG_CALL(RUST_G, "log_write")(fname, text)
/proc/rustg_log_close_all() return RUSTG_CALL(RUST_G, "log_close_all")()

// Noise Operations //

#define rustg_noise_get_at_coordinates(seed, x, y) RUSTG_CALL(RUST_G, "noise_get_at_coordinates")(seed, x, y)

// AStar Operations //

/**
* Register a list of nodes into a rust library. This list of nodes must have been serialized in a json.
* Node {// Index of this node in the list of nodes
* unique_id: usize,
* // Position of the node in byond
* x: usize,
* y: usize,
* z: usize,
* // Indexes of nodes connected to this one
* connected_nodes_id: Vec<usize>}
* It is important that the node with the unique_id 0 is the first in the json, unique_id 1 right after that, etc.
* It is also important that all unique ids follow. {0, 1, 2, 4} is not a correct list and the registering will fail
* Nodes should not link across z levels.
* A node cannot link twice to the same node and shouldn't link itself either
*/
#define rustg_register_nodes_astar(json) RUSTG_CALL(RUST_G, "register_nodes_astar")(json)

/**
* Add a new node to the static list of nodes. Same rule as registering_nodes applies.
* This node unique_id must be equal to the current length of the static list of nodes
*/
#define rustg_add_node_astar(json) RUSTG_CALL(RUST_G, "add_node_astar")(json)

/**²
* Remove every link to the node with unique_id. Replace that node by null
*/
#define rustg_remove_node_astart(unique_id) RUSTG_CALL(RUST_G, "remove_node_astar")(unique_id)

/**
* Compute the shortest path between start_node and goal_node using A*. Heuristic used is simple geometric distance
*/
#define rustg_generate_path_astar(start_node_id, goal_node_id) RUSTG_CALL(RUST_G, "generate_path_astar")(start_node_id, goal_node_id)

// Redis PubSub Operations //

#define RUSTG_REDIS_ERROR_CHANNEL "RUSTG_REDIS_ERROR_CHANNEL"

#define rustg_redis_connect(addr) RUSTG_CALL(RUST_G, "redis_connect")(addr)
Expand All @@ -109,25 +257,75 @@
/proc/rustg_redis_get_messages() return RUSTG_CALL(RUST_G, "redis_get_messages")()
#define rustg_redis_publish(channel, message) RUSTG_CALL(RUST_G, "redis_publish")(channel, message)

/**
* Connects to a given redis server.
*
* Arguments:
* * addr - The address of the server, for example "redis://127.0.0.1/"
*/
#define rustg_redis_connect_rq(addr) RUSTG_CALL(RUST_G, "redis_connect_rq")(addr)
/**
* Disconnects from a previously connected redis server
*/
/proc/rustg_redis_disconnect_rq() return RUSTG_CALL(RUST_G, "redis_disconnect_rq")()
/**
* https://redis.io/commands/lpush/
*
* Arguments
* * key (string) - The key to use
* * elements (list) - The elements to push, use a list even if there's only one element.
*/
#define rustg_redis_lpush(key, elements) RUSTG_CALL(RUST_G, "redis_lpush")(key, json_encode(elements))
/**
* https://redis.io/commands/lrange/
*
* Arguments
* * key (string) - The key to use
* * start (string) - The zero-based index to start retrieving at
* * stop (string) - The zero-based index to stop retrieving at (inclusive)
*/
#define rustg_redis_lrange(key, start, stop) RUSTG_CALL(RUST_G, "redis_lrange")(key, start, stop)
/**
* https://redis.io/commands/lpop/
*
* Arguments
* * key (string) - The key to use
* * count (string|null) - The amount to pop off the list, pass null to omit (thus just 1)
*
* Note: `count` was added in Redis version 6.2.0
*/
#define rustg_redis_lpop(key, count) RUSTG_CALL(RUST_G, "redis_lpop")(key, count)

// SQL Operations //

#define rustg_sql_connect_pool(options) RUSTG_CALL(RUST_G, "sql_connect_pool")(options)
#define rustg_sql_query_async(handle, query, params) RUSTG_CALL(RUST_G, "sql_query_async")(handle, query, params)
#define rustg_sql_query_blocking(handle, query, params) RUSTG_CALL(RUST_G, "sql_query_blocking")(handle, query, params)
#define rustg_sql_connected(handle) RUSTG_CALL(RUST_G, "sql_connected")(handle)
#define rustg_sql_disconnect_pool(handle) RUSTG_CALL(RUST_G, "sql_disconnect_pool")(handle)
#define rustg_sql_check_query(job_id) RUSTG_CALL(RUST_G, "sql_check_query")("[job_id]")

// Time Tracking Functions //

#define rustg_time_microseconds(id) text2num(RUSTG_CALL(RUST_G, "time_microseconds")(id))
#define rustg_time_milliseconds(id) text2num(RUSTG_CALL(RUST_G, "time_milliseconds")(id))
#define rustg_time_reset(id) RUSTG_CALL(RUST_G, "time_reset")(id)

/// Returns the timestamp as a string
/proc/rustg_unix_timestamp()
return text2num(RUSTG_CALL(RUST_G, "unix_timestamp")())
return RUSTG_CALL(RUST_G, "unix_timestamp")()

// Toast Operations //

#define rustg_create_toast(title, body) RUSTG_CALL(RUST_G, "create_toast")(title, body)

// TOML Operations //

#define rustg_raw_read_toml_file(path) json_decode(RUSTG_CALL(RUST_G, "toml_file_to_json")(path) || "null")

/proc/rustg_read_toml_file(path)
var/list/output = rustg_raw_read_toml_file(path)
if (output["success"])
if(output["success"])
return json_decode(output["content"])
else
CRASH(output["content"])
Expand All @@ -136,11 +334,18 @@

/proc/rustg_toml_encode(value)
var/list/output = rustg_raw_toml_encode(value)
if (output["success"])
if(output["success"])
return output["content"]
else
CRASH(output["content"])

// ZIP File Operations //

#define rustg_unzip_download_async(url, unzip_directory) RUSTG_CALL(RUST_G, "unzip_download_async")(url, unzip_directory)
#define rustg_unzip_check(job_id) RUSTG_CALL(RUST_G, "unzip_check")("[job_id]")

// URL Operations //

#define rustg_url_encode(text) RUSTG_CALL(RUST_G, "url_encode")("[text]")
#define rustg_url_decode(text) RUSTG_CALL(RUST_G, "url_decode")(text)

Expand All @@ -149,3 +354,22 @@
#define url_decode(text) rustg_url_decode(text)
#endif

// Worley Noise Operations //

/**
* This proc generates a noise grid using worley noise algorithm
*
* Returns a single string that goes row by row, with values of 1 representing an alive cell, and a value of 0 representing a dead cell.
*
* Arguments:
* * region_size: The size of regions
* * threshold: the value that determines wether a cell is dead or alive
* * node_per_region_chance: chance of a node existiing in a region
* * size: size of the returned grid
* * node_min: minimum amount of nodes in a region (after the node_per_region_chance is applied)
* * node_max: maximum amount of nodes in a region
*/
#define rustg_worley_generate(region_size, threshold, node_per_region_chance, size, node_min, node_max) \
RUSTG_CALL(RUST_G, "worley_generate")(region_size, threshold, node_per_region_chance, size, node_min, node_max)


9 changes: 8 additions & 1 deletion code/__DEFINES/sounds.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
#define VOLUME_AMB 2
#define VOLUME_ADM 3
#define VOLUME_LOBBY 4
#define VOLUME_ANNOUNCEMENT 5
// #define VOLUME_ANNOUNCEMENT 5 // SS220 EDIT - TTS
#define VOLUME_TTS_LOCAL 5 // SS220 EDIT - TTS
#define VOLUME_TTS_RADIO 6 // SS220 EDIT - TTS

#define MUFFLE_LOW -500
#define MUFFLE_MEDIUM -2000
Expand All @@ -31,6 +33,11 @@
#define SOUND_CHANNEL_LOBBY 1023
#define SOUND_CHANNEL_Z 1024

// SS220 ADDITION START
#define CHANNEL_TTS_RADIO 1010
#define CHANNEL_TTS_LOCAL 1009
// SS220 ADDITION END


//default byond sound echo list index positions.
//ECHO_DIRECT and ECHO_ROOM are the only two that actually appear to do anything, and represent the dry and wet channels of the environment effects, respectively.
Expand Down
Loading