@shipload/sdk 1.0.0-next.10 → 1.0.0-next.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/shipload.d.ts +98 -25
- package/lib/shipload.js +318 -27
- package/lib/shipload.js.map +1 -1
- package/lib/shipload.m.js +302 -17
- package/lib/shipload.m.js.map +1 -1
- package/package.json +1 -1
- package/src/data/entities.json +13 -0
- package/src/data/item-ids.ts +1 -0
- package/src/data/items.json +6 -0
- package/src/data/metadata.ts +6 -0
- package/src/data/recipes.json +57 -0
- package/src/entities/container.ts +2 -2
- package/src/entities/extractor.ts +2 -2
- package/src/entities/factory.ts +135 -0
- package/src/entities/makers.ts +59 -0
- package/src/entities/nexus.ts +29 -0
- package/src/entities/ship.ts +2 -2
- package/src/entities/warehouse.ts +2 -2
- package/src/errors.ts +10 -13
- package/src/index-module.ts +15 -1
- package/src/managers/entities.ts +38 -4
- package/src/nft/atomicdata.ts +3 -0
- package/src/scheduling/projection.ts +2 -2
- package/src/subscriptions/manager.ts +3 -2
- package/src/subscriptions/mappers.ts +5 -1
- package/src/subscriptions/types.ts +2 -2
- package/src/types/entity-traits.ts +40 -1
package/lib/shipload.m.js
CHANGED
|
@@ -2169,15 +2169,15 @@ const PLAYER_ALREADY_JOINED = 'Player has already joined the game.';
|
|
|
2169
2169
|
const PLAYER_NOT_JOINED = 'Player has not joined the game.';
|
|
2170
2170
|
const PLAYER_NOT_FOUND = 'Cannot find player for given account name.';
|
|
2171
2171
|
const STARTER_ALREADY_CLAIMED = 'Starter ship already claimed; destroy existing ships to re-claim.';
|
|
2172
|
-
const
|
|
2172
|
+
const ENTITY_ALREADY_THERE = 'Entity cannot travel to the location it is already at.';
|
|
2173
2173
|
const SHIP_ALREADY_TRAVELING = 'Ship is already traveling.';
|
|
2174
2174
|
const SHIP_CANNOT_BUY_TRAVELING = 'Ship cannot buy goods while traveling.';
|
|
2175
2175
|
const SHIP_CANNOT_UPDATE_TRAVELING = 'Ship cannot be updated while traveling.';
|
|
2176
|
-
const
|
|
2177
|
-
const
|
|
2176
|
+
const ENTITY_INVALID_DESTINATION = 'Cannot travel: no system at specified destination.';
|
|
2177
|
+
const ENTITY_INVALID_TRAVEL_DURATION = 'This trip cannot be made as it would exceed the maximum travel duration.';
|
|
2178
2178
|
const SHIP_NOT_ARRIVED = 'Ship has not yet arrived at its destination.';
|
|
2179
|
-
const
|
|
2180
|
-
const
|
|
2179
|
+
const ENTITY_NOT_ENOUGH_ENERGY = 'Entity does not have enough energy to travel to the destination.';
|
|
2180
|
+
const ENTITY_NOT_ENOUGH_ENERGY_CAPACITY = 'Entity does not have enough energy capacity to travel.';
|
|
2181
2181
|
const SHIP_NOT_FOUND = 'Cannot find ship for given account.';
|
|
2182
2182
|
const SHIP_NOT_OWNED = 'Ship is not owned by this account.';
|
|
2183
2183
|
const NO_SCHEDULE = 'No scheduled tasks.';
|
|
@@ -2186,16 +2186,13 @@ const SHIP_NO_COMPLETED_TASKS = 'No completed tasks to resolve.';
|
|
|
2186
2186
|
const RESOLVE_COUNT_EXCEEDS_COMPLETED = 'Requested resolve count exceeds completed tasks.';
|
|
2187
2187
|
const SHIP_CANNOT_CANCEL_TASK = 'Cannot cancel task that is immutable or in progress.';
|
|
2188
2188
|
const SHIP_NO_TASKS_TO_CANCEL = 'No tasks to cancel.';
|
|
2189
|
-
const
|
|
2190
|
-
const
|
|
2191
|
-
const
|
|
2192
|
-
const SHIP_CAPACITY_EXCEEDED = 'Ship cargo capacity would be exceeded.';
|
|
2189
|
+
const ENTITY_INVALID_CARGO = 'Invalid cargo specified for load/unload.';
|
|
2190
|
+
const ENTITY_CARGO_NOT_OWNED = 'Cannot load cargo that is not owned.';
|
|
2191
|
+
const ENTITY_CARGO_NOT_LOADED = 'Cannot unload cargo that is not loaded.';
|
|
2193
2192
|
const ENTITY_CAPACITY_EXCEEDED = 'Entity cargo capacity would be exceeded.';
|
|
2194
2193
|
const WAREHOUSE_NOT_FOUND = 'Cannot find warehouse for given id.';
|
|
2195
2194
|
const WAREHOUSE_ALREADY_AT_LOCATION = 'Warehouse already exists at this location.';
|
|
2196
|
-
const WAREHOUSE_CAPACITY_EXCEEDED = 'Warehouse capacity would be exceeded.';
|
|
2197
2195
|
const CONTAINER_NOT_FOUND = 'Cannot find container for given id.';
|
|
2198
|
-
const CONTAINER_CAPACITY_EXCEEDED = 'Container capacity would be exceeded.';
|
|
2199
2196
|
const DESTINATION_CAPACITY_EXCEEDED = 'Destination entity does not have enough capacity for the gather.';
|
|
2200
2197
|
const CANCEL_PAIRED_HAS_PENDING = 'Cannot cancel transfer, paired entity has pending tasks.';
|
|
2201
2198
|
const GROUP_EMPTY = 'Group travel requires at least one entity.';
|
|
@@ -2403,6 +2400,7 @@ const ITEM_CONTAINER_T1_PACKED = 10200;
|
|
|
2403
2400
|
const ITEM_SHIP_T1_PACKED = 10201;
|
|
2404
2401
|
const ITEM_WAREHOUSE_T1_PACKED = 10202;
|
|
2405
2402
|
const ITEM_EXTRACTOR_T1_PACKED = 10203;
|
|
2403
|
+
const ITEM_FACTORY_T1_PACKED = 10204;
|
|
2406
2404
|
const ITEM_HULL_PLATES_T2 = 20001;
|
|
2407
2405
|
const ITEM_CARGO_LINING_T2 = 20002;
|
|
2408
2406
|
const ITEM_CONTAINER_T2_PACKED = 20200;
|
|
@@ -2898,6 +2896,12 @@ var items = [
|
|
|
2898
2896
|
type: "entity",
|
|
2899
2897
|
tier: 1
|
|
2900
2898
|
},
|
|
2899
|
+
{
|
|
2900
|
+
id: 10204,
|
|
2901
|
+
mass: 800000,
|
|
2902
|
+
type: "entity",
|
|
2903
|
+
tier: 1
|
|
2904
|
+
},
|
|
2901
2905
|
{
|
|
2902
2906
|
id: 20001,
|
|
2903
2907
|
mass: 50000,
|
|
@@ -3744,6 +3748,64 @@ var recipes = [
|
|
|
3744
3748
|
blendWeights: [
|
|
3745
3749
|
]
|
|
3746
3750
|
},
|
|
3751
|
+
{
|
|
3752
|
+
outputItemId: 10204,
|
|
3753
|
+
outputMass: 800000,
|
|
3754
|
+
inputs: [
|
|
3755
|
+
{
|
|
3756
|
+
itemId: 10001,
|
|
3757
|
+
quantity: 15
|
|
3758
|
+
},
|
|
3759
|
+
{
|
|
3760
|
+
itemId: 10002,
|
|
3761
|
+
quantity: 6
|
|
3762
|
+
},
|
|
3763
|
+
{
|
|
3764
|
+
itemId: 10008,
|
|
3765
|
+
quantity: 4
|
|
3766
|
+
},
|
|
3767
|
+
{
|
|
3768
|
+
itemId: 10009,
|
|
3769
|
+
quantity: 4
|
|
3770
|
+
}
|
|
3771
|
+
],
|
|
3772
|
+
statSlots: [
|
|
3773
|
+
{
|
|
3774
|
+
sources: [
|
|
3775
|
+
{
|
|
3776
|
+
inputIndex: 0,
|
|
3777
|
+
statIndex: 0
|
|
3778
|
+
}
|
|
3779
|
+
]
|
|
3780
|
+
},
|
|
3781
|
+
{
|
|
3782
|
+
sources: [
|
|
3783
|
+
{
|
|
3784
|
+
inputIndex: 0,
|
|
3785
|
+
statIndex: 1
|
|
3786
|
+
}
|
|
3787
|
+
]
|
|
3788
|
+
},
|
|
3789
|
+
{
|
|
3790
|
+
sources: [
|
|
3791
|
+
{
|
|
3792
|
+
inputIndex: 1,
|
|
3793
|
+
statIndex: 0
|
|
3794
|
+
}
|
|
3795
|
+
]
|
|
3796
|
+
},
|
|
3797
|
+
{
|
|
3798
|
+
sources: [
|
|
3799
|
+
{
|
|
3800
|
+
inputIndex: 1,
|
|
3801
|
+
statIndex: 1
|
|
3802
|
+
}
|
|
3803
|
+
]
|
|
3804
|
+
}
|
|
3805
|
+
],
|
|
3806
|
+
blendWeights: [
|
|
3807
|
+
]
|
|
3808
|
+
},
|
|
3747
3809
|
{
|
|
3748
3810
|
outputItemId: 20001,
|
|
3749
3811
|
outputMass: 50000,
|
|
@@ -3961,6 +4023,19 @@ var entities = [
|
|
|
3961
4023
|
}
|
|
3962
4024
|
]
|
|
3963
4025
|
},
|
|
4026
|
+
{
|
|
4027
|
+
entityItemId: 10204,
|
|
4028
|
+
slots: [
|
|
4029
|
+
{
|
|
4030
|
+
type: "generator",
|
|
4031
|
+
outputPct: 100
|
|
4032
|
+
},
|
|
4033
|
+
{
|
|
4034
|
+
type: "crafter",
|
|
4035
|
+
outputPct: 100
|
|
4036
|
+
}
|
|
4037
|
+
]
|
|
4038
|
+
},
|
|
3964
4039
|
{
|
|
3965
4040
|
entityItemId: 20200,
|
|
3966
4041
|
slots: [
|
|
@@ -4165,6 +4240,11 @@ const itemMetadata = {
|
|
|
4165
4240
|
description: 'Planetary resource extraction facility with generator and gatherer module slots.',
|
|
4166
4241
|
color: '#D4726F',
|
|
4167
4242
|
},
|
|
4243
|
+
10204: {
|
|
4244
|
+
name: 'Factory',
|
|
4245
|
+
description: 'Planetary fabrication facility with generator and crafter module slots.',
|
|
4246
|
+
color: '#7BA7D4',
|
|
4247
|
+
},
|
|
4168
4248
|
20001: {
|
|
4169
4249
|
name: 'Hull Plates',
|
|
4170
4250
|
description: 'Advanced structural plating reinforced with tier 2 ore.',
|
|
@@ -4185,6 +4265,7 @@ const entityMetadata = {
|
|
|
4185
4265
|
10201: { moduleSlotLabels: ['Engine', 'Generator', 'Gatherer', 'Loader', 'Storage'] },
|
|
4186
4266
|
10202: { moduleSlotLabels: ['Loader', 'Storage', 'Storage', 'Storage', 'Storage'] },
|
|
4187
4267
|
10203: { moduleSlotLabels: ['Generator', 'Gatherer'] },
|
|
4268
|
+
10204: { moduleSlotLabels: ['Generator', 'Crafter'] },
|
|
4188
4269
|
};
|
|
4189
4270
|
for (const item of items) {
|
|
4190
4271
|
if (!itemMetadata[item.id]) {
|
|
@@ -7832,7 +7913,7 @@ function validateCraftTask(task, projected) {
|
|
|
7832
7913
|
}
|
|
7833
7914
|
}
|
|
7834
7915
|
if (!found)
|
|
7835
|
-
throw new Error(
|
|
7916
|
+
throw new Error(ENTITY_CARGO_NOT_LOADED);
|
|
7836
7917
|
}
|
|
7837
7918
|
}
|
|
7838
7919
|
function validateSchedule(entity) {
|
|
@@ -8092,7 +8173,7 @@ class Ship extends Types.entity_info {
|
|
|
8092
8173
|
return this.entity_name;
|
|
8093
8174
|
}
|
|
8094
8175
|
get entityClass() {
|
|
8095
|
-
return '
|
|
8176
|
+
return 'orbital';
|
|
8096
8177
|
}
|
|
8097
8178
|
get canUndeploy() {
|
|
8098
8179
|
return true;
|
|
@@ -9039,7 +9120,7 @@ class Warehouse extends Types.entity_info {
|
|
|
9039
9120
|
return this.entity_name;
|
|
9040
9121
|
}
|
|
9041
9122
|
get entityClass() {
|
|
9042
|
-
return '
|
|
9123
|
+
return 'planetary';
|
|
9043
9124
|
}
|
|
9044
9125
|
get canDemolish() {
|
|
9045
9126
|
return true;
|
|
@@ -9121,7 +9202,7 @@ class Container extends Types.entity_info {
|
|
|
9121
9202
|
return this.entity_name;
|
|
9122
9203
|
}
|
|
9123
9204
|
get entityClass() {
|
|
9124
|
-
return '
|
|
9205
|
+
return 'orbital';
|
|
9125
9206
|
}
|
|
9126
9207
|
get canUndeploy() {
|
|
9127
9208
|
return true;
|
|
@@ -9195,7 +9276,7 @@ class Extractor extends Types.entity_info {
|
|
|
9195
9276
|
return this.entity_name;
|
|
9196
9277
|
}
|
|
9197
9278
|
get entityClass() {
|
|
9198
|
-
return '
|
|
9279
|
+
return 'planetary';
|
|
9199
9280
|
}
|
|
9200
9281
|
get canDemolish() {
|
|
9201
9282
|
return true;
|
|
@@ -9278,6 +9359,101 @@ function computeExtractorCapabilities(modules, layout) {
|
|
|
9278
9359
|
return out;
|
|
9279
9360
|
}
|
|
9280
9361
|
|
|
9362
|
+
class Factory extends Types.entity_info {
|
|
9363
|
+
get name() {
|
|
9364
|
+
return this.entity_name;
|
|
9365
|
+
}
|
|
9366
|
+
get entityClass() {
|
|
9367
|
+
return 'planetary';
|
|
9368
|
+
}
|
|
9369
|
+
get canDemolish() {
|
|
9370
|
+
return true;
|
|
9371
|
+
}
|
|
9372
|
+
get inv() {
|
|
9373
|
+
this._inv ?? (this._inv = new InventoryAccessor(this));
|
|
9374
|
+
return this._inv;
|
|
9375
|
+
}
|
|
9376
|
+
get inventory() {
|
|
9377
|
+
return this.inv.items;
|
|
9378
|
+
}
|
|
9379
|
+
get sched() {
|
|
9380
|
+
this._sched ?? (this._sched = new ScheduleAccessor(this));
|
|
9381
|
+
return this._sched;
|
|
9382
|
+
}
|
|
9383
|
+
get isIdle() {
|
|
9384
|
+
return this.is_idle;
|
|
9385
|
+
}
|
|
9386
|
+
get location() {
|
|
9387
|
+
return Location.from(this.coordinates);
|
|
9388
|
+
}
|
|
9389
|
+
get totalCargoMass() {
|
|
9390
|
+
return this.inv.totalMass;
|
|
9391
|
+
}
|
|
9392
|
+
get maxCapacity() {
|
|
9393
|
+
return UInt64.from(this.capacity);
|
|
9394
|
+
}
|
|
9395
|
+
get availableCapacity() {
|
|
9396
|
+
const cargo = this.totalCargoMass;
|
|
9397
|
+
return cargo.gte(this.maxCapacity) ? UInt64.from(0) : this.maxCapacity.subtracting(cargo);
|
|
9398
|
+
}
|
|
9399
|
+
get isFull() {
|
|
9400
|
+
return this.totalCargoMass.gte(this.maxCapacity);
|
|
9401
|
+
}
|
|
9402
|
+
get totalMass() {
|
|
9403
|
+
const hull = this.hullmass ? UInt64.from(this.hullmass) : UInt64.from(0);
|
|
9404
|
+
return hull.adding(this.totalCargoMass);
|
|
9405
|
+
}
|
|
9406
|
+
}
|
|
9407
|
+
function computeFactoryCapabilities(modules, layout) {
|
|
9408
|
+
const out = {};
|
|
9409
|
+
const genModules = modules.filter((m) => getModuleCapabilityType(m.itemId) === MODULE_GENERATOR);
|
|
9410
|
+
if (genModules.length > 0) {
|
|
9411
|
+
let totalCapacity = 0;
|
|
9412
|
+
let totalRecharge = 0;
|
|
9413
|
+
for (const m of genModules) {
|
|
9414
|
+
const caps = computeGeneratorCapabilities(decodeCraftedItemStats(m.itemId, m.stats));
|
|
9415
|
+
const amp = getSlotAmp(layout, m.slotIndex);
|
|
9416
|
+
totalCapacity += applySlotMultiplier(caps.capacity, amp);
|
|
9417
|
+
totalRecharge += applySlotMultiplier(caps.recharge, amp);
|
|
9418
|
+
}
|
|
9419
|
+
out.generator = {
|
|
9420
|
+
capacity: clampUint16(totalCapacity),
|
|
9421
|
+
recharge: clampUint16(totalRecharge),
|
|
9422
|
+
};
|
|
9423
|
+
}
|
|
9424
|
+
const crafterModules = modules.filter((m) => getModuleCapabilityType(m.itemId) === MODULE_CRAFTER);
|
|
9425
|
+
if (crafterModules.length > 0) {
|
|
9426
|
+
let totalSpeed = 0;
|
|
9427
|
+
let totalDrain = 0;
|
|
9428
|
+
for (const m of crafterModules) {
|
|
9429
|
+
const caps = computeCrafterCapabilities(decodeCraftedItemStats(m.itemId, m.stats));
|
|
9430
|
+
const amp = getSlotAmp(layout, m.slotIndex);
|
|
9431
|
+
totalSpeed += applySlotMultiplier(caps.speed, amp);
|
|
9432
|
+
totalDrain += caps.drain;
|
|
9433
|
+
}
|
|
9434
|
+
out.crafter = {
|
|
9435
|
+
speed: clampUint16(totalSpeed),
|
|
9436
|
+
drain: totalDrain,
|
|
9437
|
+
};
|
|
9438
|
+
}
|
|
9439
|
+
return out;
|
|
9440
|
+
}
|
|
9441
|
+
|
|
9442
|
+
class Nexus extends Types.entity_info {
|
|
9443
|
+
get name() {
|
|
9444
|
+
return this.entity_name;
|
|
9445
|
+
}
|
|
9446
|
+
get entityClass() {
|
|
9447
|
+
return 'orbital';
|
|
9448
|
+
}
|
|
9449
|
+
get location() {
|
|
9450
|
+
return Location.from(this.coordinates);
|
|
9451
|
+
}
|
|
9452
|
+
get orbitalAltitude() {
|
|
9453
|
+
return this.coordinates.z?.toNumber() || 0;
|
|
9454
|
+
}
|
|
9455
|
+
}
|
|
9456
|
+
|
|
9281
9457
|
class EntitiesManager extends BaseManager {
|
|
9282
9458
|
async getEntity(id) {
|
|
9283
9459
|
const result = await this.server.readonly('getentity', {
|
|
@@ -9315,6 +9491,9 @@ class EntitiesManager extends BaseManager {
|
|
|
9315
9491
|
async getExtractor(id) {
|
|
9316
9492
|
return (await this.getEntity(id));
|
|
9317
9493
|
}
|
|
9494
|
+
async getFactory(id) {
|
|
9495
|
+
return (await this.getEntity(id));
|
|
9496
|
+
}
|
|
9318
9497
|
async getShips(owner) {
|
|
9319
9498
|
return (await this.getEntities(owner, 'ship'));
|
|
9320
9499
|
}
|
|
@@ -9327,6 +9506,9 @@ class EntitiesManager extends BaseManager {
|
|
|
9327
9506
|
async getExtractors(owner) {
|
|
9328
9507
|
return (await this.getEntities(owner, 'extractor'));
|
|
9329
9508
|
}
|
|
9509
|
+
async getFactories(owner) {
|
|
9510
|
+
return (await this.getEntities(owner, 'factory'));
|
|
9511
|
+
}
|
|
9330
9512
|
async getShipSummaries(owner) {
|
|
9331
9513
|
return this.getSummaries(owner, 'ship');
|
|
9332
9514
|
}
|
|
@@ -9339,6 +9521,18 @@ class EntitiesManager extends BaseManager {
|
|
|
9339
9521
|
async getExtractorSummaries(owner) {
|
|
9340
9522
|
return this.getSummaries(owner, 'extractor');
|
|
9341
9523
|
}
|
|
9524
|
+
async getFactorySummaries(owner) {
|
|
9525
|
+
return this.getSummaries(owner, 'factory');
|
|
9526
|
+
}
|
|
9527
|
+
async getNexus(id) {
|
|
9528
|
+
return (await this.getEntity(id));
|
|
9529
|
+
}
|
|
9530
|
+
async getNexuses(owner) {
|
|
9531
|
+
return (await this.getEntities(owner, 'nexus'));
|
|
9532
|
+
}
|
|
9533
|
+
async getNexusSummaries(owner) {
|
|
9534
|
+
return this.getSummaries(owner, 'nexus');
|
|
9535
|
+
}
|
|
9342
9536
|
wrapEntity(entity) {
|
|
9343
9537
|
if (entity.type.equals('ship'))
|
|
9344
9538
|
return new Ship(entity);
|
|
@@ -9346,8 +9540,12 @@ class EntitiesManager extends BaseManager {
|
|
|
9346
9540
|
return new Warehouse(entity);
|
|
9347
9541
|
if (entity.type.equals('extractor'))
|
|
9348
9542
|
return new Extractor(entity);
|
|
9543
|
+
if (entity.type.equals('factory'))
|
|
9544
|
+
return new Factory(entity);
|
|
9349
9545
|
if (entity.type.equals('container'))
|
|
9350
9546
|
return new Container(entity);
|
|
9547
|
+
if (entity.type.equals('nexus'))
|
|
9548
|
+
return new Nexus(entity);
|
|
9351
9549
|
throw new Error(`unknown entity type: ${entity.type}`);
|
|
9352
9550
|
}
|
|
9353
9551
|
resolveOwner(owner) {
|
|
@@ -9798,6 +9996,8 @@ function mapEntity(ei) {
|
|
|
9798
9996
|
return new Warehouse(ei);
|
|
9799
9997
|
if (ei.type.equals('container'))
|
|
9800
9998
|
return new Container(ei);
|
|
9999
|
+
if (ei.type.equals('nexus'))
|
|
10000
|
+
return new Nexus(ei);
|
|
9801
10001
|
throw new Error(`mapEntity: unknown entity type ${ei.type.toString()}`);
|
|
9802
10002
|
}
|
|
9803
10003
|
function parseWireEntity(raw) {
|
|
@@ -10367,6 +10567,42 @@ function makeExtractor(state) {
|
|
|
10367
10567
|
const entityInfo = Types.entity_info.from(info);
|
|
10368
10568
|
return new Extractor(entityInfo);
|
|
10369
10569
|
}
|
|
10570
|
+
function makeFactory(state) {
|
|
10571
|
+
const info = {
|
|
10572
|
+
type: Name.from('factory'),
|
|
10573
|
+
id: UInt64.from(state.id),
|
|
10574
|
+
owner: Name.from(state.owner),
|
|
10575
|
+
entity_name: state.name,
|
|
10576
|
+
coordinates: Types.coordinates.from(state.coordinates),
|
|
10577
|
+
cargomass: UInt32.from(0),
|
|
10578
|
+
cargo: state.cargo || [],
|
|
10579
|
+
is_idle: !state.schedule,
|
|
10580
|
+
current_task_elapsed: UInt32.from(0),
|
|
10581
|
+
current_task_remaining: UInt32.from(0),
|
|
10582
|
+
pending_tasks: [],
|
|
10583
|
+
};
|
|
10584
|
+
if (state.hullmass !== undefined)
|
|
10585
|
+
info.hullmass = UInt32.from(state.hullmass);
|
|
10586
|
+
if (state.energy !== undefined)
|
|
10587
|
+
info.energy = UInt16.from(state.energy);
|
|
10588
|
+
if (state.schedule)
|
|
10589
|
+
info.schedule = state.schedule;
|
|
10590
|
+
if (state.capacity !== undefined)
|
|
10591
|
+
info.capacity = UInt32.from(state.capacity);
|
|
10592
|
+
const moduleEntries = assignModulesToSlots(ITEM_FACTORY_T1_PACKED, state.modules ?? [], 'Factory T1');
|
|
10593
|
+
if (state.modules && state.modules.length > 0) {
|
|
10594
|
+
const layout = getEntityLayout(ITEM_FACTORY_T1_PACKED)?.slots ?? [];
|
|
10595
|
+
const installed = toInstalledModules(moduleEntries);
|
|
10596
|
+
const capabilities = computeFactoryCapabilities(installed, layout);
|
|
10597
|
+
if (capabilities.generator)
|
|
10598
|
+
info.generator = capabilities.generator;
|
|
10599
|
+
if (capabilities.crafter)
|
|
10600
|
+
info.crafter = capabilities.crafter;
|
|
10601
|
+
}
|
|
10602
|
+
info.modules = moduleEntries;
|
|
10603
|
+
const entityInfo = Types.entity_info.from(info);
|
|
10604
|
+
return new Factory(entityInfo);
|
|
10605
|
+
}
|
|
10370
10606
|
function makeContainer(state) {
|
|
10371
10607
|
const entityInfo = Types.entity_info.from({
|
|
10372
10608
|
type: Name.from('container'),
|
|
@@ -10387,6 +10623,23 @@ function makeContainer(state) {
|
|
|
10387
10623
|
});
|
|
10388
10624
|
return new Container(entityInfo);
|
|
10389
10625
|
}
|
|
10626
|
+
function makeNexus(state) {
|
|
10627
|
+
const entityInfo = Types.entity_info.from({
|
|
10628
|
+
type: Name.from('nexus'),
|
|
10629
|
+
id: UInt64.from(state.id),
|
|
10630
|
+
owner: Name.from(state.owner),
|
|
10631
|
+
entity_name: state.name,
|
|
10632
|
+
coordinates: Types.coordinates.from(state.coordinates),
|
|
10633
|
+
cargomass: UInt32.from(0),
|
|
10634
|
+
cargo: [],
|
|
10635
|
+
modules: [],
|
|
10636
|
+
is_idle: true,
|
|
10637
|
+
current_task_elapsed: UInt32.from(0),
|
|
10638
|
+
current_task_remaining: UInt32.from(0),
|
|
10639
|
+
pending_tasks: [],
|
|
10640
|
+
});
|
|
10641
|
+
return new Nexus(entityInfo);
|
|
10642
|
+
}
|
|
10390
10643
|
|
|
10391
10644
|
function totalCargoMass(cargo) {
|
|
10392
10645
|
return cargo.reduce((sum, c) => {
|
|
@@ -10497,7 +10750,9 @@ function taskCargoChanges(task) {
|
|
|
10497
10750
|
const ENTITY_SHIP = Name.from('ship');
|
|
10498
10751
|
const ENTITY_WAREHOUSE = Name.from('warehouse');
|
|
10499
10752
|
const ENTITY_EXTRACTOR = Name.from('extractor');
|
|
10753
|
+
const ENTITY_FACTORY = Name.from('factory');
|
|
10500
10754
|
const ENTITY_CONTAINER = Name.from('container');
|
|
10755
|
+
const ENTITY_NEXUS = Name.from('nexus');
|
|
10501
10756
|
var EntityClass;
|
|
10502
10757
|
(function (EntityClass) {
|
|
10503
10758
|
EntityClass[EntityClass["OrbitalVessel"] = 0] = "OrbitalVessel";
|
|
@@ -10508,9 +10763,11 @@ function getEntityClass(entityType) {
|
|
|
10508
10763
|
switch (typeName) {
|
|
10509
10764
|
case 'ship':
|
|
10510
10765
|
case 'container':
|
|
10766
|
+
case 'nexus':
|
|
10511
10767
|
return EntityClass.OrbitalVessel;
|
|
10512
10768
|
case 'warehouse':
|
|
10513
10769
|
case 'extractor':
|
|
10770
|
+
case 'factory':
|
|
10514
10771
|
return EntityClass.PlanetaryStructure;
|
|
10515
10772
|
default:
|
|
10516
10773
|
throw new Error(`Entity type has no class: ${typeName}`);
|
|
@@ -10527,6 +10784,8 @@ function getPackedEntityType(itemId) {
|
|
|
10527
10784
|
return ENTITY_WAREHOUSE;
|
|
10528
10785
|
case ITEM_EXTRACTOR_T1_PACKED:
|
|
10529
10786
|
return ENTITY_EXTRACTOR;
|
|
10787
|
+
case ITEM_FACTORY_T1_PACKED:
|
|
10788
|
+
return ENTITY_FACTORY;
|
|
10530
10789
|
default:
|
|
10531
10790
|
return null;
|
|
10532
10791
|
}
|
|
@@ -10555,6 +10814,14 @@ const extractorTraits = {
|
|
|
10555
10814
|
hasModules: true,
|
|
10556
10815
|
notFoundError: 'extractor not found',
|
|
10557
10816
|
};
|
|
10817
|
+
const factoryTraits = {
|
|
10818
|
+
typeName: ENTITY_FACTORY,
|
|
10819
|
+
isMovable: false,
|
|
10820
|
+
hasEnergy: true,
|
|
10821
|
+
hasLoaders: false,
|
|
10822
|
+
hasModules: true,
|
|
10823
|
+
notFoundError: 'factory not found',
|
|
10824
|
+
};
|
|
10558
10825
|
const containerTraits = {
|
|
10559
10826
|
typeName: ENTITY_CONTAINER,
|
|
10560
10827
|
isMovable: true,
|
|
@@ -10563,6 +10830,14 @@ const containerTraits = {
|
|
|
10563
10830
|
hasModules: false,
|
|
10564
10831
|
notFoundError: 'container not found',
|
|
10565
10832
|
};
|
|
10833
|
+
const nexusTraits = {
|
|
10834
|
+
typeName: ENTITY_NEXUS,
|
|
10835
|
+
isMovable: false,
|
|
10836
|
+
hasEnergy: false,
|
|
10837
|
+
hasLoaders: false,
|
|
10838
|
+
hasModules: false,
|
|
10839
|
+
notFoundError: 'nexus not found',
|
|
10840
|
+
};
|
|
10566
10841
|
function getEntityTraits(entityType) {
|
|
10567
10842
|
const typeName = typeof entityType === 'string' ? entityType : entityType.toString();
|
|
10568
10843
|
switch (typeName) {
|
|
@@ -10572,8 +10847,12 @@ function getEntityTraits(entityType) {
|
|
|
10572
10847
|
return warehouseTraits;
|
|
10573
10848
|
case 'extractor':
|
|
10574
10849
|
return extractorTraits;
|
|
10850
|
+
case 'factory':
|
|
10851
|
+
return factoryTraits;
|
|
10575
10852
|
case 'container':
|
|
10576
10853
|
return containerTraits;
|
|
10854
|
+
case 'nexus':
|
|
10855
|
+
return nexusTraits;
|
|
10577
10856
|
default:
|
|
10578
10857
|
throw new Error(`Unknown entity type: ${typeName}`);
|
|
10579
10858
|
}
|
|
@@ -10587,6 +10866,9 @@ function isWarehouse(entity) {
|
|
|
10587
10866
|
function isExtractor(entity) {
|
|
10588
10867
|
return entity.type?.equals(ENTITY_EXTRACTOR) ?? false;
|
|
10589
10868
|
}
|
|
10869
|
+
function isFactory(entity) {
|
|
10870
|
+
return entity.type?.equals(ENTITY_FACTORY) ?? false;
|
|
10871
|
+
}
|
|
10590
10872
|
function isContainer(entity) {
|
|
10591
10873
|
return entity.type?.equals(ENTITY_CONTAINER) ?? false;
|
|
10592
10874
|
}
|
|
@@ -11737,6 +12019,9 @@ function deserializeAtomicData(data, schema) {
|
|
|
11737
12019
|
case 'uint64':
|
|
11738
12020
|
result[field.name] = readVarint64();
|
|
11739
12021
|
break;
|
|
12022
|
+
case 'int32':
|
|
12023
|
+
result[field.name] = readZigzagInt64();
|
|
12024
|
+
break;
|
|
11740
12025
|
case 'int64':
|
|
11741
12026
|
result[field.name] = readZigzagInt64();
|
|
11742
12027
|
break;
|
|
@@ -11835,5 +12120,5 @@ function describeItem(resolved, opts) {
|
|
|
11835
12120
|
return `${tier} ${resolved.name} · ${mass}`;
|
|
11836
12121
|
}
|
|
11837
12122
|
|
|
11838
|
-
export { ActionsManager, BASE_ORBITAL_MASS, BLEND_INPUTS_MUST_MATCH, BLEND_REQUIRES_MULTIPLE, BLEND_STAT_LESS_NOT_SUPPORTED, CANCEL_CONTAINS_GROUPED_TASK, CANCEL_PAIRED_HAS_PENDING, CATEGORY_LABELS, COMMIT_ALREADY_SET, COMMIT_CANNOT_MATCH, COMMIT_NOT_SET, COMPANY_NOT_FOUND,
|
|
12123
|
+
export { ActionsManager, BASE_ORBITAL_MASS, BLEND_INPUTS_MUST_MATCH, BLEND_REQUIRES_MULTIPLE, BLEND_STAT_LESS_NOT_SUPPORTED, CANCEL_CONTAINS_GROUPED_TASK, CANCEL_PAIRED_HAS_PENDING, CATEGORY_LABELS, COMMIT_ALREADY_SET, COMMIT_CANNOT_MATCH, COMMIT_NOT_SET, COMPANY_NOT_FOUND, CONTAINER_NOT_FOUND, CONTAINER_Z, CRAFT_ENERGY_DIVISOR, CRAFT_EXCEEDS_ENERGY_CAPACITY, CRAFT_NOT_ENOUGH_ENERGY, Container, Coordinates, DEPLOY_ENTITY_HAS_SCHEDULE, DEPTH_THRESHOLD_T1, DEPTH_THRESHOLD_T2, DEPTH_THRESHOLD_T3, DEPTH_THRESHOLD_T4, DEPTH_THRESHOLD_T5, DESTINATION_CAPACITY_EXCEEDED, ENTITY_ALREADY_THERE, ENTITY_CAPACITY_EXCEEDED, ENTITY_CARGO_NOT_LOADED, ENTITY_CARGO_NOT_OWNED, ENTITY_CONTAINER, ENTITY_EXTRACTOR, ENTITY_FACTORY, ENTITY_INVALID_CARGO, ENTITY_INVALID_DESTINATION, ENTITY_INVALID_TRAVEL_DURATION, ENTITY_NOT_ENOUGH_ENERGY, ENTITY_NOT_ENOUGH_ENERGY_CAPACITY, ENTITY_NO_CRAFTER, ENTITY_SHIP, ENTITY_WAREHOUSE, EPOCH_NON_ZERO, EPOCH_NOT_READY, ERROR_SYSTEM_ALREADY_INITIALIZED, ERROR_SYSTEM_DISABLED, ERROR_SYSTEM_NOT_INITIALIZED, EntitiesManager, EntityClass, EntityInventory, EntityType, EpochsManager, Extractor, Factory, GAME_NOT_FOUND, GAME_SEED_NOT_SET, GATHERER_DEPTH_MAX_TIER, GATHERER_DEPTH_TABLE, GATHER_EXCEEDS_ENERGY_CAPACITY, GATHER_NOT_ENOUGH_ENERGY, GROUP_DUPLICATE_ENTITY, GROUP_EMPTY, GROUP_ENTITY_NOT_MOVABLE, GROUP_HAUL_CAPACITY_EXCEEDED, GROUP_NOT_FOUND, GROUP_NOT_SAME_LOCATION, GROUP_NOT_SAME_OWNER, GROUP_NO_THRUST, GameState, INSUFFICIENT_BALANCE, INSUFFICIENT_ITEM_QUANTITY, INSUFFICIENT_ITEM_SUPPLY, INVALID_AMOUNT, ITEM_BIOMASS_T1, ITEM_BIOMASS_T10, ITEM_BIOMASS_T2, ITEM_BIOMASS_T3, ITEM_BIOMASS_T4, ITEM_BIOMASS_T5, ITEM_BIOMASS_T6, ITEM_BIOMASS_T7, ITEM_BIOMASS_T8, ITEM_BIOMASS_T9, ITEM_CARGO_ARM, ITEM_CARGO_LINING, ITEM_CARGO_LINING_T2, ITEM_CONTAINER_T1_PACKED, ITEM_CONTAINER_T2_PACKED, ITEM_CRAFTER_T1, ITEM_CRYSTAL_T1, ITEM_CRYSTAL_T10, ITEM_CRYSTAL_T2, ITEM_CRYSTAL_T3, ITEM_CRYSTAL_T4, ITEM_CRYSTAL_T5, ITEM_CRYSTAL_T6, ITEM_CRYSTAL_T7, ITEM_CRYSTAL_T8, ITEM_CRYSTAL_T9, ITEM_DOES_NOT_EXIST, ITEM_ENGINE_T1, ITEM_EXTRACTOR_T1_PACKED, ITEM_FACTORY_T1_PACKED, ITEM_FOCUSING_ARRAY, ITEM_GAS_T1, ITEM_GAS_T10, ITEM_GAS_T2, ITEM_GAS_T3, ITEM_GAS_T4, ITEM_GAS_T5, ITEM_GAS_T6, ITEM_GAS_T7, ITEM_GAS_T8, ITEM_GAS_T9, ITEM_GATHERER_T1, ITEM_GENERATOR_T1, ITEM_HAULER_T1, ITEM_HULL_PLATES, ITEM_HULL_PLATES_T2, ITEM_LOADER_T1, ITEM_MATTER_CONDUIT, ITEM_NOT_AVAILABLE_AT_LOCATION, ITEM_NOT_DEPLOYABLE, ITEM_NOT_PACKED_ENTITY, ITEM_ORE_T1, ITEM_ORE_T10, ITEM_ORE_T2, ITEM_ORE_T3, ITEM_ORE_T4, ITEM_ORE_T5, ITEM_ORE_T6, ITEM_ORE_T7, ITEM_ORE_T8, ITEM_ORE_T9, ITEM_POWER_CELL, ITEM_REACTION_CHAMBER, ITEM_REGOLITH_T1, ITEM_REGOLITH_T10, ITEM_REGOLITH_T2, ITEM_REGOLITH_T3, ITEM_REGOLITH_T4, ITEM_REGOLITH_T5, ITEM_REGOLITH_T6, ITEM_REGOLITH_T7, ITEM_REGOLITH_T8, ITEM_REGOLITH_T9, ITEM_SHIP_T1_PACKED, ITEM_STORAGE_T1, ITEM_SURVEY_PROBE, ITEM_THRUSTER_CORE, ITEM_TOOL_BIT, ITEM_TYPE_COMPONENT, ITEM_TYPE_ENTITY, ITEM_TYPE_MODULE, ITEM_TYPE_RESOURCE, ITEM_WAREHOUSE_T1_PACKED, ITEM_WARP_T1, InventoryAccessor, LOCATION_MAX_DEPTH, LOCATION_MIN_DEPTH, Location, LocationType, LocationsManager, MAX_ORBITAL_ALTITUDE, MIN_ORBITAL_ALTITUDE, MIN_TRANSFER_DISTANCE, MODULE_ANY, MODULE_CARGO_NOT_FOUND, MODULE_CRAFTER, MODULE_ENGINE, MODULE_ENTITY_BUSY, MODULE_GATHERER, MODULE_GENERATOR, MODULE_HAULER, MODULE_LAUNCHER, MODULE_LOADER, MODULE_NOT_MODULE, MODULE_SLOT_EMPTY, MODULE_SLOT_INVALID, MODULE_SLOT_OCCUPIED, MODULE_STORAGE, MODULE_TYPE_MISMATCH, MODULE_WARP, index as NFT, NO_SCHEDULE, Nexus, PLANETARY_STRUCTURE_Z, PLANET_SUBTYPE_GAS_GIANT, PLANET_SUBTYPE_ICY, PLANET_SUBTYPE_INDUSTRIAL, PLANET_SUBTYPE_OCEAN, PLANET_SUBTYPE_ROCKY, PLANET_SUBTYPE_TERRESTRIAL, PLAYER_ALREADY_JOINED, PLAYER_NOT_FOUND, PLAYER_NOT_JOINED, PRECISION$1 as PRECISION, platform as PlatformContract, Types$1 as PlatformTypes, Player, PlayersManager, RECIPE_INPUTS_EXCESS, RECIPE_INPUTS_INSUFFICIENT, RECIPE_INPUTS_INVALID, RECIPE_INPUTS_MIXED, RECIPE_NOT_FOUND, REQUIRES_MORE_THAN_ONE, REQUIRES_POSITIVE_VALUE, RESERVE_TIERS, RESOLVE_COUNT_EXCEEDS_COMPLETED, SHIP_ALREADY_TRAVELING, SHIP_CANNOT_BUY_TRAVELING, SHIP_CANNOT_CANCEL_TASK, SHIP_CANNOT_UPDATE_TRAVELING, SHIP_NOT_ARRIVED, SHIP_NOT_FOUND, SHIP_NOT_IDLE, SHIP_NOT_OWNED, SHIP_NO_COMPLETED_TASKS, SHIP_NO_TASKS_TO_CANCEL, SLOT_FORMULAS, STARTER_ALREADY_CLAIMED, ScheduleAccessor, server as ServerContract, Types as ServerTypes, Ship, Shipload, SubscriptionsManager, TIER_ADJECTIVES, TIER_ROLL_MAX, TRAVEL_MAX_DURATION, TaskCancelable, TaskType, WAREHOUSE_ALREADY_AT_LOCATION, WAREHOUSE_NOT_FOUND, WARP_HAS_CARGO, WARP_HAS_SCHEDULE, WARP_NOT_FULL_ENERGY, WARP_NO_CAPABILITY, WARP_OUT_OF_RANGE, Warehouse, WebSocketConnection, availableCapacity$1 as availableCapacity, availableCapacityFromMass, blendCargoStacks, blendComponentStacks, blendCrossGroup, blendStacks, buildEntityDescription, calcCargoItemMass, calcCargoMass, calcEnergyUsage, calcLoadDuration, calcStacksMass, calc_acceleration, calc_craft_duration, calc_craft_energy, calc_energyusage, calc_flighttime, calc_gather_duration, calc_gather_energy, calc_loader_acceleration, calc_loader_flighttime, calc_orbital_altitude, calc_rechargetime, calc_ship_acceleration, calc_ship_flighttime, calc_ship_mass, calc_ship_rechargetime, calc_transfer_duration, calculateFlightTime, calculateLoadTimeBreakdown, calculateRefuelingTime, calculateTransferTime, canMove, capabilityAttributes, capabilityNames, capsHasCrafter, capsHasGatherer, capsHasHauler, capsHasLoaders, capsHasMass, capsHasMovement, capsHasStorage, cargoItem, cargoItemToStack, cargoRef, cargoUtils, categoryColors, categoryFromIndex, categoryIconShapes, categoryIcons, categoryLabel, categoryLabelFromIndex, componentIcon, computeBaseCapacityShip, computeBaseCapacityWarehouse, computeBaseHullmass, computeComponentStats, computeContainerCapabilities, computeContainerT2Capabilities, computeCraftedOutputStats, computeCrafterCapabilities, computeCrafterDrain, computeCrafterSpeed, computeEngineCapabilities, computeEngineDrain, computeEngineThrust, computeEntityStats, computeExtractorCapabilities, computeFactoryCapabilities, computeGathererCapabilities, computeGathererDepth, computeGathererDrain, computeGathererSpeed, computeGathererYield, computeGeneratorCap, computeGeneratorCapabilities, computeGeneratorRech, computeHaulPenalty, computeHaulerCapabilities, computeHaulerCapacity, computeHaulerDrain$1 as computeHaulerDrain, computeHaulerEfficiency, computeInputMass, computeLoaderCapabilities, computeLoaderMass, computeLoaderThrust, computeShipCapabilities, computeShipHullCapabilities, computeStorageCapabilities, computeWarehouseCapabilities, computeWarehouseHullCapabilities, computeWarpRange, containerTraits, coordsToLocationId, createInventoryAccessor, createProjectedEntity, createScheduleAccessor, decodeCraftedItemStats, decodeStat, decodeStats, Shipload as default, deriveLocation, deriveLocationSize, deriveLocationStatic, deriveResourceStats, deriveStatMappings, deriveStrata, deriveStratum, describeItem, describeModule, describeModuleForItem, describeModuleForSlot, deserializeAsset, deserializeAtomicData, deserializeComponent, deserializeEntity, deserializeModule, deserializeResource, displayName, distanceBetweenCoordinates, distanceBetweenPoints, easeFlightProgress, encodeGatheredCargoStats, encodeStats, energyPercent, entityDisplayName, estimateDealTravelTime, estimateTravelTime, extractorTraits, factoryTraits, findItemByCategoryAndTier, findNearbyPlanets, flightSpeedFactor, formatMass, formatMassDelta, formatModuleLine, formatTier, gathererDepthForTier, getCapabilityAttributes, getCategoryInfo, getComponents, getCurrentEpoch, getDepthThreshold, getDestinationLocation, getEligibleResources, getEntityClass, getEntityItems, getEntityLayout, getEntityTraits, getEpochInfo, getFlightOrigin, getInterpolatedPosition, getItem, getItems, getLocationCandidates, getLocationProfile, getLocationType, getLocationTypeName, getModuleCapabilityType, getModules, getPackedEntityType, getPlanetSubtype, getPlanetSubtypes, getPositionAt, getRecipe, getResourceTier, getResourceWeight, getResources, getStatDefinitions, getStatMappings, getStatMappingsForCapability, getStatMappingsForStat, getStatName, getSystemName, hasEnergy, hasEnergyForDistance$1 as hasEnergyForDistance, hasGatherer, hasLoaders, hasMass, hasSchedule, hasSpace$1 as hasSpace, hasSpaceForMass, hasStorage, hasSystem, hash, hash512, interpolateFlightPosition, isContainer, isCraftedItem, isExtractor, isFactory, isFull$1 as isFull, isFullFromMass, isGatherableLocation, isInvertedAttribute, isLocationBuildable, isModuleItem, isRelatedItem, isShip, isSubscriptionsDebugEnabled, isWarehouse, itemAbbreviations, itemCategory, itemIds, itemOffset, itemTier, itemTypeCode, lerp$1 as lerp, makeContainer, makeExtractor, makeFactory, makeNexus, makeShip, makeWarehouse, mapEntity, maxTravelDistance, mergeStacks, moduleAccepts, moduleDisplayName, moduleIcon, moduleSlotTypeToCode, needsRecharge, parseWireEntity, projectEntity, projectEntityAt, projectFromCurrentState, projectFromCurrentStateAt, readCommonBase, removeFromStacks, renderDescription, resolveItem, resolveItemCategory, resolveStats, rollTier, rollWithinTier, rotation, schedule, setSubscriptionsDebug, shipTraits, stackKey, stackToCargoItem, stacksEqual, taskCargoChanges, tierAdjective, tierColors, toLocation, typeLabel, validateSchedule, warehouseTraits };
|
|
11839
12124
|
//# sourceMappingURL=shipload.m.js.map
|