UnrealShare
Class Health

source: e:\games\UnrealTournament\UnrealShare\Classes\Health.uc
Core.Object
   |
   +--Engine.Actor
      |
      +--Engine.Inventory
         |
         +--Engine.Pickup
            |
            +--UnrealShare.Health
Direct Known Subclasses:Bandages, NaliFruit, SuperHealth

class Health
extends Engine.Pickup


Variables
 int HealingAmount
 bool bSuperHeal

States
Pickup

Function Summary
 void PlayPickupMessage(Pawn Other)


State Pickup Function Summary
 void Touch(Actor Other)



Source Code


00001	class Health extends PickUp;
00002	
00003	#exec AUDIO IMPORT FILE="Sounds\Pickups\HEALTH2.WAV"  NAME="Health2"     GROUP="Pickups"
00004	
00005	#exec TEXTURE IMPORT NAME=I_Health FILE=TEXTURES\HUD\i_Health.PCX GROUP="Icons" MIPS=OFF
00006	
00007	#exec MESH IMPORT MESH=HealthM ANIVFILE=MODELS\aniv38.3D DATAFILE=MODELS\data38.3D LODSTYLE=8
00008	#exec MESH LODPARAMS MESH=HealthM STRENGTH=0.3
00009	#exec  MESH ORIGIN MESH=HealthM X=0 Y=0 Z=0 YAW=0
00010	#exec  MESH SEQUENCE MESH=HealthM SEQ=All    STARTFRAME=0  NUMFRAMES=1
00011	#exec  TEXTURE IMPORT NAME=Jhealth1 FILE=MODELS\health.PCX GROUP="Skins" FLAGS=2
00012	#exec  MESHMAP SCALE MESHMAP=HealthM X=0.02 Y=0.02 Z=0.04
00013	#exec  MESHMAP SETTEXTURE MESHMAP=HealthM NUM=0 TEXTURE=Jhealth1 TLOD=5
00014	
00015	var() int HealingAmount;
00016	var() bool bSuperHeal;
00017	
00018	event float BotDesireability(Pawn Bot)
00019	{
00020		local float desire;
00021		local int HealMax;
00022	
00023		HealMax = Bot.Default.Health;
00024		if (bSuperHeal) HealMax = HealMax * 2.0;
00025		desire = Min(HealingAmount, HealMax - Bot.Health);
00026	
00027		if ( (Bot.Weapon != None) && (Bot.Weapon.AIRating > 0.5) )
00028			desire *= 1.7;
00029		if ( Bot.Health < 40 )
00030			return ( FMin(0.03 * desire, 2.2) );
00031		else
00032			return ( FMin(0.015 * desire, 2.0) ); 
00033	}
00034	
00035	function PlayPickupMessage(Pawn Other)
00036	{
00037		Other.ClientMessage(PickupMessage$HealingAmount, 'Pickup');
00038	}
00039	
00040	auto state Pickup
00041	{	
00042		function Touch( actor Other )
00043		{
00044			local int HealMax;
00045			local Pawn P;
00046				
00047			if ( ValidTouch(Other) ) 
00048			{	
00049				P = Pawn(Other);	
00050				HealMax = P.default.health;
00051				if (bSuperHeal) HealMax = HealMax * 2.0;
00052				if (P.Health < HealMax) 
00053				{
00054					if (Level.Game.LocalLog != None)
00055						Level.Game.LocalLog.LogPickup(Self, P);
00056					if (Level.Game.WorldLog != None)
00057						Level.Game.WorldLog.LogPickup(Self, P);
00058					P.Health += HealingAmount;
00059					if (P.Health > HealMax) P.Health = HealMax;
00060					PlayPickupMessage(P);
00061					PlaySound (PickupSound,,2.5);
00062					if ( Level.Game.Difficulty > 1 )
00063						Other.MakeNoise(0.1 * Level.Game.Difficulty);		
00064					SetRespawn();
00065				}
00066			}
00067		}
00068	}
00069	
00070	defaultproperties
00071	{
00072	     HealingAmount=20
00073	     PickupMessage="You picked up a Health Pack +"
00074	     RespawnTime=20.000000
00075	     PickupViewMesh=LodMesh'UnrealShare.HealthM'
00076	     MaxDesireability=0.500000
00077	     PickupSound=Sound'UnrealShare.Pickups.Health2'
00078	     Icon=Texture'UnrealShare.Icons.I_Health'
00079	     RemoteRole=ROLE_DumbProxy
00080	     Mesh=LodMesh'UnrealShare.HealthM'
00081	     AmbientGlow=64
00082	     CollisionRadius=22.000000
00083	     CollisionHeight=8.000000
00084	     Mass=10.000000
00085	}

End Source Code