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

UTGameContent.UTWeap_BioRifle_Content


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
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382
00383
00384
00385
00386
00387
00388
00389
00390
00391
00392
00393
00394
00395
00396
00397
00398
00399
00400
00401
00402
00403
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415
00416
00417
00418
00419
00420
00421
00422
00423
00424
00425
00426
00427
00428
00429
00430
00431
00432
00433
00434
00435
00436
00437
00438
00439
00440
00441
00442
00443
00444
00445
00446
00447
00448
00449
00450
00451
00452
00453
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463
00464
/**
 * Copyright 1998-2007 Epic Games, Inc. All Rights Reserved.
 */
class UTWeap_BioRifle_Content extends UTWeapon;

/** maximum number of globs we can load for one shot */
var int MaxGlobStrength;

var int GlobStrength;

var SoundCue WeaponLoadSnd;

var float AdditionalCoolDownTime;
var float CoolDownTime;

/** Array of all the animations for the various primary fires*/
var array<name> PrimaryFireAnims; // special case for Bio; if this needs to be promoted perhaps an array of arrays?

/** arm animations corresponding to above*/
var array<name> PrimaryArmAnims;

/** the primary fire animation currently playing */
var int CurrentFireAnim;

var ParticleSystemComponent ChargingSystem;
var name WeaponChargeAnim;
var name ArmsChargeAnim;

simulated function PostBeginPlay()
{
	super.PostBeginPlay();
	SkeletalMeshComponent(Mesh).AttachComponentToSocket(ChargingSystem,MuzzleFlashSocket);
}
/*********************************************************************************************
 * Hud/Crosshairs
 *********************************************************************************************/

simulated event float GetPowerPerc()
{
	return 0.0;
}

/**
 * GetAdjustedAim begins a chain of function class that allows the weapon, the pawn and the controller to make
 * on the fly adjustments to where this weapon is pointing.
 */
simulated function Rotator GetAdjustedAim( vector StartFireLoc )
{
	local rotator R;

	// Start the chain, see Pawn.GetAdjustedAimFor()
	if( Instigator != None )
	{
		R = Instigator.GetAdjustedAimFor( Self, StartFireLoc );

		if ( PlayerController(Instigator.Controller) != None )
		{
			R.Pitch = R.Pitch & 65535;
			if ( R.Pitch < 16384 )
			{
				R.Pitch += (16384 - R.Pitch)/16;
			}
			else if ( R.Pitch > 49152 )
			{
				R.Pitch += 1024;
			}
		}
	}

	return R;
}

/**
 * Take the projectile spawned and if it's the proper type, adjust it's strength and speed
 */
simulated function Projectile ProjectileFire()
{
	local Projectile SpawnedProjectile;

	SpawnedProjectile = super.ProjectileFire();
	if ( UTProj_BioGlob(SpawnedProjectile) != None )
	{
		UTProj_BioGlob(SpawnedProjectile).InitBio(self, GlobStrength);
	}

	return SpawnedProjectile;
}

/**
 * Tells the weapon to play a firing sound (uses CurrentFireMode)
 */
simulated function PlayFiringSound()
{
	if (CurrentFireMode<WeaponFireSnd.Length)
	{
		// play weapon fire sound
		if ( WeaponFireSnd[CurrentFireMode] != None )
		{
			MakeNoise(1.0);
			if(CurrentFireMode == 1 && GetPowerPerc() > 0.75)
			{
				WeaponPlaySound( WeaponFireSnd[2] );
			}
			else
			{
				WeaponPlaySound( WeaponFireSnd[CurrentFireMode] );
			}
		}
	}
}
/*********************************************************************************************
 * State WeaponLoadAmmo
 * In this state, ammo will continue to load up until MAXLOADCOUNT has been reached.  It's
 * similar to the firing state
 *********************************************************************************************/

