@shipload/sdk 2.0.0-rc8 → 2.0.0-rc9
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 +401 -38
- package/lib/shipload.js +1390 -67
- package/lib/shipload.js.map +1 -1
- package/lib/shipload.m.js +1330 -68
- package/lib/shipload.m.js.map +1 -1
- package/package.json +6 -5
- package/src/capabilities/modules.ts +9 -5
- package/src/contracts/server.ts +279 -22
- package/src/data/capabilities.ts +372 -0
- package/src/data/categories.ts +57 -0
- package/src/data/colors.ts +19 -14
- package/src/data/locations.ts +53 -0
- package/src/data/recipes.ts +117 -14
- package/src/data/tiers.ts +41 -0
- package/src/derivation/crafting.ts +58 -1
- package/src/entities/container.ts +18 -0
- package/src/entities/makers.ts +6 -4
- package/src/entities/ship-deploy.ts +34 -1
- package/src/entities/warehouse.ts +7 -1
- package/src/index-module.ts +70 -2
- package/src/nft/description.ts +173 -0
- package/src/nft/deserializers.ts +81 -0
- package/src/nft/index.ts +2 -0
- package/src/resolution/resolve-item.ts +11 -1
- package/src/travel/travel.ts +17 -8
- package/src/types/entity.ts +1 -1
- package/src/types.ts +6 -6
package/src/data/recipes.ts
CHANGED
|
@@ -1,20 +1,25 @@
|
|
|
1
|
-
import {MODULE_ANY, 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
|
+
import {MODULE_ANY, MODULE_ENGINE, MODULE_GENERATOR, MODULE_EXTRACTOR, MODULE_LOADER, MODULE_CRAFTER, MODULE_STORAGE, ITEM_ENGINE_T1, ITEM_GENERATOR_T1, ITEM_EXTRACTOR_T1, ITEM_LOADER_T1, ITEM_MANUFACTURING_T1, ITEM_STORAGE_T1} from '../capabilities/modules'
|
|
2
2
|
import type {ResourceCategory} from '../types'
|
|
3
3
|
|
|
4
|
-
export {ITEM_ENGINE_T1, ITEM_GENERATOR_T1, ITEM_EXTRACTOR_T1, ITEM_LOADER_T1, ITEM_MANUFACTURING_T1}
|
|
4
|
+
export {ITEM_ENGINE_T1, ITEM_GENERATOR_T1, ITEM_EXTRACTOR_T1, ITEM_LOADER_T1, ITEM_MANUFACTURING_T1, ITEM_STORAGE_T1}
|
|
5
5
|
|
|
6
|
-
export const ITEM_DRILL_SHAFT =
|
|
7
|
-
export const ITEM_EXTRACTION_PROBE =
|
|
8
|
-
export const ITEM_CARGO_ARM =
|
|
9
|
-
export const ITEM_TOOL_BIT =
|
|
10
|
-
export const ITEM_REACTION_CHAMBER =
|
|
6
|
+
export const ITEM_DRILL_SHAFT = 10005
|
|
7
|
+
export const ITEM_EXTRACTION_PROBE = 10006
|
|
8
|
+
export const ITEM_CARGO_ARM = 10007
|
|
9
|
+
export const ITEM_TOOL_BIT = 10008
|
|
10
|
+
export const ITEM_REACTION_CHAMBER = 10009
|
|
11
11
|
|
|
12
12
|
export const ITEM_HULL_PLATES = 10001
|
|
13
13
|
export const ITEM_CARGO_LINING = 10002
|
|
14
|
-
export const
|
|
15
|
-
export const ITEM_THRUSTER_CORE =
|
|
16
|
-
export const ITEM_POWER_CELL =
|
|
17
|
-
export const ITEM_SHIP_T1_PACKED =
|
|
14
|
+
export const ITEM_CONTAINER_T1_PACKED = 10200
|
|
15
|
+
export const ITEM_THRUSTER_CORE = 10003
|
|
16
|
+
export const ITEM_POWER_CELL = 10004
|
|
17
|
+
export const ITEM_SHIP_T1_PACKED = 10201
|
|
18
|
+
export const ITEM_WAREHOUSE_T1_PACKED = 10202
|
|
19
|
+
|
|
20
|
+
export const ITEM_HULL_PLATES_T2 = 20001
|
|
21
|
+
export const ITEM_CARGO_LINING_T2 = 20002
|
|
22
|
+
export const ITEM_CONTAINER_T2_PACKED = 20200
|
|
18
23
|
|
|
19
24
|
export interface RecipeInput {
|
|
20
25
|
category?: ResourceCategory
|
|
@@ -40,6 +45,7 @@ export interface ComponentDefinition {
|
|
|
40
45
|
|
|
41
46
|
export interface ModuleSlot {
|
|
42
47
|
type: number
|
|
48
|
+
label?: string
|
|
43
49
|
}
|
|
44
50
|
|
|
45
51
|
export interface EntityRecipe {
|
|
@@ -73,7 +79,7 @@ export const components: ComponentDefinition[] = [
|
|
|
73
79
|
{key: 'density', source: 'metal'},
|
|
74
80
|
],
|
|
75
81
|
recipe: [{category: 'metal', quantity: 15}],
|
|
76
|
-
usedIn: [{type: 'entity', name: 'Container'}, {type: 'entity', name: 'Ship T1'}],
|
|
82
|
+
usedIn: [{type: 'entity', name: 'Container'}, {type: 'entity', name: 'Warehouse T1'}, {type: 'entity', name: 'Ship T1'}],
|
|
77
83
|
},
|
|
78
84
|
{
|
|
79
85
|
id: ITEM_CARGO_LINING,
|
|
@@ -90,7 +96,7 @@ export const components: ComponentDefinition[] = [
|
|
|
90
96
|
{category: 'precious', quantity: 6},
|
|
91
97
|
{category: 'organic', quantity: 14},
|
|
92
98
|
],
|
|
93
|
-
usedIn: [{type: 'entity', name: 'Container'}, {type: 'entity', name: 'Ship T1'}],
|
|
99
|
+
usedIn: [{type: 'entity', name: 'Container'}, {type: 'entity', name: 'Warehouse T1'}, {type: 'entity', name: 'Ship T1'}],
|
|
94
100
|
},
|
|
95
101
|
{
|
|
96
102
|
id: ITEM_THRUSTER_CORE,
|
|
@@ -183,6 +189,39 @@ export const components: ComponentDefinition[] = [
|
|
|
183
189
|
recipe: [{category: 'gas' as ResourceCategory, quantity: 32}],
|
|
184
190
|
usedIn: [{type: 'module', name: 'Manufacturing'}],
|
|
185
191
|
},
|
|
192
|
+
{
|
|
193
|
+
id: ITEM_HULL_PLATES_T2,
|
|
194
|
+
name: 'Hull Plates T2',
|
|
195
|
+
description: 'Advanced structural plating reinforced with tier 2 metals.',
|
|
196
|
+
color: '#9BADB8',
|
|
197
|
+
mass: 50000,
|
|
198
|
+
stats: [
|
|
199
|
+
{key: 'strength', source: 'metal'},
|
|
200
|
+
{key: 'density', source: 'metal'},
|
|
201
|
+
],
|
|
202
|
+
recipe: [
|
|
203
|
+
{itemId: ITEM_HULL_PLATES, quantity: 2},
|
|
204
|
+
{category: 'metal', quantity: 15},
|
|
205
|
+
],
|
|
206
|
+
usedIn: [{type: 'entity', name: 'Container T2'}],
|
|
207
|
+
},
|
|
208
|
+
{
|
|
209
|
+
id: ITEM_CARGO_LINING_T2,
|
|
210
|
+
name: 'Cargo Lining T2',
|
|
211
|
+
description: 'Advanced composite lining with improved storage properties.',
|
|
212
|
+
color: '#E0B84D',
|
|
213
|
+
mass: 30000,
|
|
214
|
+
stats: [
|
|
215
|
+
{key: 'ductility', source: 'precious'},
|
|
216
|
+
{key: 'purity', source: 'organic'},
|
|
217
|
+
],
|
|
218
|
+
recipe: [
|
|
219
|
+
{itemId: ITEM_CARGO_LINING, quantity: 2},
|
|
220
|
+
{category: 'precious', quantity: 6},
|
|
221
|
+
{category: 'organic', quantity: 14},
|
|
222
|
+
],
|
|
223
|
+
usedIn: [{type: 'entity', name: 'Container T2'}],
|
|
224
|
+
},
|
|
186
225
|
]
|
|
187
226
|
|
|
188
227
|
export const entityRecipes: EntityRecipe[] = [
|
|
@@ -191,7 +230,7 @@ export const entityRecipes: EntityRecipe[] = [
|
|
|
191
230
|
name: 'Container',
|
|
192
231
|
description: 'Passive floating cargo storage in space. Towed by ships.',
|
|
193
232
|
color: '#7B8D9E',
|
|
194
|
-
packedItemId:
|
|
233
|
+
packedItemId: ITEM_CONTAINER_T1_PACKED,
|
|
195
234
|
recipe: [
|
|
196
235
|
{itemId: ITEM_HULL_PLATES, quantity: 6},
|
|
197
236
|
{itemId: ITEM_CARGO_LINING, quantity: 2},
|
|
@@ -227,6 +266,47 @@ export const entityRecipes: EntityRecipe[] = [
|
|
|
227
266
|
{type: MODULE_ANY},
|
|
228
267
|
],
|
|
229
268
|
},
|
|
269
|
+
{
|
|
270
|
+
id: 'warehouse-t1',
|
|
271
|
+
name: 'Warehouse T1',
|
|
272
|
+
description: 'Massive stationary storage facility with a single loader module slot.',
|
|
273
|
+
color: '#EAB308',
|
|
274
|
+
packedItemId: ITEM_WAREHOUSE_T1_PACKED,
|
|
275
|
+
recipe: [
|
|
276
|
+
{itemId: ITEM_HULL_PLATES, quantity: 20},
|
|
277
|
+
{itemId: ITEM_CARGO_LINING, quantity: 10},
|
|
278
|
+
],
|
|
279
|
+
stats: [
|
|
280
|
+
{key: 'strength', sourceComponentId: ITEM_HULL_PLATES, sourceStatKey: 'strength'},
|
|
281
|
+
{key: 'density', sourceComponentId: ITEM_HULL_PLATES, sourceStatKey: 'density'},
|
|
282
|
+
{key: 'ductility', sourceComponentId: ITEM_CARGO_LINING, sourceStatKey: 'ductility'},
|
|
283
|
+
{key: 'purity', sourceComponentId: ITEM_CARGO_LINING, sourceStatKey: 'purity'},
|
|
284
|
+
],
|
|
285
|
+
moduleSlots: [
|
|
286
|
+
{type: MODULE_LOADER, label: 'Loader'},
|
|
287
|
+
{type: MODULE_STORAGE, label: 'Storage'},
|
|
288
|
+
{type: MODULE_STORAGE, label: 'Storage'},
|
|
289
|
+
{type: MODULE_STORAGE, label: 'Storage'},
|
|
290
|
+
{type: MODULE_STORAGE, label: 'Storage'},
|
|
291
|
+
],
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
id: 'container-t2',
|
|
295
|
+
name: 'Container T2',
|
|
296
|
+
description: 'Advanced cargo container with improved capacity formulas.',
|
|
297
|
+
color: '#9BADB8',
|
|
298
|
+
packedItemId: ITEM_CONTAINER_T2_PACKED,
|
|
299
|
+
recipe: [
|
|
300
|
+
{itemId: ITEM_HULL_PLATES_T2, quantity: 6},
|
|
301
|
+
{itemId: ITEM_CARGO_LINING_T2, quantity: 2},
|
|
302
|
+
],
|
|
303
|
+
stats: [
|
|
304
|
+
{key: 'strength', sourceComponentId: ITEM_HULL_PLATES_T2, sourceStatKey: 'strength'},
|
|
305
|
+
{key: 'density', sourceComponentId: ITEM_HULL_PLATES_T2, sourceStatKey: 'density'},
|
|
306
|
+
{key: 'ductility', sourceComponentId: ITEM_CARGO_LINING_T2, sourceStatKey: 'ductility'},
|
|
307
|
+
{key: 'purity', sourceComponentId: ITEM_CARGO_LINING_T2, sourceStatKey: 'purity'},
|
|
308
|
+
],
|
|
309
|
+
},
|
|
230
310
|
]
|
|
231
311
|
|
|
232
312
|
export interface ModuleRecipe {
|
|
@@ -318,6 +398,24 @@ export const moduleRecipes: ModuleRecipe[] = [
|
|
|
318
398
|
{key: 'clarity', sourceComponentId: ITEM_TOOL_BIT, sourceStatKey: 'clarity'},
|
|
319
399
|
],
|
|
320
400
|
},
|
|
401
|
+
{
|
|
402
|
+
id: 'storage-t1',
|
|
403
|
+
name: 'Storage',
|
|
404
|
+
description: 'Expands cargo capacity based on hull material quality',
|
|
405
|
+
color: '#8B7355',
|
|
406
|
+
itemId: ITEM_STORAGE_T1,
|
|
407
|
+
moduleType: MODULE_STORAGE,
|
|
408
|
+
recipe: [
|
|
409
|
+
{itemId: ITEM_HULL_PLATES, quantity: 8},
|
|
410
|
+
{itemId: ITEM_CARGO_LINING, quantity: 4},
|
|
411
|
+
],
|
|
412
|
+
stats: [
|
|
413
|
+
{key: 'strength', sourceComponentId: ITEM_HULL_PLATES, sourceStatKey: 'strength'},
|
|
414
|
+
{key: 'ductility', sourceComponentId: ITEM_HULL_PLATES, sourceStatKey: 'ductility'},
|
|
415
|
+
{key: 'purity', sourceComponentId: ITEM_CARGO_LINING, sourceStatKey: 'purity'},
|
|
416
|
+
{key: 'density', sourceComponentId: ITEM_CARGO_LINING, sourceStatKey: 'density'},
|
|
417
|
+
],
|
|
418
|
+
},
|
|
321
419
|
]
|
|
322
420
|
|
|
323
421
|
export function getModuleRecipe(id: string): ModuleRecipe | undefined {
|
|
@@ -340,6 +438,11 @@ export function getEntityRecipeByItemId(itemId: number): EntityRecipe | undefine
|
|
|
340
438
|
return entityRecipes.find((r) => r.packedItemId === itemId)
|
|
341
439
|
}
|
|
342
440
|
|
|
441
|
+
export function getEntitySlotLayout(packedItemId: number): ModuleSlot[] {
|
|
442
|
+
const recipe = getEntityRecipeByItemId(packedItemId)
|
|
443
|
+
return recipe?.moduleSlots ?? []
|
|
444
|
+
}
|
|
445
|
+
|
|
343
446
|
export function getAllCraftableItems(): CraftableItem[] {
|
|
344
447
|
const items: CraftableItem[] = []
|
|
345
448
|
for (const comp of components) {
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
export type CraftedItemCategory = 'component' | 'module' | 'entity' | 'resource'
|
|
2
|
+
|
|
3
|
+
export const ITEM_TYPE_RESOURCE = 0
|
|
4
|
+
export const ITEM_TYPE_COMPONENT = 1
|
|
5
|
+
export const ITEM_TYPE_MODULE = 2
|
|
6
|
+
export const ITEM_TYPE_ENTITY = 3
|
|
7
|
+
|
|
8
|
+
export function itemTypeCode(id: number): number {
|
|
9
|
+
switch (itemCategory(id)) {
|
|
10
|
+
case 'resource': return ITEM_TYPE_RESOURCE
|
|
11
|
+
case 'component': return ITEM_TYPE_COMPONENT
|
|
12
|
+
case 'module': return ITEM_TYPE_MODULE
|
|
13
|
+
case 'entity': return ITEM_TYPE_ENTITY
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function itemTier(id: number): number {
|
|
18
|
+
if (id < 10000) return 0
|
|
19
|
+
return Math.floor(id / 10000)
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function itemOffset(id: number): number {
|
|
23
|
+
return id % 10000
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function itemCategory(id: number): CraftedItemCategory {
|
|
27
|
+
if (id < 10000) return 'resource'
|
|
28
|
+
const offset = itemOffset(id)
|
|
29
|
+
if (offset >= 200) return 'entity'
|
|
30
|
+
if (offset >= 100) return 'module'
|
|
31
|
+
return 'component'
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function isRelatedItem(a: number, b: number): boolean {
|
|
35
|
+
if (a < 10000 || b < 10000) return false
|
|
36
|
+
return itemOffset(a) === itemOffset(b)
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function isCraftedItem(id: number): boolean {
|
|
40
|
+
return id >= 10000
|
|
41
|
+
}
|
|
@@ -27,10 +27,14 @@ export function encodeStats(values: number[]): bigint {
|
|
|
27
27
|
return seed
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
export function decodeStat(seed: bigint, index: number): number {
|
|
31
|
+
return Number((seed >> BigInt(index * 10)) & 0x3ffn)
|
|
32
|
+
}
|
|
33
|
+
|
|
30
34
|
export function decodeStats(seed: bigint, count: number): number[] {
|
|
31
35
|
const stats: number[] = []
|
|
32
36
|
for (let i = 0; i < count; i++) {
|
|
33
|
-
stats.push(
|
|
37
|
+
stats.push(decodeStat(seed, i))
|
|
34
38
|
}
|
|
35
39
|
return stats
|
|
36
40
|
}
|
|
@@ -128,6 +132,59 @@ function decodeStackStats(itemId: number, seed: UInt64): Record<string, number>
|
|
|
128
132
|
return {stat1: raw.stat1, stat2: raw.stat2, stat3: raw.stat3}
|
|
129
133
|
}
|
|
130
134
|
|
|
135
|
+
export const categoryItemMass: Record<string, number> = {
|
|
136
|
+
metal: 30000,
|
|
137
|
+
precious: 40000,
|
|
138
|
+
gas: 15000,
|
|
139
|
+
mineral: 22000,
|
|
140
|
+
organic: 15000,
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
export function computeInputMass(
|
|
144
|
+
itemId: string | number,
|
|
145
|
+
itemType: 'component' | 'module' | 'entity'
|
|
146
|
+
): number {
|
|
147
|
+
if (itemType === 'component') {
|
|
148
|
+
const comp = getComponentById(itemId as number)
|
|
149
|
+
if (!comp) return 0
|
|
150
|
+
return comp.recipe.reduce((sum, input) => {
|
|
151
|
+
const mass = input.category ? (categoryItemMass[input.category] ?? 0) : 0
|
|
152
|
+
return sum + mass * input.quantity
|
|
153
|
+
}, 0)
|
|
154
|
+
}
|
|
155
|
+
if (itemType === 'module') {
|
|
156
|
+
const mod = getModuleRecipe(itemId as string)
|
|
157
|
+
if (!mod) return 0
|
|
158
|
+
return mod.recipe.reduce((sum, input) => {
|
|
159
|
+
const comp = input.itemId ? getComponentById(input.itemId) : undefined
|
|
160
|
+
return sum + (comp?.mass ?? 0) * input.quantity
|
|
161
|
+
}, 0)
|
|
162
|
+
}
|
|
163
|
+
if (itemType === 'entity') {
|
|
164
|
+
const ent = getEntityRecipe(itemId as string)
|
|
165
|
+
if (!ent) return 0
|
|
166
|
+
return ent.recipe.reduce((sum, input) => {
|
|
167
|
+
const comp = input.itemId ? getComponentById(input.itemId) : undefined
|
|
168
|
+
return sum + (comp?.mass ?? 0) * input.quantity
|
|
169
|
+
}, 0)
|
|
170
|
+
}
|
|
171
|
+
return 0
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export function blendCrossGroup(
|
|
175
|
+
sources: {value: number; weight: number}[]
|
|
176
|
+
): number {
|
|
177
|
+
let weightedSum = 0
|
|
178
|
+
let totalWeight = 0
|
|
179
|
+
for (const src of sources) {
|
|
180
|
+
weightedSum += src.value * src.weight
|
|
181
|
+
totalWeight += src.weight
|
|
182
|
+
}
|
|
183
|
+
if (totalWeight === 0) return 1
|
|
184
|
+
const result = Math.floor(weightedSum / totalWeight)
|
|
185
|
+
return Math.max(1, Math.min(999, result))
|
|
186
|
+
}
|
|
187
|
+
|
|
131
188
|
export function blendCargoStacks(
|
|
132
189
|
itemId: number,
|
|
133
190
|
stacks: {quantity: number; seed: UInt64}[]
|
|
@@ -86,3 +86,21 @@ export function computeContainerCapabilities(stats: Record<string, number>): {
|
|
|
86
86
|
|
|
87
87
|
return {hullmass, capacity}
|
|
88
88
|
}
|
|
89
|
+
|
|
90
|
+
export function computeContainerT2Capabilities(stats: Record<string, number>): {
|
|
91
|
+
hullmass: number
|
|
92
|
+
capacity: number
|
|
93
|
+
} {
|
|
94
|
+
const strength = stats['strength'] ?? 0
|
|
95
|
+
const density = stats['density'] ?? 0
|
|
96
|
+
const ductility = stats['ductility'] ?? 0
|
|
97
|
+
const purity = stats['purity'] ?? 0
|
|
98
|
+
|
|
99
|
+
const hullmass = 20000 + 50 * density
|
|
100
|
+
|
|
101
|
+
const statSum = strength + ductility + purity
|
|
102
|
+
const exponent = statSum / 2500
|
|
103
|
+
const capacity = Math.floor(1500000 * Math.pow(10, exponent))
|
|
104
|
+
|
|
105
|
+
return {hullmass, capacity}
|
|
106
|
+
}
|
package/src/entities/makers.ts
CHANGED
|
@@ -30,7 +30,7 @@ export function makeShip(state: ShipStateInput): Ship {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
export function makeWarehouse(state: WarehouseStateInput): Warehouse {
|
|
33
|
-
const
|
|
33
|
+
const info: Record<string, unknown> = {
|
|
34
34
|
type: Name.from('warehouse'),
|
|
35
35
|
id: UInt64.from(state.id),
|
|
36
36
|
owner: Name.from(state.owner),
|
|
@@ -39,13 +39,15 @@ export function makeWarehouse(state: WarehouseStateInput): Warehouse {
|
|
|
39
39
|
capacity: UInt32.from(state.capacity),
|
|
40
40
|
cargomass: UInt32.from(0),
|
|
41
41
|
cargo: state.cargo || [],
|
|
42
|
-
loaders: state.loaders,
|
|
43
42
|
is_idle: !state.schedule,
|
|
44
43
|
current_task_elapsed: UInt32.from(0),
|
|
45
44
|
current_task_remaining: UInt32.from(0),
|
|
46
45
|
pending_tasks: [],
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
}
|
|
47
|
+
if (state.hullmass !== undefined) info.hullmass = UInt32.from(state.hullmass)
|
|
48
|
+
if (state.loaders) info.loaders = state.loaders
|
|
49
|
+
if (state.schedule) info.schedule = state.schedule
|
|
50
|
+
const entityInfo = ServerContract.Types.entity_info.from(info)
|
|
49
51
|
return new Warehouse(entityInfo)
|
|
50
52
|
}
|
|
51
53
|
|
|
@@ -24,7 +24,7 @@ export function computeEngineCapabilities(stats: Record<string, number>): {
|
|
|
24
24
|
|
|
25
25
|
return {
|
|
26
26
|
thrust: 400 + Math.floor(vol * 3 / 4),
|
|
27
|
-
drain: Math.max(
|
|
27
|
+
drain: Math.max(30, 50 - Math.floor(thm / 70)),
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -87,3 +87,36 @@ export function computeManufacturingCapabilities(stats: Record<string, number>):
|
|
|
87
87
|
drain: Math.max(5, 30 - Math.floor(clr / 33)),
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
+
|
|
91
|
+
export function computeStorageCapabilities(
|
|
92
|
+
stats: Record<string, number>,
|
|
93
|
+
baseCapacity: number
|
|
94
|
+
): {
|
|
95
|
+
capacityBonus: number
|
|
96
|
+
} {
|
|
97
|
+
const strength = stats.strength ?? 500
|
|
98
|
+
const ductility = stats.ductility ?? 500
|
|
99
|
+
const purity = stats.purity ?? 500
|
|
100
|
+
|
|
101
|
+
const statSum = strength + ductility + purity
|
|
102
|
+
const capacityBonus = Math.floor(baseCapacity * (10 + Math.floor(statSum * 10 / 2997)) / 100)
|
|
103
|
+
|
|
104
|
+
return {capacityBonus}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export function computeWarehouseHullCapabilities(stats: Record<string, number>): {
|
|
108
|
+
hullmass: number
|
|
109
|
+
capacity: number
|
|
110
|
+
} {
|
|
111
|
+
const density = stats.density ?? 500
|
|
112
|
+
const strength = stats.strength ?? 500
|
|
113
|
+
const ductility = stats.ductility ?? 500
|
|
114
|
+
const purity = stats.purity ?? 500
|
|
115
|
+
|
|
116
|
+
const hullmass = 25000 + 75 * density
|
|
117
|
+
const statSum = strength + ductility + purity
|
|
118
|
+
const exponent = statSum / 2997.0
|
|
119
|
+
const capacity = Math.floor(20000000 * Math.pow(10, exponent))
|
|
120
|
+
|
|
121
|
+
return {hullmass, capacity}
|
|
122
|
+
}
|
|
@@ -12,8 +12,9 @@ export interface WarehouseStateInput {
|
|
|
12
12
|
owner: string
|
|
13
13
|
name: string
|
|
14
14
|
coordinates: CoordinatesType | {x: number; y: number; z?: number}
|
|
15
|
+
hullmass?: number
|
|
15
16
|
capacity: number
|
|
16
|
-
loaders
|
|
17
|
+
loaders?: ServerContract.Types.loader_stats
|
|
17
18
|
schedule?: ServerContract.Types.schedule
|
|
18
19
|
cargo?: ServerContract.Types.cargo_item[]
|
|
19
20
|
}
|
|
@@ -82,4 +83,9 @@ export class Warehouse extends ServerContract.Types.entity_info {
|
|
|
82
83
|
get orbitalAltitude(): number {
|
|
83
84
|
return this.coordinates.z?.toNumber() || 0
|
|
84
85
|
}
|
|
86
|
+
|
|
87
|
+
get totalMass(): UInt64 {
|
|
88
|
+
const hull = this.hullmass ? UInt64.from(this.hullmass) : UInt64.from(0)
|
|
89
|
+
return hull.adding(this.totalCargoMass)
|
|
90
|
+
}
|
|
85
91
|
}
|
package/src/index-module.ts
CHANGED
|
@@ -143,6 +143,27 @@ export * from './capabilities'
|
|
|
143
143
|
|
|
144
144
|
export {categoryColors, tierColors, categoryIcons, componentIcon, moduleIcon, itemIcons} from './data/colors'
|
|
145
145
|
|
|
146
|
+
export {itemTier, itemOffset, itemCategory, isRelatedItem, isCraftedItem} from './data/tiers'
|
|
147
|
+
export type {CraftedItemCategory} from './data/tiers'
|
|
148
|
+
|
|
149
|
+
export {getCategoryInfo} from './data/categories'
|
|
150
|
+
export type {CategoryInfo} from './data/categories'
|
|
151
|
+
|
|
152
|
+
export {getPlanetSubtypes, getPlanetSubtype} from './data/locations'
|
|
153
|
+
export type {PlanetSubtypeInfo} from './data/locations'
|
|
154
|
+
|
|
155
|
+
export {
|
|
156
|
+
capabilityNames,
|
|
157
|
+
capabilityAttributes,
|
|
158
|
+
statMappings,
|
|
159
|
+
isInvertedAttribute,
|
|
160
|
+
getCapabilityAttributes,
|
|
161
|
+
getStatMappings,
|
|
162
|
+
getStatMappingsForStat,
|
|
163
|
+
getStatMappingsForCapability,
|
|
164
|
+
} from './data/capabilities'
|
|
165
|
+
export type {CapabilityAttribute, StatMapping} from './data/capabilities'
|
|
166
|
+
|
|
146
167
|
export {
|
|
147
168
|
components,
|
|
148
169
|
entityRecipes,
|
|
@@ -157,12 +178,13 @@ export {
|
|
|
157
178
|
getComponentsForStat,
|
|
158
179
|
ITEM_HULL_PLATES,
|
|
159
180
|
ITEM_CARGO_LINING,
|
|
160
|
-
|
|
181
|
+
ITEM_CONTAINER_T1_PACKED,
|
|
161
182
|
ITEM_THRUSTER_CORE,
|
|
162
183
|
ITEM_POWER_CELL,
|
|
163
184
|
ITEM_ENGINE_T1,
|
|
164
185
|
ITEM_GENERATOR_T1,
|
|
165
186
|
ITEM_SHIP_T1_PACKED,
|
|
187
|
+
ITEM_WAREHOUSE_T1_PACKED,
|
|
166
188
|
ITEM_DRILL_SHAFT,
|
|
167
189
|
ITEM_EXTRACTION_PROBE,
|
|
168
190
|
ITEM_CARGO_ARM,
|
|
@@ -171,6 +193,10 @@ export {
|
|
|
171
193
|
ITEM_EXTRACTOR_T1,
|
|
172
194
|
ITEM_LOADER_T1,
|
|
173
195
|
ITEM_MANUFACTURING_T1,
|
|
196
|
+
ITEM_STORAGE_T1,
|
|
197
|
+
ITEM_HULL_PLATES_T2,
|
|
198
|
+
ITEM_CARGO_LINING_T2,
|
|
199
|
+
ITEM_CONTAINER_T2_PACKED,
|
|
174
200
|
} from './data/recipes'
|
|
175
201
|
export type {
|
|
176
202
|
ComponentDefinition,
|
|
@@ -184,6 +210,7 @@ export type {
|
|
|
184
210
|
|
|
185
211
|
export {
|
|
186
212
|
encodeStats,
|
|
213
|
+
decodeStat,
|
|
187
214
|
decodeStats,
|
|
188
215
|
decodeCraftedItemStats,
|
|
189
216
|
blendStacks,
|
|
@@ -191,10 +218,13 @@ export {
|
|
|
191
218
|
blendComponentStacks,
|
|
192
219
|
computeEntityStats,
|
|
193
220
|
blendCargoStacks,
|
|
221
|
+
blendCrossGroup,
|
|
222
|
+
categoryItemMass,
|
|
223
|
+
computeInputMass,
|
|
194
224
|
} from './derivation/crafting'
|
|
195
225
|
export type {StackInput, CategoryStacks} from './derivation/crafting'
|
|
196
226
|
|
|
197
|
-
export {computeContainerCapabilities} from './entities/container'
|
|
227
|
+
export {computeContainerCapabilities, computeContainerT2Capabilities} from './entities/container'
|
|
198
228
|
|
|
199
229
|
export {
|
|
200
230
|
computeShipHullCapabilities,
|
|
@@ -203,7 +233,45 @@ export {
|
|
|
203
233
|
computeExtractorCapabilities,
|
|
204
234
|
computeLoaderCapabilities,
|
|
205
235
|
computeManufacturingCapabilities,
|
|
236
|
+
computeWarehouseHullCapabilities,
|
|
237
|
+
computeStorageCapabilities,
|
|
206
238
|
} from './entities/ship-deploy'
|
|
207
239
|
|
|
208
240
|
export {resolveItem} from './resolution/resolve-item'
|
|
209
241
|
export type {ResolvedItem, ResolvedItemStat, ResolvedAttributeGroup, ResolvedModuleSlot, ResolvedItemType} from './resolution/resolve-item'
|
|
242
|
+
|
|
243
|
+
export * as NFT from './nft'
|
|
244
|
+
export {
|
|
245
|
+
deserializeAsset,
|
|
246
|
+
deserializeResource,
|
|
247
|
+
deserializeComponent,
|
|
248
|
+
deserializeModule,
|
|
249
|
+
deserializeEntity,
|
|
250
|
+
readCommonBase,
|
|
251
|
+
} from './nft/deserializers'
|
|
252
|
+
export type {NFTCargoItem, NFTModuleSlot, NFTInstalledModule, NFTCommonBase} from './nft/deserializers'
|
|
253
|
+
|
|
254
|
+
export {
|
|
255
|
+
buildEntityDescription,
|
|
256
|
+
formatModuleLine,
|
|
257
|
+
entityDisplayName,
|
|
258
|
+
moduleDisplayName,
|
|
259
|
+
computeBaseHullmass,
|
|
260
|
+
computeBaseCapacityShip,
|
|
261
|
+
computeBaseCapacityWarehouse,
|
|
262
|
+
computeEngineThrust,
|
|
263
|
+
computeEngineDrain,
|
|
264
|
+
computeGeneratorCap,
|
|
265
|
+
computeGeneratorRech,
|
|
266
|
+
computeExtractorRate,
|
|
267
|
+
computeExtractorDrain,
|
|
268
|
+
computeExtractorDepth,
|
|
269
|
+
computeExtractorDrill,
|
|
270
|
+
computeLoaderMass,
|
|
271
|
+
computeLoaderThrust,
|
|
272
|
+
computeCrafterSpeed,
|
|
273
|
+
computeCrafterDrain,
|
|
274
|
+
} from './nft/description'
|
|
275
|
+
|
|
276
|
+
export {getEntitySlotLayout} from './data/recipes'
|
|
277
|
+
export {ITEM_TYPE_RESOURCE, ITEM_TYPE_COMPONENT, ITEM_TYPE_MODULE, ITEM_TYPE_ENTITY, itemTypeCode} from './data/tiers'
|