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 00236 00237 00238 00239 00240 00241 00242 00243 00244 00245 00246 00247 00248 00249 00250 00251 00252 00253 00254 00255 00256 00257 00258 00259 00260 00261 00262 00263 00264 00265 00266 00267 00268 00269 00270 00271 00272 00273 00274 00275 00276 00277 00278 00279 00280 00281 00282 00283 00284 00285 00286 00287 00288 00289 00290 00291 00292 00293 00294 00295 00296 |
/** * Copyright 1998-2008 Epic Games, Inc. All Rights Reserved. */ class UTProj_RedeemerBase extends UTProjectile abstract; var CameraAnim ExplosionShake; var class<UTReplicatedEmitter> ExplosionClass; var array<DistanceBasedParticleTemplate> DistanceExplosionTemplates; var StaticMeshComponent ProjMesh; /** Used to pulse the lights */ var MaterialInstanceConstant RocketMaterialInstance; var name TeamParamName; var LinearColor TeamColor; simulated function PostBeginPlay() { super.PostBeginPlay(); if ( !bDeleteMe && (WorldInfo.NetMode != NM_DedicatedServer) && ProjMesh != none ) { RocketMaterialInstance = ProjMesh.CreateAndSetMaterialInstanceConstant(0); RocketMaterialInstance.SetVectorParameterValue( TeamParamName, TeamColor ); } } event bool EncroachingOn(Actor Other) { return Other.bWorldGeometry; } simulated function bool EffectIsRelevant(vector SpawnLocation, bool bForceDedicated, float CullDistance ) { return true; } simulated function ProcessTouch(Actor Other, vector HitLocation, vector HitNormal) { if ( Projectile(Other) == None ) { Explode(HitLocation, HitNormal); } } simulated function PhysicsVolumeChange(PhysicsVolume Volume); simulated function Landed(vector HitNormal, Actor FloorActor) { Explode(Location, HitNormal); } simulated function HitWall(vector HitNormal, Actor Wall, PrimitiveComponent WallComp) { Explode(Location, HitNormal); } event TakeDamage(int DamageAmount, Controller InstigatedBy, vector HitLocation, vector Momentum, class<DamageType> DamageType, optional TraceHitInfo HitInfo, optional Actor DamageCauser) { if (DamageAmount > 0 && (InstigatedBy == None || InstigatorController == None || InstigatedBy == InstigatorController || !WorldInfo.GRI.OnSameTeam(InstigatedBy, InstigatorController))) { if ( InstigatedBy == None || DamageType == class'DmgType_Crushed' || (class<UTDamageType>(DamageType) != None && class<UTDamageType>(DamageType).default.bVehicleHit) ) { Explode(Location, vect(0,0,1)); } else { Spawn(ExplosionClass); if ( PlayerController(InstigatorController) != None ) PlayerController(InstigatorController).ReceiveLocalizedMessage(class'UTLastSecondMessage', 1, InstigatorController.PlayerReplicationInfo, None, None); if ( (InstigatedBy != InstigatorController) && (PlayerController(InstigatedBy) != None) ) { PlayerController(InstigatedBy).ReceiveLocalizedMessage(class'UTLastSecondMessage', 1, InstigatorController.PlayerReplicationInfo, None, None); } if ( UTPlayerReplicationInfo(InstigatorController.PlayerReplicationInfo) != None ) { UTPlayerReplicationInfo(InstigatorController.PlayerReplicationInfo).IncrementEventStat('EVENT_DENIEDREDEEMER'); } bSuppressExplosionFX = true; SetCollision(false, false); HurtRadius(Damage, DamageRadius * 0.125, MyDamageType, MomentumTransfer, Location); Destroy(); } } } simulated event FellOutOfWorld(class<DamageType> DmgType) { Explode(Location, vect(0,0,1)); } simulated function Explode(vector HitLocation, vector HitNormal) { SpawnExplosionEffects(HitLocation, HitNormal); // Clean up the effects here if (ProjEffects != None) { ProjEffects.DeactivateSystem(); } GotoState('Dying'); } simulated function SpawnExplosionEffects(vector HitLocation, vector HitNormal) { ProjExplosionTemplate = class'UTEmitter'.static.GetTemplateForDistance(DistanceExplosionTemplates, HitLocation, WorldInfo); Super.SpawnExplosionEffects(HitLocation, HitNormal); } /** shakes the view of players near Location * static so that it can be shared with UTRemoteRedeemer */ static function ShakeView(vector Loc, WorldInfo WI) { local UTPlayerController PC; local float Dist, Scale; foreach WI.AllControllers(class'UTPlayerController', PC) { if (PC.ViewTarget != None) { Dist = VSize(Loc - PC.ViewTarget.Location); if (Dist < default.DamageRadius * 2.0) { if (Dist < default.DamageRadius) { Scale = 1.0; } else { Scale = (default.DamageRadius * 2.0 - Dist) / default.DamageRadius; } PC.ClientPlayCameraAnim(CameraAnim'Camera_FX_02.WP_Redeemer.C_WP_Redeemer_Shake_UT3G', Scale); } } } } /** knocks down all players that would have been killed, but avoided it by being out of line of sight * static so that it can be shared with UTRemoteRedeemer */ static function DoKnockdown(vector Loc, WorldInfo WI, Controller InstigatedByController) { local Controller C; local vector Dir; local float DamageScale; local UTPawn P; foreach WI.AllControllers(class'Controller', C) { P = UTPawn(C.Pawn); if (P != None && P.Health > 0 && !P.bIgnoreForces && !P.InGodMode() && !WI.GRI.OnSameTeam(P, InstigatedByController)) { Dir = P.Location - Loc; DamageScale = FClamp(1.0 - (VSize(Dir) / default.DamageRadius), 0.0, 1.0); if (P.Health < default.Damage * DamageScale) { P.AddVelocity(((default.MomentumTransfer * DamageScale) / P.Mass) * 0.5 * Normal(Dir), P.Location, default.MyDamageType); P.ForceRagdoll(); } } } } /** special version of HurtRadius() for the Redeemer that works better with the giant radius by tracing to edges * of large objects instead of just the center * static so that it can be shared with UTRemoteRedeemer */ static function RedeemerHurtRadius(float RadiusFactor, Actor Redeemer, Controller InstigatedByController) { local Actor Victim, HitActor; local bool bCauseDamage; local float HurtRadius, Radius, Height, VictimDamage; local vector Side, Up, ExplosionCenter, HitNormal, HitLocation; HurtRadius = default.DamageRadius * RadiusFactor; if (InstigatedByController == None && Redeemer.Instigator != None) { InstigatedByController = Redeemer.Instigator.Controller; } // move explosion center up a bit to address not hitting pawns ExplosionCenter = Redeemer.Location + vect(0,0,200); HitActor = Redeemer.Trace(HitLocation, HitNormal, ExplosionCenter, Redeemer.Location, true,,,TRACEFLAG_Blocking); ExplosionCenter = (HitActor == None) ? Redeemer.Location + vect(0,0,100) : 0.5 * (Redeemer.Location + HitLocation); foreach Redeemer.CollidingActors(class'Actor', Victim, HurtRadius, ExplosionCenter) { if (!Victim.bStatic && (Victim != Redeemer) ) { Victim.GetBoundingCylinder(Radius, Height); Up = vect(0,0,1) * Height; bCauseDamage = Redeemer.FastTrace(Victim.Location + Up, ExplosionCenter); if (!bCauseDamage) { bCauseDamage = Redeemer.FastTrace(Victim.Location , ExplosionCenter); if ( !bCauseDamage ) { bCauseDamage = Redeemer.FastTrace(Victim.Location , Redeemer.Location); } if ( !bCauseDamage && (Radius > 100.0) ) { // try sides Side = (Normal(Victim.Location - ExplosionCenter) Cross vect(0,0,1)) * Radius; bCauseDamage = Redeemer.FastTrace(Victim.Location + Side + Up, ExplosionCenter) || Redeemer.FastTrace(Victim.Location - Side + Up, ExplosionCenter); } } if (bCauseDamage) { VictimDamage = (UTOnslaughtPowerNode(Victim) == None) ? default.Damage : 2*default.Damage; Victim.TakeRadiusDamage( InstigatedByController, VictimDamage, HurtRadius, default.MyDamageType, default.MomentumTransfer, ExplosionCenter, false, Redeemer ); } } } } simulated state Dying { event TakeDamage(int DamageAmount, Controller EventInstigator, vector HitLocation, vector Momentum, class<DamageType> DamageType, optional TraceHitInfo HitInfo, optional Actor DamageCauser) {} function Timer() {} simulated function BeginState(Name PreviousStateName) { if (Role == ROLE_Authority) { MakeNoise(1.0); ShakeView(Location, WorldInfo); } SetHidden(True); SetPhysics(PHYS_None); SetCollision(false, false); InitialState = 'Dying'; SetTimer(0, false); } Begin: RedeemerHurtRadius(0.125, self, InstigatorController); Sleep(0.5); RedeemerHurtRadius(0.300, self, InstigatorController); Sleep(0.2); RedeemerHurtRadius(0.475, self, InstigatorController); Sleep(0.2); RedeemerHurtRadius(0.650, self, InstigatorController); if (Role == ROLE_Authority) { DoKnockdown(Location, WorldInfo, InstigatorController); } Sleep(0.2); RedeemerHurtRadius(0.825, self, InstigatorController); Sleep(0.2); RedeemerHurtRadius(1.0, self, InstigatorController); Shutdown(); } defaultproperties { TeamParamName="Redeemer_Team_Color" TeamColor=(R=0.500000,G=1.000000,B=14.000000,A=1.000000) bImportantAmbientSound=True bSuppressExplosionFX=True Speed=1000.000000 MaxSpeed=1000.000000 Damage=250.000000 DamageRadius=2600.000000 MomentumTransfer=250000.000000 Begin Object Class=CylinderComponent Name=CollisionCylinder ObjName=CollisionCylinder Archetype=CylinderComponent'UTGame.Default__UTProjectile:CollisionCylinder' CollisionHeight=12.000000 CollisionRadius=20.000000 CollideActors=True ObjectArchetype=CylinderComponent'UTGame.Default__UTProjectile:CollisionCylinder' End Object CylinderComponent=CollisionCylinder Components(0)=CollisionCylinder Begin Object Class=DynamicLightEnvironmentComponent Name=RedeemerLightEnvironment ObjName=RedeemerLightEnvironment Archetype=DynamicLightEnvironmentComponent'Engine.Default__DynamicLightEnvironmentComponent' bCastShadows=False Name="RedeemerLightEnvironment" ObjectArchetype=DynamicLightEnvironmentComponent'Engine.Default__DynamicLightEnvironmentComponent' End Object Components(1)=RedeemerLightEnvironment bNetTemporary=False bCollideComplex=False bProjTarget=True LifeSpan=20.000000 CollisionComponent=CollisionCylinder Name="Default__UTProj_RedeemerBase" ObjectArchetype=UTProjectile'UTGame.Default__UTProjectile' } |
Overview | Package | Class | Source | Class tree | Glossary | UnrealScript Documentation |
previous class next class | frames no frames |