@shipload/sdk 2.0.0-rc6 → 2.0.0-rc7

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.
@@ -1,8 +1,20 @@
1
+ import {MODULE_ENGINE, MODULE_GENERATOR, MODULE_EXTRACTOR, MODULE_LOADER, MODULE_CRAFTER, ITEM_ENGINE_T1, ITEM_GENERATOR_T1, ITEM_EXTRACTOR_T1, ITEM_LOADER_T1, ITEM_MANUFACTURING_T1} from '../capabilities/modules'
1
2
  import type {ResourceCategory} from '../types'
2
3
 
4
+ export {ITEM_ENGINE_T1, ITEM_GENERATOR_T1, ITEM_EXTRACTOR_T1, ITEM_LOADER_T1, ITEM_MANUFACTURING_T1}
5
+
6
+ export const ITEM_DRILL_SHAFT = 10009
7
+ export const ITEM_EXTRACTION_PROBE = 10010
8
+ export const ITEM_CARGO_ARM = 10011
9
+ export const ITEM_TOOL_BIT = 10012
10
+ export const ITEM_REACTION_CHAMBER = 10013
11
+
3
12
  export const ITEM_HULL_PLATES = 10001
4
13
  export const ITEM_CARGO_LINING = 10002
5
14
  export const ITEM_CONTAINER_PACKED = 10003
15
+ export const ITEM_THRUSTER_CORE = 10004
16
+ export const ITEM_POWER_CELL = 10005
17
+ export const ITEM_SHIP_T1_PACKED = 10008
6
18
 
