Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //=============================================================================
- // CSWeapons.
- //=============================================================================
- class CSWeapons expands Weapon
- Abstract;
- Var(CSWeapons) Int Count, ClipCount, HitDamage, AltHitDamage;
- Var(CSWeapons) Float ShellCaseScale, FireRate, AltFireRate;
- Var(CSWeapons) Vector EjectOffset, TracerOffset;
- Var(CSWeapons) Sound ReloadSounds[4];
- Replication
- {
- Reliable If (Role == ROLE_Authority && bNetOwner)
- ClipCount;
- Reliable If (Role == ROLE_Authority)
- ClientSetFOV, ClientSetMFlash, ClientResetFOV;
- }
- Simulated Function SpawnShellCase( Vector X, Vector Y, Vector Z )
- {
- local shellcase s;
- s = Spawn(class'ShellCase', Pawn(Owner), '', Owner.Location + CalcDrawOffset() + EjectOffset.X * X + EjectOffset.Y * Y + EjectOffset.Z * Z);
- if ( s != None )
- {
- s.DrawScale = ShellCaseScale;
- s.Eject(((FRand()*0.3+0.8) *X + (FRand()*0.3+0.4) *Y + (FRand()*0.3+1.0) * Z * 100));
- }
- }
- Simulated Function SpawnSniperShellCase()
- {
- Local Vector X, Y, Z;
- local shellcase s;
- GetAxes(Pawn(owner).ViewRotation,X,Y,Z);
- s = Spawn(class'ShellCase', Pawn(Owner), '', Owner.Location + CalcDrawOffset() + EjectOffset.X * X + EjectOffset.Y * Y + EjectOffset.Z * Z);
- if ( s != None )
- {
- s.DrawScale = ShellCaseScale;
- s.LightType = LT_None;
- s.LightEffect = LE_None;
- s.LightRadius = 0;
- s.LightBrightness = 0;
- s.LightHue = 0;
- s.LightSaturation = 0;
- s.Eject(((FRand()*0.3+0.8) *X + (FRand()*0.3+0.4) *Y + (FRand()*0.3+1.0) * Z * 100));
- }
- }
- function ProcessTraceHit(Actor Other, Vector HitLocation, Vector HitNormal, Vector X, Vector Y, Vector Z)
- {
- SpawnShellCase( X,Y,Z );
- if ( PlayerPawn(Owner)!=None )
- PlayerPawn(Owner).ClientInstantFlash( -0.4, vect(650, 450, 190));
- if (Other == Level)
- Spawn(class'HeavyWallHitEffect',,, HitLocation+HitNormal*9, Rotator(HitNormal));
- else if ( Other!=None && Other!=Self )
- {
- if ( Other.IsA('Pawn') && (HitLocation.Z - Other.Location.Z > 0.62 * Other.CollisionHeight)
- && (instigator.IsA('PlayerPawn') || (instigator.skill > 1))
- && (!Other.IsA('ScriptedPawn') || !ScriptedPawn(Other).bIsBoss) )
- Other.TakeDamage(HitDamage * 1.35, Pawn(Owner), HitLocation, 35000 * X, 'decapitated');
- else
- Other.TakeDamage(HitDamage, Pawn(Owner), HitLocation, 30000.0*X, 'shot');
- if ( !Other.IsA('Pawn') && !Other.IsA('Carcass') )
- spawn(class'SpriteSmokePuff',,,HitLocation+HitNormal*9);
- if ( Other.IsA('Brush') )
- Spawn(class'HeavyWallHitEffect',,, HitLocation+HitNormal*9, Rotator(HitNormal));
- }
- }
- function TraceFire( float Accuracy )
- {
- local vector HitLocation, HitNormal, StartTraceFire, StartTraceSpawn, EndTrace, X,Y,Z, AimDir;
- local actor Other;
- Owner.MakeNoise(Pawn(Owner).SoundDampening);
- GetAxes(Pawn(owner).ViewRotation,X,Y,Z);
- StartTraceFire = Owner.Location + CalcDrawOffset() + FireOffset.Y * Y + FireOffset.Z * Z;
- StartTraceSpawn = Owner.Location + CalcDrawOffset() + TracerOffset.X * X + TracerOffset.Y * Y + TracerOffset.Z * Z;
- AdjustedAim = pawn(owner).AdjustAim(1000000, StartTraceFire, 2.75*AimError, False, False);
- EndTrace = StartTraceFire + Accuracy * (FRand() - 0.5 )* Y * 1000
- + Accuracy * (FRand() - 0.5 ) * Z * 1000;
- AimDir = vector(AdjustedAim);
- EndTrace += (10000 * AimDir);
- Other = Pawn(Owner).TraceShot(HitLocation,HitNormal,EndTrace,StartTraceFire);
- Count++;
- if ( Count == 4 )
- {
- Count = 0;
- if ( VSize(HitLocation - StartTraceFire) > 250 )
- Spawn(class'CSTracer',,, StartTraceSpawn + 96 * AimDir, rotator(EndTrace - StartTraceFire));
- }
- ProcessTraceHit(Other, HitLocation, HitNormal, vector(AdjustedAim),Y,Z);
- }
- Simulated Function ClientSetFOV( Float NewFOV )
- {
- PlayerPawn(Owner).FovAngle = NewFOV;
- PlayerPawn(Owner).DesiredFov = NewFOV;
- }
- Simulated Function ClientResetFOV()
- {
- PlayerPawn(Owner).FOVAngle = PlayerPawn(Owner).DefaultFOV;
- PlayerPawn(Owner).DesiredFov = PlayerPawn(Owner).DefaultFOV;
- }
- Simulated Function ClientSetMFlash( Float FlashSOffset, Float FlashYOffset )
- {
- FlashS = FlashSOffset;
- FlashY = FlashYOffset;
- }
- // Credit to whoever made this, can't remember who it was
- Simulated function WeaponKickback(Int WeaponKickback)
- {
- Local Rotator ViewRotation;
- ViewRotation = Pawn(Owner).ViewRotation;
- ViewRotation.Pitch += WeaponKickback;
- If ( ( ViewRotation.Pitch > 16384 ) && ( ViewRotation.Pitch < 32768 ) )
- ViewRotation.Pitch = 16384;
- Pawn(Owner).ClientSetRotation(ViewRotation);
- }
- Function TweenDown();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement