generalise kill vs eject garrisoned entities on death of garrisonHolder
This was SVN commit r13676.
This commit is contained in:
parent
d37d3be5d0
commit
b5888f4e45
@ -13,6 +13,9 @@ GarrisonHolder.prototype.Schema =
|
||||
"<element name='EjectHealth' a:help='Percentage of maximum health below which this holder no longer allows garrisoning'>" +
|
||||
"<ref name='nonNegativeDecimal'/>" +
|
||||
"</element>" +
|
||||
"<element name='EjectEntitiesOnDestroy' a:help='Whether the entity should eject or kill all garrisoned entities on destroy'>" +
|
||||
"<data type='boolean'/>" +
|
||||
"</element>" +
|
||||
"<element name='BuffHeal' a:help='Number of hit points that will be restored to this holder's garrisoned units each second'>" +
|
||||
"<ref name='nonNegativeDecimal'/>" +
|
||||
"</element>" +
|
||||
@ -74,6 +77,13 @@ GarrisonHolder.prototype.GetHealRate = function()
|
||||
return ApplyTechModificationsToEntity("GarrisonHolder/BuffHeal", +this.template.BuffHeal, this.entity);
|
||||
};
|
||||
|
||||
GarrisonHolder.prototype.EjectEntitiesOnDestroy = function()
|
||||
{
|
||||
if (this.template.EjectEntitiesOnDestroy == "true")
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get number of garrisoned units capable of shooting arrows
|
||||
* Not necessarily archers
|
||||
@ -337,15 +347,12 @@ GarrisonHolder.prototype.OnHealthChanged = function(msg)
|
||||
{
|
||||
if (!this.HasEnoughHealth())
|
||||
{
|
||||
// We have to be careful of our passability
|
||||
// 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();
|
||||
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())
|
||||
// Destroy the garrisoned units if the holder kill his entities on destroy or
|
||||
// is not in the world (generally means this holder is inside
|
||||
// a holder which kills its entities which has sunk).
|
||||
if (!this.EjectEntitiesOnDestroy() || !cmpPosition.IsInWorld())
|
||||
{
|
||||
for each (var entity in this.entities)
|
||||
{
|
||||
|
@ -7,6 +7,7 @@
|
||||
<GarrisonHolder>
|
||||
<Max>30</Max>
|
||||
<EjectHealth>0.1</EjectHealth>
|
||||
<EjectEntitiesOnDestroy>true</EjectEntitiesOnDestroy>
|
||||
<List datatype="tokens">Support Infantry Cavalry</List>
|
||||
<BuffHeal>3</BuffHeal>
|
||||
<LoadingRange>2</LoadingRange>
|
||||
|
@ -16,6 +16,7 @@
|
||||
<GarrisonHolder>
|
||||
<Max>5</Max>
|
||||
<EjectHealth>0.1</EjectHealth>
|
||||
<EjectEntitiesOnDestroy>true</EjectEntitiesOnDestroy>
|
||||
<List datatype="tokens">Support Infantry</List>
|
||||
<BuffHeal>0</BuffHeal>
|
||||
<LoadingRange>2</LoadingRange>
|
||||
|
@ -7,6 +7,7 @@
|
||||
<GarrisonHolder>
|
||||
<Max>30</Max>
|
||||
<EjectHealth>0.1</EjectHealth>
|
||||
<EjectEntitiesOnDestroy>true</EjectEntitiesOnDestroy>
|
||||
<List datatype="tokens">Support Infantry Cavalry</List>
|
||||
<BuffHeal>3</BuffHeal>
|
||||
<LoadingRange>2</LoadingRange>
|
||||
|
@ -42,6 +42,7 @@
|
||||
<GarrisonHolder>
|
||||
<Max>20</Max>
|
||||
<EjectHealth>0.1</EjectHealth>
|
||||
<EjectEntitiesOnDestroy>true</EjectEntitiesOnDestroy>
|
||||
<List datatype="tokens">Support Infantry Cavalry</List>
|
||||
<BuffHeal>1</BuffHeal>
|
||||
<LoadingRange>2</LoadingRange>
|
||||
|
@ -23,6 +23,7 @@
|
||||
<GarrisonHolder>
|
||||
<Max>20</Max>
|
||||
<EjectHealth>0.1</EjectHealth>
|
||||
<EjectEntitiesOnDestroy>true</EjectEntitiesOnDestroy>
|
||||
<List datatype="tokens">Support Infantry Cavalry</List>
|
||||
<BuffHeal>3</BuffHeal>
|
||||
<LoadingRange>2</LoadingRange>
|
||||
|
@ -35,6 +35,7 @@
|
||||
<GarrisonHolder>
|
||||
<Max>5</Max>
|
||||
<EjectHealth>0.1</EjectHealth>
|
||||
<EjectEntitiesOnDestroy>true</EjectEntitiesOnDestroy>
|
||||
<List datatype="tokens">Support Infantry</List>
|
||||
<BuffHeal>0</BuffHeal>
|
||||
<LoadingRange>2</LoadingRange>
|
||||
|
@ -44,6 +44,7 @@
|
||||
<GarrisonHolder>
|
||||
<Max>1</Max>
|
||||
<EjectHealth>0.1</EjectHealth>
|
||||
<EjectEntitiesOnDestroy>true</EjectEntitiesOnDestroy>
|
||||
<List datatype="tokens">Support Infantry</List>
|
||||
<BuffHeal>0</BuffHeal>
|
||||
<LoadingRange>2</LoadingRange>
|
||||
|
@ -34,6 +34,7 @@
|
||||
<GarrisonHolder>
|
||||
<Max>5</Max>
|
||||
<EjectHealth>0.1</EjectHealth>
|
||||
<EjectEntitiesOnDestroy>true</EjectEntitiesOnDestroy>
|
||||
<List datatype="tokens">Support Infantry</List>
|
||||
<BuffHeal>0</BuffHeal>
|
||||
<LoadingRange>2</LoadingRange>
|
||||
|
@ -16,6 +16,7 @@
|
||||
<GarrisonHolder>
|
||||
<Max>10</Max>
|
||||
<EjectHealth>0.1</EjectHealth>
|
||||
<EjectEntitiesOnDestroy>true</EjectEntitiesOnDestroy>
|
||||
<List datatype="tokens">Infantry Cavalry</List>
|
||||
<BuffHeal>0</BuffHeal>
|
||||
<LoadingRange>2</LoadingRange>
|
||||
|
@ -35,6 +35,7 @@
|
||||
<GarrisonHolder>
|
||||
<Max>20</Max>
|
||||
<EjectHealth>0.075</EjectHealth>
|
||||
<EjectEntitiesOnDestroy>true</EjectEntitiesOnDestroy>
|
||||
<List datatype="tokens">Support Infantry Cavalry Siege</List>
|
||||
<BuffHeal>0</BuffHeal>
|
||||
<LoadingRange>6</LoadingRange>
|
||||
|
@ -13,6 +13,7 @@
|
||||
<GarrisonHolder>
|
||||
<Max>10</Max>
|
||||
<EjectHealth>0.1</EjectHealth>
|
||||
<EjectEntitiesOnDestroy>true</EjectEntitiesOnDestroy>
|
||||
<List datatype="tokens">Animal</List>
|
||||
<BuffHeal>1</BuffHeal>
|
||||
<LoadingRange>2</LoadingRange>
|
||||
|
@ -29,6 +29,7 @@
|
||||
<GarrisonHolder>
|
||||
<Max>5</Max>
|
||||
<EjectHealth>0.1</EjectHealth>
|
||||
<EjectEntitiesOnDestroy>true</EjectEntitiesOnDestroy>
|
||||
<List datatype="tokens">Support Infantry Cavalry</List>
|
||||
<BuffHeal>1</BuffHeal>
|
||||
<LoadingRange>2</LoadingRange>
|
||||
|
@ -33,6 +33,7 @@
|
||||
<GarrisonHolder>
|
||||
<Max>20</Max>
|
||||
<EjectHealth>0</EjectHealth>
|
||||
<EjectEntitiesOnDestroy>false</EjectEntitiesOnDestroy>
|
||||
<List datatype="tokens">Support Infantry Cavalry</List>
|
||||
<BuffHeal>1</BuffHeal>
|
||||
<LoadingRange>10</LoadingRange>
|
||||
|
@ -22,6 +22,7 @@
|
||||
<GarrisonHolder>
|
||||
<Max>1</Max>
|
||||
<EjectHealth>0</EjectHealth>
|
||||
<EjectEntitiesOnDestroy>false</EjectEntitiesOnDestroy>
|
||||
<List datatype="tokens">Support Infantry</List>
|
||||
<BuffHeal>1</BuffHeal>
|
||||
<LoadingRange>10</LoadingRange>
|
||||
|
@ -14,6 +14,7 @@
|
||||
<GarrisonHolder>
|
||||
<Max>15</Max>
|
||||
<EjectHealth>0</EjectHealth>
|
||||
<EjectEntitiesOnDestroy>false</EjectEntitiesOnDestroy>
|
||||
<List datatype="tokens">Support Infantry Cavalry</List>
|
||||
<BuffHeal>1</BuffHeal>
|
||||
<LoadingRange>10</LoadingRange>
|
||||
|
@ -33,6 +33,7 @@
|
||||
<GarrisonHolder>
|
||||
<Max>50</Max>
|
||||
<EjectHealth>0</EjectHealth>
|
||||
<EjectEntitiesOnDestroy>false</EjectEntitiesOnDestroy>
|
||||
<List datatype="tokens">Support Infantry Cavalry Siege</List>
|
||||
<BuffHeal>1</BuffHeal>
|
||||
<LoadingRange>10</LoadingRange>
|
||||
|
@ -33,6 +33,7 @@
|
||||
<GarrisonHolder>
|
||||
<Max>30</Max>
|
||||
<EjectHealth>0</EjectHealth>
|
||||
<EjectEntitiesOnDestroy>false</EjectEntitiesOnDestroy>
|
||||
<List datatype="tokens">Support Infantry Cavalry Siege</List>
|
||||
<BuffHeal>1</BuffHeal>
|
||||
<LoadingRange>10</LoadingRange>
|
||||
|
@ -56,6 +56,7 @@
|
||||
<GarrisonHolder>
|
||||
<Max>5</Max>
|
||||
<EjectHealth>0.1</EjectHealth>
|
||||
<EjectEntitiesOnDestroy>true</EjectEntitiesOnDestroy>
|
||||
<List datatype="tokens">Support Infantry</List>
|
||||
<BuffHeal>1</BuffHeal>
|
||||
<LoadingRange>2</LoadingRange>
|
||||
|
@ -38,6 +38,7 @@
|
||||
<GarrisonHolder>
|
||||
<Max>20</Max>
|
||||
<EjectHealth>0.1</EjectHealth>
|
||||
<EjectEntitiesOnDestroy>true</EjectEntitiesOnDestroy>
|
||||
<List datatype="tokens">Support Infantry</List>
|
||||
<BuffHeal>1</BuffHeal>
|
||||
<LoadingRange>2</LoadingRange>
|
||||
|
Loading…
Reference in New Issue
Block a user