simulated state WeaponLoadAmmo
{
	simulated function WeaponEmpty();

	simulated event float GetPowerPerc()
	{
		local float p;
		p = float(GlobStrength) / float(MaxGlobStrength);
		p = FClamp(p,0.0,1.0);

		return p;
	}

	simulated function bool TryPutdown()
	{
		bWeaponPutDown = true;
		return true;
	}

	/**
	 * Adds a rocket to the count and uses up some ammo.  In Addition, it plays
	 * a sound so that other pawns in the world can here it.
	 */
	simulated function IncreaseGlobStrength()
	{
		if (GlobStrength < MaxGlobStrength && HasAmmo(CurrentFireMode))
		{
			// Add the glob
			GlobStrength++;
			ConsumeAmmo(CurrentFireMode);
		}
	}

	function bool IsFullyCharged()
	{
		return (GlobStrength >= MaxGlobStrength);
	}

	/**
	 * Fire off a shot w/ effects
	 */
	simulated function WeaponFireLoad()
	{
		ProjectileFire();
		PlayFiringSound();
		InvManager.OwnerEvent('FiredWeapon');
	}

	/**
	 * This is the timer event for each shot
	 */
	simulated event RefireCheckTimer()
	{
		IncreaseGlobStrength();
	}

	simulated function SendToFiringState( byte FireModeNum )
	{
		return;
	}


	/**
	 * We need to override EndFire so that we can correctly fire off the
	 * current load if we have any.
	 */
	simulated function EndFire(byte FireModeNum)
	{
		Global.EndFire(FireModeNum);

		if (FireModeNum == CurrentFireMode)
		{
			// Fire the load
			ChargingSystem.DeactivateSystem();

			WeaponFireLoad();

			// Cool Down
			AdditionalCoolDownTime = GetTimerRate('RefireCheckTimer') - GetTimerCount('RefireCheckTimer');
			GotoState('WeaponCoolDown');
		}
	}

	/**
	 * Initialize the loadup
	 */
	simulated function BeginState(Name PreviousStateName)
	{
		local UTPawn POwner;
		local UTAttachment_BioRifle ABio;

		GlobStrength = 0;

		super.BeginState(PreviousStateName);

		POwner = UTPawn(Instigator);
		if (POwner != None)
		{
			POwner.SetWeaponAmbientSound(WeaponLoadSnd);
			ABio = UTAttachment_BioRifle(POwner.CurrentWeaponAttachment);
			if(ABio != none)
			{
				ABio.StartCharging();
			}
		}
		ChargingSystem.ActivateSystem();
		PlayWeaponAnimation( WeaponChargeAnim, MaxGlobStrength*FireInterval[1], false);
		PlayArmAnimation(ArmsChargeAnim, MaxGlobStrength*FireInterval[1],false);
	}

	/**
	 * Insure that the GlobStrength is 1 when we leave this state
	 */
	simulated function EndState(Name NextStateName)
	{
		local UTPawn POwner;

		Cleartimer('RefireCheckTimer');

		GlobStrength = 1;

		POwner = UTPawn(Instigator);
		if (POwner != None)
		{
			POwner.SetWeaponAmbientSound(None);
			POwner.SetFiringMode(0); // return to base fire mode for network anims
		}
		ChargingSystem.DeactivateSystem();

		Super.EndState(NextStateName);
	}

	simulated function bool IsFiring()
	{
		return true;
	}

	/**
	 * This determines whether or not the Weapon can have ViewAcceleration when Firing.
	 *
	 * When you are FULLY charged up and running around the level looking for someone to Glob,
	 * you need to be able to view accelerate
	 **/
	simulated function bool CanViewAccelerationWhenFiring()
	{
		return( GlobStrength == MaxGlobStrength );
	};


Begin:
	IncreaseGlobStrength();
	TimeWeaponFiring(CurrentFireMode);

}

simulated function PlayFireEffects( byte FireModeNum, optional vector HitLocation )
{
	if(FireModeNum == 0)
	{
		CurrentFireAnim = (CurrentFireAnim+1)%(PrimaryFireAnims.Length);
		WeaponFireAnim[0] = PrimaryFireAnims[CurrentFireAnim];
		ArmFireAnim[0] = PrimaryArmAnims[CurrentFireAnim];
	}
	super.PlayFireEffects(FireModeNum,HitLocation);
}

