[Mod FF]: Fixed blackout battlechatter, refactored the battlechatter script and some fix in _damagefeedback
This commit is contained in:
@ -12,7 +12,7 @@ init()
|
||||
// if ( getDvar( "scr_damagefeedback" ) == "0" )
|
||||
// return;
|
||||
|
||||
axis = getaiarray( "axis" );
|
||||
axis = getAIArray( "axis" );
|
||||
array_thread( axis, ::monitorDamage );
|
||||
add_global_spawn_function( "axis", ::monitorDamage );
|
||||
|
||||
@ -56,18 +56,18 @@ damagefeedback_took_damage( damage, attacker, direction_vec, point, type, modelN
|
||||
legal_bullet_types = [];
|
||||
legal_bullet_types[ "MOD_PISTOL_BULLET" ] = true;
|
||||
legal_bullet_types[ "MOD_RIFLE_BULLET" ] = true;
|
||||
if ( isdefined( self.bullet_resistance ) )
|
||||
if ( isDefined( self.bullet_resistance ) )
|
||||
{
|
||||
if ( isdefined( legal_bullet_types[ type ] ) )
|
||||
if ( isDefined( legal_bullet_types[ type ] ) )
|
||||
{
|
||||
if ( damage <= self.bullet_resistance )
|
||||
return;
|
||||
}
|
||||
}
|
||||
if ( !isalive( self ) )
|
||||
if ( !isAlive( self ) )
|
||||
{
|
||||
headshot = false;
|
||||
if ( ( self.damageLocation == "helmet" || self.damageLocation == "head" ) && isdefined( legal_bullet_types[ type ] ) )
|
||||
if ( ( self.damageLocation == "helmet" || self.damageLocation == "head" ) && isDefined( legal_bullet_types[ type ] ) )
|
||||
headshot = true;
|
||||
|
||||
attacker updateDamageFeedback( self, true, headshot );
|
||||
@ -79,21 +79,50 @@ damagefeedback_took_damage( damage, attacker, direction_vec, point, type, modelN
|
||||
}
|
||||
|
||||
updateDamageFeedback( attacked, kill, headshot )
|
||||
{
|
||||
if ( !isPlayer( self ) )
|
||||
return;
|
||||
if ( !isDefined( attacked.team ) )
|
||||
return;
|
||||
if ( ( attacked.team == "allies" ) || ( attacked.team == "neutral" ) )
|
||||
return;
|
||||
/*
|
||||
if ( isDefined( attacked.magic_bullet_shield ) && attacked.magic_bullet_shield )
|
||||
return;
|
||||
if ( isDefined( attacked.godmode ) && attacked.godmode )
|
||||
return;
|
||||
if ( isDefined( attacked.script_godmode ) && attacked.script_godmode )
|
||||
return;
|
||||
*/
|
||||
self updateDamageFeedbackSnd();
|
||||
self updateDamageFeedbackHUD( attacked, kill, headshot );
|
||||
}
|
||||
|
||||
updateDamageFeedbackSnd()
|
||||
{
|
||||
if ( getDvar( "snd_hitsoundDisabled" ) == "1" )
|
||||
return;
|
||||
|
||||
if ( !isPlayer( self ) )
|
||||
return;
|
||||
|
||||
if ( soundExists( "SP_hit_alert_npc" ) )
|
||||
self playLocalSound( "SP_hit_alert_npc" );
|
||||
}
|
||||
|
||||
updateDamageFeedbackHUD( attacked, kill, headshot )
|
||||
{
|
||||
if ( getDvar( "cg_drawDamageFeedbackOption" ) == "0" )
|
||||
return;
|
||||
|
||||
if ( !isPlayer( self ) )
|
||||
return;
|
||||
if ( !isdefined( attacked.team ) )
|
||||
return;
|
||||
if ( ( attacked.team == "allies" ) || ( attacked.team == "neutral" ) )
|
||||
return;
|
||||
|
||||
if ( getDvar( "snd_hitsoundDisabled" ) == "0" )
|
||||
self playlocalsound( "SP_hit_alert_npc" );
|
||||
|
||||
fadeTime = 1; //fade out crosshair damage indicator over this time
|
||||
|
||||
fadeTime = 1; //fade out crosshair damage indicator over this time
|
||||
|
||||
//If in slomo, fade out damage indicator faster (the value entered for the slomo time fraction
|
||||
if ( isDefined( level.slowmo.speed_slow ) )
|
||||
fadeTime = level.slowmo.speed_slow;
|
||||
|
||||
if ( kill )
|
||||
self.hud_damagefeedback.color = ( 1, 0.2, 0.2 );
|
||||
@ -118,4 +147,4 @@ updateDamageFeedback( attacked, kill, headshot )
|
||||
offset = 0 * 240;
|
||||
self.hud_damagefeedback.y = 25 - int( offset );
|
||||
self.hud_damagefeedback_headshot.y = 25 - int( offset );
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user