From 5014927bc4ae6f3bd03f3ea1866cb6ba6c9e7c54 Mon Sep 17 00:00:00 2001 From: SabreML <57483089+SabreML@users.noreply.github.com> Date: Wed, 7 Feb 2024 17:09:17 +0000 Subject: [PATCH 1/6] Autoclose UI on tutorial start --- code/datums/tutorial/_tutorial.dm | 1 + code/datums/tutorial/_tutorial_menu.dm | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/code/datums/tutorial/_tutorial.dm b/code/datums/tutorial/_tutorial.dm index 5423453bbdb9..7dd7ac85c04d 100644 --- a/code/datums/tutorial/_tutorial.dm +++ b/code/datums/tutorial/_tutorial.dm @@ -52,6 +52,7 @@ GLOBAL_LIST_EMPTY_TYPED(ongoing_tutorials, /datum/tutorial) reservation = SSmapping.RequestBlockReservation(initial(tutorial_template.width), initial(tutorial_template.height)) if(!reservation) + abort_tutorial() return FALSE var/turf/bottom_left_corner_reservation = locate(reservation.bottom_left_coords[1], reservation.bottom_left_coords[2], reservation.bottom_left_coords[3]) diff --git a/code/datums/tutorial/_tutorial_menu.dm b/code/datums/tutorial/_tutorial_menu.dm index 42eb3f6aabfa..dde76b6e3896 100644 --- a/code/datums/tutorial/_tutorial_menu.dm +++ b/code/datums/tutorial/_tutorial_menu.dm @@ -79,5 +79,5 @@ return path = new path - path.start_tutorial(usr) - return TRUE + if(path.start_tutorial(usr)) + ui.close() From b10974c0471ef14c3c66ec10910e8c993cbb29d1 Mon Sep 17 00:00:00 2001 From: SabreML <57483089+SabreML@users.noreply.github.com> Date: Wed, 7 Feb 2024 17:10:09 +0000 Subject: [PATCH 2/6] Basic xeno tutorial ID Plus a couple of other minor tweaks --- code/datums/tutorial/xenomorph/xenomorph_basic.dm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/code/datums/tutorial/xenomorph/xenomorph_basic.dm b/code/datums/tutorial/xenomorph/xenomorph_basic.dm index 0415977835aa..e91c85e1e1e4 100644 --- a/code/datums/tutorial/xenomorph/xenomorph_basic.dm +++ b/code/datums/tutorial/xenomorph/xenomorph_basic.dm @@ -4,6 +4,7 @@ name = "Xenomorph - Basic" desc = "A tutorial to get you acquainted with the very basics of how to play a xenomorph." icon_state = "xeno" + tutorial_id = "xeno_basic_1" tutorial_template = /datum/map_template/tutorial/s12x12 starting_xenomorph_type = /mob/living/carbon/xenomorph/drone @@ -105,7 +106,7 @@ UnregisterSignal(human_dummy, COMSIG_MOB_DEATH) message_to_player("Well done. Killing humans is one of many ways to help the hive.") - message_to_player("Another way is to capture them. This will grow a new xenomorph inside them which will eventually burst into a new playable xenomorph!") + message_to_player("Another way is to capture them. This will grow a new xenomorph inside them which will eventually burst into a new playable xenomorph!") addtimer(CALLBACK(human_dummy, TYPE_PROC_REF(/mob/living, rejuvenate)), 8 SECONDS) addtimer(CALLBACK(src, PROC_REF(proceed_to_tackle_phase)), 10 SECONDS) @@ -227,3 +228,5 @@ /datum/tutorial/xenomorph/basic/init_map() loc_from_corner(9,0).ChangeTurf(/turf/closed/wall/resin/tutorial) + +#undef WAITING_HEALTH_THRESHOLD From 38c03c987dbad50f7d8a2354a63c75f88d5efcce Mon Sep 17 00:00:00 2001 From: SabreML <57483089+SabreML@users.noreply.github.com> Date: Wed, 7 Feb 2024 17:10:27 +0000 Subject: [PATCH 3/6] Tutorial xeno no age prefix --- code/datums/tutorial/xenomorph/_xenomorph.dm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/code/datums/tutorial/xenomorph/_xenomorph.dm b/code/datums/tutorial/xenomorph/_xenomorph.dm index bd85cdb35f44..caa33d8eed43 100644 --- a/code/datums/tutorial/xenomorph/_xenomorph.dm +++ b/code/datums/tutorial/xenomorph/_xenomorph.dm @@ -22,6 +22,10 @@ // We don't want people talking to other xenomorphs across tutorials new_character.can_hivemind_speak = FALSE + // No age prefix or HUD element + new_character.age = XENO_NO_AGE + new_character.show_age_prefix = FALSE + new_character.generate_name() tutorial_mob = new_character xeno = new_character From a595b971c489922510bd984e3d324ac844450efe Mon Sep 17 00:00:00 2001 From: SabreML <57483089+SabreML@users.noreply.github.com> Date: Sun, 11 Feb 2024 10:30:11 +0000 Subject: [PATCH 4/6] Tutorial unit test (Failure check) --- .../tutorial/xenomorph/xenomorph_basic.dm | 8 ++++---- code/modules/unit_tests/_unit_tests.dm | 12 ++++++++---- code/modules/unit_tests/tutorials.dm | 19 +++++++++++++++++++ 3 files changed, 31 insertions(+), 8 deletions(-) create mode 100644 code/modules/unit_tests/tutorials.dm diff --git a/code/datums/tutorial/xenomorph/xenomorph_basic.dm b/code/datums/tutorial/xenomorph/xenomorph_basic.dm index e91c85e1e1e4..1a726dfc2801 100644 --- a/code/datums/tutorial/xenomorph/xenomorph_basic.dm +++ b/code/datums/tutorial/xenomorph/xenomorph_basic.dm @@ -1,10 +1,10 @@ #define WAITING_HEALTH_THRESHOLD 300 /datum/tutorial/xenomorph/basic - name = "Xenomorph - Basic" - desc = "A tutorial to get you acquainted with the very basics of how to play a xenomorph." - icon_state = "xeno" - tutorial_id = "xeno_basic_1" + //name = "Xenomorph - Basic" + //desc = "A tutorial to get you acquainted with the very basics of how to play a xenomorph." + //icon_state = "xeno" + //tutorial_id = "xeno_basic_1" tutorial_template = /datum/map_template/tutorial/s12x12 starting_xenomorph_type = /mob/living/carbon/xenomorph/drone diff --git a/code/modules/unit_tests/_unit_tests.dm b/code/modules/unit_tests/_unit_tests.dm index 90040ec9acf9..3967ee70e391 100644 --- a/code/modules/unit_tests/_unit_tests.dm +++ b/code/modules/unit_tests/_unit_tests.dm @@ -74,19 +74,23 @@ /// A trait source when adding traits through unit tests #define TRAIT_SOURCE_UNIT_TESTS "unit_tests" +// Unit tests #include "autowiki.dm" +#include "check_runtimes.dm" #include "create_and_destroy.dm" -#include "focus_only_tests.dm" +#include "emote_panels.dm" #include "missing_icons.dm" #include "resist.dm" +#include "spawn_humans.dm" #include "spritesheets.dm" #include "subsystem_init.dm" #include "tgui_create_message.dm" #include "timer_sanity.dm" +#include "tutorials.dm" + +// Unit tests backend +#include "focus_only_tests.dm" #include "unit_test.dm" -#include "spawn_humans.dm" -#include "check_runtimes.dm" -#include "emote_panels.dm" #undef TEST_ASSERT #undef TEST_ASSERT_EQUAL diff --git a/code/modules/unit_tests/tutorials.dm b/code/modules/unit_tests/tutorials.dm new file mode 100644 index 000000000000..d835a4f272cb --- /dev/null +++ b/code/modules/unit_tests/tutorials.dm @@ -0,0 +1,19 @@ +/datum/unit_test/tutorials + +/datum/unit_test/tutorials/Run() + var/datum/tutorial/base_path = /datum/tutorial + for(var/datum/tutorial/tutorial_path as anything in subtypesof(base_path)) + if(initial(tutorial_path.parent_path) == tutorial_path) + continue + + // Make sure these variables are overridden on any subtypes. + TEST_ASSERT_NOTEQUAL(initial(tutorial_path.name), initial(base_path.name), + "[tutorial_path] does not have a name set.") + TEST_ASSERT_NOTEQUAL(initial(tutorial_path.tutorial_id), initial(base_path.tutorial_id), + "[tutorial_path] does not have a tutorial_id set.") + TEST_ASSERT_NOTEQUAL(initial(tutorial_path.desc), initial(base_path.desc), + "[tutorial_path] does not have a desc set.") + TEST_ASSERT_NOTEQUAL(initial(tutorial_path.icon_state), initial(base_path.icon_state), + "[tutorial_path] does not have an icon_state set.") + +// TODO: Add a test verifying that a basic tutorial can be started and completed. (Requires unit test client handling) From 27e38e654a611aeefd548c41035bbff035caa76b Mon Sep 17 00:00:00 2001 From: SabreML <57483089+SabreML@users.noreply.github.com> Date: Sun, 11 Feb 2024 10:32:54 +0000 Subject: [PATCH 5/6] Uncommenting (Success check) --- code/datums/tutorial/xenomorph/xenomorph_basic.dm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/code/datums/tutorial/xenomorph/xenomorph_basic.dm b/code/datums/tutorial/xenomorph/xenomorph_basic.dm index 1a726dfc2801..e91c85e1e1e4 100644 --- a/code/datums/tutorial/xenomorph/xenomorph_basic.dm +++ b/code/datums/tutorial/xenomorph/xenomorph_basic.dm @@ -1,10 +1,10 @@ #define WAITING_HEALTH_THRESHOLD 300 /datum/tutorial/xenomorph/basic - //name = "Xenomorph - Basic" - //desc = "A tutorial to get you acquainted with the very basics of how to play a xenomorph." - //icon_state = "xeno" - //tutorial_id = "xeno_basic_1" + name = "Xenomorph - Basic" + desc = "A tutorial to get you acquainted with the very basics of how to play a xenomorph." + icon_state = "xeno" + tutorial_id = "xeno_basic_1" tutorial_template = /datum/map_template/tutorial/s12x12 starting_xenomorph_type = /mob/living/carbon/xenomorph/drone From 4632c9a5e11cbb756587a1c4649cf7108ee3d468 Mon Sep 17 00:00:00 2001 From: SabreML <57483089+SabreML@users.noreply.github.com> Date: Mon, 12 Feb 2024 10:11:55 +0000 Subject: [PATCH 6/6] `return TRUE` --- code/datums/tutorial/_tutorial_menu.dm | 1 + 1 file changed, 1 insertion(+) diff --git a/code/datums/tutorial/_tutorial_menu.dm b/code/datums/tutorial/_tutorial_menu.dm index dde76b6e3896..951b9654ef0e 100644 --- a/code/datums/tutorial/_tutorial_menu.dm +++ b/code/datums/tutorial/_tutorial_menu.dm @@ -81,3 +81,4 @@ path = new path if(path.start_tutorial(usr)) ui.close() + return TRUE