7
19
  export interface RecipeInput {
8
20
  category?: ResourceCategory
@@ -23,7 +35,7 @@ export interface ComponentDefinition {
23
35
  mass: number
24
36
  stats: ComponentStat[]
25
37
  recipe: RecipeInput[]
26
- usedIn: {type: 'entity'; name: string}[]
38
+ usedIn: {type: 'entity' | 'module'; name: string}[]
27
39
  }
28
40
 
29
41
  export interface EntityRecipe {
@@ -37,7 +49,7 @@ export interface EntityRecipe {
37
49
  }
38
50
 
39
51
  export interface CraftableItem {
40
- type: 'component' | 'entity'
52
+ type: 'component' | 'entity' | 'module'
41
53
  id: number | string
42
54
  name: string
43
55
  description: string
@@ -55,8 +67,8 @@ export const components: ComponentDefinition[] = [
55
67
  {key: 'strength', source: 'metal'},
56
68
  {key: 'density', source: 'metal'},
57
69
  ],
58
- recipe: [{category: 'metal', quantity: 40}],
59
- usedIn: [{type: 'entity', name: 'Container'}],
70
+ recipe: [{category: 'metal', quantity: 15}],
71
+ usedIn: [{type: 'entity', name: 'Container'}, {type: 'entity', name: 'Ship T1'}],
60
72
  },
61
73
  {
62
74
  id: ITEM_CARGO_LINING,
@@ -70,10 +82,101 @@ export const components: ComponentDefinition[] = [
70
82
  {key: 'purity', source: 'organic'},
71
83
  ],
72
84
  recipe: [
73
- {category: 'precious', quantity: 10},
74
- {category: 'organic', quantity: 20},
85
+ {category: 'precious', quantity: 6},
86
+ {category: 'organic', quantity: 14},
87
+ ],
88
+ usedIn: [{type: 'entity', name: 'Container'}, {type: 'entity', name: 'Ship T1'}],
89
+ },
90
+ {
91
+ id: ITEM_THRUSTER_CORE,
92
+ name: 'Thruster Core',
93
+ description: 'High-energy propulsion component formed from volatile gases.',
94
+ color: '#E86344',
95
+ mass: 50000,
96
+ stats: [
97
+ {key: 'volatility', source: 'gas'},
98
+ {key: 'thermal', source: 'gas'},
99
+ ],
100
+ recipe: [{category: 'gas' as ResourceCategory, quantity: 32}],
101
+ usedIn: [{type: 'module', name: 'Engine Module T1'}],
102
+ },
103
+ {
104
+ id: ITEM_POWER_CELL,
105
+ name: 'Power Cell',
106
+ description: 'Crystalline energy storage matrix formed from resonant minerals.',
107
+ color: '#7B5AE8',
108
+ mass: 30000,
109
+ stats: [
110
+ {key: 'resonance', source: 'mineral'},
111
+ {key: 'clarity', source: 'mineral'},
75
112
  ],
76
- usedIn: [{type: 'entity', name: 'Container'}],
113
+ recipe: [{category: 'mineral' as ResourceCategory, quantity: 20}],
114
+ usedIn: [{type: 'module', name: 'Generator Module T1'}],
115
+ },
116
+ {
117
+ id: ITEM_DRILL_SHAFT,
118
+ name: 'Drill Shaft',
119
+ description: 'Heavy-duty metal shaft used in extraction equipment.',
120
+ color: '#7B8D9E',
121
+ mass: 50000,
122
+ stats: [
123
+ {key: 'strength', source: 'metal'},
124
+ {key: 'tolerance', source: 'metal'},
125
+ ],
126
+ recipe: [{category: 'metal' as ResourceCategory, quantity: 15}],
127
+ usedIn: [{type: 'module', name: 'Extractor Module T1'}],
128
+ },
129
+ {
130
+ id: ITEM_EXTRACTION_PROBE,
131
+ name: 'Extraction Probe',
132
+ description: 'Precious metal sensor array for deep resource detection.',
133
+ color: '#D4A843',
134
+ mass: 30000,
135
+ stats: [
136
+ {key: 'conductivity', source: 'precious'},
137
+ {key: 'reflectivity', source: 'precious'},
138
+ ],
139
+ recipe: [{category: 'precious' as ResourceCategory, quantity: 10}],
140
+ usedIn: [{type: 'module', name: 'Extractor Module T1'}],
141
+ },
142
+ {
143
+ id: ITEM_CARGO_ARM,
144
+ name: 'Cargo Arm',
145
+ description: 'Flexible organic composite arm for cargo handling.',
146
+ color: '#6B8E5A',
147
+ mass: 30000,
148
+ stats: [
149
+ {key: 'plasticity', source: 'organic'},
150
+ {key: 'insulation', source: 'organic'},
151
+ ],
152
+ recipe: [{category: 'organic' as ResourceCategory, quantity: 32}],
153
+ usedIn: [{type: 'module', name: 'Loader Module T1'}],
154
+ },
155
+ {
156
+ id: ITEM_TOOL_BIT,
157
+ name: 'Tool Bit',
158
+ description: 'Dense mineral cutting head for manufacturing operations.',
159
+ color: '#B8A9C9',
160
+ mass: 30000,
161
+ stats: [
162
+ {key: 'hardness', source: 'mineral'},
163
+ {key: 'clarity', source: 'mineral'},
164
+ ],
165
+ recipe: [{category: 'mineral' as ResourceCategory, quantity: 20}],
166
+ usedIn: [{type: 'module', name: 'Manufacturing Module T1'}],
167
+ },
168
+ {
169
+ id: ITEM_REACTION_CHAMBER,
170
+ name: 'Reaction Chamber',
171
+ description: 'Gas-pressurized vessel for controlled manufacturing reactions.',
172
+ color: '#7EC8E3',
173
+ mass: 50000,
174
+ stats: [
175
+ {key: 'reactivity', source: 'gas'},
176
+ {key: 'thermal', source: 'gas'},
177
+ ],
178
+ recipe: [{category: 'gas' as ResourceCategory, quantity: 32}],
179
+ usedIn: [{type: 'module', name: 'Manufacturing Module T1'}],
77
180
  },
78
181
  ]
79
182
 
@@ -95,8 +198,124 @@ export const entityRecipes: EntityRecipe[] = [
95
198
  {key: 'purity', sourceComponentId: ITEM_CARGO_LINING, sourceStatKey: 'purity'},
96
199
  ],
97
200
  },
