rott/kf_sources/KFMod/Classes/KFWeaponShotgun.uc
2026-07-14 20:27:09 +07:00

77 lines
1.9 KiB
Ucode

class KFWeaponShotgun extends KFWeapon
abstract;
simulated function AddReloadedAmmo()
{
if(AmmoAmount(0) > 0)
++MagAmmoRemaining;
// Don't do this on a "Hold to reload" weapon, as it can update too quick actually and cause issues maybe - Ramm
if( !bHoldToReload )
{
ClientForceKFAmmoUpdate(MagAmmoRemaining,AmmoAmount(0));
}
if ( PlayerController(Instigator.Controller) != none && KFSteamStatsAndAchievements(PlayerController(Instigator.Controller).SteamStatsAndAchievements) != none )
{
KFSteamStatsAndAchievements(PlayerController(Instigator.Controller).SteamStatsAndAchievements).OnWeaponReloaded();
}
}
//I'll just copy and paste the damn things if you want them
//so badly.
// AI Interface
function float GetAIRating()
{
local Bot B;
local float EnemyDist;
local vector EnemyDir;
B = Bot(Instigator.Controller);
if ( B == None )
return AIRating;
if ( (B.Target != None) && (Pawn(B.Target) == None) && (VSize(B.Target.Location - Instigator.Location) < 1250) )
return 0.9;
if ( B.Enemy == None )
{
if ( (B.Target != None) && VSize(B.Target.Location - B.Pawn.Location) > 3500 )
return 0.2;
return AIRating;
}
EnemyDir = B.Enemy.Location - Instigator.Location;
EnemyDist = VSize(EnemyDir);
if ( EnemyDist > 750 )
{
if ( EnemyDist > 2000 )
{
if ( EnemyDist > 3500 )
return 0.2;
return (AIRating - 0.3);
}
if ( EnemyDir.Z < -0.5 * EnemyDist )
return (AIRating - 0.3);
}
else if ( (B.Enemy.Weapon != None) && B.Enemy.Weapon.bMeleeWeapon )
return (AIRating + 0.35);
else if ( EnemyDist < 400 )
return (AIRating + 0.2);
return FMax(AIRating + 0.2 - (EnemyDist - 400) * 0.0008, 0.2);
}
function float SuggestAttackStyle()
{
if ( (AIController(Instigator.Controller) != None)
&& (AIController(Instigator.Controller).Skill < 3) )
return 0.4;
return 0.8;
}
defaultproperties
{
bHoldToReload=True
}