From cea0034a67772d890d7acc45823f9b6cdb149147 Mon Sep 17 00:00:00 2001 From: SkyratBot <59378654+SkyratBot@users.noreply.github.com> Date: Sat, 25 May 2024 20:51:41 +0200 Subject: [PATCH] [MIRROR] Adds a "Remind me later" button for tutorials (#27832) * Adds a "Remind me later" button for tutorials (#83064) ## About The Pull Request Dismisses the tutorial when the button is pushed ## Why It's Good For The Game Some tutorials may pop up at inopportune moments and this lets players deal with that, as well as when they bug out ## Changelog :cl: qol: Added a "Remind me later" button for tutorials /:cl: --------- Co-authored-by: TiviPlus <572233640+TiviPlus@ users.noreply.com> * Adds a "Remind me later" button for tutorials --------- Co-authored-by: TiviPlus <57223640+TiviPlus@users.noreply.github.com> Co-authored-by: TiviPlus <572233640+TiviPlus@ users.noreply.com> --- code/modules/tutorials/_tutorial.dm | 9 ++++++- code/modules/tutorials/tutorial_skip.dm | 35 +++++++++++++++++++++++++ tgstation.dme | 1 + 3 files changed, 44 insertions(+), 1 deletion(-) create mode 100644 code/modules/tutorials/tutorial_skip.dm diff --git a/code/modules/tutorials/_tutorial.dm b/code/modules/tutorials/_tutorial.dm index aecdcb7f23b..1211f8e2993 100644 --- a/code/modules/tutorials/_tutorial.dm +++ b/code/modules/tutorials/_tutorial.dm @@ -9,6 +9,7 @@ VAR_PROTECTED/mob/user VAR_PRIVATE/atom/movable/screen/tutorial_instruction/instruction_screen + VAR_PRIVATE/atom/movable/screen/tutorial_skip/skip_button /datum/tutorial/New(mob/user) src.user = user @@ -17,10 +18,11 @@ /datum/tutorial/Destroy(force) user.client?.screen -= instruction_screen + user.client?.screen -= skip_button QDEL_NULL(instruction_screen) + QDEL_NULL(skip_button) user = null - return ..() /// Gets the [`/datum/tutorial_manager`] that owns this tutorial. @@ -70,6 +72,7 @@ if (!isnull(instruction_screen)) animate(instruction_screen, time = INSTRUCTION_SCREEN_DELAY, alpha = 0, easing = SINE_EASING) + animate(skip_button, time = INSTRUCTION_SCREEN_DELAY, alpha = 0, easing = SINE_EASING) delay += INSTRUCTION_SCREEN_DELAY QDEL_IN(src, delay) @@ -97,6 +100,10 @@ /// If a message already exists, will fade it out and replace it. /datum/tutorial/proc/show_instruction(message) PROTECTED_PROC(TRUE) + if(isnull(skip_button)) + skip_button = new + user.client?.screen += skip_button + RegisterSignal(skip_button, COMSIG_SCREEN_ELEMENT_CLICK, PROC_REF(dismiss)) if (isnull(instruction_screen)) instruction_screen = new(null, null, message, user.client) diff --git a/code/modules/tutorials/tutorial_skip.dm b/code/modules/tutorials/tutorial_skip.dm new file mode 100644 index 00000000000..803aebc8650 --- /dev/null +++ b/code/modules/tutorials/tutorial_skip.dm @@ -0,0 +1,35 @@ +/atom/movable/screen/tutorial_skip + icon = 'icons/effects/alphacolors.dmi' + icon_state = "white" + screen_loc = "TOP,LEFT" + color = COLOR_NEARLY_ALL_BLACK + alpha = 0 + mouse_opacity = MOUSE_OPACITY_OPAQUE + layer = TUTORIAL_INSTRUCTIONS_LAYER + var/atom/movable/screen/tutorial_skip_text/skip_text + +/atom/movable/screen/tutorial_skip/Initialize(mapload, datum/hud/hud_owner) + . = ..() + transform = transform.Scale(9, 1) + skip_text = new(null, hud_owner) + vis_contents += skip_text + maptext = MAPTEXT_VCR_OSD_MONO("Remind me later") + animate(src, alpha = 245, time = 0.8 SECONDS, easing = SINE_EASING) + +/atom/movable/screen/tutorial_skip/Destroy() + QDEL_NULL(skip_text) + return ..() + +/atom/movable/screen/tutorial_skip_text + alpha = 0 + layer = TUTORIAL_INSTRUCTIONS_LAYER + mouse_opacity = MOUSE_OPACITY_TRANSPARENT + maptext_height = 32 + maptext_width = 200 + maptext_x = 20 + maptext_y = 9 + +/atom/movable/screen/tutorial_skip_text/Initialize(mapload, datum/hud/hud_owner) + . = ..() + var/newtext = MAPTEXT_VCR_OSD_MONO("Remind me later") + animate(src, alpha = 255, time = 0.5 SECONDS, maptext=newtext) diff --git a/tgstation.dme b/tgstation.dme index 1d94081d458..70ca6a1e181 100644 --- a/tgstation.dme +++ b/tgstation.dme @@ -6065,6 +6065,7 @@ #include "code\modules\transport\tram\tram_structures.dm" #include "code\modules\tutorials\_tutorial.dm" #include "code\modules\tutorials\tutorial_instruction.dm" +#include "code\modules\tutorials\tutorial_skip.dm" #include "code\modules\tutorials\tutorials\drop.dm" #include "code\modules\tutorials\tutorials\switch_hands.dm" #include "code\modules\unit_tests\_unit_tests.dm"