@shipload/sdk 1.0.0-next.1 → 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.
Files changed (56) hide show
  1. package/lib/shipload.d.ts +618 -353
  2. package/lib/shipload.js +2250 -1059
  3. package/lib/shipload.js.map +1 -1
  4. package/lib/shipload.m.js +2193 -1044
  5. package/lib/shipload.m.js.map +1 -1
  6. package/package.json +2 -2
  7. package/src/capabilities/modules.ts +3 -0
  8. package/src/capabilities/storage.ts +1 -1
  9. package/src/contracts/platform.ts +13 -1
  10. package/src/contracts/server.ts +227 -282
  11. package/src/data/capabilities.ts +5 -330
  12. package/src/data/capability-formulas.ts +70 -0
  13. package/src/data/catalog.ts +0 -5
  14. package/src/data/colors.ts +2 -16
  15. package/src/data/entities.json +46 -10
  16. package/src/data/item-ids.ts +4 -1
  17. package/src/data/items.json +264 -0
  18. package/src/data/metadata.ts +63 -1
  19. package/src/data/recipes-runtime.ts +1 -0
  20. package/src/data/recipes.json +139 -11
  21. package/src/derivation/capability-mappings.ts +122 -0
  22. package/src/derivation/index.ts +1 -0
  23. package/src/derivation/resources.ts +116 -37
  24. package/src/derivation/stats.ts +1 -2
  25. package/src/entities/container.ts +25 -10
  26. package/src/entities/extractor.ts +144 -0
  27. package/src/entities/factory.ts +135 -0
  28. package/src/entities/gamestate.ts +0 -9
  29. package/src/entities/makers.ts +130 -20
  30. package/src/entities/nexus.ts +29 -0
  31. package/src/entities/ship-deploy.ts +114 -56
  32. package/src/entities/ship.ts +17 -0
  33. package/src/entities/slot-multiplier.ts +21 -0
  34. package/src/entities/warehouse.ts +20 -3
  35. package/src/errors.ts +10 -13
  36. package/src/index-module.ts +81 -26
  37. package/src/managers/actions.ts +53 -80
  38. package/src/managers/entities.ts +65 -17
  39. package/src/managers/locations.ts +2 -20
  40. package/src/nft/atomicdata.ts +128 -0
  41. package/src/nft/description.ts +41 -7
  42. package/src/nft/index.ts +1 -0
  43. package/src/resolution/resolve-item.ts +17 -9
  44. package/src/scheduling/accessor.ts +4 -0
  45. package/src/scheduling/projection.ts +10 -2
  46. package/src/scheduling/schedule.ts +15 -1
  47. package/src/scheduling/task-cargo.ts +47 -0
  48. package/src/subscriptions/connection.ts +50 -2
  49. package/src/subscriptions/manager.ts +84 -4
  50. package/src/subscriptions/mappers.ts +5 -1
  51. package/src/subscriptions/types.ts +2 -2
  52. package/src/travel/travel.ts +61 -2
  53. package/src/types/entity-traits.ts +103 -1
  54. package/src/types.ts +11 -1
  55. package/src/utils/cargo.ts +27 -0
  56. package/src/utils/system.ts +25 -24
@@ -10,6 +10,8 @@ import type {PackedModuleInput} from './ship'
10
10
  import {decodeCraftedItemStats} from '../derivation/crafting'
11
11
  import {getModuleCapabilityType, MODULE_LOADER} from '../capabilities/modules'
12
12
  import {computeLoaderCapabilities} from './ship-deploy'
13
+ import {applySlotMultiplier, clampUint16, getSlotAmp, type InstalledModule} from './slot-multiplier'
14
+ import type {EntitySlot} from '../data/recipes-runtime'
13
15
 
