@shipload/sdk 2.0.0-rc1 → 2.0.0-rc11

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 (74) hide show
  1. package/lib/shipload.d.ts +1701 -1183
  2. package/lib/shipload.js +6746 -3447
  3. package/lib/shipload.js.map +1 -1
  4. package/lib/shipload.m.js +6429 -3229
  5. package/lib/shipload.m.js.map +1 -1
  6. package/package.json +6 -6
  7. package/src/capabilities/crafting.ts +26 -0
  8. package/src/capabilities/gathering.ts +36 -0
  9. package/src/capabilities/guards.ts +38 -0
  10. package/src/capabilities/hauling.ts +22 -0
  11. package/src/capabilities/index.ts +8 -0
  12. package/src/capabilities/loading.ts +8 -0
  13. package/src/capabilities/modules.ts +57 -0
  14. package/src/capabilities/movement.ts +29 -0
  15. package/src/capabilities/storage.ts +72 -0
  16. package/src/contracts/server.ts +932 -314
  17. package/src/data/capabilities.ts +408 -0
  18. package/src/data/categories.ts +58 -0
  19. package/src/data/colors.ts +53 -0
  20. package/src/data/items.json +17 -0
  21. package/src/data/locations.ts +53 -0
  22. package/src/data/nebula-adjectives.json +211 -0
  23. package/src/data/nebula-nouns.json +151 -0
  24. package/src/data/recipes.ts +571 -0
  25. package/src/data/syllables.json +1386 -780
  26. package/src/data/tiers.ts +45 -0
  27. package/src/derivation/crafting.ts +197 -0
  28. package/src/derivation/index.ts +28 -0
  29. package/src/derivation/location-size.ts +15 -0
  30. package/src/derivation/resources.ts +142 -0
  31. package/src/derivation/stats.ts +146 -0
  32. package/src/derivation/stratum.ts +124 -0
  33. package/src/entities/cargo-utils.ts +46 -9
  34. package/src/entities/container.ts +106 -0
  35. package/src/entities/entity-inventory.ts +13 -13
  36. package/src/entities/inventory-accessor.ts +42 -0
  37. package/src/entities/location.ts +7 -188
  38. package/src/entities/makers.ts +72 -0
  39. package/src/entities/player.ts +1 -273
  40. package/src/entities/ship-deploy.ts +263 -0
  41. package/src/entities/ship.ts +93 -453
  42. package/src/entities/warehouse.ts +34 -148
  43. package/src/errors.ts +4 -4
  44. package/src/index-module.ts +226 -42
  45. package/src/managers/actions.ts +111 -79
  46. package/src/managers/context.ts +0 -9
  47. package/src/managers/entities.ts +22 -5
  48. package/src/managers/index.ts +0 -1
  49. package/src/managers/locations.ts +15 -79
  50. package/src/market/items.ts +30 -0
  51. package/src/nft/description.ts +175 -0
  52. package/src/nft/deserializers.ts +81 -0
  53. package/src/nft/index.ts +2 -0
  54. package/src/resolution/resolve-item.ts +313 -0
  55. package/src/scheduling/accessor.ts +82 -0
  56. package/src/scheduling/projection.ts +158 -54
  57. package/src/scheduling/schedule.ts +24 -0
  58. package/src/shipload.ts +0 -5
  59. package/src/travel/travel.ts +93 -19
  60. package/src/types/capabilities.ts +71 -0
  61. package/src/types/entity-traits.ts +69 -0
  62. package/src/types/entity.ts +39 -0
  63. package/src/types/index.ts +3 -0
  64. package/src/types.ts +76 -33
  65. package/src/utils/hash.ts +1 -1
  66. package/src/utils/system.ts +148 -11
  67. package/src/data/goods.json +0 -23
  68. package/src/managers/trades.ts +0 -119
  69. package/src/market/goods.ts +0 -31
  70. package/src/market/market.ts +0 -209
  71. package/src/market/rolls.ts +0 -8
  72. package/src/trading/collect.ts +0 -939
  73. package/src/trading/deal.ts +0 -208
  74. package/src/trading/trade.ts +0 -203
