Index: ps/trunk/binaries/data/mods/public/gui/session/unit_actions.js
===================================================================
--- ps/trunk/binaries/data/mods/public/gui/session/unit_actions.js
+++ ps/trunk/binaries/data/mods/public/gui/session/unit_actions.js
@@ -1440,7 +1440,7 @@
if (entState.capturePoints && entState.capturePoints[entState.player] < entState.maxCapturePoints / 2)
return translate("You cannot destroy this entity as you own less than half the capture points");
- if (!entState.canDelete)
+ if (!entState.identity.canDelete)
return translate("This entity is undeletable");
return false;
Index: ps/trunk/binaries/data/mods/public/maps/random/survivalofthefittest.js
===================================================================
--- ps/trunk/binaries/data/mods/public/maps/random/survivalofthefittest.js
+++ ps/trunk/binaries/data/mods/public/maps/random/survivalofthefittest.js
@@ -30,7 +30,7 @@
const pForest1 = [tForestFloor2 + TERRAIN_SEPARATOR + oTree1, tForestFloor2 + TERRAIN_SEPARATOR + oTree2, tForestFloor2];
const pForest2 = [tForestFloor1 + TERRAIN_SEPARATOR + oTree4, tForestFloor1 + TERRAIN_SEPARATOR + oTree5, tForestFloor1];
-const oTreasureSeeker = "skirmish/units/default_support_female_citizen";
+const oTreasureSeeker = "undeletable|skirmish/units/default_support_female_citizen";
const triggerPointAttacker = "trigger/trigger_point_A";
const triggerPointTreasures = [
Index: ps/trunk/binaries/data/mods/public/maps/random/survivalofthefittest_triggers.js
===================================================================
--- ps/trunk/binaries/data/mods/public/maps/random/survivalofthefittest_triggers.js
+++ ps/trunk/binaries/data/mods/public/maps/random/survivalofthefittest_triggers.js
@@ -178,9 +178,6 @@
let cmpDamageReceiver = Engine.QueryInterface(entity, IID_DamageReceiver);
cmpDamageReceiver.SetInvulnerability(true);
-
- let cmpHealth = Engine.QueryInterface(entity, IID_Health);
- cmpHealth.SetUndeletable(true);
}
}
}
Index: ps/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js
===================================================================
--- ps/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js
+++ ps/trunk/binaries/data/mods/public/simulation/components/GuiInterface.js
@@ -277,7 +277,8 @@
"rank": cmpIdentity.GetRank(),
"classes": cmpIdentity.GetClassesList(),
"visibleClasses": cmpIdentity.GetVisibleClassesList(),
- "selectionGroupName": cmpIdentity.GetSelectionGroupName()
+ "selectionGroupName": cmpIdentity.GetSelectionGroupName(),
+ "canDelete": !cmpIdentity.IsUndeletable()
};
let cmpPosition = Engine.QueryInterface(ent, IID_Position);
@@ -294,7 +295,6 @@
ret.maxHitpoints = cmpHealth.GetMaxHitpoints();
ret.needsRepair = cmpHealth.IsRepairable() && cmpHealth.GetHitpoints() < cmpHealth.GetMaxHitpoints();
ret.needsHeal = !cmpHealth.IsUnhealable();
- ret.canDelete = !cmpHealth.IsUndeletable();
}
let cmpCapturable = QueryMiragedInterface(ent, IID_Capturable);
Index: ps/trunk/binaries/data/mods/public/simulation/components/Health.js
===================================================================
--- ps/trunk/binaries/data/mods/public/simulation/components/Health.js
+++ ps/trunk/binaries/data/mods/public/simulation/components/Health.js
@@ -47,9 +47,6 @@
"" +
"" +
"" +
- "" +
- "" +
- "" +
"" +
"" +
"";
@@ -63,7 +60,6 @@
this.hitpoints = +(this.template.Initial || this.GetMaxHitpoints());
this.regenRate = ApplyValueModificationsToEntity("Health/RegenRate", +this.template.RegenRate, this.entity);
this.idleRegenRate = ApplyValueModificationsToEntity("Health/IdleRegenRate", +this.template.IdleRegenRate, this.entity);
- this.undeletable = this.template.Undeletable == "true";
this.CheckRegenTimer();
this.UpdateActor();
};
@@ -122,16 +118,6 @@
|| this.GetHitpoints() >= this.GetMaxHitpoints());
};
-Health.prototype.IsUndeletable = function()
-{
- return this.undeletable;
-};
-
-Health.prototype.SetUndeletable = function(undeletable)
-{
- this.undeletable = undeletable;
-};
-
Health.prototype.GetIdleRegenRate = function()
{
return this.idleRegenRate;
Index: ps/trunk/binaries/data/mods/public/simulation/components/Identity.js
===================================================================
--- ps/trunk/binaries/data/mods/public/simulation/components/Identity.js
+++ ps/trunk/binaries/data/mods/public/simulation/components/Identity.js
@@ -86,8 +86,10 @@
"" +
"" +
"" +
- "";
-
+ "" +
+ "" +
+ "" +
+ "";
Identity.prototype.Init = function()
{
@@ -159,4 +161,9 @@
return this.template.GenericName;
};
+Identity.prototype.IsUndeletable = function()
+{
+ return this.template.Undeletable == "true";
+};
+
Engine.RegisterComponentType(IID_Identity, "Identity", Identity);
Index: ps/trunk/binaries/data/mods/public/simulation/components/Mirage.js
===================================================================
--- ps/trunk/binaries/data/mods/public/simulation/components/Mirage.js
+++ ps/trunk/binaries/data/mods/public/simulation/components/Mirage.js
@@ -15,6 +15,8 @@
this.miragedIids = new Set();
+ this.classesList = [];
+
this.buildPercentage = 0;
this.numBuilders = 0;
@@ -22,7 +24,6 @@
this.hitpoints = null;
this.repairable = null;
this.unhealable = null;
- this.undeletable = null;
this.capturePoints = [];
this.maxCapturePoints = 0;
@@ -92,14 +93,12 @@
this.hitpoints = cmpHealth.GetHitpoints();
this.repairable = cmpHealth.IsRepairable();
this.unhealable = cmpHealth.IsUnhealable();
- this.undeletable = cmpHealth.IsUndeletable();
};
Mirage.prototype.GetMaxHitpoints = function() { return this.maxHitpoints; };
Mirage.prototype.GetHitpoints = function() { return this.hitpoints; };
Mirage.prototype.IsRepairable = function() { return this.repairable; };
Mirage.prototype.IsUnhealable = function() { return this.unhealable; };
-Mirage.prototype.IsUndeletable = function() { return this.undeletable; };
// Capture data
Index: ps/trunk/binaries/data/mods/public/simulation/components/SkirmishReplacer.js
===================================================================
--- ps/trunk/binaries/data/mods/public/simulation/components/SkirmishReplacer.js
+++ ps/trunk/binaries/data/mods/public/simulation/components/SkirmishReplacer.js
@@ -40,6 +40,15 @@
var cmpTemplateManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_TemplateManager);
var templateName = cmpTemplateManager.GetCurrentTemplateName(this.entity);
+ let specialFilter = "";
+ let specialFilterPos = templateName.lastIndexOf("|");
+
+ if (specialFilterPos != -1)
+ {
+ specialFilter = templateName.substr(0, specialFilterPos + 1);
+ templateName = templateName.substr(specialFilterPos);
+ }
+
if (templateName in replacementEntities)
templateName = replacementEntities[templateName];
else if (this.template && "general" in this.template)
@@ -53,7 +62,7 @@
return;
}
- templateName = templateName.replace(/\{civ\}/g, civ);
+ templateName = specialFilter + templateName.replace(/\{civ\}/g, civ);
var cmpCurPosition = Engine.QueryInterface(this.entity, IID_Position);
var replacement = Engine.AddEntity(templateName);
Index: ps/trunk/binaries/data/mods/public/simulation/components/tests/test_GuiInterface.js
===================================================================
--- ps/trunk/binaries/data/mods/public/simulation/components/tests/test_GuiInterface.js
+++ ps/trunk/binaries/data/mods/public/simulation/components/tests/test_GuiInterface.js
@@ -566,8 +566,7 @@
GetHitpoints: function() { return 50; },
GetMaxHitpoints: function() { return 60; },
IsRepairable: function() { return false; },
- IsUnhealable: function() { return false; },
- IsUndeletable: function() { return false; }
+ IsUnhealable: function() { return false; }
});
AddMock(10, IID_Identity, {
@@ -575,7 +574,8 @@
GetVisibleClassesList: function() { return ["class3", "class4"]; },
GetRank: function() { return "foo"; },
GetSelectionGroupName: function() { return "Selection Group Name"; },
- HasClass: function() { return true; }
+ HasClass: function() { return true; },
+ IsUndeletable: function() { return false; }
});
AddMock(10, IID_Position, {
@@ -614,7 +614,8 @@
rank: "foo",
classes: ["class1", "class2"],
visibleClasses: ["class3", "class4"],
- selectionGroupName: "Selection Group Name"
+ selectionGroupName: "Selection Group Name",
+ canDelete: true
},
fogging: null,
foundation: null,
@@ -637,8 +638,7 @@
hitpoints: 50,
maxHitpoints: 60,
needsRepair: false,
- needsHeal: true,
- canDelete: true
+ needsHeal: true
});
TS_ASSERT_UNEVAL_EQUALS(cmp.GetExtendedEntityState(-1, 10), {
Index: ps/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
===================================================================
--- ps/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
+++ ps/trunk/binaries/data/mods/public/simulation/helpers/Commands.js
@@ -386,10 +386,10 @@
{
for (let ent of data.entities)
{
- let cmpHealth = QueryMiragedInterface(ent, IID_Health);
if (!data.controlAllUnits)
{
- if (cmpHealth && cmpHealth.IsUndeletable())
+ let cmpIdentity = Engine.QueryInterface(ent, IID_Identity);
+ if (cmpIdentity && cmpIdentity.IsUndeletable())
continue;
let cmpCapturable = QueryMiragedInterface(ent, IID_Capturable);
@@ -412,8 +412,11 @@
Engine.DestroyEntity(cmpMirage.parent);
Engine.DestroyEntity(ent);
+ continue;
}
- else if (cmpHealth)
+
+ let cmpHealth = Engine.QueryInterface(ent, IID_Health);
+ if (cmpHealth)
cmpHealth.Kill();
else
Engine.DestroyEntity(ent);
Index: ps/trunk/binaries/data/mods/public/simulation/templates/special/filter/mirage.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/simulation/templates/special/filter/mirage.xml
+++ ps/trunk/binaries/data/mods/public/simulation/templates/special/filter/mirage.xml
@@ -8,6 +8,7 @@
+
Index: ps/trunk/binaries/data/mods/public/simulation/templates/special/filter/undeletable.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/simulation/templates/special/filter/undeletable.xml
+++ ps/trunk/binaries/data/mods/public/simulation/templates/special/filter/undeletable.xml
@@ -0,0 +1,6 @@
+
+
+
+ true
+
+
Index: ps/trunk/binaries/data/mods/public/simulation/templates/special/player.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/simulation/templates/special/player.xml
+++ ps/trunk/binaries/data/mods/public/simulation/templates/special/player.xml
@@ -56,6 +56,7 @@
Player
Player
+ true
Index: ps/trunk/binaries/data/mods/public/simulation/templates/special/spy.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/simulation/templates/special/spy.xml
+++ ps/trunk/binaries/data/mods/public/simulation/templates/special/spy.xml
@@ -16,6 +16,7 @@
Spy
Spy
unlock_spies
+ true
false
Index: ps/trunk/binaries/data/mods/public/simulation/templates/template_gaia.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/simulation/templates/template_gaia.xml
+++ ps/trunk/binaries/data/mods/public/simulation/templates/template_gaia.xml
@@ -4,6 +4,7 @@
gaia
Gaia
+ true
true
Index: ps/trunk/binaries/data/mods/public/simulation/templates/template_structure.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/simulation/templates/template_structure.xml
+++ ps/trunk/binaries/data/mods/public/simulation/templates/template_structure.xml
@@ -53,12 +53,12 @@
corpse
0
0
- false
true
Structure
Structure ConquestCritical
+ false
0
Index: ps/trunk/binaries/data/mods/public/simulation/templates/template_structure_defense_wallset.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/simulation/templates/template_structure_defense_wallset.xml
+++ ps/trunk/binaries/data/mods/public/simulation/templates/template_structure_defense_wallset.xml
@@ -10,6 +10,7 @@
City Wall
Wall off your town for a stout defense.
phase_town
+ true
0.85
Index: ps/trunk/binaries/data/mods/public/simulation/templates/template_structure_gaia_settlement.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/simulation/templates/template_structure_gaia_settlement.xml
+++ ps/trunk/binaries/data/mods/public/simulation/templates/template_structure_gaia_settlement.xml
@@ -10,6 +10,7 @@
Settlement
Build a Civic Center at this location to expand your territory.
gaia/special_settlement.png
+ true
settlement
Index: ps/trunk/binaries/data/mods/public/simulation/templates/template_unit.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/simulation/templates/template_unit.xml
+++ ps/trunk/binaries/data/mods/public/simulation/templates/template_unit.xml
@@ -34,7 +34,6 @@
100
0
0
- false
false
@@ -50,6 +49,7 @@
special/formations/flank
special/formations/battle_line
+ false
Index: ps/trunk/binaries/data/mods/public/simulation/templates/template_unit_catafalque.xml
===================================================================
--- ps/trunk/binaries/data/mods/public/simulation/templates/template_unit_catafalque.xml
+++ ps/trunk/binaries/data/mods/public/simulation/templates/template_unit_catafalque.xml
@@ -10,9 +10,6 @@
2.0
-
- true
-
gaia
-ConquestCritical
@@ -21,6 +18,7 @@
units/catafalque.png
template_unit_catafalque
A catafalque that holds the remains of a great leader.
+ true
Relic