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

update #2

Open
wants to merge 8 commits into
base: chungus
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions burgerstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@
#include "code\_core\client\movement.dm"
#include "code\_core\client\topic.dm"
#include "code\_core\client\varedit.dm"
#include "code\_core\client\View-Variables.dm"
#include "code\_core\client\window.dm"
#include "code\_core\client\chat\_chat.dm"
#include "code\_core\client\chat\formatting.dm"
Expand Down Expand Up @@ -1044,6 +1045,7 @@
#include "code\_core\obj\item\clothing\feet\shoes\workboots.dm"
#include "code\_core\obj\item\clothing\feet\shoes\halo\elite.dm"
#include "code\_core\obj\item\clothing\feet\shoes\halo\halo_human.dm"
#include "code\_core\obj\item\clothing\feet\shoes\halo\spartan.dm"
#include "code\_core\obj\item\clothing\feet\socks\_socks.dm"
#include "code\_core\obj\item\clothing\glasses\_glasses.dm"
#include "code\_core\obj\item\clothing\glasses\blindfold.dm"
Expand All @@ -1066,6 +1068,7 @@
#include "code\_core\obj\item\clothing\hands\gloves\gladiator.dm"
#include "code\_core\obj\item\clothing\hands\gloves\tutorial.dm"
#include "code\_core\obj\item\clothing\hands\gloves\halo\elite.dm"
#include "code\_core\obj\item\clothing\hands\gloves\halo\spartan.dm"
#include "code\_core\obj\item\clothing\hats\helmet\_helmet.dm"
#include "code\_core\obj\item\clothing\hats\light\_light.dm"
#include "code\_core\obj\item\clothing\head\_head.dm"
Expand Down Expand Up @@ -1110,6 +1113,7 @@
#include "code\_core\obj\item\clothing\head\helmet\full\swat.dm"
#include "code\_core\obj\item\clothing\head\helmet\halo\insurrection.dm"
#include "code\_core\obj\item\clothing\head\helmet\halo\marine.dm"
#include "code\_core\obj\item\clothing\head\helmet\halo\spartan.dm"
#include "code\_core\obj\item\clothing\head\helmet\halo\covenant\elite.dm"
#include "code\_core\obj\item\clothing\head\helmet\hardsuit\_hardsuit.dm"
#include "code\_core\obj\item\clothing\head\helmet\hardsuit\cult.dm"
Expand Down Expand Up @@ -1164,6 +1168,7 @@
#include "code\_core\obj\item\clothing\overwear\armor\xeno_armor.dm"
#include "code\_core\obj\item\clothing\overwear\armor\halo\insurrection.dm"
#include "code\_core\obj\item\clothing\overwear\armor\halo\marine.dm"
#include "code\_core\obj\item\clothing\overwear\armor\halo\spartan.dm"
#include "code\_core\obj\item\clothing\overwear\armor\halo\covenant\elite.dm"
#include "code\_core\obj\item\clothing\overwear\armor\halo\covenant\kigyar.dm"
#include "code\_core\obj\item\clothing\overwear\armor\halo\covenant\unggoy.dm"
Expand Down Expand Up @@ -1237,6 +1242,7 @@
#include "code\_core\obj\item\clothing\uniform\halo\kigyar.dm"
#include "code\_core\obj\item\clothing\uniform\halo\marine.dm"
#include "code\_core\obj\item\clothing\uniform\halo\odst.dm"
#include "code\_core\obj\item\clothing\uniform\halo\spartan.dm"
#include "code\_core\obj\item\clothing\uniform\halo\unggoy.dm"
#include "code\_core\obj\item\clothing\uniform\halo\unsc_captain.dm"
#include "code\_core\obj\item\coin\_coin.dm"
Expand Down
91 changes: 70 additions & 21 deletions code/__defines/_rust_g.dm
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,52 @@
#define RUST_G (__rust_g || __detect_rust_g())
#endif

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


/**
* 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) 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) 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) 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) call(RUST_G, "acreplace_with_replacements")(key, text, json_encode(replacements))

/**
* This proc generates a cellular automata noise grid which can be used in procedural generation methods.
*
Expand All @@ -52,45 +98,35 @@
* * height: The height of the grid.
*/
#define rustg_cnoise_generate(percentage, smoothing_iterations, birth_limit, death_limit, width, height) \
call(RUST_G, "cnoise_generate")(percentage, smoothing_iterations, birth_limit, death_limit, width, height)
call(RUST_G, "cnoise_generate")(percentage, smoothing_iterations, birth_limit, death_limit, width, height)

#define rustg_dmi_strip_metadata(fname) call(RUST_G, "dmi_strip_metadata")(fname)
#define rustg_dmi_create_png(path, width, height, data) call(RUST_G, "dmi_create_png")(path, width, height, data)
#define rustg_dmi_resize_png(path, width, height, resizetype) call(RUST_G, "dmi_resize_png")(path, width, height, resizetype)

