@shipload/sdk 1.0.0-next.7 → 1.0.0-next.71
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/scan.d.ts +52 -0
- package/lib/scan.js +162 -0
- package/lib/scan.js.map +1 -0
- package/lib/scan.m.js +152 -0
- package/lib/scan.m.js.map +1 -0
- package/lib/shipload.d.ts +5822 -1484
- package/lib/shipload.js +20838 -5419
- package/lib/shipload.js.map +1 -1
- package/lib/shipload.m.js +20674 -5669
- package/lib/shipload.m.js.map +1 -1
- package/lib/testing.d.ts +1691 -0
- package/lib/testing.js +7109 -0
- package/lib/testing.js.map +1 -0
- package/lib/testing.m.js +7103 -0
- package/lib/testing.m.js.map +1 -0
- package/package.json +20 -2
- package/src/capabilities/craftable.test.ts +82 -0
- package/src/capabilities/craftable.ts +82 -0
- package/src/capabilities/crafting.test.ts +80 -0
- package/src/capabilities/crafting.ts +50 -8
- package/src/capabilities/gathering.test.ts +29 -0
- package/src/capabilities/gathering.ts +38 -20
- package/src/capabilities/hauling.ts +0 -5
- package/src/capabilities/index.ts +0 -1
- package/src/capabilities/modules.ts +27 -30
- package/src/capabilities/movement.ts +1 -1
- package/src/capabilities/storage.test.ts +26 -0
- package/src/capabilities/storage.ts +22 -7
- package/src/contracts/fund.ts +306 -0
- package/src/contracts/platform.ts +312 -3
- package/src/contracts/server.ts +2793 -478
- package/src/contracts/token.ts +170 -0
- package/src/contracts.ts +2 -0
- package/src/coordinates/address.ts +88 -0
- package/src/coordinates/constants.test.ts +15 -0
- package/src/coordinates/constants.ts +23 -0
- package/src/coordinates/index.ts +15 -0
- package/src/coordinates/memo.test.ts +47 -0
- package/src/coordinates/memo.ts +20 -0
- package/src/coordinates/permutation.ts +77 -0
- package/src/coordinates/regions.ts +48 -0
- package/src/coordinates/sectors.ts +115 -0
- package/src/data/capabilities.ts +49 -18
- package/src/data/capability-formulas.ts +26 -14
- package/src/data/catalog.test.ts +19 -0
- package/src/data/catalog.ts +13 -3
- package/src/data/charters.json +396 -0
- package/src/data/citizenry-adjectives.json +42 -0
- package/src/data/citizenry-nouns.json +50 -0
- package/src/data/colors.ts +14 -32
- package/src/data/entities.json +421 -15
- package/src/data/item-ids.ts +53 -13
- package/src/data/items.json +330 -77
- package/src/data/kind-registry.json +212 -0
- package/src/data/kind-registry.ts +192 -0
- package/src/data/metadata.ts +312 -51
- package/src/data/recipes-runtime.ts +6 -23
- package/src/data/recipes.json +2173 -173
- package/src/data/tiers.ts +9 -6
- package/src/derivation/build-methods.test.ts +71 -0
- package/src/derivation/build-methods.ts +50 -0
- package/src/derivation/capabilities.test.ts +348 -0
- package/src/derivation/capabilities.ts +707 -0
- package/src/derivation/capability-mappings.ts +60 -16
- package/src/derivation/crafting.test.ts +17 -0
- package/src/derivation/crafting.ts +57 -34
- package/src/derivation/index.ts +27 -2
- package/src/derivation/recipe-usage.test.ts +88 -0
- package/src/derivation/recipe-usage.ts +141 -0
- package/src/derivation/reserve-regen.ts +34 -0
- package/src/derivation/resources.ts +9 -1
- package/src/derivation/rollups.test.ts +55 -0
- package/src/derivation/rollups.ts +72 -0
- package/src/derivation/stars.test.ts +67 -0
- package/src/derivation/stars.ts +25 -0
- package/src/derivation/stat-scaling.ts +12 -0
- package/src/derivation/stats.ts +6 -6
- package/src/derivation/strata.ts +5 -3
- package/src/derivation/stratum.ts +26 -22
- package/src/derivation/tiers.ts +40 -7
- package/src/derivation/upgrades.ts +14 -0
- package/src/derivation/wormhole.ts +154 -0
- package/src/entities/entity.ts +102 -0
- package/src/entities/gamestate.ts +3 -28
- package/src/entities/makers.ts +144 -136
- package/src/entities/slot-multiplier.ts +43 -0
- package/src/entity/hydrate.test.ts +156 -0
- package/src/entity/hydrate.ts +86 -0
- package/src/errors.ts +21 -16
- package/src/format.ts +42 -9
- package/src/index-module.ts +425 -32
- package/src/influence/ballot.test.ts +103 -0
- package/src/influence/ballot.ts +98 -0
- package/src/influence/categories.ts +32 -0
- package/src/influence/charter-metadata.test.ts +136 -0
- package/src/influence/charter-metadata.ts +236 -0
- package/src/influence/charters.test.ts +112 -0
- package/src/influence/charters.ts +150 -0
- package/src/influence/citizenry.ts +38 -0
- package/src/influence/civic-shuttle.test.ts +202 -0
- package/src/influence/civic-shuttle.ts +142 -0
- package/src/influence/civic.test.ts +287 -0
- package/src/influence/civic.ts +269 -0
- package/src/influence/constants.ts +84 -0
- package/src/influence/decay.ts +20 -0
- package/src/influence/decomp.ts +95 -0
- package/src/influence/demand.ts +106 -0
- package/src/influence/duration.ts +101 -0
- package/src/influence/index.ts +118 -0
- package/src/influence/influence.test.ts +450 -0
- package/src/influence/quality.ts +25 -0
- package/src/influence/valuation.ts +154 -0
- package/src/managers/actions.ts +950 -93
- package/src/managers/balances.test.ts +161 -0
- package/src/managers/balances.ts +93 -0
- package/src/managers/base.ts +10 -2
- package/src/managers/cluster.test.ts +39 -0
- package/src/managers/cluster.ts +53 -0
- package/src/managers/construction-types.ts +80 -0
- package/src/managers/construction.ts +453 -0
- package/src/managers/context.ts +58 -1
- package/src/managers/coordinates.ts +14 -0
- package/src/managers/entities.ts +35 -63
- package/src/managers/epochs.ts +72 -1
- package/src/managers/index.ts +38 -1
- package/src/managers/influence.test.ts +56 -0
- package/src/managers/influence.ts +425 -0
- package/src/managers/jobs.test.ts +96 -0
- package/src/managers/jobs.ts +58 -0
- package/src/managers/locations.ts +25 -29
- package/src/managers/nft.test.ts +21 -0
- package/src/managers/nft.ts +110 -0
- package/src/managers/players.ts +25 -0
- package/src/managers/plot.ts +122 -0
- package/src/nft/atomicassets.abi.json +1342 -0
- package/src/nft/atomicassets.ts +237 -0
- package/src/nft/atomicdata.ts +130 -0
- package/src/nft/buildImmutableData.ts +388 -0
- package/src/nft/description.ts +222 -100
- package/src/nft/index.ts +3 -0
- package/src/planner/index.ts +296 -0
- package/src/planner/planner.test.ts +459 -0
- package/src/receipts.ts +22 -0
- package/src/resolution/describe-module.ts +43 -25
- package/src/resolution/display-name.ts +39 -11
- package/src/resolution/resolve-item.test.ts +48 -0
- package/src/resolution/resolve-item.ts +112 -58
- package/src/scan/index.ts +244 -0
- package/src/scan/scan-wasm.base64.ts +2 -0
- package/src/scheduling/accessor.ts +65 -23
- package/src/scheduling/availability.test.ts +320 -0
- package/src/scheduling/availability.ts +251 -0
- package/src/scheduling/cancel.test.ts +550 -0
- package/src/scheduling/cancel.ts +254 -0
- package/src/scheduling/cluster-stock.test.ts +31 -0
- package/src/scheduling/cluster-stock.ts +15 -0
- package/src/scheduling/energy.ts +47 -0
- package/src/scheduling/epoch.ts +1 -0
- package/src/scheduling/idle-resolve.ts +45 -0
- package/src/scheduling/jobs.test.ts +448 -0
- package/src/scheduling/jobs.ts +343 -0
- package/src/scheduling/lane-core.ts +128 -0
- package/src/scheduling/lanes.test.ts +250 -0
- package/src/scheduling/lanes.ts +279 -0
- package/src/scheduling/projection.ts +265 -149
- package/src/scheduling/schedule.test.ts +163 -0
- package/src/scheduling/schedule.ts +282 -116
- package/src/scheduling/task-cargo.test.ts +110 -0
- package/src/scheduling/task-cargo.ts +62 -0
- package/src/scheduling/task-effects.test.ts +35 -0
- package/src/scheduling/task-effects.ts +34 -0
- package/src/scheduling/unwrap.test.ts +86 -0
- package/src/scheduling/unwrap.ts +190 -0
- package/src/shipload.ts +63 -4
- package/src/subscriptions/manager.cluster.test.ts +51 -0
- package/src/subscriptions/manager.ts +245 -172
- package/src/subscriptions/mappers.ts +5 -8
- package/src/subscriptions/types.ts +28 -3
- package/src/testing/catalog-hash.ts +19 -0
- package/src/testing/index.ts +2 -0
- package/src/testing/projection-parity.ts +167 -0
- package/src/travel/reach.test.ts +86 -0
- package/src/travel/reach.ts +34 -0
- package/src/travel/route-build.test.ts +63 -0
- package/src/travel/route-build.ts +60 -0
- package/src/travel/route-planner.ts +288 -0
- package/src/travel/route-simulator.ts +170 -0
- package/src/travel/travel.ts +190 -123
- package/src/types/capabilities.ts +37 -8
- package/src/types/entity.ts +3 -3
- package/src/types/index.ts +0 -1
- package/src/types.ts +81 -23
- package/src/utils/cargo.test.ts +14 -0
- package/src/utils/cargo.ts +2 -0
- package/src/utils/display-name.ts +70 -0
- package/src/utils/hash.ts +22 -2
- package/src/utils/system.ts +24 -5
- package/src/capabilities/loading.ts +0 -8
- package/src/entities/container.ts +0 -123
- package/src/entities/ship-deploy.ts +0 -295
- package/src/entities/ship.ts +0 -221
- package/src/entities/warehouse.ts +0 -127
- package/src/types/entity-traits.ts +0 -69
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import {tryGetItem} from '../data/catalog'
|
|
2
|
+
import {getRecipe} from '../data/recipes-runtime'
|
|
3
|
+
import recipes from '../data/recipes.json'
|
|
4
|
+
import {
|
|
5
|
+
DECOMP_MAX_BUCKETS,
|
|
6
|
+
DECOMP_MAX_DEPTH,
|
|
7
|
+
DECOMP_PROCESSED_MASS_MAX,
|
|
8
|
+
DECOMP_RAW_MASS_MAX,
|
|
9
|
+
} from './constants'
|
|
10
|
+
import {categoryIndex} from './categories'
|
|
11
|
+
|
|
12
|
+
export interface DecompBucket {
|
|
13
|
+
category: number
|
|
14
|
+
tier: number
|
|
15
|
+
rawMass: number
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface DecompEntry {
|
|
19
|
+
itemId: number
|
|
20
|
+
processedMass: number
|
|
21
|
+
buckets: DecompBucket[]
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
interface Accumulator {
|
|
25
|
+
buckets: DecompBucket[]
|
|
26
|
+
processedMass: number
|
|
27
|
+
overflow: boolean
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function add(acc: Accumulator, category: number, tier: number, mass: number): void {
|
|
31
|
+
const existing = acc.buckets.find((b) => b.category === category && b.tier === tier)
|
|
32
|
+
if (existing) {
|
|
33
|
+
existing.rawMass += mass
|
|
34
|
+
return
|
|
35
|
+
}
|
|
36
|
+
if (acc.buckets.length >= DECOMP_MAX_BUCKETS) {
|
|
37
|
+
acc.overflow = true
|
|
38
|
+
return
|
|
39
|
+
}
|
|
40
|
+
acc.buckets.push({category, tier, rawMass: mass})
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function walk(itemId: number, multiplier: number, acc: Accumulator, depth: number): void {
|
|
44
|
+
if (depth > DECOMP_MAX_DEPTH) {
|
|
45
|
+
acc.overflow = true
|
|
46
|
+
return
|
|
47
|
+
}
|
|
48
|
+
const recipe = getRecipe(itemId)
|
|
49
|
+
if (!recipe) return
|
|
50
|
+
|
|
51
|
+
for (const input of recipe.inputs) {
|
|
52
|
+
const def = tryGetItem(input.itemId)
|
|
53
|
+
const units = multiplier * input.quantity
|
|
54
|
+
const mass = units * (def ? def.mass : 0)
|
|
55
|
+
acc.processedMass += mass
|
|
56
|
+
if (getRecipe(input.itemId)) {
|
|
57
|
+
walk(input.itemId, units, acc, depth + 1)
|
|
58
|
+
} else if (def?.type !== 'resource' || def.category === undefined) {
|
|
59
|
+
acc.overflow = true
|
|
60
|
+
} else {
|
|
61
|
+
add(acc, categoryIndex(def.category), def.tier, mass)
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function buildRegistry(): DecompEntry[] {
|
|
67
|
+
const out: DecompEntry[] = []
|
|
68
|
+
for (const recipe of recipes as {outputItemId: number}[]) {
|
|
69
|
+
const acc: Accumulator = {buckets: [], processedMass: 0, overflow: false}
|
|
70
|
+
walk(recipe.outputItemId, 1, acc, 0)
|
|
71
|
+
acc.buckets.sort((a, b) => a.category - b.category || a.tier - b.tier)
|
|
72
|
+
|
|
73
|
+
const rawTotal = acc.buckets.reduce((sum, b) => sum + b.rawMass, 0)
|
|
74
|
+
if (rawTotal > DECOMP_RAW_MASS_MAX || acc.processedMass > DECOMP_PROCESSED_MASS_MAX) {
|
|
75
|
+
acc.overflow = true
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
out.push({
|
|
79
|
+
itemId: recipe.outputItemId,
|
|
80
|
+
processedMass: acc.overflow ? 0 : acc.processedMass,
|
|
81
|
+
buckets: acc.buckets,
|
|
82
|
+
})
|
|
83
|
+
}
|
|
84
|
+
out.sort((a, b) => a.itemId - b.itemId)
|
|
85
|
+
return out
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export const DECOMP_REGISTRY: DecompEntry[] = buildRegistry()
|
|
89
|
+
|
|
90
|
+
const byItemId = new Map<number, DecompEntry>()
|
|
91
|
+
for (const entry of DECOMP_REGISTRY) byItemId.set(entry.itemId, entry)
|
|
92
|
+
|
|
93
|
+
export function findDecomp(itemId: number): DecompEntry | undefined {
|
|
94
|
+
return byItemId.get(itemId)
|
|
95
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import {Checksum256, type Checksum256Type, type Checksum512} from '@wharfkit/antelope'
|
|
2
|
+
import {getLocationProfile} from '../derivation/resources'
|
|
3
|
+
import {Coordinates, type CoordinatesType} from '../types'
|
|
4
|
+
import {hash512} from '../utils/hash'
|
|
5
|
+
import {deriveLocationStatic} from '../utils/system'
|
|
6
|
+
import {RESOURCE_CATEGORY_COUNT} from './constants'
|
|
7
|
+
|
|
8
|
+
export interface DemandTriple {
|
|
9
|
+
peak: bigint
|
|
10
|
+
base: bigint
|
|
11
|
+
floor: bigint
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface DemandView {
|
|
15
|
+
abundantMask: number
|
|
16
|
+
lackingMask: number
|
|
17
|
+
acute: number
|
|
18
|
+
needFp: bigint[]
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const ALL_CATEGORIES_MASK = 0x1f
|
|
22
|
+
|
|
23
|
+
export function abundantMaskFor(locationType: number, subtype: number): number {
|
|
24
|
+
let mask = 0
|
|
25
|
+
for (const entry of getLocationProfile(locationType, subtype)) {
|
|
26
|
+
mask |= 1 << entry.category
|
|
27
|
+
}
|
|
28
|
+
return mask
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function lackingMaskFrom(abundantMask: number): number {
|
|
32
|
+
return ~abundantMask & ALL_CATEGORIES_MASK
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export function popcount5(mask: number): number {
|
|
36
|
+
let n = 0
|
|
37
|
+
for (let i = 0; i < RESOURCE_CATEGORY_COUNT; i++) if (mask & (1 << i)) n++
|
|
38
|
+
return n
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function pickAcuteCategory(lackingMask: number, roll: number): number {
|
|
42
|
+
const count = popcount5(lackingMask)
|
|
43
|
+
if (count === 0) throw new Error('location has no lacking category')
|
|
44
|
+
let index = roll % count
|
|
45
|
+
for (let c = 0; c < RESOURCE_CATEGORY_COUNT; c++) {
|
|
46
|
+
if ((lackingMask & (1 << c)) === 0) continue
|
|
47
|
+
if (index === 0) return c
|
|
48
|
+
index--
|
|
49
|
+
}
|
|
50
|
+
throw new Error('acute pick fell through')
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export function demandRoll(hash: Checksum512): number {
|
|
54
|
+
const bytes = hash.array
|
|
55
|
+
return ((bytes[0] << 24) | (bytes[1] << 16) | (bytes[2] << 8) | bytes[3]) >>> 0
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function buildDemand(abundantMask: number, acute: number, triple: DemandTriple): DemandView {
|
|
59
|
+
const lackingMask = lackingMaskFrom(abundantMask)
|
|
60
|
+
const needFp: bigint[] = []
|
|
61
|
+
for (let c = 0; c < RESOURCE_CATEGORY_COUNT; c++) {
|
|
62
|
+
if (c === acute) needFp.push(triple.peak)
|
|
63
|
+
else if (lackingMask & (1 << c)) needFp.push(triple.base)
|
|
64
|
+
else needFp.push(triple.floor)
|
|
65
|
+
}
|
|
66
|
+
return {abundantMask, lackingMask, acute, needFp}
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export function needForCategory(demand: DemandView, category: number): bigint {
|
|
70
|
+
if (category < 0 || category >= RESOURCE_CATEGORY_COUNT) {
|
|
71
|
+
throw new Error('invalid category')
|
|
72
|
+
}
|
|
73
|
+
return demand.needFp[category]
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// Two distinct seeds: composition from the genesis game seed, acute rotation from the epoch seed.
|
|
77
|
+
export function deriveDemand(args: {
|
|
78
|
+
gameSeed: Checksum256Type
|
|
79
|
+
epochSeed: Checksum256Type
|
|
80
|
+
coordinates: CoordinatesType
|
|
81
|
+
triple: DemandTriple
|
|
82
|
+
}): DemandView {
|
|
83
|
+
const coords = Coordinates.from(args.coordinates)
|
|
84
|
+
const location = deriveLocationStatic(args.gameSeed, coords)
|
|
85
|
+
const abundant = abundantMaskFor(Number(location.type), Number(location.subtype))
|
|
86
|
+
if (abundant === 0) throw new Error('location has no composition')
|
|
87
|
+
|
|
88
|
+
const hash = hash512(
|
|
89
|
+
Checksum256.from(args.epochSeed),
|
|
90
|
+
`demand-${coords.x.toString()}-${coords.y.toString()}`
|
|
91
|
+
)
|
|
92
|
+
const acute = pickAcuteCategory(lackingMaskFrom(abundant), demandRoll(hash))
|
|
93
|
+
return buildDemand(abundant, acute, args.triple)
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export function isAbundant(demand: DemandView, category: number): boolean {
|
|
97
|
+
return (demand.abundantMask & (1 << category)) !== 0
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export function isAcute(demand: DemandView, category: number): boolean {
|
|
101
|
+
return demand.acute === category
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export function needMultiplier(demand: DemandView, category: number): number {
|
|
105
|
+
return Number(needForCategory(demand, category)) / 10_000
|
|
106
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import type {NameType} from '@wharfkit/antelope'
|
|
2
|
+
import type {ServerContract} from '../contracts'
|
|
3
|
+
import {getEntityClass} from '../data/kind-registry'
|
|
4
|
+
import {computeLoaderMass, computeLoaderThrust} from '../nft/description'
|
|
5
|
+
import {laneKeyForModule, resolveLaneLoader} from '../scheduling/lanes'
|
|
6
|
+
import {calc_onesided_duration} from '../travel/travel'
|
|
7
|
+
import {MASS_STAT_SCALE, MASS_UNITS_PER_TONNE, PRECISION} from '../types'
|
|
8
|
+
import {CIVIC_LOADER_STAT, CIVIC_LOADER_TIER, DEFAULT_ORBITAL_Z} from './constants'
|
|
9
|
+
|
|
10
|
+
export interface CivicLoaderStats {
|
|
11
|
+
thrust: number
|
|
12
|
+
mass: number
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function civicLoader(): CivicLoaderStats {
|
|
16
|
+
return {
|
|
17
|
+
thrust: Math.min(computeLoaderThrust(CIVIC_LOADER_STAT, CIVIC_LOADER_TIER), 65_535),
|
|
18
|
+
mass: computeLoaderMass(CIVIC_LOADER_STAT),
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
function acceleration(thrust: number, mass: number): number {
|
|
23
|
+
if (mass <= 0) return 0
|
|
24
|
+
return (thrust / (mass * MASS_STAT_SCALE)) * PRECISION
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
function flightTime(distance: number, accel: number): number {
|
|
28
|
+
if (accel <= 0 || distance <= 0) return 0
|
|
29
|
+
return Math.floor(2 * Math.sqrt(distance / accel))
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function contributeDuration(totalMass: number, altitudeZ = 0): number {
|
|
33
|
+
const loader = civicLoader()
|
|
34
|
+
const mass = totalMass + loader.mass
|
|
35
|
+
const z = Math.max(altitudeZ, DEFAULT_ORBITAL_Z)
|
|
36
|
+
return flightTime(z, acceleration(loader.thrust, mass))
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function contributeDurationForTonnes(tonnes: number, altitudeZ = 0): number {
|
|
40
|
+
return contributeDuration(Math.floor(tonnes * MASS_UNITS_PER_TONNE), altitudeZ)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export const DEPOT_LOADER_SLOT = 0
|
|
44
|
+
|
|
45
|
+
export interface DepotTransferParams {
|
|
46
|
+
depotModules: ServerContract.Types.module_entry[]
|
|
47
|
+
depotItemId: number
|
|
48
|
+
depotKind: NameType
|
|
49
|
+
depotZ: number
|
|
50
|
+
shipKind: NameType
|
|
51
|
+
shipZ: number
|
|
52
|
+
cargoMass: number
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Mirrors depot.cpp: the depot's slot-0 loader drives the transfer; 0 when no loader is installed.
|
|
56
|
+
export function depotTransferDuration(params: DepotTransferParams): number {
|
|
57
|
+
const loader = resolveLaneLoader(
|
|
58
|
+
params.depotModules,
|
|
59
|
+
params.depotItemId,
|
|
60
|
+
laneKeyForModule(DEPOT_LOADER_SLOT)
|
|
61
|
+
)
|
|
62
|
+
if (!loader.valid) return 0
|
|
63
|
+
return calc_onesided_duration(
|
|
64
|
+
loader.thrust,
|
|
65
|
+
loader.mass,
|
|
66
|
+
params.shipZ,
|
|
67
|
+
params.depotZ,
|
|
68
|
+
getEntityClass(params.shipKind),
|
|
69
|
+
getEntityClass(params.depotKind),
|
|
70
|
+
params.cargoMass
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export interface CivicDropoffParams {
|
|
75
|
+
buildingModules: ServerContract.Types.module_entry[]
|
|
76
|
+
buildingItemId: number
|
|
77
|
+
buildingKind: NameType
|
|
78
|
+
buildingZ: number
|
|
79
|
+
shipKind: NameType
|
|
80
|
+
shipZ: number
|
|
81
|
+
cargoMass: number
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
// Mirrors jobs.cpp craftjob: the building's slot-0 loader when one is installed, the civic loader when none is.
|
|
85
|
+
export function civicDropoffDuration(params: CivicDropoffParams): number {
|
|
86
|
+
const loader = resolveLaneLoader(
|
|
87
|
+
params.buildingModules,
|
|
88
|
+
params.buildingItemId,
|
|
89
|
+
laneKeyForModule(DEPOT_LOADER_SLOT)
|
|
90
|
+
)
|
|
91
|
+
if (!loader.valid) return contributeDuration(params.cargoMass, params.shipZ)
|
|
92
|
+
return calc_onesided_duration(
|
|
93
|
+
loader.thrust,
|
|
94
|
+
loader.mass,
|
|
95
|
+
params.shipZ,
|
|
96
|
+
params.buildingZ,
|
|
97
|
+
getEntityClass(params.shipKind),
|
|
98
|
+
getEntityClass(params.buildingKind),
|
|
99
|
+
params.cargoMass
|
|
100
|
+
)
|
|
101
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
export * from './constants'
|
|
2
|
+
export * from './categories'
|
|
3
|
+
export {decayActive, normalizeActive, type DecayableStanding} from './decay'
|
|
4
|
+
export {getStatCount, statsSumSq, qualityFactor} from './quality'
|
|
5
|
+
export {
|
|
6
|
+
DECOMP_REGISTRY,
|
|
7
|
+
findDecomp,
|
|
8
|
+
type DecompBucket,
|
|
9
|
+
type DecompEntry,
|
|
10
|
+
} from './decomp'
|
|
11
|
+
export {
|
|
12
|
+
abundantMaskFor,
|
|
13
|
+
buildDemand,
|
|
14
|
+
demandRoll,
|
|
15
|
+
deriveDemand,
|
|
16
|
+
isAbundant,
|
|
17
|
+
isAcute,
|
|
18
|
+
lackingMaskFrom,
|
|
19
|
+
needForCategory,
|
|
20
|
+
needMultiplier,
|
|
21
|
+
pickAcuteCategory,
|
|
22
|
+
popcount5,
|
|
23
|
+
type DemandTriple,
|
|
24
|
+
type DemandView,
|
|
25
|
+
} from './demand'
|
|
26
|
+
export {
|
|
27
|
+
componentBaseAtomic,
|
|
28
|
+
componentEffortAtomic,
|
|
29
|
+
pricingFromWeights,
|
|
30
|
+
resourceValueAtomic,
|
|
31
|
+
valueCargoItem,
|
|
32
|
+
valueContribution,
|
|
33
|
+
weightedQualityAtomic,
|
|
34
|
+
type InfluencePricing,
|
|
35
|
+
type ValuedItem,
|
|
36
|
+
} from './valuation'
|
|
37
|
+
export {
|
|
38
|
+
civicDropoffDuration,
|
|
39
|
+
civicLoader,
|
|
40
|
+
contributeDuration,
|
|
41
|
+
contributeDurationForTonnes,
|
|
42
|
+
depotTransferDuration,
|
|
43
|
+
DEPOT_LOADER_SLOT,
|
|
44
|
+
type CivicDropoffParams,
|
|
45
|
+
type CivicLoaderStats,
|
|
46
|
+
type DepotTransferParams,
|
|
47
|
+
} from './duration'
|
|
48
|
+
export {
|
|
49
|
+
civicShuttleBays,
|
|
50
|
+
civicTransfersAtCap,
|
|
51
|
+
civicTransfersFrom,
|
|
52
|
+
pendingCivicTransfers,
|
|
53
|
+
selectCivicShuttleBay,
|
|
54
|
+
CIVIC_TRANSFER_PER_PLAYER_CAP,
|
|
55
|
+
type CivicShuttleBay,
|
|
56
|
+
type PendingCivicTransfer,
|
|
57
|
+
} from './civic-shuttle'
|
|
58
|
+
export {citizenryName, citizenryPatternCount} from './citizenry'
|
|
59
|
+
export {
|
|
60
|
+
charterBuildingEntity,
|
|
61
|
+
charterEligible,
|
|
62
|
+
charterEligibleChained,
|
|
63
|
+
charterGateNodeFor,
|
|
64
|
+
charterIneligible,
|
|
65
|
+
charterNode,
|
|
66
|
+
charterPrereqsMet,
|
|
67
|
+
charterRungValue,
|
|
68
|
+
charterSingletonMandate,
|
|
69
|
+
charterModuleCount,
|
|
70
|
+
CHARTER_INELIGIBILITY_MESSAGES,
|
|
71
|
+
CHARTER_REGISTRY,
|
|
72
|
+
eligibleCharters,
|
|
73
|
+
type BuiltCharter,
|
|
74
|
+
type CharterGrant,
|
|
75
|
+
type CharterIneligibility,
|
|
76
|
+
type CharterNode,
|
|
77
|
+
type CharterWorld,
|
|
78
|
+
type WorldBuilding,
|
|
79
|
+
} from './charters'
|
|
80
|
+
export {
|
|
81
|
+
projectBallot,
|
|
82
|
+
type BallotInput,
|
|
83
|
+
type BallotProjection,
|
|
84
|
+
type BallotVoter,
|
|
85
|
+
type ProjectedOption,
|
|
86
|
+
type ProjectedSeat,
|
|
87
|
+
} from './ballot'
|
|
88
|
+
export {
|
|
89
|
+
charterMetadata,
|
|
90
|
+
charterName,
|
|
91
|
+
charterSignature,
|
|
92
|
+
charterSummary,
|
|
93
|
+
civicBuildingLabel,
|
|
94
|
+
civicStatLabel,
|
|
95
|
+
romanNumeral,
|
|
96
|
+
type CharterGateSignature,
|
|
97
|
+
type CharterMeta,
|
|
98
|
+
type CharterRungSignature,
|
|
99
|
+
type CharterSignature,
|
|
100
|
+
} from './charter-metadata'
|
|
101
|
+
export {
|
|
102
|
+
CIVIC_STAT_DEFS,
|
|
103
|
+
civicBuildingFor,
|
|
104
|
+
civicBuildingKind,
|
|
105
|
+
civicHullItem,
|
|
106
|
+
civicModuleItemFor,
|
|
107
|
+
civicStatModuleType,
|
|
108
|
+
emptyCivicModules,
|
|
109
|
+
findCivicStatDef,
|
|
110
|
+
fitCivicModules,
|
|
111
|
+
isCivicEntity,
|
|
112
|
+
isCivicKind,
|
|
113
|
+
previewCharterGrants,
|
|
114
|
+
raiseCivicStat,
|
|
115
|
+
type CivicBuildingPreview,
|
|
116
|
+
type CivicStanding,
|
|
117
|
+
type CivicStatDef,
|
|
118
|
+
} from './civic'
|