-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Player snaps back if teleport fails #72887
base: master
Are you sure you want to change the base?
Changes from all commits
195441e
04d7352
2ae568e
7d111a4
661fd45
50dd2cc
5fe1076
d91ec5f
f2f86d5
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -118,7 +118,7 @@ | |
|
||
GIVEN( "avatar is underwater at z-2" ) { | ||
dummy.set_underwater( true ); | ||
dummy.setpos( test_origin + tripoint( 0, 0, -2 ) ); | ||
dummy.setpos( test_origin ); | ||
g->vertical_shift( -2 ); | ||
|
||
WHEN( "avatar dives down" ) { | ||
|
@@ -261,8 +261,14 @@ | |
static int swimming_steps( avatar &swimmer ) | ||
{ | ||
map &here = get_map(); | ||
// This shouldn't work. | ||
CAPTURE( swimmer.pos() ); | ||
avatar_action::move( swimmer, here, swimmer.pos() + tripoint_west ); | ||
CAPTURE( swimmer.pos() ); | ||
const tripoint left = swimmer.pos(); | ||
const tripoint right = left + tripoint_east; | ||
CAPTURE( left ); | ||
CAPTURE( right ); | ||
int steps = 0; | ||
constexpr int STOP_STEPS = 9000; | ||
int last_moves = swimmer.get_speed(); | ||
|
@@ -272,10 +278,10 @@ | |
while( swimmer.get_stamina() > 0 && !swimmer.has_effect( effect_winded ) && steps < STOP_STEPS ) { | ||
if( steps % 2 == 0 ) { | ||
REQUIRE( swimmer.pos() == left ); | ||
REQUIRE( avatar_action::move( swimmer, here, tripoint_east ) ); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again, this wants an offset like tripoint_east, not a coordinate like left. |
||
REQUIRE( avatar_action::move( swimmer, here, right ) ); | ||
Check failure on line 281 in tests/water_movement_test.cpp GitHub Actions / Basic Build and Test (Clang 10, Ubuntu, Curses)
Check failure on line 281 in tests/water_movement_test.cpp GitHub Actions / Basic Build and Test (Clang 10, Ubuntu, Curses)
Check failure on line 281 in tests/water_movement_test.cpp GitHub Actions / Basic Build and Test (Clang 10, Ubuntu, Curses)
Check failure on line 281 in tests/water_movement_test.cpp GitHub Actions / Basic Build and Test (Clang 10, Ubuntu, Curses)
Check failure on line 281 in tests/water_movement_test.cpp GitHub Actions / Basic Build and Test (Clang 10, Ubuntu, Curses)
Check failure on line 281 in tests/water_movement_test.cpp GitHub Actions / Basic Build and Test (Clang 10, Ubuntu, Curses)
Check failure on line 281 in tests/water_movement_test.cpp GitHub Actions / Basic Build and Test (Clang 10, Ubuntu, Curses)
Check failure on line 281 in tests/water_movement_test.cpp GitHub Actions / Basic Build and Test (Clang 10, Ubuntu, Curses)
Check failure on line 281 in tests/water_movement_test.cpp GitHub Actions / Basic Build and Test (Clang 10, Ubuntu, Curses)
|
||
} else { | ||
REQUIRE( swimmer.pos() == right ); | ||
REQUIRE( avatar_action::move( swimmer, here, tripoint_west ) ); | ||
REQUIRE( avatar_action::move( swimmer, here, left ) ); | ||
} | ||
++steps; | ||
REQUIRE( swimmer.get_moves() < last_moves ); | ||
|
@@ -905,6 +911,7 @@ | |
|
||
TEST_CASE( "check_swim_move_cost_and_distance_values", "[swimming][slow]" ) | ||
{ | ||
clear_avatar(); | ||
setup_test_lake(); | ||
|
||
avatar &dummy = get_avatar(); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
avatar_action::move() wants an offset, not a coordinate, so you should provide just tripoint_west as the third argument.
No idea why it's ending up at z= -2 though?