mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-23 20:16:55 +01:00
Ports rust_g -> rustlibs: logging, toml, dmi, json, and noisegen (#28858)
* Rustlibs logging, toml, dmi, and dbpnoise * missed one * Hopefully fix logging utf-8 decode errors * Fuck * Build Rust library * ports rust_g json validator * rustlibs_file clippy lint * Build Rust library * fix merge conflict --------- Co-authored-by: paradisess13[bot] <165046124+paradisess13[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
paradisess13[bot] <165046124+paradisess13[bot]@users.noreply.github.com>
parent
4094c80116
commit
5c8ba2ee4e
@@ -131,6 +131,47 @@
|
||||
/proc/mapmanip_read_dmm(mapname)
|
||||
return RUSTLIB_CALL(mapmanip_read_dmm_file, mapname)
|
||||
|
||||
// MARK: TOML
|
||||
/proc/rustlibs_read_toml_file(path)
|
||||
var/list/output = json_decode(RUSTLIB_CALL(toml_file_to_json, path) || "null")
|
||||
if(output["success"])
|
||||
return json_decode(output["content"])
|
||||
else
|
||||
CRASH(output["content"])
|
||||
|
||||
// MARK: Logging
|
||||
/proc/rustlibs_log_write(fname, text)
|
||||
return RUSTLIB_CALL(log_write, fname, text)
|
||||
|
||||
/proc/rustlibs_log_close_all()
|
||||
return RUSTLIB_CALL(log_close_all)
|
||||
|
||||
// MARK: DMI
|
||||
/proc/rustlibs_dmi_strip_metadata(fname)
|
||||
return RUSTLIB_CALL(dmi_strip_metadata, fname)
|
||||
|
||||
// MARK: JSON
|
||||
/proc/rustlibs_json_is_valid(text)
|
||||
return (RUSTLIB_CALL(json_is_valid, text) == "true")
|
||||
|
||||
|
||||
// MARK: 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)
|
||||
*/
|
||||
/proc/rustlibs_dbp_generate(seed, accuracy, stamp_size, world_size, lower_range, upper_range)
|
||||
return RUSTLIB_CALL(dbp_generate, seed, accuracy, stamp_size, world_size, lower_range, upper_range)
|
||||
|
||||
// MARK: Redis
|
||||
#define RUSTLIBS_REDIS_ERROR_CHANNEL "RUSTG_REDIS_ERROR_CHANNEL"
|
||||
|
||||
|
||||
@@ -48,29 +48,6 @@
|
||||
/// Gets the version of rust_g
|
||||
/proc/rustg_get_version() return RUSTG_CALL(RUST_G, "get_version")()
|
||||
|
||||
// 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)
|
||||
|
||||
|
||||
// Git Operations //
|
||||
|
||||
/// Returns the git hash of the given revision, ex. "HEAD".
|
||||
@@ -111,15 +88,6 @@
|
||||
#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) RUSTG_CALL(RUST_G, "log_write")(fname, text)
|
||||
/proc/rustg_log_close_all() return RUSTG_CALL(RUST_G, "log_close_all")()
|
||||
|
||||
// SQL Operations //
|
||||
|
||||
#define rustg_sql_connect_pool(options) RUSTG_CALL(RUST_G, "sql_connect_pool")(options)
|
||||
@@ -132,14 +100,3 @@
|
||||
// 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"])
|
||||
return json_decode(output["content"])
|
||||
else
|
||||
CRASH(output["content"])
|
||||
|
||||
Reference in New Issue
Block a user