@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.js CHANGED
@@ -2177,15 +2177,15 @@ const PLAYER_ALREADY_JOINED = 'Player has already joined the game.';
2177
2177
  const PLAYER_NOT_JOINED = 'Player has not joined the game.';
2178
2178
  const PLAYER_NOT_FOUND = 'Cannot find player for given account name.';
2179
2179
  const STARTER_ALREADY_CLAIMED = 'Starter ship already claimed; destroy existing ships to re-claim.';
2180
- const SHIP_ALREADY_THERE = 'Ship cannot travel to the location its already at.';
2180
+ const ENTITY_ALREADY_THERE = 'Entity cannot travel to the location it is already at.';
2181
2181
  const SHIP_ALREADY_TRAVELING = 'Ship is already traveling.';
2182
2182
  const SHIP_CANNOT_BUY_TRAVELING = 'Ship cannot buy goods while traveling.';
2183
2183
  const SHIP_CANNOT_UPDATE_TRAVELING = 'Ship cannot be updated while traveling.';
2184
- const SHIP_INVALID_DESTINATION = 'Ship cannot travel, no system at specified destination.';
2185
- const SHIP_INVALID_TRAVEL_DURATION = 'This trip cannot be made as it would exceed the maximum travel duration.';
2184
+ const ENTITY_INVALID_DESTINATION = 'Cannot travel: no system at specified destination.';
2185
+ const ENTITY_INVALID_TRAVEL_DURATION = 'This trip cannot be made as it would exceed the maximum travel duration.';
2186
2186
  const SHIP_NOT_ARRIVED = 'Ship has not yet arrived at its destination.';
2187
- const SHIP_NOT_ENOUGH_ENERGY = 'Ship does not have enough energy to travel to the destination.';
2188
- const SHIP_NOT_ENOUGH_ENERGY_CAPACITY = 'Ship does not have enough energy capacity to travel.';
2187
+ const ENTITY_NOT_ENOUGH_ENERGY = 'Entity does not have enough energy to travel to the destination.';
2188
+ const ENTITY_NOT_ENOUGH_ENERGY_CAPACITY = 'Entity does not have enough energy capacity to travel.';
2189
2189
  const SHIP_NOT_FOUND = 'Cannot find ship for given account.';
2190
2190
  const SHIP_NOT_OWNED = 'Ship is not owned by this account.';
2191
2191
  const NO_SCHEDULE = 'No scheduled tasks.';
@@ -2194,16 +2194,13 @@ const SHIP_NO_COMPLETED_TASKS = 'No completed tasks to resolve.';
2194
2194
  const RESOLVE_COUNT_EXCEEDS_COMPLETED = 'Requested resolve count exceeds completed tasks.';
2195
2195
  const SHIP_CANNOT_CANCEL_TASK = 'Cannot cancel task that is immutable or in progress.';
2196
2196
  const SHIP_NO_TASKS_TO_CANCEL = 'No tasks to cancel.';
2197
- const SHIP_INVALID_CARGO = 'Invalid cargo specified for load/unload.';
2198
- const SHIP_CARGO_NOT_OWNED = 'Cannot load cargo that is not owned.';
2199
- const SHIP_CARGO_NOT_LOADED = 'Cannot unload cargo that is not loaded.';
2200
- const SHIP_CAPACITY_EXCEEDED = 'Ship cargo capacity would be exceeded.';
2197
+ const ENTITY_INVALID_CARGO = 'Invalid cargo specified for load/unload.';
2198
+ const ENTITY_CARGO_NOT_OWNED = 'Cannot load cargo that is not owned.';
2199
+ const ENTITY_CARGO_NOT_LOADED = 'Cannot unload cargo that is not loaded.';
2201
2200
  const ENTITY_CAPACITY_EXCEEDED = 'Entity cargo capacity would be exceeded.';
2202
2201
  const WAREHOUSE_NOT_FOUND = 'Cannot find warehouse for given id.';
2203
2202
  const WAREHOUSE_ALREADY_AT_LOCATION = 'Warehouse already exists at this location.';
2204
- const WAREHOUSE_CAPACITY_EXCEEDED = 'Warehouse capacity would be exceeded.';
2205
2203
  const CONTAINER_NOT_FOUND = 'Cannot find container for given id.';
2206
- const CONTAINER_CAPACITY_EXCEEDED = 'Container capacity would be exceeded.';
2207
2204
  const DESTINATION_CAPACITY_EXCEEDED = 'Destination entity does not have enough capacity for the gather.';
2208
2205
  const CANCEL_PAIRED_HAS_PENDING = 'Cannot cancel transfer, paired entity has pending tasks.';
2209
2206
  const GROUP_EMPTY = 'Group travel requires at least one entity.';
