@@ -2008,7 +2008,20 @@ void mattack::smg(monster *z, int index)
}
} else {
// Not friendly; hence, firing at the player
if (within_visual_range (z, 24 ) < 0 ) return ;
if (within_visual_range (z, 24 ) < 0 ) {
return ;
}
// Target not human, presumably some weird animal, not worth the ammo
// TODO: Once NPCs can be targeted, add a check for whether the turret's damaged
// and if so, have it shoot whatever attacked it most recently
if (g->u .crossed_threshold () && !g->u .has_trait (" THRESH_ALPHA" )) {
if (g->u_see (z->posx (), z->posy ())) {
add_msg (m_info, _ (" The %s doesn't seem to consider you a target." ), z->name ().c_str ());
z->moves -= 100 ;
return ;
}
}
if (!z->has_effect (" targeted" )) {
g->sound (z->posx (), z->posy (), 6 , _ (" beep-beep-beep!" ));
@@ -2070,6 +2083,17 @@ void mattack::laser(monster *z, int index)
} else {
// Not friendly; hence, firing at the player
if (within_visual_range (z, 24 ) < 0 ) return ;
// Target not human, presumably some weird animal, not worth the ammo
// TODO: Once NPCs can be targeted, add a check for whether the turret's damaged
// and if so, have it shoot whatever attacked it most recently
if (g->u .crossed_threshold () && !g->u .has_trait (" THRESH_ALPHA" )) {
if (g->u_see (z->posx (), z->posy ())) {
add_msg (m_info, _ (" The %s doesn't seem to consider you a target." ), z->name ().c_str ());
z->moves -= 100 ;
return ;
}
}
if (!z->has_effect (" targeted" )) {
g->sound (z->posx (), z->posy (), 6 , _ (" beep-beep-beep!" ));
@@ -2136,6 +2160,17 @@ void mattack::rifle_tur(monster *z, int index)
// Not friendly; hence, firing at the player
// (This is a bit generous: 5.56 has 38 range.)
if (within_visual_range (z, 36 ) < 0 ) return ;
// Target not human, presumably some weird animal, not worth the ammo
// TODO: Once NPCs can be targeted, add a check for whether the turret's damaged
// and if so, have it shoot whatever attacked it most recently
if (g->u .crossed_threshold () && !g->u .has_trait (" THRESH_ALPHA" )) {
if (g->u_see (z->posx (), z->posy ())) {
add_msg (m_info, _ (" The %s doesn't seem to consider you a target." ), z->name ().c_str ());
z->moves -= 100 ;
return ;
}
}
if (!z->has_effect (" targeted" )) {
g->sound (z->posx (), z->posy (), 8 , _ (" beep-beep." ));
@@ -2203,6 +2238,17 @@ void mattack::frag_tur(monster *z, int index) // This is for the bots, not a sta
// Not friendly; hence, firing at the player
// (Be grateful for safety precautions. 40mm frag has range 40.)
if (within_visual_range (z, 38 ) < 0 ) return ;
// Target not human, presumably some weird animal, not worth the ammo
// TODO: Once NPCs can be targeted, add a check for whether the turret's damaged
// and if so, have it shoot whatever attacked it most recently
if (g->u .crossed_threshold () && !g->u .has_trait (" THRESH_ALPHA" )) {
if (g->u_see (z->posx (), z->posy ())) {
add_msg (m_info, _ (" The %s doesn't seem to consider you a target." ), z->name ().c_str ());
z->moves -= 100 ;
return ;
}
}
if (!z->has_effect (" targeted" )) {
// ~Potential grenading detected.
@@ -2274,6 +2320,18 @@ void mattack::bmg_tur(monster *z, int index)
// Not friendly; hence, firing at the player
// (Be grateful for safety precautions. 50BMG has range 90.)
if (within_visual_range (z, 40 ) < 0 ) return ;
// Target not human or vehicle, presumably some weird animal, not worth the ammo
// TODO: Once NPCs can be targeted, add a check for whether the turret's damaged
// and if so, have it shoot whatever attacked it most recently
if (g->u .crossed_threshold () && !g->u .has_trait (" THRESH_ALPHA" ) && !(g->u .has_trait (" HUGE" ) ||
g->u .has_trait (" HUGE_OK" )) ) {
if (g->u_see (z->posx (), z->posy ())) {
add_msg (m_info, _ (" The %s doesn't seem to consider you a target." ), z->name ().c_str ());
z->moves -= 100 ;
return ;
}
}
if (!z->has_effect (" targeted" )) {
// ~There will be a .50BMG shell sent at high speed to your location next turn.
@@ -2348,6 +2406,18 @@ void mattack::tank_tur(monster *z, int index)
// Not friendly; hence, firing at the player
// (Be grateful for safety precautions.)
if (within_visual_range (z, 48 ) < 0 ) return ;
// Target not human or vehicle, presumably some weird animal, not worth the ammo
// TODO: Once NPCs can be targeted, add a check for whether the turret's damaged
// and if so, have it shoot whatever attacked it most recently
if (g->u .crossed_threshold () && !g->u .has_trait (" THRESH_ALPHA" ) && !(g->u .has_trait (" HUGE" ) ||
g->u .has_trait (" HUGE_OK" )) ) {
if (g->u_see (z->posx (), z->posy ())) {
add_msg (m_info, _ (" The %s doesn't seem to consider you a target." ), z->name ().c_str ());
z->moves -= 100 ;
return ;
}
}
if (!z->has_effect (" targeted" )) {
// ~ There will be a 120mm HEAT shell sent at high speed to your location next turn.
0 comments on commit
13af826