201
+ {
202
+ id: 'ship-t1',
203
+ name: 'Ship T1',
204
+ description: 'General-purpose vessel with 5 module slots.',
205
+ color: '#4AE898',
206
+ packedItemId: ITEM_SHIP_T1_PACKED,
207
+ recipe: [
208
+ {itemId: ITEM_HULL_PLATES, quantity: 8},
209
+ {itemId: ITEM_CARGO_LINING, quantity: 4},
210
+ ],
211
+ stats: [
212
+ {key: 'strength', sourceComponentId: ITEM_HULL_PLATES, sourceStatKey: 'strength'},
213
+ {key: 'density', sourceComponentId: ITEM_HULL_PLATES, sourceStatKey: 'density'},
214
+ {key: 'ductility', sourceComponentId: ITEM_CARGO_LINING, sourceStatKey: 'ductility'},
215
+ {key: 'purity', sourceComponentId: ITEM_CARGO_LINING, sourceStatKey: 'purity'},
216
+ ],
217
+ },
218
+ ]
219
+
220
+ export interface ModuleRecipe {
221
+ id: string
222
+ name: string
223
+ description: string
224
+ color: string
225
+ itemId: number
226
+ moduleType: number
227
+ recipe: RecipeInput[]
228
+ stats: {key: string; sourceComponentId: number; sourceStatKey: string}[]
229
+ }
230
+
231
+ export const moduleRecipes: ModuleRecipe[] = [
232
+ {
233
+ id: 'engine-t1',
234
+ name: 'Engine Module T1',
235
+ description: 'Basic propulsion system. Converts volatile gases into thrust.',
236
+ color: '#E86344',
237
+ itemId: ITEM_ENGINE_T1,
238
+ moduleType: MODULE_ENGINE,
239
+ recipe: [{itemId: ITEM_THRUSTER_CORE, quantity: 6}],
240
+ stats: [
241
+ {key: 'volatility', sourceComponentId: ITEM_THRUSTER_CORE, sourceStatKey: 'volatility'},
242
+ {key: 'thermal', sourceComponentId: ITEM_THRUSTER_CORE, sourceStatKey: 'thermal'},
243
+ ],
244
+ },
245
+ {
246
+ id: 'generator-t1',
247
+ name: 'Generator Module T1',
248
+ description: 'Basic energy system. Stores and recharges energy from resonant minerals.',
249
+ color: '#7B5AE8',
250
+ itemId: ITEM_GENERATOR_T1,
251
+ moduleType: MODULE_GENERATOR,
252
+ recipe: [{itemId: ITEM_POWER_CELL, quantity: 5}],
253
+ stats: [
254
+ {key: 'resonance', sourceComponentId: ITEM_POWER_CELL, sourceStatKey: 'resonance'},
255
+ {key: 'clarity', sourceComponentId: ITEM_POWER_CELL, sourceStatKey: 'clarity'},
256
+ ],
257
+ },
258
+ {
259
+ id: 'extractor-t1',
260
+ name: 'Extractor Module T1',
261
+ description: 'Basic extraction system. Drills and probes for raw resources.',
262
+ color: '#7B8D9E',
263
+ itemId: ITEM_EXTRACTOR_T1,
264
+ moduleType: MODULE_EXTRACTOR,
265
+ recipe: [
266
+ {itemId: ITEM_DRILL_SHAFT, quantity: 4},
267
+ {itemId: ITEM_EXTRACTION_PROBE, quantity: 3},
268
+ ],
269
+ stats: [
270
+ {key: 'strength', sourceComponentId: ITEM_DRILL_SHAFT, sourceStatKey: 'strength'},
271
+ {key: 'tolerance', sourceComponentId: ITEM_DRILL_SHAFT, sourceStatKey: 'tolerance'},
272
+ {key: 'reflectivity', sourceComponentId: ITEM_EXTRACTION_PROBE, sourceStatKey: 'reflectivity'},
273
+ {key: 'conductivity', sourceComponentId: ITEM_EXTRACTION_PROBE, sourceStatKey: 'conductivity'},
274
+ {key: 'reflectivity_drill', sourceComponentId: ITEM_EXTRACTION_PROBE, sourceStatKey: 'reflectivity'},
275
+ ],
276
+ },
277
+ {
278
+ id: 'loader-t1',
279
+ name: 'Loader Module T1',
280
+ description: 'Basic cargo handling system. Loads and unloads cargo with articulated arms.',
281
+ color: '#6B8E5A',
282
+ itemId: ITEM_LOADER_T1,
283
+ moduleType: MODULE_LOADER,
284
+ recipe: [
285
+ {itemId: ITEM_CARGO_LINING, quantity: 3},
286
+ {itemId: ITEM_CARGO_ARM, quantity: 3},
287
+ ],
288
+ stats: [
289
+ {key: 'ductility', sourceComponentId: ITEM_CARGO_LINING, sourceStatKey: 'ductility'},
290
+ {key: 'plasticity', sourceComponentId: ITEM_CARGO_ARM, sourceStatKey: 'plasticity'},
291
+ ],
292
+ },
293
+ {
294
+ id: 'manufacturing-t1',
295
+ name: 'Manufacturing Module T1',
296
+ description: 'Basic crafting system. Processes materials using reaction chambers and cutting tools.',
297
+ color: '#7EC8E3',
298
+ itemId: ITEM_MANUFACTURING_T1,
299
+ moduleType: MODULE_CRAFTER,
300
+ recipe: [
301
+ {itemId: ITEM_TOOL_BIT, quantity: 3},
302
+ {itemId: ITEM_REACTION_CHAMBER, quantity: 3},
303
+ ],
304
+ stats: [
305
+ {key: 'reactivity', sourceComponentId: ITEM_REACTION_CHAMBER, sourceStatKey: 'reactivity'},
306
+ {key: 'clarity', sourceComponentId: ITEM_TOOL_BIT, sourceStatKey: 'clarity'},
307
+ ],
308
+ },
98
309
  ]
