@shipload/sdk 1.0.0-next.2 → 1.0.0-next.20

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.
Files changed (85) hide show
  1. package/lib/shipload.d.ts +1709 -1044
  2. package/lib/shipload.js +6762 -4658
  3. package/lib/shipload.js.map +1 -1
  4. package/lib/shipload.m.js +6653 -4614
  5. package/lib/shipload.m.js.map +1 -1
  6. package/lib/testing.d.ts +833 -0
  7. package/lib/testing.js +3647 -0
  8. package/lib/testing.js.map +1 -0
  9. package/lib/testing.m.js +3641 -0
  10. package/lib/testing.m.js.map +1 -0
  11. package/package.json +15 -2
  12. package/src/capabilities/gathering.ts +17 -7
  13. package/src/capabilities/modules.ts +9 -0
  14. package/src/capabilities/storage.ts +1 -1
  15. package/src/contracts/platform.ts +211 -3
  16. package/src/contracts/server.ts +723 -438
  17. package/src/data/capabilities.ts +9 -329
  18. package/src/data/capability-formulas.ts +76 -0
  19. package/src/data/catalog.ts +0 -5
  20. package/src/data/colors.ts +14 -28
  21. package/src/data/entities.json +46 -10
  22. package/src/data/item-ids.ts +17 -13
  23. package/src/data/items.json +308 -37
  24. package/src/data/kind-registry.json +85 -0
  25. package/src/data/kind-registry.ts +150 -0
  26. package/src/data/metadata.ts +99 -24
  27. package/src/data/recipes-runtime.ts +3 -23
  28. package/src/data/recipes.json +265 -96
  29. package/src/derivation/build-methods.ts +45 -0
  30. package/src/derivation/capabilities.ts +414 -0
  31. package/src/derivation/capability-mappings.ts +117 -0
  32. package/src/derivation/crafting.ts +23 -24
  33. package/src/derivation/index.ts +8 -2
  34. package/src/derivation/reserve-regen.ts +34 -0
  35. package/src/derivation/resources.ts +125 -38
  36. package/src/derivation/stats.ts +1 -2
  37. package/src/derivation/stratum.ts +15 -19
  38. package/src/derivation/tiers.ts +28 -7
  39. package/src/entities/entity.ts +98 -0
  40. package/src/entities/gamestate.ts +3 -28
  41. package/src/entities/makers.ts +75 -129
  42. package/src/entities/slot-multiplier.ts +37 -0
  43. package/src/errors.ts +10 -15
  44. package/src/format.ts +26 -4
  45. package/src/index-module.ts +149 -40
  46. package/src/managers/actions.ts +184 -82
  47. package/src/managers/base.ts +2 -2
  48. package/src/managers/construction-types.ts +47 -0
  49. package/src/managers/construction.ts +147 -0
  50. package/src/managers/context.ts +9 -0
  51. package/src/managers/entities.ts +18 -66
  52. package/src/managers/epochs.ts +40 -0
  53. package/src/managers/index.ts +14 -1
  54. package/src/managers/locations.ts +2 -20
  55. package/src/managers/nft.ts +28 -0
  56. package/src/managers/plot.ts +123 -0
  57. package/src/nft/atomicassets.ts +231 -0
  58. package/src/nft/atomicdata.ts +130 -0
  59. package/src/nft/buildImmutableData.ts +319 -0
  60. package/src/nft/description.ts +45 -13
  61. package/src/nft/index.ts +3 -0
  62. package/src/resolution/describe-module.ts +5 -8
  63. package/src/resolution/display-name.ts +38 -10
  64. package/src/resolution/resolve-item.ts +20 -12
  65. package/src/scheduling/accessor.ts +4 -0
  66. package/src/scheduling/projection.ts +79 -27
  67. package/src/scheduling/schedule.ts +15 -1
  68. package/src/scheduling/task-cargo.ts +46 -0
  69. package/src/shipload.ts +5 -0
  70. package/src/subscriptions/manager.ts +40 -6
  71. package/src/subscriptions/mappers.ts +3 -8
  72. package/src/subscriptions/types.ts +3 -2
  73. package/src/testing/catalog-hash.ts +19 -0
  74. package/src/testing/index.ts +2 -0
  75. package/src/testing/projection-parity.ts +143 -0
  76. package/src/travel/travel.ts +61 -2
  77. package/src/types/index.ts +0 -1
  78. package/src/types.ts +17 -12
  79. package/src/utils/cargo.ts +27 -0
  80. package/src/utils/system.ts +25 -24
  81. package/src/entities/container.ts +0 -108
  82. package/src/entities/ship-deploy.ts +0 -258
  83. package/src/entities/ship.ts +0 -204
  84. package/src/entities/warehouse.ts +0 -119
  85. package/src/types/entity-traits.ts +0 -69
