Index: ps/trunk/binaries/data/mods/public/simulation/components/TerritoryDecay.js =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/components/TerritoryDecay.js +++ ps/trunk/binaries/data/mods/public/simulation/components/TerritoryDecay.js @@ -1,9 +1,20 @@ function TerritoryDecay() {} -TerritoryDecay.prototype.Schema = - "" + - "Infinity" + - ""; +TerritoryDecay.prototype.Schema = ` + + Infinity + + + + + + neutral + enemy + + + + + `; TerritoryDecay.prototype.Init = function() { @@ -24,25 +35,29 @@ if (!cmpPlayer) return true;// something without ownership can't decay + const decayTerritory = ApplyValueModificationsToEntity("TerritoryDecay/Territory", this.template.Territory, this.entity); + var cmpTerritoryManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_TerritoryManager); var pos = cmpPosition.GetPosition2D(); var tileOwner = cmpTerritoryManager.GetOwner(pos.x, pos.y); if (tileOwner == 0) { this.connectedNeighbours[0] = 1; - return cmpPlayer.GetPlayerID() == 0; // Gaia building on gaia ground -> don't decay + return cmpPlayer.GetPlayerID() == 0 || decayTerritory.indexOf("neutral") === -1; } var tileConnected = cmpTerritoryManager.IsConnected(pos.x, pos.y); if (tileConnected && !cmpPlayer.IsMutualAlly(tileOwner)) { this.connectedNeighbours[tileOwner] = 1; - return false; + return decayTerritory.indexOf("enemy") === -1; } if (tileConnected) return true; + // Special-case: if the tile is unconnected, non-own territory, decay towards gaia. + // TODO: this is not great, see #4749 if (cmpPlayer.GetPlayerID() != tileOwner) { this.connectedNeighbours[0] = 1; 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 @@ -159,6 +159,7 @@ 20 + neutral enemy true Index: ps/trunk/binaries/data/mods/public/simulation/templates/template_territory_pull.xml =================================================================== --- ps/trunk/binaries/data/mods/public/simulation/templates/template_territory_pull.xml +++ ps/trunk/binaries/data/mods/public/simulation/templates/template_territory_pull.xml @@ -24,6 +24,7 @@ 5 + neutral enemy false