diff --git a/binaries/data/mods/public/gui/session/unit_actions.js b/binaries/data/mods/public/gui/session/unit_actions.js
index 9f11d2cf69..ca3c0742a5 100644
--- a/binaries/data/mods/public/gui/session/unit_actions.js
+++ b/binaries/data/mods/public/gui/session/unit_actions.js
@@ -1440,7 +1440,7 @@ function isUndeletable(entState)
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;
diff --git a/binaries/data/mods/public/maps/random/survivalofthefittest.js b/binaries/data/mods/public/maps/random/survivalofthefittest.js
index 07e04c8992..3dcb77a144 100644
--- a/binaries/data/mods/public/maps/random/survivalofthefittest.js
+++ b/binaries/data/mods/public/maps/random/survivalofthefittest.js
@@ -30,7 +30,7 @@ const aWaypointFlag = "actor|props/special/common/waypoint_flag.xml";
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 = [
diff --git a/binaries/data/mods/public/maps/random/survivalofthefittest_triggers.js b/binaries/data/mods/public/maps/random/survivalofthefittest_triggers.js
index 8f6df15368..20035bf236 100644
--- a/binaries/data/mods/public/maps/random/survivalofthefittest_triggers.js
+++ b/binaries/data/mods/public/maps/random/survivalofthefittest_triggers.js
@@ -178,9 +178,6 @@ Trigger.prototype.InitStartingUnits = function()
let cmpDamageReceiver = Engine.QueryInterface(entity, IID_DamageReceiver);
cmpDamageReceiver.SetInvulnerability(true);
-
- let cmpHealth = Engine.QueryInterface(entity, IID_Health);
- cmpHealth.SetUndeletable(true);
}
}
}
diff --git a/binaries/data/mods/public/simulation/components/GuiInterface.js b/binaries/data/mods/public/simulation/components/GuiInterface.js
index 960c3a2152..9c399ff356 100644
--- a/binaries/data/mods/public/simulation/components/GuiInterface.js
+++ b/binaries/data/mods/public/simulation/components/GuiInterface.js
@@ -277,7 +277,8 @@ GuiInterface.prototype.GetEntityState = function(player, ent)
"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 @@ GuiInterface.prototype.GetEntityState = function(player, ent)
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);
diff --git a/binaries/data/mods/public/simulation/components/Health.js b/binaries/data/mods/public/simulation/components/Health.js
index 76607ca47a..79e697b7e3 100644
--- a/binaries/data/mods/public/simulation/components/Health.js
+++ b/binaries/data/mods/public/simulation/components/Health.js
@@ -47,9 +47,6 @@ Health.prototype.Schema =
"" +
"" +
"" +
- "" +
- "" +
- "" +
"" +
"" +
"";
@@ -63,7 +60,6 @@ Health.prototype.Init = function()
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 @@ Health.prototype.IsUnhealable = function()
|| 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;
diff --git a/binaries/data/mods/public/simulation/components/Identity.js b/binaries/data/mods/public/simulation/components/Identity.js
index 2e6de386a0..5421fe442b 100644
--- a/binaries/data/mods/public/simulation/components/Identity.js
+++ b/binaries/data/mods/public/simulation/components/Identity.js
@@ -86,8 +86,10 @@ Identity.prototype.Schema =
"" +
"" +
"" +
- "";
-
+ "" +
+ "" +
+ "" +
+ "";
Identity.prototype.Init = function()
{
@@ -159,4 +161,9 @@ Identity.prototype.GetGenericName = function()
return this.template.GenericName;
};
+Identity.prototype.IsUndeletable = function()
+{
+ return this.template.Undeletable == "true";
+};
+
Engine.RegisterComponentType(IID_Identity, "Identity", Identity);
diff --git a/binaries/data/mods/public/simulation/components/Mirage.js b/binaries/data/mods/public/simulation/components/Mirage.js
index c59ff604f4..d478b2caa2 100644
--- a/binaries/data/mods/public/simulation/components/Mirage.js
+++ b/binaries/data/mods/public/simulation/components/Mirage.js
@@ -15,6 +15,8 @@ Mirage.prototype.Init = function()
this.miragedIids = new Set();
+ this.classesList = [];
+
this.buildPercentage = 0;
this.numBuilders = 0;
@@ -22,7 +24,6 @@ Mirage.prototype.Init = function()
this.hitpoints = null;
this.repairable = null;
this.unhealable = null;
- this.undeletable = null;
this.capturePoints = [];
this.maxCapturePoints = 0;
@@ -92,14 +93,12 @@ Mirage.prototype.CopyHealth = function(cmpHealth)
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
diff --git a/binaries/data/mods/public/simulation/components/SkirmishReplacer.js b/binaries/data/mods/public/simulation/components/SkirmishReplacer.js
index ebec3871b2..4f2db51dc8 100644
--- a/binaries/data/mods/public/simulation/components/SkirmishReplacer.js
+++ b/binaries/data/mods/public/simulation/components/SkirmishReplacer.js
@@ -40,6 +40,15 @@ SkirmishReplacer.prototype.ReplaceEntities = function()
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 @@ SkirmishReplacer.prototype.ReplaceEntities = function()
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);
diff --git a/binaries/data/mods/public/simulation/components/tests/test_GuiInterface.js b/binaries/data/mods/public/simulation/components/tests/test_GuiInterface.js
index 9d632f1870..ec464bf1c3 100644
--- a/binaries/data/mods/public/simulation/components/tests/test_GuiInterface.js
+++ b/binaries/data/mods/public/simulation/components/tests/test_GuiInterface.js
@@ -566,8 +566,7 @@ AddMock(10, IID_Health, {
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 @@ AddMock(10, IID_Identity, {
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 @@ TS_ASSERT_UNEVAL_EQUALS(cmp.GetEntityState(-1, 10), {
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 @@ TS_ASSERT_UNEVAL_EQUALS(cmp.GetEntityState(-1, 10), {
hitpoints: 50,
maxHitpoints: 60,
needsRepair: false,
- needsHeal: true,
- canDelete: true
+ needsHeal: true
});
TS_ASSERT_UNEVAL_EQUALS(cmp.GetExtendedEntityState(-1, 10), {
diff --git a/binaries/data/mods/public/simulation/helpers/Commands.js b/binaries/data/mods/public/simulation/helpers/Commands.js
index 08837d8e67..ba8d1f913b 100644
--- a/binaries/data/mods/public/simulation/helpers/Commands.js
+++ b/binaries/data/mods/public/simulation/helpers/Commands.js
@@ -386,10 +386,10 @@ var g_Commands = {
{
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 @@ var g_Commands = {
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);
diff --git a/binaries/data/mods/public/simulation/templates/special/filter/mirage.xml b/binaries/data/mods/public/simulation/templates/special/filter/mirage.xml
index fc2854bd38..282a96e5dc 100644
--- a/binaries/data/mods/public/simulation/templates/special/filter/mirage.xml
+++ b/binaries/data/mods/public/simulation/templates/special/filter/mirage.xml
@@ -8,6 +8,7 @@
+
diff --git a/binaries/data/mods/public/simulation/templates/special/filter/undeletable.xml b/binaries/data/mods/public/simulation/templates/special/filter/undeletable.xml
new file mode 100644
index 0000000000..0dcd6d215e
--- /dev/null
+++ b/binaries/data/mods/public/simulation/templates/special/filter/undeletable.xml
@@ -0,0 +1,6 @@
+
+
+
+ true
+
+
diff --git a/binaries/data/mods/public/simulation/templates/special/player.xml b/binaries/data/mods/public/simulation/templates/special/player.xml
index 43d8e10a40..fff76b5ce7 100644
--- a/binaries/data/mods/public/simulation/templates/special/player.xml
+++ b/binaries/data/mods/public/simulation/templates/special/player.xml
@@ -56,6 +56,7 @@
Player
Player
+ true
diff --git a/binaries/data/mods/public/simulation/templates/special/spy.xml b/binaries/data/mods/public/simulation/templates/special/spy.xml
index 44fe9aa1d7..246a9091cf 100644
--- a/binaries/data/mods/public/simulation/templates/special/spy.xml
+++ b/binaries/data/mods/public/simulation/templates/special/spy.xml
@@ -16,6 +16,7 @@
Spy
Spy
unlock_spies
+ true
false
diff --git a/binaries/data/mods/public/simulation/templates/template_gaia.xml b/binaries/data/mods/public/simulation/templates/template_gaia.xml
index ce21e96107..050ceff6d7 100644
--- a/binaries/data/mods/public/simulation/templates/template_gaia.xml
+++ b/binaries/data/mods/public/simulation/templates/template_gaia.xml
@@ -4,6 +4,7 @@
gaia
Gaia
+ true
true
diff --git a/binaries/data/mods/public/simulation/templates/template_structure.xml b/binaries/data/mods/public/simulation/templates/template_structure.xml
index a7503ef34d..8dce374927 100644
--- a/binaries/data/mods/public/simulation/templates/template_structure.xml
+++ b/binaries/data/mods/public/simulation/templates/template_structure.xml
@@ -53,12 +53,12 @@
corpse
0
0
- false
true
Structure
Structure ConquestCritical
+ false
0
diff --git a/binaries/data/mods/public/simulation/templates/template_structure_defense_wallset.xml b/binaries/data/mods/public/simulation/templates/template_structure_defense_wallset.xml
index fb8409128d..01dd36cf6c 100644
--- a/binaries/data/mods/public/simulation/templates/template_structure_defense_wallset.xml
+++ b/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
diff --git a/binaries/data/mods/public/simulation/templates/template_structure_gaia_settlement.xml b/binaries/data/mods/public/simulation/templates/template_structure_gaia_settlement.xml
index 7c481d10b6..b144df4a45 100644
--- a/binaries/data/mods/public/simulation/templates/template_structure_gaia_settlement.xml
+++ b/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
diff --git a/binaries/data/mods/public/simulation/templates/template_unit.xml b/binaries/data/mods/public/simulation/templates/template_unit.xml
index d8b1748246..4f824b6b89 100644
--- a/binaries/data/mods/public/simulation/templates/template_unit.xml
+++ b/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
diff --git a/binaries/data/mods/public/simulation/templates/template_unit_catafalque.xml b/binaries/data/mods/public/simulation/templates/template_unit_catafalque.xml
index 57b3433a2e..8b58f1b497 100644
--- a/binaries/data/mods/public/simulation/templates/template_unit_catafalque.xml
+++ b/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