@@ -2411,6 +2408,7 @@ const ITEM_CONTAINER_T1_PACKED = 10200;
2411
2408
  const ITEM_SHIP_T1_PACKED = 10201;
2412
2409
  const ITEM_WAREHOUSE_T1_PACKED = 10202;
2413
2410
  const ITEM_EXTRACTOR_T1_PACKED = 10203;
2411
+ const ITEM_FACTORY_T1_PACKED = 10204;
2414
2412
  const ITEM_HULL_PLATES_T2 = 20001;
2415
2413
  const ITEM_CARGO_LINING_T2 = 20002;
2416
2414
  const ITEM_CONTAINER_T2_PACKED = 20200;
@@ -2906,6 +2904,12 @@ var items = [
2906
2904
  type: "entity",
2907
2905
  tier: 1
2908
2906
  },
2907
+ {
2908
+ id: 10204,
2909
+ mass: 800000,
2910
+ type: "entity",
2911
+ tier: 1
2912
+ },
2909
2913
  {
2910
2914
  id: 20001,
2911
2915
  mass: 50000,
@@ -3752,6 +3756,64 @@ var recipes = [
3752
3756
  blendWeights: [
3753
3757
  ]
3754
3758
  },
3759
+ {
3760
+ outputItemId: 10204,
3761
+ outputMass: 800000,
3762
+ inputs: [
3763
+ {
3764
+ itemId: 10001,
3765
+ quantity: 15
3766
+ },
3767
+ {
3768
+ itemId: 10002,
3769
+ quantity: 6
3770
+ },
3771
+ {
3772
+ itemId: 10008,
3773
+ quantity: 4
3774
+ },
3775
+ {
3776
+ itemId: 10009,
3777
+ quantity: 4
3778
+ }
3779
+ ],
3780
+ statSlots: [
3781
+ {
3782
+ sources: [
3783
+ {
3784
+ inputIndex: 0,
3785
+ statIndex: 0
3786
+ }
3787
+ ]
3788
+ },
3789
+ {
3790
+ sources: [
3791
+ {
3792
+ inputIndex: 0,
3793
+ statIndex: 1
3794
+ }
3795
+ ]
3796
+ },
3797
+ {
3798
+ sources: [
3799
+ {
3800
+ inputIndex: 1,
3801
+ statIndex: 0
3802
+ }
3803
+ ]
3804
+ },
3805
+ {
3806
+ sources: [
3807
+ {
3808
+ inputIndex: 1,
3809
+ statIndex: 1
3810
+ }
3811
+ ]
3812
+ }
3813
+ ],
3814
+ blendWeights: [
3815
+ ]
3816
+ },
3755
3817
  {
3756
3818
  outputItemId: 20001,
3757
3819
  outputMass: 50000,
@@ -3969,6 +4031,19 @@ var entities = [
3969
4031
  }
3970
4032
  ]
3971
4033
  },
