Skip to content

Commit

Permalink
poobs i think i did it (#5186)
Browse files Browse the repository at this point in the history
  • Loading branch information
Veth-s authored Jan 30, 2025
1 parent f7af2d8 commit 55c5f9a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
16 changes: 9 additions & 7 deletions monkestation/code/datums/meta_tokens.dm
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ GLOBAL_LIST_INIT(patreon_etoken_values, list(
var/antag_timeout
/// The timer for the event token timeout
var/event_timeout
/// The month we last used a donator token on
var/token_month = 0

/datum/meta_token_holder/New(client/creator)
. = ..()
Expand Down Expand Up @@ -72,6 +74,7 @@ GLOBAL_LIST_INIT(patreon_etoken_values, list(
event_tokens = saved_tokens["event_tokens"]
event_token_month = saved_tokens["event_token_month"]
donator_token = saved_tokens["donator"]
token_month = saved_tokens["donator_token_month"]

total_antag_tokens = total_low_threat_tokens + total_medium_threat_tokens + total_high_threat_tokens

Expand All @@ -90,6 +93,7 @@ GLOBAL_LIST_INIT(patreon_etoken_values, list(
"event_tokens" = event_tokens,
"event_token_month" = event_token_month,
"donator" = donator_token,
"donator_token_month" = token_month,
)
backup_tokens()
owner.prefs.save_preferences()
Expand All @@ -101,29 +105,27 @@ GLOBAL_LIST_INIT(patreon_etoken_values, list(
return FALSE

var/month_number = text2num(time2text(world.time, "MM"))
if(owner.prefs.token_month == 0)
owner.prefs.token_month = month_number
if(owner.prefs.token_month != month_number)

if(token_month != month_number)
if(patreon.has_access(ACCESS_NUKIE_RANK)) ///if nukie rank, get coins AND token
owner.prefs.adjust_metacoins(owner?.ckey, 10000, "Monthly Monkecoin rations.", TRUE, FALSE, FALSE)

donator_token++
owner.prefs.token_month = month_number ///update per-person month counter
token_month = month_number ///update per-person month counter
convert_tokens_to_list()
return TRUE

else
owner.prefs.token_month = month_number
token_month = month_number
convert_tokens_to_list()
return FALSE

/datum/meta_token_holder/proc/spend_antag_token(tier, use_donor = FALSE)
if(use_donor)
if(donator_token)
donator_token--
logger.Log(LOG_CATEGORY_META, "[owner], used donator token on [owner.prefs.token_month].")
owner.prefs.save_preferences()
logger.Log(LOG_CATEGORY_META, "[owner], used donator token on [token_month].")
convert_tokens_to_list()
return

switch(tier)
Expand Down
3 changes: 0 additions & 3 deletions monkestation/code/modules/client/preference_savefile.dm
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@
savefile.set_entry("channel_volume", channel_volume)
savefile.set_entry("saved_tokens", saved_tokens)
savefile.set_entry("extra_stat_inventory", extra_stat_inventory)
if(token_month)
savefile.set_entry("token_month", token_month)
savefile.set_entry("lootboxes_owned", lootboxes_owned)
savefile.set_entry("antag_rep", antag_rep)

Expand All @@ -79,7 +77,6 @@
extra_stat_inventory = savefile.get_entry("extra_stat_inventory", extra_stat_inventory)
extra_stat_inventory = SANITIZE_LIST(extra_stat_inventory)

token_month = savefile.get_entry("token_month", token_month)
lootboxes_owned = savefile.get_entry("lootboxes_owned", lootboxes_owned)
antag_rep = savefile.get_entry("antag_rep", antag_rep)

3 changes: 1 addition & 2 deletions monkestation/code/modules/client/preferences.dm
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,14 @@
"event_tokens" = 0,
"event_token_month" = 0,
"donator" = 0,
"donator_token_month" = 0,
)

///amount of metaconis you can earn per shift
var/max_round_coins = 1000

///Alternative job titles stored in preferences. Assoc list, ie. alt_job_titles["Scientist"] = "Cytologist"
var/list/alt_job_titles = list()
/// the month we used our last donator token on
var/token_month = 0
/// these are inventory items that require external data to load correctly
var/list/extra_stat_inventory = list(
"unusual" = list(),
Expand Down

0 comments on commit 55c5f9a

Please sign in to comment.