class AuraCannon extends TeamCannon; function PostBeginPlay() { Super.PostBeginPlay(); } function Name PickAnim() { Drop = 0; if (DesiredRotation.Pitch < -1000) { if ( DesiredRotation.Pitch < -4000) return 'All'; else return 'All'; } else if (DesiredRotation.Pitch > 1000) { if (DesiredRotation.Pitch > 4000) return 'All'; else return 'All'; } else return 'All'; } function PlayDeactivate() { TweenAnim('Still', 1.5); } function StartDeactivate() { PlaySound(ActivateSound, SLOT_None,5.0); Mesh = mesh'UnrealI.minigunM'; AnimSequence = 'Still'; AnimFrame = 0.0; SetPhysics(PHYS_Rotating); DesiredRotation = StartingRotation; PrePivot = vect(0,0,0); } function ActivateComplete() { Mesh = mesh'UnrealI.minigunM'; PrePivot = vect(0,0,40); } function ProcessTraceHit(Actor Other, Vector HitLocation, Vector HitNormal, Vector X, Vector Y, Vector Z) { local int rndDam; if ((Other!=self) && (Other != None)) { if (!Other.bIsPawn && !Other.IsA('Carcass')) rndDam = 5 + Rand(4); Other.TakeDamage(rndDam, self, HitLocation, rndDam*500.0*X, 'shot'); } } function Shoot() { local Actor HitActor; local Vector HitLocation, HitNormal, EndTrace, ProjStart, X,Y,Z; local rotator ShootRot; if (DesiredRotation.Pitch < -10000) Return; if ( AmbientSound == None ) PlaySound(FireSound, SLOT_None,5.0); GetAxes(Rotation,X,Y,Z); ProjStart = PrePivot + Location + X*20 + 12 * Y + 16 * Z; ShootRot = rotator(Enemy.Location - ProjStart); ShootRot.Yaw = ShootRot.Yaw + 1024 - Rand(2048); DesiredRotation = ShootRot; ShootRot.Pitch = ShootRot.Pitch + 256 - Rand(512); GetAxes(ShootRot,X,Y,Z); PlayAnim(PickAnim()); if (FRand() < 0.4) Spawn(class'AuraT',,, ProjStart, ShootRot); HitActor = TraceShot(HitLocation,HitNormal,ProjStart + 10000 * X,ProjStart); ProcessTraceHit(HitActor, HitLocation, HitNormal, X,Y,Z); bShoot = false; ShootRot.Pitch = ShootRot.Pitch & 65535; if (ShootRot.Pitch < 32768) ShootRot.Pitch = Min(ShootRot.Pitch, 5000); else ShootRot.Pitch = Max(ShootRot.Pitch, 60535); ShootRot.Pitch = 0; SetRotation(ShootRot); } state ActiveCannon { ignores SeePlayer; function Timer() { local Pawn P; DesiredRotation = rotator(Enemy.Location - Location - PrePivot); DesiredRotation.Yaw = DesiredRotation.Yaw & 65535; if ( bShoot ) Shoot(); else { TweenAnim(PickAnim(), 0.2); bShoot=True; SetTimer(SampleTime,True); } } function BeginState() { Super.BeginState(); } function EndState() { AmbientSound = None; } Begin: Disable('Timer'); FinishAnim(); PlayActivate(); FinishAnim(); ActivateComplete(); Enable('Timer'); SetTimer(SampleTime,True); RotationRate.Yaw = TrackingRate; SetPhysics(PHYS_Rotating); AmbientSound = Class'Minigun'.Default.FireSound; bShoot=True; FaceEnemy: TurnToward(Enemy); Goto('FaceEnemy'); } defaultproperties { FireSound=Sound'UnrealI.Cannon.CannonShot' }