Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/ai/petra/navalManager.js
Show First 20 Lines • Show All 253 Lines • ▼ Show 20 Lines | |||||
m.NavalManager.prototype.checkEvents = function(gameState, queues, events) | m.NavalManager.prototype.checkEvents = function(gameState, queues, events) | ||||
{ | { | ||||
for (let evt of events.Create) | for (let evt of events.Create) | ||||
{ | { | ||||
if (!evt.entity) | if (!evt.entity) | ||||
continue; | continue; | ||||
let ent = gameState.getEntityById(evt.entity); | let ent = gameState.getEntityById(evt.entity); | ||||
if (ent && ent.isOwn(PlayerID) && ent.foundationProgress() !== undefined && (ent.hasClass("Dock") || ent.hasClass("Shipyard"))) | if (ent && ent.isOwn(PlayerID) && ent.foundationProgress() !== undefined && MatchesClassList(ent.classes(), ["Dock", "Shipyard"])) | ||||
Silier: redundant () | |||||
m.setSeaAccess(gameState, ent); | m.setSeaAccess(gameState, ent); | ||||
} | } | ||||
for (let evt of events.TrainingFinished) | for (let evt of events.TrainingFinished) | ||||
{ | { | ||||
if (!evt.entities) | if (!evt.entities) | ||||
continue; | continue; | ||||
for (let entId of evt.entities) | for (let entId of evt.entities) | ||||
▲ Show 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | for (let evt of events.Destroy) | ||||
} | } | ||||
} | } | ||||
for (let evt of events.OwnershipChanged) // capture events | for (let evt of events.OwnershipChanged) // capture events | ||||
{ | { | ||||
if (evt.to !== PlayerID) | if (evt.to !== PlayerID) | ||||
continue; | continue; | ||||
let ent = gameState.getEntityById(evt.entity); | let ent = gameState.getEntityById(evt.entity); | ||||
if (ent && (ent.hasClass("Dock") || ent.hasClass("Shipyard"))) | if (ent && MatchesClassList(ent.classes(), ["Dock", "Shipyard"])) | ||||
Done Inline Actionsredundant () Silier: redundant () | |||||
m.setSeaAccess(gameState, ent); | m.setSeaAccess(gameState, ent); | ||||
} | } | ||||
}; | }; | ||||
m.NavalManager.prototype.getPlan = function(ID) | m.NavalManager.prototype.getPlan = function(ID) | ||||
{ | { | ||||
for (let plan of this.transportPlans) | for (let plan of this.transportPlans) | ||||
▲ Show 20 Lines • Show All 559 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
redundant ()