From 754ee7a5bfddaa23e5ed821393e30e20cc765012 Mon Sep 17 00:00:00 2001 From: Lucy Date: Tue, 15 Oct 2024 14:08:17 -0400 Subject: [PATCH] Add a preference to disable roundend credits --- monkestation/code/modules/and_roll_credits/_credits.dm | 8 +++----- .../modules/client/preferences/show_roundend_credits.dm | 9 +++++++++ tgstation.dme | 1 + .../monkestation/show_roundend_credits.tsx | 8 ++++++++ 4 files changed, 21 insertions(+), 5 deletions(-) create mode 100644 monkestation/code/modules/client/preferences/show_roundend_credits.dm create mode 100644 tgui/packages/tgui/interfaces/PreferencesMenu/preferences/features/game_preferences/monkestation/show_roundend_credits.tsx diff --git a/monkestation/code/modules/and_roll_credits/_credits.dm b/monkestation/code/modules/and_roll_credits/_credits.dm index de37f7c4d0fe..fb9dc2fa101c 100644 --- a/monkestation/code/modules/and_roll_credits/_credits.dm +++ b/monkestation/code/modules/and_roll_credits/_credits.dm @@ -6,7 +6,7 @@ /client/proc/RollCredits() set waitfor = FALSE - if(!fexists(CREDITS_PATH)) + if(!fexists(CREDITS_PATH) || !prefs?.read_preference(/datum/preference/toggle/show_roundend_credits)) return LAZYINITLIST(credits) var/list/_credits = credits @@ -93,8 +93,7 @@ set name = "Hide Credits" set category = "OOC" remove_verb(src, /client/proc/ClearCredits) - QDEL_LIST(credits) - credits = null + QDEL_LAZYLIST(credits) /atom/movable/screen/credit mouse_opacity = MOUSE_OPACITY_TRANSPARENT @@ -158,8 +157,7 @@ animate(src, alpha = 255, time = CREDIT_EASE_DURATION, flags = ANIMATION_PARALLEL) addtimer(CALLBACK(src, PROC_REF(FadeOut)), CREDIT_ROLL_SPEED - CREDIT_EASE_DURATION) QDEL_IN(src, CREDIT_ROLL_SPEED) - if(parent) - parent.screen += src + parent?.screen += src /atom/movable/screen/credit/Destroy() icon = null diff --git a/monkestation/code/modules/client/preferences/show_roundend_credits.dm b/monkestation/code/modules/client/preferences/show_roundend_credits.dm new file mode 100644 index 000000000000..35e332b15921 --- /dev/null +++ b/monkestation/code/modules/client/preferences/show_roundend_credits.dm @@ -0,0 +1,9 @@ +/datum/preference/toggle/show_roundend_credits + category = PREFERENCE_CATEGORY_GAME_PREFERENCES + savefile_key = "show_roundend_credits" + savefile_identifier = PREFERENCE_PLAYER + default_value = TRUE + +/datum/preference/toggle/show_roundend_credits/apply_to_client_updated(client/client, value) + if(!value) + INVOKE_ASYNC(client, TYPE_PROC_REF(/client, ClearCredits)) diff --git a/tgstation.dme b/tgstation.dme index ccab6a628fea..90e8de0d398f 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -6880,6 +6880,7 @@ #include "monkestation\code\modules\client\preferences\multiline_preferences.dm" #include "monkestation\code\modules\client\preferences\prude.dm" #include "monkestation\code\modules\client\preferences\runechat.dm" +#include "monkestation\code\modules\client\preferences\show_roundend_credits.dm" #include "monkestation\code\modules\client\preferences\sounds.dm" #include "monkestation\code\modules\client\preferences\tunnel_vision.dm" #include "monkestation\code\modules\client\preferences\alt_jobs\_job.dm" diff --git a/tgui/packages/tgui/interfaces/PreferencesMenu/preferences/features/game_preferences/monkestation/show_roundend_credits.tsx b/tgui/packages/tgui/interfaces/PreferencesMenu/preferences/features/game_preferences/monkestation/show_roundend_credits.tsx new file mode 100644 index 000000000000..cab9478e4c5f --- /dev/null +++ b/tgui/packages/tgui/interfaces/PreferencesMenu/preferences/features/game_preferences/monkestation/show_roundend_credits.tsx @@ -0,0 +1,8 @@ +import { CheckboxInput, FeatureToggle } from '../../base'; + +export const show_roundend_credits: FeatureToggle = { + name: 'Show Roundend Credits', + category: 'UI', + description: 'Show the credits roll after the round ends.', + component: CheckboxInput, +};