Engine
Class ArmorPickup

source: C:\XIII\Engine\Classes\ArmorPickup.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Pickup
         |
         +--Engine.ArmorPickup
Direct Known Subclasses:XIIIArmorPickup

class ArmorPickup
extends Engine.Pickup


Variables
 int ProtectionLevel


Function Summary
 float BotDesireability(Pawn Bot)
     
//_____________________________________________________________________________
 Inventory SpawnCopy(Pawn Other)
     
//_____________________________________________________________________________
// Either give this inventory to player Other, or spawn a copy
// and give it to the player Other, setting up original to be respawned.



Source Code


00001	class ArmorPickup extends Pickup
00002	  abstract;
00003	
00004	var() int ProtectionLevel;
00005	
00006	//_____________________________________________________________________________
00007	event ParseDynamicLoading(LevelInfo MyLI)
00008	{
00009	    Log("ParseDynamicLoading Actor="$self);
00010	    class<Armor>(default.InventoryType).Static.StaticParseDynamicLoading(MyLI);
00011	//    MyLI.ForcedMeshes[MyLI.ForcedMeshes.Length] = mesh(DynamicLoadObject(class<Weapon>(default.InventoryType).default.MeshName, class'mesh'));
00012	}
00013	
00014	//_____________________________________________________________________________
00015	// Either give this inventory to player Other, or spawn a copy
00016	// and give it to the player Other, setting up original to be respawned.
00017	function inventory SpawnCopy( pawn Other )
00018	{
00019	    local inventory Copy;
00020	
00021	    if ( Inventory != None )
00022	    {
00023	      Copy = Inventory;
00024	      Inventory = None;
00025	    }
00026	    else
00027	    {
00028	      Copy = spawn(InventoryType,Other,,,rot(0,0,0));
00029	      // ELR Added this to make each armor type unique in inventory (not giletMk1 & Mk2)
00030	      Copy.Charge = ProtectionLevel;
00031	    }
00032	
00033	    Copy.GiveTo( Other );
00034	
00035	    if( Level.Game.ShouldRespawn(self) )
00036	      StartSleeping();
00037	    else
00038	      Destroy();
00039	    return Copy;
00040	}
00041	
00042	//_____________________________________________________________________________
00043	function float BotDesireability( pawn Bot )
00044	{
00045	    local Inventory AlreadyHas;
00046	    local Armor AlreadyHasArmor;
00047	    local float desire;
00048	    local bool bChecked;
00049	
00050	    desire = MaxDesireability;
00051	
00052	    if ( RespawnTime < 10 )
00053	    {
00054	      bChecked = true;
00055	      AlreadyHas = Bot.FindInventoryType(InventoryType);
00056	      if ( AlreadyHas != None )
00057	      {
00058	        if ( Inventory != None )
00059	        {
00060	          if( Inventory.Charge <= AlreadyHas.Charge )
00061	          	return -1;
00062	        }
00063	        else if ( InventoryType.Default.Charge <= AlreadyHas.Charge )
00064	          return -1;
00065	      }
00066	    }
00067	
00068	    if ( !bChecked )
00069	      AlreadyHasArmor = Armor(Bot.FindInventoryType(InventoryType));
00070	    if ( AlreadyHasArmor != None )
00071	      desire *= (1 - AlreadyHasArmor.Charge * AlreadyHasArmor.ArmorAbsorption * 0.00003);
00072	
00073	    if ( Armor(Inventory) != None )
00074	    {
00075	      // pointing to specific, existing item
00076	      desire *= (Inventory.Charge * 0.005);
00077	      desire *= (Armor(Inventory).ArmorAbsorption * 0.01);
00078	    }
00079	    else
00080	    {
00081	      desire *= (InventoryType.default.Charge * 0.005);
00082	      desire *= (class<Armor>(InventoryType).default.ArmorAbsorption * 0.01);
00083	    }
00084	    return desire;
00085	}
00086	
00087	defaultproperties
00088	{
00089	     CollisionHeight=20.000000
00090	}

End Source Code