Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tweak(customs): add optional patron requirement #10651

Merged
merged 1 commit into from
Oct 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions code/__defines/donations_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#define PATREON_CULTIST "cultist"
#define PATREON_ASSISTANT "assistant"

// IMPORTANT (!!!) KEEP THE ASCENDING ORDER (more benefits -> place it on the right) OTHERWISE IT BREAKS CUSTOM ITEMS ASSIGNATION
#define PATREON_ALL_TIERS list(\
PATREON_NONE, PATREON_CARGO, PATREON_ENGINEER, \
PATREON_SCIENTIST, PATREON_HOS, PATREON_CAPTAIN, \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
var/ckey // assigned ckey of custom item owner
var/required_access
var/datum/custom_item/item_data
var/patreon_type

/datum/gear/custom_item/New(key, item_path, datum/custom_item/data)
var/obj/item/A = item_path
Expand Down Expand Up @@ -32,6 +33,9 @@
gear_tweaks += new /datum/gear_tweak/custom(item_data)

/datum/gear/custom_item/is_allowed_to_display(mob/user)
var/list/patreon_all_tiers = PATREON_ALL_TIERS
if(patreon_type && patreon_all_tiers.Find(user?.client?.donator_info.patron_type) < patreon_all_tiers.Find(patreon_type))
return FALSE
return user.ckey == ckey

/datum/gear/custom_item/is_allowed_to_equip(mob/user)
Expand Down
1 change: 1 addition & 0 deletions code/modules/customitems/item_spawning.dm
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@
current_data.assoc_key = ckey
current_data.item_path = item_path
var/datum/gear/custom_item/G = new(ckey, item_path, current_data)
G.patreon_type = item_data["patreon_type"]

var/use_name = G.display_name
var/use_category = G.sort_category
Expand Down
4 changes: 4 additions & 0 deletions config/schema/custom_items.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@
},
"additional_data": {
"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."
}
},
"required": ["item"],
Expand Down
Loading