Files
Bubberstation/code/modules/tutorials/tutorial_instruction.dm
Mothblocks 9740f104d0 Contextual tutorials for swapping hands and dropping items (#72292)
# Requires https://github.com/tgstation/tgstation/pull/72320

## About The Pull Request


https://user-images.githubusercontent.com/35135081/209700892-e54be6cf-d18c-4d12-acd1-e5eb46e9d82d.mp4


https://user-images.githubusercontent.com/35135081/209700911-751b8a0e-d770-49fa-a6eb-ce50aa0fa670.mp4

---

Adds a system for tutorials that:

- Are contextually given
- Are not given again after completion
- Can optionally not trigger for anyone who first played before a
certain date

Uses this system for a tutorial for switching hands/dropping items. This
tutorial is triggered when you try to click on an item with another
item, and `afterattack` return FALSE. In order for this to work as
smoothly as possible, I'm going to open a separate PR that cleans up the
`afterattack` on everything to either return TRUE/FALSE.

## Why It's Good For The Game

SS13 is an extremely confusing game, being able to do tutorials in a
non-intrusive way (like a separate tutorial mode) is nice.

The system in place is going to be perfectly usable for introducing
mechanics to both fresh players and experienced players alike (such as
for future content).

## Changelog
🆑
qol: New players will now get a contextual tutorial for how to switch
hands and drop items.
/🆑

Co-authored-by: Fikou <23585223+Fikou@users.noreply.github.com>
2023-01-09 01:29:18 +01:00

54 lines
1.7 KiB
Plaintext

/atom/movable/screen/tutorial_instruction
icon = 'icons/effects/alphacolors.dmi'
icon_state = "white"
color = COLOR_NEARLY_ALL_BLACK
alpha = 0
screen_loc = "TOP-2,CENTER"
layer = TUTORIAL_INSTRUCTIONS_LAYER
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
var/client/client
var/atom/movable/screen/tutorial_instruction_text/instruction_text
/atom/movable/screen/tutorial_instruction/Initialize(mapload, message, client/client)
. = ..()
transform = transform.Scale(36, 2.5)
src.client = client
animate(src, alpha = 245, time = 0.8 SECONDS, easing = SINE_EASING)
instruction_text = new(src, message, client)
vis_contents += instruction_text
/atom/movable/screen/tutorial_instruction/Destroy()
client = null
QDEL_NULL(instruction_text)
return ..()
/atom/movable/screen/tutorial_instruction/proc/change_message(message)
instruction_text.change_message(message)
/atom/movable/screen/tutorial_instruction_text
maptext_height = 480
maptext_y = -2
mouse_opacity = MOUSE_OPACITY_TRANSPARENT
layer = TUTORIAL_INSTRUCTIONS_LAYER
/atom/movable/screen/tutorial_instruction_text/Initialize(mapload, message, client/client)
. = ..()
var/view = client?.view_size.getView()
maptext_width = view ? view_to_pixels(view)[1] : 480
pixel_x = (maptext_width - world.icon_size) * -0.5
change_message(message)
/atom/movable/screen/tutorial_instruction_text/proc/change_message(message)
// We don't use MAPTEXT macro here because it doesn't handle big text
message = "<span style='font-family: \"VCR OSD Mono\"; font-size: 22px; text-align: center'>[message]</span>"
animate(src, alpha = 0, time = (maptext ? 0.5 SECONDS : 0), easing = SINE_EASING)
animate(alpha = 255, time = 0.5 SECONDS, maptext = message)