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