Core.Object | +--Engine.Actor | +--Engine.Projectile | +--Botpack.TranslocatorTarget
Actor
DesiredTarget
float
DisruptionThreshold
Pawn
Disruptor
TranslocGlow
Glow
class
GlowColor[4]
Translocator
Master
vector
RealLocation
Decal
Shadow
Disruption,
SpawnTime
bAlreadyHit,
bTempDamage
simulated
Destroyed()
bool
Disrupted()
void
DropFrom(vector StartLocation)
Throw(Pawn Thrower, float force, vector StartPosition)
ZoneChange(ZoneInfo NewZone)
EndState()
Touch(Actor Other)
AnimEnd()
00001 //============================================================================= 00002 // TranslocatorTarget. 00003 //============================================================================= 00004 class TranslocatorTarget extends Projectile; 00005 00006 #exec MESH IMPORT MESH=Module ANIVFILE=MODELS\Transobj_a.3D DATAFILE=MODELS\Transobj_d.3D X=0 Y=0 Z=0 UNMIRROR=1 00007 #exec MESH ORIGIN MESH=Module X=0 Y=0 Z=-150 YAW=0 PITCH=0 ROLL=0 00008 #exec MESH SEQUENCE MESH=Module SEQ=All STARTFRAME=0 NUMFRAMES=3 00009 #exec MESH SEQUENCE MESH=Module SEQ=Open STARTFRAME=0 NUMFRAMES=3 00010 #exec TEXTURE IMPORT NAME=tloc2 FILE=MODELS\tran2.PCX GROUP="Skins" LODSET=2 00011 #exec MESHMAP SCALE MESHMAP=Module X=0.028 Y=0.028 Z=0.056 00012 #exec MESHMAP SETTEXTURE MESHMAP=Module NUM=1 TEXTURE=tloc2 00013 00014 #exec AUDIO IMPORT FILE="..\unreali\Sounds\Krall\krasht2.wav" NAME="TDisrupt" GROUP="translocator" 00015 #exec AUDIO IMPORT FILE="Sounds\Pickups\ambhum3.wav" NAME="targethum" GROUP="translocator" 00016 00017 var float Disruption, SpawnTime; 00018 var() float DisruptionThreshold; 00019 var pawn Disruptor; 00020 var translocator Master; 00021 var Actor DesiredTarget; 00022 var bool bAlreadyHit, bTempDamage; 00023 var vector RealLocation; 00024 var TranslocGlow Glow; 00025 var class<TranslocGlow> GlowColor[4]; 00026 var Decal Shadow; 00027 00028 Replication 00029 { 00030 UnReliable if ( Role == ROLE_Authority ) 00031 RealLocation, Glow; 00032 } 00033 00034 simulated function Destroyed() 00035 { 00036 if ( Shadow != None ) 00037 Shadow.Destroy(); 00038 if ( Glow != None ) 00039 Glow.Destroy(); 00040 Super.Destroyed(); 00041 } 00042 00043 function bool Disrupted() 00044 { 00045 return ( Disruption > DisruptionThreshold ); 00046 } 00047 00048 function DropFrom(vector StartLocation) 00049 { 00050 if ( !SetLocation(StartLocation) ) 00051 return; 00052 00053 SetPhysics(PHYS_Falling); 00054 GotoState('PickUp'); 00055 } 00056 00057 simulated singular function ZoneChange( ZoneInfo NewZone ) 00058 { 00059 local float splashsize; 00060 local actor splash; 00061 00062 if( NewZone.bWaterZone ) 00063 { 00064 if( !Region.Zone.bWaterZone && (Velocity.Z < -200) ) 00065 { 00066 // Else play a splash. 00067 splashSize = FClamp(0.0001 * Mass * (250 - 0.5 * FMax(-600,Velocity.Z)), 1.0, 3.0 ); 00068 if( NewZone.EntrySound != None ) 00069 PlaySound(NewZone.EntrySound, SLOT_Interact, splashSize); 00070 if( NewZone.EntryActor != None ) 00071 { 00072 splash = Spawn(NewZone.EntryActor); 00073 if ( splash != None ) 00074 { 00075 splash.DrawScale = splashSize; 00076 splash.RemoteRole = ROLE_None; 00077 } 00078 } 00079 } 00080 } 00081 } 00082 00083 function Throw(Pawn Thrower, float force, vector StartPosition) 00084 { 00085 local vector dir; 00086 00087 dir = vector(Thrower.ViewRotation); 00088 if ( Thrower.IsA('Bot') ) 00089 Velocity = force * dir + vect(0,0,200); 00090 else 00091 { 00092 dir.Z = dir.Z + 0.35 * (1 - Abs(dir.Z)); 00093 Velocity = FMin(force, Master.MaxTossForce) * Normal(dir); 00094 } 00095 bBounce = true; 00096 DropFrom(StartPosition); 00097 } 00098 00099 //////////////////////////////////////////////////////// 00100 auto state Pickup 00101 { 00102 simulated function Timer() 00103 { 00104 local Pawn P; 00105 00106 if ( (Physics == PHYS_None) && (Role != ROLE_Authority) 00107 && (RealLocation != Location) && (RealLocation != vect(0,0,0)) ) 00108 SetLocation(RealLocation); 00109 00110 //disruption effect 00111 if ( Disrupted() ) 00112 { 00113 Spawn(class'Electricity',,,Location + Vect(0,0,6)); 00114 PlaySound(sound'TDisrupt', SLOT_None, 4.0); 00115 } 00116 else 00117 { 00118 // tell local bots about self 00119 for ( P=Level.PawnList; P!=None; P=P.NextPawn ) 00120 if ( P.IsA('Bot') && (P.Weapon != None) && !P.Weapon.bMeleeWeapon 00121 && (!Level.Game.bTeamGame || (P.PlayerReplicationInfo.Team != Pawn(Master.Owner).PlayerReplicationInfo.Team)) ) 00122 { 00123 if ( (VSize(P.Location - Location) < 500) && P.LineOfSightTo(self) ) 00124 { 00125 Bot(P).ShootTarget(self); 00126 break; 00127 } 00128 else if ( P.IsInState('Roaming') && Bot(P).bCamping 00129 && Level.Game.IsA('DeathMatchPlus') && DeathMatchPlus(Level.Game).CheckThisTranslocator(Bot(P), self) ) 00130 { 00131 Bot(P).SetPeripheralVision(); 00132 Bot(P).TweenToRunning(0.1); 00133 Bot(P).bCamping = false; 00134 Bot(P).GotoState('Roaming', 'SpecialNavig'); 00135 break; 00136 } 00137 } 00138 } 00139 AnimEnd(); 00140 SetTimer(1 + 2 * FRand(), false); 00141 } 00142 00143 simulated event Landed( vector HitNormal ) 00144 { 00145 local rotator newRot; 00146 00147 SetTimer(2.5, false); 00148 newRot = Rotation; 00149 newRot.Pitch = 0; 00150 newRot.Roll = 0; 00151 SetRotation(newRot); 00152 PlayAnim('Open',0.1); 00153 if ( Role == ROLE_Authority ) 00154 { 00155 RemoteRole = ROLE_DumbProxy; 00156 RealLocation = Location; 00157 if ( Master.Owner.IsA('Bot') ) 00158 { 00159 if ( Pawn(Master.Owner).Weapon == Master ) 00160 Bot(Master.Owner).SwitchToBestWeapon(); 00161 LifeSpan = 10; 00162 } 00163 Disable('Tick'); 00164 } 00165 } 00166 00167 function AnimEnd() 00168 { 00169 local int glownum; 00170 00171 if ( (Physics != PHYS_None) || (Glow != None) || (Instigator.PlayerReplicationInfo == None) || Disrupted() ) 00172 return; 00173 00174 glownum = Instigator.PlayerReplicationInfo.Team; 00175 if ( glownum > 3 ) 00176 glownum = 0; 00177 00178 Glow = spawn(GlowColor[glownum], self); 00179 } 00180 00181 event TakeDamage( int Damage, Pawn EventInstigator, vector HitLocation, vector Momentum, name DamageType) 00182 { 00183 SetPhysics(PHYS_Falling); 00184 Velocity = Momentum/Mass; 00185 Velocity.Z = FMax(Velocity.Z, 0.7 * VSize(Velocity)); 00186 00187 if ( Level.Game.bTeamGame && (EventInstigator != None) 00188 && (EventInstigator.PlayerReplicationInfo != None) 00189 && (EventInstigator.PlayerReplicationInfo.Team == Instigator.PlayerReplicationInfo.Team) ) 00190 return; 00191 00192 Disruption += Damage; 00193 Disruptor = EventInstigator; 00194 if ( !Disrupted() ) 00195 SetTimer(0.3, false); 00196 else if ( Glow != None ) 00197 Glow.Destroy(); 00198 } 00199 00200 singular function Touch( Actor Other ) 00201 { 00202 local bool bMasterTouch; 00203 local vector NewPos; 00204 00205 if ( !Other.bIsPawn ) 00206 { 00207 if ( (Physics == PHYS_Falling) && !Other.IsA('Inventory') && !Other.IsA('Triggers') && !Other.IsA('NavigationPoint') ) 00208 HitWall(-1 * Normal(Velocity), Other); 00209 return; 00210 } 00211 bMasterTouch = ( Other == Instigator ); 00212 00213 if ( Physics == PHYS_None ) 00214 { 00215 if ( bMasterTouch ) 00216 { 00217 PlaySound(Sound'Botpack.Pickups.AmmoPick',,2.0); 00218 Master.TTarget = None; 00219 Master.bTTargetOut = false; 00220 if ( Other.IsA('PlayerPawn') ) 00221 PlayerPawn(Other).ClientWeaponEvent('TouchTarget'); 00222 destroy(); 00223 } 00224 return; 00225 } 00226 if ( bMasterTouch ) 00227 return; 00228 NewPos = Other.Location; 00229 NewPos.Z = Location.Z; 00230 SetLocation(NewPos); 00231 Velocity = vect(0,0,0); 00232 if ( Level.Game.bTeamGame 00233 && (Instigator.PlayerReplicationInfo.Team == Pawn(Other).PlayerReplicationInfo.Team) ) 00234 return; 00235 00236 if ( Instigator.IsA('Bot') ) 00237 Master.Translocate(); 00238 } 00239 00240 simulated function HitWall (vector HitNormal, actor Wall) 00241 { 00242 if ( bAlreadyHit ) 00243 { 00244 bBounce = false; 00245 return; 00246 } 00247 bAlreadyHit = ( HitNormal.Z > 0.7 ); 00248 PlaySound(ImpactSound, SLOT_Misc); // hit wall sound 00249 Velocity = 0.3*(( Velocity dot HitNormal ) * HitNormal * (-2.0) + Velocity); // Reflect off Wall w/damping 00250 speed = VSize(Velocity); 00251 } 00252 00253 simulated function Tick(float DeltaTime) 00254 { 00255 if ( Level.bHighDetailMode && (Shadow == None) 00256 && (PlayerPawn(Instigator) != None) && (ViewPort(PlayerPawn(Instigator).Player) != None) ) 00257 Shadow = spawn(class'TargetShadow',self,,,rot(16384,0,0)); 00258 00259 if ( Role != ROLE_Authority ) 00260 { 00261 Disable('Tick'); 00262 return; 00263 } 00264 if ( (DesiredTarget == None) || (Master == None) ) 00265 { 00266 Disable('Tick'); 00267 if ( Master.Owner.IsA('Bot') && (Pawn(Master.Owner).Weapon == Master) ) 00268 Bot(Master.Owner).SwitchToBestWeapon(); 00269 return; 00270 } 00271 00272 if ( (Abs(Location.X - DesiredTarget.Location.X) < Master.Owner.CollisionRadius) 00273 && (Abs(Location.Y - DesiredTarget.Location.Y) < Master.Owner.CollisionRadius) ) 00274 { 00275 if ( !FastTrace(DesiredTarget.Location, Location) ) 00276 return; 00277 00278 Pawn(Master.Owner).StopWaiting(); 00279 Master.Translocate(); 00280 if ( Master.Owner.IsA('Bot') && (Pawn(Master.Owner).Weapon == Master) ) 00281 Bot(Master.Owner).SwitchToBestWeapon(); 00282 Disable('Tick'); 00283 } 00284 } 00285 00286 simulated function BeginState() 00287 { 00288 SpawnTime = Level.TimeSeconds; 00289 TweenAnim('Open', 0.1); 00290 } 00291 00292 function EndState() 00293 { 00294 DesiredTarget = None; 00295 if ( (Master != None) && (Master.Owner != None) 00296 && Master.Owner.IsA('Bot') && (Pawn(Master.Owner).Weapon == Master) ) 00297 Bot(Master.Owner).SwitchToBestWeapon(); 00298 } 00299 } 00300 00301 defaultproperties 00302 { 00303 DisruptionThreshold=65.000000 00304 GlowColor(0)=Class'Botpack.TranslocGlow' 00305 GlowColor(1)=Class'Botpack.TranslocBLue' 00306 GlowColor(2)=Class'Botpack.TranslocGreen' 00307 GlowColor(3)=Class'Botpack.TranslocGold' 00308 ImpactSound=Sound'UnrealShare.Eightball.GrenadeFloor' 00309 bNetTemporary=False 00310 RemoteRole=ROLE_SimulatedProxy 00311 LifeSpan=0.000000 00312 AmbientSound=Sound'Botpack.Translocator.targethum' 00313 Mesh=LodMesh'Botpack.Module' 00314 SoundRadius=20 00315 SoundVolume=100 00316 CollisionRadius=10.000000 00317 CollisionHeight=3.000000 00318 bProjTarget=True 00319 bBounce=True 00320 Mass=50.000000 00321 }