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

UTGameContent.UTVWeap_LeviathanPrimary


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
/**
 * Copyright 1998-2007 Epic Games, Inc. All Rights Reserved.
 */

class UTVWeap_LeviathanPrimary extends UTVehicleWeapon
	HideDropDown;

/** the amount of time the same target must be kept for the shot to go off */
var float PaintTime;

/** How long after the shot does it take to recharge (should be the time of the effect) */
var float RechargeTime;

/** units/sec player can move their aim and not reset the paint timer */
var float TargetSlack;
/** current target location */
var vector TargetLocation;
/** Ambient sound played while acquiring the target */
var SoundCue AcquireSound;

reliable server function ServerStartFire(byte FireModeNum)
{
	local UTVehicle_Leviathan MyLevi;

	// can't fire while deploying in progress
	MyLevi = UTVehicle_Leviathan(MyVehicle);
	if (MyLevi == None || MyLevi.DeployedState != EDS_Deploying)
	{
		Super.ServerStartFire(FireModeNum);
	}
	else
	{
		ClientEndFire(FireModeNum);
	}
}

simulated function SendToFiringState( byte FireModeNum )
{
	local UTVehicle_Leviathan MyLevi;

	// make sure fire mode is valid
	if( FireModeNum >= FiringStatesArray.Length )
	{
		WeaponLog("Invalid FireModeNum", "Weapon::SendToFiringState");
		return;
	}

	// Ignore a none fire type
	if( WeaponFireTypes[FireModeNum] == EWFT_None )
	{
		return;
	}

	MyLevi = UTVehicle_Leviathan(MyVehicle);
	if (MyLevi != none)
	{
		// set current fire mode
		SetCurrentFireMode(FireModeNum);

		if ( MyLevi.DeployedState == EDS_Undeployed )
		{
			GotoState('WeaponFiring');
		}
		else if (MyLevi.DeployedState == EDS_Deployed )
		{
			GotoState('WeaponBeamFiring');
		}
	}
}

reliable client function ClientHasFired()
{
	GotoState('WeaponRecharge');
}

simulated state WeaponBeamFiring
{
	simulated function BeginState( Name PreviousStateName )
	{
		Super.BeginState(PreviousStateName);

		if (Role == ROLE_Authority)
		{
			SetTimer(PaintTime,false,'FireWeapon');
		}

		InstantFire();
	}

	function FireWeapon()
	{
		local UTEmit_LeviathanExplosion Blast;
		local actor HitActor;
		local vector HitLocation, HitNormal, SpawnLoc;

		HitActor = Trace(HitLocation, HitNormal, TargetLocation + Vect(0,0,64), TargetLocation, false);
		SpawnLoc = (HitActor == None) ? TargetLocation + Vect(0,0,32) : 0.5 * (TargetLocation + HitLocation);
		Blast = Spawn(class'UTEmit_LeviathanExplosion', Instigator,, SpawnLoc);
		Blast.InstigatorController = Instigator.Controller;

		if ( !Instigator.IsLocallyControlled() )
		{
			ClientHasFired();
		}
		GotoState('WeaponRecharge');
	}

	/**
	 * When leaving the state, shut everything down
	 */
	simulated function EndState(Name NextStateName)
	{
		ClearTimer('FireWeapon');
		Super.EndState(NextStateName);
	}

	simulated function bool IsFiring()
	{
		return true;
	}

	simulated function SetFlashLocation(vector HitLocation)
	{
		if (ROLE == ROLE_Authority)
		{
			Global.SetFlashLocation(HitLocation);
			TargetLocation = HitLocation;
		}
	}
}

simulated state WeaponRecharge
{
	simulated function BeginState( Name PreviousStateName )
	{
		Super.BeginState(PreviousStateName);
		SetTimer(RechargeTime,false,'Charged');
		TimeWeaponFiring(0);
	}

	simulated function EndState(Name NextStateName)
	{
		ClearTimer('RefireCheckTimer');
		ClearFlashLocation();
		Super.EndState(NextStateName);
	}

	simulated function bool IsFiring()
	{
		return true;
	}

	simulated function Charged()
	{
		GotoState('Active');
	}
}

