Files
Bubberstation/code/modules/unit_tests/tutorial_sanity.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

20 lines
967 B
Plaintext

/// Verifies that every tutorial has properly set variables
/datum/unit_test/tutorial_sanity
/datum/unit_test/tutorial_sanity/Run()
var/regex/regex_valid_date = regex(@"\d{4}-\d{2}-\d{2}")
var/list/keys = list()
for (var/datum/tutorial/tutorial_type as anything in SStutorials.tutorial_managers)
var/datum/tutorial_manager/tutorial_manager = SStutorials.tutorial_managers[tutorial_type]
var/grandfather_date = initial(tutorial_type.grandfather_date)
if (!isnull(grandfather_date))
TEST_ASSERT(regex_valid_date.Find(grandfather_date), "[tutorial_type] has an invalid grandfather_date ([grandfather_date])")
var/key = tutorial_manager.get_key()
TEST_ASSERT(!(key in keys), "[key] shows up twice")
TEST_ASSERT(length(key) < 64, "[key] is more than 64 characters, it won't fit in the SQL table.")
TEST_ASSERT_EQUAL(SStutorials.tutorial_managers.len, length(subtypesof(/datum/tutorial)), "Expected tutorial_managers to have one of every tutorial")