Skip to content

Commit f2d885d

Browse files
authored
bump rust_g to 3.5.0 (#1122)
* bump rust_g to 3.5.0 * forgot
1 parent f29ba4f commit f2d885d

File tree

3 files changed

+97
-4
lines changed

3 files changed

+97
-4
lines changed

code/__DEFINES/rust_g.dm

+96-3
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,23 @@
107107
#define rustg_cnoise_generate(percentage, smoothing_iterations, birth_limit, death_limit, width, height) \
108108
RUSTG_CALL(RUST_G, "cnoise_generate")(percentage, smoothing_iterations, birth_limit, death_limit, width, height)
109109

110+
/**
111+
* This proc generates a grid of perlin-like noise
112+
*
113+
* 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.
114+
*
115+
* Arguments:
116+
* * seed: seed for the function
117+
* * accuracy: how close this is to the original perlin noise, as accuracy approaches infinity, the noise becomes more and more perlin-like
118+
* * stamp_size: Size of a singular stamp used by the algorithm, think of this as the same stuff as frequency in perlin noise
119+
* * world_size: size of the returned grid.
120+
* * lower_range: lower bound of values selected for. (inclusive)
121+
* * upper_range: upper bound of values selected for. (exclusive)
122+
*/
123+
#define rustg_dbp_generate(seed, accuracy, stamp_size, world_size, lower_range, upper_range) \
124+
RUSTG_CALL(RUST_G, "dbp_generate")(seed, accuracy, stamp_size, world_size, lower_range, upper_range)
125+
126+
110127
#define rustg_dmi_strip_metadata(fname) RUSTG_CALL(RUST_G, "dmi_strip_metadata")(fname)
111128
#define rustg_dmi_create_png(path, width, height, data) RUSTG_CALL(RUST_G, "dmi_create_png")(path, width, height, data)
112129
#define rustg_dmi_resize_png(path, width, height, resizetype) RUSTG_CALL(RUST_G, "dmi_resize_png")(path, width, height, resizetype)
@@ -133,10 +150,19 @@
133150
#define rustg_git_revparse(rev) RUSTG_CALL(RUST_G, "rg_git_revparse")(rev)
134151

135152
/**
136-
* Returns the date of the given revision in the format YYYY-MM-DD.
137-
* Returns null if the revision is invalid.
153+
* Returns the date of the given revision using the provided format.
154+
* Defaults to returning %F which is YYYY-MM-DD.
138155
*/
139-
#define rustg_git_commit_date(rev) RUSTG_CALL(RUST_G, "rg_git_commit_date")(rev)
156+
/proc/rustg_git_commit_date(rev, format = "%F")
157+
return RUSTG_CALL(RUST_G, "rg_git_commit_date")(rev, format)
158+
159+
/**
160+
* Returns the formatted datetime string of HEAD using the provided format.
161+
* Defaults to returning %F which is YYYY-MM-DD.
162+
* This is different to rustg_git_commit_date because it only needs the logs directory.
163+
*/
164+
/proc/rustg_git_commit_date_head(format = "%F")
165+
return RUSTG_CALL(RUST_G, "rg_git_commit_date_head")(format)
140166

141167
#define RUSTG_HTTP_METHOD_GET "get"
142168
#define RUSTG_HTTP_METHOD_PUT "put"
@@ -159,6 +185,73 @@
159185

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

188+
/**
189+
* Generates a 2D poisson disk distribution ('blue noise'), which is relatively uniform.
190+
*
191+
* params:
192+
* `seed`: str
193+
* `width`: int, width of the noisemap (see world.maxx)
194+
* `length`: int, height of the noisemap (see world.maxy)
195+
* `radius`: int, distance between points on the noisemap
196+
*
197+
* returns:
198+
* a width*length length string of 1s and 0s representing a 2D poisson sample collapsed into a 1D string
199+
*/
200+
#define rustg_noise_poisson_map(seed, width, length, radius) RUSTG_CALL(RUST_G, "noise_poisson_map")(seed, width, length, radius)
201+
202+
/*
203+
* Takes in a string and json_encode()"d lists to produce a sanitized string.
204+
* This function operates on whitelists, there is currently no way to blacklist.
205+
* Args:
206+
* * text: the string to sanitize.
207+
* * attribute_whitelist_json: a json_encode()'d list of HTML attributes to allow in the final string.
208+
* * tag_whitelist_json: a json_encode()'d list of HTML tags to allow in the final string.
209+
*/
210+
#define rustg_sanitize_html(text, attribute_whitelist_json, tag_whitelist_json) RUSTG_CALL(RUST_G, "sanitize_html")(text, attribute_whitelist_json, tag_whitelist_json)
211+
212+
/// Provided a static RSC file path or a raw text file path, returns the duration of the file in deciseconds as a float.
213+
/proc/rustg_sound_length(file_path)
214+
var/static/list/sound_cache
215+
if(isnull(sound_cache))
216+
sound_cache = list()
217+
218+
. = 0
219+
220+
if(!istext(file_path))
221+
if(!isfile(file_path))
222+
CRASH("rustg_sound_length error: Passed non-text object")
223+
224+
if(length("[file_path]")) // Runtime generated RSC references stringify into 0-length strings.
225+
file_path = "[file_path]"
226+
else
227+
CRASH("rustg_sound_length does not support non-static file refs.")
228+
229+
var/cached_length = sound_cache[file_path]
230+
if(!isnull(cached_length))
231+
return cached_length
232+
233+
var/ret = RUSTG_CALL(RUST_G, "sound_len")(file_path)
234+
var/as_num = text2num(ret)
235+
if(isnull(ret))
236+
. = 0
237+
CRASH("rustg_sound_length error: [ret]")
238+
239+
sound_cache[file_path] = as_num
240+
return as_num
241+
242+
243+
#define RUSTG_SOUNDLEN_SUCCESSES "successes"
244+
#define RUSTG_SOUNDLEN_ERRORS "errors"
245+
/**
246+
* Returns a nested key-value list containing "successes" and "errors"
247+
* The format is as follows:
248+
* list(
249+
* RUSTG_SOUNDLEN_SUCCESES = list("sounds/test.ogg" = 25.34),
250+
* RUSTG_SOUNDLEN_ERRORS = list("sound/bad.png" = "SoundLen: Unable to decode file."),
251+
*)
252+
*/
253+
#define rustg_sound_length_list(file_paths) json_decode(RUSTG_CALL(RUST_G, "sound_len_list")(json_encode(file_paths)))
254+
162255
#define rustg_sql_connect_pool(options) RUSTG_CALL(RUST_G, "sql_connect_pool")(options)
163256
#define rustg_sql_query_async(handle, query, params) RUSTG_CALL(RUST_G, "sql_query_async")(handle, query, params)
164257
#define rustg_sql_query_blocking(handle, query, params) RUSTG_CALL(RUST_G, "sql_query_blocking")(handle, query, params)

dependencies.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export BYOND_MAJOR=515
88
export BYOND_MINOR=1630
99

1010
#rust_g git tag
11-
export RUST_G_VERSION=3.1.0
11+
export RUST_G_VERSION=3.5.0
1212

1313
#node version
1414
export NODE_VERSION=20

rust_g.dll

931 KB
Binary file not shown.

0 commit comments

Comments
 (0)