Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames

UTGame.UTProj_AvrilRocketBase


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
/**
 * Copyright 1998-2008 Epic Games, Inc. All Rights Reserved.
 */
class UTProj_AvrilRocketBase extends UTProjectile
	native;

/** Holds the vehicle this rocket is locked on to.  The vehicle will give us our Homing Target */
var Actor LockedTarget;

/** Holds a pointer back to the firing Avril - Only valid server side */
var UTWeap_Avril MyWeapon;
/** the AVRiL that is currently controlling the target lock (could be different if MyWeapon has no target) */
var UTWeap_Avril LockingWeapon;

/** Set to true if the lock for this rocket has been redirected */
var bool bRedirectedLock;

/** The last time a lock message was sent */
var float	LastLockWarningTime;

/** How long before re-sending the next Lock On message update */
var float	LockWarningInterval;

var float InitialPostRenderTime;

var Texture2D BeaconTexture;

/** Extended radius for raptor bolts destroying this avril */
var float RaptorBoltExtendedRadius;

// (cpptext)
// (cpptext)
// (cpptext)
// (cpptext)

replication
{
	if (bNetDirty && ROLE == ROLE_Authority)
		LockedTarget;
}

simulated event Destroyed()
{
	local PlayerController PC;

	if (Role==ROLE_Authority)
	{
		// Notify the launcher I'm dead
		if ( MyWeapon != None )
			MyWeapon.RocketDestroyed(self);
	}

	// remove from local HUD's post-rendered list
	ForEach LocalPlayerControllers(class'PlayerController', PC)
	{
		if ( UTHUD(PC.MyHUD) != None )
		{
			UTHUD(PC.MyHUD).RemovePostRenderedActor(self);
		}
	}

	super.Destroyed();
}

simulated function PostBeginPlay()
{
	local PlayerController PC;

	super.PostBeginPlay();

	// add to local HUD's post-rendered list
	ForEach LocalPlayerControllers(class'PlayerController', PC)
	{
		if ( UTHUD(PC.MyHUD) != None )
		{
			UTHUD(PC.MyHUD).AddPostRenderedActor(self);
		}
	}
}

function ForceLock(Actor ForcedLock)
{
	LockedTarget = ForcedLock;
// don't get any more target updates from weapon.
	MyWeapon.RocketDestroyed(self);
	if ( (UTVehicle_SPMA(ForcedLock) != None) && (PlayerController(InstigatorController) != None) )
		PlayerController(InstigatorController).ReceiveLocalizedMessage(class'UTLockWarningMessage', 3);
}

/**
 * Clean up
 */
simulated function Shutdown()
{
	local PlayerController PC;

	if (Role==ROLE_Authority)
	{
		// Notify the launcher I'm dead
		if ( MyWeapon != None )
		{
			MyWeapon.RocketDestroyed(self);
			MyWeapon = None;
		}
	}

	// remove from local HUD's post-rendered list
	ForEach LocalPlayerControllers(class'PlayerController', PC)
	{
		if ( UTHUD(PC.MyHUD) != None )
		{
			UTHUD(PC.MyHUD).RemovePostRenderedActor(self);
		}
	}
	Super.ShutDown();

	SetTimer(0.0,false);
}

/** sets the target we're locked on to. May fail (return false) if NewLockOwner isn't allowed to control me */
function bool SetTarget(Actor NewTarget, UTWeap_Avril NewLockOwner)
{
	// follow the lock if it's the shooter's target or the shooter doesn't have a target and a friendly player is giving one
	// short delay before accepting other players' targets to avoid rocket twisting through shooter's body, etc
	if ( NewLockOwner == MyWeapon ||
		( (LockingWeapon == None || LockingWeapon == NewLockOwner) && WorldInfo.TimeSeconds - CreationTime > 2.0 &&
			WorldInfo.GRI.OnSameTeam(NewLockOwner.Instigator, InstigatorController) ) )
	{
		LockedTarget = NewTarget;
		LockingWeapon = (LockedTarget != None) ? NewLockOwner : None;
		return true;
	}
	else
	{
		return false;
	}
}

