From 41696e038d8f538f3ce27eb347331fe98d748eb5 Mon Sep 17 00:00:00 2001
From: wraith-54321 <69217972+wraith-54321@users.noreply.github.com>
Date: Thu, 16 Nov 2023 01:27:14 -0800
Subject: [PATCH] workstm
---
code/__DEFINES/~monkestation/admin.dm | 4 +-
code/modules/admin/admin_verbs.dm | 5 +-
code/modules/admin/topic.dm | 36 ++++++++---
monkestation/code/datums/meta_tokens.dm | 60 ++++++++++++++++---
.../code/modules/admin/antag_tokens.dm | 3 +-
.../code/modules/admin/event_tokens.dm | 16 ++---
.../code/modules/client/event_tokens.dm | 1 -
monkestation/code/modules/client/verbs.dm | 53 +++++++---------
.../modules/code_redemption/code_redeemer.dm | 2 +-
.../modules/twitch_bits/events/amongus.dm | 3 +-
.../modules/twitch_bits/events/anime_ook.dm | 1 +
.../twitch_bits/events/australia_mode.dm | 1 +
.../code/modules/twitch_bits/events/buff.dm | 1 +
.../modules/twitch_bits/events/chuckle_nut.dm | 1 +
.../modules/twitch_bits/events/die_fate.dm | 2 +
.../modules/twitch_bits/events/random_item.dm | 1 +
.../code/modules/twitch_bits/events/rod.dm | 1 +
.../code/modules/twitch_bits/events/skinny.dm | 1 +
.../code/modules/twitch_bits/twitch_system.dm | 14 ++++-
tgstation.dme | 1 -
20 files changed, 141 insertions(+), 66 deletions(-)
delete mode 100644 monkestation/code/modules/client/event_tokens.dm
diff --git a/code/__DEFINES/~monkestation/admin.dm b/code/__DEFINES/~monkestation/admin.dm
index bf7b9207aa53..f705fdb26b2b 100644
--- a/code/__DEFINES/~monkestation/admin.dm
+++ b/code/__DEFINES/~monkestation/admin.dm
@@ -1,5 +1,5 @@
-#define ADMIN_APPROVE_TOKEN(user) "(Yes)"
-#define ADMIN_REJECT_TOKEN(user) "(No)"
+#define ADMIN_APPROVE_ANTAG_TOKEN(user) "(Yes)"
+#define ADMIN_REJECT_ANTAG_TOKEN(user) "(No)"
#define ADMIN_OPEN_REVIEW(id) "(Open Review)"
#define ADMIN_APPROVE_TOKEN_EVENT(user) "(Yes)"
#define ADMIN_REJECT_TOKEN_EVENT(user) "(No)"
diff --git a/code/modules/admin/admin_verbs.dm b/code/modules/admin/admin_verbs.dm
index c01ab9e5b21d..dd3d514254e9 100644
--- a/code/modules/admin/admin_verbs.dm
+++ b/code/modules/admin/admin_verbs.dm
@@ -104,8 +104,9 @@ GLOBAL_LIST_INIT(admin_verbs_fun, list(
// Client procs
/client/proc/admin_away,
/client/proc/add_mob_ability,
- /client/proc/adjust_players_antag_tokens,
- /client/proc/adjust_players_metacoins,
+ /client/proc/adjust_players_antag_tokens, //monkestation edit
+ /client/proc/adjust_players_event_tokens, //monkestation edit
+ /client/proc/adjust_players_metacoins, //monkestation edit
/client/proc/admin_change_sec_level,
/client/proc/change_ocean, //monkestation addition
/client/proc/cinematic,
diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm
index c436d382d3a5..fc36a8e8a8ba 100644
--- a/code/modules/admin/topic.dm
+++ b/code/modules/admin/topic.dm
@@ -1762,22 +1762,24 @@
else if(href_list["approve_antag_token"])
if(!check_rights(R_ADMIN))
return
- var/atom/movable/target = locate(href_list["approve_token"])
+ var/atom/movable/target = locate(href_list["approve_antag_token"])
if(!IS_CLIENT_OR_MOCK(target))
return
var/client/user_client = target
- user_client.client_token_holder.approve_token()
- message_admins("[user_client]'s token has been approved, by [owner]")
+ user_client.client_token_holder.approve_antag_token()
+ message_admins("[user_client]'s token has been approved by [owner].")
+ log_admin("[user_client]'s token has been approved by [owner].")
else if(href_list["reject_antag_token"])
if(!check_rights(R_ADMIN))
return
- var/atom/movable/target = locate(href_list["reject_token"])
+ var/atom/movable/target = locate(href_list["reject_antag_token"])
if(!IS_CLIENT_OR_MOCK(target))
return
var/client/user_client = target
- user_client.client_token_holder.reject_token()
- message_admins("[user_client]'s token has been rejected, by [owner]")
+ user_client.client_token_holder.reject_antag_token()
+ message_admins("[user_client]'s token has been rejected by [owner].")
+ log_admin("[user_client]'s token has been rejected by [owner].")
else if(href_list["open_music_review"])
if(!check_rights(R_ADMIN))
@@ -1788,5 +1790,25 @@
return
cassette_review.ui_interact(usr)
-// else if()
+ else if(href_list["approve_token_event"])
+ if(!check_rights(R_ADMIN))
+ return
+ var/atom/movable/target = locate(href_list["approve_token_event"])
+ if(!IS_CLIENT_OR_MOCK(target))
+ return
+ var/client/user_client = target
+ user_client.client_token_holder.approve_token_event()
+ message_admins("[user_client]'s token event has been approved by [owner].")
+ log_admin("[user_client]'s token event has been approved by [owner].")
+
+ else if(href_list["reject_token_event"])
+ if(!check_rights(R_ADMIN))
+ return
+ var/atom/movable/target = locate(href_list["reject_token_event"])
+ if(!IS_CLIENT_OR_MOCK(target))
+ return
+ var/client/user_client = target
+ user_client.client_token_holder.reject_token_event()
+ message_admins("[user_client]'s token event has been rejected by [owner].")
+ log_admin("[user_client]'s token event has been rejected by [owner].")
//monkestation edit end
diff --git a/monkestation/code/datums/meta_tokens.dm b/monkestation/code/datums/meta_tokens.dm
index 29ad1493723e..12031c8c2d3e 100644
--- a/monkestation/code/datums/meta_tokens.dm
+++ b/monkestation/code/datums/meta_tokens.dm
@@ -1,5 +1,15 @@
GLOBAL_LIST_INIT(used_monthly_token, list())
+///assoc list of how many event tokens each role gets each month
+GLOBAL_LIST_INIT(patreon_etoken_values, list(
+ NO_RANK = 0,
+ RANK_TANKS = 100,
+ ASSISTANT_RANK = 500,
+ COMMAND_RANK = 1000,
+ TRAITOR_RANK = 2500,
+ NUKIE_RANK = 5000,
+))
+
/client
var/datum/meta_token_holder/client_token_holder
@@ -69,7 +79,7 @@ GLOBAL_LIST_INIT(used_monthly_token, list())
return FALSE
return TRUE
-/datum/meta_token_holder/proc/spend_token(tier, use_donor = FALSE)
+/datum/meta_token_holder/proc/spend_antag_token(tier, use_donor = FALSE)
if(use_donor)
if(donator_token)
donator_token = FALSE
@@ -88,7 +98,8 @@ GLOBAL_LIST_INIT(used_monthly_token, list())
convert_tokens_to_list()
///adjusts the users tokens, yes they can be in antag token debt
-/datum/meta_token_holder/proc/adjust_tokens(tier, amount)
+/datum/meta_token_holder/proc/adjust_antag_tokens(tier, amount)
+ var/list/old_token_values = list(HIGH_THREAT = total_high_threat_tokens, MEDIUM_THREAT = total_medium_threat_tokens, LOW_THREAT = total_low_threat_tokens)
switch(tier)
if(HIGH_THREAT)
total_high_threat_tokens += amount
@@ -97,25 +108,60 @@ GLOBAL_LIST_INIT(used_monthly_token, list())
if(LOW_THREAT)
total_low_threat_tokens += amount
+ log_admin("[key_name(owner)] had their antag tokens adjusted from high: [old_token_values[HIGH_THREAT]], medium: [old_token_values[MEDIUM_THREAT]], \
+ low: [old_token_values[LOW_THREAT]], to, high: [total_high_threat_tokens], medium: [total_medium_threat_tokens], low: [total_low_threat_tokens]")
convert_tokens_to_list()
-/datum/meta_token_holder/proc/approve_token(thing_to_approve)
+/datum/meta_token_holder/proc/approve_antag_token()
if(!in_queue)
return
- to_chat(owner, "Your request to play as [in_queue] has been approved.")
- spend_token(in_queued_tier, queued_donor)
+ to_chat(owner, "Your request to play as [in_queue] has been approved.")
+ spend_antag_token(in_queued_tier, queued_donor)
if(!owner.mob.mind)
owner.mob.mind_initialize()
- in_queue.antag_token(owner.mob.mind, owner.mob)
+ in_queue.antag_token(owner.mob.mind, owner.mob) //might not be in queue
qdel(in_queue)
in_queue = null
in_queued_tier = null
queued_donor = FALSE
-/datum/meta_token_holder/proc/reject_token(thing_to_reject)
+/datum/meta_token_holder/proc/reject_antag_token()
+ if(!in_queue)
+ return
+
to_chat(owner, "Your request to play as [in_queue] has been denied.")
in_queue = null
in_queued_tier = null
queued_donor = FALSE
+
+/datum/meta_token_holder/proc/adjust_event_tokens(amount)
+ check_event_tokens(owner)
+ var/old_value = event_tokens
+ event_tokens += amount
+ log_admin("[key_name(owner)] had their event tokens adjusted from [old_value] to, [event_tokens].")
+ convert_tokens_to_list()
+
+/datum/meta_token_holder/proc/check_event_tokens(client/checked_client)
+ var/month_number = text2num(time2text(world.time, "MM"))
+ if(event_token_month != month_number)
+ event_token_month = month_number
+ event_tokens = GLOB.patreon_etoken_values[checked_client.patreon.owned_rank]
+ convert_tokens_to_list()
+
+/datum/meta_token_holder/proc/approve_token_event()
+ if(!queued_token_event)
+ return
+
+ to_chat(owner, "Your request to trigger [queued_token_event] has been approved.")
+ adjust_event_tokens(-queued_token_event.token_cost)
+ SStwitch.add_to_queue(initial(queued_token_event.id_tag))
+ queued_token_event = null
+
+/datum/meta_token_holder/proc/reject_token_event()
+ if(!queued_token_event)
+ return
+
+ to_chat(owner, "Your request to trigger [queued_token_event] has been denied.")
+ queued_token_event = null
diff --git a/monkestation/code/modules/admin/antag_tokens.dm b/monkestation/code/modules/admin/antag_tokens.dm
index def24b5fdea1..67754d61f5a4 100644
--- a/monkestation/code/modules/admin/antag_tokens.dm
+++ b/monkestation/code/modules/admin/antag_tokens.dm
@@ -16,4 +16,5 @@
if(!tier)
return
- chosen_client.client_token_holder.adjust_tokens(tier, adjustment_amount)
+ log_admin("[key_name(src)] adjusted the [tier] antag tokens of [key_name(chosen_client)] by [adjustment_amount].")
+ chosen_client.client_token_holder.adjust_antag_tokens(tier, adjustment_amount)
diff --git a/monkestation/code/modules/admin/event_tokens.dm b/monkestation/code/modules/admin/event_tokens.dm
index 1c633ebde0fd..8e89c4960cbd 100644
--- a/monkestation/code/modules/admin/event_tokens.dm
+++ b/monkestation/code/modules/admin/event_tokens.dm
@@ -1,17 +1,17 @@
-/client/proc/set_players_event_tokens()
+/client/proc/adjust_players_event_tokens()
set category = "Admin.Fun"
-//due to the fact that these reset each month im just making this directly this this value instead of add or subtract
- set name = "Set Event Tokens"
- set desc = "Set how many event tokens someone has."
+
+ set name = "Adjust Event Tokens"
+ set desc = "Adjust how many event tokens someone has."
var/mob/chosen_player = tgui_input_list(src, "Choose a Player", "Player List", GLOB.player_list)
if(!chosen_player)
return
var/client/chosen_client = chosen_player.client
- var/adjustment_amount = tgui_input_number(src, "What should we set this users tokens to?", "Input Value", TRUE)
- if(!adjustment_amount || !chosen_client || !chosen_client.patreon)
+ var/adjustment_amount = tgui_input_number(src, "How much should we adjust this users tokens by?", "Input Value", TRUE)
+ if(!adjustment_amount || !chosen_client)
return
- check_event_tokens(chosen_client)
- chosen_client.prefs.event_tokens = adjustment_amount
+ log_admin("[key_name(src)] adjusted the event tokens of [key_name(chosen_client)] by [adjustment_amount].")
+ chosen_client.client_token_holder.adjust_event_tokens(adjustment_amount)
diff --git a/monkestation/code/modules/client/event_tokens.dm b/monkestation/code/modules/client/event_tokens.dm
deleted file mode 100644
index 8b137891791f..000000000000
--- a/monkestation/code/modules/client/event_tokens.dm
+++ /dev/null
@@ -1 +0,0 @@
-
diff --git a/monkestation/code/modules/client/verbs.dm b/monkestation/code/modules/client/verbs.dm
index a62bfebb884d..b6ec997e08d8 100644
--- a/monkestation/code/modules/client/verbs.dm
+++ b/monkestation/code/modules/client/verbs.dm
@@ -16,17 +16,6 @@ GLOBAL_LIST_INIT(low_threat_antags, list(
/datum/antagonist/paradox_clone,
))
-//PLACEHOLDER VALUES(1 to 1 cent to token conversion, also you get a free token if you dont pay yeah totally)
-///assoc list of how many event tokens each role gets each month
-GLOBAL_LIST_INIT(patreon_etoken_values, list(
- NO_RANK = 0,
- RANK_TANKS = 100,
- ASSISTANT_RANK = 500,
- COMMAND_RANK = 1000,
- TRAITOR_RANK = 2500,
- NUKIE_RANK = 5000,
-))
-
/client/verb/spend_antag_tokens()
set category = "IC"
set name = "Spend Antag Tokens"
@@ -83,11 +72,12 @@ GLOBAL_LIST_INIT(patreon_etoken_values, list(
client_token_holder.in_queue = new chosen_antagonist
to_chat(src, "Your request has been sent to the admins.")
- SEND_NOTFIED_ADMIN_MESSAGE('sound/items/bikehorn.ogg', "[span_admin("[span_prefix("ANTAG TOKEN:")] [key_name(src)] [ADMIN_APPROVE_TOKEN(src)] [ADMIN_REJECT_TOKEN(src)] | \
+ SEND_NOTFIED_ADMIN_MESSAGE('sound/items/bikehorn.ogg', "[span_admin("[span_prefix("ANTAG TOKEN:")] [key_name(src)] \
+ [ADMIN_APPROVE_ANTAG_TOKEN(src)] [ADMIN_REJECT_ANTAG_TOKEN(src)] | \
[src] has requested to use their antag token to be a [chosen_antagonist].")]")
-/client/proc/trigger_token_event()
- set category = "Ghost"
+/client/verb/trigger_token_event()
+ set category = "IC"
set name = "Trigger Token Event"
set desc = "Opens a ui to spend event tokens on"
@@ -96,28 +86,27 @@ GLOBAL_LIST_INIT(patreon_etoken_values, list(
var/static/list/event_list
if(!event_list)
- event_list = subtypesof(/datum/twitch_event)
- for(var/datum/twitch_event/event as anything in event_list)
- if(!event.token_cost)
- event_list -= event
+ event_list = list()
+ for(var/event as anything in GLOB.twitch_events_by_type)
+ var/datum/twitch_event/event_instance = GLOB.twitch_events_by_type[event]
+ if(!event_instance.token_cost)
+ continue
+ event_list += event_instance
+
+ client_token_holder.check_event_tokens(src)
- check_event_tokens(src)
+ var/datum/twitch_event/selected_event = tgui_input_list(src, "Event tokens: [client_token_holder.event_tokens]", "Choose an event to trigger", event_list)
+ if(!selected_event)
+ return
- var/datum/twitch_event/selected_event = tgui_input_list(src, "Event tokens: [prefs.event_tokens]", "Choose an event to trigger", event_list)
var/confirm = tgui_alert(src, "Are you sure you want to trigger [selected_event.event_name]? It will cost [selected_event.token_cost] event tokens.", "Trigger token event", \
list("Yes", "No"))
if(confirm == "Yes")
- if(prefs.event_tokens >= selected_event.token_cost)
- SEND_NOTFIED_ADMIN_MESSAGE('sound/items/bikehorn.ogg', "MESSAGE")
+ if(client_token_holder.event_tokens >= selected_event.token_cost)
+ client_token_holder.queued_token_event = selected_event
+ to_chat(src, "Your request has been sent.")
+ SEND_NOTFIED_ADMIN_MESSAGE('sound/items/bikehorn.ogg', "[span_admin("[span_prefix("TOKEN EVENT:")] [key_name(src)] \
+ [ADMIN_APPROVE_TOKEN_EVENT(src)] [ADMIN_REJECT_TOKEN_EVENT(src)] | \
+ [src] has requested use their event tokens to trigger [selected_event].")]")
return
to_chat(src, "You dont have enough tokens to trigger this event.")
-
-/proc/approve_token_event()
-
-/proc/reject_token_event()
-
-/proc/check_event_tokens(client/checked_client)
- var/month_number = text2num(time2text(world.time, "MM"))
- if(checked_client.prefs.event_token_month != month_number)
- checked_client.prefs.event_token_month = month_number
- checked_client.prefs.event_tokens = GLOB.patreon_etoken_values[checked_client.patreon.owned_rank]
diff --git a/monkestation/code/modules/code_redemption/code_redeemer.dm b/monkestation/code/modules/code_redemption/code_redeemer.dm
index 7e394286b0d4..208b1618cbfa 100644
--- a/monkestation/code/modules/code_redemption/code_redeemer.dm
+++ b/monkestation/code/modules/code_redemption/code_redeemer.dm
@@ -26,7 +26,7 @@ GLOBAL_LIST_INIT(redeemed_codes, list())
if(isnum(path))
usr.client.prefs.adjust_metacoins(usr.ckey, path, "Redeemed a Giveaway Code", donator_multipler = FALSE)
else if(path == HIGH_THREAT || path == MEDIUM_THREAT || path == LOW_THREAT)
- usr.client.client_token_holder.adjust_tokens(path, 1)
+ usr.client.client_token_holder.adjust_antag_tokens(path, 1)
to_chat(usr, span_boldnotice("You have successfully redeemed a giveaway code for: [path] Antag Token."))
else
var/pathedstring = text2path(path)
diff --git a/monkestation/code/modules/twitch_bits/events/amongus.dm b/monkestation/code/modules/twitch_bits/events/amongus.dm
index d0739aefbff1..871ea5095193 100644
--- a/monkestation/code/modules/twitch_bits/events/amongus.dm
+++ b/monkestation/code/modules/twitch_bits/events/amongus.dm
@@ -3,13 +3,14 @@
event_duration = 15 MINUTES
event_flags = TWITCH_AFFECTS_ALL
id_tag = "amongus-all15"
+ token_cost = 500
/datum/twitch_event/amongus/ook
event_name = "Amongus Ook"
event_duration = 30 MINUTES
event_flags = TWITCH_AFFECTS_STREAMER
id_tag = "amongus-ook10"
-
+ token_cost = 500
/datum/twitch_event/amongus/run_event(name)
. = ..()
diff --git a/monkestation/code/modules/twitch_bits/events/anime_ook.dm b/monkestation/code/modules/twitch_bits/events/anime_ook.dm
index 1237e91d18cb..70e9573dce98 100644
--- a/monkestation/code/modules/twitch_bits/events/anime_ook.dm
+++ b/monkestation/code/modules/twitch_bits/events/anime_ook.dm
@@ -3,6 +3,7 @@
event_duration = 1 SECONDS
event_flags = TWITCH_AFFECTS_STREAMER
id_tag = "anime-ook"
+ token_cost = 100
/datum/twitch_event/anime_ook/run_event(name)
. = ..()
diff --git a/monkestation/code/modules/twitch_bits/events/australia_mode.dm b/monkestation/code/modules/twitch_bits/events/australia_mode.dm
index 9204c81c2ae1..2bf42cc3eee2 100644
--- a/monkestation/code/modules/twitch_bits/events/australia_mode.dm
+++ b/monkestation/code/modules/twitch_bits/events/australia_mode.dm
@@ -3,6 +3,7 @@
event_duration = 15 MINUTES //effect is very minor so it lasts for a while
event_flags = TWITCH_AFFECTS_ALL
id_tag = "australia-mode"
+ token_cost = 500
/datum/twitch_event/australia_mode/run_event(name)
. = ..()
diff --git a/monkestation/code/modules/twitch_bits/events/buff.dm b/monkestation/code/modules/twitch_bits/events/buff.dm
index 97c10978ad3d..fd92367a5aac 100644
--- a/monkestation/code/modules/twitch_bits/events/buff.dm
+++ b/monkestation/code/modules/twitch_bits/events/buff.dm
@@ -3,6 +3,7 @@
event_duration = 5 MINUTES
event_flags = TWITCH_AFFECTS_ALL
id_tag = "buff-5"
+ token_cost = 500
/datum/twitch_event/buff/run_event(name)
. = ..()
diff --git a/monkestation/code/modules/twitch_bits/events/chuckle_nut.dm b/monkestation/code/modules/twitch_bits/events/chuckle_nut.dm
index 9608cf4e5a2f..d462f440400e 100644
--- a/monkestation/code/modules/twitch_bits/events/chuckle_nut.dm
+++ b/monkestation/code/modules/twitch_bits/events/chuckle_nut.dm
@@ -3,6 +3,7 @@
event_duration = 1 SECONDS
event_flags = TWITCH_AFFECTS_STREAMER
id_tag = "chucklenuts-ook"
+ token_cost = 800
/datum/twitch_event/chucklenuts/random
event_name = "Think Fast"
diff --git a/monkestation/code/modules/twitch_bits/events/die_fate.dm b/monkestation/code/modules/twitch_bits/events/die_fate.dm
index 9bb6dabfa845..30934772ec20 100644
--- a/monkestation/code/modules/twitch_bits/events/die_fate.dm
+++ b/monkestation/code/modules/twitch_bits/events/die_fate.dm
@@ -3,6 +3,7 @@
event_duration = 1 SECONDS
event_flags = TWITCH_AFFECTS_STREAMER
id_tag = "ook-die-fate"
+ token_cost = 2500
/datum/twitch_event/free_wiz/run_event(name)
. = ..()
@@ -19,3 +20,4 @@
event_name = "Change Everyone's Fate"
event_flags = TWITCH_AFFECTS_ALL
id_tag = "everyone-die-fate"
+ token_cost = 5002 // :)
diff --git a/monkestation/code/modules/twitch_bits/events/random_item.dm b/monkestation/code/modules/twitch_bits/events/random_item.dm
index 0bcc67025703..de5de7c6d2a7 100644
--- a/monkestation/code/modules/twitch_bits/events/random_item.dm
+++ b/monkestation/code/modules/twitch_bits/events/random_item.dm
@@ -3,6 +3,7 @@
event_duration = 1 SECONDS
event_flags = TWITCH_AFFECTS_STREAMER
id_tag = "give-ook-item"
+ token_cost = 1000
/datum/twitch_event/give_smsword/run_event(name)
. = ..()
diff --git a/monkestation/code/modules/twitch_bits/events/rod.dm b/monkestation/code/modules/twitch_bits/events/rod.dm
index 7de830e3cbca..235988add906 100644
--- a/monkestation/code/modules/twitch_bits/events/rod.dm
+++ b/monkestation/code/modules/twitch_bits/events/rod.dm
@@ -4,6 +4,7 @@
event_flags = TWITCH_AFFECTS_STREAMER
id_tag = "rod-ook"
announce = FALSE //takes a while to reach its target so dont announce it
+ token_cost = 3000
/datum/twitch_event/clang/run_event(name)
. = ..()
diff --git a/monkestation/code/modules/twitch_bits/events/skinny.dm b/monkestation/code/modules/twitch_bits/events/skinny.dm
index 1a670135e2da..b0d7a5865825 100644
--- a/monkestation/code/modules/twitch_bits/events/skinny.dm
+++ b/monkestation/code/modules/twitch_bits/events/skinny.dm
@@ -3,6 +3,7 @@
event_duration = 5 MINUTES
event_flags = TWITCH_AFFECTS_ALL
id_tag = "skinny-5"
+ token_cost = 500
/datum/twitch_event/skinny/run_event(name)
. = ..()
diff --git a/monkestation/code/modules/twitch_bits/twitch_system.dm b/monkestation/code/modules/twitch_bits/twitch_system.dm
index 56f90afce6d1..465f89da211a 100644
--- a/monkestation/code/modules/twitch_bits/twitch_system.dm
+++ b/monkestation/code/modules/twitch_bits/twitch_system.dm
@@ -1,10 +1,13 @@
+///assoc list of instances of all twitch events keyed by their type
+GLOBAL_LIST_EMPTY(twitch_events_by_type)
+
/datum/config_entry/string/twitch_key
default = "changethisplease"
SUBSYSTEM_DEF(twitch)
name = "Twitch Events"
wait = 0.5 SECONDS
- flags = SS_KEEP_TIMING | SS_NO_INIT
+ flags = SS_KEEP_TIMING
runlevels = RUNLEVEL_GAME | RUNLEVEL_POSTGAME
priority = FIRE_PRIORITY_TWITCH
init_order = INIT_ORDER_TWITCH
@@ -19,6 +22,11 @@ SUBSYSTEM_DEF(twitch)
var/last_event_execution = 0
var/last_executor
+/datum/controller/subsystem/twitch/Initialize()
+ for(var/event as anything in subtypesof(/datum/twitch_event))
+ GLOB.twitch_events_by_type[event] = new event
+ return SS_INIT_SUCCESS
+
/datum/controller/subsystem/twitch/stat_entry(msg)
msg += "Running Events:[running_events.len]"
return ..()
@@ -44,7 +52,7 @@ SUBSYSTEM_DEF(twitch)
for(var/datum/twitch_event/listed_events as anything in subtypesof(/datum/twitch_event))
if(incoming[3] != initial(listed_events.id_tag))
continue
- chosen_one = new listed_events
+ chosen_one = GLOB.twitch_events_by_type[listed_events]
if(!chosen_one)
return
@@ -76,7 +84,7 @@ SUBSYSTEM_DEF(twitch)
for(var/datum/twitch_event/listed_events as anything in subtypesof(/datum/twitch_event))
if(listed_item != initial(listed_events.id_tag))
continue
- chosen_one = new listed_events
+ chosen_one = GLOB.twitch_events_by_type[listed_events]
if(!chosen_one)
return
chosen_one.run_event()
diff --git a/tgstation.dme b/tgstation.dme
index dcc757bda72c..bf23f2499a5b 100644
--- a/tgstation.dme
+++ b/tgstation.dme
@@ -5814,7 +5814,6 @@
#include "monkestation\code\modules\cassettes\machines\media\track.dm"
#include "monkestation\code\modules\cassettes\machines\media\subsystem\media_track_manager.dm"
#include "monkestation\code\modules\cassettes\walkman\_walkmen.dm"
-#include "monkestation\code\modules\client\event_tokens.dm"
#include "monkestation\code\modules\client\preference_savefile.dm"
#include "monkestation\code\modules\client\preferences.dm"
#include "monkestation\code\modules\client\verbs.dm"