@shipload/sdk 1.0.0-next.42 → 1.0.0-next.44
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/lib/shipload.d.ts +222 -172
- package/lib/shipload.js +658 -421
- package/lib/shipload.js.map +1 -1
- package/lib/shipload.m.js +644 -423
- package/lib/shipload.m.js.map +1 -1
- package/lib/testing.d.ts +50 -67
- package/lib/testing.js +168 -208
- package/lib/testing.js.map +1 -1
- package/lib/testing.m.js +169 -209
- package/lib/testing.m.js.map +1 -1
- package/package.json +1 -1
- package/src/contracts/server.ts +126 -214
- package/src/data/capabilities.ts +22 -14
- package/src/data/capability-formulas.ts +7 -7
- package/src/data/entities.json +4 -0
- package/src/data/item-ids.ts +1 -0
- package/src/data/items.json +6 -0
- package/src/data/kind-registry.json +18 -6
- package/src/data/kind-registry.ts +7 -0
- package/src/data/metadata.ts +22 -15
- package/src/data/recipes.json +147 -138
- package/src/derivation/build-methods.test.ts +13 -0
- package/src/derivation/build-methods.ts +5 -2
- package/src/derivation/capabilities.ts +8 -8
- package/src/derivation/capability-mappings.ts +49 -4
- package/src/index-module.ts +21 -1
- package/src/managers/actions.ts +42 -8
- package/src/managers/cluster.test.ts +39 -0
- package/src/managers/cluster.ts +53 -0
- package/src/managers/context.ts +9 -0
- package/src/managers/index.ts +2 -0
- package/src/nft/buildImmutableData.ts +15 -17
- package/src/nft/description.ts +8 -8
- package/src/resolution/describe-module.ts +6 -6
- package/src/resolution/resolve-item.ts +3 -3
- package/src/scheduling/unwrap.test.ts +60 -0
- package/src/scheduling/unwrap.ts +187 -0
- package/src/shipload.ts +5 -0
- package/src/subscriptions/manager.cluster.test.ts +46 -0
- package/src/subscriptions/manager.ts +22 -0
- package/src/subscriptions/types.ts +16 -0
- package/src/types.ts +7 -0
package/src/data/capabilities.ts
CHANGED
|
@@ -8,6 +8,14 @@ export interface StatMapping {
|
|
|
8
8
|
stat: string
|
|
9
9
|
capability: string
|
|
10
10
|
attribute: string
|
|
11
|
+
source: string // producing module/role, always present
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface CapabilityAttributeRow {
|
|
15
|
+
capability: string
|
|
16
|
+
attribute: string
|
|
17
|
+
description: string
|
|
18
|
+
source?: string // producing module/role; absent when no formula-derived producer exists
|
|
11
19
|
}
|
|
12
20
|
|
|
13
21
|
export const capabilityNames: string[] = [
|
|
@@ -15,12 +23,12 @@ export const capabilityNames: string[] = [
|
|
|
15
23
|
'Storage',
|
|
16
24
|
'Movement',
|
|
17
25
|
'Energy',
|
|
18
|
-
'
|
|
26
|
+
'Loading',
|
|
19
27
|
'Gathering',
|
|
20
28
|
'Warp',
|
|
21
|
-
'
|
|
29
|
+
'Crafting',
|
|
22
30
|
'Launch',
|
|
23
|
-
'
|
|
31
|
+
'Hauling',
|
|
24
32
|
]
|
|
25
33
|
|
|
26
34
|
export const capabilityAttributes: CapabilityAttribute[] = [
|
|
@@ -28,20 +36,20 @@ export const capabilityAttributes: CapabilityAttribute[] = [
|
|
|
28
36
|
{
|
|
29
37
|
capability: 'Storage',
|
|
30
38
|
attribute: 'capacity',
|
|
31
|
-
description: 'Cargo capacity added by hulls and installed Cargo
|
|
39
|
+
description: 'Cargo capacity added by hulls and installed Cargo Hold modules',
|
|
32
40
|
},
|
|
33
41
|
{capability: 'Movement', attribute: 'thrust', description: 'Propulsion force'},
|
|
34
42
|
{capability: 'Movement', attribute: 'drain', description: 'Energy consumed per movement'},
|
|
35
43
|
{
|
|
36
44
|
capability: 'Energy',
|
|
37
45
|
attribute: 'capacity',
|
|
38
|
-
description: 'Energy capacity from
|
|
46
|
+
description: 'Energy capacity from Reactors and installed Battery Bank modules',
|
|
39
47
|
},
|
|
40
48
|
{capability: 'Energy', attribute: 'recharge', description: 'Energy regeneration rate'},
|
|
41
|
-
{capability: '
|
|
42
|
-
{capability: '
|
|
49
|
+
{capability: 'Loading', attribute: 'mass', description: 'Weight of the loader unit itself'},
|
|
50
|
+
{capability: 'Loading', attribute: 'thrust', description: 'Loading speed/force'},
|
|
43
51
|
{
|
|
44
|
-
capability: '
|
|
52
|
+
capability: 'Loading',
|
|
45
53
|
attribute: 'quantity',
|
|
46
54
|
description: 'Number of cargo items moved per load operation',
|
|
47
55
|
},
|
|
@@ -49,28 +57,28 @@ export const capabilityAttributes: CapabilityAttribute[] = [
|
|
|
49
57
|
{capability: 'Gathering', attribute: 'drain', description: 'Energy consumed per gather'},
|
|
50
58
|
{capability: 'Gathering', attribute: 'depth', description: 'Maximum gather depth'},
|
|
51
59
|
{capability: 'Warp', attribute: 'range', description: 'Maximum warp distance'},
|
|
52
|
-
{capability: '
|
|
60
|
+
{capability: 'Crafting', attribute: 'speed', description: 'Crafting time per item'},
|
|
53
61
|
{
|
|
54
|
-
capability: '
|
|
62
|
+
capability: 'Crafting',
|
|
55
63
|
attribute: 'drain',
|
|
56
64
|
description: 'Energy consumed per second while crafting',
|
|
57
65
|
},
|
|
58
|
-
{capability: '
|
|
66
|
+
{capability: 'Crafting', attribute: 'quality', description: 'Modifier on output quality'},
|
|
59
67
|
{capability: 'Launch', attribute: 'range', description: 'Maximum launch distance'},
|
|
60
68
|
{capability: 'Launch', attribute: 'capacity', description: 'Maximum mass per launch'},
|
|
61
69
|
{capability: 'Launch', attribute: 'drain', description: 'Energy consumed per launch'},
|
|
62
70
|
{
|
|
63
|
-
capability: '
|
|
71
|
+
capability: 'Hauling',
|
|
64
72
|
attribute: 'capacity',
|
|
65
73
|
description: 'Number of targets the haul beam can lock onto simultaneously',
|
|
66
74
|
},
|
|
67
75
|
{
|
|
68
|
-
capability: '
|
|
76
|
+
capability: 'Hauling',
|
|
69
77
|
attribute: 'efficiency',
|
|
70
78
|
description: 'Thrust penalty reduction per hauled target',
|
|
71
79
|
},
|
|
72
80
|
{
|
|
73
|
-
capability: '
|
|
81
|
+
capability: 'Hauling',
|
|
74
82
|
attribute: 'drain',
|
|
75
83
|
description: 'Energy consumed per target during haul-beam operation',
|
|
76
84
|
},
|
|
@@ -40,12 +40,12 @@ export const SLOT_FORMULAS: Record<SlotConsumerKind, Record<number, SlotConsumer
|
|
|
40
40
|
2: {capability: 'Gathering', attribute: 'drain'},
|
|
41
41
|
},
|
|
42
42
|
loader: {
|
|
43
|
-
0: {capability: '
|
|
44
|
-
1: {capability: '
|
|
43
|
+
0: {capability: 'Loading', attribute: 'mass'},
|
|
44
|
+
1: {capability: 'Loading', attribute: 'thrust'},
|
|
45
45
|
},
|
|
46
46
|
crafter: {
|
|
47
|
-
0: {capability: '
|
|
48
|
-
1: {capability: '
|
|
47
|
+
0: {capability: 'Crafting', attribute: 'speed'},
|
|
48
|
+
1: {capability: 'Crafting', attribute: 'drain'},
|
|
49
49
|
},
|
|
50
50
|
storage: {
|
|
51
51
|
0: {capability: 'Storage', attribute: 'capacity'},
|
|
@@ -54,9 +54,9 @@ export const SLOT_FORMULAS: Record<SlotConsumerKind, Record<number, SlotConsumer
|
|
|
54
54
|
3: {capability: 'Storage', attribute: 'capacity'},
|
|
55
55
|
},
|
|
56
56
|
hauler: {
|
|
57
|
-
0: {capability: '
|
|
58
|
-
1: {capability: '
|
|
59
|
-
2: {capability: '
|
|
57
|
+
0: {capability: 'Hauling', attribute: 'capacity'},
|
|
58
|
+
1: {capability: 'Hauling', attribute: 'efficiency'},
|
|
59
|
+
2: {capability: 'Hauling', attribute: 'drain'},
|
|
60
60
|
},
|
|
61
61
|
warp: {
|
|
62
62
|
0: {capability: 'Warp', attribute: 'range'},
|
package/src/data/entities.json
CHANGED
package/src/data/item-ids.ts
CHANGED
|
@@ -77,6 +77,7 @@ export const ITEM_EXTRACTOR_T1_PACKED = 10203
|
|
|
77
77
|
export const ITEM_FACTORY_T1_PACKED = 10204
|
|
78
78
|
export const ITEM_MASS_DRIVER_T1_PACKED = 10205
|
|
79
79
|
export const ITEM_MASS_CATCHER_T1_PACKED = 10206
|
|
80
|
+
export const ITEM_HUB_T1_PACKED = 10207
|
|
80
81
|
export const ITEM_PLATE_T2 = 20001
|
|
81
82
|
export const ITEM_FRAME_T2 = 20002
|
|
82
83
|
export const ITEM_CONTAINER_T2_PACKED = 20200
|
package/src/data/items.json
CHANGED
|
@@ -9,35 +9,35 @@
|
|
|
9
9
|
},
|
|
10
10
|
{
|
|
11
11
|
"kind": "warehouse",
|
|
12
|
-
"classification": "
|
|
12
|
+
"classification": "OrbitalStructure",
|
|
13
13
|
"capabilityFlags": 20,
|
|
14
14
|
"zCoord": 0,
|
|
15
15
|
"defaultLabel": "Warehouse"
|
|
16
16
|
},
|
|
17
17
|
{
|
|
18
18
|
"kind": "extractor",
|
|
19
|
-
"classification": "
|
|
19
|
+
"classification": "OrbitalStructure",
|
|
20
20
|
"capabilityFlags": 20,
|
|
21
21
|
"zCoord": 0,
|
|
22
|
-
"defaultLabel": "
|
|
22
|
+
"defaultLabel": "Mining Rig"
|
|
23
23
|
},
|
|
24
24
|
{
|
|
25
25
|
"kind": "factory",
|
|
26
|
-
"classification": "
|
|
26
|
+
"classification": "OrbitalStructure",
|
|
27
27
|
"capabilityFlags": 20,
|
|
28
28
|
"zCoord": 0,
|
|
29
29
|
"defaultLabel": "Factory"
|
|
30
30
|
},
|
|
31
31
|
{
|
|
32
32
|
"kind": "mdriver",
|
|
33
|
-
"classification": "
|
|
33
|
+
"classification": "OrbitalStructure",
|
|
34
34
|
"capabilityFlags": 20,
|
|
35
35
|
"zCoord": 0,
|
|
36
36
|
"defaultLabel": "Mass Driver"
|
|
37
37
|
},
|
|
38
38
|
{
|
|
39
39
|
"kind": "mcatcher",
|
|
40
|
-
"classification": "
|
|
40
|
+
"classification": "OrbitalStructure",
|
|
41
41
|
"capabilityFlags": 28,
|
|
42
42
|
"zCoord": 0,
|
|
43
43
|
"defaultLabel": "Mass Catcher"
|
|
@@ -62,6 +62,13 @@
|
|
|
62
62
|
"capabilityFlags": 0,
|
|
63
63
|
"zCoord": 0,
|
|
64
64
|
"defaultLabel": "Plot"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"kind": "hub",
|
|
68
|
+
"classification": "OrbitalStructure",
|
|
69
|
+
"capabilityFlags": 4,
|
|
70
|
+
"zCoord": 0,
|
|
71
|
+
"defaultLabel": "Station Hub"
|
|
65
72
|
}
|
|
66
73
|
],
|
|
67
74
|
"templates": [
|
|
@@ -104,6 +111,11 @@
|
|
|
104
111
|
"itemId": 20200,
|
|
105
112
|
"kind": "container",
|
|
106
113
|
"displayLabel": ""
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"itemId": 10207,
|
|
117
|
+
"kind": "hub",
|
|
118
|
+
"displayLabel": ""
|
|
107
119
|
}
|
|
108
120
|
]
|
|
109
121
|
}
|
|
@@ -11,12 +11,14 @@ export enum EntityClass {
|
|
|
11
11
|
OrbitalVessel = 0,
|
|
12
12
|
PlanetaryStructure = 1,
|
|
13
13
|
Plot = 2,
|
|
14
|
+
OrbitalStructure = 3,
|
|
14
15
|
}
|
|
15
16
|
|
|
16
17
|
const CLASSIFICATION_BY_NAME: Record<string, EntityClass> = {
|
|
17
18
|
OrbitalVessel: EntityClass.OrbitalVessel,
|
|
18
19
|
PlanetaryStructure: EntityClass.PlanetaryStructure,
|
|
19
20
|
Plot: EntityClass.Plot,
|
|
21
|
+
OrbitalStructure: EntityClass.OrbitalStructure,
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
export type EntityTypeName =
|
|
@@ -29,6 +31,7 @@ export type EntityTypeName =
|
|
|
29
31
|
| 'plot'
|
|
30
32
|
| 'mdriver'
|
|
31
33
|
| 'mcatcher'
|
|
34
|
+
| 'hub'
|
|
32
35
|
|
|
33
36
|
export interface KindMeta {
|
|
34
37
|
kind: Name
|
|
@@ -135,6 +138,7 @@ export const ENTITY_NEXUS = Name.from('nexus')
|
|
|
135
138
|
export const ENTITY_PLOT = Name.from('plot')
|
|
136
139
|
export const ENTITY_MASS_DRIVER = Name.from('mdriver')
|
|
137
140
|
export const ENTITY_MASS_CATCHER = Name.from('mcatcher')
|
|
141
|
+
export const ENTITY_HUB = Name.from('hub')
|
|
138
142
|
|
|
139
143
|
export function isShip(entity: {type?: Name}): boolean {
|
|
140
144
|
return entity.type?.equals(ENTITY_SHIP) ?? false
|
|
@@ -163,3 +167,6 @@ export function isMassDriver(entity: {type?: Name}): boolean {
|
|
|
163
167
|
export function isMassCatcher(entity: {type?: Name}): boolean {
|
|
164
168
|
return entity.type?.equals(ENTITY_MASS_CATCHER) ?? false
|
|
165
169
|
}
|
|
170
|
+
export function isHub(entity: {type?: Name}): boolean {
|
|
171
|
+
return entity.type?.equals(ENTITY_HUB) ?? false
|
|
172
|
+
}
|
package/src/data/metadata.ts
CHANGED
|
@@ -176,46 +176,46 @@ export const itemMetadata: Record<number, ItemMetadata> = {
|
|
|
176
176
|
color: '#E86344',
|
|
177
177
|
},
|
|
178
178
|
10101: {
|
|
179
|
-
name: '
|
|
179
|
+
name: 'Reactor',
|
|
180
180
|
description: 'Basic energy system. Stores and recharges energy from resonant crystals.',
|
|
181
181
|
color: '#4ADBFF',
|
|
182
182
|
},
|
|
183
183
|
10102: {
|
|
184
|
-
name: '
|
|
184
|
+
name: 'Limpet Bay',
|
|
185
185
|
description: 'Basic gathering system. Probes and conduits for raw resources.',
|
|
186
186
|
color: '#7B8D9E',
|
|
187
187
|
},
|
|
188
188
|
10103: {
|
|
189
|
-
name: '
|
|
189
|
+
name: 'Shuttle Bay',
|
|
190
190
|
description: 'Basic cargo handling system. Loads and unloads cargo with articulated arms.',
|
|
191
191
|
color: '#5A8B3E',
|
|
192
192
|
},
|
|
193
193
|
10104: {
|
|
194
|
-
name: '
|
|
194
|
+
name: 'Fabricator',
|
|
195
195
|
description:
|
|
196
196
|
'Basic crafting system. Processes materials using reaction chambers and cutting tools.',
|
|
197
197
|
color: '#B877FF',
|
|
198
198
|
},
|
|
199
199
|
10105: {
|
|
200
|
-
name: 'Cargo
|
|
200
|
+
name: 'Cargo Hold',
|
|
201
201
|
description: 'Expanded cargo storage with reinforced internal holds.',
|
|
202
202
|
color: '#8B7355',
|
|
203
203
|
},
|
|
204
204
|
10106: {
|
|
205
|
-
name: '
|
|
205
|
+
name: 'Tractor Beam',
|
|
206
206
|
description:
|
|
207
207
|
'Projects a haul beam to lock onto and transport containers or warehouses through group travel.',
|
|
208
208
|
color: '#4ADBFF',
|
|
209
209
|
},
|
|
210
210
|
10107: {
|
|
211
|
-
name: 'Warp',
|
|
211
|
+
name: 'Warp Drive',
|
|
212
212
|
description:
|
|
213
213
|
'Folds local space-time around the hull, projecting the ship across vast distances in a single discharge of the entire energy reserve.',
|
|
214
214
|
color: '#9be4ff',
|
|
215
215
|
},
|
|
216
216
|
10108: {
|
|
217
217
|
name: 'Battery Bank',
|
|
218
|
-
description: 'Stores additional charge produced by
|
|
218
|
+
description: 'Stores additional charge produced by reactors.',
|
|
219
219
|
color: '#4ADBFF',
|
|
220
220
|
},
|
|
221
221
|
10109: {
|
|
@@ -241,7 +241,7 @@ export const itemMetadata: Record<number, ItemMetadata> = {
|
|
|
241
241
|
color: '#EAB308',
|
|
242
242
|
},
|
|
243
243
|
10203: {
|
|
244
|
-
name: '
|
|
244
|
+
name: 'Mining Rig',
|
|
245
245
|
description:
|
|
246
246
|
'Planetary resource extraction facility with generator and gatherer module slots.',
|
|
247
247
|
color: '#D4726F',
|
|
@@ -262,6 +262,11 @@ export const itemMetadata: Record<number, ItemMetadata> = {
|
|
|
262
262
|
'Planetary receiving platform with storage module slots; catches launched payloads.',
|
|
263
263
|
color: '#4AE898',
|
|
264
264
|
},
|
|
265
|
+
10207: {
|
|
266
|
+
name: 'Station Hub',
|
|
267
|
+
description: 'Orbital command structure. Anchors a player station cluster.',
|
|
268
|
+
color: '#A0B8D0',
|
|
269
|
+
},
|
|
265
270
|
|
|
266
271
|
// === Components (T2) ===
|
|
267
272
|
20001: {
|
|
@@ -285,12 +290,14 @@ export const itemMetadata: Record<number, ItemMetadata> = {
|
|
|
285
290
|
}
|
|
286
291
|
|
|
287
292
|
export const entityMetadata: Record<number, EntityMetadata> = {
|
|
288
|
-
10201: {moduleSlotLabels: ['Engine', '
|
|
289
|
-
10202: {
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
293
|
+
10201: {moduleSlotLabels: ['Engine', 'Reactor', 'Limpet Bay', 'Shuttle Bay', 'Cargo Hold']},
|
|
294
|
+
10202: {
|
|
295
|
+
moduleSlotLabels: ['Shuttle Bay', 'Cargo Hold', 'Cargo Hold', 'Cargo Hold', 'Cargo Hold'],
|
|
296
|
+
},
|
|
297
|
+
10203: {moduleSlotLabels: ['Reactor', 'Limpet Bay']},
|
|
298
|
+
10204: {moduleSlotLabels: ['Reactor', 'Fabricator']},
|
|
299
|
+
10205: {moduleSlotLabels: ['Reactor', 'Drive Coil']},
|
|
300
|
+
10206: {moduleSlotLabels: ['Cargo Hold', 'Cargo Hold', 'Cargo Hold']},
|
|
294
301
|
}
|
|
295
302
|
|
|
296
303
|
for (const item of items as Array<{id: number}>) {
|