99
310
 
311
+ export function getModuleRecipe(id: string): ModuleRecipe | undefined {
312
+ return moduleRecipes.find((r) => r.id === id)
313
+ }
314
+
315
+ export function getModuleRecipeByItemId(itemId: number): ModuleRecipe | undefined {
316
+ return moduleRecipes.find((r) => r.itemId === itemId)
317
+ }
318
+
100
319
  export function getComponentById(id: number): ComponentDefinition | undefined {
101
320
  return components.find((c) => c.id === id)
102
321
  }
@@ -117,6 +336,9 @@ export function getAllCraftableItems(): CraftableItem[] {
117
336
  for (const entity of entityRecipes) {
118
337
  items.push({type: 'entity', id: entity.id, name: entity.name, description: entity.description, color: entity.color})
119
338
  }
339
+ for (const mod of moduleRecipes) {
340
+ items.push({type: 'module', id: mod.id, name: mod.name, description: mod.description, color: mod.color})
341
+ }
120
342
  return items
121
343
  }
122
344
 
@@ -1,10 +1,13 @@
1
+ import {UInt64} from '@wharfkit/antelope'
1
2
  import type {ResourceCategory} from '../types'
2
3
  import {
3
- components,
4
4
  entityRecipes,
5
5
  getComponentById,
6
6
  getEntityRecipe,
7
+ getModuleRecipe,
8
+ moduleRecipes,
7
9
  } from '../data/recipes'
10
+ import {deriveResourceStats} from './stratum'
8
11
 
