forked from BurgerLUA/burgerstation
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
BurgerLua
authored and
BurgerLua
committed
Jul 18, 2020
1 parent
f711cf0
commit 6212a00
Showing
17 changed files
with
276 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
// rust_g.dm - DM API for rust_g extension library | ||
// | ||
// To configure, create a `rust_g.config.dm` and set what you care about from | ||
// the following options: | ||
// | ||
// #define RUST_G "path/to/rust_g" | ||
// Override the .dll/.so detection logic with a fixed path or with detection | ||
// logic of your own. | ||
// | ||
// #define RUSTG_OVERRIDE_BUILTINS | ||
// Enable replacement rust-g functions for certain builtins. Off by default. | ||
|
||
#ifndef RUST_G | ||
// Default automatic RUST_G detection. | ||
// On Windows, looks in the standard places for `rust_g.dll`. | ||
// On Linux, looks in `.`, `$LD_LIBRARY_PATH`, and `~/.byond/bin` for either of | ||
// `librust_g.so` (preferred) or `rust_g` (old). | ||
/proc/__detect_rust_g() | ||
var/static/__rust_g | ||
. = __rust_g | ||
if (!.) | ||
if (world.system_type == UNIX) | ||
if (fexists("./librust_g.so")) | ||
// No need for LD_LIBRARY_PATH badness. | ||
. = __rust_g = "./librust_g.so" | ||
else if (fexists("./rust_g")) | ||
// Old dumb filename. | ||
. = __rust_g = "./rust_g" | ||
else if (fexists("[world.GetConfig("env", "HOME")]/.byond/bin/rust_g")) | ||
// Old dumb filename in `~/.byond/bin`. | ||
. = __rust_g = "rust_g" | ||
else | ||
// It's not in the current directory, so try others | ||
. = __rust_g = "librust_g.so" | ||
else | ||
. = __rust_g = "rust_g" | ||
|
||
#define RUST_G __detect_rust_g() | ||
#endif | ||
|
||
#define RUSTG_JOB_NO_RESULTS_YET "NO RESULTS YET" | ||
#define RUSTG_JOB_NO_SUCH_JOB "NO SUCH JOB" | ||
#define RUSTG_JOB_ERROR "JOB PANICKED" | ||
|
||
#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_noise_get_at_coordinates(seed, x, y) call(RUST_G, "noise_get_at_coordinates")(seed, x, y) | ||
|
||
#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_log_write(fname, text, format) call(RUST_G, "log_write")(fname, text, format) | ||
/proc/rustg_log_close_all() return call(RUST_G, "log_close_all")() | ||
|
||
#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_check_request(req_id) call(RUST_G, "http_check_request")(req_id) | ||
|
||
#define rustg_sql_connect_pool(options) call(RUST_G, "sql_connect_pool")(options) | ||
#define rustg_sql_query_async(handle, query, params) call(RUST_G, "sql_query_async")(handle, query, params) | ||
#define rustg_sql_query_blocking(handle, query, params) call(RUST_G, "sql_query_blocking")(handle, query, params) | ||
#define rustg_sql_connected(handle) call(RUST_G, "sql_connected")(handle) | ||
#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]") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/obj/marker/generation | ||
name = "generation marker" | ||
|
||
var/obj/object_to_place | ||
|
||
var/turf/list/valid_turfs = list() | ||
var/turf/list/forbidden_turfs = list() | ||
|
||
var/grow_amount_min = 2 | ||
var/grow_amount_max = 10 | ||
|
||
var/fade_chance = 10 | ||
|
||
initialize_type = INITIALIZE_EARLY | ||
|
||
/obj/marker/generation/proc/grow() | ||
|
||
for(var/turf/T in valid_turfs) | ||
valid_turfs -= T | ||
var/atom/movable/M = locate(object_to_place) in T.contents | ||
if(M) continue | ||
new object_to_place(T) | ||
for(var/k in DIRECTIONS_ALL) | ||
var/turf/T2 = get_step(T,k) | ||
if(T2.type != T.type) | ||
continue | ||
if(prob(fade_chance)) | ||
forbidden_turfs[T2] = TRUE | ||
else if(!length(forbidden_turfs) || !forbidden_turfs[T2]) | ||
valid_turfs += T2 | ||
|
||
/obj/marker/generation/Initialize() | ||
|
||
var/desired_grow = rand(grow_amount_min,grow_amount_max) | ||
|
||
valid_turfs += get_turf(src) | ||
|
||
while(desired_grow > 0) | ||
desired_grow-- | ||
grow() | ||
|
||
. = ..() | ||
|
||
qdel(src) | ||
|
||
return . | ||
|
||
|
||
/obj/marker/generation/grass | ||
object_to_place = /obj/structure/scenery/grass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ var/global/world_state = STATE_STARTING | |
loop_checks = 0 | ||
|
||
/world/New() | ||
__detect_rust_g() | ||
..() | ||
life() | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.