Core.Object | +--Engine.Actor | +--Engine.Pickup | +--Engine.Ammo
int
AmmoAmount
float
BotDesireability(Pawn Bot)
//_____________________________________________________________________________
Inventory
SpawnCopy(Pawn Other)
00001 //============================================================================= 00002 // Ammo. 00003 //============================================================================= 00004 class Ammo extends Pickup 00005 abstract 00006 native; 00007 00008 #exec Texture Import File=Textures\Ammo.pcx Name=S_Ammo Mips=Off MASKED=1 COMPRESS=DXT1 00009 00010 var() int AmmoAmount; 00011 00012 //_____________________________________________________________________________ 00013 function float BotDesireability(Pawn Bot) 00014 { 00015 local Ammunition AlreadyHas; 00016 00017 AlreadyHas = Ammunition(Bot.FindInventoryType(InventoryType)); 00018 if ( AlreadyHas == None ) 00019 return (0.35 * MaxDesireability); 00020 if ( AlreadyHas.AmmoAmount == 0 ) 00021 return MaxDesireability; 00022 if (AlreadyHas.AmmoAmount >= AlreadyHas.MaxAmmo) 00023 return -1; 00024 00025 return ( MaxDesireability * FMin(1, 0.15 * AmmoAmount/AlreadyHas.AmmoAmount) ); 00026 } 00027 00028 //_____________________________________________________________________________ 00029 function inventory SpawnCopy( Pawn Other ) 00030 { 00031 local inventory Copy; 00032 00033 if ( Inventory != None ) 00034 { 00035 Copy = Inventory; 00036 Inventory = None; 00037 } 00038 else 00039 Copy = spawn(InventoryType,Other,,,rot(0,0,0)); 00040 Ammunition(Copy).AmmoAmount = AmmoAmount; 00041 00042 Copy.GiveTo( Other ); 00043 if( Level.Game.ShouldRespawn(self) ) 00044 StartSleeping(); 00045 else 00046 Destroy(); 00047 return Copy; 00048 } 00049 00050 defaultproperties 00051 { 00052 MaxDesireability=0.200000 00053 RespawnTime=30.000000 00054 PickupMessage="You picked up some ammo." 00055 Texture=Texture'Engine.S_Ammo' 00056 }