Core.Object | +--Engine.Actor | +--Engine.Projectile | +--Botpack.PBolt
float
BeamSize
Actor
DamagedActor
vector
FireOffset
AccumulatedDamage,
LastHitTime
PBolt
PlasmaBeam
int
Position
Texture
SpriteAnim[5]
SpriteFrame
PlasmaCap
WallEffect
bRight,
bCenter
simulated
CheckBeam(vector X, float DeltaTime)
Destroyed()
UpdateBeam(PBolt ParentBolt, vector Dir, float DeltaTime)
00001 //============================================================================= 00002 // pbolt. 00003 //============================================================================= 00004 class PBolt extends projectile; 00005 00006 #exec TEXTURE IMPORT NAME=PalGreen FILE=..\unrealshare\textures\expgreen.pcx GROUP=Effects 00007 #exec OBJ LOAD FILE=textures\BoltCap.utx PACKAGE=Botpack.BoltCap 00008 #exec OBJ LOAD FILE=textures\BoltHit.utx PACKAGE=Botpack.BoltHit 00009 00010 #exec MESH IMPORT MESH=pbolt ANIVFILE=MODELS\pbolt_a.3d DATAFILE=MODELS\pbolt_d.3d 00011 #exec MESH ORIGIN MESH=pbolt X=0 Y=-400 Z=0 YAW=192 00012 00013 #exec MESH SEQUENCE MESH=pbolt SEQ=All STARTFRAME=0 NUMFRAMES=1 00014 #exec MESH SEQUENCE MESH=pbolt SEQ=still STARTFRAME=0 NUMFRAMES=1 00015 00016 #exec MESHMAP NEW MESHMAP=pbolt MESH=pbolt 00017 #exec MESHMAP SCALE MESHMAP=pbolt X=0.10125 Y=0.10125 Z=0.2025 00018 00019 #exec TEXTURE IMPORT NAME=pbolt0 FILE=Textures\Bolta_00.bmp GROUP=Skins LODSET=2 00020 #exec TEXTURE IMPORT NAME=pbolt1 FILE=Textures\Bolta_01.bmp GROUP=Skins LODSET=2 00021 #exec TEXTURE IMPORT NAME=pbolt2 FILE=Textures\Bolta_02.bmp GROUP=Skins LODSET=2 00022 #exec TEXTURE IMPORT NAME=pbolt3 FILE=Textures\Bolta_03.bmp GROUP=Skins LODSET=2 00023 #exec TEXTURE IMPORT NAME=pbolt4 FILE=Textures\Bolta_04.bmp GROUP=Skins LODSET=2 00024 #exec MESHMAP SETTEXTURE MESHMAP=pbolt NUM=0 TEXTURE=pbolt0 00025 00026 var() texture SpriteAnim[5]; 00027 var int SpriteFrame; 00028 var PBolt PlasmaBeam; 00029 var PlasmaCap WallEffect; 00030 var int Position; 00031 var vector FireOffset; 00032 var float BeamSize; 00033 var bool bRight, bCenter; 00034 var float AccumulatedDamage, LastHitTime; 00035 var Actor DamagedActor; 00036 00037 replication 00038 { 00039 // Things the server should send to the client. 00040 unreliable if( Role==ROLE_Authority ) 00041 bRight, bCenter; 00042 } 00043 00044 simulated function Destroyed() 00045 { 00046 Super.Destroyed(); 00047 if ( PlasmaBeam != None ) 00048 PlasmaBeam.Destroy(); 00049 if ( WallEffect != None ) 00050 WallEffect.Destroy(); 00051 } 00052 00053 simulated function CheckBeam(vector X, float DeltaTime) 00054 { 00055 local actor HitActor; 00056 local vector HitLocation, HitNormal; 00057 00058 // check to see if hits something, else spawn or orient child 00059 00060 HitActor = Trace(HitLocation, HitNormal, Location + BeamSize * X, Location, true); 00061 if ( (HitActor != None) && (HitActor != Instigator) 00062 && (HitActor.bProjTarget || (HitActor == Level) || (HitActor.bBlockActors && HitActor.bBlockPlayers)) 00063 && ((Pawn(HitActor) == None) || Pawn(HitActor).AdjustHitLocation(HitLocation, Velocity)) ) 00064 { 00065 if ( Level.Netmode != NM_Client ) 00066 { 00067 if ( DamagedActor == None ) 00068 { 00069 AccumulatedDamage = FMin(0.5 * (Level.TimeSeconds - LastHitTime), 0.1); 00070 HitActor.TakeDamage(damage * AccumulatedDamage, instigator,HitLocation, 00071 (MomentumTransfer * X * AccumulatedDamage), MyDamageType); 00072 AccumulatedDamage = 0; 00073 } 00074 else if ( DamagedActor != HitActor ) 00075 { 00076 DamagedActor.TakeDamage(damage * AccumulatedDamage, instigator,HitLocation, 00077 (MomentumTransfer * X * AccumulatedDamage), MyDamageType); 00078 AccumulatedDamage = 0; 00079 } 00080 LastHitTime = Level.TimeSeconds; 00081 DamagedActor = HitActor; 00082 AccumulatedDamage += DeltaTime; 00083 if ( AccumulatedDamage > 0.22 ) 00084 { 00085 if ( DamagedActor.IsA('Carcass') && (FRand() < 0.09) ) 00086 AccumulatedDamage = 35/damage; 00087 DamagedActor.TakeDamage(damage * AccumulatedDamage, instigator,HitLocation, 00088 (MomentumTransfer * X * AccumulatedDamage), MyDamageType); 00089 AccumulatedDamage = 0; 00090 } 00091 } 00092 if ( HitActor.bIsPawn && Pawn(HitActor).bIsPlayer ) 00093 { 00094 if ( WallEffect != None ) 00095 WallEffect.Destroy(); 00096 } 00097 else if ( (WallEffect == None) || WallEffect.bDeleteMe ) 00098 WallEffect = Spawn(class'PlasmaHit',,, HitLocation - 5 * X); 00099 else if ( !WallEffect.IsA('PlasmaHit') ) 00100 { 00101 WallEffect.Destroy(); 00102 WallEffect = Spawn(class'PlasmaHit',,, HitLocation - 5 * X); 00103 } 00104 else 00105 WallEffect.SetLocation(HitLocation - 5 * X); 00106 00107 if ( (WallEffect != None) && (Level.NetMode != NM_DedicatedServer) ) 00108 Spawn(ExplosionDecal,,,HitLocation,rotator(HitNormal)); 00109 00110 if ( PlasmaBeam != None ) 00111 { 00112 AccumulatedDamage += PlasmaBeam.AccumulatedDamage; 00113 PlasmaBeam.Destroy(); 00114 PlasmaBeam = None; 00115 } 00116 00117 return; 00118 } 00119 else if ( (Level.Netmode != NM_Client) && (DamagedActor != None) ) 00120 { 00121 DamagedActor.TakeDamage(damage * AccumulatedDamage, instigator, DamagedActor.Location - X * 1.2 * DamagedActor.CollisionRadius, 00122 (MomentumTransfer * X * AccumulatedDamage), MyDamageType); 00123 AccumulatedDamage = 0; 00124 DamagedActor = None; 00125 } 00126 00127 00128 if ( Position >= 9 ) 00129 { 00130 if ( (WallEffect == None) || WallEffect.bDeleteMe ) 00131 WallEffect = Spawn(class'PlasmaCap',,, Location + (BeamSize - 4) * X); 00132 else if ( WallEffect.IsA('PlasmaHit') ) 00133 { 00134 WallEffect.Destroy(); 00135 WallEffect = Spawn(class'PlasmaCap',,, Location + (BeamSize - 4) * X); 00136 } 00137 else 00138 WallEffect.SetLocation(Location + (BeamSize - 4) * X); 00139 } 00140 else 00141 { 00142 if ( WallEffect != None ) 00143 { 00144 WallEffect.Destroy(); 00145 WallEffect = None; 00146 } 00147 if ( PlasmaBeam == None ) 00148 { 00149 PlasmaBeam = Spawn(class'PBolt',,, Location + BeamSize * X); 00150 PlasmaBeam.Position = Position + 1; 00151 } 00152 else 00153 PlasmaBeam.UpdateBeam(self, X, DeltaTime); 00154 } 00155 } 00156 00157 simulated function UpdateBeam(PBolt ParentBolt, vector Dir, float DeltaTime) 00158 { 00159 local actor HitActor; 00160 local vector HitLocation, HitNormal; 00161 00162 SpriteFrame = ParentBolt.SpriteFrame; 00163 Skin = SpriteAnim[SpriteFrame]; 00164 SetLocation(ParentBolt.Location + BeamSize * Dir); 00165 SetRotation(ParentBolt.Rotation); 00166 CheckBeam(Dir, DeltaTime); 00167 } 00168 00169 defaultproperties 00170 { 00171 SpriteAnim(0)=Texture'Botpack.Skins.pbolt0' 00172 SpriteAnim(1)=Texture'Botpack.Skins.pbolt1' 00173 SpriteAnim(2)=Texture'Botpack.Skins.pbolt2' 00174 SpriteAnim(3)=Texture'Botpack.Skins.pbolt3' 00175 SpriteAnim(4)=Texture'Botpack.Skins.pbolt4' 00176 FireOffset=(X=16.000000,Y=-14.000000,Z=-8.000000) 00177 BeamSize=81.000000 00178 bRight=True 00179 MaxSpeed=0.000000 00180 Damage=72.000000 00181 MomentumTransfer=8500 00182 MyDamageType=zapped 00183 ExplosionDecal=Class'Botpack.BoltScorch' 00184 bNetTemporary=False 00185 Physics=PHYS_None 00186 RemoteRole=ROLE_None 00187 LifeSpan=60.000000 00188 AmbientSound=Sound'Botpack.PulseGun.PulseBolt' 00189 Style=STY_Translucent 00190 Texture=Texture'Botpack.Skins.pbolt0' 00191 Skin=Texture'Botpack.Skins.pbolt0' 00192 Mesh=LodMesh'Botpack.PBolt' 00193 bUnlit=True 00194 SoundRadius=12 00195 SoundVolume=255 00196 bCollideActors=False 00197 bCollideWorld=False 00198 }