forked from mirrors/0ad
Allow units without Cost component and use it for the Catafalque template.
Differential Revision: https://code.wildfiregames.com/D334 Reviewed By: Sandarac This was SVN commit r19419.
This commit is contained in:
@@ -248,11 +248,12 @@ StatisticsTracker.prototype.IncreaseConstructedBuildingsCounter = function(const
|
|||||||
StatisticsTracker.prototype.KilledEntity = function(targetEntity)
|
StatisticsTracker.prototype.KilledEntity = function(targetEntity)
|
||||||
{
|
{
|
||||||
var cmpTargetEntityIdentity = Engine.QueryInterface(targetEntity, IID_Identity);
|
var cmpTargetEntityIdentity = Engine.QueryInterface(targetEntity, IID_Identity);
|
||||||
var cmpCost = Engine.QueryInterface(targetEntity, IID_Cost);
|
|
||||||
var costs = cmpCost.GetResourceCosts();
|
|
||||||
if (!cmpTargetEntityIdentity)
|
if (!cmpTargetEntityIdentity)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
var cmpCost = Engine.QueryInterface(targetEntity, IID_Cost);
|
||||||
|
var costs = cmpCost && cmpCost.GetResourceCosts();
|
||||||
|
|
||||||
var cmpTargetOwnership = Engine.QueryInterface(targetEntity, IID_Ownership);
|
var cmpTargetOwnership = Engine.QueryInterface(targetEntity, IID_Ownership);
|
||||||
|
|
||||||
// Ignore gaia
|
// Ignore gaia
|
||||||
@@ -266,6 +267,9 @@ StatisticsTracker.prototype.KilledEntity = function(targetEntity)
|
|||||||
|
|
||||||
++this.enemyUnitsKilled.total;
|
++this.enemyUnitsKilled.total;
|
||||||
|
|
||||||
|
if (!cmpCost)
|
||||||
|
return;
|
||||||
|
|
||||||
for (let type in costs)
|
for (let type in costs)
|
||||||
this.enemyUnitsKilledValue += costs[type];
|
this.enemyUnitsKilledValue += costs[type];
|
||||||
}
|
}
|
||||||
@@ -278,6 +282,9 @@ StatisticsTracker.prototype.KilledEntity = function(targetEntity)
|
|||||||
|
|
||||||
++this.enemyBuildingsDestroyed.total;
|
++this.enemyBuildingsDestroyed.total;
|
||||||
|
|
||||||
|
if (!costs)
|
||||||
|
return;
|
||||||
|
|
||||||
for (let type in costs)
|
for (let type in costs)
|
||||||
this.enemyBuildingsDestroyedValue += costs[type];
|
this.enemyBuildingsDestroyedValue += costs[type];
|
||||||
}
|
}
|
||||||
@@ -286,11 +293,12 @@ StatisticsTracker.prototype.KilledEntity = function(targetEntity)
|
|||||||
StatisticsTracker.prototype.LostEntity = function(lostEntity)
|
StatisticsTracker.prototype.LostEntity = function(lostEntity)
|
||||||
{
|
{
|
||||||
var cmpLostEntityIdentity = Engine.QueryInterface(lostEntity, IID_Identity);
|
var cmpLostEntityIdentity = Engine.QueryInterface(lostEntity, IID_Identity);
|
||||||
var cmpCost = Engine.QueryInterface(lostEntity, IID_Cost);
|
|
||||||
var costs = cmpCost.GetResourceCosts();
|
|
||||||
if (!cmpLostEntityIdentity)
|
if (!cmpLostEntityIdentity)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
var cmpCost = Engine.QueryInterface(lostEntity, IID_Cost);
|
||||||
|
var costs = cmpCost && cmpCost.GetResourceCosts();
|
||||||
|
|
||||||
if (cmpLostEntityIdentity.HasClass("Unit") && !cmpLostEntityIdentity.HasClass("Domestic"))
|
if (cmpLostEntityIdentity.HasClass("Unit") && !cmpLostEntityIdentity.HasClass("Domestic"))
|
||||||
{
|
{
|
||||||
for (let type of this.unitsClasses)
|
for (let type of this.unitsClasses)
|
||||||
@@ -298,6 +306,9 @@ StatisticsTracker.prototype.LostEntity = function(lostEntity)
|
|||||||
|
|
||||||
++this.unitsLost.total;
|
++this.unitsLost.total;
|
||||||
|
|
||||||
|
if (!costs)
|
||||||
|
return;
|
||||||
|
|
||||||
for (let type in costs)
|
for (let type in costs)
|
||||||
this.unitsLostValue += costs[type];
|
this.unitsLostValue += costs[type];
|
||||||
}
|
}
|
||||||
@@ -310,6 +321,9 @@ StatisticsTracker.prototype.LostEntity = function(lostEntity)
|
|||||||
|
|
||||||
++this.buildingsLost.total;
|
++this.buildingsLost.total;
|
||||||
|
|
||||||
|
if (!costs)
|
||||||
|
return;
|
||||||
|
|
||||||
for (let type in costs)
|
for (let type in costs)
|
||||||
this.buildingsLostValue += costs[type];
|
this.buildingsLostValue += costs[type];
|
||||||
}
|
}
|
||||||
@@ -321,6 +335,9 @@ StatisticsTracker.prototype.CapturedEntity = function(capturedEntity)
|
|||||||
if (!cmpCapturedEntityIdentity)
|
if (!cmpCapturedEntityIdentity)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
let cmpCost = Engine.QueryInterface(capturedEntity, IID_Cost);
|
||||||
|
let costs = cmpCost && cmpCost.GetResourceCosts();
|
||||||
|
|
||||||
if (cmpCapturedEntityIdentity.HasClass("Unit"))
|
if (cmpCapturedEntityIdentity.HasClass("Unit"))
|
||||||
{
|
{
|
||||||
for (let type of this.unitsClasses)
|
for (let type of this.unitsClasses)
|
||||||
@@ -328,11 +345,9 @@ StatisticsTracker.prototype.CapturedEntity = function(capturedEntity)
|
|||||||
|
|
||||||
++this.unitsCaptured.total;
|
++this.unitsCaptured.total;
|
||||||
|
|
||||||
let cmpCost = Engine.QueryInterface(capturedEntity, IID_Cost);
|
|
||||||
if (!cmpCost)
|
if (!cmpCost)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
let costs = cmpCost.GetResourceCosts();
|
|
||||||
for (let type in costs)
|
for (let type in costs)
|
||||||
this.unitsCapturedValue += costs[type];
|
this.unitsCapturedValue += costs[type];
|
||||||
}
|
}
|
||||||
@@ -344,11 +359,9 @@ StatisticsTracker.prototype.CapturedEntity = function(capturedEntity)
|
|||||||
|
|
||||||
++this.buildingsCaptured.total;
|
++this.buildingsCaptured.total;
|
||||||
|
|
||||||
let cmpCost = Engine.QueryInterface(capturedEntity, IID_Cost);
|
|
||||||
if (!cmpCost)
|
if (!cmpCost)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
let costs = cmpCost.GetResourceCosts();
|
|
||||||
for (let type in costs)
|
for (let type in costs)
|
||||||
this.buildingsCapturedValue += costs[type];
|
this.buildingsCapturedValue += costs[type];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,9 +5,7 @@
|
|||||||
<GarrisonRegenRate>0</GarrisonRegenRate>
|
<GarrisonRegenRate>0</GarrisonRegenRate>
|
||||||
<RegenRate>10</RegenRate>
|
<RegenRate>10</RegenRate>
|
||||||
</Capturable>
|
</Capturable>
|
||||||
<Cost>
|
<Cost disable=""/>
|
||||||
<Population>0</Population>
|
|
||||||
</Cost>
|
|
||||||
<Footprint replace="">
|
<Footprint replace="">
|
||||||
<Height>2.0</Height>
|
<Height>2.0</Height>
|
||||||
<Square width="5.0" depth="12.0"/>
|
<Square width="5.0" depth="12.0"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user