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

Engine.WeaponPickup


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
// CHANGENOTE:  All changes to this class since v739 are related to the Weapon code updates.

class WeaponPickup extends Pickup
	abstract;

var() bool	  bWeaponStay;


event PostBeginPlay()
{
	Super.PostBeginPlay();
	SetWeaponStay();
	MaxDesireability = 1.2 * class<Weapon>(InventoryType).Default.AIRating;
}

function SetWeaponStay()
{
	bWeaponStay = bWeaponStay || Level.Game.bCoopWeaponMode;
}

// tell the bot how much it wants this weapon pickup
// called when the bot is trying to decide which inventory pickup to go after next
function float BotDesireability( Pawn Bot )
{
	local Weapon AlreadyHas;
	local float desire;

	// bots adjust their desire for their favorite weapons
	desire = MaxDesireability + Bot.Controller.AdjustDesireFor(self);

	// see if bot already has a weapon of this type
	AlreadyHas = Weapon(Bot.FindInventoryType(InventoryType)); 
	if ( AlreadyHas != None )
	{
		if ( (RespawnTime < 10) 
			&& ( bHidden || (AlreadyHas.AmmoType == None) 
				|| (AlreadyHas.AmmoType.AmmoAmount < AlreadyHas.AmmoType.MaxAmmo)) )
			return 0;

		// can't pick it up if weapon stay is on
		if ( bWeaponStay && ((Inventory == None) || Inventory.bTossedOut) )
			return 0;

		// bot wants this weapon for the ammo it holds
//NEW (mdf) fix for weapons which don't have AmmoType or AmmoType.PickupClass (e.g. takkra)
		if ( AlreadyHas.HasAmmo() && AlreadyHas.AmmoType != None && AlreadyHas.AmmoType.PickupClass != None )
		{
/*OLD
		if ( AlreadyHas.HasAmmo() )
*/
			return FMax( 0.25 * desire, 
					AlreadyHas.AmmoType.PickupClass.Default.MaxDesireability
//NEW MJL: fix so the correct percentage calculation is used
					 * FMin(1, 0.15 * AlreadyHas.AmmoType.AmmoAmount/AlreadyHas.AmmoType.MaxAmmo) ); 
/*OLD
					 * FMin(1, 0.15 * AlreadyHas.AmmoType.MaxAmmo/AlreadyHas.AmmoType.AmmoAmount) ); 
*/
		}
		else
			return 0.05;
	}
	
	// incentivize bot to get this weapon if it doesn't have a good weapon already
	if ( (Bot.Weapon == None) || (Bot.Weapon.AIRating <= 0.4) )
		return 2*desire;

	return desire;
}

defaultproperties
{
	MaxDesireability=0.500000
	RespawnTime=30.000000
	PickupMessage="You got a weapon"
	Texture=Texture'Engine.S_Weapon'
     UseReticleOnEvents(0)="UseReticleText"
     UseReticleOnEvents(1)="UseReticleCorners"
     UseReticleOnEvents(2)="UseReticleTopBars"
     ProximityReticleOnEvents(0)="ProximityReticleCorners"
     ProximityReticleOnEvents(1)="ProximityReticleTopBars"
}

Overview Package Class Source Class tree Glossary
previous class      next class frames      no frames
Class file time: sk 3-1-2016 10:38:40.000 - Creation time: sk 3-1-2016 10:48:43.997 - Created with UnCodeX