#define rustg_file_read(fname) call(RUST_G, "file_read")(fname)
// #define rustg_file_exists(fname) call(RUST_G, "file_exists")(fname) THIS DOESN'T WORK
#define rustg_file_exists(fname) call(RUST_G, "file_exists")(fname)
#define rustg_file_write(text, fname) call(RUST_G, "file_write")(text, fname)
#define rustg_file_append(text, fname) call(RUST_G, "file_append")(text, fname)
#define rustg_file_get_line_count(fname) text2num(call(RUST_G, "file_get_line_count")(fname))
#define rustg_file_seek_line(fname, line) call(RUST_G, "file_seek_line")(fname, "[line]")

#ifdef RUSTG_OVERRIDE_BUILTINS
#define file2text(fname) rustg_file_read("[fname]")
#define text2file(text, fname) rustg_file_append(text, "[fname]")
#define file2text(fname) rustg_file_read("[fname]")
#define text2file(text, fname) rustg_file_append(text, "[fname]")
#endif

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

#define rustg_hash_string(algorithm, text) call(RUST_G, "hash_string")(algorithm, text)
#define rustg_hash_file(algorithm, fname) call(RUST_G, "hash_file")(algorithm, fname)

#define RUSTG_HASH_MD5 "md5"
#define RUSTG_HASH_SHA1 "sha1"
#define RUSTG_HASH_SHA256 "sha256"
#define RUSTG_HASH_SHA512 "sha512"

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

#define RUSTG_HTTP_METHOD_GET "get"
#define RUSTG_HTTP_METHOD_PUT "put"
#define RUSTG_HTTP_METHOD_DELETE "delete"
#define RUSTG_HTTP_METHOD_PATCH "patch"
#define RUSTG_HTTP_METHOD_HEAD "head"
#define RUSTG_HTTP_METHOD_POST "post"
#define rustg_http_request_blocking(method, url, body, headers) call(RUST_G, "http_request_blocking")(method, url, body, headers)
#define rustg_http_request_async(method, url, body, headers) call(RUST_G, "http_request_async")(method, url, body, headers)
#define rustg_http_request_blocking(method, url, body, headers, options) call(RUST_G, "http_request_blocking")(method, url, body, headers, options)
#define rustg_http_request_async(method, url, body, headers, options) call(RUST_G, "http_request_async")(method, url, body, headers, options)
#define rustg_http_check_request(req_id) call(RUST_G, "http_check_request")(req_id)

#define RUSTG_JOB_NO_RESULTS_YET "NO RESULTS YET"
Expand All @@ -111,11 +147,24 @@
#define rustg_sql_disconnect_pool(handle) call(RUST_G, "sql_disconnect_pool")(handle)
#define rustg_sql_check_query(job_id) call(RUST_G, "sql_check_query")("[job_id]")

#define rustg_url_encode(text) call(RUST_G, "url_encode")(text)
#define rustg_time_microseconds(id) text2num(call(RUST_G, "time_microseconds")(id))
#define rustg_time_milliseconds(id) text2num(call(RUST_G, "time_milliseconds")(id))
#define rustg_time_reset(id) call(RUST_G, "time_reset")(id)

#define rustg_raw_read_toml_file(path) json_decode(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 output["content"]
else
CRASH(output["content"])

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

#ifdef RUSTG_OVERRIDE_BUILTINS
#define url_encode(text) rustg_url_encode(text)
#define url_decode(text) rustg_url_decode(text)
#define url_encode(text) rustg_url_encode(text)
#define url_decode(text) rustg_url_decode(text)
#endif

4 changes: 3 additions & 1 deletion code/__defines/liberation.dm
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#define LIBERATION_DELAY_WAIT 120
#define LIBERATION_DELAY_WAIT 10
#define LIBERATION_DELAY_GEARING 120
#define LIBERATION_DELAY_BOARDING 10
#define LIBERATION_DELAY_LAUNCHING 120
5 changes: 4 additions & 1 deletion code/__helpers/name.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,7 @@
#define FIRST_NAME_SANG (pick(SStext.first_sangheili))
#define LAST_NAME_SANG (pick(SStext.last_sangheili))
#define JACK (pick(SStext.first_kigyar))
#define UNGG (pick(SStext.first_unggoy))
#define UNGG (pick(SStext.first_unggoy))
//spartan
#define FIRST_NAME_SPARTAN (pick(SStext.first_spartan))
#define LAST_NAME_SPARTAN (pick(SStext.last_spartan))
5 changes: 5 additions & 0 deletions code/__helpers/text.dm
Original file line number Diff line number Diff line change
Expand Up @@ -163,3 +163,8 @@

/proc/proper_url_encode(var/input)
return url_encode(replacetextEx(input,"\n",""))

// Used to get a sanitized input.
/proc/stripped_input(var/mob/user, var/message = "", var/title = "", var/default = "", var/max_length=MAX_MESSAGE_LEN)
var/name = input(user, message, title, default) as text|null
return html_encode(trim(name, max_length))
Loading