Engine
Class WeaponPickup

source: C:\XIII\Engine\Classes\WeaponPickup.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Pickup
         |
         +--Engine.WeaponPickup
Direct Known Subclasses:XIIIWeaponPickup, XIIIMPBombPick

class WeaponPickup
extends Engine.Pickup

// CHANGENOTE: All changes to this class since v739 are related to the Weapon code updates.
Variables
 bool bWeaponStay


Function Summary
 float BotDesireability(Pawn Bot)
     
// 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
 
simulated
PostBeginPlay()
     
//_____________________________________________________________________________
 void SetWeaponStay()



Source Code


00001	// CHANGENOTE:  All changes to this class since v739 are related to the Weapon code updates.
00002	
00003	class WeaponPickup extends Pickup
00004		abstract;
00005	
00006	var() bool	  bWeaponStay;
00007	
00008	//_____________________________________________________________________________
00009	event ParseDynamicLoading(LevelInfo MyLI)
00010	{
00011	    Log("ParseDynamicLoading Actor="$self);
00012	    class<Weapon>(default.InventoryType).Static.StaticParseDynamicLoading(MyLI);
00013	//    MyLI.ForcedMeshes[MyLI.ForcedMeshes.Length] = mesh(DynamicLoadObject(class<Weapon>(default.InventoryType).default.MeshName, class'mesh'));
00014	}
00015	
00016	//_____________________________________________________________________________
00017	simulated function PostBeginPlay()
00018	{
00019	    Super.PostBeginPlay();
00020	    SetWeaponStay();
00021	    MaxDesireability = 1.2 * class<Weapon>(InventoryType).Default.AIRating;
00022	}
00023	
00024	function SetWeaponStay()
00025	{
00026		bWeaponStay = bWeaponStay || Level.Game.bCoopWeaponMode;
00027	}
00028	
00029	// tell the bot how much it wants this weapon pickup
00030	// called when the bot is trying to decide which inventory pickup to go after next
00031	function float BotDesireability(Pawn Bot)
00032	{
00033		local Weapon AlreadyHas;
00034		local float desire;
00035	
00036		// bots adjust their desire for their favorite weapons
00037		desire = MaxDesireability + Bot.Controller.AdjustDesireFor(self);
00038	
00039		// see if bot already has a weapon of this type
00040		AlreadyHas = Weapon(Bot.FindInventoryType(InventoryType));
00041		if ( AlreadyHas != None )
00042		{
00043			if ( (RespawnTime < 10)
00044				&& ( bHidden || (AlreadyHas.AmmoType == None)
00045					|| (AlreadyHas.AmmoType.AmmoAmount < AlreadyHas.AmmoType.MaxAmmo)) )
00046				return 0;
00047	
00048			// can't pick it up if weapon stay is on
00049			if ( bWeaponStay && ((Inventory == None) || Inventory.bTossedOut) )
00050				return 0;
00051	
00052			// bot wants this weapon for the ammo it holds
00053			if ( AlreadyHas.HasAmmo() )
00054				return FMax( 0.25 * desire,
00055						AlreadyHas.AmmoType.PickupClass.Default.MaxDesireability
00056						 * FMin(1, 0.15 * AlreadyHas.AmmoType.MaxAmmo/AlreadyHas.AmmoType.AmmoAmount) );
00057			else
00058				return 0.05;
00059		}
00060	
00061		// incentivize bot to get this weapon if it doesn't have a good weapon already
00062		if ( (Bot.Weapon == None) || (Bot.Weapon.AIRating <= 0.4) )
00063			return 2*desire;
00064	
00065		return desire;
00066	}
00067	
00068	defaultproperties
00069	{
00070	     MaxDesireability=0.500000
00071	     RespawnTime=30.000000
00072	     PickupMessage="You got a weapon"
00073	     Texture=Texture'Engine.S_Weapon'
00074	}

End Source Code