@@ -0,0 +1,571 @@
1
+ import {
2
+ ITEM_ENGINE_T1,
3
+ ITEM_GATHERER_T1,
4
+ ITEM_GENERATOR_T1,
5
+ ITEM_HAULER_T1,
6
+ ITEM_LOADER_T1,
7
+ ITEM_MANUFACTURING_T1,
8
+ ITEM_STORAGE_T1,
9
+ MODULE_ANY,
10
+ MODULE_CRAFTER,
11
+ MODULE_ENGINE,
12
+ MODULE_GATHERER,
13
+ MODULE_GENERATOR,
14
+ MODULE_HAULER,
15
+ MODULE_LOADER,
16
+ MODULE_STORAGE,
17
+ } from '../capabilities/modules'
18
+ import type {ResourceCategory} from '../types'
19
+
20
+ export {
21
+ ITEM_ENGINE_T1,
22
+ ITEM_GENERATOR_T1,
23
+ ITEM_GATHERER_T1,
24
+ ITEM_LOADER_T1,
25
+ ITEM_MANUFACTURING_T1,
26
+ ITEM_STORAGE_T1,
27
+ ITEM_HAULER_T1,
28
+ }
29
+
30
+ export const ITEM_MATTER_CONDUIT = 10005
31
+ export const ITEM_SURVEY_PROBE = 10006
32
+ export const ITEM_CARGO_ARM = 10007
33
+ export const ITEM_TOOL_BIT = 10008
34
+ export const ITEM_REACTION_CHAMBER = 10009
35
+ export const ITEM_FOCUSING_ARRAY = 10010
36
+
37
+ export const ITEM_HULL_PLATES = 10001
38
+ export const ITEM_CARGO_LINING = 10002
39
+ export const ITEM_CONTAINER_T1_PACKED = 10200
40
+ export const ITEM_THRUSTER_CORE = 10003
41
+ export const ITEM_POWER_CELL = 10004
42
+ export const ITEM_SHIP_T1_PACKED = 10201
43
+ export const ITEM_WAREHOUSE_T1_PACKED = 10202
44
+
45
+ export const ITEM_HULL_PLATES_T2 = 20001
46
+ export const ITEM_CARGO_LINING_T2 = 20002
47
+ export const ITEM_CONTAINER_T2_PACKED = 20200
48
+
49
+ export interface RecipeInput {
50
+ category?: ResourceCategory
51
+ itemId?: number
52
+ quantity: number
53
+ }
54
+
55
+ export interface ComponentStat {
56
+ key: string
57
+ source: ResourceCategory
58
+ }
59
+
60
+ export interface ComponentDefinition {
61
+ id: number
62
+ name: string
63
+ description: string
64
+ color: string
65
+ mass: number
66
+ stats: ComponentStat[]
67
+ recipe: RecipeInput[]
68
+ usedIn: {type: 'entity' | 'module'; name: string}[]
69
+ }
70
+
71
+ export interface ModuleSlot {
72
+ type: number
73
+ label?: string
74
+ }
75
+
76
+ export interface EntityRecipe {
77
+ id: string
78
+ name: string
79
+ description: string
80
+ color: string
81
+ packedItemId: number
82
+ recipe: RecipeInput[]
83
+ stats: {key: string; sourceComponentId: number; sourceStatKey: string}[]
84
+ moduleSlots?: ModuleSlot[]
85
+ }
86
+
87
+ export interface CraftableItem {
88
+ type: 'component' | 'entity' | 'module'
89
+ id: number | string
90
+ name: string
91
+ description: string
92
+ color: string
93
+ }
94
+
95
+ export const components: ComponentDefinition[] = [
96
+ {
97
+ id: ITEM_HULL_PLATES,
98
+ name: 'Hull Plates',
99
+ description: 'Structural plating formed from metal. Used in hulls, containers, and frames.',
100
+ color: '#7B8D9E',
101
+ mass: 50000,
102
+ stats: [
103
+ {key: 'strength', source: 'metal'},
104
+ {key: 'density', source: 'metal'},
105
+ ],
106
+ recipe: [{category: 'metal', quantity: 15}],
107
+ usedIn: [
108
+ {type: 'entity', name: 'Container'},
109
+ {type: 'entity', name: 'Warehouse T1'},
110
+ {type: 'entity', name: 'Ship T1'},
111
+ ],
112
+ },
113
+ {
114
+ id: ITEM_CARGO_LINING,
115
+ name: 'Cargo Lining',
116
+ description:
117
+ 'Precision-formed composite lining for cargo storage. Combines precious metal shaping with organic sealing.',
118
+ color: '#D4A843',
119
+ mass: 30000,
120
+ stats: [
121
+ {key: 'ductility', source: 'precious'},
122
+ {key: 'purity', source: 'organic'},
123
+ ],
124
+ recipe: [
125
+ {category: 'precious', quantity: 6},
126
+ {category: 'organic', quantity: 14},
127
+ ],
128
+ usedIn: [
129
+ {type: 'entity', name: 'Container'},
130
+ {type: 'entity', name: 'Warehouse T1'},
131
+ {type: 'entity', name: 'Ship T1'},
132
+ ],
133
+ },
134
+ {
135
+ id: ITEM_THRUSTER_CORE,
136
+ name: 'Thruster Core',
137
+ description: 'High-energy propulsion component formed from volatile gases.',
138
+ color: '#E86344',
139
+ mass: 50000,
140
+ stats: [
141
+ {key: 'volatility', source: 'gas'},
142
+ {key: 'thermal', source: 'gas'},
143
+ ],
144
+ recipe: [{category: 'gas' as ResourceCategory, quantity: 32}],
145
+ usedIn: [{type: 'module', name: 'Engine'}],
146
+ },
147
+ {
148
+ id: ITEM_POWER_CELL,
149
+ name: 'Power Cell',
150
+ description: 'Crystalline energy storage matrix formed from resonant minerals.',
151
+ color: '#7B5AE8',
152
+ mass: 30000,
153
+ stats: [
154
+ {key: 'resonance', source: 'mineral'},
155
+ {key: 'clarity', source: 'mineral'},
156
+ ],
157
+ recipe: [{category: 'mineral' as ResourceCategory, quantity: 20}],
158
+ usedIn: [{type: 'module', name: 'Generator'}],
159
+ },
160
+ {
161
+ id: ITEM_MATTER_CONDUIT,
162
+ name: 'Matter Conduit',
163
+ description: 'Heavy-duty metal shaft used in gathering equipment.',
164
+ color: '#7B8D9E',
165
+ mass: 50000,
166
+ stats: [
167
+ {key: 'strength', source: 'metal'},
168
+ {key: 'tolerance', source: 'metal'},
169
+ ],
170
+ recipe: [{category: 'metal' as ResourceCategory, quantity: 15}],
171
+ usedIn: [{type: 'module', name: 'Gatherer'}],
172
+ },
173
+ {
174
+ id: ITEM_SURVEY_PROBE,
175
+ name: 'Survey Probe',
176
+ description: 'Precious metal sensor array for deep resource detection.',
177
+ color: '#D4A843',
178
+ mass: 30000,
179
+ stats: [
180
+ {key: 'conductivity', source: 'precious'},
181
+ {key: 'reflectivity', source: 'precious'},
182
+ ],
183
+ recipe: [{category: 'precious' as ResourceCategory, quantity: 10}],
184
+ usedIn: [{type: 'module', name: 'Gatherer'}],
185
+ },
186
+ {
187
+ id: ITEM_CARGO_ARM,
188
+ name: 'Cargo Arm',
189
+ description: 'Flexible organic composite arm for cargo handling.',
190
+ color: '#6B8E5A',
191
+ mass: 30000,
192
+ stats: [
193
+ {key: 'plasticity', source: 'organic'},
194
+ {key: 'insulation', source: 'organic'},
195
+ ],
196
+ recipe: [{category: 'organic' as ResourceCategory, quantity: 32}],
197
+ usedIn: [{type: 'module', name: 'Loader'}],
198
+ },
199
+ {
200
+ id: ITEM_TOOL_BIT,
201
+ name: 'Tool Bit',
202
+ description: 'Dense mineral cutting head for manufacturing operations.',
203
+ color: '#B8A9C9',
204
+ mass: 30000,
205
+ stats: [
206
+ {key: 'hardness', source: 'mineral'},
207
+ {key: 'clarity', source: 'mineral'},
208
+ ],
209
+ recipe: [{category: 'mineral' as ResourceCategory, quantity: 20}],
210
+ usedIn: [{type: 'module', name: 'Manufacturing'}],
211
+ },
212
+ {
213
+ id: ITEM_REACTION_CHAMBER,
214
+ name: 'Reaction Chamber',
215
+ description: 'Gas-pressurized vessel for controlled manufacturing reactions.',
216
+ color: '#7EC8E3',
217
+ mass: 50000,
218
+ stats: [
219
+ {key: 'reactivity', source: 'gas'},
220
+ {key: 'thermal', source: 'gas'},
221
+ ],
222
+ recipe: [{category: 'gas' as ResourceCategory, quantity: 32}],
223
+ usedIn: [{type: 'module', name: 'Manufacturing'}],
224
+ },
225
+ {
226
+ id: ITEM_FOCUSING_ARRAY,
227
+ name: 'Focusing Array',
228
+ description:
229
+ "Precision-formed precious-metal lens array. Routes the haul beam's energy efficiently to the target lock.",
230
+ color: '#D4A843',
231
+ mass: 40000,
232
+ stats: [
233
+ {key: 'conductivity', source: 'precious'},
234
+ {key: 'ductility', source: 'precious'},
235
+ ],
236
+ recipe: [{category: 'precious' as ResourceCategory, quantity: 25}],
237
+ usedIn: [{type: 'module', name: 'Hauler Module T1'}],
238
+ },
239
+ {
240
+ id: ITEM_HULL_PLATES_T2,
241
+ name: 'Hull Plates T2',
242
+ description: 'Advanced structural plating reinforced with tier 2 metals.',
243
+ color: '#9BADB8',
244
+ mass: 50000,
245
+ stats: [
246
+ {key: 'strength', source: 'metal'},
247
+ {key: 'density', source: 'metal'},
248
+ ],
249
+ recipe: [
250
+ {itemId: ITEM_HULL_PLATES, quantity: 2},
251
+ {category: 'metal', quantity: 15},
252
+ ],
253
+ usedIn: [{type: 'entity', name: 'Container T2'}],
254
+ },
255
+ {
256
+ id: ITEM_CARGO_LINING_T2,
257
+ name: 'Cargo Lining T2',
258
+ description: 'Advanced composite lining with improved storage properties.',
259
+ color: '#E0B84D',
260
+ mass: 30000,
261
+ stats: [
262
+ {key: 'ductility', source: 'precious'},
263
+ {key: 'purity', source: 'organic'},
264
+ ],
265
+ recipe: [
266
+ {itemId: ITEM_CARGO_LINING, quantity: 2},
267
+ {category: 'precious', quantity: 6},
268
+ {category: 'organic', quantity: 14},
269
+ ],
270
+ usedIn: [{type: 'entity', name: 'Container T2'}],
271
+ },
272
+ ]
273
+
274
+ export const entityRecipes: EntityRecipe[] = [
275
+ {
276
+ id: 'container',
277
+ name: 'Container',
278
+ description: 'Passive floating cargo storage in space. Towed by ships.',
279
+ color: '#7B8D9E',
280
+ packedItemId: ITEM_CONTAINER_T1_PACKED,
281
+ recipe: [
282
+ {itemId: ITEM_HULL_PLATES, quantity: 6},
283
+ {itemId: ITEM_CARGO_LINING, quantity: 2},
284
+ ],
285
+ stats: [
286
+ {key: 'strength', sourceComponentId: ITEM_HULL_PLATES, sourceStatKey: 'strength'},
287
+ {key: 'density', sourceComponentId: ITEM_HULL_PLATES, sourceStatKey: 'density'},
288
+ {key: 'ductility', sourceComponentId: ITEM_CARGO_LINING, sourceStatKey: 'ductility'},
289
+ {key: 'purity', sourceComponentId: ITEM_CARGO_LINING, sourceStatKey: 'purity'},
290
+ ],
291
+ },
292
+ {
293
+ id: 'ship-t1',
294
+ name: 'Ship T1',
295
+ description: 'General-purpose vessel with 5 module slots.',
296
+ color: '#4AE898',
297
+ packedItemId: ITEM_SHIP_T1_PACKED,
298
+ recipe: [
299
+ {itemId: ITEM_HULL_PLATES, quantity: 8},
300
+ {itemId: ITEM_CARGO_LINING, quantity: 4},
301
+ ],
302
+ stats: [
303
+ {key: 'strength', sourceComponentId: ITEM_HULL_PLATES, sourceStatKey: 'strength'},
304
+ {key: 'density', sourceComponentId: ITEM_HULL_PLATES, sourceStatKey: 'density'},
305
+ {key: 'ductility', sourceComponentId: ITEM_CARGO_LINING, sourceStatKey: 'ductility'},
306
+ {key: 'purity', sourceComponentId: ITEM_CARGO_LINING, sourceStatKey: 'purity'},
307
+ ],
308
+ moduleSlots: [
309
+ {type: MODULE_ANY},
310
+ {type: MODULE_ANY},
311
+ {type: MODULE_ANY},
312
+ {type: MODULE_ANY},
313
+ {type: MODULE_ANY},
314
+ ],
315
+ },
316
+ {
317
+ id: 'warehouse-t1',
318
+ name: 'Warehouse T1',
319
+ description: 'Massive stationary storage facility with a single loader module slot.',
320
+ color: '#EAB308',
321
+ packedItemId: ITEM_WAREHOUSE_T1_PACKED,
322
+ recipe: [
323
+ {itemId: ITEM_HULL_PLATES, quantity: 20},
324
+ {itemId: ITEM_CARGO_LINING, quantity: 10},
325
+ ],
326
+ stats: [
327
+ {key: 'strength', sourceComponentId: ITEM_HULL_PLATES, sourceStatKey: 'strength'},
328
+ {key: 'density', sourceComponentId: ITEM_HULL_PLATES, sourceStatKey: 'density'},
329
+ {key: 'ductility', sourceComponentId: ITEM_CARGO_LINING, sourceStatKey: 'ductility'},
330
+ {key: 'purity', sourceComponentId: ITEM_CARGO_LINING, sourceStatKey: 'purity'},
331
+ ],
332
+ moduleSlots: [
333
+ {type: MODULE_LOADER, label: 'Loader'},
334
+ {type: MODULE_STORAGE, label: 'Storage'},
335
+ {type: MODULE_STORAGE, label: 'Storage'},
336
+ {type: MODULE_STORAGE, label: 'Storage'},
337
+ {type: MODULE_STORAGE, label: 'Storage'},
338
+ ],
339
+ },
340
+ {
341
+ id: 'container-t2',
342
+ name: 'Container T2',
343
+ description: 'Advanced cargo container with improved capacity formulas.',
344
+ color: '#9BADB8',
345
+ packedItemId: ITEM_CONTAINER_T2_PACKED,
346
+ recipe: [
347
+ {itemId: ITEM_HULL_PLATES_T2, quantity: 6},
348
+ {itemId: ITEM_CARGO_LINING_T2, quantity: 2},
349
+ ],
350
+ stats: [
351
+ {key: 'strength', sourceComponentId: ITEM_HULL_PLATES_T2, sourceStatKey: 'strength'},
352
+ {key: 'density', sourceComponentId: ITEM_HULL_PLATES_T2, sourceStatKey: 'density'},
353
+ {key: 'ductility', sourceComponentId: ITEM_CARGO_LINING_T2, sourceStatKey: 'ductility'},
354
+ {key: 'purity', sourceComponentId: ITEM_CARGO_LINING_T2, sourceStatKey: 'purity'},
355
+ ],
356
+ },
357
+ ]
358
+
359
+ export interface ModuleRecipe {
360
+ id: string
361
+ name: string
362
+ description: string
363
+ color: string
364
+ itemId: number
365
+ moduleType: number
366
+ recipe: RecipeInput[]
367
+ stats: {key: string; sourceComponentId: number; sourceStatKey: string}[]
368
+ }
369
+
370
+ export const moduleRecipes: ModuleRecipe[] = [
371
+ {
372
+ id: 'engine-t1',
373
+ name: 'Engine',
374
+ description: 'Basic propulsion system. Converts volatile gases into thrust.',
375
+ color: '#E86344',
376
+ itemId: ITEM_ENGINE_T1,
377
+ moduleType: MODULE_ENGINE,
378
+ recipe: [{itemId: ITEM_THRUSTER_CORE, quantity: 6}],
379
+ stats: [
380
+ {key: 'volatility', sourceComponentId: ITEM_THRUSTER_CORE, sourceStatKey: 'volatility'},
381
+ {key: 'thermal', sourceComponentId: ITEM_THRUSTER_CORE, sourceStatKey: 'thermal'},
382
+ ],
383
+ },
384
+ {
385
+ id: 'generator-t1',
386
+ name: 'Generator',
387
+ description: 'Basic energy system. Stores and recharges energy from resonant minerals.',
388
+ color: '#7B5AE8',
389
+ itemId: ITEM_GENERATOR_T1,
390
+ moduleType: MODULE_GENERATOR,
391
+ recipe: [{itemId: ITEM_POWER_CELL, quantity: 5}],
392
+ stats: [
393
+ {key: 'resonance', sourceComponentId: ITEM_POWER_CELL, sourceStatKey: 'resonance'},
394
+ {key: 'clarity', sourceComponentId: ITEM_POWER_CELL, sourceStatKey: 'clarity'},
395
+ ],
396
+ },
397
+ {
398
+ id: 'gatherer-t1',
399
+ name: 'Gatherer',
400
+ description: 'Basic gathering system. Probes and conduits for raw resources.',
401
+ color: '#7B8D9E',
402
+ itemId: ITEM_GATHERER_T1,
403
+ moduleType: MODULE_GATHERER,
404
+ recipe: [
405
+ {itemId: ITEM_MATTER_CONDUIT, quantity: 4},
406
+ {itemId: ITEM_SURVEY_PROBE, quantity: 3},
407
+ ],
408
+ stats: [
409
+ {key: 'strength', sourceComponentId: ITEM_MATTER_CONDUIT, sourceStatKey: 'strength'},
410
+ {key: 'tolerance', sourceComponentId: ITEM_MATTER_CONDUIT, sourceStatKey: 'tolerance'},
411
+ {
412
+ key: 'reflectivity',
413
+ sourceComponentId: ITEM_SURVEY_PROBE,
414
+ sourceStatKey: 'reflectivity',
415
+ },
416
+ {
417
+ key: 'conductivity',
418
+ sourceComponentId: ITEM_SURVEY_PROBE,
419
+ sourceStatKey: 'conductivity',
420
+ },
421
+ {
422
+ key: 'reflectivity_speed',
423
+ sourceComponentId: ITEM_SURVEY_PROBE,
424
+ sourceStatKey: 'reflectivity',
425
+ },
426
+ ],
427
+ },
428
+ {
429
+ id: 'loader-t1',
430
+ name: 'Loader',
431
+ description: 'Basic cargo handling system. Loads and unloads cargo with articulated arms.',
432
+ color: '#6B8E5A',
433
+ itemId: ITEM_LOADER_T1,
434
+ moduleType: MODULE_LOADER,
435
+ recipe: [
436
+ {itemId: ITEM_CARGO_LINING, quantity: 3},
437
+ {itemId: ITEM_CARGO_ARM, quantity: 3},
438
+ ],
439
+ stats: [
440
+ {key: 'ductility', sourceComponentId: ITEM_CARGO_LINING, sourceStatKey: 'ductility'},
441
+ {key: 'plasticity', sourceComponentId: ITEM_CARGO_ARM, sourceStatKey: 'plasticity'},
442
+ ],
443
+ },
444
+ {
445
+ id: 'manufacturing-t1',
446
+ name: 'Manufacturing',
447
+ description:
448
+ 'Basic crafting system. Processes materials using reaction chambers and cutting tools.',
449
+ color: '#7EC8E3',
450
+ itemId: ITEM_MANUFACTURING_T1,
451
+ moduleType: MODULE_CRAFTER,
452
+ recipe: [
453
+ {itemId: ITEM_TOOL_BIT, quantity: 3},
454
+ {itemId: ITEM_REACTION_CHAMBER, quantity: 3},
455
+ ],
456
+ stats: [
457
+ {
458
+ key: 'reactivity',
459
+ sourceComponentId: ITEM_REACTION_CHAMBER,
460
+ sourceStatKey: 'reactivity',
461
+ },
462
+ {key: 'clarity', sourceComponentId: ITEM_TOOL_BIT, sourceStatKey: 'clarity'},
463
+ ],
464
+ },
465
+ {
466
+ id: 'storage-t1',
467
+ name: 'Storage',
468
+ description: 'Expands cargo capacity based on hull material quality',
469
+ color: '#8B7355',
470
+ itemId: ITEM_STORAGE_T1,
471
+ moduleType: MODULE_STORAGE,
472
+ recipe: [
473
+ {itemId: ITEM_HULL_PLATES, quantity: 8},
474
+ {itemId: ITEM_CARGO_LINING, quantity: 4},
475
+ ],
476
+ stats: [
477
+ {key: 'strength', sourceComponentId: ITEM_HULL_PLATES, sourceStatKey: 'strength'},
478
+ {key: 'ductility', sourceComponentId: ITEM_HULL_PLATES, sourceStatKey: 'ductility'},
479
+ {key: 'purity', sourceComponentId: ITEM_CARGO_LINING, sourceStatKey: 'purity'},
480
+ {key: 'density', sourceComponentId: ITEM_CARGO_LINING, sourceStatKey: 'density'},
481
+ ],
482
+ },
483
+ {
484
+ id: 'hauler-t1',
485
+ name: 'Hauler Module T1',
486
+ description:
487
+ 'Projects a haul beam to lock onto and transport containers or warehouses through group travel.',
488
+ color: '#D4A843',
489
+ itemId: ITEM_HAULER_T1,
490
+ moduleType: MODULE_HAULER,
491
+ recipe: [
492
+ {itemId: ITEM_POWER_CELL, quantity: 3},
493
+ {itemId: ITEM_FOCUSING_ARRAY, quantity: 3},
494
+ ],
495
+ stats: [
496
+ {key: 'capacity', sourceComponentId: ITEM_POWER_CELL, sourceStatKey: 'resonance'},
497
+ {
498
+ key: 'efficiency',
499
+ sourceComponentId: ITEM_FOCUSING_ARRAY,
500
+ sourceStatKey: 'conductivity',
501
+ },
502
+ {key: 'drain', sourceComponentId: ITEM_POWER_CELL, sourceStatKey: 'clarity'},
503
+ {key: 'ductility', sourceComponentId: ITEM_FOCUSING_ARRAY, sourceStatKey: 'ductility'},
504
+ ],
505
+ },
506
+ ]
507
+
508
+ export function getModuleRecipe(id: string): ModuleRecipe | undefined {
509
+ return moduleRecipes.find((r) => r.id === id)
510
+ }
511
+
512
+ export function getModuleRecipeByItemId(itemId: number): ModuleRecipe | undefined {
513
+ return moduleRecipes.find((r) => r.itemId === itemId)
514
+ }
515
+
516
+ export function getComponentById(id: number): ComponentDefinition | undefined {
517
+ return components.find((c) => c.id === id)
518
+ }
519
+
520
+ export function getEntityRecipe(id: string): EntityRecipe | undefined {
521
+ return entityRecipes.find((r) => r.id === id)
522
+ }
523
+
524
+ export function getEntityRecipeByItemId(itemId: number): EntityRecipe | undefined {
525
+ return entityRecipes.find((r) => r.packedItemId === itemId)
526
+ }
527
+
528
+ export function getEntitySlotLayout(packedItemId: number): ModuleSlot[] {
529
+ const recipe = getEntityRecipeByItemId(packedItemId)
530
+ return recipe?.moduleSlots ?? []
531
+ }
532
+
533
+ export function getAllCraftableItems(): CraftableItem[] {
534
+ const items: CraftableItem[] = []
535
+ for (const comp of components) {
536
+ items.push({
537
+ type: 'component',
538
+ id: comp.id,
539
+ name: comp.name,
540
+ description: comp.description,
541
+ color: comp.color,
542
+ })
543
+ }
544
+ for (const entity of entityRecipes) {
545
+ items.push({
546
+ type: 'entity',
547
+ id: entity.id,
548
+ name: entity.name,
549
+ description: entity.description,
550
+ color: entity.color,
551
+ })
552
+ }
553
+ for (const mod of moduleRecipes) {
554
+ items.push({
555
+ type: 'module',
556
+ id: mod.id,
557
+ name: mod.name,
558
+ description: mod.description,
559
+ color: mod.color,
560
+ })
561
+ }
562
+ return items
563
+ }
564
+
565
+ export function getComponentsForCategory(category: ResourceCategory): ComponentDefinition[] {
566
+ return components.filter((c) => c.recipe.some((r) => r.category === category))
567
+ }
568
+
569
+ export function getComponentsForStat(statKey: string): ComponentDefinition[] {
570
+ return components.filter((c) => c.stats.some((s) => s.key === statKey))
571
+ }