Skip to content

Commit

Permalink
feat(custom): add flags for custom items
Browse files Browse the repository at this point in the history
  • Loading branch information
Doster-d committed Jan 30, 2024
1 parent cde6b49 commit 678c812
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions code/modules/client/preference_setup/loadout/lists/custom.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)

Expand Down
2 changes: 2 additions & 0 deletions code/modules/customitems/item_spawning.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions config/schema/custom_items.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand Down

0 comments on commit 678c812

Please sign in to comment.