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

Stop zombie bash parties #44673

Merged
merged 2 commits into from
Oct 8, 2020
Merged
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
14 changes: 13 additions & 1 deletion src/monmove.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,7 @@ void monster::move()
}

tripoint next_step;
const bool can_open_doors = has_flag( MF_CAN_OPEN_DOORS );
const bool staggers = has_flag( MF_STUMBLES );
if( moved ) {
// Implement both avoiding obstacles and staggering.
Expand Down Expand Up @@ -982,13 +983,25 @@ void monster::move()
bad_choice = true;
}

// is there an openable door?
if( can_open_doors &&
here.open_door( candidate, !here.is_outside( pos() ), true ) ) {
moved = true;
next_step = candidate_abs;
continue;
}

// Try to shove vehicle out of the way
shove_vehicle( destination, candidate );
// Bail out if we can't move there and we can't bash.
if( !pathed && !can_move_to( candidate ) ) {
if( !can_bash ) {
continue;
}
// Don't bash if we're just tracking a noise.
if( wander() && destination == wander_pos ) {
continue;
}
const int estimate = here.bash_rating( bash_estimate(), candidate );
if( estimate <= 0 ) {
continue;
Expand Down Expand Up @@ -1017,7 +1030,6 @@ void monster::move()
}
}
}
const bool can_open_doors = has_flag( MF_CAN_OPEN_DOORS );
// Finished logic section. By this point, we should have chosen a square to
// move to (moved = true).
if( moved ) { // Actual effects of moving to the square we've chosen
Expand Down