mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-09 23:27:56 +01:00
[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 🆑 qol: Added a "Remind me later" button for tutorials /🆑 --------- 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>
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user