Display "garrisoned" prop on buildings containing units
This was SVN commit r8817.
This commit is contained in:
parent
2540e17f45
commit
e853dd1079
@ -123,6 +123,7 @@ GarrisonHolder.prototype.Garrison = function(entity)
|
|||||||
this.entities.push(entity);
|
this.entities.push(entity);
|
||||||
this.spaceOccupied += 1;
|
this.spaceOccupied += 1;
|
||||||
cmpPosition.MoveOutOfWorld();
|
cmpPosition.MoveOutOfWorld();
|
||||||
|
this.UpdateVisual();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -140,6 +141,7 @@ GarrisonHolder.prototype.Unload = function(entity)
|
|||||||
var entityIndex = this.entities.indexOf(entity);
|
var entityIndex = this.entities.indexOf(entity);
|
||||||
this.spaceOccupied -= 1;
|
this.spaceOccupied -= 1;
|
||||||
this.entities.splice(entityIndex, 1);
|
this.entities.splice(entityIndex, 1);
|
||||||
|
this.UpdateVisual();
|
||||||
var cmpFootprint = Engine.QueryInterface(this.entity, IID_Footprint);
|
var cmpFootprint = Engine.QueryInterface(this.entity, IID_Footprint);
|
||||||
var pos = cmpFootprint.PickSpawnPoint(entity);
|
var pos = cmpFootprint.PickSpawnPoint(entity);
|
||||||
if (pos.y < 0)
|
if (pos.y < 0)
|
||||||
@ -211,6 +213,24 @@ GarrisonHolder.prototype.UnloadAll = function()
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Updates the actor's settings to display the garrison flag prop (if any).
|
||||||
|
*/
|
||||||
|
GarrisonHolder.prototype.UpdateVisual = function()
|
||||||
|
{
|
||||||
|
var cmpVisual = Engine.QueryInterface(this.entity, IID_Visual);
|
||||||
|
if (!cmpVisual)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// TODO: ought to extend ICmpVisual to let us just select variant
|
||||||
|
// keywords without changing the animation too
|
||||||
|
|
||||||
|
if (this.entities.length)
|
||||||
|
cmpVisual.SelectAnimation("garrisoned", false, 1.0, "");
|
||||||
|
else
|
||||||
|
cmpVisual.SelectAnimation("idle", false, 1.0, "");
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Called every second. Heals garrisoned units
|
* Called every second. Heals garrisoned units
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user