9
12
  export interface StackInput {
10
13
  quantity: number
@@ -32,26 +35,24 @@ export function decodeStats(seed: bigint, count: number): number[] {
32
35
  return stats
33
36
  }
34
37
 
38
+ function mapStatsToKeys(seed: bigint, statDefs: {key: string}[]): Record<string, number> {
39
+ const values = decodeStats(seed, statDefs.length)
40
+ const result: Record<string, number> = {}
41
+ for (let i = 0; i < statDefs.length; i++) {
42
+ result[statDefs[i].key] = values[i]
43
+ }
44
+ return result
45
+ }
46
+
35
47
  export function decodeCraftedItemStats(itemId: number, seed: bigint): Record<string, number> {
36
48
  const comp = getComponentById(itemId)
37
- if (comp) {
38
- const values = decodeStats(seed, comp.stats.length)
39
- const result: Record<string, number> = {}
40
- for (let i = 0; i < comp.stats.length; i++) {
41
- result[comp.stats[i].key] = values[i]
42
- }
43
- return result
44
- }
49
+ if (comp) return mapStatsToKeys(seed, comp.stats)
45
50
 
46
51
  const entityRecipe = entityRecipes.find((r) => r.packedItemId === itemId)
47
- if (entityRecipe) {
48
- const values = decodeStats(seed, entityRecipe.stats.length)
49
- const result: Record<string, number> = {}
50
- for (let i = 0; i < entityRecipe.stats.length; i++) {
51
- result[entityRecipe.stats[i].key] = values[i]
52
- }
53
- return result
54
- }
52
+ if (entityRecipe) return mapStatsToKeys(seed, entityRecipe.stats)
53
+
54
+ const moduleRecipe = moduleRecipes.find((r) => r.itemId === itemId)
55
+ if (moduleRecipe) return mapStatsToKeys(seed, moduleRecipe.stats)
55
56
 
56
57
  return {}
57
58
  }
@@ -65,7 +66,7 @@ export function blendStacks(stacks: StackInput[], statKey: string): number {
65
66
  totalQty += stack.quantity
66
67
  }
67
68
  if (totalQty === 0) return 0
68
- return Math.round(weightedSum / totalQty)
69
+ return Math.floor(weightedSum / totalQty)
69
70
  }
70
71
 
71
72
  export function computeComponentStats(
@@ -104,7 +105,7 @@ export function computeEntityStats(
104
105
  entityRecipeId: string,
105
106
  componentStacks: Record<number, {quantity: number; stats: Record<string, number>}[]>
106
107
  ): {key: string; value: number}[] {
107
- const recipe = getEntityRecipe(entityRecipeId)
108
+ const recipe = getEntityRecipe(entityRecipeId) ?? getModuleRecipe(entityRecipeId)
108
109
  if (!recipe) return []
109
110
 
110
111
  const blendedByComponent: Record<number, Record<string, number>> = {}
@@ -118,3 +119,24 @@ export function computeEntityStats(
118
119
  return {key: stat.key, value: Math.max(1, Math.min(999, value))}
119
120
  })
120
121
  }
122
+
123
+ function decodeStackStats(itemId: number, seed: UInt64): Record<string, number> {
124
+ if (itemId >= 10000) {
125
+ return decodeCraftedItemStats(itemId, BigInt(seed.toString()))
126
+ }
127
+ const raw = deriveResourceStats(BigInt(seed.toString()))
128
+ return {stat1: raw.stat1, stat2: raw.stat2, stat3: raw.stat3}
129
+ }
130
+
131
+ export function blendCargoStacks(
132
+ itemId: number,
133
+ stacks: {quantity: number; seed: UInt64}[]
134
+ ): UInt64 {
135
+ const decoded = stacks.map((s) => ({
136
+ quantity: s.quantity,
137
+ stats: decodeStackStats(itemId, s.seed),
138
+ }))
139
+ const allKeys = Object.keys(decoded[0]?.stats ?? {})
140
+ const blended = allKeys.map((key) => Math.max(1, Math.min(999, blendStacks(decoded, key))))
141
+ return UInt64.from(encodeStats(blended))
142
+ }
@@ -5,26 +5,27 @@ import {Warehouse, WarehouseStateInput} from './warehouse'
5
5
  import {Container, ContainerStateInput} from './container'
6
6
 