4034
+ {
4035
+ entityItemId: 10204,
4036
+ slots: [
4037
+ {
4038
+ type: "generator",
4039
+ outputPct: 100
4040
+ },
4041
+ {
4042
+ type: "crafter",
4043
+ outputPct: 100
4044
+ }
4045
+ ]
4046
+ },
3972
4047
  {
3973
4048
  entityItemId: 20200,
3974
4049
  slots: [
@@ -4173,6 +4248,11 @@ const itemMetadata = {
4173
4248
  description: 'Planetary resource extraction facility with generator and gatherer module slots.',
4174
4249
  color: '#D4726F',
4175
4250
  },
4251
+ 10204: {
4252
+ name: 'Factory',
4253
+ description: 'Planetary fabrication facility with generator and crafter module slots.',
4254
+ color: '#7BA7D4',
4255
+ },
4176
4256
  20001: {
4177
4257
  name: 'Hull Plates',
4178
4258
  description: 'Advanced structural plating reinforced with tier 2 ore.',
@@ -4193,6 +4273,7 @@ const entityMetadata = {
4193
4273
  10201: { moduleSlotLabels: ['Engine', 'Generator', 'Gatherer', 'Loader', 'Storage'] },
4194
4274
  10202: { moduleSlotLabels: ['Loader', 'Storage', 'Storage', 'Storage', 'Storage'] },
4195
4275
  10203: { moduleSlotLabels: ['Generator', 'Gatherer'] },
4276
+ 10204: { moduleSlotLabels: ['Generator', 'Crafter'] },
4196
4277
  };
4197
4278
  for (const item of items) {
4198
4279
  if (!itemMetadata[item.id]) {
@@ -7840,7 +7921,7 @@ function validateCraftTask(task, projected) {
7840
7921
  }
7841
7922
  }
7842
7923
  if (!found)
7843
- throw new Error(SHIP_CARGO_NOT_LOADED);
7924
+ throw new Error(ENTITY_CARGO_NOT_LOADED);
7844
7925
  }
7845
7926
  }
7846
7927
  function validateSchedule(entity) {
@@ -8100,7 +8181,7 @@ class Ship extends exports.ServerTypes.entity_info {
8100
8181
  return this.entity_name;
8101
8182
  }
8102
8183
  get entityClass() {
8103
- return 'mobile';
8184
+ return 'orbital';
8104
8185
  }
8105
8186
  get canUndeploy() {
8106
8187
  return true;
@@ -9047,7 +9128,7 @@ class Warehouse extends exports.ServerTypes.entity_info {
9047
9128
  return this.entity_name;
9048
9129
  }
9049
9130
  get entityClass() {
9050
- return 'building';
9131
+ return 'planetary';
9051
9132
  }
9052
9133
  get canDemolish() {
9053
9134
  return true;
@@ -9129,7 +9210,7 @@ class Container extends exports.ServerTypes.entity_info {
9129
9210
  return this.entity_name;
9130
9211
  }
9131
9212
  get entityClass() {
9132
- return 'mobile';
9213
+ return 'orbital';
9133
9214
  }
9134
9215
  get canUndeploy() {
9135
9216
  return true;
@@ -9203,7 +9284,7 @@ class Extractor extends exports.ServerTypes.entity_info {
9203
9284
  return this.entity_name;
9204
9285
  }
9205
9286
  get entityClass() {
9206
- return 'building';
9287
+ return 'planetary';
9207
9288
  }
9208
9289
  get canDemolish() {
9209
9290
  return true;
@@ -9286,6 +9367,101 @@ function computeExtractorCapabilities(modules, layout) {
9286
9367
  return out;
9287
9368
  }
9288
9369
 
9370
+ class Factory extends exports.ServerTypes.entity_info {
9371
+ get name() {
9372
+ return this.entity_name;
9373
+ }
9374
+ get entityClass() {
9375
+ return 'planetary';
9376
+ }
9377
+ get canDemolish() {
9378
+ return true;
9379
+ }
9380
+ get inv() {
9381
+ this._inv ?? (this._inv = new InventoryAccessor(this));
9382
+ return this._inv;
9383
+ }
9384
+ get inventory() {
9385
+ return this.inv.items;
9386
+ }
9387
+ get sched() {
9388
+ this._sched ?? (this._sched = new ScheduleAccessor(this));
9389
+ return this._sched;
9390
+ }
9391
+ get isIdle() {
9392
+ return this.is_idle;
9393
+ }
9394
+ get location() {
9395
+ return Location.from(this.coordinates);
9396
+ }
9397
+ get totalCargoMass() {
9398
+ return this.inv.totalMass;
9399
+ }
9400
+ get maxCapacity() {
9401
+ return antelope.UInt64.from(this.capacity);
9402
+ }
9403
+ get availableCapacity() {
9404
+ const cargo = this.totalCargoMass;
9405
+ return cargo.gte(this.maxCapacity) ? antelope.UInt64.from(0) : this.maxCapacity.subtracting(cargo);
9406
+ }
9407
+ get isFull() {
9408
+ return this.totalCargoMass.gte(this.maxCapacity);
9409
+ }
9410
+ get totalMass() {
9411
+ const hull = this.hullmass ? antelope.UInt64.from(this.hullmass) : antelope.UInt64.from(0);
9412
+ return hull.adding(this.totalCargoMass);
9413
+ }
9414
+ }
9415
+ function computeFactoryCapabilities(modules, layout) {
9416
+ const out = {};
9417
+ const genModules = modules.filter((m) => getModuleCapabilityType(m.itemId) === MODULE_GENERATOR);
9418
+ if (genModules.length > 0) {
9419
+ let totalCapacity = 0;
9420
+ let totalRecharge = 0;
9421
+ for (const m of genModules) {
9422
+ const caps = computeGeneratorCapabilities(decodeCraftedItemStats(m.itemId, m.stats));
9423
+ const amp = getSlotAmp(layout, m.slotIndex);
9424
+ totalCapacity += applySlotMultiplier(caps.capacity, amp);
9425
+ totalRecharge += applySlotMultiplier(caps.recharge, amp);
9426
+ }
9427
+ out.generator = {
9428
+ capacity: clampUint16(totalCapacity),
9429
+ recharge: clampUint16(totalRecharge),
9430
+ };
9431
+ }
9432
+ const crafterModules = modules.filter((m) => getModuleCapabilityType(m.itemId) === MODULE_CRAFTER);
9433
+ if (crafterModules.length > 0) {
9434
+ let totalSpeed = 0;
9435
+ let totalDrain = 0;
9436
+ for (const m of crafterModules) {
9437
+ const caps = computeCrafterCapabilities(decodeCraftedItemStats(m.itemId, m.stats));
9438
+ const amp = getSlotAmp(layout, m.slotIndex);
9439
+ totalSpeed += applySlotMultiplier(caps.speed, amp);
9440
+ totalDrain += caps.drain;
9441
+ }
9442
+ out.crafter = {
9443
+ speed: clampUint16(totalSpeed),
9444
+ drain: totalDrain,
9445
+ };
9446
+ }
9447
+ return out;
9448
+ }
9449
+
9450
+ class Nexus extends exports.ServerTypes.entity_info {
9451
+ get name() {
9452
+ return this.entity_name;
9453
+ }
9454
+ get entityClass() {
9455
+ return 'orbital';
9456
+ }
9457
+ get location() {
9458
+ return Location.from(this.coordinates);
9459
+ }
9460
+ get orbitalAltitude() {
9461
+ return this.coordinates.z?.toNumber() || 0;
9462
+ }
9463
+ }
9464
+
9289
9465
  class EntitiesManager extends BaseManager {
9290
9466
  async getEntity(id) {
9291
9467
  const result = await this.server.readonly('getentity', {
@@ -9323,6 +9499,9 @@ class EntitiesManager extends BaseManager {
9323
9499
  async getExtractor(id) {
9324
9500
  return (await this.getEntity(id));
9325
9501
  }
9502
+ async getFactory(id) {
9503
+ return (await this.getEntity(id));
9504
+ }
9326
9505
  async getShips(owner) {
9327
9506
  return (await this.getEntities(owner, 'ship'));
9328
9507
  }
@@ -9335,6 +9514,9 @@ class EntitiesManager extends BaseManager {
9335
9514
  async getExtractors(owner) {
9336
9515
  return (await this.getEntities(owner, 'extractor'));
9337
9516
  }
9517
+ async getFactories(owner) {
9518
+ return (await this.getEntities(owner, 'factory'));
9519
+ }
9338
9520
  async getShipSummaries(owner) {
9339
9521
  return this.getSummaries(owner, 'ship');
9340
9522
  }
@@ -9347,6 +9529,18 @@ class EntitiesManager extends BaseManager {
9347
9529
  async getExtractorSummaries(owner) {
9348
9530
  return this.getSummaries(owner, 'extractor');
9349
9531
  }
9532
+ async getFactorySummaries(owner) {
9533
+ return this.getSummaries(owner, 'factory');
9534
+ }
9535
+ async getNexus(id) {
9536
+ return (await this.getEntity(id));
9537
+ }
9538
+ async getNexuses(owner) {
9539
+ return (await this.getEntities(owner, 'nexus'));
9540
+ }
9541
+ async getNexusSummaries(owner) {
9542
+ return this.getSummaries(owner, 'nexus');
9543
+ }
9350
9544
  wrapEntity(entity) {
9351
9545
  if (entity.type.equals('ship'))
9352
9546
  return new Ship(entity);
@@ -9354,8 +9548,12 @@ class EntitiesManager extends BaseManager {
9354
9548
  return new Warehouse(entity);
9355
9549
  if (entity.type.equals('extractor'))
9356
9550
  return new Extractor(entity);
9551
+ if (entity.type.equals('factory'))
9552
+ return new Factory(entity);
9357
9553
  if (entity.type.equals('container'))
9358
9554
  return new Container(entity);
9555
+ if (entity.type.equals('nexus'))
9556
+ return new Nexus(entity);
9359
9557
  throw new Error(`unknown entity type: ${entity.type}`);
9360
9558
  }
9361
9559
  resolveOwner(owner) {
@@ -9806,6 +10004,8 @@ function mapEntity(ei) {
9806
10004
  return new Warehouse(ei);
9807
10005
  if (ei.type.equals('container'))
9808
10006
  return new Container(ei);
10007
+ if (ei.type.equals('nexus'))
10008
+ return new Nexus(ei);
9809
10009
  throw new Error(`mapEntity: unknown entity type ${ei.type.toString()}`);
9810
10010
  }
9811
10011
  function parseWireEntity(raw) {
@@ -10375,6 +10575,42 @@ function makeExtractor(state) {
10375
10575
  const entityInfo = exports.ServerTypes.entity_info.from(info);
10376
10576
  return new Extractor(entityInfo);
10377
10577
  }
10578
+ function makeFactory(state) {
10579
+ const info = {
10580
+ type: antelope.Name.from('factory'),
10581
+ id: antelope.UInt64.from(state.id),
10582
+ owner: antelope.Name.from(state.owner),
10583
+ entity_name: state.name,
10584
+ coordinates: exports.ServerTypes.coordinates.from(state.coordinates),
10585
+ cargomass: antelope.UInt32.from(0),
10586
+ cargo: state.cargo || [],
10587
+ is_idle: !state.schedule,
10588
+ current_task_elapsed: antelope.UInt32.from(0),
10589
+ current_task_remaining: antelope.UInt32.from(0),
10590
+ pending_tasks: [],
10591
+ };
10592
+ if (state.hullmass !== undefined)
10593
+ info.hullmass = antelope.UInt32.from(state.hullmass);
10594
+ if (state.energy !== undefined)
10595
+ info.energy = antelope.UInt16.from(state.energy);
10596
+ if (state.schedule)
10597
+ info.schedule = state.schedule;
10598
+ if (state.capacity !== undefined)
10599
+ info.capacity = antelope.UInt32.from(state.capacity);
10600
+ const moduleEntries = assignModulesToSlots(ITEM_FACTORY_T1_PACKED, state.modules ?? [], 'Factory T1');
10601
+ if (state.modules && state.modules.length > 0) {
10602
+ const layout = getEntityLayout(ITEM_FACTORY_T1_PACKED)?.slots ?? [];
10603
+ const installed = toInstalledModules(moduleEntries);
10604
+ const capabilities = computeFactoryCapabilities(installed, layout);
10605
+ if (capabilities.generator)
10606
+ info.generator = capabilities.generator;
10607
+ if (capabilities.crafter)
10608
+ info.crafter = capabilities.crafter;
10609
+ }
10610
+ info.modules = moduleEntries;
10611
+ const entityInfo = exports.ServerTypes.entity_info.from(info);
10612
+ return new Factory(entityInfo);
10613
+ }
10378
10614
  function makeContainer(state) {
10379
10615
  const entityInfo = exports.ServerTypes.entity_info.from({
10380
10616
  type: antelope.Name.from('container'),
@@ -10395,6 +10631,23 @@ function makeContainer(state) {
10395
10631
  });
10396
10632
  return new Container(entityInfo);
10397
10633
  }
10634
+ function makeNexus(state) {
10635
+ const entityInfo = exports.ServerTypes.entity_info.from({
10636
+ type: antelope.Name.from('nexus'),
10637
+ id: antelope.UInt64.from(state.id),
10638
+ owner: antelope.Name.from(state.owner),
10639
+ entity_name: state.name,
10640
+ coordinates: exports.ServerTypes.coordinates.from(state.coordinates),
10641
+ cargomass: antelope.UInt32.from(0),
10642
+ cargo: [],
10643
+ modules: [],
10644
+ is_idle: true,
10645
+ current_task_elapsed: antelope.UInt32.from(0),
10646
+ current_task_remaining: antelope.UInt32.from(0),
10647
+ pending_tasks: [],
10648
+ });
10649
+ return new Nexus(entityInfo);
10650
+ }
10398
10651
 
10399
10652
  function totalCargoMass(cargo) {
10400
10653
  return cargo.reduce((sum, c) => {
@@ -10505,7 +10758,9 @@ function taskCargoChanges(task) {
10505
10758
  const ENTITY_SHIP = antelope.Name.from('ship');
10506
10759
  const ENTITY_WAREHOUSE = antelope.Name.from('warehouse');
10507
10760
  const ENTITY_EXTRACTOR = antelope.Name.from('extractor');
10761
+ const ENTITY_FACTORY = antelope.Name.from('factory');
10508
10762
  const ENTITY_CONTAINER = antelope.Name.from('container');
10763
+ const ENTITY_NEXUS = antelope.Name.from('nexus');
10509
10764
  exports.EntityClass = void 0;
10510
10765
  (function (EntityClass) {
10511
10766
  EntityClass[EntityClass["OrbitalVessel"] = 0] = "OrbitalVessel";
@@ -10516,9 +10771,11 @@ function getEntityClass(entityType) {
10516
10771
  switch (typeName) {
10517
10772
  case 'ship':
10518
10773
  case 'container':
10774
+ case 'nexus':
10519
10775
  return exports.EntityClass.OrbitalVessel;
10520
10776
  case 'warehouse':
10521
10777
  case 'extractor':
10778
+ case 'factory':
10522
10779
  return exports.EntityClass.PlanetaryStructure;
10523
10780
  default:
10524
10781
  throw new Error(`Entity type has no class: ${typeName}`);
@@ -10535,6 +10792,8 @@ function getPackedEntityType(itemId) {
10535
10792
  return ENTITY_WAREHOUSE;
10536
10793
  case ITEM_EXTRACTOR_T1_PACKED:
10537
10794
  return ENTITY_EXTRACTOR;
10795
+ case ITEM_FACTORY_T1_PACKED:
10796
+ return ENTITY_FACTORY;
10538
10797
  default:
10539
10798
  return null;
10540
10799
  }
@@ -10563,6 +10822,14 @@ const extractorTraits = {
10563
10822
  hasModules: true,
10564
10823
  notFoundError: 'extractor not found',
10565
10824
  };
10825
+ const factoryTraits = {
10826
+ typeName: ENTITY_FACTORY,
10827
+ isMovable: false,
10828
+ hasEnergy: true,
10829
+ hasLoaders: false,
10830
+ hasModules: true,
10831
+ notFoundError: 'factory not found',
10832
+ };
10566
10833
  const containerTraits = {
10567
10834
  typeName: ENTITY_CONTAINER,
10568
10835
  isMovable: true,
@@ -10571,6 +10838,14 @@ const containerTraits = {
10571
10838
  hasModules: false,
10572
10839
  notFoundError: 'container not found',
10573
10840
  };
10841
+ const nexusTraits = {
10842
+ typeName: ENTITY_NEXUS,
10843
+ isMovable: false,
10844
+ hasEnergy: false,
10845
+ hasLoaders: false,
10846
+ hasModules: false,
10847
+ notFoundError: 'nexus not found',
10848
+ };
10574
10849
  function getEntityTraits(entityType) {
10575
10850
  const typeName = typeof entityType === 'string' ? entityType : entityType.toString();
10576
10851
  switch (typeName) {
@@ -10580,8 +10855,12 @@ function getEntityTraits(entityType) {
10580
10855
  return warehouseTraits;
10581
10856
  case 'extractor':
10582
10857
  return extractorTraits;
10858
+ case 'factory':
10859
+ return factoryTraits;
10583
10860
  case 'container':
10584
10861
  return containerTraits;
10862
+ case 'nexus':
10863
+ return nexusTraits;
10585
10864
  default:
10586
10865
  throw new Error(`Unknown entity type: ${typeName}`);
10587
10866
  }
@@ -10595,6 +10874,9 @@ function isWarehouse(entity) {
10595
10874
  function isExtractor(entity) {
10596
10875
  return entity.type?.equals(ENTITY_EXTRACTOR) ?? false;
10597
10876
  }
10877
+ function isFactory(entity) {
10878
+ return entity.type?.equals(ENTITY_FACTORY) ?? false;
10879
+ }
10598
10880
  function isContainer(entity) {
10599
10881
  return entity.type?.equals(ENTITY_CONTAINER) ?? false;
10600
10882
  }
@@ -11745,6 +12027,9 @@ function deserializeAtomicData(data, schema) {
11745
12027
  case 'uint64':
11746
12028
  result[field.name] = readVarint64();
11747
12029
  break;
12030
+ case 'int32':
12031
+ result[field.name] = readZigzagInt64();
12032
+ break;
11748
12033
  case 'int64':
11749
12034
  result[field.name] = readZigzagInt64();
11750
12035
  break;
@@ -11855,7 +12140,6 @@ exports.COMMIT_ALREADY_SET = COMMIT_ALREADY_SET;
11855
12140
  exports.COMMIT_CANNOT_MATCH = COMMIT_CANNOT_MATCH;
11856
12141
  exports.COMMIT_NOT_SET = COMMIT_NOT_SET;
11857
12142
  exports.COMPANY_NOT_FOUND = COMPANY_NOT_FOUND;
11858
- exports.CONTAINER_CAPACITY_EXCEEDED = CONTAINER_CAPACITY_EXCEEDED;
11859
12143
  exports.CONTAINER_NOT_FOUND = CONTAINER_NOT_FOUND;
11860
12144
  exports.CONTAINER_Z = CONTAINER_Z;
11861
12145
  exports.CRAFT_ENERGY_DIVISOR = CRAFT_ENERGY_DIVISOR;
@@ -11870,9 +12154,18 @@ exports.DEPTH_THRESHOLD_T3 = DEPTH_THRESHOLD_T3;
11870
12154
  exports.DEPTH_THRESHOLD_T4 = DEPTH_THRESHOLD_T4;
11871
12155
  exports.DEPTH_THRESHOLD_T5 = DEPTH_THRESHOLD_T5;
11872
12156
  exports.DESTINATION_CAPACITY_EXCEEDED = DESTINATION_CAPACITY_EXCEEDED;
12157
+ exports.ENTITY_ALREADY_THERE = ENTITY_ALREADY_THERE;
11873
12158
  exports.ENTITY_CAPACITY_EXCEEDED = ENTITY_CAPACITY_EXCEEDED;
12159
+ exports.ENTITY_CARGO_NOT_LOADED = ENTITY_CARGO_NOT_LOADED;
12160
+ exports.ENTITY_CARGO_NOT_OWNED = ENTITY_CARGO_NOT_OWNED;
11874
12161
  exports.ENTITY_CONTAINER = ENTITY_CONTAINER;
11875
12162
  exports.ENTITY_EXTRACTOR = ENTITY_EXTRACTOR;
12163
+ exports.ENTITY_FACTORY = ENTITY_FACTORY;
12164
+ exports.ENTITY_INVALID_CARGO = ENTITY_INVALID_CARGO;
12165
+ exports.ENTITY_INVALID_DESTINATION = ENTITY_INVALID_DESTINATION;
12166
+ exports.ENTITY_INVALID_TRAVEL_DURATION = ENTITY_INVALID_TRAVEL_DURATION;
12167
+ exports.ENTITY_NOT_ENOUGH_ENERGY = ENTITY_NOT_ENOUGH_ENERGY;
12168
+ exports.ENTITY_NOT_ENOUGH_ENERGY_CAPACITY = ENTITY_NOT_ENOUGH_ENERGY_CAPACITY;
11876
12169
  exports.ENTITY_NO_CRAFTER = ENTITY_NO_CRAFTER;
11877
12170
  exports.ENTITY_SHIP = ENTITY_SHIP;
11878
12171
  exports.ENTITY_WAREHOUSE = ENTITY_WAREHOUSE;
@@ -11886,6 +12179,7 @@ exports.EntityInventory = EntityInventory;
11886
12179
  exports.EntityType = EntityType;
11887
12180
  exports.EpochsManager = EpochsManager;
11888
12181
  exports.Extractor = Extractor;
12182
+ exports.Factory = Factory;
11889
12183
  exports.GAME_NOT_FOUND = GAME_NOT_FOUND;
11890
12184
  exports.GAME_SEED_NOT_SET = GAME_SEED_NOT_SET;
11891
12185
  exports.GATHERER_DEPTH_MAX_TIER = GATHERER_DEPTH_MAX_TIER;
@@ -11934,6 +12228,7 @@ exports.ITEM_CRYSTAL_T9 = ITEM_CRYSTAL_T9;
11934
12228
  exports.ITEM_DOES_NOT_EXIST = ITEM_DOES_NOT_EXIST;
11935
12229
  exports.ITEM_ENGINE_T1 = ITEM_ENGINE_T1;
11936
12230
  exports.ITEM_EXTRACTOR_T1_PACKED = ITEM_EXTRACTOR_T1_PACKED;
12231
+ exports.ITEM_FACTORY_T1_PACKED = ITEM_FACTORY_T1_PACKED;
11937
12232
  exports.ITEM_FOCUSING_ARRAY = ITEM_FOCUSING_ARRAY;
11938
12233
  exports.ITEM_GAS_T1 = ITEM_GAS_T1;
11939
12234
  exports.ITEM_GAS_T10 = ITEM_GAS_T10;
@@ -12015,6 +12310,7 @@ exports.MODULE_TYPE_MISMATCH = MODULE_TYPE_MISMATCH;
12015
12310
  exports.MODULE_WARP = MODULE_WARP;
12016
12311
  exports.NFT = index;
12017
12312
  exports.NO_SCHEDULE = NO_SCHEDULE;
12313
+ exports.Nexus = Nexus;
12018
12314
  exports.PLANETARY_STRUCTURE_Z = PLANETARY_STRUCTURE_Z;
12019
12315
  exports.PLANET_SUBTYPE_GAS_GIANT = PLANET_SUBTYPE_GAS_GIANT;
12020
12316
  exports.PLANET_SUBTYPE_ICY = PLANET_SUBTYPE_ICY;
@@ -12038,20 +12334,11 @@ exports.REQUIRES_MORE_THAN_ONE = REQUIRES_MORE_THAN_ONE;
12038
12334
  exports.REQUIRES_POSITIVE_VALUE = REQUIRES_POSITIVE_VALUE;
12039
12335
  exports.RESERVE_TIERS = RESERVE_TIERS;
12040
12336
  exports.RESOLVE_COUNT_EXCEEDS_COMPLETED = RESOLVE_COUNT_EXCEEDS_COMPLETED;
12041
- exports.SHIP_ALREADY_THERE = SHIP_ALREADY_THERE;
12042
12337
  exports.SHIP_ALREADY_TRAVELING = SHIP_ALREADY_TRAVELING;
12043
12338
  exports.SHIP_CANNOT_BUY_TRAVELING = SHIP_CANNOT_BUY_TRAVELING;
12044
12339
  exports.SHIP_CANNOT_CANCEL_TASK = SHIP_CANNOT_CANCEL_TASK;
12045
12340
  exports.SHIP_CANNOT_UPDATE_TRAVELING = SHIP_CANNOT_UPDATE_TRAVELING;
12046
- exports.SHIP_CAPACITY_EXCEEDED = SHIP_CAPACITY_EXCEEDED;
12047
- exports.SHIP_CARGO_NOT_LOADED = SHIP_CARGO_NOT_LOADED;
12048
- exports.SHIP_CARGO_NOT_OWNED = SHIP_CARGO_NOT_OWNED;
12049
- exports.SHIP_INVALID_CARGO = SHIP_INVALID_CARGO;
12050
- exports.SHIP_INVALID_DESTINATION = SHIP_INVALID_DESTINATION;
12051
- exports.SHIP_INVALID_TRAVEL_DURATION = SHIP_INVALID_TRAVEL_DURATION;
12052
12341
  exports.SHIP_NOT_ARRIVED = SHIP_NOT_ARRIVED;
12053
- exports.SHIP_NOT_ENOUGH_ENERGY = SHIP_NOT_ENOUGH_ENERGY;
12054
- exports.SHIP_NOT_ENOUGH_ENERGY_CAPACITY = SHIP_NOT_ENOUGH_ENERGY_CAPACITY;
12055
12342
  exports.SHIP_NOT_FOUND = SHIP_NOT_FOUND;
12056
12343
  exports.SHIP_NOT_IDLE = SHIP_NOT_IDLE;
12057
12344
  exports.SHIP_NOT_OWNED = SHIP_NOT_OWNED;
@@ -12068,7 +12355,6 @@ exports.TIER_ADJECTIVES = TIER_ADJECTIVES;
12068
12355
  exports.TIER_ROLL_MAX = TIER_ROLL_MAX;
12069
12356
  exports.TRAVEL_MAX_DURATION = TRAVEL_MAX_DURATION;
12070
12357
  exports.WAREHOUSE_ALREADY_AT_LOCATION = WAREHOUSE_ALREADY_AT_LOCATION;
12071
- exports.WAREHOUSE_CAPACITY_EXCEEDED = WAREHOUSE_CAPACITY_EXCEEDED;
12072
12358
  exports.WAREHOUSE_NOT_FOUND = WAREHOUSE_NOT_FOUND;
12073
12359
  exports.WARP_HAS_CARGO = WARP_HAS_CARGO;
12074
12360
  exports.WARP_HAS_SCHEDULE = WARP_HAS_SCHEDULE;
@@ -12145,6 +12431,7 @@ exports.computeEngineDrain = computeEngineDrain;
12145
12431
  exports.computeEngineThrust = computeEngineThrust;
12146
12432
  exports.computeEntityStats = computeEntityStats;
12147
12433
  exports.computeExtractorCapabilities = computeExtractorCapabilities;
12434
+ exports.computeFactoryCapabilities = computeFactoryCapabilities;
12148
12435
  exports.computeGathererCapabilities = computeGathererCapabilities;
12149
12436
  exports.computeGathererDepth = computeGathererDepth;
12150
12437
  exports.computeGathererDrain = computeGathererDrain;
@@ -12205,6 +12492,7 @@ exports.entityDisplayName = entityDisplayName;
12205
12492
  exports.estimateDealTravelTime = estimateDealTravelTime;
12206
12493
  exports.estimateTravelTime = estimateTravelTime;
12207
12494
  exports.extractorTraits = extractorTraits;
12495
+ exports.factoryTraits = factoryTraits;
12208
12496
  exports.findItemByCategoryAndTier = findItemByCategoryAndTier;
12209
12497
  exports.findNearbyPlanets = findNearbyPlanets;
12210
12498
  exports.flightSpeedFactor = flightSpeedFactor;
@@ -12265,6 +12553,7 @@ exports.interpolateFlightPosition = interpolateFlightPosition;
12265
12553
  exports.isContainer = isContainer;
12266
12554
  exports.isCraftedItem = isCraftedItem;
12267
12555
  exports.isExtractor = isExtractor;
12556
+ exports.isFactory = isFactory;
12268
12557
  exports.isFull = isFull$1;
12269
12558
  exports.isFullFromMass = isFullFromMass;
12270
12559
  exports.isGatherableLocation = isGatherableLocation;
@@ -12284,6 +12573,8 @@ exports.itemTypeCode = itemTypeCode;
12284
12573
  exports.lerp = lerp$1;
12285
12574
  exports.makeContainer = makeContainer;
12286
12575
  exports.makeExtractor = makeExtractor;
12576
+ exports.makeFactory = makeFactory;
12577
+ exports.makeNexus = makeNexus;
12287
12578
  exports.makeShip = makeShip;
12288
12579
  exports.makeWarehouse = makeWarehouse;
12289
12580
  exports.mapEntity = mapEntity;