Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/components/TerritoryDecay.js
Show All 17 Lines | |||||
TerritoryDecay.prototype.Init = function() | TerritoryDecay.prototype.Init = function() | ||||
{ | { | ||||
this.decaying = false; | this.decaying = false; | ||||
this.connectedNeighbours = new Array(Engine.QueryInterface(SYSTEM_ENTITY, IID_PlayerManager).GetNumPlayers()).fill(0); | this.connectedNeighbours = new Array(Engine.QueryInterface(SYSTEM_ENTITY, IID_PlayerManager).GetNumPlayers()).fill(0); | ||||
this.territoryOwnership = !isFinite(+this.template.DecayRate); | this.territoryOwnership = !isFinite(+this.template.DecayRate); | ||||
}; | }; | ||||
TerritoryDecay.prototype.Update = function(newTemplate) { | |||||
this.template = newTemplate; | |||||
this.territoryOwnership = !isFinite(+this.template.DecayRate); | |||||
this.UpdateDecayState(); | |||||
} | |||||
TerritoryDecay.prototype.IsConnected = function() | TerritoryDecay.prototype.IsConnected = function() | ||||
{ | { | ||||
this.connectedNeighbours.fill(0); | this.connectedNeighbours.fill(0); | ||||
var cmpPosition = Engine.QueryInterface(this.entity, IID_Position); | var cmpPosition = Engine.QueryInterface(this.entity, IID_Position); | ||||
if (!cmpPosition || !cmpPosition.IsInWorld()) | if (!cmpPosition || !cmpPosition.IsInWorld()) | ||||
return false; | return false; | ||||
▲ Show 20 Lines • Show All 138 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator