Skip to content

Commit

Permalink
Add a preference to disable roundend credits
Browse files Browse the repository at this point in the history
  • Loading branch information
Absolucy committed Oct 15, 2024
1 parent a69e38a commit 754ee7a
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
8 changes: 3 additions & 5 deletions monkestation/code/modules/and_roll_credits/_credits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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))
1 change: 1 addition & 0 deletions tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Original file line number Diff line number Diff line change
@@ -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,
};

0 comments on commit 754ee7a

Please sign in to comment.