7
7
  export function makeShip(state: ShipStateInput): Ship {
8
- const entityInfo = ServerContract.Types.entity_info.from({
8
+ const info: Record<string, unknown> = {
9
9
  type: Name.from('ship'),
10
10
  id: UInt64.from(state.id),
11
11
  owner: Name.from(state.owner),
12
12
  entity_name: state.name,
13
13
  coordinates: ServerContract.Types.coordinates.from(state.coordinates),
14
- hullmass: UInt32.from(state.hullmass),
15
- capacity: UInt32.from(state.capacity),
16
- energy: UInt16.from(state.energy),
17
14
  cargomass: UInt32.from(0),
18
15
  cargo: state.cargo || [],
19
16
  is_idle: !state.schedule,
20
17
  current_task_elapsed: UInt32.from(0),
21
18
  current_task_remaining: UInt32.from(0),
22
19
  pending_tasks: [],
23
- engines: state.engines,
24
- generator: state.generator,
25
- loaders: state.loaders,
26
- schedule: state.schedule,
27
- })
20
+ }
21
+ if (state.hullmass !== undefined) info.hullmass = UInt32.from(state.hullmass)
22
+ if (state.capacity !== undefined) info.capacity = UInt32.from(state.capacity)
23
+ if (state.energy !== undefined) info.energy = UInt16.from(state.energy)
24
+ if (state.engines) info.engines = state.engines
25
+ if (state.generator) info.generator = state.generator
26
+ if (state.loaders) info.loaders = state.loaders
27
+ if (state.schedule) info.schedule = state.schedule
28
+ const entityInfo = ServerContract.Types.entity_info.from(info)
28
29
  return new Ship(entityInfo)
29
30
  }
30
31
 
@@ -0,0 +1,89 @@
1
+ export function computeShipHullCapabilities(stats: Record<string, number>): {
2
+ hullmass: number
3
+ capacity: number
4
+ } {
5
+ const density = stats.density ?? 500
6
+ const strength = stats.strength ?? 500
7
+ const ductility = stats.ductility ?? 500
8
+ const purity = stats.purity ?? 500
9
+
10
+ const hullmass = 25000 + 75 * density
11
+ const statSum = strength + ductility + purity
12
+ const exponent = statSum / 2997.0
13
+ const capacity = Math.floor(1000000 * Math.pow(10, exponent))
14
+
15
+ return {hullmass, capacity}
16
+ }
17
+
18
+ export function computeEngineCapabilities(stats: Record<string, number>): {
19
+ thrust: number
20
+ drain: number
21
+ } {
22
+ const vol = stats.volatility ?? 500
23
+ const thm = stats.thermal ?? 500
24
+
25
+ return {
26
+ thrust: 400 + Math.floor(vol * 3 / 4),
27
+ drain: Math.max(16, 30 - Math.floor(thm / 70)),
28
+ }
29
+ }
30
+
31
+ export function computeGeneratorCapabilities(stats: Record<string, number>): {
32
+ capacity: number
33
+ recharge: number
34
+ } {
35
+ const res = stats.resonance ?? 500
36
+ const clr = stats.clarity ?? 500
37
+
38
+ return {
39
+ capacity: 300 + Math.floor(res / 6),
40
+ recharge: 5 + Math.floor(clr * 15 / 1000),
41
+ }
42
+ }
43
+
44
+ export function computeExtractorCapabilities(stats: Record<string, number>): {
45
+ rate: number
46
+ drain: number
47
+ depth: number
48
+ drill: number
49
+ } {
50
+ const str = stats.strength ?? 500
51
+ const con = stats.conductivity ?? 500
52
+ const ref = stats.reflectivity ?? 500
53
+ const tol = stats.tolerance ?? 500
54
+
55
+ return {
56
+ rate: 200 + str,
57
+ drain: Math.max(10, 50 - Math.floor(con / 20)),
58
+ depth: 200 + Math.floor(tol * 3 / 2),
59
+ drill: 100 + Math.floor(ref * 4 / 5),
60
+ }
61
+ }
62
+
63
+ export function computeLoaderCapabilities(stats: Record<string, number>): {
64
+ mass: number
65
+ thrust: number
66
+ quantity: number
67
+ } {
68
+ const duc = stats.ductility ?? 500
69
+ const pla = stats.plasticity ?? 500
70
+
71
+ return {
72
+ mass: Math.max(200, 2000 - Math.floor(duc * 2)),
73
+ thrust: 1 + Math.floor(pla / 500),
74
+ quantity: 1,
75
+ }
76
+ }
77
+
78
+ export function computeManufacturingCapabilities(stats: Record<string, number>): {
79
+ speed: number
80
+ drain: number
81
+ } {
82
+ const rea = stats.reactivity ?? 500
83
+ const clr = stats.clarity ?? 500
84
+
85
+ return {
86
+ speed: 100 + Math.floor(rea * 4 / 5),
87
+ drain: Math.max(5, 30 - Math.floor(clr / 33)),
88
+ }
89
+ }
@@ -28,12 +28,12 @@ export interface ShipStateInput {
28
28
  owner: string
29
29
  name: string
30
30
  coordinates: CoordinatesType | {x: number; y: number; z?: number}
31
- hullmass: number
32
- capacity: number
33
- energy: number
34
- engines: ServerContract.Types.movement_stats
35
- generator: ServerContract.Types.energy_stats
36
- loaders: ServerContract.Types.loader_stats
31
+ hullmass?: number
32
+ capacity?: number
33
+ energy?: number
34
+ engines?: ServerContract.Types.movement_stats
35
+ generator?: ServerContract.Types.energy_stats
36
+ loaders?: ServerContract.Types.loader_stats
37
37
  schedule?: ServerContract.Types.schedule
38
38
  cargo?: ServerContract.Types.cargo_item[]
39
39
  }