14
16
  export interface WarehouseStateInput {
15
17
  id: UInt64Type
@@ -31,6 +33,14 @@ export class Warehouse extends ServerContract.Types.entity_info {
31
33
  return this.entity_name
32
34
  }
33
35
 
36
+ get entityClass(): 'planetary' {
37
+ return 'planetary'
38
+ }
39
+
40
+ get canDemolish(): boolean {
41
+ return true
42
+ }
43
+
34
44
  get inv(): InventoryAccessor {
35
45
  this._inv ??= new InventoryAccessor(this)
36
46
  return this._inv
@@ -96,7 +106,10 @@ export class Warehouse extends ServerContract.Types.entity_info {
96
106
  }
97
107
  }
98
108
 
99
- export function computeWarehouseCapabilities(modules: {itemId: number; stats: bigint}[]): {
109
+ export function computeWarehouseCapabilities(
110
+ modules: InstalledModule[],
111
+ layout: EntitySlot[]
112
+ ): {
100
113
  loaders?: {mass: number; thrust: number; quantity: number}
101
114
  } {
102
115
  const warehouse: {loaders?: {mass: number; thrust: number; quantity: number}} = {}
@@ -109,10 +122,14 @@ export function computeWarehouseCapabilities(modules: {itemId: number; stats: bi
109
122
  for (const m of loaderModules) {
110
123
  const caps = computeLoaderCapabilities(decodeCraftedItemStats(m.itemId, m.stats))
111
124
  totalMass += caps.mass
112
- totalThrust += caps.thrust
125
+ totalThrust += applySlotMultiplier(caps.thrust, getSlotAmp(layout, m.slotIndex))
113
126
  totalQuantity += caps.quantity
114
127
  }
115
- warehouse.loaders = {mass: totalMass, thrust: totalThrust, quantity: totalQuantity}
128
+ warehouse.loaders = {
129
+ mass: totalMass,
130
+ thrust: clampUint16(totalThrust),
131
+ quantity: totalQuantity,
132
+ }
116
133
  }
117
134
 
118
135
  return warehouse
package/src/errors.ts CHANGED
@@ -18,18 +18,18 @@ export const PLAYER_NOT_JOINED = 'Player has not joined the game.'
18
18
  export const PLAYER_NOT_FOUND = 'Cannot find player for given account name.'
19
19
  export const STARTER_ALREADY_CLAIMED =
20
20
  'Starter ship already claimed; destroy existing ships to re-claim.'
21
- export const SHIP_ALREADY_THERE = 'Ship cannot travel to the location its already at.'
21
+ export const ENTITY_ALREADY_THERE = 'Entity cannot travel to the location it is already at.'
22
22
  export const SHIP_ALREADY_TRAVELING = 'Ship is already traveling.'
23
23
  export const SHIP_CANNOT_BUY_TRAVELING = 'Ship cannot buy goods while traveling.'
24
24
  export const SHIP_CANNOT_UPDATE_TRAVELING = 'Ship cannot be updated while traveling.'
25
- export const SHIP_INVALID_DESTINATION = 'Ship cannot travel, no system at specified destination.'
26
- export const SHIP_INVALID_TRAVEL_DURATION =
25
+ export const ENTITY_INVALID_DESTINATION = 'Cannot travel: no system at specified destination.'
26
+ export const ENTITY_INVALID_TRAVEL_DURATION =
27
27
  'This trip cannot be made as it would exceed the maximum travel duration.'
28
28
  export const SHIP_NOT_ARRIVED = 'Ship has not yet arrived at its destination.'
29
- export const SHIP_NOT_ENOUGH_ENERGY =
30
- 'Ship does not have enough energy to travel to the destination.'
31
- export const SHIP_NOT_ENOUGH_ENERGY_CAPACITY =
32
- 'Ship does not have enough energy capacity to travel.'
29
+ export const ENTITY_NOT_ENOUGH_ENERGY =
30
+ 'Entity does not have enough energy to travel to the destination.'
31
+ export const ENTITY_NOT_ENOUGH_ENERGY_CAPACITY =
32
+ 'Entity does not have enough energy capacity to travel.'
33
33
  export const SHIP_NOT_FOUND = 'Cannot find ship for given account.'
34
34
  export const SHIP_NOT_OWNED = 'Ship is not owned by this account.'
35
35
  export const NO_SCHEDULE = 'No scheduled tasks.'
@@ -38,16 +38,13 @@ export const SHIP_NO_COMPLETED_TASKS = 'No completed tasks to resolve.'
38
38
  export const RESOLVE_COUNT_EXCEEDS_COMPLETED = 'Requested resolve count exceeds completed tasks.'
39
39
  export const SHIP_CANNOT_CANCEL_TASK = 'Cannot cancel task that is immutable or in progress.'
40
40
  export const SHIP_NO_TASKS_TO_CANCEL = 'No tasks to cancel.'
41
- export const SHIP_INVALID_CARGO = 'Invalid cargo specified for load/unload.'
42
- export const SHIP_CARGO_NOT_OWNED = 'Cannot load cargo that is not owned.'
43
- export const SHIP_CARGO_NOT_LOADED = 'Cannot unload cargo that is not loaded.'
44
- export const SHIP_CAPACITY_EXCEEDED = 'Ship cargo capacity would be exceeded.'
41
+ export const ENTITY_INVALID_CARGO = 'Invalid cargo specified for load/unload.'
42
+ export const ENTITY_CARGO_NOT_OWNED = 'Cannot load cargo that is not owned.'
43
+ export const ENTITY_CARGO_NOT_LOADED = 'Cannot unload cargo that is not loaded.'
45
44
  export const ENTITY_CAPACITY_EXCEEDED = 'Entity cargo capacity would be exceeded.'
46
45
  export const WAREHOUSE_NOT_FOUND = 'Cannot find warehouse for given id.'
47
46
  export const WAREHOUSE_ALREADY_AT_LOCATION = 'Warehouse already exists at this location.'
48
- export const WAREHOUSE_CAPACITY_EXCEEDED = 'Warehouse capacity would be exceeded.'
49
47
  export const CONTAINER_NOT_FOUND = 'Cannot find container for given id.'
50
- export const CONTAINER_CAPACITY_EXCEEDED = 'Container capacity would be exceeded.'
51
48
  export const DESTINATION_CAPACITY_EXCEEDED =
52
49
  'Destination entity does not have enough capacity for the gather.'
53
50
  export const CANCEL_PAIRED_HAS_PENDING = 'Cannot cancel transfer, paired entity has pending tasks.'
@@ -16,9 +16,22 @@ export {Ship} from './entities/ship'
16
16
  export type {ShipStateInput, PackedModuleInput} from './entities/ship'
17
17
  export {Warehouse, computeWarehouseCapabilities} from './entities/warehouse'
18
18
  export type {WarehouseStateInput} from './entities/warehouse'
19
+ export {Extractor, computeExtractorCapabilities} from './entities/extractor'
20
+ export type {ExtractorStateInput, ExtractorCapabilities} from './entities/extractor'
21
+ export {Factory, computeFactoryCapabilities} from './entities/factory'
22
+ export type {FactoryStateInput, FactoryCapabilities} from './entities/factory'
19
23
  export {Container} from './entities/container'
20
24
  export type {ContainerStateInput} from './entities/container'
21
- export {makeShip, makeWarehouse, makeContainer} from './entities/makers'
25
+ export {Nexus} from './entities/nexus'
26
+ export type {NexusStateInput} from './entities/nexus'
27
+ export {
28
+ makeShip,
29
+ makeWarehouse,
30
+ makeExtractor,
31
+ makeFactory,
32
+ makeContainer,
33
+ makeNexus,
34
+ } from './entities/makers'
22
35
 
23
36
  export type movement_stats = ServerContract.Types.movement_stats
24
37
  export type energy_stats = ServerContract.Types.energy_stats
@@ -26,14 +39,11 @@ export type loader_stats = ServerContract.Types.loader_stats
26
39
  export type schedule = ServerContract.Types.schedule
27
40
  export type task = ServerContract.Types.task
28
41
  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
42
+ export type entity_row = ServerContract.Types.entity_row
31
43
  export type gatherer_stats = ServerContract.Types.gatherer_stats
32
44
 
33
45
  export type location_static = ServerContract.Types.location_static
34
- export type location_epoch = ServerContract.Types.location_epoch
35
46
  export type location_derived = ServerContract.Types.location_derived
36
- export type location_row = ServerContract.Types.location_row
37
47
  export {Player} from './entities/player'
38
48
  export type {PlayerStateInput} from './entities/player'
39
49
  export {EntityInventory} from './entities/entity-inventory'
@@ -63,7 +73,6 @@ export {
63
73
  categoryLabel,
64
74
  categoryFromIndex,
65
75
  categoryLabelFromIndex,
66
- tierLabel,
67
76
  } from './data/catalog'
68
77
  export {getCurrentEpoch, getEpochInfo} from './scheduling/epoch'
69
78
  export type {EpochInfo} from './scheduling/epoch'
@@ -73,8 +82,8 @@ export {
73
82
  getLocationType,
74
83
  getLocationTypeName,
75
84
  isGatherableLocation,
85
+ isLocationBuildable,
76
86
  deriveLocationStatic,
77
- deriveLocationEpoch,
78
87
  deriveLocation,
79
88
  } from './utils/system'
80
89
 
@@ -86,6 +95,7 @@ export {
86
95
  getEligibleResources,
87
96
  getResourceWeight,
88
97
  getLocationCandidates,
98
+ getLocationProfile,
89
99
  getDepthThreshold,
90
100
  getResourceTier,
91
101
  DEPTH_THRESHOLD_T1,
@@ -117,30 +127,35 @@ export {
117
127
  distanceBetweenCoordinates,
118
128
  distanceBetweenPoints,
119
129
  findNearbyPlanets,
120
- lerp,
121
- rotation,
122
- calc_ship_mass,
123
130
  calc_acceleration,
131
+ calc_energyusage,
124
132
  calc_flighttime,
125
- calc_ship_flighttime,
126
- calc_ship_acceleration,
127
- calc_rechargetime,
128
- calc_ship_rechargetime,
129
- calc_loader_flighttime,
130
133
  calc_loader_acceleration,
131
- calc_energyusage,
134
+ calc_loader_flighttime,
132
135
  calc_orbital_altitude,
136
+ calc_rechargetime,
137
+ calc_ship_acceleration,
138
+ calc_ship_flighttime,
139
+ calc_ship_mass,
140
+ calc_ship_rechargetime,
133
141
  calc_transfer_duration,
134
- calculateTransferTime,
142
+ calculateFlightTime,
135
143
  calculateLoadTimeBreakdown,
136
144
  calculateRefuelingTime,
137
- calculateFlightTime,
138
- estimateTravelTime,
145
+ calculateTransferTime,
146
+ easeFlightProgress,
139
147
  estimateDealTravelTime,
140
- hasEnergyForDistance,
141
- getFlightOrigin,
148
+ estimateTravelTime,
149
+ flightSpeedFactor,
150
+ type FloatPosition,
142
151
  getDestinationLocation,
152
+ getFlightOrigin,
153
+ getInterpolatedPosition,
143
154
  getPositionAt,
155
+ hasEnergyForDistance,
156
+ interpolateFlightPosition,
157
+ lerp,
158
+ rotation,
144
159
  } from './travel/travel'
145
160
  export type {
146
161
  LoadTimeBreakdown,
@@ -159,6 +174,8 @@ export type {HasCargo} from './entities/inventory-accessor'
159
174
  export * as cargoUtils from './entities/cargo-utils'
160
175
  export type {CargoData} from './entities/cargo-utils'
161
176
 
177
+ export {cargoRef, cargoItem} from './utils/cargo'
178
+
162
179
  export {
163
180
  createProjectedEntity,
164
181
  projectEntity,
@@ -174,14 +191,38 @@ export type {
174
191
  ProjectionOptions,
175
192
  } from './scheduling/projection'
176
193
 
194
+ export {taskCargoChanges} from './scheduling/task-cargo'
195
+ export type {TaskCargoChange, TaskCargoDirection} from './scheduling/task-cargo'
196
+
177
197
  export * from './types/capabilities'
178
198
  export * from './types/entity'
199
+ export {
200
+ EntityClass,
201
+ ENTITY_SHIP,
202
+ ENTITY_WAREHOUSE,
203
+ ENTITY_EXTRACTOR,
204
+ ENTITY_FACTORY,
205
+ ENTITY_CONTAINER,
206
+ shipTraits,
207
+ warehouseTraits,
208
+ extractorTraits,
209
+ factoryTraits,
210
+ containerTraits,
211
+ getEntityClass,
212
+ getPackedEntityType,
213
+ getEntityTraits,
214
+ isShip,
215
+ isWarehouse,
216
+ isExtractor,
217
+ isFactory,
218
+ isContainer,
219
+ } from './types/entity-traits'
220
+ export type {EntityTraits, EntityTypeName} from './types/entity-traits'
179
221
  export * from './capabilities'
180
222
 
181
223
  export {
182
224
  categoryColors,
183
225
  tierColors,
184
- tierLabels,
185
226
  categoryIcons,
186
227
  categoryIconShapes,
187
228
  componentIcon,
@@ -202,14 +243,19 @@ export type {PlanetSubtypeInfo} from './data/locations'
202
243
  export {
203
244
  capabilityNames,
204
245
  capabilityAttributes,
205
- statMappings,
206
246
  isInvertedAttribute,
207
247
  getCapabilityAttributes,
248
+ } from './data/capabilities'
249
+ export type {CapabilityAttribute, StatMapping} from './data/capabilities'
250
+
251
+ export {
252
+ deriveStatMappings,
208
253
  getStatMappings,
209
254
  getStatMappingsForStat,
210
255
  getStatMappingsForCapability,
211
- } from './data/capabilities'
212
- export type {CapabilityAttribute, StatMapping} from './data/capabilities'
256
+ } from './derivation/capability-mappings'
257
+ export {SLOT_FORMULAS} from './data/capability-formulas'
258
+ export type {SlotConsumer, SlotConsumerKind} from './data/capability-formulas'
213
259
 
214
260
  export {
215
261
  encodeStats,
@@ -241,8 +287,11 @@ export {
241
287
  computeWarehouseHullCapabilities,
242
288
  computeStorageCapabilities,
243
289
  computeShipCapabilities,
290
+ GATHERER_DEPTH_TABLE,
291
+ GATHERER_DEPTH_MAX_TIER,
292
+ gathererDepthForTier,
244
293
  } from './entities/ship-deploy'
245
- export type {ShipCapabilities} from './entities/ship-deploy'
294
+ export type {ShipCapabilities, GathererDepthParams} from './entities/ship-deploy'
246
295
 
247
296
  export {resolveItem} from './resolution/resolve-item'
248
297
  export type {
@@ -282,6 +331,9 @@ export type {
282
331
  NFTCommonBase,
283
332
  } from './nft/deserializers'
284
333
 
334
+ export {deserializeAtomicData} from './nft/atomicdata'
335
+ export type {SchemaField, RawData} from './nft/atomicdata'
336
+
285
337
  export {
286
338
  buildEntityDescription,
287
339
  formatModuleLine,
@@ -302,6 +354,9 @@ export {
302
354
  computeLoaderThrust,
303
355
  computeCrafterSpeed,
304
356
  computeCrafterDrain,
357
+ computeHaulerCapacity,
358
+ computeHaulerEfficiency,
359
+ computeWarpRange,
305
360
  } from './nft/description'
306
361
 
307
362
  export {
@@ -11,11 +11,11 @@ import {
11
11
  type UInt64Type,
12
12
  } from '@wharfkit/antelope'
13
13
  import {BaseManager} from './base'
14
- import {type CoordinatesType, EntityType, type EntityTypeName} from '../types'
14
+ import type {CoordinatesType} from '../types'
15
15
  import {ServerContract} from '../contracts'
16
16
 
17
17
  export type EntityRefInput = {
18
- entityType: EntityTypeName
18
+ entityType: NameType
19
19
  entityId: UInt64Type
20
20
  }
21
21
 
@@ -25,7 +25,6 @@ export class ActionsManager extends BaseManager {
25
25
  const y = Int64.from(destination.y)
26
26
 
27
27
  return this.server.action('travel', {
28
- entity_type: EntityType.SHIP,
29
28
  id: UInt64.from(shipId),
30
29
  x,
31
30
  y,
@@ -51,13 +50,8 @@ export class ActionsManager extends BaseManager {
51
50
  })
52
51
  }
53
52
 
54
- resolve(
55
- entityId: UInt64Type,
56
- entityType: EntityTypeName = EntityType.SHIP,
57
- count?: UInt64Type
58
- ): Action {
53
+ resolve(entityId: UInt64Type, count?: UInt64Type): Action {
59
54
  const params: ServerContract.ActionParams.resolve = {
60
- entity_type: entityType,
61
55
  id: UInt64.from(entityId),
62
56
  }
63
57
  if (count !== undefined) {
@@ -66,42 +60,34 @@ export class ActionsManager extends BaseManager {
66
60
  return this.server.action('resolve', params)
67
61
  }
68
62
 
69
- cancel(
70
- entityId: UInt64Type,
71
- count: UInt64Type,
72
- entityType: EntityTypeName = EntityType.SHIP
73
- ): Action {
63
+ cancel(entityId: UInt64Type, count: UInt64Type): Action {
74
64
  return this.server.action('cancel', {
75
- entity_type: entityType,
76
65
  id: UInt64.from(entityId),
77
66
  count: UInt64.from(count),
78
67
  })
79
68
  }
80
69
 
81
- recharge(entityId: UInt64Type, entityType: EntityTypeName = EntityType.SHIP): Action {
70
+ recharge(entityId: UInt64Type): Action {
82
71
  return this.server.action('recharge', {
83
- entity_type: entityType,
84
72
  id: UInt64.from(entityId),
85
73
  })
86
74
  }
87
75
 
76
+ refrshentity(entityId: UInt64Type): Action {
77
+ return this.server.action('refrshentity', {
78
+ entity_id: UInt64.from(entityId),
79
+ })
80
+ }
81
+
88
82
  transfer(
89
- sourceType: EntityTypeName,
90
83
  sourceId: UInt64Type,
91
- destType: EntityTypeName,
92
84
  destId: UInt64Type,
93
- itemId: UInt64Type,
94
- stats: UInt64Type,
95
- quantity: UInt64Type
85
+ items: ServerContract.ActionParams.Type.cargo_item[]
96
86
  ): Action {
97
87
  return this.server.action('transfer', {
98
- source_type: sourceType,
99
88
  source_id: UInt64.from(sourceId),
100
- dest_type: destType,
101
89
  dest_id: UInt64.from(destId),
102
- item_id: UInt16.from(itemId),
103
- stats: UInt64.from(stats),
104
- quantity: UInt32.from(quantity),
90
+ items,
105
91
  })
106
92
  }
107
93
 
@@ -119,35 +105,24 @@ export class ActionsManager extends BaseManager {
119
105
  }
120
106
 
121
107
  gather(
122
- source: EntityRefInput,
123
- destination: EntityRefInput,
108
+ sourceId: UInt64Type,
109
+ destinationId: UInt64Type,
124
110
  stratum: UInt16Type,
125
111
  quantity: UInt32Type
126
112
  ): Action {
127
113
  return this.server.action('gather', {
128
- source: ServerContract.Types.entity_ref.from({
129
- entity_type: source.entityType,
130
- entity_id: UInt64.from(source.entityId),
131
- }),
132
- destination: ServerContract.Types.entity_ref.from({
133
- entity_type: destination.entityType,
134
- entity_id: UInt64.from(destination.entityId),
135
- }),
114
+ source_id: UInt64.from(sourceId),
115
+ destination_id: UInt64.from(destinationId),
136
116
  stratum: UInt16.from(stratum),
137
117
  quantity: UInt32.from(quantity),
138
118
  })
139
119
  }
140
120
 
141
- warp(
142
- entityId: UInt64Type,
143
- destination: CoordinatesType,
144
- entityType: EntityTypeName = EntityType.SHIP
145
- ): Action {
121
+ warp(entityId: UInt64Type, destination: CoordinatesType): Action {
146
122
  const x = Int64.from(destination.x)
147
123
  const y = Int64.from(destination.y)
148
124
 
149
125
  return this.server.action('warp', {
150
- entity_type: entityType,
151
126
  id: UInt64.from(entityId),
152
127
  x,
153
128
  y,
@@ -155,92 +130,90 @@ export class ActionsManager extends BaseManager {
155
130
  }
156
131
 
157
132
  craft(
158
- entityType: EntityTypeName,
159
133
  entityId: UInt64Type,
160
134
  recipeId: number,
161
135
  quantity: number,
162
136
  inputs: ServerContract.ActionParams.Type.cargo_item[]
163
137
  ): Action {
164
- const cargoInputs = inputs.map((i) => ServerContract.Types.cargo_item.from(i))
165
138
  return this.server.action('craft', {
166
- entity_type: entityType,
167
139
  id: UInt64.from(entityId),
168
140
  recipe_id: UInt16.from(recipeId),
169
141
  quantity: UInt32.from(quantity),
170
- inputs: cargoInputs,
142
+ inputs,
171
143
  })
172
144
  }
173
145
 
174
- blend(
175
- entityType: EntityTypeName,
176
- entityId: UInt64Type,
177
- inputs: ServerContract.ActionParams.Type.cargo_item[]
178
- ): Action {
179
- const cargoInputs = inputs.map((i) => ServerContract.Types.cargo_item.from(i))
146
+ blend(entityId: UInt64Type, inputs: ServerContract.ActionParams.Type.cargo_item[]): Action {
180
147
  return this.server.action('blend', {
181
- entity_type: entityType,
182
148
  id: UInt64.from(entityId),
183
- inputs: cargoInputs,
149
+ inputs,
184
150
  })
185
151
  }
186
152
 
187
- deploy(
188
- entityType: EntityTypeName,
189
- entityId: UInt64Type,
190
- packedItemId: number,
191
- stats: bigint
192
- ): Action {
153
+ deploy(entityId: UInt64Type, ref: ServerContract.ActionParams.Type.cargo_ref): Action {
193
154
  return this.server.action('deploy', {
194
- entity_type: entityType,
195
155
  id: UInt64.from(entityId),
196
- packed_item_id: UInt16.from(packedItemId),
197
- stats: UInt64.from(stats),
156
+ ref,
198
157
  })
199
158
  }
200
159
 
201
160
  addmodule(
202
- entityType: EntityTypeName,
203
161
  entityId: UInt64Type,
204
162
  moduleIndex: number,
205
- moduleCargoId: UInt64Type,
206
- targetCargoId: UInt64Type = UInt64.from(0)
163
+ moduleRef: ServerContract.ActionParams.Type.cargo_ref,
164
+ targetRef: ServerContract.ActionParams.Type.cargo_ref | null = null
207
165
  ): Action {
208
166
  return this.server.action('addmodule', {
209
- entity_type: entityType,
210
167
  entity_id: UInt64.from(entityId),
211
168
  module_index: moduleIndex,
212
- module_cargo_id: UInt64.from(moduleCargoId),
213
- target_cargo_id: UInt64.from(targetCargoId),
169
+ module_ref: moduleRef,
170
+ target_ref: targetRef ?? undefined,
214
171
  })
215
172
  }
216
173
 
217
174
  rmmodule(
218
- entityType: EntityTypeName,
219
175
  entityId: UInt64Type,
220
176
  moduleIndex: number,
221
- targetCargoId: UInt64Type = UInt64.from(0)
177
+ targetRef: ServerContract.ActionParams.Type.cargo_ref | null = null
222
178
  ): Action {
223
179
  return this.server.action('rmmodule', {
224
- entity_type: entityType,
225
180
  entity_id: UInt64.from(entityId),
226
181
  module_index: moduleIndex,
227
- target_cargo_id: UInt64.from(targetCargoId),
182
+ target_ref: targetRef ?? undefined,
228
183
  })
229
184
  }
230
185
 
231
186
  wrap(
232
187
  owner: NameType,
233
- entityType: EntityTypeName,
234
188
  entityId: UInt64Type,
235
- cargoId: UInt64Type,
236
- quantity: UInt64Type
189
+ nexusId: UInt64Type,
190
+ items: ServerContract.ActionParams.Type.cargo_item[]
237
191
  ): Action {
238
192
  return this.server.action('wrap', {
239
193
  owner: Name.from(owner),
240
- entity_type: entityType,
241
194
  entity_id: UInt64.from(entityId),
242
- cargo_id: UInt64.from(cargoId),
243
- quantity: UInt64.from(quantity),
195
+ nexus_id: UInt64.from(nexusId),
196
+ items,
197
+ })
198
+ }
199
+
200
+ undeploy(hostId: UInt64Type, targetId: UInt64Type): Action {
201
+ return this.server.action('undeploy', {
202
+ host_id: UInt64.from(hostId),
203
+ target_id: UInt64.from(targetId),
204
+ })
205
+ }
206
+
207
+ wrapEntity(entityId: UInt64Type, nexusId: UInt64Type): Action {
208
+ return this.server.action('wrapentity', {
209
+ entity_id: UInt64.from(entityId),
210
+ nexus_id: UInt64.from(nexusId),
211
+ })
212
+ }
213
+
214
+ demolish(entityId: UInt64Type): Action {
215
+ return this.server.action('demolish', {
216
+ entity_id: UInt64.from(entityId),
244
217
  })
245
218
  }
246
219