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

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 +1731 -1044
  2. package/lib/shipload.js +6758 -4523
  3. package/lib/shipload.js.map +1 -1
  4. package/lib/shipload.m.js +6649 -4479
  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 +151 -40
  46. package/src/managers/actions.ts +184 -82
  47. package/src/managers/base.ts +2 -2
  48. package/src/managers/construction-types.ts +68 -0
  49. package/src/managers/construction.ts +292 -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 +16 -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,21 @@ 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,
62
+ InboundTransfer,
63
+ Reservation,
49
64
  } from './managers'
50
- export type {EntityType, LocationStratum} from './managers'
51
65
  export type {EntityRefInput} from './managers/actions'
52
66
 
53
67
  export {
@@ -63,7 +77,6 @@ export {
63
77
  categoryLabel,
64
78
  categoryFromIndex,
65
79
  categoryLabelFromIndex,
66
- tierLabel,
67
80
  } from './data/catalog'
68
81
  export {getCurrentEpoch, getEpochInfo} from './scheduling/epoch'
69
82
  export type {EpochInfo} from './scheduling/epoch'
@@ -73,8 +86,8 @@ export {
73
86
  getLocationType,
74
87
  getLocationTypeName,
75
88
  isGatherableLocation,
89
+ isLocationBuildable,
76
90
  deriveLocationStatic,
77
- deriveLocationEpoch,
78
91
  deriveLocation,
79
92
  } from './utils/system'
80
93
 
@@ -86,6 +99,7 @@ export {
86
99
  getEligibleResources,
87
100
  getResourceWeight,
88
101
  getLocationCandidates,
102
+ getLocationProfile,
89
103
  getDepthThreshold,
90
104
  getResourceTier,
91
105
  DEPTH_THRESHOLD_T1,
@@ -95,6 +109,9 @@ export {
95
109
  DEPTH_THRESHOLD_T5,
96
110
  LOCATION_MIN_DEPTH,
97
111
  LOCATION_MAX_DEPTH,
112
+ yieldThresholdAt,
113
+ YIELD_FRACTION_SHALLOW,
114
+ YIELD_FRACTION_DEEP,
98
115
  PLANET_SUBTYPE_GAS_GIANT,
99
116
  PLANET_SUBTYPE_ROCKY,
100
117
  PLANET_SUBTYPE_TERRESTRIAL,
@@ -105,9 +122,12 @@ export {
105
122
 
106
123
  export type {StratumInfo, ResourceStats, DerivedStratum} from './derivation'
107
124
 
108
- export {RESERVE_TIERS, TIER_ROLL_MAX, rollTier, rollWithinTier} from './derivation'
125
+ export {RESERVE_TIERS, TIER_ROLL_MAX, tierOfReserve, rollTier, rollWithinTier} from './derivation'
109
126
  export type {ReserveTier, TierRange} from './derivation'
110
127
 
128
+ export {getEffectiveReserve} from './derivation'
129
+ export type {EffectiveReserveInput} from './derivation'
130
+
111
131
  export {getStatDefinitions, getStatName, resolveStats} from './derivation'
112
132
  export type {StatDefinition, NamedStats} from './derivation'
113
133
 
@@ -117,30 +137,35 @@ export {
117
137
  distanceBetweenCoordinates,
118
138
  distanceBetweenPoints,
119
139
  findNearbyPlanets,
120
- lerp,
121
- rotation,
122
- calc_ship_mass,
123
140
  calc_acceleration,
141
+ calc_energyusage,
124
142
  calc_flighttime,
125
- calc_ship_flighttime,
126
- calc_ship_acceleration,
127
- calc_rechargetime,
128
- calc_ship_rechargetime,
129
- calc_loader_flighttime,
130
143
  calc_loader_acceleration,
131
- calc_energyusage,
144
+ calc_loader_flighttime,
132
145
  calc_orbital_altitude,
146
+ calc_rechargetime,
147
+ calc_ship_acceleration,
148
+ calc_ship_flighttime,
149
+ calc_ship_mass,
150
+ calc_ship_rechargetime,
133
151
  calc_transfer_duration,
134
- calculateTransferTime,
152
+ calculateFlightTime,
135
153
  calculateLoadTimeBreakdown,
136
154
  calculateRefuelingTime,
137
- calculateFlightTime,
138
- estimateTravelTime,
155
+ calculateTransferTime,
156
+ easeFlightProgress,
139
157
  estimateDealTravelTime,
140
- hasEnergyForDistance,
141
- getFlightOrigin,
158
+ estimateTravelTime,
159
+ flightSpeedFactor,
160
+ type FloatPosition,
142
161
  getDestinationLocation,
162
+ getFlightOrigin,
163
+ getInterpolatedPosition,
143
164
  getPositionAt,
165
+ hasEnergyForDistance,
166
+ interpolateFlightPosition,
167
+ lerp,
168
+ rotation,
144
169
  } from './travel/travel'
145
170
  export type {
146
171
  LoadTimeBreakdown,
@@ -159,6 +184,8 @@ export type {HasCargo} from './entities/inventory-accessor'
159
184
  export * as cargoUtils from './entities/cargo-utils'
160
185
  export type {CargoData} from './entities/cargo-utils'
161
186
 
187
+ export {cargoRef, cargoItem} from './utils/cargo'
188
+
162
189
  export {
163
190
  createProjectedEntity,
164
191
  projectEntity,
@@ -174,14 +201,43 @@ export type {
174
201
  ProjectionOptions,
175
202
  } from './scheduling/projection'
176
203
 
204
+ export {taskCargoChanges} from './scheduling/task-cargo'
205
+ export type {TaskCargoChange, TaskCargoDirection} from './scheduling/task-cargo'
206
+
177
207
  export * from './types/capabilities'
178
208
  export * from './types/entity'
209
+ export {
210
+ EntityClass,
211
+ ENTITY_SHIP,
212
+ ENTITY_WAREHOUSE,
213
+ ENTITY_EXTRACTOR,
214
+ ENTITY_FACTORY,
215
+ ENTITY_CONTAINER,
216
+ ENTITY_NEXUS,
217
+ getEntityClass,
218
+ getPackedEntityType,
219
+ getKindMeta,
220
+ getTemplateMeta,
221
+ kindCan,
222
+ ALL_ENTITY_TYPES,
223
+ CAP_WRAP,
224
+ CAP_UNDEPLOY,
225
+ CAP_DEMOLISH,
226
+ CAP_MODULES,
227
+ isShip,
228
+ isWarehouse,
229
+ isExtractor,
230
+ isFactory,
231
+ isContainer,
232
+ isNexus,
233
+ isPlot,
234
+ } from './data/kind-registry'
235
+ export type {EntityTypeName, KindMeta, TemplateMeta} from './data/kind-registry'
179
236
  export * from './capabilities'
180
237
 
181
238
  export {
182
239
  categoryColors,
183
240
  tierColors,
184
- tierLabels,
185
241
  categoryIcons,
186
242
  categoryIconShapes,
187
243
  componentIcon,
@@ -202,14 +258,19 @@ export type {PlanetSubtypeInfo} from './data/locations'
202
258
  export {
203
259
  capabilityNames,
204
260
  capabilityAttributes,
205
- statMappings,
206
261
  isInvertedAttribute,
207
262
  getCapabilityAttributes,
263
+ } from './data/capabilities'
264
+ export type {CapabilityAttribute, StatMapping} from './data/capabilities'
265
+
266
+ export {
267
+ deriveStatMappings,
208
268
  getStatMappings,
209
269
  getStatMappingsForStat,
210
270
  getStatMappingsForCapability,
211
- } from './data/capabilities'
212
- export type {CapabilityAttribute, StatMapping} from './data/capabilities'
271
+ } from './derivation/capability-mappings'
272
+ export {SLOT_FORMULAS} from './data/capability-formulas'
273
+ export type {SlotConsumer, SlotConsumerKind} from './data/capability-formulas'
213
274
 
214
275
  export {
215
276
  encodeStats,
@@ -228,7 +289,15 @@ export {
228
289
  } from './derivation/crafting'
229
290
  export type {StackInput, CategoryStacks, RecipeSlotInput} from './derivation/crafting'
230
291
 
231
- export {computeContainerCapabilities, computeContainerT2Capabilities} from './entities/container'
292
+ export {
293
+ availableBuildMethods,
294
+ isBuildable,
295
+ isPlotBuildable,
296
+ filterByBuildMethod,
297
+ allBuildableItems,
298
+ allPlotBuildableItems,
299
+ } from './derivation/build-methods'
300
+ export type {BuildMethod} from './derivation/build-methods'
232
301
 
233
302
  export {
234
303
  computeShipHullCapabilities,
@@ -240,9 +309,16 @@ export {
240
309
  computeCrafterCapabilities,
241
310
  computeWarehouseHullCapabilities,
242
311
  computeStorageCapabilities,
243
- computeShipCapabilities,
244
- } from './entities/ship-deploy'
245
- export type {ShipCapabilities} from './entities/ship-deploy'
312
+ computeContainerCapabilities,
313
+ computeContainerT2Capabilities,
314
+ computeWarpCapabilities,
315
+ computeBaseCapacity,
316
+ computeEntityCapabilities,
317
+ GATHERER_DEPTH_TABLE,
318
+ GATHERER_DEPTH_MAX_TIER,
319
+ gathererDepthForTier,
320
+ } from './derivation/capabilities'
321
+ export type {GathererDepthParams, ComputedCapabilities} from './derivation/capabilities'
246
322
 
247
323
  export {resolveItem} from './resolution/resolve-item'
248
324
  export type {
@@ -282,6 +358,39 @@ export type {
282
358
  NFTCommonBase,
283
359
  } from './nft/deserializers'
284
360
 
361
+ export {deserializeAtomicData} from './nft/atomicdata'
362
+ export type {SchemaField, RawData} from './nft/atomicdata'
363
+
364
+ export {
365
+ buildImmutableData,
366
+ buildResourceImmutable,
367
+ buildComponentImmutable,
368
+ buildModuleImmutable,
369
+ buildEntityImmutable,
370
+ computeNftImageUrl,
371
+ } from './nft/buildImmutableData'
372
+ export type {
373
+ AtomicAttributeType,
374
+ ImmutableEntry,
375
+ ImmutableModuleSlot,
376
+ } from './nft/buildImmutableData'
377
+
378
+ export {
379
+ fetchAtomicAssetsForOwner,
380
+ fetchAtomicSchemas,
381
+ decodeAtomicAsset,
382
+ buildMintAssetAction,
383
+ ATOMICASSETS_ACCOUNT,
384
+ SHIPLOAD_COLLECTION,
385
+ } from './nft/atomicassets'
386
+ export type {
387
+ AtomicAssetRow,
388
+ AtomicSchemaRow,
389
+ DecodedAtomicAsset,
390
+ FetchAssetsOptions,
391
+ MintAssetParams,
392
+ } from './nft/atomicassets'
393
+
285
394
  export {
286
395
  buildEntityDescription,
287
396
  formatModuleLine,
@@ -297,11 +406,13 @@ export {
297
406
  computeGathererYield,
298
407
  computeGathererDrain,
299
408
  computeGathererDepth,
300
- computeGathererSpeed,
301
409
  computeLoaderMass,
302
410
  computeLoaderThrust,
303
411
  computeCrafterSpeed,
304
412
  computeCrafterDrain,
413
+ computeHaulerCapacity,
414
+ computeHaulerEfficiency,
415
+ computeWarpRange,
305
416
  } from './nft/description'
306
417
 
307
418
  export {
@@ -312,9 +423,9 @@ export {
312
423
  itemTypeCode,
313
424
  } from './data/tiers'
314
425
 
315
- export {formatMass, formatMassDelta} from './format'
426
+ export {formatMass, formatMassDelta, formatMassScaled, formatLocation} from './format'
316
427
 
317
- export {displayName, describeItem} from './resolution/display-name'
428
+ export {displayName, baseName, describeItem} from './resolution/display-name'
318
429
  export type {DescribeOptions} from './resolution/display-name'
319
430
 
320
431
  export * from './subscriptions'