diff --git a/SQL/database_schema.sql b/SQL/database_schema.sql index f1b50df6fd40..f2932f1aae44 100644 --- a/SQL/database_schema.sql +++ b/SQL/database_schema.sql @@ -6,7 +6,9 @@ * PRESERVE ANY vr_'s! We need to replace those tables and features at some point, that's how we konw. **/ --- core -- +/************************************************************************************************** + Database Backend +**************************************************************************************************/ -- -- Table structure for table `schema_revision` @@ -18,7 +20,55 @@ CREATE TABLE IF NOT EXISTS `%_PREFIX_%schema_revision` ( PRIMARY KEY (`major`, `minor`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; --- persistence -- +/************************************************************************************************** + Character Tables +**************************************************************************************************/ + +CREATE TABLE IF NOT EXISTS `%_PREFIX_%characters` ( + `id` INT(24) NOT NULL AUTO INCREMENT, + +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +CREATE TABLE IF NOT EXISTS `%_PREFIX_%character_records` ( + `id` INT(24) NOT NULL AUTO INCREMENT, + `flags` INT(24) NOT NULL DEFAULT 0, + `data` MEDIUMTEXT NOT NULL DEFAULT '{}', + `r_timestamp` DATETIME NULL, + `r_location` VARCHAR(512) NULL, + `r_label` VARCHAR(256) NULL, + `r_content_type` VARCHAR(64) NULL, + `r_content` TEXT NULL, + `r_author_character_id` INT(24) NULL, + CONSTRAINT `r_author_character_id` FOREIGN KEY (`r_author_character_id`) + REFERENCES `%_PREFIX_%characters` (`id`) + ON DELETE NULL + ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +/** + * 'changes' is a JSON array of strings. + */ +CREATE TABLE IF NOT EXISTS `%_PREFIX_%character_record_logs` ( + `id` INT(24) NOT NULL AUTO INCREMENT, + `record_id` INT(24) NOT NULL, + `timestamp` DATETIME NOT NULL DEFAULT Now(), + `player_id` INT(24) NULL, + `character_id` INT(24) NULL, + `changes` MEDIUMTEXT, + PRIMARY KEY(`id`), + CONSTRAINT `audit_player_id` FOREIGN KEY (`audit_character_id`) + REFERENCES `%_PREFIX_%player` (`id`) + ON DELETE NULL + ON UPDATE CASCADE, + CONSTRAINT `audit_character_id` FOREIGN KEY (`audit_character_id`) + REFERENCES `%_PREFIX_%characters` (`id`) + ON DELETE NULL + ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; + +/************************************************************************************************** + World Persistence Tables +**************************************************************************************************/ -- SSpersistence modules/bulk_entity CREATE TABLE IF NOT EXISTS `%_PREFIX_%persistence_bulk_entity` ( @@ -97,7 +147,9 @@ CREATE TABLE IF NOT EXISTS `%_PREFIX_%persistence_string_kv` ( PRIMARY KEY(`key`, `group`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; --- photography -- +/************************************************************************************************** + Photography Tables +**************************************************************************************************/ -- picture table -- -- used to store data about pictures -- @@ -128,7 +180,9 @@ CREATE TABLE IF NOT EXISTS `%_PREFIX_%photographs` ( PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; --- Players -- +/************************************************************************************************** + Player Tables +**************************************************************************************************/ -- Player lookup table -- -- Used to look up player ID from ckey, as well as -- @@ -157,7 +211,9 @@ CREATE TABLE IF NOT EXISTS `%_PREFIX_%player` ( PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; --- Playtime / JEXP -- +/************************************************************************************************** + Players - Playtime Tracking +**************************************************************************************************/ -- Role Time Table - Master -- -- Stores total role time. -- @@ -195,8 +251,9 @@ END $$ DELIMITER ; - --- Preferences -- +/************************************************************************************************** + Players - Game Preferences +**************************************************************************************************/ -- Stores game preferences -- CREATE TABLE IF NOT EXISTS `%_PREFIX_%game_preferences` ( diff --git a/citadel.dme b/citadel.dme index 784aff4241c9..283a7732b98c 100644 --- a/citadel.dme +++ b/citadel.dme @@ -136,6 +136,8 @@ #include "code\__DEFINES\atmospherics\machinery\scrubber.dm" #include "code\__DEFINES\atmospherics\machinery\vent.dm" #include "code\__DEFINES\cargo\supply.dm" +#include "code\__DEFINES\characters\character.dm" +#include "code\__DEFINES\characters\character_record.dm" #include "code\__DEFINES\client\game_preferences.dm" #include "code\__DEFINES\client\player_flags.dm" #include "code\__DEFINES\client\playtime.dm" @@ -603,6 +605,7 @@ #include "code\controllers\subsystem\characters\backgrounds.dm" #include "code\controllers\subsystem\characters\character_species.dm" #include "code\controllers\subsystem\characters\languages.dm" +#include "code\controllers\subsystem\characters\records.dm" #include "code\controllers\subsystem\characters\species.dm" #include "code\controllers\subsystem\dbcore\_dbcore.dm" #include "code\controllers\subsystem\dbcore\query.dm" @@ -635,9 +638,9 @@ #include "code\controllers\subsystem\mapping\spatial_helpers\loc.dm" #include "code\controllers\subsystem\mapping\spatial_helpers\stack.dm" #include "code\controllers\subsystem\mapping\spatial_helpers\step.dm" -#include "code\controllers\subsystem\persistence\bunker.dm" +#include "code\controllers\subsystem\persistence\_persistence.dm" #include "code\controllers\subsystem\persistence\entity_operations.dm" -#include "code\controllers\subsystem\persistence\persistence.dm" +#include "code\controllers\subsystem\persistence\panic_bunker.dm" #include "code\controllers\subsystem\persistence\prototype_lookup.dm" #include "code\controllers\subsystem\persistence\world.dm" #include "code\controllers\subsystem\persistence\modules\bulk_entity.dm" @@ -2302,6 +2305,15 @@ #include "code\modules\asset_cache\assets\tgui.dm" #include "code\modules\asset_cache\assets\vv.dm" #include "code\modules\asset_cache\assets\artwork\crayons.dm" +#include "code\modules\asset_cache\assets\characters\json\character_appearance.dm" +#include "code\modules\asset_cache\assets\characters\json\character_background.dm" +#include "code\modules\asset_cache\assets\characters\json\character_loadout.dm" +#include "code\modules\asset_cache\assets\characters\json\character_setup.dm" +#include "code\modules\asset_cache\assets\characters\spritesheet\bodyset_markings.dm" +#include "code\modules\asset_cache\assets\characters\spritesheet\bodysets.dm" +#include "code\modules\asset_cache\assets\characters\spritesheet\loadout.dm" +#include "code\modules\asset_cache\assets\characters\spritesheet\species.dm" +#include "code\modules\asset_cache\assets\characters\spritesheet\sprite_accessories.dm" #include "code\modules\asset_cache\assets\chemistry\bottles.dm" #include "code\modules\asset_cache\assets\chemistry\patches.dm" #include "code\modules\asset_cache\assets\chemistry\pills.dm" @@ -2422,6 +2434,7 @@ #include "code\modules\blob2\overmind\overmind.dm" #include "code\modules\blob2\overmind\powers.dm" #include "code\modules\blob2\overmind\types.dm" +#include "code\modules\bodysets\bodyset_marking_descriptor.dm" #include "code\modules\bodysets\sprite_accessories.dm" #include "code\modules\bodysets\organic\akula.dm" #include "code\modules\bodysets\organic\apidean.dm" @@ -2456,6 +2469,24 @@ #include "code\modules\catalogue\cataloguer.dm" #include "code\modules\catalogue\cataloguer_visuals.dm" #include "code\modules\catalogue\cataloguer_vr.dm" +#include "code\modules\characters\character\character.dm" +#include "code\modules\characters\character\character_appearance.dm" +#include "code\modules\characters\character\character_background.dm" +#include "code\modules\characters\character\character_bodypart_appearance.dm" +#include "code\modules\characters\character\character_bodypart_physiology.dm" +#include "code\modules\characters\character\character_inventory.dm" +#include "code\modules\characters\character\character_loadout.dm" +#include "code\modules\characters\character\character_physiology.dm" +#include "code\modules\characters\character\character_record.dm" +#include "code\modules\characters\character\character_skills.dm" +#include "code\modules\characters\character\character_status.dm" +#include "code\modules\characters\character\character_record\employment.dm" +#include "code\modules\characters\character\character_record\incident.dm" +#include "code\modules\characters\character\character_record\intelligence.dm" +#include "code\modules\characters\character\character_record\medical.dm" +#include "code\modules\characters\character_setup\character_setup.dm" +#include "code\modules\characters\character_shapeshift\character_shapeshift.dm" +#include "code\modules\characters\character_shapeshift\character_shapeshift_holder.dm" #include "code\modules\client\client-admin.dm" #include "code\modules\client\client.dm" #include "code\modules\client\client_procs.dm" @@ -3195,6 +3226,7 @@ #include "code\modules\loadout\loadout_general.dm" #include "code\modules\loadout\loadout_gloves.dm" #include "code\modules\loadout\loadout_head.dm" +#include "code\modules\loadout\loadout_item_descriptor.dm" #include "code\modules\loadout\loadout_mask.dm" #include "code\modules\loadout\loadout_role_restricted.dm" #include "code\modules\loadout\loadout_seasonal.dm" @@ -3538,13 +3570,13 @@ #include "code\modules\mob\_modifiers\traits.dm" #include "code\modules\mob\_modifiers\traits_phobias.dm" #include "code\modules\mob\_modifiers\unholy.dm" +#include "code\modules\mob\characteristics\characteristic_preset.dm" +#include "code\modules\mob\characteristics\characteristic_skill.dm" +#include "code\modules\mob\characteristics\characteristic_stat.dm" +#include "code\modules\mob\characteristics\characteristic_talent.dm" +#include "code\modules\mob\characteristics\characteristics_holder.dm" #include "code\modules\mob\characteristics\helpers.dm" -#include "code\modules\mob\characteristics\holder.dm" #include "code\modules\mob\characteristics\mob.dm" -#include "code\modules\mob\characteristics\presets.dm" -#include "code\modules\mob\characteristics\skill.dm" -#include "code\modules\mob\characteristics\stat.dm" -#include "code\modules\mob\characteristics\talent.dm" #include "code\modules\mob\characteristics\ui.dm" #include "code\modules\mob\characteristics\skills\engineering.dm" #include "code\modules\mob\characteristics\skills\logistics.dm" @@ -4828,6 +4860,7 @@ #include "code\modules\sprite_accessories\ears.dm" #include "code\modules\sprite_accessories\hair.dm" #include "code\modules\sprite_accessories\sprite_accessory.dm" +#include "code\modules\sprite_accessories\sprite_accessory_descriptor.dm" #include "code\modules\sprite_accessories\tail.dm" #include "code\modules\sprite_accessories\wings.dm" #include "code\modules\sprite_accessories\ears\antenna.dm" diff --git a/code/__DEFINES/characters/character.dm b/code/__DEFINES/characters/character.dm new file mode 100644 index 000000000000..441070dda1db --- /dev/null +++ b/code/__DEFINES/characters/character.dm @@ -0,0 +1,21 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2024 Citadel Station Developers *// + +//* appearance *// + +/// max appearance slots soemone is allowed to have +#define CHARATER_MAX_APPEARANCE_SLOTS 32 + +//* loadout *// + +/// max loadout sets someone is allowed to have +#define CHARACTER_MAX_LOADOUT_SLOTS 32 +/// max loadout items in a set +#define CHARACTER_MAX_LOADOUT_ITEMS 32 + +//* role priorities *// + +#define CHARACTER_ROLE_PRIORITY_NEVER 0 +#define CHARACTER_ROLE_PRIORITY_LOW 1 +#define CHARACTER_ROLE_PRIORITY_MEDIUM 2 +#define CHARACTER_ROLE_PRIORITY_HIGH 3 diff --git a/code/__DEFINES/characters/character_record.dm b/code/__DEFINES/characters/character_record.dm new file mode 100644 index 000000000000..b36701bbeb78 --- /dev/null +++ b/code/__DEFINES/characters/character_record.dm @@ -0,0 +1,30 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2024 Citadel Station Developers *// + +//* /datum/character_record character_record_flags *// + +/// ICly sealed +/// +/// * admins can do this +/// * certain IC sources may be able to do this in the future +#define CHARACTER_RECORD_FLAG_SEALED (1<<0) +/// OOCly deleted +/// +/// * only admins can do this +#define CHARACTER_RECORD_FLAG_DELETED (1<<1) + +//* /datum/character_record character_record_type *// + +/// incident records, used by security and command staff of one's own faction, usually +#define CHARACTER_RECORD_TYPE_INCIDENT "incident" +/// medical record, used by medical staff of one's own faction, usually +#define CHARACTER_RECORD_TYPE_MEDICAL "medical" +/// employment record, used by leaders or heads of departments of one's own faction, usually +#define CHARACTER_RECORD_TYPE_EMPLOYMENT "employment" +/// exploitable info, used by factions hostile to one's self, usually +#define CHARACTER_RECORD_TYPE_INTELLIGENCE "intelligence" + +//* /datum/character_record r_content_type's *// + +/// text +#define CHARACTER_RECORD_CONTENT_TYPE_PLAINTEXT "text" diff --git a/code/controllers/subsystem/characters/_characters.dm b/code/controllers/subsystem/characters/_characters.dm index 139ea5f58572..0a98035730b4 100644 --- a/code/controllers/subsystem/characters/_characters.dm +++ b/code/controllers/subsystem/characters/_characters.dm @@ -1,5 +1,7 @@ //* This file is explicitly licensed under the MIT license. *// -//* Copyright (c) 2023 Citadel Station developers. *// +//* Copyright (c) 2024 Citadel Station Developers *// + +// todo: re-review this file; ensure generation / ACID is being enforced. /** * Manages character setup, character saving, loading, @@ -21,6 +23,15 @@ SUBSYSTEM_DEF(characters) var/list/save_queue = list() + //* Records *// + + /// record datums by associative string id + /// + /// * used as a cache + var/list/character_record_cache + /// max cached record datums + var/character_record_cache_limit = 200 + /datum/controller/subsystem/characters/Initialize() rebuild_caches() for(var/ckey in GLOB.preferences_datums) diff --git a/code/controllers/subsystem/characters/records.dm b/code/controllers/subsystem/characters/records.dm new file mode 100644 index 000000000000..b259084185fa --- /dev/null +++ b/code/controllers/subsystem/characters/records.dm @@ -0,0 +1,28 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2024 Citadel Station Developers *// + +/** + * Fetches a single character record + */ +/datum/controller/subsystem/characters/proc/fetch_character_record(id) as /datum/character_record + +/** + * Stores a character record + */ +/datum/controller/subsystem/characters/proc/store_character_record(datum/character_record/record) + +/** + * Gets records of a given type for a character. + * + * * character_id - the character ID to query + * * record_type - the record type to return + * * page - which page to retrieve; defaults to 1. + * * limit - how many to return per page. This is an utter suggestion to this proc; the subsystem reserves the right to ignore your request. + * * page_total_pointer - if provided, this pointer will be set to how many pages there are at the current limit + * * limit_count_pointer - if provided, this pointer will be set to the limit being used. + * + * @return list(record datum, record datum, ...) + */ +/datum/controller/subsystem/characters/proc/query_character_records(character_id, record_type, page) as /list + +#warn impl all diff --git a/code/controllers/subsystem/persistence/persistence.dm b/code/controllers/subsystem/persistence/_persistence.dm similarity index 84% rename from code/controllers/subsystem/persistence/persistence.dm rename to code/controllers/subsystem/persistence/_persistence.dm index 806071a997be..eb117bf1d440 100644 --- a/code/controllers/subsystem/persistence/persistence.dm +++ b/code/controllers/subsystem/persistence/_persistence.dm @@ -8,6 +8,8 @@ SUBSYSTEM_DEF(persistence) init_order = INIT_ORDER_PERSISTENCE subsystem_flags = SS_NO_FIRE + //* World *// + /// world already loaded? var/static/world_loaded = FALSE /// world saved how many times? @@ -18,14 +20,16 @@ SUBSYSTEM_DEF(persistence) // todo: interface on subsystem panel var/static/world_non_canon = FALSE + //* Prototype Lookup *// + /// prototype id to typepath var/list/prototype_id_to_path /datum/controller/subsystem/persistence/Initialize() /// build prototype lookup list build_prototype_id_lookup() - - LoadPersistence() + /// load panic bunker bypass + load_panic_bunker() // todo: should this be here? save_the_world is in ticker. if(CONFIG_GET(flag/persistence)) @@ -34,21 +38,10 @@ SUBSYSTEM_DEF(persistence) return ..() /datum/controller/subsystem/persistence/Shutdown() - SavePersistence() + /// save panic bunker bypass + save_panic_bunker() return ..() -/** - * Loads all persistent information from disk. - */ -/datum/controller/subsystem/persistence/proc/LoadPersistence() - LoadPanicBunker() - -/** - * Saves all persistent information to disk. - */ -/datum/controller/subsystem/persistence/proc/SavePersistence() - SavePanicBunker() - //* ID Mapping *// /** diff --git a/code/controllers/subsystem/persistence/entity_operations.dm b/code/controllers/subsystem/persistence/entity_operations.dm index 2ba05637d0ea..89e5003bc436 100644 --- a/code/controllers/subsystem/persistence/entity_operations.dm +++ b/code/controllers/subsystem/persistence/entity_operations.dm @@ -1,3 +1,4 @@ +// todo: re-review this file; ensure generation / ACID is being enforced. /** * somewhat expensive diff --git a/code/controllers/subsystem/persistence/modules/string_kkv.dm b/code/controllers/subsystem/persistence/modules/string_kkv.dm index 6ae51d36a225..b93acb0ea16e 100644 --- a/code/controllers/subsystem/persistence/modules/string_kkv.dm +++ b/code/controllers/subsystem/persistence/modules/string_kkv.dm @@ -48,7 +48,7 @@ * - group - optional group-specific. null counts as its own group. * - flush - immediately invoke SQL; otherwise subsystem decides when. */ -/datum/controller/subsystem/persistence/proc/string_kkv_set(key, value, group, flush) +/datum/controller/subsystem/persistence/proc/string_kkv_set(key, group, value, flush) string_kkv_save(group, key, value) //* Backend Save/Load *// @@ -92,6 +92,7 @@ //* Benchmarks *// +/* /datum/controller/subsystem/persistence/proc/benchmark_string_kkv() var/oldusr = usr usr = null @@ -133,3 +134,4 @@ /datum/controller/subsystem/persistence/proc/kkv__string_load_benchmark(list/pointer, key) string_kkv_load("benchmark", key) pointer[1]-- +*/ diff --git a/code/controllers/subsystem/persistence/bunker.dm b/code/controllers/subsystem/persistence/panic_bunker.dm similarity index 84% rename from code/controllers/subsystem/persistence/bunker.dm rename to code/controllers/subsystem/persistence/panic_bunker.dm index 969b20b69d91..60b3a0976e9b 100644 --- a/code/controllers/subsystem/persistence/bunker.dm +++ b/code/controllers/subsystem/persistence/panic_bunker.dm @@ -3,14 +3,14 @@ // Persistent panic bunker passthrough -/datum/controller/subsystem/persistence/proc/SavePanicBunker() +/datum/controller/subsystem/persistence/proc/save_panic_bunker() var/json_file = file(PERSISTENCE_FILE_BUNKER_PASSTHROUGH) var/list/file_data = list() file_data["data"] = GLOB.bunker_passthrough fdel(json_file) WRITE_FILE(json_file,json_encode(file_data)) -/datum/controller/subsystem/persistence/proc/LoadPanicBunker() +/datum/controller/subsystem/persistence/proc/load_panic_bunker() var/bunker_path = file(PERSISTENCE_FILE_BUNKER_PASSTHROUGH) if(fexists(bunker_path)) var/list/json = json_decode(file2text(bunker_path)) diff --git a/code/controllers/subsystem/ticker.dm b/code/controllers/subsystem/ticker.dm index badb7450553b..58ffc3f6675e 100644 --- a/code/controllers/subsystem/ticker.dm +++ b/code/controllers/subsystem/ticker.dm @@ -119,7 +119,6 @@ SUBSYSTEM_DEF(ticker) send2chat(broadcastmessage, CONFIG_GET(string/chat_roundend_notice_tag)) SSdbcore.SetRoundEnd() - SSpersistence.SavePersistence() if(!SSpersistence.world_saved_count && CONFIG_GET(flag/persistence) && !SSpersistence.world_non_canon) SSpersistence.save_the_world() diff --git a/code/datums/underwear/README.md b/code/datums/underwear/README.md new file mode 100644 index 000000000000..abf2b09ab7a0 --- /dev/null +++ b/code/datums/underwear/README.md @@ -0,0 +1,5 @@ +# Underwear + +I don't really have anything funny to say here. + +Someone should make a proper README, maybe. diff --git a/code/modules/admin/verbs/panicbunker.dm b/code/modules/admin/verbs/panicbunker.dm index 80b51f9d3d25..1c320ad5b2ed 100644 --- a/code/modules/admin/verbs/panicbunker.dm +++ b/code/modules/admin/verbs/panicbunker.dm @@ -31,7 +31,7 @@ GLOBAL_LIST_EMPTY(bunker_passthrough) GLOB.bunker_passthrough |= ckey(ckeytobypass) GLOB.bunker_passthrough[ckey(ckeytobypass)] = world.realtime - SSpersistence.SavePanicBunker() //we can do this every time, it's okay + SSpersistence.save_panic_bunker() //we can do this every time, it's okay log_admin("[key_name(usr)] has added [ckeytobypass] to the current round's bunker bypass list.") message_admins("[key_name_admin(usr)] has added [ckeytobypass] to the current round's bunker bypass list.") send2irc("Panic Bunker", "[key_name(usr)] has added [ckeytobypass] to the current round's bunker bypass list.") @@ -45,7 +45,7 @@ GLOBAL_LIST_EMPTY(bunker_passthrough) return GLOB.bunker_passthrough -= ckey(ckeytobypass) - SSpersistence.SavePanicBunker() + SSpersistence.save_panic_bunker() log_admin("[key_name(usr)] has removed [ckeytobypass] from the current round's bunker bypass list.") message_admins("[key_name_admin(usr)] has removed [ckeytobypass] from the current round's bunker bypass list.") send2irc("Panic Bunker", "[key_name(usr)] has removed [ckeytobypass] from the current round's bunker bypass list.") diff --git a/code/modules/asset_cache/assets/characters/json/character_appearance.dm b/code/modules/asset_cache/assets/characters/json/character_appearance.dm new file mode 100644 index 000000000000..0370b41e97bd --- /dev/null +++ b/code/modules/asset_cache/assets/characters/json/character_appearance.dm @@ -0,0 +1,22 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2024 Citadel Station Developers *// + +/** + * Contains: + * + * * Bodysets + * * Bodyset Markings + * * Sprite Accessories + * + * Requires: + * + * * asset_pack/spritesheet/sprite_accessories + * * asset_pack/spritesheet/bodysets + * * asset_pack/spritesheet/bodyset_markings + */ +/datum/asset_pack/json/character_appearance + +/datum/asset_pack/json/character_appearance/generate() + . = list() + +#warn impl diff --git a/code/modules/asset_cache/assets/characters/json/character_background.dm b/code/modules/asset_cache/assets/characters/json/character_background.dm new file mode 100644 index 000000000000..62d67b5e8fae --- /dev/null +++ b/code/modules/asset_cache/assets/characters/json/character_background.dm @@ -0,0 +1,20 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2024 Citadel Station Developers *// + +/** + * Contains: + * + * * Backgrounds + * * Languages + * * Species + * + * Requires: + * + * * asset_pack/spritesheet/species + */ +/datum/asset_pack/json/character_background + +/datum/asset_pack/json/character_background/generate() + . = list() + +#warn impl diff --git a/code/modules/asset_cache/assets/characters/json/character_loadout.dm b/code/modules/asset_cache/assets/characters/json/character_loadout.dm new file mode 100644 index 000000000000..eb8c856e4509 --- /dev/null +++ b/code/modules/asset_cache/assets/characters/json/character_loadout.dm @@ -0,0 +1,24 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2024 Citadel Station Developers *// + +/** + * Contains: + * + * * Loadout Items + * + * Requires: + * + * * asset_pack/spritesheet/loadout + */ +/datum/asset_pack/json/character_loadout + +/datum/asset_pack/json/character_loadout/generate() + . = list() + + var/list/assembling = list() + for(var/id in global.gear_datums) + var/datum/loadout_entry/entry = global.gear_datums[id] + assembling[entry.id] = entry.tgui_data() + .["keyedItems"] = assembling + +#warn impl diff --git a/code/modules/asset_cache/assets/characters/json/character_setup.dm b/code/modules/asset_cache/assets/characters/json/character_setup.dm new file mode 100644 index 000000000000..5d7bf8a4f5b5 --- /dev/null +++ b/code/modules/asset_cache/assets/characters/json/character_setup.dm @@ -0,0 +1,16 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2024 Citadel Station Developers *// + +/** + * Contains anything in character setup not contained by; + * + * * character_appearance + * * character_background + * * character_loadout + */ +/datum/asset_pack/json/character_setup + +/datum/asset_pack/json/character_setup/generate() + . = list() + +#warn impl diff --git a/code/modules/asset_cache/assets/characters/spritesheet/bodyset_markings.dm b/code/modules/asset_cache/assets/characters/spritesheet/bodyset_markings.dm new file mode 100644 index 000000000000..eac13bb914f2 --- /dev/null +++ b/code/modules/asset_cache/assets/characters/spritesheet/bodyset_markings.dm @@ -0,0 +1,6 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2024 Citadel Station Developers *// + +/datum/asset_pack/spritesheet/bodyset_markings + +/datum/asset_pack/spritesheet/bodyset_markings/generate() diff --git a/code/modules/asset_cache/assets/characters/spritesheet/bodysets.dm b/code/modules/asset_cache/assets/characters/spritesheet/bodysets.dm new file mode 100644 index 000000000000..846faa1a561b --- /dev/null +++ b/code/modules/asset_cache/assets/characters/spritesheet/bodysets.dm @@ -0,0 +1,6 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2024 Citadel Station Developers *// + +/datum/asset_pack/spritesheet/bodysets + +/datum/asset_pack/spritesheet/bodysets/generate() diff --git a/code/modules/asset_cache/assets/characters/spritesheet/loadout.dm b/code/modules/asset_cache/assets/characters/spritesheet/loadout.dm new file mode 100644 index 000000000000..6d75444e6b30 --- /dev/null +++ b/code/modules/asset_cache/assets/characters/spritesheet/loadout.dm @@ -0,0 +1,13 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2024 Citadel Station Developers *// + +/** + * Contains sprites of every loadout item, with the name of the sprite being the id of the item. + */ +/datum/asset_pack/spritesheet/loadout + +/datum/asset_pack/spritesheet/loadout/generate() + for(var/id in global.gear_datums) + var/datum/loadout_entry/item = global.gear_datums[id] + var/obj/item/casted_path = item.path + insert(id, initial(casted_path.icon), initial(casted_path.icon_state), SOUTH, 1, FALSE) diff --git a/code/modules/asset_cache/assets/characters/spritesheet/species.dm b/code/modules/asset_cache/assets/characters/spritesheet/species.dm new file mode 100644 index 000000000000..826bb6ccd859 --- /dev/null +++ b/code/modules/asset_cache/assets/characters/spritesheet/species.dm @@ -0,0 +1,6 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2024 Citadel Station Developers *// + +/datum/asset_pack/spritesheet/species + +/datum/asset_pack/spritesheet/species/generate() diff --git a/code/modules/asset_cache/assets/characters/spritesheet/sprite_accessories.dm b/code/modules/asset_cache/assets/characters/spritesheet/sprite_accessories.dm new file mode 100644 index 000000000000..63d381184e52 --- /dev/null +++ b/code/modules/asset_cache/assets/characters/spritesheet/sprite_accessories.dm @@ -0,0 +1,7 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2024 Citadel Station Developers *// + +/datum/asset_pack/spritesheet/sprite_accessories + +/datum/asset_pack/spritesheet/sprite_accessories/generate() + diff --git a/code/modules/bodysets/bodyset_marking_descriptor.dm b/code/modules/bodysets/bodyset_marking_descriptor.dm new file mode 100644 index 000000000000..b639ccbdd5d4 --- /dev/null +++ b/code/modules/bodysets/bodyset_marking_descriptor.dm @@ -0,0 +1,39 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2024 Citadel Station Developers *// + +/** + * Instance descriptors of body markings. + */ +/datum/bodyset_marking_descriptor + /// body marking ID + var/id + /// color channels, packed + var/packed_coloration + /// color channels, unpacked + /// + /// * this follows the coloration format; this is not necessarily a list of colors + /// * this is done on render + var/list/unpacked_coloration + /// emissive power; 0 to 255, with 0 being off + var/emissive = 0 + /// layer adjust + /// + /// * -10 to 10 allowed + var/layer = 0 + +/datum/bodyset_marking_descriptor/serialize() + return list( + "id" = id, + "coloration" = packed_coloration, + "emissive" = emissive, + "layer" = layer, + ) + +/datum/bodyset_marking_descriptor/deserialize(list/data) + id = data["id"] + packed_coloration = data["coloration"] + emissive = data["emissive"] + layer = data["layer"] + +#warn set_coloration +#warn sanitize_and_validate diff --git a/code/modules/characters/README.md b/code/modules/characters/README.md new file mode 100644 index 000000000000..86ac6e79476c --- /dev/null +++ b/code/modules/characters/README.md @@ -0,0 +1,19 @@ +# Characters + +A big semi-subsystem-module of the game. + +Contains things like shapeshifts, descriptors, records, etc. + +All in all, a grab-bag of things used to manipulate characters. In the game. Surprise, surprise. + +Things in here may be used as a library elsewhere, and vice versa. + +Examples; + +- bodysets is used in here as appearance descriptors +- shapeshifts can be used in here / elsewhere as appearance descriptors +- records are used by other game systems + +## Disclaimer + +This system is **heavily** WIP. diff --git a/code/modules/characters/character/character.dm b/code/modules/characters/character/character.dm new file mode 100644 index 000000000000..a68dc84bd51f --- /dev/null +++ b/code/modules/characters/character/character.dm @@ -0,0 +1,128 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2024 Citadel Station Developers *// + +/** + * A character in the game. + * + * Represents humanoid actors. + * + * * AI / Cyborg support is rudimentary at this time. + * + * How this works: + * + * * Above all, /datum/character_status is allowed to arbitrarily restrain things. + * * Basic things like name, label, flavor text, etc, are set independently of everything. + * + * Then, + * + * * Core intrinsics like species are set first. + * * Character background generally only depends on species, but can depend on physiology too. + * * Character physiology generally only depends on species, but can depend on background too. + * * Character appearance generally depends on species, background, and physiology. + * + * Lastly, + * + * * Character loadout depends on everything else. + * * Extraneous data depends on everything else. + * + * Notes; + * + * * Anything that is a character field and not a system field / reference field + * should be prefixed with 'c_' + */ +/datum/character + //* System *// + //* -- Everything in here is handled by save / load backend. -- *// + /// character ID in the table + /// + /// * for savefile / legacy characters, this will **not be set.** + /// * if this is null, no persistence can proceed as we are operating in legacy / savefile mode. + var/character_id + /// current character status; used for anything from faction locking to persistence + /// + /// * this is saved / loaded even in legacy (savefile) mode + var/datum/character_status + + //* Appearance - Directly serialized *// + /// your main appearance + var/datum/character_appearance/appearance_primary + /// ordered appearance slots + /// + /// * this list can be at most [CHARACTER_MAX_APPEARANCE_SLOTS] long, and at least 0 long. + /// * this is basically a quirky lazy-list in that we only populate the later sections as it expands. + var/list/datum/character_appearance/appearance_slots + + //* Background - Directly serialized *// + /// Your character's background + var/datum/character_background/background + + //* Identity - Directly serialized *// + /// The character's true name. + /// + /// * Can be overridden by appearance slots. + var/c_name + /// short notes field for the player + /// + /// * this is for the entire character, not an appearance + var/c_label + + //* Identity - Packed into data list *// + /// the character's age + var/c_age + /// OOC notes + var/c_ooc_notes + + //* Inventory - Directly serialized *// + /// our inventory + var/datum/character_inventory/inventory + + //* Loadout - Directly serialized *// + /// ordered loadout slots + /// + /// * this list can be at most [CHARACTER_MAX_LOADOUT_SLOTS] long, and at least 0 long. + /// * this is basically a quirky lazy-list in that we only populate the later sections as it expands. + var/list/datum/character_loadout/loadout_slots + + //* Records - Are not stored in here. *// + /// Records are fetched from SScharacters. + + //* Roles - Packed into data list *// + /// + + //* Skills - Directly serialized *// + /// our skills holder + var/datum/character_skills/skills + + //* Species - Directly serialized *// + /// our species ID + var/c_species_id + + // todo: + // disabilities? + // mirror? + // special roles + // event roles + // communicator visibility? + // ringtone? + // traits? + // character dictory: (show/hide, tag, erptag, ad) + // suit sensor prefs + + // todo: hellish crap to deal with: + // pai: (name, description, role, ooc) + // silicons: (name, flavortext, ooc notes override) + // ignore list + // media system prefs + // vore prefs + // resleeving? + // autohiss? + // custom sayverbs?? + // nif + + // todo; notes: + // underwear --> items as loadout + // backpack --> backpack as loadout + // pda --> pda as loadout + +#warn impl + diff --git a/code/modules/characters/character/character_appearance.dm b/code/modules/characters/character/character_appearance.dm new file mode 100644 index 000000000000..ffd4bc308387 --- /dev/null +++ b/code/modules/characters/character/character_appearance.dm @@ -0,0 +1,86 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2024 Citadel Station Developers *// + +/** + * Stores the appearance state of a character. + * + * * Defers to /datum/character_physiology. + * * This means that physiology is always allowed to arbitarily + * override appearance whenever it wants. + */ +/datum/character_appearance + /// short notes field for the player, for this appearance slot + var/label + + /// name to use + /// + /// * overrides default if set on a slot + var/name + + /// The character's general flavor text + /// + /// * if set on a slot, the default flavortext will be suppressed + var/flavor_text_general + /// The character's per-zone flavor text + /// + /// * if set on a slot, the default flavortext will be suppressed + /// * Lazy list + var/flavor_text_zones + + /// headshot ref + /// + /// * overrides default if set on a slot + // todo: implement + var/ref_image_headshot + /// fullbody ref + /// + /// * overrides default if set on a slot + // todo: implement + var/ref_image_fullbody + + /// base bodyset to use + /// + /// * overrides default if set on a slot + /// * null = use species + var/bodyset_id + + /// base skin color to use + /// + /// * overrides default if set on a slot + var/skin_color + /// eye color to use + /// + /// * overrides default if set on a slot + var/eye_color + + /// sprite accessories; slot key to /datum/sprite_accessory_descriptor + /// + /// * overrides default if set on a slot, by key! + /// * lazy list + var/list/sprite_accessories + + /// bodyparts; bodypart key to /datum/character_bodypart_appearance + /// + /// * overrides default if set on a slot, by key! + /// * lazy list + var/list/bodypart_appearances + + /// transform multiplier, x + /// + /// * overrides default if set on a slot, by key! + var/size_x = 1 + /// transform multiplier, y + /// + /// * overrides default if set on a slot, by key! + var/size_y = 1 + /// use fuzzy rendering? default to FALSE + /// + /// * if FALSE, the person uses PIXEL_SCALE + /// * if TRUE, the person does not use PIXEL_SCALE + var/use_fuzzy_rendering = FALSE + +/datum/character_appearance/serialize() + +/datum/character_appearance/deserialize(list/data) + +#warn impl diff --git a/code/modules/characters/character/character_background.dm b/code/modules/characters/character/character_background.dm new file mode 100644 index 000000000000..149c939702ed --- /dev/null +++ b/code/modules/characters/character/character_background.dm @@ -0,0 +1,15 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2024 Citadel Station Developers *// + +/** + * Stores the background of a character. + * + * * Can be constrained by basic data like species. + */ +/datum/character_background + +/datum/character_background/serialize() + +/datum/character_background/deserialize(list/data) + +#warn impl diff --git a/code/modules/characters/character/character_bodypart_appearance.dm b/code/modules/characters/character/character_bodypart_appearance.dm new file mode 100644 index 000000000000..9b0de8fb7729 --- /dev/null +++ b/code/modules/characters/character/character_bodypart_appearance.dm @@ -0,0 +1,23 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2024 Citadel Station Developers *// + +/** + * Stores overrides for a bodypart. + * + * * Specifically appearance; does not store physiology! + */ +/datum/character_bodypart_appearance + /// bodyset override + var/bodyset_id + /// body markings + var/list/datum/bodyset_marking_descriptor/body_markings + /// override skin color + var/skin_color + +/datum/character_bodypart_appearance/serialize() + return list() + +/datum/character_bodypart_appearance/deserialize(list/data) + return + +#warn impl diff --git a/code/modules/characters/character/character_bodypart_physiology.dm b/code/modules/characters/character/character_bodypart_physiology.dm new file mode 100644 index 000000000000..e17484de273d --- /dev/null +++ b/code/modules/characters/character/character_bodypart_physiology.dm @@ -0,0 +1,17 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2024 Citadel Station Developers *// + +/** + * Stores overrides for a bodypart. + * + * * Specifically physiology; does not store appearance! + */ +/datum/character_bodypart_physiology + +/datum/character_bodypart_physiology/serialize() + return list() + +/datum/character_bodypart_physiology/deserialize(list/data) + return + +#warn impl diff --git a/code/modules/characters/character/character_inventory.dm b/code/modules/characters/character/character_inventory.dm new file mode 100644 index 000000000000..a77bf13f600b --- /dev/null +++ b/code/modules/characters/character/character_inventory.dm @@ -0,0 +1,19 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2024 Citadel Station Developers *// + +/** + * Stores items stored by a character. + * + * * Persistent inventory can live here for things like event characters / offmap characters. + * * Persistent loadout lives here. + */ +/datum/character_inventory + + +#warn impl + +/datum/character_inventory/serialize() + return list() + +/datum/character_inventory/deserialize(list/data) + return diff --git a/code/modules/characters/character/character_loadout.dm b/code/modules/characters/character/character_loadout.dm new file mode 100644 index 000000000000..2eb52c2c0f75 --- /dev/null +++ b/code/modules/characters/character/character_loadout.dm @@ -0,0 +1,22 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2024 Citadel Station Developers *// + +/** + * Stores a set of selected loadout items + */ +/datum/character_loadout + /// + var/list/selected_ids = list() + +/datum/character_loadout/serialize() + return list( + "selected" = selected_ids, + ) + +/datum/character_loadout/deserialize(list/data) + selected_ids = sanitize_islist(data, list()) + selected_ids.len = clamp(length(selected_ids), 0, CHARACTER_MAX_LOADOUT_ITEMS) + + +#warn impl + diff --git a/code/modules/characters/character/character_physiology.dm b/code/modules/characters/character/character_physiology.dm new file mode 100644 index 000000000000..7ffba77a8dc4 --- /dev/null +++ b/code/modules/characters/character/character_physiology.dm @@ -0,0 +1,14 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2024 Citadel Station Developers *// + +/** + * Stores the physiological state of a character, + * including species, organs, etc. + */ +/datum/character_physiology + /// blood color; rgb color + /// + /// * can be overridden by species + var/blood_color + +#warn impl diff --git a/code/modules/characters/character/character_record.dm b/code/modules/characters/character/character_record.dm new file mode 100644 index 000000000000..ca3a75476b1d --- /dev/null +++ b/code/modules/characters/character/character_record.dm @@ -0,0 +1,80 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2024 Citadel Station Developers *// + +/** + * Base type of a character record. + * + * * Requires database backend. + */ +/datum/character_record + /// database ID + /// + /// * set by serializer / deserializer; do not touch + /// * this is global, not per-character. + var/id + + /// flags + /// + /// * directly serialized to DB + var/character_record_flags = NONE + /// type + /// + /// * directly serialized to DB + /// * determines datum typepath!! + var/character_record_type + + //* audit fields *// + + /// string date of application + /// + /// * set by serializer / deserializer; do not touch + var/audit_timestamp + /// real ckey of writer + /// + /// * directly serialized to DB + /// * this can be null if unknown. + /// * this is not always accurate; the game tries to guess this from usually-accurate metrics. + /// * if you're reading this as an admin, do your own investigation, seriously; don't follow this blindly. + /// * this is OOC information and should never be viewable by players + var/audit_player_id + /// real character ID of writer + /// + /// * directly serialized to DB + /// * this can be null if unknown. + /// * this is not always accurate; the game tries to guess this from usually-accurate metrics. + /// * if you're reading this as an admin, do your own investigation, seriously; don't follow this blindly. + /// * this is OOC information and should never be viewable by players + var/audit_character_id + #warn these are logs, not fields on the record itself. + + //* common record fields *// + + /// string date-time this was applied on + /// + /// * this is IC time + var/r_timestamp + /// location; where was this added? + var/r_location + /// label; short description + var/r_label + /// is content plaintext? + /// + /// todo: for now, everything is CHARACTER_RECORD_CONTENT_TYPE_PLAINTEXT, + /// rich-er content support comes later + var/r_content_type = CHARACTER_RECORD_CONTENT_TYPE_PLAINTEXT + /// text; long description + var/r_content + /// author character id + /// + /// * set by serializer / deserializer, do not touch + var/r_author_character_id + + // TODO: how do we record characters if names are not UIDs? + +#warn impl + +/datum/character_record/serialize() + return list() + +/datum/character_record/deserialize(list/data) + return diff --git a/code/modules/characters/character/character_record/employment.dm b/code/modules/characters/character/character_record/employment.dm new file mode 100644 index 000000000000..ece15076b1db --- /dev/null +++ b/code/modules/characters/character/character_record/employment.dm @@ -0,0 +1,8 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2024 Citadel Station Developers *// + +/** + * for employment records within a faction + */ +/datum/character_record/employment + character_record_type = CHARACTER_RECORD_TYPE_EMPLOYMENT diff --git a/code/modules/characters/character/character_record/incident.dm b/code/modules/characters/character/character_record/incident.dm new file mode 100644 index 000000000000..ea508bca656c --- /dev/null +++ b/code/modules/characters/character/character_record/incident.dm @@ -0,0 +1,10 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2024 Citadel Station Developers *// + +/** + * for incident records within a faction + * + * * usually used by someone's own faction + */ +/datum/character_record/incident + character_record_type = CHARACTER_RECORD_TYPE_INCIDENT diff --git a/code/modules/characters/character/character_record/intelligence.dm b/code/modules/characters/character/character_record/intelligence.dm new file mode 100644 index 000000000000..364499f781a8 --- /dev/null +++ b/code/modules/characters/character/character_record/intelligence.dm @@ -0,0 +1,10 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2024 Citadel Station Developers *// + +/** + * for faction intelligence (e.g. exploitable information) + * + * * usually used by a faction that someone doesn't belong to. usually. + */ +/datum/character_record/intelligence + character_record_type = CHARACTER_RECORD_TYPE_INTELLIGENCE diff --git a/code/modules/characters/character/character_record/medical.dm b/code/modules/characters/character/character_record/medical.dm new file mode 100644 index 000000000000..96bd5da12081 --- /dev/null +++ b/code/modules/characters/character/character_record/medical.dm @@ -0,0 +1,10 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2024 Citadel Station Developers *// + +/** + * for medical records within a faction + * + * * usually used by someone's own faction + */ +/datum/character_record/medical + character_record_type = CHARACTER_RECORD_TYPE_MEDICAL diff --git a/code/modules/characters/character/character_skills.dm b/code/modules/characters/character/character_skills.dm new file mode 100644 index 000000000000..81e4844ecf12 --- /dev/null +++ b/code/modules/characters/character/character_skills.dm @@ -0,0 +1,9 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2024 Citadel Station Developers *// + +/** + * Skills holder for character datums. + */ +/datum/character_skills + +#warn impl diff --git a/code/modules/characters/character/character_status.dm b/code/modules/characters/character/character_status.dm new file mode 100644 index 000000000000..4d069391ace9 --- /dev/null +++ b/code/modules/characters/character/character_status.dm @@ -0,0 +1,15 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2024 Citadel Station Developers *// + +/** + * Status datastructure for characters. + * + * Stores things like; + * + * * which faction you're currently in + * * if you're allowed to use loadouts / etc + * * persistent state + */ +/datum/character_status + +#warn impl diff --git a/code/modules/characters/character_setup/character_setup.dm b/code/modules/characters/character_setup/character_setup.dm new file mode 100644 index 000000000000..5b9c45d67102 --- /dev/null +++ b/code/modules/characters/character_setup/character_setup.dm @@ -0,0 +1,31 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2024 Citadel Station Developers *// + +/** + * TGUI character setup: core datum + */ +/datum/character_setup + /// bound player + var/client/active_client + /// currently loaded character + var/datum/character/active_character + +#warn impl + +/datum/character_setup/ui_data(mob/user, datum/tgui/ui) + . = ..() + +/datum/character_setup/ui_static_data(mob/user, datum/tgui/ui) + . = ..() + +/datum/character_setup/ui_asset_injection(datum/tgui/ui, list/immediate, list/deferred) + // inject necessary asset packs + deferred += /datum/asset_pack/json/character_appearance + deferred += /datum/asset_pack/json/character_background + deferred += /datum/asset_pack/json/character_loadout + deferred += /datum/asset_pack/json/character_setup + deferred += /datum/asset_pack/spritesheet/bodyset_markings + deferred += /datum/asset_pack/spritesheet/bodysets + deferred += /datum/asset_pack/spritesheet/loadout + deferred += /datum/asset_pack/spritesheet/species + deferred += /datum/asset_pack/spritesheet/sprite_accessories diff --git a/code/modules/characters/character_shapeshift/character_shapeshift.dm b/code/modules/characters/character_shapeshift/character_shapeshift.dm new file mode 100644 index 000000000000..2e9d27081978 --- /dev/null +++ b/code/modules/characters/character_shapeshift/character_shapeshift.dm @@ -0,0 +1,14 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2024 Citadel Station Developers *// + +/** + * Not truly used in the character module, but this is such an useful utility + * for shapeshifters and disguising functionalities for both crew and antagonists. + * + * * This basically lets you use the datastructures of the character API to + * describe and transform a mob, make fake clothing, etc. + */ +/datum/character_shapeshift + /// character appearance + var/datum/character_appearance/appearance + #warn how to deal with clothing diff --git a/code/modules/characters/character_shapeshift/character_shapeshift_holder.dm b/code/modules/characters/character_shapeshift/character_shapeshift_holder.dm new file mode 100644 index 000000000000..e5247bbba32f --- /dev/null +++ b/code/modules/characters/character_shapeshift/character_shapeshift_holder.dm @@ -0,0 +1,12 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2024 Citadel Station Developers *// + +/** + * Holds a set of shapeshifts, and provides default handling for slots and stuff. + * + * * Can be embedded as an UI module. + * * Can also be used standalone + */ +/datum/character_shapeshift_holder + +#warn impl diff --git a/code/modules/loadout/loadout_entry.dm b/code/modules/loadout/loadout_entry.dm index ca64bbdc684b..db193da02f80 100644 --- a/code/modules/loadout/loadout_entry.dm +++ b/code/modules/loadout/loadout_entry.dm @@ -13,6 +13,7 @@ var/list/gear_datums = list() .["categories"] = categories .["maxEntries"] = LOADOUT_MAX_ITEMS +// todo: /loadout_item /datum/loadout_entry abstract_type = /datum/loadout_entry @@ -110,6 +111,12 @@ var/list/gear_datums = list() return spawned +/** + * Binding: tgui/bindings/datum/Game_LoadoutItem + */ +/datum/loadout_entry/proc/tgui_data() + #warn impl + /hook/startup/proc/populate_gear_list() // Create a list of gear datums to sort diff --git a/code/modules/loadout/loadout_item_descriptor.dm b/code/modules/loadout/loadout_item_descriptor.dm new file mode 100644 index 000000000000..c34d03cb6cec --- /dev/null +++ b/code/modules/loadout/loadout_item_descriptor.dm @@ -0,0 +1,24 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2024 Citadel Station Developers *// + +/** + * Instance descriptor of loadout items + */ +/datum/loadout_item_descriptor + /// loadout_item id + var/id + /// packed coloration string + var/coloration + +#warn impl + +/datum/loadout_item_descriptor/serialize() + return list() + +/datum/loadout_item_descriptor/deserialize(list/data) + +/** + * Binding: tgui/bindings/datum/Game_LoadoutItemDescriptor + */ +/datum/loadout_item_descriptor/proc/tgui_data() + #warn impl diff --git a/code/modules/mob/characteristics/modifier.dm b/code/modules/mob/characteristics/characteristic_modifier.dm similarity index 100% rename from code/modules/mob/characteristics/modifier.dm rename to code/modules/mob/characteristics/characteristic_modifier.dm diff --git a/code/modules/mob/characteristics/presets.dm b/code/modules/mob/characteristics/characteristic_preset.dm similarity index 100% rename from code/modules/mob/characteristics/presets.dm rename to code/modules/mob/characteristics/characteristic_preset.dm diff --git a/code/modules/mob/characteristics/skill.dm b/code/modules/mob/characteristics/characteristic_skill.dm similarity index 100% rename from code/modules/mob/characteristics/skill.dm rename to code/modules/mob/characteristics/characteristic_skill.dm diff --git a/code/modules/mob/characteristics/stat.dm b/code/modules/mob/characteristics/characteristic_stat.dm similarity index 100% rename from code/modules/mob/characteristics/stat.dm rename to code/modules/mob/characteristics/characteristic_stat.dm diff --git a/code/modules/mob/characteristics/talent.dm b/code/modules/mob/characteristics/characteristic_talent.dm similarity index 100% rename from code/modules/mob/characteristics/talent.dm rename to code/modules/mob/characteristics/characteristic_talent.dm diff --git a/code/modules/mob/characteristics/holder.dm b/code/modules/mob/characteristics/characteristics_holder.dm similarity index 100% rename from code/modules/mob/characteristics/holder.dm rename to code/modules/mob/characteristics/characteristics_holder.dm diff --git a/code/modules/sprite_accessories/sprite_accessory.dm b/code/modules/sprite_accessories/sprite_accessory.dm index 9c151d4cf69c..531b40165938 100644 --- a/code/modules/sprite_accessories/sprite_accessory.dm +++ b/code/modules/sprite_accessories/sprite_accessory.dm @@ -232,6 +232,12 @@ GLOBAL_LIST_EMPTY(sprite_accessory_icon_cache) ), ) +/** + * Binding: tgui/bindings/datum/Game_SpriteAccessory + */ +/datum/sprite_accessory/proc/tgui_data() + #warn impl + //* Resolution *// /** diff --git a/code/modules/sprite_accessories/sprite_accessory_descriptor.dm b/code/modules/sprite_accessories/sprite_accessory_descriptor.dm new file mode 100644 index 000000000000..d446a234aab3 --- /dev/null +++ b/code/modules/sprite_accessories/sprite_accessory_descriptor.dm @@ -0,0 +1,39 @@ +//* This file is explicitly licensed under the MIT license. *// +//* Copyright (c) 2024 Citadel Station Developers *// + +/** + * Instance descriptors of sprite accessories. + */ +/datum/sprite_accessory_descriptor + /// sprite accessory ID + var/id + /// color channels, packed + var/packed_coloration + /// color channels, unpacked + /// + /// * this follows the coloration format; this is not necessarily a list of colors + /// * this is done on render + var/list/unpacked_coloration + /// emissive power; 0 to 255, with 0 being off + var/emissive = 0 + +/datum/sprite_accessory_descriptor/serialize() + return list( + "id" = id, + "coloration" = packed_coloration, + "emissive" = emissive, + ) + +/datum/sprite_accessory_descriptor/deserialize(list/data) + id = data["id"] + packed_coloration = data["coloration"] + emissive = data["emissive"] + +#warn set_coloration +#warn sanitize_and_validate + +/** + * Binding: tgui/bindings/datum/Game_SpriteAccessoryDescriptor + */ +/datum/sprite_accessory_descriptor/proc/tgui_data() + #warn impl diff --git a/code/unit_tests/character_saving.dm b/code/unit_tests/character_saving.dm deleted file mode 100644 index 8d978a630d80..000000000000 --- a/code/unit_tests/character_saving.dm +++ /dev/null @@ -1,18 +0,0 @@ -/datum/unit_test/character_saving/Run() - try - var/datum/preferences/P = new - P.load_path("test") - P.features["flavor_text"] = "Foo" - P.features["ooc_notes"] = "Bar" - P.save_character() - P.load_character() - if(P.features["flavor_text"] != "Foo") - Fail("Flavor text is failing to save.") - if(P.features["ooc_notes"] != "Bar") - Fail("OOC text is failing to save.") - P.save_character() - P.load_character() - if(P.features["flavor_text"] != "Foo") - Fail("Repeated saving and loading possibly causing save deletion.") - catch(var/exception/e) - Fail("Failed to save and load character due to exception [e.file]:[e.line], [e.name]") diff --git a/tgui/packages/tgui/bindings/README.md b/tgui/packages/tgui/bindings/README.md new file mode 100644 index 000000000000..9ac1d2c531df --- /dev/null +++ b/tgui/packages/tgui/bindings/README.md @@ -0,0 +1,19 @@ +# Bindings + +## Struct Datums + +Format: It goes under `datum/`, and will be named `Game_CamelCasePath`. + +This is only for 'struct' datums without many subtypes. + +Example: + +`/datum/loadout_item` becomes `datum/Game_LoadoutItem.ts` + +Do not be fancy, just do it. + +## Asset Pack JSON's + +Example: + +`/datum/asset_pack/json/character_setup`'s contents should be defined in `asset_packs/Pack_CharacterSetup` diff --git a/tgui/packages/tgui/bindings/asset_packs/Pack_CharacterAppearance.ts b/tgui/packages/tgui/bindings/asset_packs/Pack_CharacterAppearance.ts new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tgui/packages/tgui/bindings/asset_packs/Pack_CharacterBackground.ts b/tgui/packages/tgui/bindings/asset_packs/Pack_CharacterBackground.ts new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tgui/packages/tgui/bindings/asset_packs/Pack_CharacterLoadout.ts b/tgui/packages/tgui/bindings/asset_packs/Pack_CharacterLoadout.ts new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tgui/packages/tgui/bindings/asset_packs/Pack_CharacterSetup.ts b/tgui/packages/tgui/bindings/asset_packs/Pack_CharacterSetup.ts new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tgui/packages/tgui/bindings/datum/Game_Bodyset.ts b/tgui/packages/tgui/bindings/datum/Game_Bodyset.ts new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tgui/packages/tgui/bindings/datum/Game_BodysetMarking.ts b/tgui/packages/tgui/bindings/datum/Game_BodysetMarking.ts new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tgui/packages/tgui/bindings/datum/Game_BodysetMarkingDescriptor.ts b/tgui/packages/tgui/bindings/datum/Game_BodysetMarkingDescriptor.ts new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tgui/packages/tgui/bindings/datum/Game_LoadoutItem.ts b/tgui/packages/tgui/bindings/datum/Game_LoadoutItem.ts new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tgui/packages/tgui/bindings/datum/Game_LoadoutItemDescriptor.ts b/tgui/packages/tgui/bindings/datum/Game_LoadoutItemDescriptor.ts new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tgui/packages/tgui/bindings/datum/Game_SpriteAccessory.ts b/tgui/packages/tgui/bindings/datum/Game_SpriteAccessory.ts new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/tgui/packages/tgui/bindings/datum/Game_SpriteAccessoryDescriptor.ts b/tgui/packages/tgui/bindings/datum/Game_SpriteAccessoryDescriptor.ts new file mode 100644 index 000000000000..e69de29bb2d1