@@ -10,15 +10,19 @@ export {Types as ServerTypes} from './contracts/server'
10
10
  export {Types as PlatformTypes} from './contracts/platform'
11
11
 
12
12
  import type {ServerContract} from './contracts'
13
+ import type {Entity as EntityType} from './entities/entity'
13
14
 
14
15
  export {Shipload} from './shipload'
15
- export {Ship} from './entities/ship'
16
- export type {ShipStateInput, PackedModuleInput} from './entities/ship'
17
- export {Warehouse, computeWarehouseCapabilities} from './entities/warehouse'
18
- export type {WarehouseStateInput} from './entities/warehouse'
19
- export {Container} from './entities/container'
20
- export type {ContainerStateInput} from './entities/container'
21
- export {makeShip, makeWarehouse, makeContainer} from './entities/makers'
16
+ export {Entity} from './entities/entity'
17
+ export type Ship = EntityType
18
+ export type Warehouse = EntityType
19
+ export type Container = EntityType
20
+ export type Extractor = EntityType
21
+ export type Factory = EntityType
22
+ export type Nexus = EntityType
23
+ export {makeEntity} from './entities/makers'
24
+ export type {EntityStateInput, PackedModuleInput} from './entities/makers'
25
+ export type {InstalledModule} from './entities/slot-multiplier'
22
26
 
23
27
  export type movement_stats = ServerContract.Types.movement_stats
24
28
  export type energy_stats = ServerContract.Types.energy_stats
@@ -26,14 +30,11 @@ export type loader_stats = ServerContract.Types.loader_stats
26
30
  export type schedule = ServerContract.Types.schedule
27
31
  export type task = ServerContract.Types.task
28
32
  export type cargo_item = ServerContract.Types.cargo_item
29
- export type warehouse_row = ServerContract.Types.warehouse_row
30
- export type container_row = ServerContract.Types.container_row
33
+ export type entity_row = ServerContract.Types.entity_row
31
34
  export type gatherer_stats = ServerContract.Types.gatherer_stats
32
35
 
33
36
  export type location_static = ServerContract.Types.location_static
34
- export type location_epoch = ServerContract.Types.location_epoch
35
37
  export type location_derived = ServerContract.Types.location_derived
36
- export type location_row = ServerContract.Types.location_row
37
38
  export {Player} from './entities/player'
38
39
  export type {PlayerStateInput} from './entities/player'
39
40
  export {EntityInventory} from './entities/entity-inventory'
@@ -46,8 +47,19 @@ export {
46
47
  LocationsManager,
47
48
  EpochsManager,
48
49
  ActionsManager,
50
+ NftManager,
51
+ ConstructionManager,
52
+ } from './managers'
53
+ export type {
54
+ LocationStratum,
55
+ NftConfigForItem,
56
+ BuildableTarget,
57
+ BuildState,
58
+ SourceEntityRef,
59
+ SourceCargoStack,
60
+ FinalizerEntityRef,
61
+ FinalizerCapability,
49
62
  } from './managers'