simulated state WeaponCoolDown
{
	simulated function WeaponCooled()
	{
		GotoState('Active');
	}

	simulated function EndState(name NextStateName)
	{
		ClearFlashCount();
		ClearFlashLocation();

		ClearTimer('WeaponCooled');
		super.EndState(NextStateName);
	}

begin:
	SetTimer(CoolDownTime + AdditionalCoolDownTime,false,'WeaponCooled');
}

simulated function WeaponCooled()
{
	LogInternal("BioRifle: Weapon Cooled outside WeaponCoolDown, is in"@GetStateName());
}

// AI Interface
function float GetAIRating()
{
	local UTBot B;
	local float EnemyDist;
	local vector EnemyDir;

	B = UTBot(Instigator.Controller);
	if ( (B == None) || (B.Enemy == None) )
		return AIRating;

	// if retreating, favor this weapon
	EnemyDir = B.Enemy.Location - Instigator.Location;
	EnemyDist = VSize(EnemyDir);
	if ( EnemyDist > 1500 )
		return 0.1;
	if ( B.IsRetreating() )
		return (AIRating + 0.4);
	if ( (B.Enemy.Weapon != None) && B.Enemy.Weapon.bMeleeWeapon )
		return (AIRating + 0.35);
	if ( -1 * EnemyDir.Z > EnemyDist )
		return AIRating + 0.1;
	if ( EnemyDist > 1000 )
		return 0.35;
	return AIRating;
}

/* BestMode()
choose between regular or alt-fire
*/
function byte BestMode()
{
	if ( FRand() < 0.8 )
		return 0;
	return 1;
}

function float SuggestAttackStyle()
{
	local UTBot B;
	local float EnemyDist;

	B = UTBot(Instigator.Controller);
	if ( (B == None) || (B.Enemy == None) )
		return 0.4;

	EnemyDist = VSize(B.Enemy.Location - Instigator.Location);
	if ( EnemyDist > 1500 )
		return 1.0;
	if ( EnemyDist > 1000 )
		return 0.4;
	return -0.4;
}

function float SuggestDefenseStyle()
{
	local UTBot B;

	B = UTBot(Instigator.Controller);
	if ( (B == None) || (B.Enemy == None) )
		return 0;

	if ( VSize(B.Enemy.Location - Instigator.Location) < 1600 )
		return -0.6;
	return 0;
}

