Skip to content

[DNM] Aneri except I redid the branch again #3620

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

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
fe79efe
Aneri!
Absolucy Sep 30, 2024
5233d86
Remove sorting from init profile
Absolucy Oct 20, 2024
63a0f88
Remove `/proc/sort_overtime_dsc` entirely
Absolucy Oct 20, 2024
54c8914
Merge branch 'master' of https://github.com/Monkestation/Monkestation…
Absolucy Oct 23, 2024
015b265
Update aneri binaries (https://github.com/Absolucy/aneri/actions/runs…
Absolucy Oct 23, 2024
668e289
Merge branch 'master' of https://github.com/Monkestation/Monkestation…
Absolucy Oct 26, 2024
1d9f0e2
Update aneri binaries (https://github.com/Absolucy/aneri/actions/runs…
Absolucy Oct 26, 2024
01f1c95
Merge branch 'master' of https://github.com/Monkestation/Monkestation…
Absolucy Oct 26, 2024
34d8c71
Merge branch 'master' of https://github.com/Monkestation/Monkestation…
Absolucy Nov 3, 2024
2f8f023
Merge branch 'master' of https://github.com/Monkestation/Monkestation…
Absolucy Nov 3, 2024
178e29a
Merge branch 'master' of https://github.com/Monkestation/Monkestation…
Absolucy Nov 5, 2024
624bc41
Merge branch 'master' of https://github.com/Monkestation/Monkestation…
Absolucy Nov 9, 2024
1c57e2d
Merge branch 'master' of https://github.com/Monkestation/Monkestation…
Absolucy Nov 11, 2024
f5d6afa
Merge branch 'master' of https://github.com/Monkestation/Monkestation…
Absolucy Nov 13, 2024
d15a8b2
let's use aneri regex to parse memory stat strings!
Absolucy Nov 13, 2024
b0dbab2
Update aneri binaries
Absolucy Nov 13, 2024
938e031
Add `total_memory` metric
Absolucy Nov 16, 2024
224aca3
Merge branch 'master' of https://github.com/Monkestation/Monkestation…
Absolucy Nov 24, 2024
b32cab1
add `_unix_timestamp` wrapper for chen
Absolucy Nov 24, 2024
7eaaab3
Merge branch 'master' of https://github.com/Monkestation/Monkestation…
Absolucy Nov 27, 2024
435f7c5
Merge branch 'master' of https://github.com/Monkestation/Monkestation…
Absolucy Nov 27, 2024
958c538
Merge branch 'master' of https://github.com/Monkestation/Monkestation…
Absolucy Nov 29, 2024
e387976
Merge branch 'master' of https://github.com/Monkestation/Monkestation…
Absolucy Nov 30, 2024
924bfa8
Use aneri's secure RNG to initialize `Master.random_seed`
Absolucy Nov 30, 2024
8b43f37
Merge branch 'master' of https://github.com/Monkestation/Monkestation…
Absolucy Dec 2, 2024
bc09a69
add meowtonin_stack_trace
Absolucy Dec 2, 2024
bf70234
Merge branch 'master' of https://github.com/Monkestation/Monkestation…
Absolucy Dec 2, 2024
09a2759
Update aneri binaries
Absolucy Dec 2, 2024
cc1aed0
use rewritten byond-memorystats (https://github.com/Absolucy/byond-me…
Absolucy Dec 7, 2024
3065616
Merge branch 'master' of https://github.com/Monkestation/Monkestation…
Absolucy Dec 7, 2024
ada3253
Merge branch 'master' of https://github.com/Monkestation/Monkestation…
Absolucy Dec 19, 2024
229b14c
Merge branch 'master' of https://github.com/Monkestation/Monkestation…
Absolucy Dec 26, 2024
d209e8b
no more aneri-sort + update binaries
Absolucy Dec 26, 2024
ab80886
ngl I forgot that `dependencies.sh` existed
Absolucy Dec 26, 2024
9bfa496
directly use `aneri_unix_timestamp`
Absolucy Dec 26, 2024
f7359b3
more pre-merge cleanup
Absolucy Dec 26, 2024
61116b4
new aneri build: https://github.com/Absolucy/aneri/actions/runs/12508…
Absolucy Dec 26, 2024
e19f70e
Merge branch 'master' of https://github.com/Monkestation/Monkestation…
Absolucy Dec 26, 2024
cf20dba
okay i can finally move `SSmemory_stats` to its own file. also give t…
Absolucy Dec 26, 2024
ccc06bb
Move memstat logs to profiler subfolder
Absolucy Dec 26, 2024
88c7b42
"Mem Stats" -> "Memory Statistics"
Absolucy Dec 26, 2024
be085e1
okay yeah we can rename these, which i forgot to do forever ago
Absolucy Dec 26, 2024
bbd161b
weh
Absolucy Dec 26, 2024
c01b140
okay let's just completely get rid of `sort_cost`
Absolucy Dec 26, 2024
3526574
Merge branch 'master' of https://github.com/Monkestation/Monkestation…
Absolucy Dec 27, 2024
95a1f2d
ah whoops i should just do that
Absolucy Dec 27, 2024
9f9ad94
and that
Absolucy Dec 27, 2024
1fb8e40
Merge branch 'master' of https://github.com/Monkestation/Monkestation…
Absolucy Dec 30, 2024
b54086b
wuh???
Absolucy Dec 30, 2024
cbf71c4
guh??
Absolucy Dec 31, 2024
12ee66d
Merge branch 'master' of https://github.com/Monkestation/Monkestation…
Absolucy Dec 31, 2024
673b963
meow
Absolucy Jan 1, 2025
45b5ad2
Merge branch 'master' of https://github.com/Monkestation/Monkestation…
Absolucy Jan 1, 2025
2816637
whatever
Absolucy Jan 1, 2025
8ff74cf
Merge branch 'master' of https://github.com/Monkestation/Monkestation…
Absolucy Jan 12, 2025
52695c3
Merge branch 'master' of https://github.com/Monkestation/Monkestation…
Absolucy Jan 29, 2025
e924fcb
Merge branch 'master' of https://github.com/Monkestation/Monkestation…
Absolucy Jan 30, 2025
97907ae
Merge branch 'master' of https://github.com/Monkestation/Monkestation…
Absolucy Feb 3, 2025
4c9816d
Merge branch 'master' of https://github.com/Monkestation/Monkestation…
Absolucy Feb 3, 2025
120e806
Merge branch 'master' of https://github.com/Monkestation/Monkestation…
Absolucy Feb 4, 2025
8a3b252
Merge branch 'master' of https://github.com/Monkestation/Monkestation…
Absolucy Feb 16, 2025
a1f5c26
Merge branch 'master' of https://github.com/Monkestation/Monkestation…
Absolucy Feb 19, 2025
b6ec4c5
guh
Absolucy Feb 19, 2025
e8686f4
Merge branch 'master' of https://github.com/Monkestation/Monkestation…
Absolucy Feb 23, 2025
8b962a3
aneri lighting offload prototype (!!! not ready !!!)
Absolucy Feb 23, 2025
9c33c48
Merge branch 'master' of github.com:Monkestation/Monkestation2.0 into…
Absolucy Feb 26, 2025
e4f53d3
Merge branch 'master' of github.com:Monkestation/Monkestation2.0 into…
Absolucy Mar 3, 2025
13b40ec
Merge branch 'master' of github.com:Monkestation/Monkestation2.0 into…
Absolucy Mar 11, 2025
155f0b1
use aneri pick so these have actual randomness
Absolucy Mar 13, 2025
876cabe
Merge branch 'master' of github.com:Monkestation/Monkestation2.0 into…
Absolucy Mar 13, 2025
a650426
Merge branch 'master' of https://github.com/Monkestation/Monkestation…
Absolucy Mar 26, 2025
1e8d62e
move sdql2 thing to monke file
Absolucy Mar 26, 2025
9914c94
revert `asset_list` to use rust-g wrappers, to avoid conflicts with h…
Absolucy Mar 26, 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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -248,3 +248,6 @@ config/dbconfig.txt
# Running OpenDream locally
tgstation.json
rust_g64.dll

!/libmemorystats.so
!/libaneri.so
Binary file added aneri.dll
Binary file not shown.
88 changes: 88 additions & 0 deletions code/__DEFINES/aneri.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
/* This comment bypasses grep checks */ /var/__aneri

/// Uncomment to enable aneri's lighting math offloading
//#define ANERI_LIGHTING

#define ANERI (world.system_type == MS_WINDOWS ? "aneri.dll" : (__aneri ||= __detect_auxtools("aneri")))
#define ANERI_CALL(name, args...) call_ext(ANERI, "byond:" + #name)(args)

// aneri-core
#define aneri_version(...) (ANERI_CALL(aneri_version))
#define aneri_features(...) (ANERI_CALL(aneri_features))
#define aneri_cleanup(...) (ANERI_CALL(cleanup))

// aneri-dmi
#define ANERI_RESIZE_NEAREST "nearest"
#define ANERI_RESIZE_CATMULL "catmull"
#define ANERI_RESIZE_GAUSSIAN "gaussian"
#define ANERI_RESIZE_LANCZOS3 "lanczos3"
#define ANERI_RESIZE_TRIANGLE "triangle"

// aneri-encode
#define aneri_url_encode(data) (ANERI_CALL(url_encode, data))
#define aneri_url_decode(data) (ANERI_CALL(url_decode, data))
#define aneri_hex_decode(data) (ANERI_CALL(hex_decode, data))
#define aneri_base64_encode(data) (ANERI_CALL(base64_encode, data))
#define aneri_base64_decode(data) (ANERI_CALL(base64_decode, data))
#define aneri_base64url_encode(data) (ANERI_CALL(base64url_encode, data))
#define aneri_base64url_decode(data) (ANERI_CALL(base64url_decode, data))

/proc/aneri_hex_encode(data, upper = FALSE)
return ANERI_CALL(hex_encode, data, upper)

// aneri-file
#define aneri_file_exists(path) (ANERI_CALL(file_exists, path))
#define aneri_file_read(path) (ANERI_CALL(file_read, path))
#define aneri_file_write(data, path) (ANERI_CALL(file_write, path, data))
#define aneri_file_append(data, path) (ANERI_CALL(file_append, path, data))
#define aneri_file_get_line_count(path) (ANERI_CALL(file_get_line_count, path))
#define aneri_file_seek_line(path, line) (ANERI_CALL(file_seek_line, path, line))
#define aneri_file_delete(path) (ANERI_CALL(file_delete, path))
#define aneri_mkdir(path) (ANERI_CALL(mkdir, path))
#define aneri_rmdir(path) (ANERI_CALL(rmdir, path))

// aneri-logger
#define aneri_log_write(path, message, format) (ANERI_CALL(log_write, path, message, format))
#define aneri_log_close_all(...) (ANERI_CALL(log_close_all))

// aneri-regex
#define aneri_regex_is_match(regex, haystack) (ANERI_CALL(regex_is_match, regex, haystack))
#define aneri_regex_split(regex, haystack) (ANERI_CALL(regex_split, regex, haystack))
#define aneri_regex_replace(regex, haystack, with) (ANERI_CALL(regex_replace, regex, haystack, with))
#define aneri_regex_replace_all(regex, haystack, with) (ANERI_CALL(regex_replace_all, regex, haystack, with))
#define aneri_regex_find(regex, haystack) (ANERI_CALL(regex_find, regex, haystack))

/proc/aneri_regex_splitn(regex, haystack, limit = 1)
return ANERI_CALL(regex_splitn, regex, haystack, limit)

// aneri-time
#define aneri_unix_timestamp(...) (ANERI_CALL(unix_timestamp))
#define human_readable_timestamp(...) (ANERI_CALL(human_readable_timestamp))

// aneri-util
#define aneri_json_is_valid(json) (ANERI_CALL(json_is_valid, json))
#define aneri_toml_is_valid(toml) (ANERI_CALL(toml_is_valid, toml))
#define aneri_toml_file_is_valid(file) (ANERI_CALL(toml_file_is_valid, "[file]"))

#define aneri_levenshtein(a, b) (ANERI_CALL(levenshtein, a, b))
#define aneri_damerau_levenshtein(a, b) (ANERI_CALL(damerau_levenshtein, a, b))
#define aneri_normalized_levenshtein(a, b) (ANERI_CALL(normalized_levenshtein, a, b))
#define aneri_normalized_damerau_levenshtein(a, b) (ANERI_CALL(normalized_damerau_levenshtein, a, b))
#define aneri_hamming(a, b) (ANERI_CALL(hamming, a, b))

#define aneri_deunicode(string, placeholder) (ANERI_CALL(deunicode, string, placeholder))
#define aneri_toml_decode(toml) (ANERI_CALL(toml_decode, toml))
#define aneri_toml_decode_file(file) (ANERI_CALL(toml_decode_file, "[file]"))

#define aneri_uuid(...) (ANERI_CALL(uuid))
#define aneri_cuid2(...) (ANERI_CALL(cuid2))
#define aneri_cuid2_len(len) (ANERI_CALL(cuid2, len))

// rust-g overrides
#define rustg_file_read(fname) aneri_file_read(fname)
#define rustg_file_exists(fname) aneri_file_exists(fname)
#define rustg_file_write(text, fname) aneri_file_write(text, fname)
#define rustg_file_append(text, fname) aneri_file_append(text, fname)
#define rustg_file_get_line_count(fname) aneri_file_get_line_count(fname)
#define rustg_file_seek_line(fname, line) aneri_file_seek_line(fname, line)
#define rustg_json_is_valid(json) aneri_json_is_valid(json)
7 changes: 4 additions & 3 deletions code/__DEFINES/logging.dm
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@
#define SEND_TEXT(target, text) DIRECT_OUTPUT(target, text)
#define WRITE_FILE(file, text) DIRECT_OUTPUT(file, text)
#define READ_FILE(file, text) DIRECT_INPUT(file, text)
//This is an external call, "true" and "false" are how rust parses out booleans
#define WRITE_LOG(log, text) rustg_log_write(log, text, "true")
#define WRITE_LOG_NO_FORMAT(log, text) rustg_log_write(log, text, "false")
// monkestation edit: replacing rust-g with aneri
#define WRITE_LOG(log, text) aneri_log_write(log, text, TRUE)
#define WRITE_LOG_NO_FORMAT(log, text) aneri_log_write(log, text, FALSE)
// monkestation end
6 changes: 6 additions & 0 deletions code/__DEFINES/rust_g.dm
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@
*/
#define rustg_dmi_icon_states(fname) RUSTG_CALL(RUST_G, "dmi_icon_states")(fname)

/* monkestation edit: replaced by aneri
#define rustg_file_read(fname) RUSTG_CALL(RUST_G, "file_read")(fname)
#define rustg_file_exists(fname) (RUSTG_CALL(RUST_G, "file_exists")(fname) == "true")
#define rustg_file_write(text, fname) RUSTG_CALL(RUST_G, "file_write")(text, fname)
Expand All @@ -160,6 +161,7 @@
#define file2text(fname) rustg_file_read("[fname]")
#define text2file(text, fname) rustg_file_append(text, "[fname]")
#endif
monkestation end */

/// Returns the git hash of the given revision, ex. "HEAD".
#define rustg_git_revparse(rev) RUSTG_CALL(RUST_G, "rg_git_revparse")(rev)
Expand Down Expand Up @@ -288,10 +290,12 @@
#define RUSTG_JOB_NO_SUCH_JOB "NO SUCH JOB"
#define RUSTG_JOB_ERROR "JOB PANICKED"

/* monkestation edit: replaced by aneri
#define rustg_json_is_valid(text) (RUSTG_CALL(RUST_G, "json_is_valid")(text) == "true")

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

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

Expand Down Expand Up @@ -326,13 +330,15 @@
#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]")

/* monkestation edit: replaced by aneri
#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 RUSTG_CALL(RUST_G, "unix_timestamp")()
monkestation end */

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

Expand Down
5 changes: 5 additions & 0 deletions code/__HELPERS/guid.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
* (But may make a nice salt to one)
**/
/proc/GUID()
// monkestation edit: use aneri cuid2 by default
. = aneri_cuid2()
if(.)
return
// monkestation end
var/const/GUID_VERSION = "b"
var/const/GUID_VARIANT = "d"
var/node_id = copytext_char(md5("[rand()*rand(1,9999999)][world.name][world.hub][world.hub_password][world.internet_address][world.address][world.contents.len][world.status][world.port][rand()*rand(1,9999999)]"), 1, 13)
Expand Down
2 changes: 1 addition & 1 deletion code/__HELPERS/logging/_logging.dm
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ GLOBAL_LIST_INIT(testing_global_profiler, list("_PROFILE_NAME" = "Global"))

/* Close open log handles. This should be called as late as possible, and no logging should hapen after. */
/proc/shutdown_logging()
rustg_log_close_all()
aneri_log_close_all() // monkestation edit: aneri
logger.shutdown_logging()

/* Helper procs for building detailed log lines */
Expand Down
8 changes: 6 additions & 2 deletions code/__HELPERS/text.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1181,8 +1181,12 @@ GLOBAL_LIST_INIT(binary, list("0","1"))

/// Removes all non-alphanumerics from the text, keep in mind this can lead to id conflicts
/proc/sanitize_css_class_name(name)
var/static/regex/regex = new(@"[^a-zA-Z0-9]","g")
return replacetext(name, regex, "")
// monkestation start: aneri
var/static/datum/regex/css_regex
if(!css_regex)
css_regex = new (@"[^[:alnum:]]")
return css_regex.replace_all(name, "")
// monkestation end

/// Converts a semver string into a list of numbers
/proc/semver_to_list(semver_string)
Expand Down
29 changes: 29 additions & 0 deletions code/__HELPERS/~monkestation-helpers/bytes.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* Converts a memory size with unit into bytes
*
* Converts a given size and unit into its equivalent in bytes, using binary prefixes
* (1 KB = 1024 bytes). Supports B, KB, MB, and GB units. Units are case-insensitive.
* Numbers are rounded to whole bytes.
*
* Arguments:
* * size - Numeric value to convert (can be integer or floating point)
* * unit - Text unit to convert from ("B", "KB", "MB", or "GB")
*
* Returns: Number of bytes as an integer, or null if input is invalid
*/
/proc/text2bytes(size, unit)
if(!IS_FINITE(size) || !istext(unit))
return null

switch(uppertext(unit))
if("B")
return round(size)
if("KB")
return round(size * 1024)
if("MB")
return round(size * 1024 * 1024)
if("GB")
return round(size * 1024 * 1024 * 1024)
else
return null

4 changes: 0 additions & 4 deletions code/__HELPERS/~monkestation-helpers/cmp.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,3 @@
/// Use when you want a list of most to least severe wounds.
/proc/cmp_wound_severity_dsc(datum/wound/a, datum/wound/b)
return cmp_numeric_dsc(a.severity, b.severity)

/// Used to sort overtime in profiling data.
/proc/sort_overtime_dsc(list/a, list/b)
return b["over"] - a["over"]
9 changes: 5 additions & 4 deletions code/controllers/configuration/configuration.dm
Original file line number Diff line number Diff line change
Expand Up @@ -409,13 +409,14 @@ Example config:
return

log_config("Loading config file word_filter.toml...")
var/list/result = rustg_raw_read_toml_file("[directory]/word_filter.toml")
if(!result["success"])
var/message = "The word filter is not configured correctly! [result["content"]]"
// monkestation edit: aneri
var/list/word_filter = aneri_toml_decode_file("[directory]/word_filter.toml")
if(!islist(word_filter))
var/message = "The word filter is not configured correctly! [word_filter]"
log_config(message)
DelayedMessageAdmins(message)
return
var/list/word_filter = json_decode(result["content"])
// monkestation end

ic_filter_reasons = try_extract_from_word_filter(word_filter, "ic")
ic_outside_pda_filter_reasons = try_extract_from_word_filter(word_filter, "ic_outside_pda")
Expand Down
8 changes: 5 additions & 3 deletions code/controllers/master.dm
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ GLOBAL_REAL(Master, /datum/controller/master)
#ifdef UNIT_TESTS
random_seed = 29051994 // How about 22475?
#else
random_seed = rand(1, 1e9)
random_seed = aneri_rand_uint(secure = TRUE) // monkestation edit: use aneri to initialize rng seed
#endif
rand_seed(random_seed)

Expand Down Expand Up @@ -303,13 +303,15 @@ GLOBAL_REAL(Master, /datum/controller/master)
return

current_initializing_subsystem = subsystem
rustg_time_reset(SS_INIT_TIMER_KEY)
// monkestation start: replace rust_g timer with aneri
var/datum/instant/init_timer = new

var/result = subsystem.Initialize()

// Capture end time
var/time = rustg_time_milliseconds(SS_INIT_TIMER_KEY)
var/time = init_timer.milliseconds()
var/seconds = round(time / 1000, 0.01)
// monkestation end

// Always update the blackbox tally regardless.
SSblackbox.record_feedback("tally", "subsystem_initialize", time, subsystem.name)
Expand Down
2 changes: 1 addition & 1 deletion code/controllers/subsystem/atoms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ SUBSYSTEM_DEF(atoms)
queued_deletions.Cut()

#ifdef PROFILE_MAPLOAD_INIT_ATOM
rustg_file_write(json_encode(mapload_init_times), "[GLOB.log_directory]/init_times.json")
aneri_file_write(json_encode(mapload_init_times), "[GLOB.log_directory]/init_times.json") // monkestation edit: aneri
#endif

/// Actually creates the list of atoms. Exists soley so a runtime in the creation logic doesn't cause initalized to totally break
Expand Down
2 changes: 1 addition & 1 deletion code/controllers/subsystem/job.dm
Original file line number Diff line number Diff line change
Expand Up @@ -837,7 +837,7 @@ SUBSYSTEM_DEF(job)
/datum/controller/subsystem/job/proc/export_toml(mob/user, data)
var/file_location = "data/jobconfig.toml" // store it in the data folder server-side so we can FTP it to the client.
var/payload = "[config_documentation]\n[rustg_toml_encode(data)]"
rustg_file_write(payload, file_location)
aneri_file_write(payload, file_location) // monkestation edit: aneri
DIRECT_OUTPUT(user, ftp(file(file_location), "jobconfig.toml"))
return TRUE

Expand Down
10 changes: 6 additions & 4 deletions code/controllers/subsystem/persistence/counter_delamination.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,17 @@
return
rounds_since_engine_exploded = text2num(file2text(DELAMINATION_COUNT_FILEPATH))
if (fexists(DELAMINATION_HIGHSCORE_FILEPATH))
delam_highscore = text2num(file2text(DELAMINATION_HIGHSCORE_FILEPATH))
delam_highscore = text2num(aneri_file_read(DELAMINATION_HIGHSCORE_FILEPATH)) // monkestation edit: aneri
for (var/obj/machinery/incident_display/sign as anything in GLOB.map_delamination_counters)
sign.update_delam_count(rounds_since_engine_exploded, delam_highscore)


/datum/controller/subsystem/persistence/proc/save_delamination_counter()
rustg_file_write("[rounds_since_engine_exploded + 1]", DELAMINATION_COUNT_FILEPATH)
// monkestation start: aneri
aneri_file_write("[rounds_since_engine_exploded + 1]", DELAMINATION_COUNT_FILEPATH)
if((rounds_since_engine_exploded + 1) > delam_highscore)
rustg_file_write("[rounds_since_engine_exploded + 1]", DELAMINATION_HIGHSCORE_FILEPATH)
aneri_file_write("[rounds_since_engine_exploded + 1]", DELAMINATION_HIGHSCORE_FILEPATH)
// monkestation end


/datum/controller/subsystem/persistence/proc/load_tram_counter()
Expand All @@ -25,7 +27,7 @@
tram_hits_last_round = text2num(file2text(TRAM_COUNT_FILEPATH))

/datum/controller/subsystem/persistence/proc/save_tram_counter()
rustg_file_write("[tram_hits_this_round]", TRAM_COUNT_FILEPATH)
aneri_file_write("[tram_hits_this_round]", TRAM_COUNT_FILEPATH) // monkestation edit: aneri

#undef DELAMINATION_COUNT_FILEPATH
#undef DELAMINATION_HIGHSCORE_FILEPATH
Expand Down
11 changes: 11 additions & 0 deletions code/controllers/subsystem/ticker.dm
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ SUBSYSTEM_DEF(ticker)
/// (monkestation addition) The station integrity at roundend.
var/roundend_station_integrity

/// (monkestation addition) Length of the roundend sound, in deciseconds.
var/round_end_sound_length = 0

/datum/controller/subsystem/ticker/Initialize()
// monkestation start: fix-lobby-music
var/old_login_music = trim(file2text("data/last_round_lobby_music.txt"))
Expand Down Expand Up @@ -617,6 +620,7 @@ SUBSYSTEM_DEF(ticker)
// login_music = SSticker.login_music
//monkestation removal end
round_end_sound = SSticker.round_end_sound
round_end_sound_length = SSticker.round_end_sound_length // monkestation edit: aneri

minds = SSticker.minds

Expand Down Expand Up @@ -759,6 +763,7 @@ SUBSYSTEM_DEF(ticker)
set waitfor = FALSE
round_end_sound_sent = FALSE
round_end_sound = fcopy_rsc(the_sound)
round_end_sound_length = null // monkestation edit: aneri
for(var/thing in GLOB.clients)
var/client/C = thing
if (!C)
Expand Down Expand Up @@ -822,12 +827,18 @@ SUBSYSTEM_DEF(ticker)
update_everything_flag_in_db()
if(!round_end_sound)
round_end_sound = choose_round_end_song()
round_end_sound_length = aneri_audio_length(round_end_sound) // monkestation edit: aneri
///The reference to the end of round sound that we have chosen.
var/sound/end_of_round_sound_ref = sound(round_end_sound)
for(var/mob/M in GLOB.player_list)
if(M.client.prefs.read_preference(/datum/preference/toggle/sound_endofround))
SEND_SOUND(M.client, end_of_round_sound_ref)

// monkestation start: aneri
if(round_end_sound_length)
sleep(min(round_end_sound_length, 10 SECONDS))
// monkestation end

// monkestation removal start: fix-lobby-music
// text2file(login_music, "data/last_round_lobby_music.txt")
// monkestation removal end
Expand Down
10 changes: 5 additions & 5 deletions code/datums/ai_laws/ai_laws.dm
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ GLOBAL_VAR(round_default_lawset)
specified_laws += laws
var/datum/ai_laws/lawtype
if(specified_laws.len)
lawtype = pick(specified_laws)
lawtype = aneri_rand_pick(specified_laws) // monkestation edit: pick -> aneri_rand_pick
else
lawtype = pick(subtypesof(/datum/ai_laws/default))
lawtype = aneri_rand_pick(subtypesof(/datum/ai_laws/default)) // monkestation edit: pick -> aneri_rand_pick

return lawtype
if(CONFIG_CUSTOM)
Expand All @@ -67,9 +67,9 @@ GLOBAL_VAR(round_default_lawset)
randlaws += lpath
var/datum/ai_laws/lawtype
if(randlaws.len)
lawtype = pick(randlaws)
lawtype = aneri_rand_pick(randlaws) // monkestation edit: pick -> aneri_rand_pick
else
lawtype = pick(subtypesof(/datum/ai_laws/default))
lawtype = aneri_rand_pick(subtypesof(/datum/ai_laws/default)) // monkestation edit: pick -> aneri_rand_pick

return lawtype
if(CONFIG_WEIGHTED)
Expand All @@ -82,7 +82,7 @@ GLOBAL_VAR(round_default_lawset)
if(HAS_TRAIT(SSstation, STATION_TRAIT_UNIQUE_AI))
law_weights -= AI_LAWS_ASIMOV
while(!lawtype && law_weights.len)
var/possible_id = pick_weight(law_weights)
var/possible_id = aneri_rand_pick_weighted(law_weights) // monkestation edit: pick_weight -> aneri_rand_pick_weighted
lawtype = lawid_to_type(possible_id)
if(!lawtype)
law_weights -= possible_id
Expand Down
Loading
Loading