@@ -108,6 +108,14 @@ export class Ship extends ServerContract.Types.entity_info {
108
108
  return schedule.isExtracting(this, now)
109
109
  }
110
110
 
111
+ get hasEngines(): boolean {
112
+ return this.engines !== undefined
113
+ }
114
+
115
+ get hasGenerator(): boolean {
116
+ return this.generator !== undefined
117
+ }
118
+
111
119
  get hasExtractor(): boolean {
112
120
  return this.extractor !== undefined
113
121
  }
@@ -141,24 +141,43 @@ export * from './types/capabilities'
141
141
  export * from './types/entity'
142
142
  export * from './capabilities'
143
143
 
144
+ export {categoryColors, tierColors, categoryIcons, componentIcon, moduleIcon} from './data/colors'
145
+
144
146
  export {
145
147
  components,
146
148
  entityRecipes,
149
+ moduleRecipes,
147
150
  getComponentById,
148
151
  getEntityRecipe,
149
152
  getEntityRecipeByItemId,
153
+ getModuleRecipe,
154
+ getModuleRecipeByItemId,
150
155
  getAllCraftableItems,
151
156
  getComponentsForCategory,
152
157
  getComponentsForStat,
153
158
  ITEM_HULL_PLATES,
154
159
  ITEM_CARGO_LINING,
155
160
  ITEM_CONTAINER_PACKED,
161
+ ITEM_THRUSTER_CORE,
162
+ ITEM_POWER_CELL,
163
+ ITEM_ENGINE_T1,
164
+ ITEM_GENERATOR_T1,
165
+ ITEM_SHIP_T1_PACKED,
166
+ ITEM_DRILL_SHAFT,
167
+ ITEM_EXTRACTION_PROBE,
168
+ ITEM_CARGO_ARM,
169
+ ITEM_TOOL_BIT,
170
+ ITEM_REACTION_CHAMBER,
171
+ ITEM_EXTRACTOR_T1,
172
+ ITEM_LOADER_T1,
173
+ ITEM_MANUFACTURING_T1,
156
174
  } from './data/recipes'
157
175
  export type {
158
176
  ComponentDefinition,
159
177
  ComponentStat,
160
178
  RecipeInput,
161
179
  EntityRecipe,
180
+ ModuleRecipe,
162
181
  CraftableItem,
163
182
  } from './data/recipes'
164
183
 
