s
This commit is contained in:
@@ -15,4 +15,4 @@
|
||||
#define DONATOR_GROUP_TIER_2 "T2"
|
||||
#define DONATOR_GROUP_TIER_3 "T3"
|
||||
|
||||
#define IS_CKEY_DONATOR_GROUP(ckey, group) is_donator_group(ckey, group)
|
||||
#define IS_CKEY_DONATOR_GROUP(ckey, groupid) is_donator_group(ckey, groupid)
|
||||
|
||||
@@ -11,16 +11,15 @@ For fast lookups, this is generated using regenerate_donator_grouping_list()
|
||||
|
||||
/proc/is_donator_group(ckey, group)
|
||||
ckey = ckey(ckey) //make sure it's ckey'd.
|
||||
return GLOB.donators_by_group[group]?.Find(ckey)
|
||||
var/list/L = GLOB.donators_by_group[group]
|
||||
return L && L.Find(ckey)
|
||||
|
||||
/proc/regenerate_donator_grouping_list()
|
||||
var/list/donator_list = GLOB.donators_by_group = list() //reinit everything
|
||||
|
||||
var/list/inclusive_add = list() //speed!
|
||||
|
||||
inclusive_add += TIER_1_DONATORS
|
||||
donator_list[DONATOR_GROUP_TIER_1] = inclusive_add.Copy()
|
||||
inclusive_add += TIER_2_DONATORS
|
||||
donator_list[DONATOR_GROUP_TIER_2] = inclusive_add.Copy()
|
||||
inclusive_add += TIER_3_DONATORS
|
||||
donator_list[DONATOR_GROUP_TIER_3] = inclusive_add.Copy()
|
||||
GLOB.donators_by_group = list() //reinit everything
|
||||
var/list/donator_list = GLOB.donators_by_group //cache
|
||||
var/list/tier_1 = TIER_1_DONATORS
|
||||
donator_list[DONATOR_GROUP_TIER_1] = tier_1.Copy() //The .Copy() is to "decouple"/make a new list, rather than letting the global list impact the config list.
|
||||
var/list/tier_2 = tier_1 + TIER_2_DONATORS //Using + on lists implies making new lists, so we don't need to manually Copy().
|
||||
donator_list[DONATOR_GROUP_TIER_2] = tier_2
|
||||
var/list/tier_3 = tier_2 + TIER_3_DONATORS
|
||||
donator_list[DONATOR_GROUP_TIER_3] = tier_3
|
||||
|
||||
@@ -914,11 +914,9 @@ GLOBAL_LIST_EMPTY(preferences_datums)
|
||||
dat += "<td width=80%><font size=2><b>Description</b></font></td></tr>"
|
||||
for(var/j in GLOB.loadout_items[gear_tab])
|
||||
var/datum/gear/gear = GLOB.loadout_items[gear_tab][j]
|
||||
var/donoritem
|
||||
if(gear.ckeywhitelist && gear.ckeywhitelist.len)
|
||||
donoritem = TRUE
|
||||
if(!(user.ckey in gear.ckeywhitelist))
|
||||
continue
|
||||
var/donoritem = gear.donoritem
|
||||
if(donoritem && !gear.donator_ckey_check(user.ckey))
|
||||
continue
|
||||
var/class_link = ""
|
||||
if(gear.type in chosen_gear)
|
||||
class_link = "style='white-space:normal;' class='linkOn' href='?_src_=prefs;preference=gear;toggle_gear_path=[html_encode(j)];toggle_gear=0'"
|
||||
@@ -2225,7 +2223,7 @@ GLOBAL_LIST_EMPTY(preferences_datums)
|
||||
if(!is_loadout_slot_available(G.category))
|
||||
to_chat(user, "<span class='danger'>You cannot take this loadout, as you've already chosen too many of the same category!</span>")
|
||||
return
|
||||
if(G.ckeywhitelist && G.ckeywhitelist.len && !(user.ckey in G.ckeywhitelist))
|
||||
if(G.donoritem && !G.donator_ckey_check(user.ckey))
|
||||
to_chat(user, "<span class='danger'>This is an item intended for donator use only. You are not authorized to use this item.</span>")
|
||||
return
|
||||
if(gear_points >= initial(G.cost))
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
var/permitted = TRUE
|
||||
if(G.restricted_roles && G.restricted_roles.len && !(M.mind.assigned_role in G.restricted_roles))
|
||||
permitted = FALSE
|
||||
if(G.ckeywhitelist && G.ckeywhitelist.len && !(the_mob.client.ckey in G.ckeywhitelist))
|
||||
if(G.donoritem && !G.donator_ckey_check(the_mob.client.ckey))
|
||||
permitted = FALSE
|
||||
if(!equipbackpackstuff && G.category == SLOT_IN_BACKPACK)//snowflake check since plopping stuff in the backpack doesnt work for pre-job equip loadout stuffs
|
||||
permitted = FALSE
|
||||
|
||||
@@ -51,14 +51,31 @@ GLOBAL_LIST_EMPTY(loadout_whitelist_ids)
|
||||
var/cost = 1 //normally, each loadout costs a single point.
|
||||
var/geargroupID //defines the ID that the gear inherits from the config
|
||||
|
||||
//NEW DONATOR SYTSEM STUFF
|
||||
var/donoritem //autoset on new if null
|
||||
var/donator_group_id //New donator group ID system.
|
||||
//END
|
||||
|
||||
var/list/restricted_roles
|
||||
|
||||
//Old donator system/snowflake ckey whitelist, used for single ckeys/exceptions
|
||||
var/list/ckeywhitelist
|
||||
//END
|
||||
|
||||
var/restricted_desc
|
||||
|
||||
/datum/gear/New()
|
||||
..()
|
||||
if(isnull(donoritem))
|
||||
if(donator_group_id || ckeywhitelist)
|
||||
donoritem = TRUE
|
||||
if(!description && path)
|
||||
var/obj/O = path
|
||||
description = initial(O.desc)
|
||||
|
||||
//a comprehensive donator check proc is intentionally not implemented due to the fact that we (((might))) have job-whitelists for donator items in the future and I like to stay on the safe side.
|
||||
|
||||
//ckey only check
|
||||
/datum/gear/proc/donator_ckey_check(key)
|
||||
if(ckeywhitelist && ckeywhitelist.Find(key))
|
||||
return TRUE
|
||||
return IS_CKEY_DONATOR_GROUP(key, donator_group_id)
|
||||
|
||||
-3061
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user