- removed duplicate health definitions.

This commit is contained in:
Christoph Oelckers 2017-01-15 09:42:49 +01:00
parent 87617b588a
commit d3626948e4

View file

@ -16,131 +16,6 @@ class ScoreItem : Inventory
}
}
class Health : Inventory native
{
native int PrevHealth;
native meta int LowHealth;
native meta String LowHealthMessage;
Default
{
Inventory.Amount 1;
Inventory.MaxAmount 0;
Inventory.PickupSound "misc/health_pkup";
}
//===========================================================================
//
// AHealth :: PickupMessage
//
//===========================================================================
override String PickupMessage ()
{
if (PrevHealth < LowHealth)
{
String message = LowHealthMessage;
if (message.Length() != 0)
{
return message;
}
}
return Super.PickupMessage();
}
//===========================================================================
//
// TryPickup
//
//===========================================================================
override bool TryPickup (in out Actor other)
{
PrevHealth = other.player != NULL ? other.player.health : other.health;
// P_GiveBody adds one new feature, applied only if it is possible to pick up negative health:
// Negative values are treated as positive percentages, ie Amount -100 means 100% health, ignoring max amount.
if (other.GiveBody(Amount, MaxAmount))
{
GoAwayAndDie();
return true;
}
return false;
}
}
class HealthPickup : Inventory native
{
native int autousemode;
Default
{
Inventory.DefMaxAmount;
+INVENTORY.INVBAR
}
//===========================================================================
//
// CreateCopy
//
//===========================================================================
override Inventory CreateCopy (Actor other)
{
Inventory copy = Super.CreateCopy (other);
copy.health = health;
return copy;
}
//===========================================================================
//
// CreateTossable
//
//===========================================================================
override Inventory CreateTossable ()
{
Inventory copy = Super.CreateTossable ();
if (copy != NULL)
{
copy.health = health;
}
return copy;
}
//===========================================================================
//
// HandlePickup
//
//===========================================================================
override bool HandlePickup (Inventory item)
{
// HealthPickups that are the same type but have different health amounts
// do not count as the same item.
if (item.health == health)
{
return Super.HandlePickup (item);
}
return false;
}
//===========================================================================
//
// Use
//
//===========================================================================
override bool Use (bool pickup)
{
return Owner.GiveBody (health, 0);
}
}
class Key : Inventory native
{
native uint8 KeyNumber;