Skip to content

Commit

Permalink
Merge pull request #38838 from kevingranade/autotarget-recoil-reset
Browse files Browse the repository at this point in the history
Reset recoil when autotargeting without a previous target
  • Loading branch information
ZhilkinSerg authored Mar 17, 2020
2 parents f32c5de + 1ba414b commit 82899c5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/ranged.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1291,7 +1291,14 @@ static void update_targets( player &pc, int range, std::vector<Creature *> &targ
pc.last_target_pos = cata::nullopt;
} else {
idx = 0;
dst = local_last_tgt_pos ? *local_last_tgt_pos : targets[0]->pos();
// No remembered target creature, if we have a remembered aim point, use that.
if( local_last_tgt_pos ) {
dst = *local_last_tgt_pos;
} else {
// If we don't have an aim point either, pick the nearest target.
dst = targets[0]->pos();
pc.recoil = MAX_RECOIL;
}
pc.last_target.reset();
}
}
Expand Down

0 comments on commit 82899c5

Please sign in to comment.