Changeset View
Changeset View
Standalone View
Standalone View
binaries/data/mods/public/simulation/ai/petra/transportPlan.js
var PETRA = function(m) | (function(m) | ||||
{ | { | ||||
/** | /** | ||||
* Describes a transport plan | * Describes a transport plan | ||||
* Constructor assign units (units is an ID array), a destination (position). | * Constructor assign units (units is an ID array), a destination (position). | ||||
* The naval manager will try to deal with it accordingly. | * The naval manager will try to deal with it accordingly. | ||||
* | * | ||||
* By this I mean that the naval manager will find how to go from access point 1 to access point 2 | * By this I mean that the naval manager will find how to go from access point 1 to access point 2 | ||||
▲ Show 20 Lines • Show All 225 Lines • ▼ Show 20 Lines | m.TransportPlan.prototype.releaseAll = function() | ||||
for (let ship of this.ships.values()) | for (let ship of this.ships.values()) | ||||
this.releaseShip(ship); | this.releaseShip(ship); | ||||
for (let ent of this.units.values()) | for (let ent of this.units.values()) | ||||
{ | { | ||||
ent.setMetadata(PlayerID, "endPos", undefined); | ent.setMetadata(PlayerID, "endPos", undefined); | ||||
ent.setMetadata(PlayerID, "onBoard", undefined); | ent.setMetadata(PlayerID, "onBoard", undefined); | ||||
ent.setMetadata(PlayerID, "transport", undefined); | ent.setMetadata(PlayerID, "transport", undefined); | ||||
// TODO if the index of the endPos of the entity is !=, | // TODO if the index of the endPos of the entity is !=, | ||||
// require again another transport (we could need land-sea-land-sea-land) | // require again another transport (we could need land-sea-land-sea-land) | ||||
} | } | ||||
this.transportShips.unregister(); | this.transportShips.unregister(); | ||||
this.ships.unregister(); | this.ships.unregister(); | ||||
this.units.unregister(); | this.units.unregister(); | ||||
}; | }; | ||||
▲ Show 20 Lines • Show All 468 Lines • ▼ Show 20 Lines | |||||
m.TransportPlan.prototype.Deserialize = function(data) | m.TransportPlan.prototype.Deserialize = function(data) | ||||
{ | { | ||||
for (let key in data) | for (let key in data) | ||||
this[key] = data[key]; | this[key] = data[key]; | ||||
this.failed = false; | this.failed = false; | ||||
}; | }; | ||||
return m; | }(PETRA)); | ||||
}(PETRA); |
Wildfire Games · Phabricator