@shipload/sdk 1.0.0-next.0 → 1.0.0-next.10
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 +512 -320
- package/lib/shipload.js +1960 -1060
- package/lib/shipload.js.map +1 -1
- package/lib/shipload.m.js +1920 -1056
- package/lib/shipload.m.js.map +1 -1
- package/package.json +8 -3
- package/src/capabilities/modules.ts +3 -0
- package/src/capabilities/storage.ts +1 -1
- package/src/contracts/platform.ts +13 -1
- package/src/contracts/server.ts +227 -282
- package/src/data/capabilities.ts +5 -330
- package/src/data/capability-formulas.ts +70 -0
- package/src/data/catalog.ts +0 -5
- package/src/data/colors.ts +2 -16
- package/src/data/entities.json +33 -10
- package/src/data/item-ids.ts +3 -1
- package/src/data/items.json +258 -0
- package/src/data/metadata.ts +57 -1
- package/src/data/recipes-runtime.ts +1 -0
- package/src/data/recipes.json +82 -11
- package/src/derivation/capability-mappings.ts +122 -0
- package/src/derivation/index.ts +1 -0
- package/src/derivation/resources.ts +116 -37
- package/src/derivation/stats.ts +1 -2
- package/src/entities/container.ts +25 -10
- package/src/entities/extractor.ts +144 -0
- package/src/entities/gamestate.ts +0 -9
- package/src/entities/makers.ts +71 -20
- package/src/entities/ship-deploy.ts +114 -56
- package/src/entities/ship.ts +17 -0
- package/src/entities/slot-multiplier.ts +21 -0
- package/src/entities/warehouse.ts +20 -3
- package/src/index-module.ts +67 -26
- package/src/managers/actions.ts +53 -80
- package/src/managers/entities.ts +31 -17
- package/src/managers/locations.ts +2 -20
- package/src/nft/atomicdata.ts +125 -0
- package/src/nft/description.ts +41 -7
- package/src/nft/index.ts +1 -0
- package/src/resolution/resolve-item.ts +17 -9
- package/src/scheduling/accessor.ts +4 -0
- package/src/scheduling/projection.ts +8 -0
- package/src/scheduling/schedule.ts +15 -1
- package/src/scheduling/task-cargo.ts +47 -0
- package/src/subscriptions/connection.ts +50 -2
- package/src/subscriptions/manager.ts +81 -2
- package/src/travel/travel.ts +61 -2
- package/src/types/entity-traits.ts +64 -1
- package/src/types.ts +11 -1
- package/src/utils/cargo.ts +27 -0
- package/src/utils/system.ts +25 -24
|
@@ -8,17 +8,22 @@ import {
|
|
|
8
8
|
MODULE_HAULER,
|
|
9
9
|
MODULE_LOADER,
|
|
10
10
|
} from '../capabilities/modules'
|
|
11
|
+
import {getItem} from '../data/catalog'
|
|
12
|
+
import type {EntitySlot} from '../data/recipes-runtime'
|
|
13
|
+
import {applySlotMultiplier, clampUint16, getSlotAmp, type InstalledModule} from './slot-multiplier'
|
|
14
|
+
|
|
15
|
+
export type {InstalledModule}
|
|
11
16
|
|
|
12
17
|
export function computeShipHullCapabilities(stats: Record<string, number>): {
|
|
13
18
|
hullmass: number
|
|
14
19
|
capacity: number
|
|
15
20
|
} {
|
|
16
|
-
const density = stats.density
|
|
17
|
-
const strength = stats.strength
|
|
18
|
-
const hardness = stats.hardness
|
|
19
|
-
const saturation = stats.saturation
|
|
21
|
+
const density = stats.density
|
|
22
|
+
const strength = stats.strength
|
|
23
|
+
const hardness = stats.hardness
|
|
24
|
+
const saturation = stats.saturation
|
|
20
25
|
|
|
21
|
-
const hullmass =
|
|
26
|
+
const hullmass = 100000 - 75 * density
|
|
22
27
|
const statSum = strength + hardness + saturation
|
|
23
28
|
const exponent = statSum / 2997.0
|
|
24
29
|
const capacity = Math.floor(1000000 * 10 ** exponent)
|
|
@@ -30,8 +35,8 @@ export function computeEngineCapabilities(stats: Record<string, number>): {
|
|
|
30
35
|
thrust: number
|
|
31
36
|
drain: number
|
|
32
37
|
} {
|
|
33
|
-
const vol = stats.volatility
|
|
34
|
-
const thm = stats.thermal
|
|
38
|
+
const vol = stats.volatility
|
|
39
|
+
const thm = stats.thermal
|
|
35
40
|
|
|
36
41
|
return {
|
|
37
42
|
thrust: 400 + Math.floor((vol * 3) / 4),
|
|
@@ -43,30 +48,61 @@ export function computeGeneratorCapabilities(stats: Record<string, number>): {
|
|
|
43
48
|
capacity: number
|
|
44
49
|
recharge: number
|
|
45
50
|
} {
|
|
46
|
-
const
|
|
47
|
-
const
|
|
51
|
+
const com = stats.composition
|
|
52
|
+
const fin = stats.fineness
|
|
48
53
|
|
|
49
54
|
return {
|
|
50
|
-
capacity: 300 + Math.floor(
|
|
51
|
-
recharge: 1 + Math.floor((
|
|
55
|
+
capacity: 300 + Math.floor(com / 6),
|
|
56
|
+
recharge: 1 + Math.floor((fin * 3) / 1000),
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface GathererDepthParams {
|
|
61
|
+
readonly floor: number
|
|
62
|
+
readonly slope: number
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export const GATHERER_DEPTH_TABLE: readonly GathererDepthParams[] = [
|
|
66
|
+
{floor: 500, slope: 5},
|
|
67
|
+
{floor: 2000, slope: 11},
|
|
68
|
+
{floor: 7000, slope: 16},
|
|
69
|
+
{floor: 15000, slope: 18},
|
|
70
|
+
{floor: 25000, slope: 19},
|
|
71
|
+
{floor: 35000, slope: 16},
|
|
72
|
+
{floor: 46000, slope: 12},
|
|
73
|
+
{floor: 53500, slope: 10},
|
|
74
|
+
{floor: 60000, slope: 5},
|
|
75
|
+
{floor: 63500, slope: 2},
|
|
76
|
+
]
|
|
77
|
+
|
|
78
|
+
export const GATHERER_DEPTH_MAX_TIER = 10
|
|
79
|
+
|
|
80
|
+
export function gathererDepthForTier(tol: number, tier: number): number {
|
|
81
|
+
if (tier < 1 || tier > GATHERER_DEPTH_MAX_TIER) {
|
|
82
|
+
throw new Error(`gatherer tier out of range: ${tier}`)
|
|
52
83
|
}
|
|
84
|
+
const p = GATHERER_DEPTH_TABLE[tier - 1]
|
|
85
|
+
return p.floor + tol * p.slope
|
|
53
86
|
}
|
|
54
87
|
|
|
55
|
-
export function computeGathererCapabilities(
|
|
88
|
+
export function computeGathererCapabilities(
|
|
89
|
+
stats: Record<string, number>,
|
|
90
|
+
tier: number
|
|
91
|
+
): {
|
|
56
92
|
yield: number
|
|
57
93
|
drain: number
|
|
58
94
|
depth: number
|
|
59
95
|
speed: number
|
|
60
96
|
} {
|
|
61
|
-
const str = stats.strength
|
|
62
|
-
const con = stats.conductivity
|
|
63
|
-
const ref = stats.reflectivity
|
|
64
|
-
const tol = stats.tolerance
|
|
97
|
+
const str = stats.strength
|
|
98
|
+
const con = stats.conductivity
|
|
99
|
+
const ref = stats.reflectivity
|
|
100
|
+
const tol = stats.tolerance
|
|
65
101
|
|
|
66
102
|
return {
|
|
67
103
|
yield: 200 + str,
|
|
68
104
|
drain: Math.max(250, 1250 - Math.floor((con * 25) / 20)),
|
|
69
|
-
depth:
|
|
105
|
+
depth: gathererDepthForTier(tol, tier),
|
|
70
106
|
speed: 100 + Math.floor((ref * 4) / 5),
|
|
71
107
|
}
|
|
72
108
|
}
|
|
@@ -76,12 +112,12 @@ export function computeLoaderCapabilities(stats: Record<string, number>): {
|
|
|
76
112
|
thrust: number
|
|
77
113
|
quantity: number
|
|
78
114
|
} {
|
|
79
|
-
const
|
|
80
|
-
const
|
|
115
|
+
const insulation = stats.insulation
|
|
116
|
+
const plasticity = stats.plasticity
|
|
81
117
|
|
|
82
118
|
return {
|
|
83
|
-
mass: Math.max(200, 2000 - Math.floor(
|
|
84
|
-
thrust: 1 + Math.floor(
|
|
119
|
+
mass: Math.max(200, 2000 - Math.floor(insulation * 2)),
|
|
120
|
+
thrust: 1 + Math.floor(plasticity / 500),
|
|
85
121
|
quantity: 1,
|
|
86
122
|
}
|
|
87
123
|
}
|
|
@@ -90,12 +126,12 @@ export function computeCrafterCapabilities(stats: Record<string, number>): {
|
|
|
90
126
|
speed: number
|
|
91
127
|
drain: number
|
|
92
128
|
} {
|
|
93
|
-
const rea = stats.reactivity
|
|
94
|
-
const
|
|
129
|
+
const rea = stats.reactivity
|
|
130
|
+
const fin = stats.fineness
|
|
95
131
|
|
|
96
132
|
return {
|
|
97
133
|
speed: 100 + Math.floor((rea * 4) / 5),
|
|
98
|
-
drain: Math.max(5, 30 - Math.floor(
|
|
134
|
+
drain: Math.max(5, 30 - Math.floor(fin / 33)),
|
|
99
135
|
}
|
|
100
136
|
}
|
|
101
137
|
|
|
@@ -104,14 +140,14 @@ export function computeHaulerCapabilities(stats: Record<string, number>): {
|
|
|
104
140
|
efficiency: number
|
|
105
141
|
drain: number
|
|
106
142
|
} {
|
|
107
|
-
const
|
|
108
|
-
const
|
|
109
|
-
const
|
|
143
|
+
const fineness = stats.fineness
|
|
144
|
+
const conductivity = stats.conductivity
|
|
145
|
+
const composition = stats.composition
|
|
110
146
|
|
|
111
147
|
return {
|
|
112
|
-
capacity: Math.max(1, 1 + Math.floor(
|
|
113
|
-
efficiency: 2000 +
|
|
114
|
-
drain: Math.max(3, 15 - Math.floor(
|
|
148
|
+
capacity: Math.max(1, 1 + Math.floor(fineness / 400)),
|
|
149
|
+
efficiency: 2000 + conductivity * 6,
|
|
150
|
+
drain: Math.max(3, 15 - Math.floor(composition / 80)),
|
|
115
151
|
}
|
|
116
152
|
}
|
|
117
153
|
|
|
@@ -121,11 +157,12 @@ export function computeStorageCapabilities(
|
|
|
121
157
|
): {
|
|
122
158
|
capacityBonus: number
|
|
123
159
|
} {
|
|
124
|
-
const strength = stats.strength
|
|
125
|
-
const
|
|
126
|
-
const
|
|
160
|
+
const strength = stats.strength
|
|
161
|
+
const density = stats.density
|
|
162
|
+
const hardness = stats.hardness
|
|
163
|
+
const saturation = stats.saturation
|
|
127
164
|
|
|
128
|
-
const statSum = strength + hardness + saturation
|
|
165
|
+
const statSum = strength + density + hardness + saturation
|
|
129
166
|
const capacityBonus = Math.floor(
|
|
130
167
|
(baseCapacity * (10 + Math.floor((statSum * 10) / 2997))) / 100
|
|
131
168
|
)
|
|
@@ -137,12 +174,12 @@ export function computeWarehouseHullCapabilities(stats: Record<string, number>):
|
|
|
137
174
|
hullmass: number
|
|
138
175
|
capacity: number
|
|
139
176
|
} {
|
|
140
|
-
const density = stats.density
|
|
141
|
-
const strength = stats.strength
|
|
142
|
-
const hardness = stats.hardness
|
|
143
|
-
const saturation = stats.saturation
|
|
177
|
+
const density = stats.density
|
|
178
|
+
const strength = stats.strength
|
|
179
|
+
const hardness = stats.hardness
|
|
180
|
+
const saturation = stats.saturation
|
|
144
181
|
|
|
145
|
-
const hullmass =
|
|
182
|
+
const hullmass = 100000 - 75 * density
|
|
146
183
|
const statSum = strength + hardness + saturation
|
|
147
184
|
const exponent = statSum / 2997.0
|
|
148
185
|
const capacity = Math.floor(20000000 * 10 ** exponent)
|
|
@@ -160,7 +197,8 @@ export interface ShipCapabilities {
|
|
|
160
197
|
}
|
|
161
198
|
|
|
162
199
|
export function computeShipCapabilities(
|
|
163
|
-
modules:
|
|
200
|
+
modules: InstalledModule[],
|
|
201
|
+
layout: EntitySlot[]
|
|
164
202
|
): ShipCapabilities {
|
|
165
203
|
const ship: ShipCapabilities = {}
|
|
166
204
|
|
|
@@ -170,7 +208,7 @@ export function computeShipCapabilities(
|
|
|
170
208
|
let totalDrain = 0
|
|
171
209
|
for (const m of engineModules) {
|
|
172
210
|
const caps = computeEngineCapabilities(decodeCraftedItemStats(m.itemId, m.stats))
|
|
173
|
-
totalThrust += caps.thrust
|
|
211
|
+
totalThrust += applySlotMultiplier(caps.thrust, getSlotAmp(layout, m.slotIndex))
|
|
174
212
|
totalDrain += caps.drain
|
|
175
213
|
}
|
|
176
214
|
ship.engines = {thrust: totalThrust, drain: totalDrain}
|
|
@@ -184,10 +222,14 @@ export function computeShipCapabilities(
|
|
|
184
222
|
let totalRecharge = 0
|
|
185
223
|
for (const m of generatorModules) {
|
|
186
224
|
const caps = computeGeneratorCapabilities(decodeCraftedItemStats(m.itemId, m.stats))
|
|
187
|
-
|
|
188
|
-
|
|
225
|
+
const amp = getSlotAmp(layout, m.slotIndex)
|
|
226
|
+
totalCapacity += applySlotMultiplier(caps.capacity, amp)
|
|
227
|
+
totalRecharge += applySlotMultiplier(caps.recharge, amp)
|
|
228
|
+
}
|
|
229
|
+
ship.generator = {
|
|
230
|
+
capacity: clampUint16(totalCapacity),
|
|
231
|
+
recharge: clampUint16(totalRecharge),
|
|
189
232
|
}
|
|
190
|
-
ship.generator = {capacity: totalCapacity, recharge: totalRecharge}
|
|
191
233
|
}
|
|
192
234
|
|
|
193
235
|
const gathererModules = modules.filter(
|
|
@@ -196,16 +238,26 @@ export function computeShipCapabilities(
|
|
|
196
238
|
if (gathererModules.length > 0) {
|
|
197
239
|
let totalYield = 0
|
|
198
240
|
let totalDrain = 0
|
|
199
|
-
let
|
|
241
|
+
let maxDepth = 0
|
|
200
242
|
let totalSpeed = 0
|
|
201
243
|
for (const m of gathererModules) {
|
|
202
|
-
const
|
|
203
|
-
|
|
244
|
+
const tier = getItem(m.itemId).tier
|
|
245
|
+
const caps = computeGathererCapabilities(
|
|
246
|
+
decodeCraftedItemStats(m.itemId, m.stats),
|
|
247
|
+
tier
|
|
248
|
+
)
|
|
249
|
+
const amp = getSlotAmp(layout, m.slotIndex)
|
|
250
|
+
totalYield += applySlotMultiplier(caps.yield, amp)
|
|
204
251
|
totalDrain += caps.drain
|
|
205
|
-
|
|
206
|
-
totalSpeed += caps.speed
|
|
252
|
+
if (caps.depth > maxDepth) maxDepth = caps.depth
|
|
253
|
+
totalSpeed += applySlotMultiplier(caps.speed, amp)
|
|
254
|
+
}
|
|
255
|
+
ship.gatherer = {
|
|
256
|
+
yield: clampUint16(totalYield),
|
|
257
|
+
drain: totalDrain,
|
|
258
|
+
depth: maxDepth,
|
|
259
|
+
speed: clampUint16(totalSpeed),
|
|
207
260
|
}
|
|
208
|
-
ship.gatherer = {yield: totalYield, drain: totalDrain, depth: totalDepth, speed: totalSpeed}
|
|
209
261
|
}
|
|
210
262
|
|
|
211
263
|
const haulerModules = modules.filter((m) => getModuleCapabilityType(m.itemId) === MODULE_HAULER)
|
|
@@ -215,13 +267,15 @@ export function computeShipCapabilities(
|
|
|
215
267
|
let totalDrain = 0
|
|
216
268
|
for (const m of haulerModules) {
|
|
217
269
|
const caps = computeHaulerCapabilities(decodeCraftedItemStats(m.itemId, m.stats))
|
|
270
|
+
const eff = applySlotMultiplier(caps.efficiency, getSlotAmp(layout, m.slotIndex))
|
|
218
271
|
totalCapacity += caps.capacity
|
|
219
|
-
weightedEffNum +=
|
|
272
|
+
weightedEffNum += eff * caps.capacity
|
|
220
273
|
totalDrain += caps.drain
|
|
221
274
|
}
|
|
275
|
+
const efficiency = totalCapacity > 0 ? Math.floor(weightedEffNum / totalCapacity) : 0
|
|
222
276
|
ship.hauler = {
|
|
223
277
|
capacity: totalCapacity,
|
|
224
|
-
efficiency:
|
|
278
|
+
efficiency: clampUint16(efficiency),
|
|
225
279
|
drain: totalDrain,
|
|
226
280
|
}
|
|
227
281
|
}
|
|
@@ -234,10 +288,14 @@ export function computeShipCapabilities(
|
|
|
234
288
|
for (const m of loaderModules) {
|
|
235
289
|
const caps = computeLoaderCapabilities(decodeCraftedItemStats(m.itemId, m.stats))
|
|
236
290
|
totalMass += caps.mass
|
|
237
|
-
totalThrust += caps.thrust
|
|
291
|
+
totalThrust += applySlotMultiplier(caps.thrust, getSlotAmp(layout, m.slotIndex))
|
|
238
292
|
totalQuantity += caps.quantity
|
|
239
293
|
}
|
|
240
|
-
ship.loaders = {
|
|
294
|
+
ship.loaders = {
|
|
295
|
+
mass: totalMass,
|
|
296
|
+
thrust: clampUint16(totalThrust),
|
|
297
|
+
quantity: totalQuantity,
|
|
298
|
+
}
|
|
241
299
|
}
|
|
242
300
|
|
|
243
301
|
const crafterModules = modules.filter(
|
|
@@ -248,10 +306,10 @@ export function computeShipCapabilities(
|
|
|
248
306
|
let totalDrain = 0
|
|
249
307
|
for (const m of crafterModules) {
|
|
250
308
|
const caps = computeCrafterCapabilities(decodeCraftedItemStats(m.itemId, m.stats))
|
|
251
|
-
totalSpeed += caps.speed
|
|
309
|
+
totalSpeed += applySlotMultiplier(caps.speed, getSlotAmp(layout, m.slotIndex))
|
|
252
310
|
totalDrain += caps.drain
|
|
253
311
|
}
|
|
254
|
-
ship.crafter = {speed: totalSpeed, drain: totalDrain}
|
|
312
|
+
ship.crafter = {speed: clampUint16(totalSpeed), drain: totalDrain}
|
|
255
313
|
}
|
|
256
314
|
|
|
257
315
|
return ship
|
package/src/entities/ship.ts
CHANGED
|
@@ -2,7 +2,9 @@ import {type UInt16, type UInt16Type, UInt32, UInt64, type UInt64Type} from '@wh
|
|
|
2
2
|
import {ServerContract} from '../contracts'
|
|
3
3
|
import {Coordinates, type CoordinatesType} from '../types'
|
|
4
4
|
import {
|
|
5
|
+
type FloatPosition,
|
|
5
6
|
getDestinationLocation,
|
|
7
|
+
getInterpolatedPosition,
|
|
6
8
|
getPositionAt,
|
|
7
9
|
getFlightOrigin as travelGetFlightOrigin,
|
|
8
10
|
} from '../travel/travel'
|
|
@@ -55,6 +57,14 @@ export class Ship extends ServerContract.Types.entity_info {
|
|
|
55
57
|
return this.entity_name
|
|
56
58
|
}
|
|
57
59
|
|
|
60
|
+
get entityClass(): 'mobile' {
|
|
61
|
+
return 'mobile'
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
get canUndeploy(): boolean {
|
|
65
|
+
return true
|
|
66
|
+
}
|
|
67
|
+
|
|
58
68
|
get inv(): InventoryAccessor {
|
|
59
69
|
this._inv ??= new InventoryAccessor(this)
|
|
60
70
|
return this._inv
|
|
@@ -87,12 +97,19 @@ export class Ship extends ServerContract.Types.entity_info {
|
|
|
87
97
|
return dest ? Coordinates.from(dest) : undefined
|
|
88
98
|
}
|
|
89
99
|
|
|
100
|
+
/** Chain-tile coordinates at `now`. For smooth visual position use interpolatedPositionAt. */
|
|
90
101
|
positionAt(now: Date): Coordinates {
|
|
91
102
|
const taskIndex = this.sched.currentTaskIndex(now)
|
|
92
103
|
const progress = this.sched.currentTaskProgress(now)
|
|
93
104
|
return Coordinates.from(getPositionAt(this, taskIndex, progress))
|
|
94
105
|
}
|
|
95
106
|
|
|
107
|
+
interpolatedPositionAt(now: Date): FloatPosition {
|
|
108
|
+
const taskIndex = this.sched.currentTaskIndex(now)
|
|
109
|
+
const progress = this.sched.currentTaskProgressFloat(now)
|
|
110
|
+
return getInterpolatedPosition(this, taskIndex, progress)
|
|
111
|
+
}
|
|
112
|
+
|
|
96
113
|
isInFlight(now: Date): boolean {
|
|
97
114
|
return schedule.isInFlight(this, now)
|
|
98
115
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type {EntitySlot} from '../data/recipes-runtime'
|
|
2
|
+
|
|
3
|
+
export const U16_MAX = 65535
|
|
4
|
+
|
|
5
|
+
export interface InstalledModule {
|
|
6
|
+
slotIndex: number
|
|
7
|
+
itemId: number
|
|
8
|
+
stats: bigint
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function clampUint16(value: number): number {
|
|
12
|
+
return Math.min(value, U16_MAX)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function applySlotMultiplier(value: number, outputPct: number): number {
|
|
16
|
+
return clampUint16(Math.floor((value * outputPct) / 100))
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export function getSlotAmp(layout: EntitySlot[], slotIndex: number): number {
|
|
20
|
+
return layout[slotIndex]?.outputPct ?? 100
|
|
21
|
+
}
|
|
@@ -10,6 +10,8 @@ import type {PackedModuleInput} from './ship'
|
|
|
10
10
|
import {decodeCraftedItemStats} from '../derivation/crafting'
|
|
11
11
|
import {getModuleCapabilityType, MODULE_LOADER} from '../capabilities/modules'
|
|
12
12
|
import {computeLoaderCapabilities} from './ship-deploy'
|
|
13
|
+
import {applySlotMultiplier, clampUint16, getSlotAmp, type InstalledModule} from './slot-multiplier'
|
|
14
|
+
import type {EntitySlot} from '../data/recipes-runtime'
|
|
13
15
|
|
|
14
16
|
export interface WarehouseStateInput {
|
|
15
17
|
id: UInt64Type
|
|
@@ -31,6 +33,14 @@ export class Warehouse extends ServerContract.Types.entity_info {
|
|
|
31
33
|
return this.entity_name
|
|
32
34
|
}
|
|
33
35
|
|
|
36
|
+
get entityClass(): 'building' {
|
|
37
|
+
return 'building'
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
get canDemolish(): boolean {
|
|
41
|
+
return true
|
|
42
|
+
}
|
|
43
|
+
|
|
34
44
|
get inv(): InventoryAccessor {
|
|
35
45
|
this._inv ??= new InventoryAccessor(this)
|
|
36
46
|
return this._inv
|
|
@@ -96,7 +106,10 @@ export class Warehouse extends ServerContract.Types.entity_info {
|
|
|
96
106
|
}
|
|
97
107
|
}
|
|
98
108
|
|
|
99
|
-
export function computeWarehouseCapabilities(
|
|
109
|
+
export function computeWarehouseCapabilities(
|
|
110
|
+
modules: InstalledModule[],
|
|
111
|
+
layout: EntitySlot[]
|
|
112
|
+
): {
|
|
100
113
|
loaders?: {mass: number; thrust: number; quantity: number}
|
|
101
114
|
} {
|
|
102
115
|
const warehouse: {loaders?: {mass: number; thrust: number; quantity: number}} = {}
|
|
@@ -109,10 +122,14 @@ export function computeWarehouseCapabilities(modules: {itemId: number; stats: bi
|
|
|
109
122
|
for (const m of loaderModules) {
|
|
110
123
|
const caps = computeLoaderCapabilities(decodeCraftedItemStats(m.itemId, m.stats))
|
|
111
124
|
totalMass += caps.mass
|
|
112
|
-
totalThrust += caps.thrust
|
|
125
|
+
totalThrust += applySlotMultiplier(caps.thrust, getSlotAmp(layout, m.slotIndex))
|
|
113
126
|
totalQuantity += caps.quantity
|
|
114
127
|
}
|
|
115
|
-
warehouse.loaders = {
|
|
128
|
+
warehouse.loaders = {
|
|
129
|
+
mass: totalMass,
|
|
130
|
+
thrust: clampUint16(totalThrust),
|
|
131
|
+
quantity: totalQuantity,
|
|
132
|
+
}
|
|
116
133
|
}
|
|
117
134
|
|
|
118
135
|
return warehouse
|
package/src/index-module.ts
CHANGED
|
@@ -16,9 +16,11 @@ export {Ship} from './entities/ship'
|
|
|
16
16
|
export type {ShipStateInput, PackedModuleInput} from './entities/ship'
|
|
17
17
|
export {Warehouse, computeWarehouseCapabilities} from './entities/warehouse'
|
|
18
18
|
export type {WarehouseStateInput} from './entities/warehouse'
|
|
19
|
+
export {Extractor, computeExtractorCapabilities} from './entities/extractor'
|
|
20
|
+
export type {ExtractorStateInput, ExtractorCapabilities} from './entities/extractor'
|
|
19
21
|
export {Container} from './entities/container'
|
|
20
22
|
export type {ContainerStateInput} from './entities/container'
|
|
21
|
-
export {makeShip, makeWarehouse, makeContainer} from './entities/makers'
|
|
23
|
+
export {makeShip, makeWarehouse, makeExtractor, makeContainer} from './entities/makers'
|
|
22
24
|
|
|
23
25
|
export type movement_stats = ServerContract.Types.movement_stats
|
|
24
26
|
export type energy_stats = ServerContract.Types.energy_stats
|
|
@@ -26,14 +28,11 @@ export type loader_stats = ServerContract.Types.loader_stats
|
|
|
26
28
|
export type schedule = ServerContract.Types.schedule
|
|
27
29
|
export type task = ServerContract.Types.task
|
|
28
30
|
export type cargo_item = ServerContract.Types.cargo_item
|
|
29
|
-
export type
|
|
30
|
-
export type container_row = ServerContract.Types.container_row
|
|
31
|
+
export type entity_row = ServerContract.Types.entity_row
|
|
31
32
|
export type gatherer_stats = ServerContract.Types.gatherer_stats
|
|
32
33
|
|
|
33
34
|
export type location_static = ServerContract.Types.location_static
|
|
34
|
-
export type location_epoch = ServerContract.Types.location_epoch
|
|
35
35
|
export type location_derived = ServerContract.Types.location_derived
|
|
36
|
-
export type location_row = ServerContract.Types.location_row
|
|
37
36
|
export {Player} from './entities/player'
|
|
38
37
|
export type {PlayerStateInput} from './entities/player'
|
|
39
38
|
export {EntityInventory} from './entities/entity-inventory'
|
|
@@ -63,7 +62,6 @@ export {
|
|
|
63
62
|
categoryLabel,
|
|
64
63
|
categoryFromIndex,
|
|
65
64
|
categoryLabelFromIndex,
|
|
66
|
-
tierLabel,
|
|
67
65
|
} from './data/catalog'
|
|
68
66
|
export {getCurrentEpoch, getEpochInfo} from './scheduling/epoch'
|
|
69
67
|
export type {EpochInfo} from './scheduling/epoch'
|
|
@@ -73,8 +71,8 @@ export {
|
|
|
73
71
|
getLocationType,
|
|
74
72
|
getLocationTypeName,
|
|
75
73
|
isGatherableLocation,
|
|
74
|
+
isLocationBuildable,
|
|
76
75
|
deriveLocationStatic,
|
|
77
|
-
deriveLocationEpoch,
|
|
78
76
|
deriveLocation,
|
|
79
77
|
} from './utils/system'
|
|
80
78
|
|
|
@@ -86,6 +84,7 @@ export {
|
|
|
86
84
|
getEligibleResources,
|
|
87
85
|
getResourceWeight,
|
|
88
86
|
getLocationCandidates,
|
|
87
|
+
getLocationProfile,
|
|
89
88
|
getDepthThreshold,
|
|
90
89
|
getResourceTier,
|
|
91
90
|
DEPTH_THRESHOLD_T1,
|
|
@@ -117,30 +116,35 @@ export {
|
|
|
117
116
|
distanceBetweenCoordinates,
|
|
118
117
|
distanceBetweenPoints,
|
|
119
118
|
findNearbyPlanets,
|
|
120
|
-
lerp,
|
|
121
|
-
rotation,
|
|
122
|
-
calc_ship_mass,
|
|
123
119
|
calc_acceleration,
|
|
120
|
+
calc_energyusage,
|
|
124
121
|
calc_flighttime,
|
|
125
|
-
calc_ship_flighttime,
|
|
126
|
-
calc_ship_acceleration,
|
|
127
|
-
calc_rechargetime,
|
|
128
|
-
calc_ship_rechargetime,
|
|
129
|
-
calc_loader_flighttime,
|
|
130
122
|
calc_loader_acceleration,
|
|
131
|
-
|
|
123
|
+
calc_loader_flighttime,
|
|
132
124
|
calc_orbital_altitude,
|
|
125
|
+
calc_rechargetime,
|
|
126
|
+
calc_ship_acceleration,
|
|
127
|
+
calc_ship_flighttime,
|
|
128
|
+
calc_ship_mass,
|
|
129
|
+
calc_ship_rechargetime,
|
|
133
130
|
calc_transfer_duration,
|
|
134
|
-
|
|
131
|
+
calculateFlightTime,
|
|
135
132
|
calculateLoadTimeBreakdown,
|
|
136
133
|
calculateRefuelingTime,
|
|
137
|
-
|
|
138
|
-
|
|
134
|
+
calculateTransferTime,
|
|
135
|
+
easeFlightProgress,
|
|
139
136
|
estimateDealTravelTime,
|
|
140
|
-
|
|
141
|
-
|
|
137
|
+
estimateTravelTime,
|
|
138
|
+
flightSpeedFactor,
|
|
139
|
+
type FloatPosition,
|
|
142
140
|
getDestinationLocation,
|
|
141
|
+
getFlightOrigin,
|
|
142
|
+
getInterpolatedPosition,
|
|
143
143
|
getPositionAt,
|
|
144
|
+
hasEnergyForDistance,
|
|
145
|
+
interpolateFlightPosition,
|
|
146
|
+
lerp,
|
|
147
|
+
rotation,
|
|
144
148
|
} from './travel/travel'
|
|
145
149
|
export type {
|
|
146
150
|
LoadTimeBreakdown,
|
|
@@ -159,6 +163,8 @@ export type {HasCargo} from './entities/inventory-accessor'
|
|
|
159
163
|
export * as cargoUtils from './entities/cargo-utils'
|
|
160
164
|
export type {CargoData} from './entities/cargo-utils'
|
|
161
165
|
|
|
166
|
+
export {cargoRef, cargoItem} from './utils/cargo'
|
|
167
|
+
|
|
162
168
|
export {
|
|
163
169
|
createProjectedEntity,
|
|
164
170
|
projectEntity,
|
|
@@ -174,14 +180,35 @@ export type {
|
|
|
174
180
|
ProjectionOptions,
|
|
175
181
|
} from './scheduling/projection'
|
|
176
182
|
|
|
183
|
+
export {taskCargoChanges} from './scheduling/task-cargo'
|
|
184
|
+
export type {TaskCargoChange, TaskCargoDirection} from './scheduling/task-cargo'
|
|
185
|
+
|
|
177
186
|
export * from './types/capabilities'
|
|
178
187
|
export * from './types/entity'
|
|
188
|
+
export {
|
|
189
|
+
EntityClass,
|
|
190
|
+
ENTITY_SHIP,
|
|
191
|
+
ENTITY_WAREHOUSE,
|
|
192
|
+
ENTITY_EXTRACTOR,
|
|
193
|
+
ENTITY_CONTAINER,
|
|
194
|
+
shipTraits,
|
|
195
|
+
warehouseTraits,
|
|
196
|
+
extractorTraits,
|
|
197
|
+
containerTraits,
|
|
198
|
+
getEntityClass,
|
|
199
|
+
getPackedEntityType,
|
|
200
|
+
getEntityTraits,
|
|
201
|
+
isShip,
|
|
202
|
+
isWarehouse,
|
|
203
|
+
isExtractor,
|
|
204
|
+
isContainer,
|
|
205
|
+
} from './types/entity-traits'
|
|
206
|
+
export type {EntityTraits, EntityTypeName} from './types/entity-traits'
|
|
179
207
|
export * from './capabilities'
|
|
180
208
|
|
|
181
209
|
export {
|
|
182
210
|
categoryColors,
|
|
183
211
|
tierColors,
|
|
184
|
-
tierLabels,
|
|
185
212
|
categoryIcons,
|
|
186
213
|
categoryIconShapes,
|
|
187
214
|
componentIcon,
|
|
@@ -202,14 +229,19 @@ export type {PlanetSubtypeInfo} from './data/locations'
|
|
|
202
229
|
export {
|
|
203
230
|
capabilityNames,
|
|
204
231
|
capabilityAttributes,
|
|
205
|
-
statMappings,
|
|
206
232
|
isInvertedAttribute,
|
|
207
233
|
getCapabilityAttributes,
|
|
234
|
+
} from './data/capabilities'
|
|
235
|
+
export type {CapabilityAttribute, StatMapping} from './data/capabilities'
|
|
236
|
+
|
|
237
|
+
export {
|
|
238
|
+
deriveStatMappings,
|
|
208
239
|
getStatMappings,
|
|
209
240
|
getStatMappingsForStat,
|
|
210
241
|
getStatMappingsForCapability,
|
|
211
|
-
} from './
|
|
212
|
-
export
|
|
242
|
+
} from './derivation/capability-mappings'
|
|
243
|
+
export {SLOT_FORMULAS} from './data/capability-formulas'
|
|
244
|
+
export type {SlotConsumer, SlotConsumerKind} from './data/capability-formulas'
|
|
213
245
|
|
|
214
246
|
export {
|
|
215
247
|
encodeStats,
|
|
@@ -241,8 +273,11 @@ export {
|
|
|
241
273
|
computeWarehouseHullCapabilities,
|
|
242
274
|
computeStorageCapabilities,
|
|
243
275
|
computeShipCapabilities,
|
|
276
|
+
GATHERER_DEPTH_TABLE,
|
|
277
|
+
GATHERER_DEPTH_MAX_TIER,
|
|
278
|
+
gathererDepthForTier,
|
|
244
279
|
} from './entities/ship-deploy'
|
|
245
|
-
export type {ShipCapabilities} from './entities/ship-deploy'
|
|
280
|
+
export type {ShipCapabilities, GathererDepthParams} from './entities/ship-deploy'
|
|
246
281
|
|
|
247
282
|
export {resolveItem} from './resolution/resolve-item'
|
|
248
283
|
export type {
|
|
@@ -282,6 +317,9 @@ export type {
|
|
|
282
317
|
NFTCommonBase,
|
|
283
318
|
} from './nft/deserializers'
|
|
284
319
|
|
|
320
|
+
export {deserializeAtomicData} from './nft/atomicdata'
|
|
321
|
+
export type {SchemaField, RawData} from './nft/atomicdata'
|
|
322
|
+
|
|
285
323
|
export {
|
|
286
324
|
buildEntityDescription,
|
|
287
325
|
formatModuleLine,
|
|
@@ -302,6 +340,9 @@ export {
|
|
|
302
340
|
computeLoaderThrust,
|
|
303
341
|
computeCrafterSpeed,
|
|
304
342
|
computeCrafterDrain,
|
|
343
|
+
computeHaulerCapacity,
|
|
344
|
+
computeHaulerEfficiency,
|
|
345
|
+
computeWarpRange,
|
|
305
346
|
} from './nft/description'
|
|
306
347
|
|
|
307
348
|
export {
|