event TakeDamage(int DamageAmount, Controller EventInstigator, vector HitLocation, vector Momentum, class<DamageType> DamageType, optional TraceHitInfo HitInfo, optional Actor DamageCauser)
{
	if (Damage > 0 && (InstigatorController == None || !WorldInfo.GRI.OnSameTeam(EventInstigator, InstigatorController)))
	{
		Explode(HitLocation, vect(0,0,0));
	}
}

simulated native function NativePostRenderFor(PlayerController PC, Canvas Canvas, vector CameraPosition, vector CameraDir);

/**
 * PostRenderFor() Hook to allow pawns to render HUD overlays for themselves.
 * Assumes that appropriate font has already been set
 *
 * @param	PC		The Player Controller who is rendering this pawn
 * @param	Canvas	The canvas to draw on
 */
simulated event PostRenderFor(PlayerController PC, Canvas Canvas, vector CameraPosition, vector CameraDir)
{
	local vector ScreenLoc;
	local float CrossScaler, CrossScaleTime;
	local LinearColor TeamColor;
	local color c;
	local float ResScale, XStart, XLen, YStart, YLen, OldY;
	local float width,height;

	screenLoc = Canvas.Project(Location);

	class'UTHud'.static.GetTeamColor( 1 - PC.GetTeamNum(), TeamColor, c);
	CrossScaleTime = FMax(0.05,(1 - 3*(WorldInfo.TimeSeconds - InitialPostRenderTime)));
	TeamColor.A = 0.8 - CrossScaleTime;

	ResScale = Canvas.ClipX / 1024;

	if ( InitialPostRenderTime == 0.0 )
	{
		InitialPostRenderTime = WorldInfo.TimeSeconds;
	}
	CrossScaler = CrossScaleTime * Canvas.ClipX;
	width = ResScale * CrossScaler;
	height = ResScale * CrossScaler;
	XStart = 662;
	YStart = 260;
	XLen = 56;
	YLen = 56;

	// if clipped out, draw offscreen indicator
	if (screenLoc.X < 0 ||
		screenLoc.X >= Canvas.ClipX ||
		screenLoc.Y < 0 ||
		screenLoc.Y >= Canvas.ClipY)
	{
		OldY = screenLoc.Y;
		screenLoc.X = FClamp(ScreenLoc.X, 0, Canvas.ClipX-1);
		screenLoc.Y = FClamp(ScreenLoc.Y, 0, Canvas.ClipY-1);
		if ( screenLoc.Y != OldY)
		{
			// draw up/down arrow
			YLen = 28;
			if ( screenLoc.Y == 0 )
			{
				YStart += YLen;
			}
		}
		else
		{
			// draw horizontal arrow
			XLen = 28;
			if ( screenLoc.X == 0 )
			{
				XStart += XLen;
			}
		}
	}

	Canvas.SetPos(ScreenLoc.X - width * 0.5, ScreenLoc.Y - height * 0.5);
	Canvas.DrawColorizedTile(BeaconTexture, width, height, XStart, YStart, XLen, YLen, TeamColor);
}

defaultproperties
{
   BeaconTexture=Texture2D'UI_HUD.HUD.UI_HUD_BaseA'
   RaptorBoltExtendedRadius=80.000000
   Begin Object Class=CylinderComponent Name=CollisionCylinder ObjName=CollisionCylinder Archetype=CylinderComponent'UTGame.Default__UTProjectile:CollisionCylinder'
      ObjectArchetype=CylinderComponent'UTGame.Default__UTProjectile:CollisionCylinder'
   End Object
   CylinderComponent=CollisionCylinder
   Components(0)=CollisionCylinder
   CollisionComponent=CollisionCylinder
   Name="Default__UTProj_AvrilRocketBase"
   ObjectArchetype=UTProjectile'UTGame.Default__UTProjectile'
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: tr 31-1-2018 17:18:22.000 - Creation time: sk 18-3-2018 10:01:23.906 - Created with UnCodeX