From 678c8126cb60db395ec8c7ccbc11b8fede227e47 Mon Sep 17 00:00:00 2001 From: Doster <63081538+Doster-d@users.noreply.github.com> Date: Tue, 30 Jan 2024 09:29:21 +0300 Subject: [PATCH] feat(custom): add flags for custom items --- .../client/preference_setup/loadout/lists/custom.dm | 8 ++++++++ code/modules/customitems/item_spawning.dm | 2 ++ config/schema/custom_items.schema.json | 6 ++++++ 3 files changed, 16 insertions(+) diff --git a/code/modules/client/preference_setup/loadout/lists/custom.dm b/code/modules/client/preference_setup/loadout/lists/custom.dm index 88039e5c4c1..d9343d3fc81 100644 --- a/code/modules/client/preference_setup/loadout/lists/custom.dm +++ b/code/modules/client/preference_setup/loadout/lists/custom.dm @@ -4,6 +4,11 @@ var/required_access var/datum/custom_item/item_data var/patreon_type + var/static/list/gear_flag_names_to_flag = list( + "GEAR_HAS_COLOR_SELECTION" = 1, + "GEAR_HAS_TYPE_SELECTION" = 2, + "GEAR_HAS_SUBTYPE_SELECTION" = 4, + ) /datum/gear/custom_item/New(key, item_path, datum/custom_item/data) var/obj/item/A = item_path @@ -29,6 +34,9 @@ allowed_roles = job_types required_access = data.req_access item_data = data + if(length(data.flags_list)) + for(var/flag_name in data.flags_list) + flags |= gear_flag_names_to_flag[flag_name] ..() gear_tweaks += new /datum/gear_tweak/custom(item_data) diff --git a/code/modules/customitems/item_spawning.dm b/code/modules/customitems/item_spawning.dm index bac0f8362ac..e56301ad1d2 100644 --- a/code/modules/customitems/item_spawning.dm +++ b/code/modules/customitems/item_spawning.dm @@ -28,6 +28,7 @@ var/item_path_as_string var/req_access = 0 var/list/req_titles = list() + var/list/flags_list = list() var/kit_name var/kit_desc var/kit_icon @@ -164,6 +165,7 @@ current_data.req_access = item_data["req_access"] current_data.req_titles = item_data["req_titles"] current_data.additional_data = item_data["additional_data"] + current_data.flags_list = item_data["flags_list"] current_data.assoc_key = ckey current_data.item_path = item_path diff --git a/config/schema/custom_items.schema.json b/config/schema/custom_items.schema.json index 3eb5c2459a0..65701d1e9fc 100644 --- a/config/schema/custom_items.schema.json +++ b/config/schema/custom_items.schema.json @@ -71,6 +71,12 @@ "additional_data": { "type": "string" }, + "flags_list": { + "type": "array", + "items": { + "type": "string" + } + }, "patreon_type": { "type": "string", "description": "If there's no nil string, it will be required to have this patreon type or higher to posses item."