-
Notifications
You must be signed in to change notification settings - Fork 51
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
92 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#define DONATOR_GROUPING_TIER_1_CONFIG_PATH /datum/config_entry/keyed_list/donator/tier_1_donators | ||
#define DONATOR_GROUPING_TIER_2_CONFIG_PATH /datum/config_entry/keyed_list/donator/tier_2_donators | ||
#define DONATOR_GROUPING_TIER_3_CONFIG_PATH /datum/config_entry/keyed_list/donator/tier_3_donators | ||
|
||
#define DONATOR_GROUPING_TIER_1_CONFIG_SUBPATH keyed_list/donator/tier_1_donators | ||
#define DONATOR_GROUPING_TIER_2_CONFIG_SUBPATH keyed_list/donator/tier_2_donators | ||
#define DONATOR_GROUPING_TIER_3_CONFIG_SUBPATH keyed_list/donator/tier_3_donators | ||
|
||
#define TIER_1_DONATORS CONFIG_GET(DONATOR_GROUPING_TIER_1_CONFIG_SUBPATH) | ||
#define TIER_2_DONATORS CONFIG_GET(DONATOR_GROUPING_TIER_2_CONFIG_SUBPATH) | ||
#define TIER_3_DONATORS CONFIG_GET(DONATOR_GROUPING_TIER_3_CONFIG_SUBPATH) | ||
|
||
//flags | ||
#define DONATOR_GROUP_TIER_1 "T1" | ||
#define DONATOR_GROUP_TIER_2 "T2" | ||
#define DONATOR_GROUP_TIER_3 "T3" | ||
|
||
#define IS_CKEY_DONATOR_GROUP(ckey, group) is_donator_group(ckey, group) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
Current specifications: | ||
Donator groups in __DEFINES/donator_groupings.dm, config entries in controllers/configuration/entries/donator.dm | ||
3 groups, Tier 1/2/3 | ||
Each tier includes the one before it (ascending) | ||
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) | ||
|
||
/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() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
GLOBAL_LIST_EMPTY(donators_by_group) //group id = donator list of ckeys |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/datum/config_entry/keyed_list/donator_group | ||
key_mode = KEY_MODE_TEXT | ||
value_mode = VALUE_MODE_FLAG | ||
abstract_type = /datum/config_entry/keyed_list/donator_group | ||
|
||
//If we're in the middle of a config load, only do the regeneration afterwards to prevent this from wasting a massive amount of CPU for list regenerations. | ||
/datum/config_entry/keyed_list/donator_group/ValidateAndSet(str_val, during_load) | ||
. = ..() | ||
if(. && during_load) | ||
regenerate_donator_grouping_list() | ||
|
||
/datum/config_entry/keyed_list/donator_group/OnPostload() | ||
. = ..() | ||
regenerate_donator_grouping_list() | ||
|
||
//This is kinda weird in that the config entries are defined here but all the handling/calculations are in __HELPERS/donator_groupings.dm | ||
|
||
/datum/config_entry/keyed_list/donator_group/tier_1_donators | ||
|
||
/datum/config_entry/keyed_list/donator_group/tier_2_donators | ||
|
||
/datum/config_entry/keyed_list/donator_group/tier_3_donators |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#this is a bad system but I'm lazy so it piggybacks off config loader system. | ||
#Specify group followed by ckey for each ckey. | ||
|
||
#TIER_1_DONATORS test_ckey | ||
|
||
#TIER_2_DONATORS test_ckey | ||
|
||
#TIER_3_DONATORS test_ckey |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters