Skip to content

Commit

Permalink
Merge pull request #35628 from Fris0uman/shock_z
Browse files Browse the repository at this point in the history
Shockwaves don't cross z-levels
  • Loading branch information
ZhilkinSerg authored Nov 22, 2019
2 parents 3fd65f1 + 533b9b2 commit 287240a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/explosion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -577,13 +577,19 @@ void shockwave( const tripoint &p, int radius, int force, int stun, int dam_mult
"misc", "shockwave" );

for( monster &critter : g->all_monsters() ) {
if( critter.posz() != p.z ) {
continue;
}
if( rl_dist( critter.pos(), p ) <= radius ) {
add_msg( _( "%s is caught in the shockwave!" ), critter.name() );
g->knockback( p, critter.pos(), force, stun, dam_mult );
}
}
// TODO: combine the two loops and the case for g->u using all_creatures()
for( npc &guy : g->all_npcs() ) {
if( guy.posz() != p.z ) {
continue;
}
if( rl_dist( guy.pos(), p ) <= radius ) {
add_msg( _( "%s is caught in the shockwave!" ), guy.name );
g->knockback( p, guy.pos(), force, stun, dam_mult );
Expand Down

0 comments on commit 287240a

Please sign in to comment.