@@ -170,7 +189,20 @@ export {
170
189
  computeComponentStats,
171
190
  blendComponentStacks,
172
191
  computeEntityStats,
192
+ blendCargoStacks,
173
193
  } from './derivation/crafting'
174
194
  export type {StackInput, CategoryStacks} from './derivation/crafting'
175
195
 
176
196
  export {computeContainerCapabilities} from './entities/container'
197
+
198
+ export {
199
+ computeShipHullCapabilities,
200
+ computeEngineCapabilities,
201
+ computeGeneratorCapabilities,
202
+ computeExtractorCapabilities,
203
+ computeLoaderCapabilities,
204
+ computeManufacturingCapabilities,
205
+ } from './entities/ship-deploy'
206
+
207
+ export {resolveItem} from './resolution/resolve-item'
208
+ export type {ResolvedItem, ResolvedItemStat, ResolvedAttributeGroup, ResolvedItemType} from './resolution/resolve-item'
@@ -120,14 +120,10 @@ export class ActionsManager extends BaseManager {
120
120
  entityId: UInt64Type,
121
121
  recipeId: number,
122
122
  quantity: number,
123
- inputs: {itemId: number; quantity: number; seed?: bigint}[]
123
+ inputs: ServerContract.ActionParams.Type.cargo_item[]
124
124
  ): Action {
125
125
  const cargoInputs = inputs.map((i) =>
126
- ServerContract.Types.cargo_item.from({
127
- item_id: UInt16.from(i.itemId),
128
- quantity: UInt32.from(i.quantity),
129
- seed: i.seed !== undefined ? UInt64.from(i.seed) : null,
130
- })
126
+ ServerContract.Types.cargo_item.from(i)
131
127
  )
132
128
  return this.server.action('craft', {
133
129
  entity_type: entityType,
@@ -138,6 +134,21 @@ export class ActionsManager extends BaseManager {
138
134
  })
139
135
  }
140
136
 
137
+ blend(
138
+ entityType: EntityTypeName,
139
+ entityId: UInt64Type,
140
+ inputs: ServerContract.ActionParams.Type.cargo_item[]
141
+ ): Action {
142
+ const cargoInputs = inputs.map((i) =>
143
+ ServerContract.Types.cargo_item.from(i)
144
+ )
145
+ return this.server.action('blend', {
146
+ entity_type: entityType,
147
+ id: UInt64.from(entityId),
148
+ inputs: cargoInputs,
149
+ })
150
+ }
151
+
141
152
  deploy(
142
153
  entityType: EntityTypeName,
143
154
  entityId: UInt64Type,
@@ -154,6 +165,36 @@ export class ActionsManager extends BaseManager {
154
165
  })
155
166
  }
156
167
 
168
+ addmodule(
169
+ entityType: EntityTypeName,
170
+ entityId: UInt64Type,
171
+ moduleIndex: number,
172
+ moduleCargoId: UInt64Type,
173
+ targetCargoId: UInt64Type = UInt64.from(0)
174
+ ): Action {
175
+ return this.server.action('addmodule', {
176
+ entity_type: entityType,
177
+ entity_id: UInt64.from(entityId),
178
+ module_index: moduleIndex,
179
+ module_cargo_id: UInt64.from(moduleCargoId),
180
+ target_cargo_id: UInt64.from(targetCargoId),
181
+ })
182
+ }
183
+
184
+ rmmodule(
185
+ entityType: EntityTypeName,
186
+ entityId: UInt64Type,
187
+ moduleIndex: number,
188
+ targetCargoId: UInt64Type = UInt64.from(0)
189
+ ): Action {
190
+ return this.server.action('rmmodule', {
191
+ entity_type: entityType,
192
+ entity_id: UInt64.from(entityId),
193
+ module_index: moduleIndex,
194
+ target_cargo_id: UInt64.from(targetCargoId),
195
+ })
196
+ }
197
+
157
198
  joinGame(account: NameType, companyName: string): Action[] {
158
199
  return [this.foundCompany(account, companyName), this.join(account)]
159
200
  }