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

76 lines
1.9 KiB
Ucode

class repl_M79Proj extends M79GrenadeProjectile;
simulated function Explode(vector HitLocation, vector HitNormal)
{
local Controller C;
local PlayerController LocalPlayer;
bHasExploded = true;
// Don't explode if this is a dud
if (bDud)
{
Velocity = vect(0,0,0);
LifeSpan=1.0;
SetPhysics(PHYS_Falling);
}
PlaySound(ExplosionSound,,2.0);
if (!class'Settings'.default.bRemoveSmoke && EffectIsRelevant(Location,false))
{
Spawn(class'KFMod.KFNadeLExplosion',,,HitLocation + HitNormal*20,rotator(HitNormal));
Spawn(ExplosionDecal,self,,HitLocation, rotator(-HitNormal));
}
BlowUp(HitLocation);
Destroy();
// Shake nearby players screens
LocalPlayer = Level.GetLocalPlayerController();
if ((LocalPlayer != none) && (VSize(Location - LocalPlayer.ViewTarget.Location) < DamageRadius))
LocalPlayer.ShakeView(RotMag, RotRate, RotTime, OffsetMag, OffsetRate, OffsetTime);
for (C=Level.ControllerList; C!=none; C=C.NextController)
if ((PlayerController(C) != none) && (C != LocalPlayer)
&& (VSize(Location - PlayerController(C).ViewTarget.Location) < DamageRadius) )
C.ShakeView(RotMag, RotRate, RotTime, OffsetMag, OffsetRate, OffsetTime);
}
simulated function PostBeginPlay()
{
local rotator SmokeRotation;
BCInverse = 1 / BallisticCoefficient;
if (!class'Settings'.default.bRemoveSmoke && Level.NetMode != NM_DedicatedServer)
{
SmokeTrail = Spawn(class'PanzerfaustTrail',self);
SmokeTrail.SetBase(self);
SmokeRotation.Pitch = 32768;
SmokeTrail.SetRelativeRotation(SmokeRotation);
// Corona = Spawn(class'KFMod.KFLAWCorona',self);
}
OrigLoc = Location;
if (!bDud)
{
Dir = vector(Rotation);
Velocity = speed * Dir;
}
if (PhysicsVolume.bWaterVolume)
{
bHitWater = true;
Velocity=0.6*Velocity;
}
super(Projectile).PostBeginPlay();
}
defaultproperties
{
}