Skip to content

Commit

Permalink
Merge remote-tracking branch 'Upstream/master' into vending-QOL
Browse files Browse the repository at this point in the history
  • Loading branch information
Tsar-Salat committed Jan 7, 2024
2 parents ff3786f + 87794d6 commit 2047b39
Show file tree
Hide file tree
Showing 74 changed files with 1,035 additions and 371 deletions.
8 changes: 7 additions & 1 deletion SQL/beestation_schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,12 @@ CREATE TABLE IF NOT EXISTS `SS13_characters` (
`joblessrole` TINYINT(4) UNSIGNED,
`job_preferences` MEDIUMTEXT COLLATE 'utf8mb4_general_ci',
`all_quirks` MEDIUMTEXT COLLATE 'utf8mb4_general_ci',
`quirk_prosthetic_limb_location` VARCHAR(64) COLLATE 'utf8mb4_general_ci',
`quirk_phobia` VARCHAR(64) COLLATE 'utf8mb4_general_ci',
`quirk_multilingual_language` VARCHAR(64) COLLATE 'utf8mb4_general_ci',
`quirk_smoker_cigarettes` VARCHAR(64) COLLATE 'utf8mb4_general_ci',
`quirk_junkie_drug` VARCHAR(64) COLLATE 'utf8mb4_general_ci',
`quirk_alcohol_type` VARCHAR(64) COLLATE 'utf8mb4_general_ci',
`equipped_gear` MEDIUMTEXT COLLATE 'utf8mb4_general_ci',
`role_preferences` MEDIUMTEXT COLLATE 'utf8mb4_general_ci',
`randomize` MEDIUMTEXT COLLATE 'utf8mb4_general_ci',
Expand Down Expand Up @@ -491,7 +497,7 @@ CREATE TABLE IF NOT EXISTS `SS13_schema_revision` (
`date` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`major`,`minor`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
INSERT INTO `SS13_schema_revision` (`major`, `minor`) VALUES (7, 0);
INSERT INTO `SS13_schema_revision` (`major`, `minor`) VALUES (7, 2);



Expand Down
22 changes: 19 additions & 3 deletions SQL/database_changelog.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,29 @@
Any time you make a change to the schema files, remember to increment the database schema version. Generally increment the minor number, major should be reserved for significant changes to the schema. Both values go up to 255.

The latest database version is 7.1; The query to update the schema revision table is:
The latest database version is 7.2; The query to update the schema revision table is:

INSERT INTO `schema_revision` (`major`, `minor`) VALUES (7, 1);
INSERT INTO `schema_revision` (`major`, `minor`) VALUES (7, 2);
or
INSERT INTO `SS13_schema_revision` (`major`, `minor`) VALUES (7, 1);
INSERT INTO `SS13_schema_revision` (`major`, `minor`) VALUES (7, 2);

In any query remember to add a prefix to the table names if you use one.


-----------------------------------------------------

-----------------------------------------------------

Version 7.2, 20 December 2023, by that0neperson and Absolucy
Added customization for quirks.

ALTER TABLE `SS13_characters`
ADD COLUMN IF NOT EXISTS `quirk_prosthetic_limb_location` VARCHAR(64) COLLATE 'utf8mb4_general_ci' AFTER `all_quirks`,
ADD COLUMN IF NOT EXISTS `quirk_phobia` VARCHAR(64) COLLATE 'utf8mb4_general_ci' AFTER `quirk_prosthetic_limb_location`,
ADD COLUMN IF NOT EXISTS `quirk_multilingual_language` VARCHAR(64) COLLATE 'utf8mb4_general_ci' AFTER `quirk_phobia`,
ADD COLUMN IF NOT EXISTS `quirk_smoker_cigarettes` VARCHAR(64) COLLATE 'utf8mb4_general_ci' AFTER `quirk_multilingual_language` ,
ADD COLUMN IF NOT EXISTS `quirk_junkie_drug` VARCHAR(64) COLLATE 'utf8mb4_general_ci' AFTER `quirk_smoker_cigarettes`,
ADD COLUMN IF NOT EXISTS `quirk_alcohol_type` VARCHAR(64) COLLATE 'utf8mb4_general_ci' AFTER `quirk_junkie_drug`;

-----------------------------------------------------

-----------------------------------------------------
Expand Down
8 changes: 8 additions & 0 deletions beestation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,7 @@
#include "code\datums\diseases\advance\symptoms\wizarditis.dm"
#include "code\datums\diseases\advance\symptoms\youth.dm"
#include "code\datums\elements\_element.dm"
#include "code\datums\elements\art.dm"
#include "code\datums\elements\atmos_requirements.dm"
#include "code\datums\elements\basic_body_temp_sensitive.dm"
#include "code\datums\elements\bed_tucking.dm"
Expand Down Expand Up @@ -2300,12 +2301,19 @@
#include "code\modules\client\preferences\entries\character\jobless_role.dm"
#include "code\modules\client\preferences\entries\character\names.dm"
#include "code\modules\client\preferences\entries\character\pda.dm"
#include "code\modules\client\preferences\entries\character\quirks.dm"
#include "code\modules\client\preferences\entries\character\random.dm"
#include "code\modules\client\preferences\entries\character\security_department.dm"
#include "code\modules\client\preferences\entries\character\skin_tone.dm"
#include "code\modules\client\preferences\entries\character\species.dm"
#include "code\modules\client\preferences\entries\character\underwear_color.dm"
#include "code\modules\client\preferences\entries\character\uplink_location.dm"
#include "code\modules\client\preferences\entries\character\quirks\alcoholic.dm"
#include "code\modules\client\preferences\entries\character\quirks\junkie.dm"
#include "code\modules\client\preferences\entries\character\quirks\multilingual.dm"
#include "code\modules\client\preferences\entries\character\quirks\phobia.dm"
#include "code\modules\client\preferences\entries\character\quirks\prosthetic.dm"
#include "code\modules\client\preferences\entries\character\quirks\smoker.dm"
#include "code\modules\client\preferences\entries\character\species_features\apid.dm"
#include "code\modules\client\preferences\entries\character\species_features\basic.dm"
#include "code\modules\client\preferences\entries\character\species_features\ethereal.dm"
Expand Down
11 changes: 11 additions & 0 deletions code/__DEFINES/art.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@

// art quality defines, used in datums/components/art.dm, elsewhere
#define BAD_ART 12.5
#define OK_ART 20
#define GOOD_ART 25
#define GREAT_ART 50

///tgui tab portrait categories- they're the same across all portrait tguis.
#define TAB_LIBRARY 1
#define TAB_SECURE 2
#define TAB_PRIVATE 3

///cost defines for drawing graffiti: how many charges of a crayon or spraycan are used.
#define CRAYON_COST_SMALL 0.5
#define CRAYON_COST_DEFAULT 1
#define CRAYON_COST_LARGE 5
17 changes: 17 additions & 0 deletions code/__DEFINES/language.dm
Original file line number Diff line number Diff line change
Expand Up @@ -46,3 +46,20 @@
#define LANGUAGE_MULTILINGUAL "multilingual"
#define LANGUAGE_EMP "emp"
#define LANGUAGE_HOLOPARA "holoparasite"

// Languages available from Multilingual
GLOBAL_LIST_INIT(multilingual_language_list, typecacheof(list(
/datum/language/apidite,
/datum/language/beachbum,
/datum/language/buzzwords,
/datum/language/calcic,
/datum/language/draconic,
/datum/language/moffic,
/datum/language/monkey,
/datum/language/piratespeak,
/datum/language/shadowtongue,
/datum/language/slime,
/datum/language/sylvan,
/datum/language/terrum,
/datum/language/uncommon
)))
20 changes: 20 additions & 0 deletions code/__DEFINES/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,26 @@
#define TRAUMA_RESILIENCE_MAGIC 4 //! Curable only with magic
#define TRAUMA_RESILIENCE_ABSOLUTE 5 //! This is here to stay

GLOBAL_LIST_INIT(available_random_trauma_list, list(
"spiders" = 5,
"space" = 2,
"security" = 5,
"clowns" = 5,
"greytide" = 5,
"lizards" = 5,
"skeletons" = 5,
"snakes" = 5,
"robots" = 4,
"doctors" = 4,
"authority" = 5,
"the supernatural" = 5,
"aliens" = 5,
"strangers" = 5,
"birds" = 5,
"falling" = 5,
"anime" = 5
))

/// This trauma cannot be cured through "special" means, such as nanites or viruses.
#define TRAUMA_SPECIAL_CURE_PROOF (1<<0)
/// This trauma transfers on cloning.
Expand Down
128 changes: 123 additions & 5 deletions code/__DEFINES/rust_g.dm
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,19 @@
RUSTG_CALL(RUST_G, "dbp_generate")(seed, accuracy, stamp_size, world_size, lower_range, upper_range)



#define rustg_dmi_strip_metadata(fname) RUSTG_CALL(RUST_G, "dmi_strip_metadata")("[fname]")
#define rustg_dmi_create_png(path, width, height, data) RUSTG_CALL(RUST_G, "dmi_create_png")(path, width, height, data)
#define rustg_dmi_resize_png(path, width, height, resizetype) RUSTG_CALL(RUST_G, "dmi_resize_png")(path, width, height, resizetype)
/**
* input: must be a path, not an /icon; you have to do your own handling if it is one, as icon objects can't be directly passed to rustg.
*
* output: json_encode'd list. json_decode to get a flat list with icon states in the order they're in inside the .dmi
*/
#define rustg_dmi_icon_states(fname) RUSTG_CALL(RUST_G, "dmi_icon_states")("[fname]")

#define rustg_file_read(fname) RUSTG_CALL(RUST_G, "file_read")("[fname]")
#define rustg_file_exists(fname) RUSTG_CALL(RUST_G, "file_exists")("[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]")
#define rustg_file_append(text, fname) RUSTG_CALL(RUST_G, "file_append")(text, "[fname]")
#define rustg_file_get_line_count(fname) text2num(RUSTG_CALL(RUST_G, "file_get_line_count")("[fname]"))
Expand All @@ -140,7 +147,13 @@
#define text2file(text, fname) rustg_file_append(text, "[fname]")
#endif

/// Returns the git hash of the given revision, ex. "HEAD".
#define rustg_git_revparse(rev) RUSTG_CALL(RUST_G, "rg_git_revparse")(rev)

/**
* Returns the date of the given revision in the format YYYY-MM-DD.
* Returns null if the revision is invalid.
*/
#define rustg_git_commit_date(rev) RUSTG_CALL(RUST_G, "rg_git_commit_date")(rev)

#define rustg_hash_string(algorithm, text) RUSTG_CALL(RUST_G, "hash_string")(algorithm, text)
Expand All @@ -155,6 +168,11 @@
#define RUSTG_HASH_XXH64 "xxh64"
#define RUSTG_HASH_BASE64 "base64"

/// Encode a given string into base64
#define rustg_encode_base64(str) rustg_hash_string(RUSTG_HASH_BASE64, str)
/// Decode a given base64 string
#define rustg_decode_base64(str) RUSTG_CALL(RUST_G, "decode_base64")(str)

#ifdef RUSTG_OVERRIDE_BUILTINS
#define md5(thing) (isfile(thing) ? rustg_hash_file(RUSTG_HASH_MD5, "[thing]") : rustg_hash_string(RUSTG_HASH_MD5, thing))
#endif
Expand All @@ -169,6 +187,66 @@
#define rustg_http_request_async(method, url, body, headers, options) RUSTG_CALL(RUST_G, "http_request_async")(method, url, body, headers, options)
#define rustg_http_check_request(req_id) RUSTG_CALL(RUST_G, "http_check_request")(req_id)

/// Generates a spritesheet at: [file_path][spritesheet_name]_[size_id].png
/// The resulting spritesheet arranges icons in a random order, with the position being denoted in the "sprites" return value.
/// All icons have the same y coordinate, and their x coordinate is equal to `icon_width * position`.
///
/// hash_icons is a boolean (0 or 1), and determines if the generator will spend time creating hashes for the output field dmi_hashes.
/// These hashes can be heplful for 'smart' caching (see rustg_iconforge_cache_valid), but require extra computation.
///
/// Spritesheet will contain all sprites listed within "sprites".
/// "sprites" format:
/// list(
/// "sprite_name" = list( // <--- this list is a [SPRITE_OBJECT]
/// icon_file = 'icons/path_to/an_icon.dmi',
/// icon_state = "some_icon_state",
/// dir = SOUTH,
/// frame = 1,
/// transform = list([TRANSFORM_OBJECT], ...)
/// ),
/// ...,
/// )
/// TRANSFORM_OBJECT format:
/// list("type" = "BlendColor", "color" = "#ff0000", "blend_mode" = ICON_MULTIPLY)
/// list("type" = "BlendIcon", "icon" = [SPRITE_OBJECT], "blend_mode" = ICON_OVERLAY)
/// list("type" = "Scale", "width" = 32, "height" = 32)
/// list("type" = "Crop", "x1" = 1, "y1" = 1, "x2" = 32, "y2" = 32) // (BYOND icons index from 1,1 to the upper bound, inclusive)
///
/// Returns a SpritesheetResult as JSON, containing fields:
/// list(
/// "sizes" = list("32x32", "64x64", ...),
/// "sprites" = list("sprite_name" = list("size_id" = "32x32", "position" = 0), ...),
/// "dmi_hashes" = list("icons/path_to/an_icon.dmi" = "d6325c5b4304fb03", ...),
/// "sprites_hash" = "a2015e5ff403fb5c", // This is the xxh64 hash of the INPUT field "sprites".
/// "error" = "[A string, empty if there were no errors.]"
/// )
/// In the case of an unrecoverable panic from within Rust, this function ONLY returns a string containing the error.
#define rustg_iconforge_generate(file_path, spritesheet_name, sprites, hash_icons) RUSTG_CALL(RUST_G, "iconforge_generate")(file_path, spritesheet_name, sprites, "[hash_icons]")
/// Returns a job_id for use with rustg_iconforge_check()
#define rustg_iconforge_generate_async(file_path, spritesheet_name, sprites, hash_icons) RUSTG_CALL(RUST_G, "iconforge_generate_async")(file_path, spritesheet_name, sprites, "[hash_icons]")
/// Returns the status of a job_id
#define rustg_iconforge_check(job_id) RUSTG_CALL(RUST_G, "iconforge_check")("[job_id]")
/// Clears all cached DMIs and images, freeing up memory.
/// This should be used after spritesheets are done being generated.
#define rustg_iconforge_cleanup RUSTG_CALL(RUST_G, "iconforge_cleanup")
/// Takes in a set of hashes, generate inputs, and DMI filepaths, and compares them to determine cache validity.
/// input_hash: xxh64 hash of "sprites" from the cache.
/// dmi_hashes: xxh64 hashes of the DMIs in a spritesheet, given by `rustg_iconforge_generate` with `hash_icons` enabled. From the cache.
/// sprites: The new input that will be passed to rustg_iconforge_generate().
/// Returns a CacheResult with the following structure: list(
/// "result": "1" (if cache is valid) or "0" (if cache is invalid)
/// "fail_reason": "" (emtpy string if valid, otherwise a string containing the invalidation reason or an error with ERROR: prefixed.)
/// )
/// In the case of an unrecoverable panic from within Rust, this function ONLY returns a string containing the error.
#define rustg_iconforge_cache_valid(input_hash, dmi_hashes, sprites) RUSTG_CALL(RUST_G, "iconforge_cache_valid")(input_hash, dmi_hashes, sprites)
/// Returns a job_id for use with rustg_iconforge_check()
#define rustg_iconforge_cache_valid_async(input_hash, dmi_hashes, sprites) RUSTG_CALL(RUST_G, "iconforge_cache_valid_async")(input_hash, dmi_hashes, sprites)

#define RUSTG_ICONFORGE_BLEND_COLOR "BlendColor"
#define RUSTG_ICONFORGE_BLEND_ICON "BlendIcon"
#define RUSTG_ICONFORGE_CROP "Crop"
#define RUSTG_ICONFORGE_SCALE "Scale"

#define RUSTG_JOB_NO_RESULTS_YET "NO RESULTS YET"
#define RUSTG_JOB_NO_SUCH_JOB "NO SUCH JOB"
#define RUSTG_JOB_ERROR "JOB PANICKED"
Expand Down Expand Up @@ -203,15 +281,15 @@
*/
#define rustg_add_node_astar(json) RUSTG_CALL(RUST_G, "add_node_astar")(json)

/**²
/**
* Remove every link to the node with unique_id. Replace that node by null
*/
#define rustg_remove_node_astart(unique_id) RUSTG_CALL(RUST_G, "remove_node_astar")(unique_id)
#define rustg_remove_node_astar(unique_id) RUSTG_CALL(RUST_G, "remove_node_astar")("[unique_id]")

/**
* Compute the shortest path between start_node and goal_node using A*. Heuristic used is simple geometric distance
*/
#define rustg_generate_path_astar(start_node_id, goal_node_id) RUSTG_CALL(RUST_G, "generate_path_astar")(start_node_id, goal_node_id)
#define rustg_generate_path_astar(start_node_id, goal_node_id) RUSTG_CALL(RUST_G, "generate_path_astar")("[start_node_id]", "[goal_node_id]")

#define RUSTG_REDIS_ERROR_CHANNEL "RUSTG_REDIS_ERROR_CHANNEL"

Expand All @@ -221,6 +299,45 @@
/proc/rustg_redis_get_messages() return RUSTG_CALL(RUST_G, "redis_get_messages")()
#define rustg_redis_publish(channel, message) RUSTG_CALL(RUST_G, "redis_publish")(channel, message)

/**
* Connects to a given redis server.
*
* Arguments:
* * addr - The address of the server, for example "redis://127.0.0.1/"
*/
#define rustg_redis_connect_rq(addr) RUSTG_CALL(RUST_G, "redis_connect_rq")(addr)
/**
* Disconnects from a previously connected redis server
*/
/proc/rustg_redis_disconnect_rq() return RUSTG_CALL(RUST_G, "redis_disconnect_rq")()
/**
* https://redis.io/commands/lpush/
*
* Arguments
* * key (string) - The key to use
* * elements (list) - The elements to push, use a list even if there's only one element.
*/
#define rustg_redis_lpush(key, elements) RUSTG_CALL(RUST_G, "redis_lpush")(key, json_encode(elements))
/**
* https://redis.io/commands/lrange/
*
* Arguments
* * key (string) - The key to use
* * start (string) - The zero-based index to start retrieving at
* * stop (string) - The zero-based index to stop retrieving at (inclusive)
*/
#define rustg_redis_lrange(key, start, stop) RUSTG_CALL(RUST_G, "redis_lrange")(key, start, stop)
/**
* https://redis.io/commands/lpop/
*
* Arguments
* * key (string) - The key to use
* * count (string|null) - The amount to pop off the list, pass null to omit (thus just 1)
*
* Note: `count` was added in Redis version 6.2.0
*/
#define rustg_redis_lpop(key, count) RUSTG_CALL(RUST_G, "redis_lpop")(key, count)

#define rustg_sql_connect_pool(options) RUSTG_CALL(RUST_G, "sql_connect_pool")(options)
#define rustg_sql_query_async(handle, query, params) RUSTG_CALL(RUST_G, "sql_query_async")(handle, query, params)
#define rustg_sql_query_blocking(handle, query, params) RUSTG_CALL(RUST_G, "sql_query_blocking")(handle, query, params)
Expand All @@ -232,8 +349,9 @@
#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 text2num(RUSTG_CALL(RUST_G, "unix_timestamp")())
return RUSTG_CALL(RUST_G, "unix_timestamp")()

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

Expand Down
2 changes: 1 addition & 1 deletion code/__DEFINES/subsystems.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
*
* make sure you add an update to the schema_version stable in the db changelog
*/
#define DB_MINOR_VERSION 1
#define DB_MINOR_VERSION 2


//! ## Timing subsystem
Expand Down
Loading

0 comments on commit 2047b39

Please sign in to comment.