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

51 lines
1.4 KiB
Ucode

class stub_Nade extends Nade;
var array<sound> BoomSounds;
// EXPERIMENTAL!!
// fixes nade crashes, but obviously we can't use this :yoba:
function TakeDamage( int Damage, Pawn InstigatedBy, Vector Hitlocation, Vector Momentum, class<DamageType> damageType, optional int HitIndex){}
simulated function Explode(vector HitLocation, vector HitNormal)
{
local PlayerController LocalPlayer;
local Projectile P;
local byte i;
bHasExploded = True;
BlowUp(HitLocation);
PlaySound(class'stub_Nade'.default.BoomSounds[rand(3)],,2.0);
// Shrapnel
for( i=Rand(6); i<10; i++ )
{
P = Spawn(ShrapnelClass,,,,RotRand(True));
if( P!=None )
P.RemoteRole = ROLE_None;
}
if ( EffectIsRelevant(Location,false) )
{
Spawn(Class'KFmod.KFNadeExplosion',,, HitLocation, rotator(vect(0,0,1)));
Spawn(ExplosionDecal,self,,HitLocation, rotator(-HitNormal));
}
// Shake nearby players screens
LocalPlayer = Level.GetLocalPlayerController();
if ( (LocalPlayer != None) && (VSize(Location - LocalPlayer.ViewTarget.Location) < (DamageRadius * 1.5)) )
LocalPlayer.ShakeView(RotMag, RotRate, RotTime, OffsetMag, OffsetRate, OffsetTime);
Destroy();
}
defaultproperties
{
BoomSounds[0]=SoundGroup'KF_GrenadeSnd.Nade_Explode_1'
BoomSounds[1]=SoundGroup'KF_GrenadeSnd.Nade_Explode_2'
BoomSounds[2]=SoundGroup'KF_GrenadeSnd.Nade_Explode_3'
}