50
- export type {EntityType, LocationStratum} from './managers'
51
63
  export type {EntityRefInput} from './managers/actions'
52
64
 
53
65
  export {
@@ -63,7 +75,6 @@ export {
63
75
  categoryLabel,
64
76
  categoryFromIndex,
65
77
  categoryLabelFromIndex,
66
- tierLabel,
67
78
  } from './data/catalog'
68
79
  export {getCurrentEpoch, getEpochInfo} from './scheduling/epoch'
69
80
  export type {EpochInfo} from './scheduling/epoch'
@@ -73,8 +84,8 @@ export {
73
84
  getLocationType,
74
85
  getLocationTypeName,
75
86
  isGatherableLocation,
87
+ isLocationBuildable,
76
88
  deriveLocationStatic,
77
- deriveLocationEpoch,
78
89
  deriveLocation,
79
90
  } from './utils/system'
80
91
 
@@ -86,6 +97,7 @@ export {
86
97
  getEligibleResources,
87
98
  getResourceWeight,
88
99
  getLocationCandidates,
100
+ getLocationProfile,
89
101
  getDepthThreshold,
90
102
  getResourceTier,
91
103
  DEPTH_THRESHOLD_T1,
@@ -95,6 +107,9 @@ export {
95
107
  DEPTH_THRESHOLD_T5,
96
108
  LOCATION_MIN_DEPTH,
97
109
  LOCATION_MAX_DEPTH,
110
+ yieldThresholdAt,
111
+ YIELD_FRACTION_SHALLOW,
112
+ YIELD_FRACTION_DEEP,
98
113
  PLANET_SUBTYPE_GAS_GIANT,
99
114
  PLANET_SUBTYPE_ROCKY,
100
115
  PLANET_SUBTYPE_TERRESTRIAL,
@@ -105,9 +120,12 @@ export {
105
120
 
106
121
  export type {StratumInfo, ResourceStats, DerivedStratum} from './derivation'
107
122
 
108
- export {RESERVE_TIERS, TIER_ROLL_MAX, rollTier, rollWithinTier} from './derivation'
123
+ export {RESERVE_TIERS, TIER_ROLL_MAX, tierOfReserve, rollTier, rollWithinTier} from './derivation'
109
124
  export type {ReserveTier, TierRange} from './derivation'
110
125
 
126
+ export {getEffectiveReserve} from './derivation'
127
+ export type {EffectiveReserveInput} from './derivation'
128
+
111
129
  export {getStatDefinitions, getStatName, resolveStats} from './derivation'
112
130
  export type {StatDefinition, NamedStats} from './derivation'
113
131
 
@@ -117,30 +135,35 @@ export {
117
135
  distanceBetweenCoordinates,
118
136
  distanceBetweenPoints,
119
137
  findNearbyPlanets,
120
- lerp,
121
- rotation,
122
- calc_ship_mass,
123
138
  calc_acceleration,
139
+ calc_energyusage,
124
140
  calc_flighttime,
125
- calc_ship_flighttime,
126
- calc_ship_acceleration,
127
- calc_rechargetime,
128
- calc_ship_rechargetime,
129
- calc_loader_flighttime,
130
141
  calc_loader_acceleration,
131
- calc_energyusage,
142
+ calc_loader_flighttime,
132
143
  calc_orbital_altitude,
144
+ calc_rechargetime,
145
+ calc_ship_acceleration,
146
+ calc_ship_flighttime,
147
+ calc_ship_mass,
148
+ calc_ship_rechargetime,
133
149
  calc_transfer_duration,
134
- calculateTransferTime,
150
+ calculateFlightTime,
135
151
  calculateLoadTimeBreakdown,
136
152
  calculateRefuelingTime,
137
- calculateFlightTime,
138
- estimateTravelTime,
153
+ calculateTransferTime,
154
+ easeFlightProgress,
139
155
  estimateDealTravelTime,
140
- hasEnergyForDistance,
141
- getFlightOrigin,
156
+ estimateTravelTime,
157
+ flightSpeedFactor,
158
+ type FloatPosition,
142
159
  getDestinationLocation,
160
+ getFlightOrigin,
161
+ getInterpolatedPosition,
143
162
  getPositionAt,
163
+ hasEnergyForDistance,
164
+ interpolateFlightPosition,
165
+ lerp,
166
+ rotation,
144
167
  } from './travel/travel'
145
168
  export type {
146
169
  LoadTimeBreakdown,
@@ -159,6 +182,8 @@ export type {HasCargo} from './entities/inventory-accessor'
159
182
  export * as cargoUtils from './entities/cargo-utils'
160
183
  export type {CargoData} from './entities/cargo-utils'
161
184
 
185
+ export {cargoRef, cargoItem} from './utils/cargo'
186
+
162
187
  export {
163
188
  createProjectedEntity,
164
189
  projectEntity,
@@ -174,14 +199,43 @@ export type {
174
199
  ProjectionOptions,
175
200
  } from './scheduling/projection'
176
201
 
202
+ export {taskCargoChanges} from './scheduling/task-cargo'
203
+ export type {TaskCargoChange, TaskCargoDirection} from './scheduling/task-cargo'
204
+
177
205
  export * from './types/capabilities'
178
206
  export * from './types/entity'
207
+ export {
208
+ EntityClass,
209
+ ENTITY_SHIP,
210
+ ENTITY_WAREHOUSE,
211
+ ENTITY_EXTRACTOR,
212
+ ENTITY_FACTORY,
213
+ ENTITY_CONTAINER,
214
+ ENTITY_NEXUS,
215
+ getEntityClass,
216
+ getPackedEntityType,
217
+ getKindMeta,
218
+ getTemplateMeta,
219
+ kindCan,
220
+ ALL_ENTITY_TYPES,
221
+ CAP_WRAP,
222
+ CAP_UNDEPLOY,
223
+ CAP_DEMOLISH,
224
+ CAP_MODULES,
225
+ isShip,
226
+ isWarehouse,
227
+ isExtractor,
228
+ isFactory,
229
+ isContainer,
230
+ isNexus,
231
+ isPlot,
232
+ } from './data/kind-registry'
233
+ export type {EntityTypeName, KindMeta, TemplateMeta} from './data/kind-registry'
179
234
  export * from './capabilities'
180
235
 
181
236
  export {
182
237
  categoryColors,
183
238
  tierColors,
184
- tierLabels,
185
239
  categoryIcons,
186
240
  categoryIconShapes,
187
241
  componentIcon,
@@ -202,14 +256,19 @@ export type {PlanetSubtypeInfo} from './data/locations'
202
256
  export {
203
257
  capabilityNames,
204
258
  capabilityAttributes,
205
- statMappings,
206
259
  isInvertedAttribute,
207
260
  getCapabilityAttributes,
261
+ } from './data/capabilities'
262
+ export type {CapabilityAttribute, StatMapping} from './data/capabilities'
263
+
264
+ export {
265
+ deriveStatMappings,
208
266
  getStatMappings,
209
267
  getStatMappingsForStat,
210
268
  getStatMappingsForCapability,
211
- } from './data/capabilities'
212
- export type {CapabilityAttribute, StatMapping} from './data/capabilities'
269
+ } from './derivation/capability-mappings'
270
+ export {SLOT_FORMULAS} from './data/capability-formulas'
271
+ export type {SlotConsumer, SlotConsumerKind} from './data/capability-formulas'
213
272
 
214
273
  export {
215
274
  encodeStats,
@@ -228,7 +287,15 @@ export {
228
287
  } from './derivation/crafting'
229
288
  export type {StackInput, CategoryStacks, RecipeSlotInput} from './derivation/crafting'
230
289
 
231
- export {computeContainerCapabilities, computeContainerT2Capabilities} from './entities/container'
290
+ export {
291
+ availableBuildMethods,
292
+ isBuildable,
293
+ isPlotBuildable,
294
+ filterByBuildMethod,
295
+ allBuildableItems,
296
+ allPlotBuildableItems,
297
+ } from './derivation/build-methods'
298
+ export type {BuildMethod} from './derivation/build-methods'
232
299
 
233
300
  export {
234
301
  computeShipHullCapabilities,
@@ -240,9 +307,16 @@ export {
240
307
  computeCrafterCapabilities,
241
308
  computeWarehouseHullCapabilities,
242
309
  computeStorageCapabilities,
243
- computeShipCapabilities,
244
- } from './entities/ship-deploy'
245
- export type {ShipCapabilities} from './entities/ship-deploy'
310
+ computeContainerCapabilities,
311
+ computeContainerT2Capabilities,
312
+ computeWarpCapabilities,
313
+ computeBaseCapacity,
314
+ computeEntityCapabilities,
315
+ GATHERER_DEPTH_TABLE,
316
+ GATHERER_DEPTH_MAX_TIER,
317
+ gathererDepthForTier,
318
+ } from './derivation/capabilities'
319
+ export type {GathererDepthParams, ComputedCapabilities} from './derivation/capabilities'
246
320
 
247
321
  export {resolveItem} from './resolution/resolve-item'
248
322
  export type {
@@ -282,6 +356,39 @@ export type {
282
356
  NFTCommonBase,
283
357
  } from './nft/deserializers'
284
358
 
359
+ export {deserializeAtomicData} from './nft/atomicdata'
360
+ export type {SchemaField, RawData} from './nft/atomicdata'
361
+
362
+ export {
363
+ buildImmutableData,
364
+ buildResourceImmutable,
365
+ buildComponentImmutable,
366
+ buildModuleImmutable,
367
+ buildEntityImmutable,
368
+ computeNftImageUrl,
369
+ } from './nft/buildImmutableData'
370
+ export type {
371
+ AtomicAttributeType,
372
+ ImmutableEntry,
373
+ ImmutableModuleSlot,
374
+ } from './nft/buildImmutableData'
375
+
376
+ export {
377
+ fetchAtomicAssetsForOwner,
378
+ fetchAtomicSchemas,
379
+ decodeAtomicAsset,
380
+ buildMintAssetAction,
381
+ ATOMICASSETS_ACCOUNT,
382
+ SHIPLOAD_COLLECTION,
383
+ } from './nft/atomicassets'
384
+ export type {
385
+ AtomicAssetRow,
386
+ AtomicSchemaRow,
387
+ DecodedAtomicAsset,
388
+ FetchAssetsOptions,
389
+ MintAssetParams,
390
+ } from './nft/atomicassets'
391
+
285
392
  export {
286
393
  buildEntityDescription,
287
394
  formatModuleLine,
@@ -297,11 +404,13 @@ export {
297
404
  computeGathererYield,
298
405
  computeGathererDrain,
299
406
  computeGathererDepth,
300
- computeGathererSpeed,
301
407
  computeLoaderMass,
302
408
  computeLoaderThrust,
303
409
  computeCrafterSpeed,
304
410
  computeCrafterDrain,
411
+ computeHaulerCapacity,
412
+ computeHaulerEfficiency,
413
+ computeWarpRange,
305
414
  } from './nft/description'
306
415
 
307
416
  export {
@@ -312,9 +421,9 @@ export {
312
421
  itemTypeCode,
313
422
  } from './data/tiers'
314
423
 
315
- export {formatMass, formatMassDelta} from './format'
424
+ export {formatMass, formatMassDelta, formatMassScaled, formatLocation} from './format'
316
425
 
317
- export {displayName, describeItem} from './resolution/display-name'
426
+ export {displayName, baseName, describeItem} from './resolution/display-name'
318
427
  export type {DescribeOptions} from './resolution/display-name'
319
428
 
320
429
  export * from './subscriptions'