@shipload/sdk 1.0.0-next.2 → 1.0.0-next.20
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 +1709 -1044
- package/lib/shipload.js +6762 -4658
- package/lib/shipload.js.map +1 -1
- package/lib/shipload.m.js +6653 -4614
- package/lib/shipload.m.js.map +1 -1
- package/lib/testing.d.ts +833 -0
- package/lib/testing.js +3647 -0
- package/lib/testing.js.map +1 -0
- package/lib/testing.m.js +3641 -0
- package/lib/testing.m.js.map +1 -0
- package/package.json +15 -2
- package/src/capabilities/gathering.ts +17 -7
- package/src/capabilities/modules.ts +9 -0
- package/src/capabilities/storage.ts +1 -1
- package/src/contracts/platform.ts +211 -3
- package/src/contracts/server.ts +723 -438
- package/src/data/capabilities.ts +9 -329
- package/src/data/capability-formulas.ts +76 -0
- package/src/data/catalog.ts +0 -5
- package/src/data/colors.ts +14 -28
- package/src/data/entities.json +46 -10
- package/src/data/item-ids.ts +17 -13
- package/src/data/items.json +308 -37
- package/src/data/kind-registry.json +85 -0
- package/src/data/kind-registry.ts +150 -0
- package/src/data/metadata.ts +99 -24
- package/src/data/recipes-runtime.ts +3 -23
- package/src/data/recipes.json +265 -96
- package/src/derivation/build-methods.ts +45 -0
- package/src/derivation/capabilities.ts +414 -0
- package/src/derivation/capability-mappings.ts +117 -0
- package/src/derivation/crafting.ts +23 -24
- package/src/derivation/index.ts +8 -2
- package/src/derivation/reserve-regen.ts +34 -0
- package/src/derivation/resources.ts +125 -38
- package/src/derivation/stats.ts +1 -2
- package/src/derivation/stratum.ts +15 -19
- package/src/derivation/tiers.ts +28 -7
- package/src/entities/entity.ts +98 -0
- package/src/entities/gamestate.ts +3 -28
- package/src/entities/makers.ts +75 -129
- package/src/entities/slot-multiplier.ts +37 -0
- package/src/errors.ts +10 -15
- package/src/format.ts +26 -4
- package/src/index-module.ts +149 -40
- package/src/managers/actions.ts +184 -82
- package/src/managers/base.ts +2 -2
- package/src/managers/construction-types.ts +47 -0
- package/src/managers/construction.ts +147 -0
- package/src/managers/context.ts +9 -0
- package/src/managers/entities.ts +18 -66
- package/src/managers/epochs.ts +40 -0
- package/src/managers/index.ts +14 -1
- package/src/managers/locations.ts +2 -20
- package/src/managers/nft.ts +28 -0
- package/src/managers/plot.ts +123 -0
- package/src/nft/atomicassets.ts +231 -0
- package/src/nft/atomicdata.ts +130 -0
- package/src/nft/buildImmutableData.ts +319 -0
- package/src/nft/description.ts +45 -13
- package/src/nft/index.ts +3 -0
- package/src/resolution/describe-module.ts +5 -8
- package/src/resolution/display-name.ts +38 -10
- package/src/resolution/resolve-item.ts +20 -12
- package/src/scheduling/accessor.ts +4 -0
- package/src/scheduling/projection.ts +79 -27
- package/src/scheduling/schedule.ts +15 -1
- package/src/scheduling/task-cargo.ts +46 -0
- package/src/shipload.ts +5 -0
- package/src/subscriptions/manager.ts +40 -6
- package/src/subscriptions/mappers.ts +3 -8
- package/src/subscriptions/types.ts +3 -2
- package/src/testing/catalog-hash.ts +19 -0
- package/src/testing/index.ts +2 -0
- package/src/testing/projection-parity.ts +143 -0
- package/src/travel/travel.ts +61 -2
- package/src/types/index.ts +0 -1
- package/src/types.ts +17 -12
- package/src/utils/cargo.ts +27 -0
- package/src/utils/system.ts +25 -24
- package/src/entities/container.ts +0 -108
- package/src/entities/ship-deploy.ts +0 -258
- package/src/entities/ship.ts +0 -204
- package/src/entities/warehouse.ts +0 -119
- package/src/types/entity-traits.ts +0 -69
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
import {Name, type NameType} from '@wharfkit/antelope'
|
|
2
|
+
import kindRegistryJson from './kind-registry.json'
|
|
3
|
+
|
|
4
|
+
export const CAP_WRAP = 0x01
|
|
5
|
+
export const CAP_UNDEPLOY = 0x02
|
|
6
|
+
export const CAP_DEMOLISH = 0x04
|
|
7
|
+
export const CAP_MODULES = 0x10
|
|
8
|
+
|
|
9
|
+
export enum EntityClass {
|
|
10
|
+
OrbitalVessel = 0,
|
|
11
|
+
PlanetaryStructure = 1,
|
|
12
|
+
Plot = 2,
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const CLASSIFICATION_BY_NAME: Record<string, EntityClass> = {
|
|
16
|
+
OrbitalVessel: EntityClass.OrbitalVessel,
|
|
17
|
+
PlanetaryStructure: EntityClass.PlanetaryStructure,
|
|
18
|
+
Plot: EntityClass.Plot,
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export type EntityTypeName =
|
|
22
|
+
| 'ship'
|
|
23
|
+
| 'warehouse'
|
|
24
|
+
| 'extractor'
|
|
25
|
+
| 'factory'
|
|
26
|
+
| 'container'
|
|
27
|
+
| 'nexus'
|
|
28
|
+
| 'plot'
|
|
29
|
+
|
|
30
|
+
export interface KindMeta {
|
|
31
|
+
kind: Name
|
|
32
|
+
classification: EntityClass
|
|
33
|
+
capabilityFlags: number
|
|
34
|
+
zCoord: number
|
|
35
|
+
defaultLabel: string
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface TemplateMeta {
|
|
39
|
+
itemId: number
|
|
40
|
+
kind: Name
|
|
41
|
+
displayLabel: string
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
interface RawKindEntry {
|
|
45
|
+
kind: string
|
|
46
|
+
classification: string
|
|
47
|
+
capabilityFlags: number
|
|
48
|
+
zCoord: number
|
|
49
|
+
defaultLabel: string
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
interface RawTemplateEntry {
|
|
53
|
+
itemId: number
|
|
54
|
+
kind: string
|
|
55
|
+
displayLabel: string
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
const KIND_META: Map<string, KindMeta> = (() => {
|
|
59
|
+
const m = new Map<string, KindMeta>()
|
|
60
|
+
for (const r of kindRegistryJson.kinds as RawKindEntry[]) {
|
|
61
|
+
const cls = CLASSIFICATION_BY_NAME[r.classification]
|
|
62
|
+
if (cls === undefined) {
|
|
63
|
+
throw new Error(
|
|
64
|
+
`kind-registry: unknown classification "${r.classification}" for kind ${r.kind}`
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
m.set(r.kind, {
|
|
68
|
+
kind: Name.from(r.kind),
|
|
69
|
+
classification: cls,
|
|
70
|
+
capabilityFlags: r.capabilityFlags,
|
|
71
|
+
zCoord: r.zCoord,
|
|
72
|
+
defaultLabel: r.defaultLabel,
|
|
73
|
+
})
|
|
74
|
+
}
|
|
75
|
+
return m
|
|
76
|
+
})()
|
|
77
|
+
|
|
78
|
+
export const ALL_ENTITY_TYPES: readonly EntityTypeName[] = Object.freeze([
|
|
79
|
+
...KIND_META.keys(),
|
|
80
|
+
] as EntityTypeName[])
|
|
81
|
+
|
|
82
|
+
const TEMPLATE_BY_ITEM_ID: Map<number, TemplateMeta> = (() => {
|
|
83
|
+
const m = new Map<number, TemplateMeta>()
|
|
84
|
+
for (const r of kindRegistryJson.templates as RawTemplateEntry[]) {
|
|
85
|
+
m.set(r.itemId, {
|
|
86
|
+
itemId: r.itemId,
|
|
87
|
+
kind: Name.from(r.kind),
|
|
88
|
+
displayLabel: r.displayLabel,
|
|
89
|
+
})
|
|
90
|
+
}
|
|
91
|
+
return m
|
|
92
|
+
})()
|
|
93
|
+
|
|
94
|
+
function nameKey(kind: NameType | EntityTypeName): string {
|
|
95
|
+
if (typeof kind === 'string') return kind
|
|
96
|
+
return Name.from(kind).toString()
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export function getKindMeta(kind: NameType | EntityTypeName): KindMeta | undefined {
|
|
100
|
+
return KIND_META.get(nameKey(kind))
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export function getTemplateMeta(itemId: number): TemplateMeta | undefined {
|
|
104
|
+
return TEMPLATE_BY_ITEM_ID.get(itemId)
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export function getPackedEntityType(itemId: number): Name | null {
|
|
108
|
+
return TEMPLATE_BY_ITEM_ID.get(itemId)?.kind ?? null
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export function kindCan(kind: NameType | EntityTypeName, cap: number): boolean {
|
|
112
|
+
const m = KIND_META.get(nameKey(kind))
|
|
113
|
+
return m !== undefined && (m.capabilityFlags & cap) !== 0
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export function getEntityClass(kind: NameType | EntityTypeName): EntityClass {
|
|
117
|
+
const m = KIND_META.get(nameKey(kind))
|
|
118
|
+
if (!m) throw new Error(`Entity type has no class: ${nameKey(kind)}`)
|
|
119
|
+
return m.classification
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
export const ENTITY_SHIP = Name.from('ship')
|
|
123
|
+
export const ENTITY_WAREHOUSE = Name.from('warehouse')
|
|
124
|
+
export const ENTITY_EXTRACTOR = Name.from('extractor')
|
|
125
|
+
export const ENTITY_FACTORY = Name.from('factory')
|
|
126
|
+
export const ENTITY_CONTAINER = Name.from('container')
|
|
127
|
+
export const ENTITY_NEXUS = Name.from('nexus')
|
|
128
|
+
export const ENTITY_PLOT = Name.from('plot')
|
|
129
|
+
|
|
130
|
+
export function isShip(entity: {type?: Name}): boolean {
|
|
131
|
+
return entity.type?.equals(ENTITY_SHIP) ?? false
|
|
132
|
+
}
|
|
133
|
+
export function isWarehouse(entity: {type?: Name}): boolean {
|
|
134
|
+
return entity.type?.equals(ENTITY_WAREHOUSE) ?? false
|
|
135
|
+
}
|
|
136
|
+
export function isExtractor(entity: {type?: Name}): boolean {
|
|
137
|
+
return entity.type?.equals(ENTITY_EXTRACTOR) ?? false
|
|
138
|
+
}
|
|
139
|
+
export function isFactory(entity: {type?: Name}): boolean {
|
|
140
|
+
return entity.type?.equals(ENTITY_FACTORY) ?? false
|
|
141
|
+
}
|
|
142
|
+
export function isContainer(entity: {type?: Name}): boolean {
|
|
143
|
+
return entity.type?.equals(ENTITY_CONTAINER) ?? false
|
|
144
|
+
}
|
|
145
|
+
export function isNexus(entity: {type?: Name}): boolean {
|
|
146
|
+
return entity.type?.equals(ENTITY_NEXUS) ?? false
|
|
147
|
+
}
|
|
148
|
+
export function isPlot(entity: {type?: Name}): boolean {
|
|
149
|
+
return entity.type?.equals(ENTITY_PLOT) ?? false
|
|
150
|
+
}
|
package/src/data/metadata.ts
CHANGED
|
@@ -11,7 +11,7 @@ export interface EntityMetadata {
|
|
|
11
11
|
}
|
|
12
12
|
|
|
13
13
|
export const itemMetadata: Record<number, ItemMetadata> = {
|
|
14
|
-
// === Resources
|
|
14
|
+
// === Resources / Ore ===
|
|
15
15
|
101: {name: 'Ore', description: 'Crude metallic ore.', color: '#C26D3F'},
|
|
16
16
|
102: {name: 'Ore', description: 'Refined metallic ore with improved purity.', color: '#C26D3F'},
|
|
17
17
|
103: {
|
|
@@ -19,6 +19,15 @@ export const itemMetadata: Record<number, ItemMetadata> = {
|
|
|
19
19
|
description: 'High-grade metallic ore with exceptional density.',
|
|
20
20
|
color: '#C26D3F',
|
|
21
21
|
},
|
|
22
|
+
104: {name: 'Ore', description: '', color: '#C26D3F'},
|
|
23
|
+
105: {name: 'Ore', description: '', color: '#C26D3F'},
|
|
24
|
+
106: {name: 'Ore', description: '', color: '#C26D3F'},
|
|
25
|
+
107: {name: 'Ore', description: '', color: '#C26D3F'},
|
|
26
|
+
108: {name: 'Ore', description: '', color: '#C26D3F'},
|
|
27
|
+
109: {name: 'Ore', description: '', color: '#C26D3F'},
|
|
28
|
+
110: {name: 'Ore', description: '', color: '#C26D3F'},
|
|
29
|
+
|
|
30
|
+
// === Resources / Crystal ===
|
|
22
31
|
201: {name: 'Crystal', description: 'Raw resonant crystal.', color: '#4ADBFF'},
|
|
23
32
|
202: {
|
|
24
33
|
name: 'Crystal',
|
|
@@ -30,6 +39,15 @@ export const itemMetadata: Record<number, ItemMetadata> = {
|
|
|
30
39
|
description: 'High-grade resonant crystal with exceptional purity.',
|
|
31
40
|
color: '#4ADBFF',
|
|
32
41
|
},
|
|
42
|
+
204: {name: 'Crystal', description: '', color: '#4ADBFF'},
|
|
43
|
+
205: {name: 'Crystal', description: '', color: '#4ADBFF'},
|
|
44
|
+
206: {name: 'Crystal', description: '', color: '#4ADBFF'},
|
|
45
|
+
207: {name: 'Crystal', description: '', color: '#4ADBFF'},
|
|
46
|
+
208: {name: 'Crystal', description: '', color: '#4ADBFF'},
|
|
47
|
+
209: {name: 'Crystal', description: '', color: '#4ADBFF'},
|
|
48
|
+
210: {name: 'Crystal', description: '', color: '#4ADBFF'},
|
|
49
|
+
|
|
50
|
+
// === Resources / Gas ===
|
|
33
51
|
301: {name: 'Gas', description: 'Raw volatile gas.', color: '#B8E4A0'},
|
|
34
52
|
302: {
|
|
35
53
|
name: 'Gas',
|
|
@@ -41,6 +59,15 @@ export const itemMetadata: Record<number, ItemMetadata> = {
|
|
|
41
59
|
description: 'High-grade volatile gas with exceptional energy density.',
|
|
42
60
|
color: '#B8E4A0',
|
|
43
61
|
},
|
|
62
|
+
304: {name: 'Gas', description: '', color: '#B8E4A0'},
|
|
63
|
+
305: {name: 'Gas', description: '', color: '#B8E4A0'},
|
|
64
|
+
306: {name: 'Gas', description: '', color: '#B8E4A0'},
|
|
65
|
+
307: {name: 'Gas', description: '', color: '#B8E4A0'},
|
|
66
|
+
308: {name: 'Gas', description: '', color: '#B8E4A0'},
|
|
67
|
+
309: {name: 'Gas', description: '', color: '#B8E4A0'},
|
|
68
|
+
310: {name: 'Gas', description: '', color: '#B8E4A0'},
|
|
69
|
+
|
|
70
|
+
// === Resources / Regolith ===
|
|
44
71
|
401: {name: 'Regolith', description: 'Crude regolith dust.', color: '#C4A57B'},
|
|
45
72
|
402: {
|
|
46
73
|
name: 'Regolith',
|
|
@@ -52,6 +79,15 @@ export const itemMetadata: Record<number, ItemMetadata> = {
|
|
|
52
79
|
description: 'High-grade regolith with exceptional uniformity.',
|
|
53
80
|
color: '#C4A57B',
|
|
54
81
|
},
|
|
82
|
+
404: {name: 'Regolith', description: '', color: '#C4A57B'},
|
|
83
|
+
405: {name: 'Regolith', description: '', color: '#C4A57B'},
|
|
84
|
+
406: {name: 'Regolith', description: '', color: '#C4A57B'},
|
|
85
|
+
407: {name: 'Regolith', description: '', color: '#C4A57B'},
|
|
86
|
+
408: {name: 'Regolith', description: '', color: '#C4A57B'},
|
|
87
|
+
409: {name: 'Regolith', description: '', color: '#C4A57B'},
|
|
88
|
+
410: {name: 'Regolith', description: '', color: '#C4A57B'},
|
|
89
|
+
|
|
90
|
+
// === Resources / Biomass ===
|
|
55
91
|
501: {name: 'Biomass', description: 'Crude organic biomass.', color: '#5A8B3E'},
|
|
56
92
|
502: {
|
|
57
93
|
name: 'Biomass',
|
|
@@ -63,59 +99,73 @@ export const itemMetadata: Record<number, ItemMetadata> = {
|
|
|
63
99
|
description: 'High-grade biomass with exceptional saturation.',
|
|
64
100
|
color: '#5A8B3E',
|
|
65
101
|
},
|
|
102
|
+
504: {name: 'Biomass', description: '', color: '#5A8B3E'},
|
|
103
|
+
505: {name: 'Biomass', description: '', color: '#5A8B3E'},
|
|
104
|
+
506: {name: 'Biomass', description: '', color: '#5A8B3E'},
|
|
105
|
+
507: {name: 'Biomass', description: '', color: '#5A8B3E'},
|
|
106
|
+
508: {name: 'Biomass', description: '', color: '#5A8B3E'},
|
|
107
|
+
509: {name: 'Biomass', description: '', color: '#5A8B3E'},
|
|
108
|
+
510: {name: 'Biomass', description: '', color: '#5A8B3E'},
|
|
66
109
|
|
|
67
110
|
// === Components (T1) ===
|
|
68
111
|
10001: {
|
|
69
|
-
name: '
|
|
70
|
-
description:
|
|
112
|
+
name: 'Plate',
|
|
113
|
+
description:
|
|
114
|
+
'Structural plating formed from ore. Used in hulls, containers, and storage modules.',
|
|
71
115
|
color: '#7B8D9E',
|
|
72
116
|
},
|
|
73
117
|
10002: {
|
|
74
|
-
name: '
|
|
118
|
+
name: 'Frame',
|
|
75
119
|
description:
|
|
76
|
-
'Composite
|
|
120
|
+
'Composite framing formed from fine regolith bound in biomass polymer. Dense enough to seal cargo holds, flexible enough to absorb vibration.',
|
|
77
121
|
color: '#C4A57B',
|
|
78
122
|
},
|
|
79
123
|
10003: {
|
|
80
|
-
name: '
|
|
81
|
-
description:
|
|
124
|
+
name: 'Plasma Cell',
|
|
125
|
+
description:
|
|
126
|
+
'High-energy gaseous storage cell. Volatile gas held under controlled thermal conditions.',
|
|
82
127
|
color: '#E86344',
|
|
83
128
|
},
|
|
84
129
|
10004: {
|
|
85
|
-
name: '
|
|
130
|
+
name: 'Resonator',
|
|
86
131
|
description:
|
|
87
|
-
'Crystalline
|
|
132
|
+
'Crystalline resonance lattice. Stores and releases charge through coherent oscillation.',
|
|
88
133
|
color: '#4ADBFF',
|
|
89
134
|
},
|
|
90
135
|
10005: {
|
|
91
|
-
name: '
|
|
92
|
-
description:
|
|
136
|
+
name: 'Beam',
|
|
137
|
+
description:
|
|
138
|
+
'Heavy-duty structural beam machined from refined ore. Strong enough to bear load, tolerant enough to survive harsh environments.',
|
|
93
139
|
color: '#7B8D9E',
|
|
94
140
|
},
|
|
95
141
|
10006: {
|
|
96
|
-
name: '
|
|
97
|
-
description:
|
|
142
|
+
name: 'Sensor',
|
|
143
|
+
description:
|
|
144
|
+
'Crystal-lattice sensing element with conductive and reflective properties. Reads signal and surface alike.',
|
|
98
145
|
color: '#4ADBFF',
|
|
99
146
|
},
|
|
100
147
|
10007: {
|
|
101
|
-
name: '
|
|
102
|
-
description:
|
|
148
|
+
name: 'Polymer',
|
|
149
|
+
description:
|
|
150
|
+
'Pliable biomass-derived polymer with high insulation. Flexible, durable, electrically inert.',
|
|
103
151
|
color: '#5A8B3E',
|
|
104
152
|
},
|
|
105
153
|
10008: {
|
|
106
|
-
name: '
|
|
107
|
-
description:
|
|
154
|
+
name: 'Ceramic',
|
|
155
|
+
description:
|
|
156
|
+
'Hardened fine-grained ceramic refined from regolith. Hard enough to cut, fine enough to finish.',
|
|
108
157
|
color: '#C4A57B',
|
|
109
158
|
},
|
|
110
159
|
10009: {
|
|
111
|
-
name: '
|
|
112
|
-
description:
|
|
160
|
+
name: 'Reactor',
|
|
161
|
+
description:
|
|
162
|
+
'Gas-pressurized vessel for controlled reactions. Vents heat and contains volatility.',
|
|
113
163
|
color: '#B8E4A0',
|
|
114
164
|
},
|
|
115
165
|
10010: {
|
|
116
|
-
name: '
|
|
166
|
+
name: 'Emitter',
|
|
117
167
|
description:
|
|
118
|
-
|
|
168
|
+
'Precision-formed crystal emitter array. Routes energy efficiently to a target lock.',
|
|
119
169
|
color: '#4ADBFF',
|
|
120
170
|
},
|
|
121
171
|
|
|
@@ -157,6 +207,18 @@ export const itemMetadata: Record<number, ItemMetadata> = {
|
|
|
157
207
|
'Projects a haul beam to lock onto and transport containers or warehouses through group travel.',
|
|
158
208
|
color: '#4ADBFF',
|
|
159
209
|
},
|
|
210
|
+
10107: {
|
|
211
|
+
name: 'Warp',
|
|
212
|
+
description:
|
|
213
|
+
'Folds local space-time around the hull, projecting the ship across vast distances in a single discharge of the entire energy reserve.',
|
|
214
|
+
color: '#9be4ff',
|
|
215
|
+
},
|
|
216
|
+
10108: {
|
|
217
|
+
name: 'Battery',
|
|
218
|
+
description:
|
|
219
|
+
'Extends energy capacity. Stores additional charge produced by generators, letting builds chain more high-drain actions between recharges.',
|
|
220
|
+
color: '#4ADBFF',
|
|
221
|
+
},
|
|
160
222
|
|
|
161
223
|
// === Entities (packed, T1) ===
|
|
162
224
|
10200: {
|
|
@@ -174,17 +236,28 @@ export const itemMetadata: Record<number, ItemMetadata> = {
|
|
|
174
236
|
description: 'Massive stationary storage facility with a single loader module slot.',
|
|
175
237
|
color: '#EAB308',
|
|
176
238
|
},
|
|
239
|
+
10203: {
|
|
240
|
+
name: 'Extractor',
|
|
241
|
+
description:
|
|
242
|
+
'Planetary resource extraction facility with generator and gatherer module slots.',
|
|
243
|
+
color: '#D4726F',
|
|
244
|
+
},
|
|
245
|
+
10204: {
|
|
246
|
+
name: 'Factory',
|
|
247
|
+
description: 'Planetary fabrication facility with generator and crafter module slots.',
|
|
248
|
+
color: '#7BA7D4',
|
|
249
|
+
},
|
|
177
250
|
|
|
178
251
|
// === Components (T2) ===
|
|
179
252
|
20001: {
|
|
180
|
-
name: '
|
|
253
|
+
name: 'Plate',
|
|
181
254
|
description: 'Advanced structural plating reinforced with tier 2 ore.',
|
|
182
255
|
color: '#9BADB8',
|
|
183
256
|
},
|
|
184
257
|
20002: {
|
|
185
|
-
name: '
|
|
258
|
+
name: 'Frame',
|
|
186
259
|
description:
|
|
187
|
-
'Advanced composite
|
|
260
|
+
'Advanced composite framing reinforced with tier 2 regolith and biomass polymer.',
|
|
188
261
|
color: '#C4A57B',
|
|
189
262
|
},
|
|
190
263
|
|
|
@@ -199,6 +272,8 @@ export const itemMetadata: Record<number, ItemMetadata> = {
|
|
|
199
272
|
export const entityMetadata: Record<number, EntityMetadata> = {
|
|
200
273
|
10201: {moduleSlotLabels: ['Engine', 'Generator', 'Gatherer', 'Loader', 'Storage']},
|
|
201
274
|
10202: {moduleSlotLabels: ['Loader', 'Storage', 'Storage', 'Storage', 'Storage']},
|
|
275
|
+
10203: {moduleSlotLabels: ['Generator', 'Gatherer']},
|
|
276
|
+
10204: {moduleSlotLabels: ['Generator', 'Crafter']},
|
|
202
277
|
}
|
|
203
278
|
|
|
204
279
|
for (const item of items as Array<{id: number}>) {
|
|
@@ -1,20 +1,12 @@
|
|
|
1
|
-
import items from './items.json'
|
|
2
1
|
import recipes from './recipes.json'
|
|
3
2
|
import entities from './entities.json'
|
|
4
3
|
|
|
5
|
-
import {
|
|
6
|
-
import type {Item, ModuleType, ResourceCategory} from '../types'
|
|
4
|
+
import type {ModuleType} from '../types'
|
|
7
5
|
|
|
8
|
-
export interface
|
|
6
|
+
export interface RecipeInput {
|
|
9
7
|
itemId: number
|
|
10
8
|
quantity: number
|
|
11
9
|
}
|
|
12
|
-
export interface RecipeInputCategory {
|
|
13
|
-
category: ResourceCategory
|
|
14
|
-
tier: number
|
|
15
|
-
quantity: number
|
|
16
|
-
}
|
|
17
|
-
export type RecipeInput = RecipeInputItemId | RecipeInputCategory
|
|
18
10
|
|
|
19
11
|
export interface StatSlot {
|
|
20
12
|
sources: {inputIndex: number; statIndex: number}[]
|
|
@@ -30,6 +22,7 @@ export interface Recipe {
|
|
|
30
22
|
|
|
31
23
|
export interface EntitySlot {
|
|
32
24
|
type: ModuleType
|
|
25
|
+
outputPct: number
|
|
33
26
|
}
|
|
34
27
|
|
|
35
28
|
export interface EntityLayout {
|
|
@@ -43,13 +36,6 @@ for (const r of recipes as any[]) recipesById.set(r.outputItemId, r as Recipe)
|
|
|
43
36
|
const entitiesById = new Map<number, EntityLayout>()
|
|
44
37
|
for (const e of entities as any[]) entitiesById.set(e.entityItemId, e as EntityLayout)
|
|
45
38
|
|
|
46
|
-
const resourceByCategoryTier = new Map<string, Item>()
|
|
47
|
-
for (const raw of items as any[]) {
|
|
48
|
-
if (raw.type === 'resource') {
|
|
49
|
-
resourceByCategoryTier.set(`${raw.category}:${raw.tier}`, getItem(raw.id))
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
39
|
export function getRecipe(outputItemId: number): Recipe | undefined {
|
|
54
40
|
return recipesById.get(outputItemId)
|
|
55
41
|
}
|
|
@@ -57,9 +43,3 @@ export function getRecipe(outputItemId: number): Recipe | undefined {
|
|
|
57
43
|
export function getEntityLayout(entityItemId: number): EntityLayout | undefined {
|
|
58
44
|
return entitiesById.get(entityItemId)
|
|
59
45
|
}
|
|
60
|
-
|
|
61
|
-
export function findItemByCategoryAndTier(category: ResourceCategory, tier: number): Item {
|
|
62
|
-
const item = resourceByCategoryTier.get(`${category}:${tier}`)
|
|
63
|
-
if (!item) throw new Error(`No resource found for category=${category} tier=${tier}`)
|
|
64
|
-
return item
|
|
65
|
-
}
|