simulated function Projectile ProjectileFire()
{
	local vector ActualStart,ActualEnd, HitLocation, HitNormal;
	local UTProj_LeviathanBolt Bolt;

	Bolt = UTProj_LeviathanBolt( super.ProjectileFire() );

	if (Bolt != none)
	{
		ActualStart = Instigator.GetWeaponStartTraceLocation();
		ActualEnd = ActualStart + vector(GetAdjustedAim(ActualStart)) * GetTraceRange();

		if ( Trace(HitLocation,HitNormal, ActualEnd, ActualStart) != none )
		{
			ActualEnd = HitLocation;
		}

		Bolt.TargetLoc = ActualEnd;
	}
	return Bolt;
}

simulated function float GetMaxFinalAimAdjustment()
{
	local UTVehicle_Leviathan MyLevi;

	MyLevi = UTVehicle_Leviathan(MyVehicle);
	if ( MyLevi != none && MyLevi.DeployedState == EDS_Deployed )
	{
		return 0.998;
	}
	else
	{
		return Super.GetMaxFinalAimAdjustment();
	}
}

function bool CanAttack(Actor Other)
{
	local bool bResult;

	bResult = Super.CanAttack(Other);
	// if deployed bot is trying to shoot enemy and can't hit it but can hit where enemy was recently, allow it to shoot anyway
	// (big nuke might still hit from there)
	if ( !bResult && UTVehicle_Deployable(MyVehicle) != None && UTVehicle_Deployable(MyVehicle).IsDeployed() &&
		UTBot(Instigator.Controller) != None && Other == Instigator.Controller.Enemy &&
		FastTrace(UTBot(Instigator.Controller).LastSeenPos, InstantFireStartTrace()) )
	{
		bResult = true;
	}

	return bResult;
}

simulated function NotifyVehicleDeployed()
{
	bInstantHit = true;
	AimTraceRange = MaxRange();
	bFastRepeater = false;
	bRecommendSplashDamage = true;
	bLockedAimWhileFiring = true;
}

simulated function NotifyVehicleUndeployed()
{
	bInstantHit = false;
	AimTraceRange = MaxRange();
	bFastRepeater = true;
	bRecommendSplashDamage = false;
	bLockedAimWhileFiring = false;
}

defaultproperties
{
   PaintTime=2.000000
   RechargeTime=3.000000
   TargetSlack=50.000000
   FireTriggerTags(0)="DriverMF_L"
   FireTriggerTags(1)="DriverMF_R"
   VehicleClass=Class'UTGameContent.UTVehicle_Leviathan_Content'
   bCanDestroyBarricades=True
   bFastRepeater=True
   bZoomedFireMode(0)=0
   bZoomedFireMode(1)=1
   ZoomedTargetFOV=20.000000
   ZoomedRate=60.000000
   WeaponFireSnd(0)=SoundCue'A_Vehicle_leviathan.SoundCues.A_Vehicle_Leviathan_TurretFire'
   WeaponFireTypes(0)=EWFT_Projectile
   WeaponFireTypes(1)=EWFT_None
   WeaponProjectiles(0)=Class'UTGameContent.UTProj_LeviathanBolt'
   FireInterval(0)=0.300000
   Spread(0)=0.015000
   Begin Object Class=UTSkeletalMeshComponent Name=FirstPersonMesh ObjName=FirstPersonMesh Archetype=UTSkeletalMeshComponent'UTGame.Default__UTVehicleWeapon:FirstPersonMesh'
      ObjectArchetype=UTSkeletalMeshComponent'UTGame.Default__UTVehicleWeapon:FirstPersonMesh'
   End Object
   Mesh=FirstPersonMesh
   ItemName="Leviathan"
   Begin Object Class=SkeletalMeshComponent Name=PickupMesh ObjName=PickupMesh Archetype=SkeletalMeshComponent'UTGame.Default__UTVehicleWeapon:PickupMesh'
      ObjectArchetype=SkeletalMeshComponent'UTGame.Default__UTVehicleWeapon:PickupMesh'
   End Object
   DroppedPickupMesh=PickupMesh
   PickupFactoryMesh=PickupMesh
   Name="Default__UTVWeap_LeviathanPrimary"
   ObjectArchetype=UTVehicleWeapon'UTGame.Default__UTVehicleWeapon'
}

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