defaultproperties
{
   MaxGlobStrength=10
   GlobStrength=1
   WeaponLoadSnd=SoundCue'A_Weapon_BioRifle.Weapon.A_BioRifle_FireAltChamber_Cue'
   CoolDowntime=0.330000
   PrimaryFireAnims(0)="WeaponFire1"
   PrimaryFireAnims(1)="WeaponFire2"
   PrimaryFireAnims(2)="WeaponFire3"
   PrimaryArmAnims(0)="WeaponFire1"
   PrimaryArmAnims(1)="WeaponFire2"
   PrimaryArmAnims(2)="WeaponFire3"
   Begin Object Class=ParticleSystemComponent Name=ChargePart ObjName=ChargePart Archetype=ParticleSystemComponent'Engine.Default__ParticleSystemComponent'
      Template=ParticleSystem'WP_BioRifle.Particles.P_WP_Bio_Alt_MF'
      bAutoActivate=False
      DepthPriorityGroup=SDPG_Foreground
      Name="ChargePart"
      ObjectArchetype=ParticleSystemComponent'Engine.Default__ParticleSystemComponent'
   End Object
   ChargingSystem=ChargePart
   WeaponChargeAnim="WeaponAltCharge"
   ArmsChargeAnim="WeaponAltCharge"
   AmmoCount=25
   LockerAmmoCount=50
   MaxAmmoCount=50
   IconX=382
   IconY=82
   IconWidth=27
   IconHeight=42
   IconCoordinates=(V=399.000000,UL=128.000000,VL=62.000000)
   CrossHairCoordinates=(V=0.000000)
   InventoryGroup=3
   AttachmentClass=Class'UTGame.UTAttachment_BioRifle'
   GroupWeight=0.510000
   QuickPickGroup=1
   QuickPickWeight=0.800000
   WeaponFireAnim(0)="WeaponFire1"
   WeaponFireAnim(1)="WeaponAltFire"
   ArmFireAnim(0)="WeaponFire1"
   ArmFireAnim(1)="WeaponAltFire"
   ArmsAnimSet=AnimSet'WP_BioRifle.Anims.K_WP_BioRifle_Arms'
   WeaponFireSnd(0)=SoundCue'A_Weapon_BioRifle.Weapon.A_BioRifle_FireMain_Cue'
   WeaponFireSnd(1)=SoundCue'A_Weapon_BioRifle.Weapon.A_BioRifle_FireAltLarge_Cue'
   WeaponFireSnd(2)=SoundCue'A_Weapon_BioRifle.Weapon.A_BioRifle_FireAltSmall_Cue'
   WeaponPutDownSnd=SoundCue'A_Weapon_BioRifle.Weapon.A_BioRifle_Lower_Cue'
   WeaponEquipSnd=SoundCue'A_Weapon_BioRifle.Weapon.A_BioRifle_Raise_Cue'
   WeaponColor=(B=64,G=255,R=64,A=255)
   MuzzleFlashSocket="Bio_MF"
   MuzzleFlashPSCTemplate=ParticleSystem'WP_BioRifle.Particles.P_WP_Bio_MF'
   PlayerViewOffset=(X=-1.000000,Y=-2.000000,Z=0.000000)
   LockerRotation=(Pitch=0,Yaw=0,Roll=-16384)
   CurrentRating=0.550000
   WeaponFireTypes(0)=EWFT_Projectile
   FiringStatesArray(1)="WeaponLoadAmmo"
   WeaponProjectiles(0)=Class'UTGameContent.UTProj_BioShot'
   WeaponProjectiles(1)=Class'UTGameContent.UTProj_BioGlob'
   FireInterval(0)=0.350000
   FireInterval(1)=0.350000
   EquipTime=0.800000
   FireOffset=(X=19.000000,Y=10.000000,Z=-10.000000)
   Begin Object Class=UTSkeletalMeshComponent Name=FirstPersonMesh ObjName=FirstPersonMesh Archetype=UTSkeletalMeshComponent'UTGame.Default__UTWeapon:FirstPersonMesh'
      FOV=60.000000
      SkeletalMesh=SkeletalMesh'WP_BioRifle.Mesh.SK_WP_BioRifle_1P'
      Begin Object Class=AnimNodeSequence Name=MeshSequenceA ObjName=MeshSequenceA Archetype=AnimNodeSequence'Engine.Default__AnimNodeSequence'
         Name="MeshSequenceA"
         ObjectArchetype=AnimNodeSequence'Engine.Default__AnimNodeSequence'
      End Object
      Animations=AnimNodeSequence'UTGameContent.Default__UTWeap_BioRifle_Content:MeshSequenceA'
      AnimSets(0)=AnimSet'WP_BioRifle.Anims.K_WP_BioRifle_Base'
      ObjectArchetype=UTSkeletalMeshComponent'UTGame.Default__UTWeapon:FirstPersonMesh'
   End Object
   Mesh=FirstPersonMesh
   Priority=3.100000
   AIRating=0.550000
   ItemName="Bio Rifle"
   MaxDesireability=0.750000
   PickupMessage="Bio Rifle"
   PickupSound=SoundCue'A_Pickups.Weapons.Cue.A_Pickup_Weapons_CGBio_Cue'
   Begin Object Class=SkeletalMeshComponent Name=PickupMesh ObjName=PickupMesh Archetype=SkeletalMeshComponent'UTGame.Default__UTWeapon:PickupMesh'
      SkeletalMesh=SkeletalMesh'WP_BioRifle.Mesh.SK_WP_BioRifle_3P_Mid'
      ObjectArchetype=SkeletalMeshComponent'UTGame.Default__UTWeapon:PickupMesh'
   End Object
   DroppedPickupMesh=PickupMesh
   PickupFactoryMesh=PickupMesh
   Components(0)=ChargePart
   DrawScale3D=(X=1.000000,Y=1.050000,Z=1.000000)
   Name="Default__UTWeap_BioRifle_Content"
   ObjectArchetype=UTWeapon'UTGame.Default__UTWeapon'
}

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