Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |
00001 00002 00003 00004 00005 00006 00007 00008 00009 00010 00011 00012 00013 00014 00015 00016 00017 00018 00019 00020 00021 00022 00023 00024 00025 00026 00027 00028 00029 00030 00031 00032 00033 00034 00035 00036 00037 00038 00039 00040 00041 00042 00043 00044 00045 00046 00047 00048 00049 00050 00051 00052 00053 00054 00055 00056 00057 00058 00059 00060 00061 00062 00063 00064 00065 00066 00067 00068 00069 00070 00071 00072 00073 00074 00075 00076 00077 00078 00079 00080 00081 00082 00083 00084 00085 00086 00087 00088 00089 00090 00091 00092 00093 00094 00095 00096 00097 00098 00099 00100 00101 00102 00103 00104 00105 00106 00107 00108 00109 00110 00111 00112 00113 00114 00115 00116 00117 00118 00119 00120 00121 00122 00123 00124 00125 00126 00127 00128 00129 00130 00131 00132 00133 00134 00135 00136 00137 00138 00139 00140 00141 00142 00143 00144 00145 00146 00147 00148 00149 00150 00151 00152 00153 00154 00155 00156 00157 00158 00159 00160 00161 00162 00163 00164 00165 00166 00167 00168 00169 00170 00171 00172 00173 00174 00175 00176 00177 00178 00179 00180 00181 00182 00183 00184 00185 00186 00187 00188 00189 00190 00191 00192 00193 00194 00195 00196 00197 00198 00199 00200 00201 00202 00203 00204 00205 00206 00207 00208 00209 00210 00211 00212 00213 00214 00215 00216 00217 00218 00219 00220 00221 00222 00223 00224 00225 00226 00227 00228 00229 00230 00231 00232 00233 00234 00235 |
class ONSAVRiLRocket extends Projectile; var Emitter SmokeTrail; var Effects Corona; var float AccelerationAddPerSec; var bool bLockedOn; var float LeadTargetDelay; //don't lead target until missle has been flying for this many seconds var float LeadTargetStartTime; var actor OverrideTarget; var Vehicle HomingTarget; replication { reliable if (bNetDirty && Role == ROLE_Authority) HomingTarget, OverrideTarget, bLockedOn; } simulated function Destroyed() { // Turn of smoke emitters. Emitter should then destroy itself when all particles fade out. if ( SmokeTrail != None ) SmokeTrail.Kill(); if ( Corona != None ) Corona.Destroy(); PlaySound(sound'WeaponSounds.BExplosion3',,2.5*TransientSoundVolume); if (!bNoFX && EffectIsRelevant(Location, false)) spawn(class'ONSAVRiLRocketExplosion',,, Location, rotator(vect(0,0,1))); if (Instigator != None && Instigator.IsLocallyControlled() && Instigator.Weapon != None && !Instigator.Weapon.HasAmmo()) Instigator.Weapon.DoAutoSwitch(); //hack for crappy weapon firing sound if (ONSAVRiL(Owner) != None) ONSAVRiL(Owner).PlaySound(sound'WeaponSounds.BExplosion3', SLOT_Interact, 0.01,, TransientSoundRadius); Super.Destroyed(); } simulated function PostBeginPlay() { local vector Dir; Dir = vector(Rotation); if ( Level.NetMode != NM_DedicatedServer) { SmokeTrail = Spawn(class'ONSAvrilSmokeTrail',,,Location - 15 * Dir); SmokeTrail.Setbase(self); Corona = Spawn(class'RocketCorona',self); } Velocity = speed * Dir; Acceleration = Dir; //really small accel just to give it a direction for use later if (PhysicsVolume.bWaterVolume) Velocity=0.6*Velocity; if ( Level.bDropDetail ) { bDynamicLight = false; LightType = LT_None; } SetTimer(0.1, true); LeadTargetStartTime = Level.TimeSeconds + LeadTargetDelay; Super.PostBeginPlay(); } simulated function Landed( vector HitNormal ) { Explode(Location,HitNormal); } simulated function Explode(vector HitLocation, vector HitNormal) { BlowUp(HitLocation); Destroy(); } simulated function Timer() { local vector Dir, ForceDir; local float VelMag, LowestDesiredZ; local array<Vehicle> TargetPawns; local bool bLastLockedOn; local int i; local actor NewTarget; if (Role == ROLE_Authority) { if (OverrideTarget == none) { if (Instigator != None && Instigator.Controller != None && ONSAVRiL(Owner) != None) { bLastLockedOn = bLockedOn; bLockedOn = ONSAVRiL(Owner).bLockedOn; HomingTarget = ONSAVRiL(Owner).HomingTarget; if (!bLastLockedOn && bLockedOn) { if (HomingTarget != None && HomingTarget.Controller != None) HomingTarget.Controller.ReceiveProjectileWarning(self); } } else bLockedOn = false; } else bLockedOn = true; if (HomingTarget != None) { // Check to see if it's lock has changed if ( !HomingTarget.VerifyLock(self,NewTarget) ) OverrideTarget = NewTarget; else { OverrideTarget = None; HomingTarget.IncomingMissile(self); //bots with nothing else to shoot at may attempt to shoot down incoming missles TargetPawns = HomingTarget.GetTurrets(); TargetPawns[TargetPawns.length] = HomingTarget; for (i = 0; i < TargetPawns.length; i++) TargetPawns[i].ShouldTargetMissile(self); } } } if (bLockedOn && ( HomingTarget != none || OverrideTarget != none) ) { if (OverrideTarget != none) { if ( VSize(OverrideTarget.Location - Location ) < 256 ) { OverrideTarget.Destroy(); TakeDamage(20000,none, Location, Velocity, none); return; } NewTarget = OverrideTarget; } else NewTarget = HomingTarget; // Do normal guidance to target. if ( Pawn(NewTarget) != None ) Dir = Pawn(NewTarget).GetTargetLocation() - Location; else Dir = NewTarget.Location - Location; VelMag = VSize(Velocity); if (Level.TimeSeconds >= LeadTargetStartTime) { ForceDir = Dir + NewTarget.Velocity * VSize(Dir) / (VelMag * 2); if (Instigator != None) LowestDesiredZ = FMin(Instigator.Location.Z, NewTarget.Location.Z); //missle should avoid going any lower than this else LowestDesiredZ = NewTarget.Location.Z; if (ForceDir.Z + Location.Z < LowestDesiredZ) ForceDir.Z += LowestDesiredZ - (ForceDir.Z + Location.Z); ForceDir = Normal(ForceDir); } else ForceDir = Dir; ForceDir = Normal(ForceDir * 0.8 * VelMag + Velocity); Velocity = VelMag * ForceDir; Acceleration += 5 * ForceDir; // Update rocket so it faces in the direction its going. SetRotation(rotator(Velocity)); } } simulated function Tick(float deltaTime) { if (VSize(Velocity) >= MaxSpeed) { Acceleration = vect(0,0,0); disable('Tick'); } else Acceleration += Normal(Velocity) * (AccelerationAddPerSec * deltaTime); } function TakeDamage(int Damage, Pawn instigatedBy, Vector hitlocation, Vector momentum, class<DamageType> damageType) { if (Damage > 0) Explode(HitLocation, vect(0,0,0)); } simulated event PostRender2D(Canvas C, float ScreenLocX, float ScreenLocY) { local PlayerController PC; if (bLockedOn) { PC = Level.GetLocalPlayerController(); if (PC!=none && PC.Pawn != none && ONSWeaponPawn(PC.Pawn)!=none) ONSWeaponPawn(PC.Pawn).ProjectilePostRender2D(self, C, ScreenLocX, ScreenLocY); } } defaultproperties { AccelerationAddPerSec=750.000000 LeadTargetDelay=1.000000 Speed=550.000000 MaxSpeed=2800.000000 Damage=125.000000 DamageRadius=150.000000 MomentumTransfer=50000.000000 MyDamageType=Class'Onslaught.DamTypeONSAVRiLRocket' ExplosionDecal=Class'Onslaught.ONSRocketScorch' bScriptPostRender=Wahr DrawType=DT_StaticMesh StaticMesh=StaticMesh'VMWeaponsSM.AVRiLGroup.AVRiLprojectileSM' bNetTemporary=Falsch bUpdateSimulatedPosition=Wahr bIgnoreVehicles=Wahr LifeSpan=7.000000 DrawScale=0.200000 AmbientGlow=96 bProjTarget=Wahr bUseCylinderCollision=Falsch bFixedRotationDir=Wahr RotationRate=(Roll=50000) DesiredRotation=(Roll=30000) ForceType=FT_Constant ForceRadius=100.000000 ForceScale=5.000000 } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |