destruct airplane when crashing with low hit points

TODO: needs visual feedback when low on hitpoints.
ipv6
Maikel de Vries 2016-12-28 22:18:52 +01:00
parent a16de0be0f
commit 9b133030dc
1 changed files with 13 additions and 0 deletions

View File

@ -377,6 +377,19 @@ public func Damage(int change, int cause, int by_player)
}
}
// Inflict damage when hitting something with the plane and already damaged.
public func Hit(int xdir, int ydir)
{
var remaining_hp = this.HitPoints - GetDamage();
if (remaining_hp < 10)
{
var speed = Distance(0, 0, xdir, ydir) / 10;
if (speed > 4 * remaining_hp)
DoDamage(speed / 6, FX_Call_DmgScript, GetController());
}
return;
}
private func PlaneDeath()
{
while(Contents(0))