Skip to content

Commit

Permalink
fix wont_hit_friend (#75760)
Browse files Browse the repository at this point in the history
  • Loading branch information
osuphobia authored Aug 18, 2024
1 parent 8bf39f8 commit 9efea72
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/npcmove.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2712,6 +2712,10 @@ int npc::confident_throw_range( const item &thrown, Creature *target ) const
// Index defaults to -1, i.e., wielded weapon
bool npc::wont_hit_friend( const tripoint &tar, const item &it, bool throwing ) const
{
if( !throwing && it.is_gun() && it.empty() ) {
return true; // Prevent calling nullptr ammo_data
}

if( throwing && rl_dist( pos(), tar ) == 1 ) {
return true; // If we're *really* sure that our aim is dead-on
}
Expand Down

0 comments on commit 9efea72

Please sign in to comment.