Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thour tiny tutorial tweaks (and a unit test) #5695

Merged
merged 6 commits into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions code/datums/tutorial/_tutorial.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down
5 changes: 3 additions & 2 deletions code/datums/tutorial/_tutorial_menu.dm
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,6 @@
return

path = new path
path.start_tutorial(usr)
return TRUE
SabreML marked this conversation as resolved.
Show resolved Hide resolved
if(path.start_tutorial(usr))
ui.close()
return TRUE
4 changes: 4 additions & 0 deletions code/datums/tutorial/xenomorph/_xenomorph.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 4 additions & 1 deletion code/datums/tutorial/xenomorph/xenomorph_basic.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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"
SabreML marked this conversation as resolved.
Show resolved Hide resolved
tutorial_template = /datum/map_template/tutorial/s12x12
starting_xenomorph_type = /mob/living/carbon/xenomorph/drone

Expand Down Expand Up @@ -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 <b>capture</b> 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 <b>capture</b> 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)

Expand Down Expand Up @@ -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
12 changes: 8 additions & 4 deletions code/modules/unit_tests/_unit_tests.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 19 additions & 0 deletions code/modules/unit_tests/tutorials.dm
Original file line number Diff line number Diff line change
@@ -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)
Loading