1
0
forked from 0ad/0ad

Handle nested garrison holder death properly.

This was SVN commit r12672.
This commit is contained in:
Deiz 2012-09-13 22:47:47 +00:00
parent 71cfdec62b
commit 8bd54eef71

View File

@ -333,8 +333,12 @@ GarrisonHolder.prototype.OnHealthChanged = function(msg)
// ships: not land passable, so assume units have drowned in a shipwreck
// building: land passable, so units can be ejected freely
var classes = (Engine.QueryInterface(this.entity, IID_Identity)).GetClassesList();
if (classes.indexOf("Ship") != -1)
{ // Ship - kill all units
var cmpPosition = Engine.QueryInterface(this.entity, IID_Position);
// Destroy the garrisoned units if the holder is a ship or is not in the
// world (generally means this holder is inside a ship which has sunk).
if (classes.indexOf("Ship") != -1 || !cmpPosition.IsInWorld())
{
for each (var entity in this.entities)
{
var cmpHealth = Engine.QueryInterface(entity, IID_Health);