@shipload/sdk 1.0.0-next.11 → 1.0.0-next.13

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 CHANGED
@@ -1571,547 +1571,121 @@ declare function getRecipe(outputItemId: number): Recipe | undefined;
1571
1571
  declare function getEntityLayout(entityItemId: number): EntityLayout | undefined;
1572
1572
  declare function findItemByCategoryAndTier(category: ResourceCategory, tier: number): Item;
1573
1573
 
1574
- interface EpochInfo {
1575
- epoch: UInt64;
1576
- start: Date;
1577
- end: Date;
1574
+ declare const CAP_WRAP = 1;
1575
+ declare const CAP_UNDEPLOY = 2;
1576
+ declare const CAP_DEMOLISH = 4;
1577
+ declare const CAP_MODULES = 16;
1578
+ declare enum EntityClass {
1579
+ OrbitalVessel = 0,
1580
+ PlanetaryStructure = 1
1578
1581
  }
1579
- declare function getCurrentEpoch(game: Types$1.game_row): UInt64;
1580
- declare function getEpochInfo(game: Types$1.game_row, epoch: UInt64): EpochInfo;
1581
-
1582
- /**
1583
- * GameState class extends the state_row from the server contract
1584
- * with helper methods for epoch management and system generation
1585
- */
1586
- declare class GameState extends Types.state_row {
1587
- private _game?;
1588
- /**
1589
- * Create a GameState instance from a state_row
1590
- */
1591
- static from(state: Types.state_row, game?: Types$1.game_row): GameState;
1592
- /**
1593
- * Set the game configuration (needed for epoch calculations)
1594
- */
1595
- setGame(game: Types$1.game_row): void;
1596
- /**
1597
- * Get the current epoch number from the state
1598
- */
1599
- get currentEpoch(): UInt64;
1600
- /**
1601
- * Get the epoch seed (used for market pricing and system generation)
1602
- */
1603
- get epochSeed(): Checksum256;
1604
- /**
1605
- * Get the game seed (from game config, if available)
1606
- */
1607
- get gameSeed(): Checksum256 | undefined;
1608
- /**
1609
- * Check if the game is currently enabled
1610
- */
1611
- get isEnabled(): boolean;
1612
- /**
1613
- * Get the current salt value (used for random number generation)
1614
- */
1615
- get currentSalt(): UInt64;
1616
- /**
1617
- * Get the commit hash for the next epoch
1618
- */
1619
- get nextEpochCommit(): Checksum256;
1620
- /**
1621
- * Calculate the current epoch from game config (if game is set)
1622
- * This might differ from state.epoch if the blockchain hasn't advanced yet
1623
- */
1624
- get calculatedCurrentEpoch(): UInt64 | undefined;
1625
- /**
1626
- * Get epoch info (start/end times) for the current epoch
1627
- */
1628
- get currentEpochInfo(): EpochInfo | undefined;
1629
- /**
1630
- * Get epoch info for a specific epoch number
1631
- */
1632
- getEpochInfo(epoch: UInt64): EpochInfo | undefined;
1633
- /**
1634
- * Check if a system exists at given coordinates
1635
- * Requires game seed from game config
1636
- */
1637
- hasSystemAt(x: number, y: number): boolean;
1638
- /**
1639
- * Check if a system exists at coordinates object
1640
- */
1641
- hasSystemAtCoords(coords: Types.coordinates): boolean;
1642
- /**
1643
- * Get a summary of the game state
1644
- */
1645
- get summary(): {
1646
- enabled: boolean;
1647
- epoch: string;
1648
- hasSeed: boolean;
1649
- hasCommit: boolean;
1650
- };
1582
+ type EntityTypeName = 'ship' | 'warehouse' | 'extractor' | 'factory' | 'container' | 'nexus';
1583
+ interface KindMeta {
1584
+ kind: Name;
1585
+ classification: EntityClass;
1586
+ capabilityFlags: number;
1587
+ zCoord: number;
1588
+ defaultLabel: string;
1589
+ }
1590
+ interface TemplateMeta {
1591
+ itemId: number;
1592
+ kind: Name;
1593
+ displayLabel: string;
1651
1594
  }
1595
+ declare function getKindMeta(kind: NameType | EntityTypeName): KindMeta | undefined;
1596
+ declare function getTemplateMeta(itemId: number): TemplateMeta | undefined;
1597
+ declare function getPackedEntityType(itemId: number): Name | null;
1598
+ declare function kindCan(kind: NameType | EntityTypeName, cap: number): boolean;
1599
+ declare function getEntityClass(kind: NameType | EntityTypeName): EntityClass;
1600
+ declare const ENTITY_SHIP: Name;
1601
+ declare const ENTITY_WAREHOUSE: Name;
1602
+ declare const ENTITY_EXTRACTOR: Name;
1603
+ declare const ENTITY_FACTORY: Name;
1604
+ declare const ENTITY_CONTAINER: Name;
1605
+ declare const ENTITY_NEXUS: Name;
1606
+ declare function isShip(entity: {
1607
+ type?: Name;
1608
+ }): boolean;
1609
+ declare function isWarehouse(entity: {
1610
+ type?: Name;
1611
+ }): boolean;
1612
+ declare function isExtractor(entity: {
1613
+ type?: Name;
1614
+ }): boolean;
1615
+ declare function isFactory(entity: {
1616
+ type?: Name;
1617
+ }): boolean;
1618
+ declare function isContainer(entity: {
1619
+ type?: Name;
1620
+ }): boolean;
1621
+ declare function isNexus(entity: {
1622
+ type?: Name;
1623
+ }): boolean;
1652
1624
 
1653
- interface PlayerStateInput {
1654
- owner: NameType;
1655
- }
1656
- declare class Player extends Types.player_row {
1657
- static fromState(state: PlayerStateInput): Player;
1625
+ declare class EntityInventory extends Types.cargo_item {
1626
+ private _item?;
1627
+ get item(): Item;
1628
+ get good(): Item;
1629
+ get name(): string;
1630
+ get unitMass(): UInt32;
1631
+ get totalMass(): UInt64;
1632
+ get hasCargo(): boolean;
1633
+ get isEmpty(): boolean;
1658
1634
  }
1659
1635
 
1660
- declare class PlayersManager extends BaseManager {
1661
- getPlayer(account: NameType): Promise<Player | undefined>;
1636
+ interface MovementCapability {
1637
+ engines: Types.movement_stats;
1638
+ generator: Types.energy_stats;
1662
1639
  }
1663
-
1664
- interface StratumInfo {
1665
- itemId: number;
1666
- seed: bigint;
1667
- richness: number;
1668
- reserve: number;
1640
+ interface EnergyCapability {
1641
+ energy: UInt16;
1669
1642
  }
1670
- interface ResourceStats {
1671
- stat1: number;
1672
- stat2: number;
1673
- stat3: number;
1643
+ interface StorageCapability {
1644
+ capacity: UInt32;
1645
+ cargomass: UInt32;
1646
+ cargo: Types.cargo_item[];
1674
1647
  }
1675
- declare function deriveStratum(epochSeed: Checksum256Type, coords: CoordinatesType, stratum: number, locationType: number, subtype: number, _maxDepth: number): StratumInfo;
1676
- /**
1677
- * Derives the three stat values for a raw resource from a deposit's
1678
- * entropy seed (hash-based, weibull-transformed).
1679
- *
1680
- * **Use only on deposit seeds** — the bigint returned by `deriveStratum`
1681
- * or carried on a `MassDeposit`. Do NOT call this on a cargo item's
1682
- * `stats` field; cargo stats are bit-packed and must be read via
1683
- * `decodeStat` (or `decodeStackStats` for category-mapped output).
1684
- *
1685
- * Passing a cargo `stats` value here produces meaningless output
1686
- * (hash of the packed bits, unrelated to the actual stats).
1687
- */
1688
- declare function deriveResourceStats(seed: bigint): ResourceStats;
1689
-
1690
- interface DerivedStratum {
1691
- index: number;
1692
- itemId: number;
1693
- seed: bigint;
1694
- richness: number;
1695
- reserve: number;
1696
- stats: ResourceStats;
1648
+ interface LoaderCapability {
1649
+ loaders: Types.loader_stats;
1697
1650
  }
1698
- declare function deriveStrata(coords: CoordinatesType, gameSeed: Checksum256Type, epochSeed: Checksum256Type): DerivedStratum[];
1699
-
1700
- declare function deriveLocationSize(loc: Types.location_static): number;
1701
-
1702
- declare const DEPTH_THRESHOLD_T1 = 0;
1703
- declare const DEPTH_THRESHOLD_T2 = 1500;
1704
- declare const DEPTH_THRESHOLD_T3 = 5000;
1705
- declare const DEPTH_THRESHOLD_T4 = 12000;
1706
- declare const DEPTH_THRESHOLD_T5 = 22000;
1707
- declare const LOCATION_MIN_DEPTH = 500;
1708
- declare const LOCATION_MAX_DEPTH = 65535;
1709
- declare const PLANET_SUBTYPE_GAS_GIANT = 0;
1710
- declare const PLANET_SUBTYPE_ROCKY = 1;
1711
- declare const PLANET_SUBTYPE_TERRESTRIAL = 2;
1712
- declare const PLANET_SUBTYPE_ICY = 3;
1713
- declare const PLANET_SUBTYPE_OCEAN = 4;
1714
- declare const PLANET_SUBTYPE_INDUSTRIAL = 5;
1715
- declare function getDepthThreshold(tier: number): number;
1716
- declare function getResourceTier(itemId: number): number;
1717
- declare function getResourceWeight(itemId: number, stratum: number): number;
1718
- interface LocationProfileEntry {
1719
- category: number;
1720
- maxTier: number;
1651
+ interface GathererCapability {
1652
+ gatherer: Types.gatherer_stats;
1721
1653
  }
1722
- declare function getLocationProfile(locationType: number, subtype: number): LocationProfileEntry[];
1723
- declare function getLocationCandidates(locationType: number, subtype: number): number[];
1724
- declare function getEligibleResources(locationType: number, subtype: number, stratum: number): number[];
1725
-
1726
- type ReserveTier = 'small' | 'medium' | 'large' | 'massive' | 'motherlode';
1727
- interface TierRange {
1728
- min: number;
1729
- max: number;
1654
+ interface MassCapability {
1655
+ hullmass: UInt32;
1730
1656
  }
1731
- declare const RESERVE_TIERS: Record<ReserveTier, TierRange>;
1732
- declare const TIER_ROLL_MAX = 65536;
1733
- declare function rollTier(tierRoll: number, stratum: number): ReserveTier;
1734
- declare function rollWithinTier(withinRoll: number, range: TierRange): number;
1735
-
1736
- interface StatDefinition {
1737
- key: string;
1738
- label: string;
1739
- abbreviation: string;
1740
- purpose: string;
1741
- inverted?: boolean;
1657
+ interface ScheduleCapability {
1658
+ schedule?: Types.schedule;
1742
1659
  }
1743
- declare function getStatDefinitions(category: ResourceCategory): StatDefinition[];
1744
- declare function getStatName(category: ResourceCategory, index: 0 | 1 | 2): StatDefinition;
1745
- interface NamedStats {
1746
- definitions: StatDefinition[];
1747
- values: [number, number, number];
1660
+ interface EntityCapabilities {
1661
+ hullmass?: UInt32;
1662
+ capacity?: UInt32;
1663
+ engines?: Types.movement_stats;
1664
+ generator?: Types.energy_stats;
1665
+ loaders?: Types.loader_stats;
1666
+ gatherer?: Types.gatherer_stats;
1667
+ crafter?: Types.crafter_stats;
1668
+ hauler?: Types.hauler_stats;
1748
1669
  }
1749
- declare function resolveStats(category: ResourceCategory, stats: {
1750
- stat1: number;
1751
- stat2: number;
1752
- stat3: number;
1753
- }): NamedStats;
1670
+ interface EntityState {
1671
+ owner: Name;
1672
+ location: Types.coordinates;
1673
+ energy?: UInt16;
1674
+ cargomass: UInt32;
1675
+ cargo: Types.cargo_item[];
1676
+ }
1677
+ declare function capsHasMovement(caps: EntityCapabilities): boolean;
1678
+ declare function capsHasStorage(caps: EntityCapabilities): boolean;
1679
+ declare function capsHasLoaders(caps: EntityCapabilities): boolean;
1680
+ declare function capsHasGatherer(caps: EntityCapabilities): boolean;
1681
+ declare function capsHasMass(caps: EntityCapabilities): boolean;
1682
+ declare function capsHasHauler(caps: EntityCapabilities): boolean;
1754
1683
 
1755
- interface StackInput {
1756
- quantity: number;
1757
- stats: Record<string, number>;
1684
+ interface HasCargo {
1685
+ cargo: Types.cargo_item[];
1758
1686
  }
1759
- interface CategoryStacks {
1760
- category: ResourceCategory;
1761
- stacks: StackInput[];
1762
- }
1763
- declare function encodeStats(values: number[]): bigint;
1764
- declare function decodeStat(stats: bigint, index: number): number;
1765
- declare function decodeStats(stats: bigint, count: number): number[];
1766
- declare function decodeCraftedItemStats(itemId: number, stats: bigint): Record<string, number>;
1767
- declare function blendStacks(stacks: StackInput[], statKey: string): number;
1768
- declare function blendComponentStacks(stacks: {
1769
- quantity: number;
1770
- stats: Record<string, number>;
1771
- }[]): Record<string, number>;
1772
- declare function computeComponentStats(componentId: number, categoryStacks: CategoryStacks[]): {
1773
- key: string;
1774
- value: number;
1775
- }[];
1776
- declare function computeEntityStats(entityItemIdOrLegacyId: number | string, componentStacks: Record<number, {
1777
- quantity: number;
1778
- stats: Record<string, number>;
1779
- }[]>): {
1780
- key: string;
1781
- value: number;
1782
- }[];
1783
- declare function computeInputMass(itemId: number): number;
1784
- declare function blendCrossGroup(sources: {
1785
- value: number;
1786
- weight: number;
1787
- }[]): number;
1788
- declare function blendCargoStacks(itemId: number, stacks: {
1789
- quantity: number;
1790
- stats: UInt64;
1791
- }[]): UInt64;
1792
- interface RecipeSlotInput {
1793
- itemId: number;
1794
- category: ResourceCategory | undefined;
1795
- stacks: {
1796
- quantity: number;
1797
- stats: bigint;
1798
- }[];
1799
- }
1800
- declare function computeCraftedOutputStats(outputItemId: number, slotInputs: RecipeSlotInput[]): UInt64;
1801
- /**
1802
- * Mirrors the contract's gather-time transform. Takes a deposit's entropy
1803
- * seed (bigint from deriveStratum), derives stats via weibull hashing, and
1804
- * returns a UInt64 whose bit-packed form matches what the contract writes
1805
- * to cargo_item.stats on gather.
1806
- *
1807
- * Use this whenever off-chain code simulates a gather (testmap, player
1808
- * scanners that project cargo outcomes) and needs a value that matches
1809
- * what on-chain cargo would carry.
1810
- */
1811
- declare function encodeGatheredCargoStats(depositSeed: bigint): UInt64;
1812
-
1813
- interface LocationStratum extends DerivedStratum {
1814
- reserveMax: number;
1815
- }
1816
- declare class LocationsManager extends BaseManager {
1817
- hasSystem(location: CoordinatesType): Promise<boolean>;
1818
- findNearbyPlanets(origin: CoordinatesType, maxDistance?: UInt16Type): Promise<Distance[]>;
1819
- getStrata(coords: CoordinatesType): Promise<LocationStratum[]>;
1820
- }
1821
-
1822
- declare class EpochsManager extends BaseManager {
1823
- getCurrentHeight(): Promise<UInt64>;
1824
- getCurrent(): Promise<EpochInfo>;
1825
- getByHeight(height: UInt64Type): Promise<EpochInfo>;
1826
- getTimeRemaining(): Promise<number>;
1827
- getProgress(): Promise<number>;
1828
- fitsInCurrentEpoch(durationMs: number): Promise<boolean>;
1829
- }
1830
-
1831
- type EntityRefInput = {
1832
- entityType: NameType;
1833
- entityId: UInt64Type;
1834
- };
1835
- declare class ActionsManager extends BaseManager {
1836
- travel(shipId: UInt64Type, destination: CoordinatesType, recharge?: boolean): Action;
1837
- grouptravel(entities: EntityRefInput[], destination: CoordinatesType, recharge?: boolean): Action;
1838
- resolve(entityId: UInt64Type, count?: UInt64Type): Action;
1839
- cancel(entityId: UInt64Type, count: UInt64Type): Action;
1840
- recharge(entityId: UInt64Type): Action;
1841
- refrshentity(entityId: UInt64Type): Action;
1842
- transfer(sourceId: UInt64Type, destId: UInt64Type, items: ActionParams.Type.cargo_item[]): Action;
1843
- foundCompany(account: NameType, name: string): Action;
1844
- join(account: NameType): Action;
1845
- gather(sourceId: UInt64Type, destinationId: UInt64Type, stratum: UInt16Type, quantity: UInt32Type): Action;
1846
- warp(entityId: UInt64Type, destination: CoordinatesType): Action;
1847
- craft(entityId: UInt64Type, recipeId: number, quantity: number, inputs: ActionParams.Type.cargo_item[]): Action;
1848
- blend(entityId: UInt64Type, inputs: ActionParams.Type.cargo_item[]): Action;
1849
- deploy(entityId: UInt64Type, ref: ActionParams.Type.cargo_ref): Action;
1850
- addmodule(entityId: UInt64Type, moduleIndex: number, moduleRef: ActionParams.Type.cargo_ref, targetRef?: ActionParams.Type.cargo_ref | null): Action;
1851
- rmmodule(entityId: UInt64Type, moduleIndex: number, targetRef?: ActionParams.Type.cargo_ref | null): Action;
1852
- wrap(owner: NameType, entityId: UInt64Type, nexusId: UInt64Type, items: ActionParams.Type.cargo_item[]): Action;
1853
- undeploy(hostId: UInt64Type, targetId: UInt64Type): Action;
1854
- wrapEntity(entityId: UInt64Type, nexusId: UInt64Type): Action;
1855
- demolish(entityId: UInt64Type): Action;
1856
- joinGame(account: NameType, companyName: string): Action[];
1857
- }
1858
-
1859
- type EntityInfo = Types.entity_info;
1860
- interface BoundingBox {
1861
- min_x: number;
1862
- min_y: number;
1863
- max_x: number;
1864
- max_y: number;
1865
- }
1866
- interface WireCoordinates {
1867
- x: number;
1868
- y: number;
1869
- z?: number;
1870
- }
1871
- type SubscribeMessage = {
1872
- type: 'subscribe';
1873
- sub_id: string;
1874
- bounds?: BoundingBox;
1875
- owner?: string;
1876
- prioritize_owner?: string;
1877
- };
1878
- type UpdateBoundsMessage = {
1879
- type: 'update_bounds';
1880
- sub_id: string;
1881
- bounds: BoundingBox;
1882
- };
1883
- type UnsubscribeMessage = {
1884
- type: 'unsubscribe';
1885
- sub_id: string;
1886
- };
1887
- type SubscribeEntityMessage = {
1888
- type: 'subscribe_entity';
1889
- sub_id: string;
1890
- entity_type: 'ship' | 'warehouse' | 'container' | 'nexus';
1891
- entity_id: string;
1892
- };
1893
- type UnsubscribeEntityMessage = {
1894
- type: 'unsubscribe_entity';
1895
- sub_id: string;
1896
- };
1897
- type SubscribeEventsMessage = {
1898
- type: 'subscribe_events';
1899
- sub_id: string;
1900
- event_filter?: Record<string, unknown>;
1901
- };
1902
- type UnsubscribeEventsMessage = {
1903
- type: 'unsubscribe_events';
1904
- sub_id: string;
1905
- };
1906
- type PingMessage = {
1907
- type: 'ping';
1908
- };
1909
- type ClientMessage = SubscribeMessage | UpdateBoundsMessage | UnsubscribeMessage | SubscribeEntityMessage | UnsubscribeEntityMessage | SubscribeEventsMessage | UnsubscribeEventsMessage | PingMessage;
1910
- type AckMessage = {
1911
- type: 'subscribed' | 'unsubscribed' | 'bounds_updated';
1912
- sub_id: string;
1913
- };
1914
- type WireEntity = Record<string, unknown> & {
1915
- type: number;
1916
- type_name: 'ship' | 'warehouse' | 'container' | 'nexus';
1917
- id: string | number;
1918
- owner: string;
1919
- coordinates: WireCoordinates;
1920
- };
1921
- type SnapshotMessage = {
1922
- type: 'snapshot';
1923
- sub_id: string;
1924
- seq: number;
1925
- entities: WireEntity[];
1926
- truncated?: boolean;
1927
- };
1928
- type UpdateMessage = {
1929
- type: 'update';
1930
- sub_ids: string[];
1931
- entity_id: number;
1932
- entity: WireEntity;
1933
- seq: number;
1934
- };
1935
- type BoundsDeltaMessage = {
1936
- type: 'bounds_delta';
1937
- sub_id: string;
1938
- entered: WireEntity[];
1939
- exited: number[];
1940
- seq: number;
1941
- truncated?: boolean;
1942
- };
1943
- type EventMessage = {
1944
- type: 'event';
1945
- sub_id: string;
1946
- catchup: boolean;
1947
- events: Array<Record<string, unknown>>;
1948
- seq?: number;
1949
- };
1950
- type EventCatchupCompleteMessage = {
1951
- type: 'event_catchup_complete';
1952
- sub_id: string;
1953
- };
1954
- type PongMessage = {
1955
- type: 'pong';
1956
- };
1957
- type ErrorMessage = {
1958
- type: 'error';
1959
- error: string;
1960
- sub_id?: string;
1961
- };
1962
- type ServerMessage = AckMessage | SnapshotMessage | UpdateMessage | BoundsDeltaMessage | EventMessage | EventCatchupCompleteMessage | PongMessage | ErrorMessage;
1963
-
1964
- /**
1965
- * Travel calculations for ship movement, energy usage, and flight times.
1966
- *
1967
- * Functions prefixed with `calc_` are contract-parity functions that mirror
1968
- * the C++ implementation in the server contract (schedule.cpp, ship.cpp).
1969
- * These use snake_case intentionally to match the contract naming convention
1970
- * and signal that they must produce identical results to the on-chain code.
1971
- *
1972
- * Functions prefixed with `calculate` are higher-level SDK helpers that may
1973
- * combine multiple contract calculations for convenience.
1974
- */
1975
-
1976
- declare function calc_orbital_altitude(mass: number): number;
1977
- declare function distanceBetweenCoordinates(origin: ActionParams.Type.coordinates, destination: ActionParams.Type.coordinates): UInt64;
1978
- declare function distanceBetweenPoints(x1: Int64Type, y1: Int64Type, x2: Int64Type, y2: Int64Type): UInt64;
1979
- declare function lerp(origin: ActionParams.Type.coordinates, destination: ActionParams.Type.coordinates, time: number): ActionParams.Type.coordinates;
1980
- interface FloatPosition {
1981
- x: number;
1982
- y: number;
1983
- }
1984
- declare function easeFlightProgress(t: number): number;
1985
- declare function flightSpeedFactor(t: number): number;
1986
- declare function interpolateFlightPosition(origin: {
1987
- x: Int64Type | number;
1988
- y: Int64Type | number;
1989
- }, destination: {
1990
- x: Int64Type | number;
1991
- y: Int64Type | number;
1992
- }, taskProgress: number, options?: {
1993
- easing?: 'physics' | 'linear';
1994
- }): FloatPosition;
1995
- declare function getInterpolatedPosition(entity: HasScheduleAndLocation, taskIndex: number, taskProgress: number): FloatPosition;
1996
- declare function rotation(origin: ActionParams.Type.coordinates, destination: ActionParams.Type.coordinates): number;
1997
- declare function findNearbyPlanets(seed: Checksum256, origin: ActionParams.Type.coordinates, maxDistance?: UInt64Type): Distance[];
1998
- declare function calc_rechargetime(capacity: UInt32Type, energy: UInt32Type, recharge: UInt32Type): UInt32;
1999
- declare function calc_ship_rechargetime(ship: ShipLike): UInt32;
2000
- declare function calc_flighttime(distance: UInt64Type, acceleration: number): UInt32;
2001
- declare function calc_loader_flighttime(ship: ShipLike, mass: UInt64, altitude?: number): UInt32;
2002
- declare function calc_loader_acceleration(ship: ShipLike, mass: UInt64): number;
2003
- declare function calc_ship_flighttime(ship: ShipLike, mass: UInt64, distance: UInt64): UInt32;
2004
- declare function calc_ship_acceleration(ship: ShipLike, mass: UInt64): number;
2005
- declare function calc_acceleration(thrust: number, mass: number): number;
2006
- declare function calc_ship_mass(ship: ShipLike, cargos: CargoMassInfo[]): UInt64;
2007
- declare function calc_energyusage(distance: UInt64Type, drain: UInt32Type): UInt32;
2008
- declare function calculateTransferTime(ship: ShipLike, cargos: CargoMassInfo[], quantities?: Map<number, number>): UInt32;
2009
- declare function calculateRefuelingTime(ship: ShipLike): UInt32;
2010
- declare function calculateFlightTime(ship: ShipLike, cargos: CargoMassInfo[], distance: UInt64Type): UInt32;
2011
- interface LoadTimeBreakdown {
2012
- unloadTime: number;
2013
- loadTime: number;
2014
- totalTime: number;
2015
- unloadMass: number;
2016
- loadMass: number;
2017
- }
2018
- declare function calculateLoadTimeBreakdown(ship: ShipLike, cargos: CargoMassInfo[], loadQuantities?: Map<number, number>, unloadQuantities?: Map<number, number>): LoadTimeBreakdown;
2019
- interface EstimatedTravelTime {
2020
- flightTime: UInt32;
2021
- rechargeTime: UInt32;
2022
- loadTime: UInt32;
2023
- unloadTime: UInt32;
2024
- total: UInt32;
2025
- }
2026
- interface EstimateTravelTimeOptions {
2027
- needsRecharge?: boolean;
2028
- loadMass?: UInt32Type;
2029
- unloadMass?: UInt32Type;
2030
- }
2031
- declare function estimateTravelTime(ship: ShipLike, travelMass: UInt64Type, distance: UInt64Type, options?: EstimateTravelTimeOptions): EstimatedTravelTime;
2032
- declare function estimateDealTravelTime(ship: ShipLike, shipMass: UInt64Type, distance: UInt64Type, loadMass: UInt32Type): UInt32;
2033
- declare function hasEnergyForDistance(ship: ShipLike, distance: UInt64Type): boolean;
2034
- interface TransferEntity {
2035
- location: {
2036
- z?: {
2037
- toNumber(): number;
2038
- } | number;
2039
- };
2040
- loaders?: {
2041
- thrust: {
2042
- toNumber(): number;
2043
- } | number;
2044
- mass: {
2045
- toNumber(): number;
2046
- } | number;
2047
- quantity: {
2048
- toNumber(): number;
2049
- } | number;
2050
- };
2051
- }
2052
- interface HasScheduleAndLocation {
2053
- coordinates: ActionParams.Type.coordinates;
2054
- schedule?: Types.schedule;
2055
- }
2056
- declare function getFlightOrigin(entity: HasScheduleAndLocation, flightTaskIndex: number): ActionParams.Type.coordinates;
2057
- declare function getDestinationLocation(entity: HasScheduleAndLocation): ActionParams.Type.coordinates | undefined;
2058
- /** Returns chain-tile coordinates (rounded). For visual position use getInterpolatedPosition. */
2059
- declare function getPositionAt(entity: HasScheduleAndLocation, taskIndex: number, taskProgress: number): ActionParams.Type.coordinates;
2060
- declare function calc_transfer_duration(source: TransferEntity, dest: TransferEntity, cargoMass: number): number;
2061
-
2062
- interface MovementCapability {
2063
- engines: Types.movement_stats;
2064
- generator: Types.energy_stats;
2065
- }
2066
- interface EnergyCapability {
2067
- energy: UInt16;
2068
- }
2069
- interface StorageCapability {
2070
- capacity: UInt32;
2071
- cargomass: UInt32;
2072
- cargo: Types.cargo_item[];
2073
- }
2074
- interface LoaderCapability {
2075
- loaders: Types.loader_stats;
2076
- }
2077
- interface GathererCapability {
2078
- gatherer: Types.gatherer_stats;
2079
- }
2080
- interface MassCapability {
2081
- hullmass: UInt32;
2082
- }
2083
- interface ScheduleCapability {
2084
- schedule?: Types.schedule;
2085
- }
2086
- interface EntityCapabilities {
2087
- hullmass?: UInt32;
2088
- capacity?: UInt32;
2089
- engines?: Types.movement_stats;
2090
- generator?: Types.energy_stats;
2091
- loaders?: Types.loader_stats;
2092
- gatherer?: Types.gatherer_stats;
2093
- crafter?: Types.crafter_stats;
2094
- hauler?: Types.hauler_stats;
2095
- }
2096
- interface EntityState {
2097
- owner: Name;
2098
- location: Types.coordinates;
2099
- energy?: UInt16;
2100
- cargomass: UInt32;
2101
- cargo: Types.cargo_item[];
2102
- }
2103
- declare function capsHasMovement(caps: EntityCapabilities): boolean;
2104
- declare function capsHasStorage(caps: EntityCapabilities): boolean;
2105
- declare function capsHasLoaders(caps: EntityCapabilities): boolean;
2106
- declare function capsHasGatherer(caps: EntityCapabilities): boolean;
2107
- declare function capsHasMass(caps: EntityCapabilities): boolean;
2108
- declare function capsHasHauler(caps: EntityCapabilities): boolean;
2109
-
2110
- interface HasCargo {
2111
- cargo: Types.cargo_item[];
2112
- }
2113
- interface HasCapacity {
2114
- capacity: UInt32;
1687
+ interface HasCapacity {
1688
+ capacity: UInt32;
2115
1689
  }
2116
1690
  interface HasCargomass {
2117
1691
  cargomass: UInt32;
@@ -2143,6 +1717,36 @@ declare function stacksEqual(a: CargoStack, b: CargoStack): boolean;
2143
1717
  declare function mergeStacks(stacks: CargoStack[], add: CargoStack): CargoStack[];
2144
1718
  declare function removeFromStacks(stacks: CargoStack[], remove: CargoStack): CargoStack[];
2145
1719
 
1720
+ declare class InventoryAccessor {
1721
+ private readonly entity;
1722
+ private _items?;
1723
+ constructor(entity: HasCargo);
1724
+ get items(): EntityInventory[];
1725
+ get totalMass(): UInt64;
1726
+ forItem(goodId: UInt64Type): EntityInventory | undefined;
1727
+ get sellable(): EntityInventory[];
1728
+ get hasSellable(): boolean;
1729
+ get sellableCount(): number;
1730
+ }
1731
+ declare function createInventoryAccessor(entity: HasCargo): InventoryAccessor;
1732
+
1733
+ declare class Location {
1734
+ readonly coordinates: Coordinates;
1735
+ private _gameSeed?;
1736
+ private _hasSystem?;
1737
+ private _epoch?;
1738
+ constructor(coordinates: CoordinatesType);
1739
+ static from(coordinates: CoordinatesType): Location;
1740
+ hasSystemAt(gameSeed: Checksum256Type): boolean;
1741
+ getLocationTypeAt(gameSeed: Checksum256Type): LocationType;
1742
+ isGatherableAt(gameSeed: Checksum256Type): boolean;
1743
+ findNearby(gameSeed: Checksum256Type, maxDistance?: UInt16Type): Distance[];
1744
+ equals(other: CoordinatesType | Location): boolean;
1745
+ get epoch(): UInt64 | undefined;
1746
+ clearCache(): void;
1747
+ }
1748
+ declare function toLocation(coords: CoordinatesType | Location): Location;
1749
+
2146
1750
  type Schedule = Types.schedule;
2147
1751
  type Task$1 = Types.task;
2148
1752
  interface ScheduleData {
@@ -2248,292 +1852,446 @@ declare namespace schedule {
2248
1852
  };
2249
1853
  }
2250
1854
 
2251
- interface ProjectedEntity {
2252
- location: Coordinates;
2253
- energy: UInt16;
2254
- cargo: CargoStack[];
2255
- shipMass: UInt32;
2256
- capacity?: UInt64;
2257
- engines?: Types.movement_stats;
2258
- loaders?: Types.loader_stats;
2259
- generator?: Types.energy_stats;
2260
- hauler?: Types.hauler_stats;
2261
- readonly cargoMass: UInt64;
2262
- readonly totalMass: UInt64;
2263
- hasMovement(): boolean;
2264
- hasStorage(): boolean;
2265
- hasLoaders(): boolean;
2266
- capabilities(): EntityCapabilities;
2267
- state(): EntityState;
1855
+ type Task = Types.task;
1856
+ declare class ScheduleAccessor {
1857
+ private entity;
1858
+ constructor(entity: ScheduleData);
1859
+ get hasSchedule(): boolean;
1860
+ get isIdle(): boolean;
1861
+ get tasks(): Task[];
1862
+ duration(): number;
1863
+ elapsed(now: Date): number;
1864
+ remaining(now: Date): number;
1865
+ complete(now: Date): boolean;
1866
+ currentTaskIndex(now: Date): number;
1867
+ currentTask(now: Date): Task | undefined;
1868
+ currentTaskType(now: Date): TaskType | undefined;
1869
+ taskStartTime(index: number): number;
1870
+ taskElapsed(index: number, now: Date): number;
1871
+ taskRemaining(index: number, now: Date): number;
1872
+ taskComplete(index: number, now: Date): boolean;
1873
+ taskInProgress(index: number, now: Date): boolean;
1874
+ currentTaskProgress(now: Date): number;
1875
+ currentTaskProgressFloat(now: Date): number;
1876
+ progress(now: Date): number;
2268
1877
  }
2269
- interface Projectable extends ScheduleData {
2270
- coordinates: Coordinates | Types.coordinates;
2271
- energy?: UInt16;
2272
- hullmass?: UInt32;
2273
- generator?: Types.energy_stats;
2274
- engines?: Types.movement_stats;
2275
- loaders?: Types.loader_stats;
2276
- hauler?: Types.hauler_stats;
2277
- capacity?: UInt32;
2278
- cargo: Types.cargo_item[];
2279
- cargomass: UInt32;
2280
- owner?: Name;
1878
+ declare function createScheduleAccessor(entity: ScheduleData): ScheduleAccessor;
1879
+
1880
+ declare class Entity$1 extends Types.entity_info {
1881
+ private _sched?;
1882
+ private _inv?;
1883
+ get name(): string;
1884
+ get location(): Location;
1885
+ get isIdle(): boolean;
1886
+ get sched(): ScheduleAccessor;
1887
+ get inv(): InventoryAccessor;
1888
+ get inventory(): EntityInventory[];
1889
+ get totalCargoMass(): UInt64;
1890
+ get maxCapacity(): UInt64;
1891
+ get availableCapacity(): UInt64;
1892
+ get isFull(): boolean;
1893
+ get totalMass(): UInt64;
1894
+ get entityClass(): EntityClass;
1895
+ get canWrap(): boolean;
1896
+ get canUndeploy(): boolean;
1897
+ get canDemolish(): boolean;
1898
+ get canUseModules(): boolean;
1899
+ isLoading(now: Date): boolean;
1900
+ isUnloading(now: Date): boolean;
2281
1901
  }
2282
- declare function createProjectedEntity(entity: Projectable): ProjectedEntity;
2283
- interface ProjectionOptions {
2284
- upToTaskIndex?: number;
1902
+
1903
+ interface EpochInfo {
1904
+ epoch: UInt64;
1905
+ start: Date;
1906
+ end: Date;
2285
1907
  }
2286
- declare function projectEntity(entity: Projectable, options?: ProjectionOptions): ProjectedEntity;
2287
- interface ProjectableSnapshot extends Projectable {
2288
- current_task?: Types.task;
2289
- pending_tasks?: Types.task[];
1908
+ declare function getCurrentEpoch(game: Types$1.game_row): UInt64;
1909
+ declare function getEpochInfo(game: Types$1.game_row, epoch: UInt64): EpochInfo;
1910
+
1911
+ /**
1912
+ * GameState class extends the state_row from the server contract
1913
+ * with helper methods for epoch management and system generation
1914
+ */
1915
+ declare class GameState extends Types.state_row {
1916
+ private _game?;
1917
+ /**
1918
+ * Create a GameState instance from a state_row
1919
+ */
1920
+ static from(state: Types.state_row, game?: Types$1.game_row): GameState;
1921
+ /**
1922
+ * Set the game configuration (needed for epoch calculations)
1923
+ */
1924
+ setGame(game: Types$1.game_row): void;
1925
+ /**
1926
+ * Get the current epoch number from the state
1927
+ */
1928
+ get currentEpoch(): UInt64;
1929
+ /**
1930
+ * Get the epoch seed (used for market pricing and system generation)
1931
+ */
1932
+ get epochSeed(): Checksum256;
1933
+ /**
1934
+ * Get the game seed (from game config, if available)
1935
+ */
1936
+ get gameSeed(): Checksum256 | undefined;
1937
+ /**
1938
+ * Check if the game is currently enabled
1939
+ */
1940
+ get isEnabled(): boolean;
1941
+ /**
1942
+ * Get the current salt value (used for random number generation)
1943
+ */
1944
+ get currentSalt(): UInt64;
1945
+ /**
1946
+ * Get the commit hash for the next epoch
1947
+ */
1948
+ get nextEpochCommit(): Checksum256;
1949
+ /**
1950
+ * Calculate the current epoch from game config (if game is set)
1951
+ * This might differ from state.epoch if the blockchain hasn't advanced yet
1952
+ */
1953
+ get calculatedCurrentEpoch(): UInt64 | undefined;
1954
+ /**
1955
+ * Get epoch info (start/end times) for the current epoch
1956
+ */
1957
+ get currentEpochInfo(): EpochInfo | undefined;
1958
+ /**
1959
+ * Get epoch info for a specific epoch number
1960
+ */
1961
+ getEpochInfo(epoch: UInt64): EpochInfo | undefined;
1962
+ /**
1963
+ * Check if a system exists at given coordinates
1964
+ * Requires game seed from game config
1965
+ */
1966
+ hasSystemAt(x: number, y: number): boolean;
1967
+ /**
1968
+ * Check if a system exists at coordinates object
1969
+ */
1970
+ hasSystemAtCoords(coords: Types.coordinates): boolean;
1971
+ /**
1972
+ * Get a summary of the game state
1973
+ */
1974
+ get summary(): {
1975
+ enabled: boolean;
1976
+ epoch: string;
1977
+ hasSeed: boolean;
1978
+ hasCommit: boolean;
1979
+ };
2290
1980
  }
2291
- declare function projectFromCurrentState(snapshot: ProjectableSnapshot): ProjectedEntity;
2292
- declare function validateSchedule(entity: Projectable): void;
2293
- declare function projectEntityAt(entity: Projectable, now: Date): ProjectedEntity;
2294
- declare function projectFromCurrentStateAt(snapshot: ProjectableSnapshot, now: Date): ProjectedEntity;
2295
1981
 
2296
- declare class Location {
2297
- readonly coordinates: Coordinates;
2298
- private _gameSeed?;
2299
- private _hasSystem?;
2300
- private _epoch?;
2301
- constructor(coordinates: CoordinatesType);
2302
- static from(coordinates: CoordinatesType): Location;
2303
- hasSystemAt(gameSeed: Checksum256Type): boolean;
2304
- getLocationTypeAt(gameSeed: Checksum256Type): LocationType;
2305
- isGatherableAt(gameSeed: Checksum256Type): boolean;
2306
- findNearby(gameSeed: Checksum256Type, maxDistance?: UInt16Type): Distance[];
2307
- equals(other: CoordinatesType | Location): boolean;
2308
- get epoch(): UInt64 | undefined;
2309
- clearCache(): void;
1982
+ interface PlayerStateInput {
1983
+ owner: NameType;
1984
+ }
1985
+ declare class Player extends Types.player_row {
1986
+ static fromState(state: PlayerStateInput): Player;
1987
+ }
1988
+
1989
+ declare class PlayersManager extends BaseManager {
1990
+ getPlayer(account: NameType): Promise<Player | undefined>;
1991
+ }
1992
+
1993
+ interface StratumInfo {
1994
+ itemId: number;
1995
+ seed: bigint;
1996
+ richness: number;
1997
+ reserve: number;
1998
+ }
1999
+ interface ResourceStats {
2000
+ stat1: number;
2001
+ stat2: number;
2002
+ stat3: number;
2003
+ }
2004
+ declare function deriveStratum(epochSeed: Checksum256Type, coords: CoordinatesType, stratum: number, locationType: number, subtype: number, _maxDepth: number): StratumInfo;
2005
+ /**
2006
+ * Derives the three stat values for a raw resource from a deposit's
2007
+ * entropy seed (hash-based, weibull-transformed).
2008
+ *
2009
+ * **Use only on deposit seeds** — the bigint returned by `deriveStratum`
2010
+ * or carried on a `MassDeposit`. Do NOT call this on a cargo item's
2011
+ * `stats` field; cargo stats are bit-packed and must be read via
2012
+ * `decodeStat` (or `decodeStackStats` for category-mapped output).
2013
+ *
2014
+ * Passing a cargo `stats` value here produces meaningless output
2015
+ * (hash of the packed bits, unrelated to the actual stats).
2016
+ */
2017
+ declare function deriveResourceStats(seed: bigint): ResourceStats;
2018
+
2019
+ interface DerivedStratum {
2020
+ index: number;
2021
+ itemId: number;
2022
+ seed: bigint;
2023
+ richness: number;
2024
+ reserve: number;
2025
+ stats: ResourceStats;
2310
2026
  }
2311
- declare function toLocation(coords: CoordinatesType | Location): Location;
2027
+ declare function deriveStrata(coords: CoordinatesType, gameSeed: Checksum256Type, epochSeed: Checksum256Type): DerivedStratum[];
2312
2028
 
2313
- type Task = Types.task;
2314
- declare class ScheduleAccessor {
2315
- private entity;
2316
- constructor(entity: ScheduleData);
2317
- get hasSchedule(): boolean;
2318
- get isIdle(): boolean;
2319
- get tasks(): Task[];
2320
- duration(): number;
2321
- elapsed(now: Date): number;
2322
- remaining(now: Date): number;
2323
- complete(now: Date): boolean;
2324
- currentTaskIndex(now: Date): number;
2325
- currentTask(now: Date): Task | undefined;
2326
- currentTaskType(now: Date): TaskType | undefined;
2327
- taskStartTime(index: number): number;
2328
- taskElapsed(index: number, now: Date): number;
2329
- taskRemaining(index: number, now: Date): number;
2330
- taskComplete(index: number, now: Date): boolean;
2331
- taskInProgress(index: number, now: Date): boolean;
2332
- currentTaskProgress(now: Date): number;
2333
- currentTaskProgressFloat(now: Date): number;
2334
- progress(now: Date): number;
2029
+ declare function deriveLocationSize(loc: Types.location_static): number;
2030
+
2031
+ declare const DEPTH_THRESHOLD_T1 = 0;
2032
+ declare const DEPTH_THRESHOLD_T2 = 1500;
2033
+ declare const DEPTH_THRESHOLD_T3 = 5000;
2034
+ declare const DEPTH_THRESHOLD_T4 = 12000;
2035
+ declare const DEPTH_THRESHOLD_T5 = 22000;
2036
+ declare const LOCATION_MIN_DEPTH = 500;
2037
+ declare const LOCATION_MAX_DEPTH = 65535;
2038
+ declare const PLANET_SUBTYPE_GAS_GIANT = 0;
2039
+ declare const PLANET_SUBTYPE_ROCKY = 1;
2040
+ declare const PLANET_SUBTYPE_TERRESTRIAL = 2;
2041
+ declare const PLANET_SUBTYPE_ICY = 3;
2042
+ declare const PLANET_SUBTYPE_OCEAN = 4;
2043
+ declare const PLANET_SUBTYPE_INDUSTRIAL = 5;
2044
+ declare function getDepthThreshold(tier: number): number;
2045
+ declare function getResourceTier(itemId: number): number;
2046
+ declare function getResourceWeight(itemId: number, stratum: number): number;
2047
+ interface LocationProfileEntry {
2048
+ category: number;
2049
+ maxTier: number;
2335
2050
  }
2336
- declare function createScheduleAccessor(entity: ScheduleData): ScheduleAccessor;
2051
+ declare function getLocationProfile(locationType: number, subtype: number): LocationProfileEntry[];
2052
+ declare function getLocationCandidates(locationType: number, subtype: number): number[];
2053
+ declare function getEligibleResources(locationType: number, subtype: number, stratum: number): number[];
2337
2054
 
2338
- declare class EntityInventory extends Types.cargo_item {
2339
- private _item?;
2340
- get item(): Item;
2341
- get good(): Item;
2342
- get name(): string;
2343
- get unitMass(): UInt32;
2344
- get totalMass(): UInt64;
2345
- get hasCargo(): boolean;
2346
- get isEmpty(): boolean;
2055
+ type ReserveTier = 'small' | 'medium' | 'large' | 'massive' | 'motherlode';
2056
+ interface TierRange {
2057
+ min: number;
2058
+ max: number;
2347
2059
  }
2060
+ declare const RESERVE_TIERS: Record<ReserveTier, TierRange>;
2061
+ declare const TIER_ROLL_MAX = 65536;
2062
+ declare function rollTier(tierRoll: number, stratum: number): ReserveTier;
2063
+ declare function rollWithinTier(withinRoll: number, range: TierRange): number;
2348
2064
 
2349
- declare class InventoryAccessor {
2350
- private readonly entity;
2351
- private _items?;
2352
- constructor(entity: HasCargo);
2353
- get items(): EntityInventory[];
2354
- get totalMass(): UInt64;
2355
- forItem(goodId: UInt64Type): EntityInventory | undefined;
2356
- get sellable(): EntityInventory[];
2357
- get hasSellable(): boolean;
2358
- get sellableCount(): number;
2065
+ interface StatDefinition {
2066
+ key: string;
2067
+ label: string;
2068
+ abbreviation: string;
2069
+ purpose: string;
2070
+ inverted?: boolean;
2359
2071
  }
2360
- declare function createInventoryAccessor(entity: HasCargo): InventoryAccessor;
2072
+ declare function getStatDefinitions(category: ResourceCategory): StatDefinition[];
2073
+ declare function getStatName(category: ResourceCategory, index: 0 | 1 | 2): StatDefinition;
2074
+ interface NamedStats {
2075
+ definitions: StatDefinition[];
2076
+ values: [number, number, number];
2077
+ }
2078
+ declare function resolveStats(category: ResourceCategory, stats: {
2079
+ stat1: number;
2080
+ stat2: number;
2081
+ stat3: number;
2082
+ }): NamedStats;
2361
2083
 
2362
- interface PackedModuleInput {
2363
- itemId: UInt16Type;
2364
- stats: UInt64Type;
2084
+ interface StackInput {
2085
+ quantity: number;
2086
+ stats: Record<string, number>;
2365
2087
  }
2366
- interface ShipStateInput {
2367
- id: UInt64Type;
2368
- owner: string;
2369
- name: string;
2370
- coordinates: CoordinatesType | {
2371
- x: number;
2372
- y: number;
2373
- z?: number;
2374
- };
2375
- hullmass?: number;
2376
- capacity?: number;
2377
- energy?: number;
2378
- modules?: PackedModuleInput[];
2379
- schedule?: Types.schedule;
2380
- cargo?: Types.cargo_item[];
2088
+ interface CategoryStacks {
2089
+ category: ResourceCategory;
2090
+ stacks: StackInput[];
2381
2091
  }
2382
- declare class Ship extends Types.entity_info {
2383
- private _sched?;
2384
- private _inv?;
2385
- get name(): string;
2386
- get entityClass(): 'orbital';
2387
- get canUndeploy(): boolean;
2388
- get inv(): InventoryAccessor;
2389
- get inventory(): EntityInventory[];
2390
- get sched(): ScheduleAccessor;
2391
- get maxDistance(): UInt32;
2392
- get isIdle(): boolean;
2393
- getFlightOrigin(flightTaskIndex: number): Coordinates;
2394
- destinationLocation(): Coordinates | undefined;
2395
- /** Chain-tile coordinates at `now`. For smooth visual position use interpolatedPositionAt. */
2396
- positionAt(now: Date): Coordinates;
2397
- interpolatedPositionAt(now: Date): FloatPosition;
2398
- isInFlight(now: Date): boolean;
2399
- isRecharging(now: Date): boolean;
2400
- isLoading(now: Date): boolean;
2401
- isUnloading(now: Date): boolean;
2402
- isGathering(now: Date): boolean;
2403
- get hasEngines(): boolean;
2404
- get hasGenerator(): boolean;
2405
- get hasGatherer(): boolean;
2406
- get hasWarp(): boolean;
2407
- project(): ProjectedEntity;
2408
- projectAt(now: Date): ProjectedEntity;
2409
- get location(): Location;
2410
- get totalCargoMass(): UInt64;
2411
- get totalMass(): UInt64;
2412
- get maxCapacity(): UInt64;
2413
- hasSpace(goodMass: UInt64, quantity: number): boolean;
2414
- get availableCapacity(): UInt64;
2415
- getCargoForItem(goodId: UInt64Type): EntityInventory | undefined;
2416
- get sellableCargo(): EntityInventory[];
2417
- get hasSellableCargo(): boolean;
2418
- get sellableGoodsCount(): number;
2419
- get isFull(): boolean;
2420
- get energyPercent(): number;
2421
- get needsRecharge(): boolean;
2422
- hasEnergyFor(distance: UInt64): boolean;
2092
+ declare function encodeStats(values: number[]): bigint;
2093
+ declare function decodeStat(stats: bigint, index: number): number;
2094
+ declare function decodeStats(stats: bigint, count: number): number[];
2095
+ declare function decodeCraftedItemStats(itemId: number, stats: bigint): Record<string, number>;
2096
+ declare function blendStacks(stacks: StackInput[], statKey: string): number;
2097
+ declare function blendComponentStacks(stacks: {
2098
+ quantity: number;
2099
+ stats: Record<string, number>;
2100
+ }[]): Record<string, number>;
2101
+ declare function computeComponentStats(componentId: number, categoryStacks: CategoryStacks[]): {
2102
+ key: string;
2103
+ value: number;
2104
+ }[];
2105
+ declare function computeEntityStats(entityItemIdOrLegacyId: number | string, componentStacks: Record<number, {
2106
+ quantity: number;
2107
+ stats: Record<string, number>;
2108
+ }[]>): {
2109
+ key: string;
2110
+ value: number;
2111
+ }[];
2112
+ declare function computeInputMass(itemId: number): number;
2113
+ declare function blendCrossGroup(sources: {
2114
+ value: number;
2115
+ weight: number;
2116
+ }[]): number;
2117
+ declare function blendCargoStacks(itemId: number, stacks: {
2118
+ quantity: number;
2119
+ stats: UInt64;
2120
+ }[]): UInt64;
2121
+ interface RecipeSlotInput {
2122
+ itemId: number;
2123
+ category: ResourceCategory | undefined;
2124
+ stacks: {
2125
+ quantity: number;
2126
+ stats: bigint;
2127
+ }[];
2423
2128
  }
2129
+ declare function computeCraftedOutputStats(outputItemId: number, slotInputs: RecipeSlotInput[]): UInt64;
2130
+ /**
2131
+ * Mirrors the contract's gather-time transform. Takes a deposit's entropy
2132
+ * seed (bigint from deriveStratum), derives stats via weibull hashing, and
2133
+ * returns a UInt64 whose bit-packed form matches what the contract writes
2134
+ * to cargo_item.stats on gather.
2135
+ *
2136
+ * Use this whenever off-chain code simulates a gather (webapp, player
2137
+ * scanners that project cargo outcomes) and needs a value that matches
2138
+ * what on-chain cargo would carry.
2139
+ */
2140
+ declare function encodeGatheredCargoStats(depositSeed: bigint): UInt64;
2424
2141
 
2425
- interface InstalledModule {
2426
- slotIndex: number;
2427
- itemId: number;
2428
- stats: bigint;
2142
+ interface LocationStratum extends DerivedStratum {
2143
+ reserveMax: number;
2144
+ }
2145
+ declare class LocationsManager extends BaseManager {
2146
+ hasSystem(location: CoordinatesType): Promise<boolean>;
2147
+ findNearbyPlanets(origin: CoordinatesType, maxDistance?: UInt16Type): Promise<Distance[]>;
2148
+ getStrata(coords: CoordinatesType): Promise<LocationStratum[]>;
2429
2149
  }
2430
2150
 
2431
- interface WarehouseStateInput {
2432
- id: UInt64Type;
2433
- owner: string;
2434
- name: string;
2435
- coordinates: CoordinatesType | {
2436
- x: number;
2437
- y: number;
2438
- z?: number;
2439
- };
2440
- hullmass?: number;
2441
- capacity: number;
2442
- modules?: PackedModuleInput[];
2443
- schedule?: Types.schedule;
2444
- cargo?: Types.cargo_item[];
2151
+ declare class EpochsManager extends BaseManager {
2152
+ getCurrentHeight(): Promise<UInt64>;
2153
+ getCurrent(): Promise<EpochInfo>;
2154
+ getByHeight(height: UInt64Type): Promise<EpochInfo>;
2155
+ getTimeRemaining(): Promise<number>;
2156
+ getProgress(): Promise<number>;
2157
+ fitsInCurrentEpoch(durationMs: number): Promise<boolean>;
2445
2158
  }
2446
- declare class Warehouse extends Types.entity_info {
2447
- private _sched?;
2448
- private _inv?;
2449
- get name(): string;
2450
- get entityClass(): 'planetary';
2451
- get canDemolish(): boolean;
2452
- get inv(): InventoryAccessor;
2453
- get inventory(): EntityInventory[];
2454
- get sched(): ScheduleAccessor;
2455
- get isIdle(): boolean;
2456
- isLoading(now: Date): boolean;
2457
- isUnloading(now: Date): boolean;
2458
- get location(): Location;
2459
- get totalCargoMass(): UInt64;
2460
- get maxCapacity(): UInt64;
2461
- get availableCapacity(): UInt64;
2462
- hasSpace(goodMass: UInt64, quantity: number): boolean;
2463
- get isFull(): boolean;
2464
- getCargoForItem(goodId: UInt64Type): EntityInventory | undefined;
2465
- get orbitalAltitude(): number;
2466
- get totalMass(): UInt64;
2159
+
2160
+ type EntityRefInput = {
2161
+ entityType: NameType;
2162
+ entityId: UInt64Type;
2163
+ };
2164
+ declare class ActionsManager extends BaseManager {
2165
+ travel(shipId: UInt64Type, destination: CoordinatesType, recharge?: boolean): Action;
2166
+ grouptravel(entities: EntityRefInput[], destination: CoordinatesType, recharge?: boolean): Action;
2167
+ resolve(entityId: UInt64Type, count?: UInt64Type): Action;
2168
+ cancel(entityId: UInt64Type, count: UInt64Type): Action;
2169
+ recharge(entityId: UInt64Type): Action;
2170
+ refrshentity(entityId: UInt64Type): Action;
2171
+ transfer(sourceId: UInt64Type, destId: UInt64Type, items: ActionParams.Type.cargo_item[]): Action;
2172
+ foundCompany(account: NameType, name: string): Action;
2173
+ join(account: NameType): Action;
2174
+ gather(sourceId: UInt64Type, destinationId: UInt64Type, stratum: UInt16Type, quantity: UInt32Type): Action;
2175
+ warp(entityId: UInt64Type, destination: CoordinatesType): Action;
2176
+ craft(entityId: UInt64Type, recipeId: number, quantity: number, inputs: ActionParams.Type.cargo_item[]): Action;
2177
+ blend(entityId: UInt64Type, inputs: ActionParams.Type.cargo_item[]): Action;
2178
+ deploy(entityId: UInt64Type, ref: ActionParams.Type.cargo_ref): Action;
2179
+ addmodule(entityId: UInt64Type, moduleIndex: number, moduleRef: ActionParams.Type.cargo_ref, targetRef?: ActionParams.Type.cargo_ref | null): Action;
2180
+ rmmodule(entityId: UInt64Type, moduleIndex: number, targetRef?: ActionParams.Type.cargo_ref | null): Action;
2181
+ wrap(owner: NameType, entityId: UInt64Type, nexusId: UInt64Type, items: ActionParams.Type.cargo_item[]): Action;
2182
+ undeploy(hostId: UInt64Type, targetId: UInt64Type): Action;
2183
+ wrapEntity(entityId: UInt64Type, nexusId: UInt64Type): Action;
2184
+ demolish(entityId: UInt64Type): Action;
2185
+ joinGame(account: NameType, companyName: string): Action[];
2467
2186
  }
2468
- declare function computeWarehouseCapabilities(modules: InstalledModule[], layout: EntitySlot[]): {
2469
- loaders?: {
2470
- mass: number;
2471
- thrust: number;
2472
- quantity: number;
2473
- };
2474
- };
2475
2187
 
2476
- interface ContainerStateInput {
2477
- id: UInt64Type;
2478
- owner: string;
2479
- name: string;
2480
- coordinates: CoordinatesType | {
2481
- x: number;
2482
- y: number;
2483
- z?: number;
2484
- };
2485
- hullmass: number;
2486
- capacity: number;
2487
- cargomass?: number;
2488
- cargo?: Types.cargo_item[];
2489
- schedule?: Types.schedule;
2188
+ type EntityInfo = Types.entity_info;
2189
+ interface BoundingBox {
2190
+ min_x: number;
2191
+ min_y: number;
2192
+ max_x: number;
2193
+ max_y: number;
2490
2194
  }
2491
- declare class Container extends Types.entity_info {
2492
- private _sched?;
2493
- get name(): string;
2494
- get entityClass(): 'orbital';
2495
- get canUndeploy(): boolean;
2496
- get sched(): ScheduleAccessor;
2497
- get isIdle(): boolean;
2498
- interpolatedPositionAt(now: Date): FloatPosition;
2499
- isLoading(now: Date): boolean;
2500
- isUnloading(now: Date): boolean;
2501
- get location(): Location;
2502
- get totalMass(): UInt64;
2503
- get maxCapacity(): UInt64;
2504
- get availableCapacity(): UInt64;
2505
- hasSpace(additionalMass: UInt64): boolean;
2506
- get isFull(): boolean;
2507
- get orbitalAltitude(): number;
2195
+ interface WireCoordinates {
2196
+ x: number;
2197
+ y: number;
2198
+ z?: number;
2508
2199
  }
2509
- declare function computeContainerCapabilities(stats: Record<string, number>): {
2510
- hullmass: number;
2511
- capacity: number;
2200
+ type SubscribeMessage = {
2201
+ type: 'subscribe';
2202
+ sub_id: string;
2203
+ bounds?: BoundingBox;
2204
+ owner?: string;
2205
+ prioritize_owner?: string;
2512
2206
  };
2513
- declare function computeContainerT2Capabilities(stats: Record<string, number>): {
2514
- hullmass: number;
2515
- capacity: number;
2207
+ type UpdateBoundsMessage = {
2208
+ type: 'update_bounds';
2209
+ sub_id: string;
2210
+ bounds: BoundingBox;
2516
2211
  };
2517
-
2518
- interface NexusStateInput {
2519
- id: UInt64Type;
2212
+ type UnsubscribeMessage = {
2213
+ type: 'unsubscribe';
2214
+ sub_id: string;
2215
+ };
2216
+ type SubscribeEntityMessage = {
2217
+ type: 'subscribe_entity';
2218
+ sub_id: string;
2219
+ entity_type: 'ship' | 'warehouse' | 'container' | 'nexus';
2220
+ entity_id: string;
2221
+ };
2222
+ type UnsubscribeEntityMessage = {
2223
+ type: 'unsubscribe_entity';
2224
+ sub_id: string;
2225
+ };
2226
+ type SubscribeEventsMessage = {
2227
+ type: 'subscribe_events';
2228
+ sub_id: string;
2229
+ event_filter?: Record<string, unknown>;
2230
+ };
2231
+ type UnsubscribeEventsMessage = {
2232
+ type: 'unsubscribe_events';
2233
+ sub_id: string;
2234
+ };
2235
+ type PingMessage = {
2236
+ type: 'ping';
2237
+ };
2238
+ type ClientMessage = SubscribeMessage | UpdateBoundsMessage | UnsubscribeMessage | SubscribeEntityMessage | UnsubscribeEntityMessage | SubscribeEventsMessage | UnsubscribeEventsMessage | PingMessage;
2239
+ type AckMessage = {
2240
+ type: 'subscribed' | 'unsubscribed' | 'bounds_updated';
2241
+ sub_id: string;
2242
+ };
2243
+ type WireEntity = Record<string, unknown> & {
2244
+ type: number;
2245
+ type_name: 'ship' | 'warehouse' | 'container' | 'nexus';
2246
+ id: string | number;
2520
2247
  owner: string;
2521
- name: string;
2522
- coordinates: CoordinatesType | {
2523
- x: number;
2524
- y: number;
2525
- z?: number;
2526
- };
2527
- }
2528
- declare class Nexus extends Types.entity_info {
2529
- get name(): string;
2530
- get entityClass(): 'orbital';
2531
- get location(): Location;
2532
- get orbitalAltitude(): number;
2533
- }
2248
+ coordinates: WireCoordinates;
2249
+ };
2250
+ type SnapshotMessage = {
2251
+ type: 'snapshot';
2252
+ sub_id: string;
2253
+ seq: number;
2254
+ entities: WireEntity[];
2255
+ truncated?: boolean;
2256
+ };
2257
+ type UpdateMessage = {
2258
+ type: 'update';
2259
+ sub_ids: string[];
2260
+ entity_id: number;
2261
+ entity: WireEntity;
2262
+ seq: number;
2263
+ };
2264
+ type BoundsDeltaMessage = {
2265
+ type: 'bounds_delta';
2266
+ sub_id: string;
2267
+ entered: WireEntity[];
2268
+ exited: number[];
2269
+ seq: number;
2270
+ truncated?: boolean;
2271
+ };
2272
+ type EventMessage = {
2273
+ type: 'event';
2274
+ sub_id: string;
2275
+ catchup: boolean;
2276
+ events: Array<Record<string, unknown>>;
2277
+ seq?: number;
2278
+ };
2279
+ type EventCatchupCompleteMessage = {
2280
+ type: 'event_catchup_complete';
2281
+ sub_id: string;
2282
+ };
2283
+ type PongMessage = {
2284
+ type: 'pong';
2285
+ };
2286
+ type ErrorMessage = {
2287
+ type: 'error';
2288
+ error: string;
2289
+ sub_id?: string;
2290
+ };
2291
+ type ServerMessage = AckMessage | SnapshotMessage | UpdateMessage | BoundsDeltaMessage | EventMessage | EventCatchupCompleteMessage | PongMessage | ErrorMessage;
2534
2292
 
2535
2293
  type SubscriptionEntityType = 'ship' | 'warehouse' | 'container' | 'nexus';
2536
- type EntityInstance = Ship | Warehouse | Container | Nexus;
2294
+ type EntityInstance = Entity$1;
2537
2295
  interface SubscriptionsOptions {
2538
2296
  url: string;
2539
2297
  minReconnectDelay?: number;
@@ -2597,154 +2355,43 @@ declare class GameContext {
2597
2355
  readonly server: Contract$2;
2598
2356
  readonly platform: Contract$2;
2599
2357
  private _entities?;
2600
- private _players?;
2601
- private _locations?;
2602
- private _epochs?;
2603
- private _actions?;
2604
- private _subscriptions?;
2605
- private _subscriptionsUrl?;
2606
- private _gameCache?;
2607
- private _stateCache?;
2608
- constructor(client: APIClient, server: Contract$2, platform: Contract$2);
2609
- get entities(): EntitiesManager;
2610
- get players(): PlayersManager;
2611
- get locations(): LocationsManager;
2612
- get epochs(): EpochsManager;
2613
- get actions(): ActionsManager;
2614
- setSubscriptionsUrl(url: string): void;
2615
- get subscriptions(): SubscriptionsManager;
2616
- getGame(reload?: boolean): Promise<Types$1.game_row>;
2617
- getState(reload?: boolean): Promise<GameState>;
2618
- get cachedGame(): Types$1.game_row | undefined;
2619
- get cachedState(): GameState | undefined;
2620
- }
2621
-
2622
- declare abstract class BaseManager {
2623
- protected readonly context: GameContext;
2624
- constructor(context: GameContext);
2625
- protected get client(): _wharfkit_antelope.APIClient;
2626
- protected get server(): _wharfkit_contract.Contract;
2627
- protected get platform(): _wharfkit_contract.Contract;
2628
- protected getGame(): Promise<Types$1.game_row>;
2629
- protected getState(): Promise<GameState>;
2630
- }
2631
-
2632
- interface ExtractorStateInput {
2633
- id: UInt64Type;
2634
- owner: string;
2635
- name: string;
2636
- coordinates: CoordinatesType | {
2637
- x: number;
2638
- y: number;
2639
- z?: number;
2640
- };
2641
- hullmass?: number;
2642
- capacity?: number;
2643
- energy?: number;
2644
- modules?: PackedModuleInput[];
2645
- schedule?: Types.schedule;
2646
- cargo?: Types.cargo_item[];
2647
- }
2648
- declare class Extractor extends Types.entity_info {
2649
- private _sched?;
2650
- private _inv?;
2651
- get name(): string;
2652
- get entityClass(): 'planetary';
2653
- get canDemolish(): boolean;
2654
- get inv(): InventoryAccessor;
2655
- get inventory(): EntityInventory[];
2656
- get sched(): ScheduleAccessor;
2657
- get isIdle(): boolean;
2658
- get location(): Location;
2659
- get totalCargoMass(): UInt64;
2660
- get maxCapacity(): UInt64;
2661
- get availableCapacity(): UInt64;
2662
- get isFull(): boolean;
2663
- get totalMass(): UInt64;
2664
- }
2665
- interface ExtractorCapabilities {
2666
- generator?: {
2667
- capacity: number;
2668
- recharge: number;
2669
- };
2670
- gatherer?: {
2671
- yield: number;
2672
- drain: number;
2673
- depth: number;
2674
- speed: number;
2675
- };
2676
- }
2677
- declare function computeExtractorCapabilities(modules: InstalledModule[], layout: EntitySlot[]): ExtractorCapabilities;
2678
-
2679
- interface FactoryStateInput {
2680
- id: UInt64Type;
2681
- owner: string;
2682
- name: string;
2683
- coordinates: CoordinatesType | {
2684
- x: number;
2685
- y: number;
2686
- z?: number;
2687
- };
2688
- hullmass?: number;
2689
- capacity?: number;
2690
- energy?: number;
2691
- modules?: PackedModuleInput[];
2692
- schedule?: Types.schedule;
2693
- cargo?: Types.cargo_item[];
2694
- }
2695
- declare class Factory extends Types.entity_info {
2696
- private _sched?;
2697
- private _inv?;
2698
- get name(): string;
2699
- get entityClass(): 'planetary';
2700
- get canDemolish(): boolean;
2701
- get inv(): InventoryAccessor;
2702
- get inventory(): EntityInventory[];
2703
- get sched(): ScheduleAccessor;
2704
- get isIdle(): boolean;
2705
- get location(): Location;
2706
- get totalCargoMass(): UInt64;
2707
- get maxCapacity(): UInt64;
2708
- get availableCapacity(): UInt64;
2709
- get isFull(): boolean;
2710
- get totalMass(): UInt64;
2358
+ private _players?;
2359
+ private _locations?;
2360
+ private _epochs?;
2361
+ private _actions?;
2362
+ private _subscriptions?;
2363
+ private _subscriptionsUrl?;
2364
+ private _gameCache?;
2365
+ private _stateCache?;
2366
+ constructor(client: APIClient, server: Contract$2, platform: Contract$2);
2367
+ get entities(): EntitiesManager;
2368
+ get players(): PlayersManager;
2369
+ get locations(): LocationsManager;
2370
+ get epochs(): EpochsManager;
2371
+ get actions(): ActionsManager;
2372
+ setSubscriptionsUrl(url: string): void;
2373
+ get subscriptions(): SubscriptionsManager;
2374
+ getGame(reload?: boolean): Promise<Types$1.game_row>;
2375
+ getState(reload?: boolean): Promise<GameState>;
2376
+ get cachedGame(): Types$1.game_row | undefined;
2377
+ get cachedState(): GameState | undefined;
2711
2378
  }
2712
- interface FactoryCapabilities {
2713
- generator?: {
2714
- capacity: number;
2715
- recharge: number;
2716
- };
2717
- crafter?: {
2718
- speed: number;
2719
- drain: number;
2720
- };
2379
+
2380
+ declare abstract class BaseManager {
2381
+ protected readonly context: GameContext;
2382
+ constructor(context: GameContext);
2383
+ protected get client(): _wharfkit_antelope.APIClient;
2384
+ protected get server(): _wharfkit_contract.Contract;
2385
+ protected get platform(): _wharfkit_contract.Contract;
2386
+ protected getGame(): Promise<Types$1.game_row>;
2387
+ protected getState(): Promise<GameState>;
2721
2388
  }
2722
- declare function computeFactoryCapabilities(modules: InstalledModule[], layout: EntitySlot[]): FactoryCapabilities;
2723
2389
 
2724
- type EntityType = 'ship' | 'warehouse' | 'extractor' | 'factory' | 'container' | 'nexus';
2725
2390
  declare class EntitiesManager extends BaseManager {
2726
- getEntity(id: UInt64Type): Promise<Ship | Warehouse | Extractor | Factory | Container | Nexus>;
2727
- getEntities(owner: NameType | Types.player_row, type?: EntityType): Promise<(Ship | Warehouse | Extractor | Factory | Container | Nexus)[]>;
2728
- getSummaries(owner: NameType | Types.player_row, type?: EntityType): Promise<Types.entity_summary[]>;
2729
- getShip(id: UInt64Type): Promise<Ship>;
2730
- getWarehouse(id: UInt64Type): Promise<Warehouse>;
2731
- getContainer(id: UInt64Type): Promise<Container>;
2732
- getExtractor(id: UInt64Type): Promise<Extractor>;
2733
- getFactory(id: UInt64Type): Promise<Factory>;
2734
- getShips(owner: NameType | Types.player_row): Promise<Ship[]>;
2735
- getWarehouses(owner: NameType | Types.player_row): Promise<Warehouse[]>;
2736
- getContainers(owner: NameType | Types.player_row): Promise<Container[]>;
2737
- getExtractors(owner: NameType | Types.player_row): Promise<Extractor[]>;
2738
- getFactories(owner: NameType | Types.player_row): Promise<Factory[]>;
2739
- getShipSummaries(owner: NameType | Types.player_row): Promise<Types.entity_summary[]>;
2740
- getWarehouseSummaries(owner: NameType | Types.player_row): Promise<Types.entity_summary[]>;
2741
- getContainerSummaries(owner: NameType | Types.player_row): Promise<Types.entity_summary[]>;
2742
- getExtractorSummaries(owner: NameType | Types.player_row): Promise<Types.entity_summary[]>;
2743
- getFactorySummaries(owner: NameType | Types.player_row): Promise<Types.entity_summary[]>;
2744
- getNexus(id: UInt64Type): Promise<Nexus>;
2745
- getNexuses(owner: NameType | Types.player_row): Promise<Nexus[]>;
2746
- getNexusSummaries(owner: NameType | Types.player_row): Promise<Types.entity_summary[]>;
2747
- private wrapEntity;
2391
+ getEntity(id: UInt64Type): Promise<Entity$1>;
2392
+ getProjection(id: UInt64Type, taskCount?: number): Promise<unknown>;
2393
+ getEntities(owner: NameType | Types.player_row, kind?: EntityTypeName): Promise<Entity$1[]>;
2394
+ getSummaries(owner: NameType | Types.player_row, kind?: EntityTypeName): Promise<Types.entity_summary[]>;
2748
2395
  private resolveOwner;
2749
2396
  }
2750
2397
 
@@ -2775,12 +2422,34 @@ declare class Shipload {
2775
2422
  getState(reload?: boolean): Promise<GameState>;
2776
2423
  }
2777
2424
 
2778
- declare function makeShip(state: ShipStateInput): Ship;
2779
- declare function makeWarehouse(state: WarehouseStateInput): Warehouse;
2780
- declare function makeExtractor(state: ExtractorStateInput): Extractor;
2781
- declare function makeFactory(state: FactoryStateInput): Factory;
2782
- declare function makeContainer(state: ContainerStateInput): Container;
2783
- declare function makeNexus(state: NexusStateInput): Nexus;
2425
+ interface PackedModuleInput {
2426
+ itemId: number;
2427
+ stats: bigint;
2428
+ }
2429
+ interface EntityStateInput {
2430
+ id: UInt64Type;
2431
+ owner: NameType;
2432
+ name: string;
2433
+ coordinates: {
2434
+ x: number;
2435
+ y: number;
2436
+ z?: number;
2437
+ };
2438
+ hullmass?: number;
2439
+ capacity?: number;
2440
+ cargomass?: number;
2441
+ energy?: number;
2442
+ modules?: PackedModuleInput[];
2443
+ schedule?: Types.schedule;
2444
+ cargo?: Types.cargo_item[];
2445
+ }
2446
+ declare function makeEntity(packedItemId: number, state: EntityStateInput): Entity$1;
2447
+
2448
+ interface InstalledModule {
2449
+ slotIndex: number;
2450
+ itemId: number;
2451
+ stats: bigint;
2452
+ }
2784
2453
 
2785
2454
  declare const itemIds: number[];
2786
2455
  declare function getItem(itemId: UInt16Type): Item;
@@ -2817,6 +2486,104 @@ declare function deriveLocation(gameSeed: Checksum256Type, coordinates: Coordina
2817
2486
  declare function hash(seed: Checksum256Type, string: string): Checksum256;
2818
2487
  declare function hash512(seed: Checksum256Type, string: string): Checksum512;
2819
2488
 
2489
+ /**
2490
+ * Travel calculations for ship movement, energy usage, and flight times.
2491
+ *
2492
+ * Functions prefixed with `calc_` are contract-parity functions that mirror
2493
+ * the C++ implementation in the server contract (schedule.cpp, ship.cpp).
2494
+ * These use snake_case intentionally to match the contract naming convention
2495
+ * and signal that they must produce identical results to the on-chain code.
2496
+ *
2497
+ * Functions prefixed with `calculate` are higher-level SDK helpers that may
2498
+ * combine multiple contract calculations for convenience.
2499
+ */
2500
+
2501
+ declare function calc_orbital_altitude(mass: number): number;
2502
+ declare function distanceBetweenCoordinates(origin: ActionParams.Type.coordinates, destination: ActionParams.Type.coordinates): UInt64;
2503
+ declare function distanceBetweenPoints(x1: Int64Type, y1: Int64Type, x2: Int64Type, y2: Int64Type): UInt64;
2504
+ declare function lerp(origin: ActionParams.Type.coordinates, destination: ActionParams.Type.coordinates, time: number): ActionParams.Type.coordinates;
2505
+ interface FloatPosition {
2506
+ x: number;
2507
+ y: number;
2508
+ }
2509
+ declare function easeFlightProgress(t: number): number;
2510
+ declare function flightSpeedFactor(t: number): number;
2511
+ declare function interpolateFlightPosition(origin: {
2512
+ x: Int64Type | number;
2513
+ y: Int64Type | number;
2514
+ }, destination: {
2515
+ x: Int64Type | number;
2516
+ y: Int64Type | number;
2517
+ }, taskProgress: number, options?: {
2518
+ easing?: 'physics' | 'linear';
2519
+ }): FloatPosition;
2520
+ declare function getInterpolatedPosition(entity: HasScheduleAndLocation, taskIndex: number, taskProgress: number): FloatPosition;
2521
+ declare function rotation(origin: ActionParams.Type.coordinates, destination: ActionParams.Type.coordinates): number;
2522
+ declare function findNearbyPlanets(seed: Checksum256, origin: ActionParams.Type.coordinates, maxDistance?: UInt64Type): Distance[];
2523
+ declare function calc_rechargetime(capacity: UInt32Type, energy: UInt32Type, recharge: UInt32Type): UInt32;
2524
+ declare function calc_ship_rechargetime(ship: ShipLike): UInt32;
2525
+ declare function calc_flighttime(distance: UInt64Type, acceleration: number): UInt32;
2526
+ declare function calc_loader_flighttime(ship: ShipLike, mass: UInt64, altitude?: number): UInt32;
2527
+ declare function calc_loader_acceleration(ship: ShipLike, mass: UInt64): number;
2528
+ declare function calc_ship_flighttime(ship: ShipLike, mass: UInt64, distance: UInt64): UInt32;
2529
+ declare function calc_ship_acceleration(ship: ShipLike, mass: UInt64): number;
2530
+ declare function calc_acceleration(thrust: number, mass: number): number;
2531
+ declare function calc_ship_mass(ship: ShipLike, cargos: CargoMassInfo[]): UInt64;
2532
+ declare function calc_energyusage(distance: UInt64Type, drain: UInt32Type): UInt32;
2533
+ declare function calculateTransferTime(ship: ShipLike, cargos: CargoMassInfo[], quantities?: Map<number, number>): UInt32;
2534
+ declare function calculateRefuelingTime(ship: ShipLike): UInt32;
2535
+ declare function calculateFlightTime(ship: ShipLike, cargos: CargoMassInfo[], distance: UInt64Type): UInt32;
2536
+ interface LoadTimeBreakdown {
2537
+ unloadTime: number;
2538
+ loadTime: number;
2539
+ totalTime: number;
2540
+ unloadMass: number;
2541
+ loadMass: number;
2542
+ }
2543
+ declare function calculateLoadTimeBreakdown(ship: ShipLike, cargos: CargoMassInfo[], loadQuantities?: Map<number, number>, unloadQuantities?: Map<number, number>): LoadTimeBreakdown;
2544
+ interface EstimatedTravelTime {
2545
+ flightTime: UInt32;
2546
+ rechargeTime: UInt32;
2547
+ loadTime: UInt32;
2548
+ unloadTime: UInt32;
2549
+ total: UInt32;
2550
+ }
2551
+ interface EstimateTravelTimeOptions {
2552
+ needsRecharge?: boolean;
2553
+ loadMass?: UInt32Type;
2554
+ unloadMass?: UInt32Type;
2555
+ }
2556
+ declare function estimateTravelTime(ship: ShipLike, travelMass: UInt64Type, distance: UInt64Type, options?: EstimateTravelTimeOptions): EstimatedTravelTime;
2557
+ declare function estimateDealTravelTime(ship: ShipLike, shipMass: UInt64Type, distance: UInt64Type, loadMass: UInt32Type): UInt32;
2558
+ declare function hasEnergyForDistance(ship: ShipLike, distance: UInt64Type): boolean;
2559
+ interface TransferEntity {
2560
+ location: {
2561
+ z?: {
2562
+ toNumber(): number;
2563
+ } | number;
2564
+ };
2565
+ loaders?: {
2566
+ thrust: {
2567
+ toNumber(): number;
2568
+ } | number;
2569
+ mass: {
2570
+ toNumber(): number;
2571
+ } | number;
2572
+ quantity: {
2573
+ toNumber(): number;
2574
+ } | number;
2575
+ };
2576
+ }
2577
+ interface HasScheduleAndLocation {
2578
+ coordinates: ActionParams.Type.coordinates;
2579
+ schedule?: Types.schedule;
2580
+ }
2581
+ declare function getFlightOrigin(entity: HasScheduleAndLocation, flightTaskIndex: number): ActionParams.Type.coordinates;
2582
+ declare function getDestinationLocation(entity: HasScheduleAndLocation): ActionParams.Type.coordinates | undefined;
2583
+ /** Returns chain-tile coordinates (rounded). For visual position use getInterpolatedPosition. */
2584
+ declare function getPositionAt(entity: HasScheduleAndLocation, taskIndex: number, taskProgress: number): ActionParams.Type.coordinates;
2585
+ declare function calc_transfer_duration(source: TransferEntity, dest: TransferEntity, cargoMass: number): number;
2586
+
2820
2587
  interface CargoData {
2821
2588
  cargo: EntityInventory[];
2822
2589
  }
@@ -2863,6 +2630,51 @@ declare function cargoItem(src: {
2863
2630
  modules?: Types.module_entry[];
2864
2631
  }, quantity: bigint | number): ActionParams.Type.cargo_item;
2865
2632
 
2633
+ interface ProjectedEntity {
2634
+ location: Coordinates;
2635
+ energy: UInt16;
2636
+ cargo: CargoStack[];
2637
+ shipMass: UInt32;
2638
+ capacity?: UInt64;
2639
+ engines?: Types.movement_stats;
2640
+ loaders?: Types.loader_stats;
2641
+ generator?: Types.energy_stats;
2642
+ hauler?: Types.hauler_stats;
2643
+ readonly cargoMass: UInt64;
2644
+ readonly totalMass: UInt64;
2645
+ hasMovement(): boolean;
2646
+ hasStorage(): boolean;
2647
+ hasLoaders(): boolean;
2648
+ capabilities(): EntityCapabilities;
2649
+ state(): EntityState;
2650
+ }
2651
+ interface Projectable extends ScheduleData {
2652
+ coordinates: Coordinates | Types.coordinates;
2653
+ energy?: UInt16;
2654
+ hullmass?: UInt32;
2655
+ generator?: Types.energy_stats;
2656
+ engines?: Types.movement_stats;
2657
+ loaders?: Types.loader_stats;
2658
+ hauler?: Types.hauler_stats;
2659
+ capacity?: UInt32;
2660
+ cargo: Types.cargo_item[];
2661
+ cargomass: UInt32;
2662
+ owner?: Name;
2663
+ }
2664
+ declare function createProjectedEntity(entity: Projectable): ProjectedEntity;
2665
+ interface ProjectionOptions {
2666
+ upToTaskIndex?: number;
2667
+ }
2668
+ declare function projectEntity(entity: Projectable, options?: ProjectionOptions): ProjectedEntity;
2669
+ interface ProjectableSnapshot extends Projectable {
2670
+ current_task?: Types.task;
2671
+ pending_tasks?: Types.task[];
2672
+ }
2673
+ declare function projectFromCurrentState(snapshot: ProjectableSnapshot): ProjectedEntity;
2674
+ declare function validateSchedule(entity: Projectable): void;
2675
+ declare function projectEntityAt(entity: Projectable, now: Date): ProjectedEntity;
2676
+ declare function projectFromCurrentStateAt(snapshot: ProjectableSnapshot, now: Date): ProjectedEntity;
2677
+
2866
2678
  type TaskCargoDirection = 'in' | 'out';
2867
2679
  interface TaskCargoChange {
2868
2680
  direction: TaskCargoDirection;
@@ -2887,48 +2699,6 @@ type WarehouseEntity = Entity & StorageCapability & Partial<LoaderCapability> &
2887
2699
  type ContainerEntity = Entity & StorageCapability & MassCapability & ScheduleCapability;
2888
2700
  type AnyEntity = ShipEntity | WarehouseEntity | ContainerEntity;
2889
2701
 
2890
- declare const ENTITY_SHIP: Name;
2891
- declare const ENTITY_WAREHOUSE: Name;
2892
- declare const ENTITY_EXTRACTOR: Name;
2893
- declare const ENTITY_FACTORY: Name;
2894
- declare const ENTITY_CONTAINER: Name;
2895
- declare enum EntityClass {
2896
- OrbitalVessel = 0,
2897
- PlanetaryStructure = 1
2898
- }
2899
- declare function getEntityClass(entityType: Name | EntityTypeName): EntityClass;
2900
- declare function getPackedEntityType(itemId: number): Name | null;
2901
- type EntityTypeName = 'ship' | 'warehouse' | 'extractor' | 'factory' | 'container' | 'nexus';
2902
- interface EntityTraits {
2903
- typeName: Name;
2904
- isMovable: boolean;
2905
- hasEnergy: boolean;
2906
- hasLoaders: boolean;
2907
- hasModules: boolean;
2908
- notFoundError: string;
2909
- }
2910
- declare const shipTraits: EntityTraits;
2911
- declare const warehouseTraits: EntityTraits;
2912
- declare const extractorTraits: EntityTraits;
2913
- declare const factoryTraits: EntityTraits;
2914
- declare const containerTraits: EntityTraits;
2915
- declare function getEntityTraits(entityType: Name | EntityTypeName): EntityTraits;
2916
- declare function isShip(entity: {
2917
- type?: Name;
2918
- }): boolean;
2919
- declare function isWarehouse(entity: {
2920
- type?: Name;
2921
- }): boolean;
2922
- declare function isExtractor(entity: {
2923
- type?: Name;
2924
- }): boolean;
2925
- declare function isFactory(entity: {
2926
- type?: Name;
2927
- }): boolean;
2928
- declare function isContainer(entity: {
2929
- type?: Name;
2930
- }): boolean;
2931
-
2932
2702
  declare function canMove(e: Entity): e is Entity & MovementCapability & EnergyCapability;
2933
2703
  declare function hasEnergy(e: Entity): e is Entity & EnergyCapability;
2934
2704
  declare function hasStorage(e: Entity): e is Entity & StorageCapability;
@@ -3089,11 +2859,18 @@ declare function computeHaulerCapabilities(stats: Record<string, number>): {
3089
2859
  declare function computeStorageCapabilities(stats: Record<string, number>, baseCapacity: number): {
3090
2860
  capacityBonus: number;
3091
2861
  };
2862
+
2863
+ declare function computeBaseCapacity(itemId: number, stats: Record<string, number>): number;
2864
+ declare function computeWarpCapabilities(stats: Record<string, number>): {
2865
+ range: number;
2866
+ };
3092
2867
  declare function computeWarehouseHullCapabilities(stats: Record<string, number>): {
3093
2868
  hullmass: number;
3094
2869
  capacity: number;
3095
2870
  };
3096
- interface ShipCapabilities {
2871
+ interface ComputedCapabilities {
2872
+ hullmass: number;
2873
+ capacity: number;
3097
2874
  engines?: {
3098
2875
  thrust: number;
3099
2876
  drain: number;
@@ -3108,11 +2885,6 @@ interface ShipCapabilities {
3108
2885
  depth: number;
3109
2886
  speed: number;
3110
2887
  };
3111
- hauler?: {
3112
- capacity: number;
3113
- efficiency: number;
3114
- drain: number;
3115
- };
3116
2888
  loaders?: {
3117
2889
  mass: number;
3118
2890
  thrust: number;
@@ -3122,8 +2894,24 @@ interface ShipCapabilities {
3122
2894
  speed: number;
3123
2895
  drain: number;
3124
2896
  };
2897
+ hauler?: {
2898
+ capacity: number;
2899
+ efficiency: number;
2900
+ drain: number;
2901
+ };
2902
+ warp?: {
2903
+ range: number;
2904
+ };
3125
2905
  }
3126
- declare function computeShipCapabilities(modules: InstalledModule[], layout: EntitySlot[]): ShipCapabilities;
2906
+ declare function computeEntityCapabilities(stats: Record<string, number>, itemId: number, modules: InstalledModule[], layout: EntitySlot[]): ComputedCapabilities;
2907
+ declare function computeContainerCapabilities(stats: Record<string, number>): {
2908
+ hullmass: number;
2909
+ capacity: number;
2910
+ };
2911
+ declare function computeContainerT2Capabilities(stats: Record<string, number>): {
2912
+ hullmass: number;
2913
+ capacity: number;
2914
+ };
3127
2915
 
3128
2916
  interface ResolvedItemStat {
3129
2917
  key: string;
@@ -3391,12 +3179,19 @@ declare class WebSocketConnection {
3391
3179
  get isConnected(): boolean;
3392
3180
  }
3393
3181
 
3394
- declare function mapEntity(ei: Types.entity_info): Ship | Warehouse | Container | Nexus;
3182
+ declare function mapEntity(ei: Types.entity_info): Entity$1;
3395
3183
  declare function parseWireEntity(raw: WireEntity): Types.entity_info;
3396
3184
 
3397
3185
  declare function setSubscriptionsDebug(on: boolean): void;
3398
3186
  declare function isSubscriptionsDebugEnabled(): boolean;
3399
3187
 
3188
+ type Ship = Entity$1;
3189
+ type Warehouse = Entity$1;
3190
+ type Container = Entity$1;
3191
+ type Extractor = Entity$1;
3192
+ type Factory = Entity$1;
3193
+ type Nexus = Entity$1;
3194
+
3400
3195
  type movement_stats = Types.movement_stats;
3401
3196
  type energy_stats = Types.energy_stats;
3402
3197
  type loader_stats = Types.loader_stats;
@@ -3407,4 +3202,4 @@ type gatherer_stats = Types.gatherer_stats;
3407
3202
  type location_static = Types.location_static;
3408
3203
  type location_derived = Types.location_derived;
3409
3204
 
3410
- export { AckMessage, ActionsManager, AnyEntity, BASE_ORBITAL_MASS, BLEND_INPUTS_MUST_MATCH, BLEND_REQUIRES_MULTIPLE, BLEND_STAT_LESS_NOT_SUPPORTED, BoundingBox, BoundsDeltaMessage, BoundsSubscriptionHandle, CANCEL_CONTAINS_GROUPED_TASK, CANCEL_PAIRED_HAS_PENDING, CATEGORY_LABELS, COMMIT_ALREADY_SET, COMMIT_CANNOT_MATCH, COMMIT_NOT_SET, COMPANY_NOT_FOUND, CONTAINER_NOT_FOUND, CONTAINER_Z, CRAFT_ENERGY_DIVISOR, CRAFT_EXCEEDS_ENERGY_CAPACITY, CRAFT_NOT_ENOUGH_ENERGY, CapabilityAttribute, CapabilityInput, CargoData, CargoMassInfo, CargoStack, CategoryIconShape, CategoryInfo, CategoryStacks, ClientMessage, ConnectionState, Container, ContainerEntity, ContainerStateInput, Coordinates, CoordinatesType, CraftedItemCategory, CrafterCapability, DEPLOY_ENTITY_HAS_SCHEDULE, DEPTH_THRESHOLD_T1, DEPTH_THRESHOLD_T2, DEPTH_THRESHOLD_T3, DEPTH_THRESHOLD_T4, DEPTH_THRESHOLD_T5, DESTINATION_CAPACITY_EXCEEDED, DerivedStratum, DescribeOptions, Distance, ENTITY_ALREADY_THERE, ENTITY_CAPACITY_EXCEEDED, ENTITY_CARGO_NOT_LOADED, ENTITY_CARGO_NOT_OWNED, ENTITY_CONTAINER, ENTITY_EXTRACTOR, ENTITY_FACTORY, ENTITY_INVALID_CARGO, ENTITY_INVALID_DESTINATION, ENTITY_INVALID_TRAVEL_DURATION, ENTITY_NOT_ENOUGH_ENERGY, ENTITY_NOT_ENOUGH_ENERGY_CAPACITY, ENTITY_NO_CRAFTER, ENTITY_SHIP, ENTITY_WAREHOUSE, EPOCH_NON_ZERO, EPOCH_NOT_READY, ERROR_SYSTEM_ALREADY_INITIALIZED, ERROR_SYSTEM_DISABLED, ERROR_SYSTEM_NOT_INITIALIZED, EnergyCapability, EntitiesManager, Entity, EntityCapabilities, EntityClass, EntityInfo, EntityInstance, EntityInventory, EntityLayout, EntityRefInput, EntitySlot, EntityState, EntitySubscriptionHandle, EntityTraits, EntityType, EntityTypeName, EpochInfo, EpochsManager, ErrorMessage, EstimateTravelTimeOptions, EstimatedTravelTime, EventCatchupCompleteMessage, EventMessage, Extractor, ExtractorCapabilities, ExtractorStateInput, Factory, FactoryCapabilities, FactoryStateInput, FloatPosition, GAME_NOT_FOUND, GAME_SEED_NOT_SET, GATHERER_DEPTH_MAX_TIER, GATHERER_DEPTH_TABLE, GATHER_EXCEEDS_ENERGY_CAPACITY, GATHER_NOT_ENOUGH_ENERGY, GROUP_DUPLICATE_ENTITY, GROUP_EMPTY, GROUP_ENTITY_NOT_MOVABLE, GROUP_HAUL_CAPACITY_EXCEEDED, GROUP_NOT_FOUND, GROUP_NOT_SAME_LOCATION, GROUP_NOT_SAME_OWNER, GROUP_NO_THRUST, GameState, GathererCapability, GathererDepthParams, HasCapacity, HasCargo, HasCargomass, HasScheduleAndLocation, INSUFFICIENT_BALANCE, INSUFFICIENT_ITEM_QUANTITY, INSUFFICIENT_ITEM_SUPPLY, INVALID_AMOUNT, ITEM_BIOMASS_T1, ITEM_BIOMASS_T10, ITEM_BIOMASS_T2, ITEM_BIOMASS_T3, ITEM_BIOMASS_T4, ITEM_BIOMASS_T5, ITEM_BIOMASS_T6, ITEM_BIOMASS_T7, ITEM_BIOMASS_T8, ITEM_BIOMASS_T9, ITEM_CARGO_ARM, ITEM_CARGO_LINING, ITEM_CARGO_LINING_T2, ITEM_CONTAINER_T1_PACKED, ITEM_CONTAINER_T2_PACKED, ITEM_CRAFTER_T1, ITEM_CRYSTAL_T1, ITEM_CRYSTAL_T10, ITEM_CRYSTAL_T2, ITEM_CRYSTAL_T3, ITEM_CRYSTAL_T4, ITEM_CRYSTAL_T5, ITEM_CRYSTAL_T6, ITEM_CRYSTAL_T7, ITEM_CRYSTAL_T8, ITEM_CRYSTAL_T9, ITEM_DOES_NOT_EXIST, ITEM_ENGINE_T1, ITEM_EXTRACTOR_T1_PACKED, ITEM_FACTORY_T1_PACKED, ITEM_FOCUSING_ARRAY, ITEM_GAS_T1, ITEM_GAS_T10, ITEM_GAS_T2, ITEM_GAS_T3, ITEM_GAS_T4, ITEM_GAS_T5, ITEM_GAS_T6, ITEM_GAS_T7, ITEM_GAS_T8, ITEM_GAS_T9, ITEM_GATHERER_T1, ITEM_GENERATOR_T1, ITEM_HAULER_T1, ITEM_HULL_PLATES, ITEM_HULL_PLATES_T2, ITEM_LOADER_T1, ITEM_MATTER_CONDUIT, ITEM_NOT_AVAILABLE_AT_LOCATION, ITEM_NOT_DEPLOYABLE, ITEM_NOT_PACKED_ENTITY, ITEM_ORE_T1, ITEM_ORE_T10, ITEM_ORE_T2, ITEM_ORE_T3, ITEM_ORE_T4, ITEM_ORE_T5, ITEM_ORE_T6, ITEM_ORE_T7, ITEM_ORE_T8, ITEM_ORE_T9, ITEM_POWER_CELL, ITEM_REACTION_CHAMBER, ITEM_REGOLITH_T1, ITEM_REGOLITH_T10, ITEM_REGOLITH_T2, ITEM_REGOLITH_T3, ITEM_REGOLITH_T4, ITEM_REGOLITH_T5, ITEM_REGOLITH_T6, ITEM_REGOLITH_T7, ITEM_REGOLITH_T8, ITEM_REGOLITH_T9, ITEM_SHIP_T1_PACKED, ITEM_STORAGE_T1, ITEM_SURVEY_PROBE, ITEM_THRUSTER_CORE, ITEM_TOOL_BIT, ITEM_TYPE_COMPONENT, ITEM_TYPE_ENTITY, ITEM_TYPE_MODULE, ITEM_TYPE_RESOURCE, ITEM_WAREHOUSE_T1_PACKED, ITEM_WARP_T1, InventoryAccessor, Item, ItemType, LOCATION_MAX_DEPTH, LOCATION_MIN_DEPTH, LoadTimeBreakdown, LoaderCapability, Location, LocationStratum, LocationType, LocationsManager, MAX_ORBITAL_ALTITUDE, MIN_ORBITAL_ALTITUDE, MIN_TRANSFER_DISTANCE, MODULE_ANY, MODULE_CARGO_NOT_FOUND, MODULE_CRAFTER, MODULE_ENGINE, MODULE_ENTITY_BUSY, MODULE_GATHERER, MODULE_GENERATOR, MODULE_HAULER, MODULE_LAUNCHER, MODULE_LOADER, MODULE_NOT_MODULE, MODULE_SLOT_EMPTY, MODULE_SLOT_INVALID, MODULE_SLOT_OCCUPIED, MODULE_STORAGE, MODULE_TYPE_MISMATCH, MODULE_WARP, MassCapability, ModuleDescription, ModuleEntry, ModuleType, MovementCapability, index as NFT, NFTCargoItem, NFTCommonBase, NFTInstalledModule, NFTModuleSlot, NO_SCHEDULE, NamedStats, Nexus, NexusStateInput, OwnerSubscriptionHandle, PLANETARY_STRUCTURE_Z, PLANET_SUBTYPE_GAS_GIANT, PLANET_SUBTYPE_ICY, PLANET_SUBTYPE_INDUSTRIAL, PLANET_SUBTYPE_OCEAN, PLANET_SUBTYPE_ROCKY, PLANET_SUBTYPE_TERRESTRIAL, PLAYER_ALREADY_JOINED, PLAYER_NOT_FOUND, PLAYER_NOT_JOINED, PRECISION, PackedModule, PackedModuleInput, PingMessage, PlanetSubtypeInfo, platform as PlatformContract, Types$1 as PlatformTypes, Player, PlayerStateInput, PlayersManager, PongMessage, Projectable, ProjectableSnapshot, ProjectedEntity, ProjectionOptions, RECIPE_INPUTS_EXCESS, RECIPE_INPUTS_INSUFFICIENT, RECIPE_INPUTS_INVALID, RECIPE_INPUTS_MIXED, RECIPE_NOT_FOUND, REQUIRES_MORE_THAN_ONE, REQUIRES_POSITIVE_VALUE, RESERVE_TIERS, RESOLVE_COUNT_EXCEEDS_COMPLETED, RawData, Recipe, RecipeInput, RecipeInputCategory, RecipeInputItemId, RecipeSlotInput, RenderDescriptionOptions, ReserveTier, ResolvedAttributeGroup, ResolvedItem, ResolvedItemStat, ResolvedItemType, ResolvedModuleSlot, ResourceCategory, ResourceStats, SHIP_ALREADY_TRAVELING, SHIP_CANNOT_BUY_TRAVELING, SHIP_CANNOT_CANCEL_TASK, SHIP_CANNOT_UPDATE_TRAVELING, SHIP_NOT_ARRIVED, SHIP_NOT_FOUND, SHIP_NOT_IDLE, SHIP_NOT_OWNED, SHIP_NO_COMPLETED_TASKS, SHIP_NO_TASKS_TO_CANCEL, SLOT_FORMULAS, STARTER_ALREADY_CLAIMED, ScheduleAccessor, ScheduleCapability, ScheduleData, Scheduleable, SchemaField, server as ServerContract, ServerMessage, Types as ServerTypes, Ship, ShipCapabilities, ShipEntity, ShipLike, ShipStateInput, Shipload, SlotConsumer, SlotConsumerKind, SnapshotMessage, StackInput, StatDefinition, StatMapping, StatSlot, StorageCapability, StratumInfo, SubscribeEntityMessage, SubscribeEventsMessage, SubscribeMessage, SubscriptionEntityType, SubscriptionsManager, SubscriptionsOptions, TIER_ADJECTIVES, TIER_ROLL_MAX, TRAVEL_MAX_DURATION, TaskCancelable, TaskCargoChange, TaskCargoDirection, TaskType, TextSpan, TierRange, TransferEntity, UnsubscribeEntityMessage, UnsubscribeEventsMessage, UnsubscribeMessage, UpdateBoundsMessage, UpdateMessage, WAREHOUSE_ALREADY_AT_LOCATION, WAREHOUSE_NOT_FOUND, WARP_HAS_CARGO, WARP_HAS_SCHEDULE, WARP_NOT_FULL_ENERGY, WARP_NO_CAPABILITY, WARP_OUT_OF_RANGE, Warehouse, WarehouseEntity, WarehouseStateInput, WebSocketConnection, WebSocketConnectionOptions, WireCoordinates, WireEntity, availableCapacity$1 as availableCapacity, availableCapacityFromMass, blendCargoStacks, blendComponentStacks, blendCrossGroup, blendStacks, buildEntityDescription, calcCargoItemMass, calcCargoMass, calcEnergyUsage, calcLoadDuration, calcStacksMass, calc_acceleration, calc_craft_duration, calc_craft_energy, calc_energyusage, calc_flighttime, calc_gather_duration, calc_gather_energy, calc_loader_acceleration, calc_loader_flighttime, calc_orbital_altitude, calc_rechargetime, calc_ship_acceleration, calc_ship_flighttime, calc_ship_mass, calc_ship_rechargetime, calc_transfer_duration, calculateFlightTime, calculateLoadTimeBreakdown, calculateRefuelingTime, calculateTransferTime, canMove, capabilityAttributes, capabilityNames, capsHasCrafter, capsHasGatherer, capsHasHauler, capsHasLoaders, capsHasMass, capsHasMovement, capsHasStorage, cargoItem, cargoItemToStack, cargoRef, cargoUtils, cargo_item, categoryColors, categoryFromIndex, categoryIconShapes, categoryIcons, categoryLabel, categoryLabelFromIndex, componentIcon, computeBaseCapacityShip, computeBaseCapacityWarehouse, computeBaseHullmass, computeComponentStats, computeContainerCapabilities, computeContainerT2Capabilities, computeCraftedOutputStats, computeCrafterCapabilities, computeCrafterDrain, computeCrafterSpeed, computeEngineCapabilities, computeEngineDrain, computeEngineThrust, computeEntityStats, computeExtractorCapabilities, computeFactoryCapabilities, computeGathererCapabilities, computeGathererDepth, computeGathererDrain, computeGathererSpeed, computeGathererYield, computeGeneratorCap, computeGeneratorCapabilities, computeGeneratorRech, computeHaulPenalty, computeHaulerCapabilities, computeHaulerCapacity, computeHaulerDrain$1 as computeHaulerDrain, computeHaulerEfficiency, computeInputMass, computeLoaderCapabilities, computeLoaderMass, computeLoaderThrust, computeShipCapabilities, computeShipHullCapabilities, computeStorageCapabilities, computeWarehouseCapabilities, computeWarehouseHullCapabilities, computeWarpRange, containerTraits, coordsToLocationId, createInventoryAccessor, createProjectedEntity, createScheduleAccessor, decodeCraftedItemStats, decodeStat, decodeStats, Shipload as default, deriveLocation, deriveLocationSize, deriveLocationStatic, deriveResourceStats, deriveStatMappings, deriveStrata, deriveStratum, describeItem, describeModule, describeModuleForItem, describeModuleForSlot, deserializeAsset, deserializeAtomicData, deserializeComponent, deserializeEntity, deserializeModule, deserializeResource, displayName, distanceBetweenCoordinates, distanceBetweenPoints, easeFlightProgress, encodeGatheredCargoStats, encodeStats, energyPercent, energy_stats, entityDisplayName, entity_row, estimateDealTravelTime, estimateTravelTime, extractorTraits, factoryTraits, findItemByCategoryAndTier, findNearbyPlanets, flightSpeedFactor, formatMass, formatMassDelta, formatModuleLine, formatTier, gathererDepthForTier, gatherer_stats, getCapabilityAttributes, getCategoryInfo, getComponents, getCurrentEpoch, getDepthThreshold, getDestinationLocation, getEligibleResources, getEntityClass, getEntityItems, getEntityLayout, getEntityTraits, getEpochInfo, getFlightOrigin, getInterpolatedPosition, getItem, getItems, getLocationCandidates, getLocationProfile, getLocationType, getLocationTypeName, getModuleCapabilityType, getModules, getPackedEntityType, getPlanetSubtype, getPlanetSubtypes, getPositionAt, getRecipe, getResourceTier, getResourceWeight, getResources, getStatDefinitions, getStatMappings, getStatMappingsForCapability, getStatMappingsForStat, getStatName, getSystemName, hasEnergy, hasEnergyForDistance, hasGatherer, hasLoaders, hasMass, hasSchedule, hasSpace$1 as hasSpace, hasSpaceForMass, hasStorage, hasSystem, hash, hash512, interpolateFlightPosition, isContainer, isCraftedItem, isExtractor, isFactory, isFull$1 as isFull, isFullFromMass, isGatherableLocation, isInvertedAttribute, isLocationBuildable, isModuleItem, isRelatedItem, isShip, isSubscriptionsDebugEnabled, isWarehouse, itemAbbreviations, itemCategory, itemIds, itemOffset, itemTier, itemTypeCode, lerp, loader_stats, location_derived, location_static, makeContainer, makeExtractor, makeFactory, makeNexus, makeShip, makeWarehouse, mapEntity, maxTravelDistance, mergeStacks, moduleAccepts, moduleDisplayName, moduleIcon, moduleSlotTypeToCode, movement_stats, needsRecharge, parseWireEntity, projectEntity, projectEntityAt, projectFromCurrentState, projectFromCurrentStateAt, readCommonBase, removeFromStacks, renderDescription, resolveItem, resolveItemCategory, resolveStats, rollTier, rollWithinTier, rotation, schedule, setSubscriptionsDebug, shipTraits, stackKey, stackToCargoItem, stacksEqual, task, taskCargoChanges, tierAdjective, tierColors, toLocation, typeLabel, validateSchedule, warehouseTraits };
3205
+ export { AckMessage, ActionsManager, AnyEntity, BASE_ORBITAL_MASS, BLEND_INPUTS_MUST_MATCH, BLEND_REQUIRES_MULTIPLE, BLEND_STAT_LESS_NOT_SUPPORTED, BoundingBox, BoundsDeltaMessage, BoundsSubscriptionHandle, CANCEL_CONTAINS_GROUPED_TASK, CANCEL_PAIRED_HAS_PENDING, CAP_DEMOLISH, CAP_MODULES, CAP_UNDEPLOY, CAP_WRAP, CATEGORY_LABELS, COMMIT_ALREADY_SET, COMMIT_CANNOT_MATCH, COMMIT_NOT_SET, COMPANY_NOT_FOUND, CONTAINER_NOT_FOUND, CONTAINER_Z, CRAFT_ENERGY_DIVISOR, CRAFT_EXCEEDS_ENERGY_CAPACITY, CRAFT_NOT_ENOUGH_ENERGY, CapabilityAttribute, CapabilityInput, CargoData, CargoMassInfo, CargoStack, CategoryIconShape, CategoryInfo, CategoryStacks, ClientMessage, ComputedCapabilities, ConnectionState, Container, ContainerEntity, Coordinates, CoordinatesType, CraftedItemCategory, CrafterCapability, DEPLOY_ENTITY_HAS_SCHEDULE, DEPTH_THRESHOLD_T1, DEPTH_THRESHOLD_T2, DEPTH_THRESHOLD_T3, DEPTH_THRESHOLD_T4, DEPTH_THRESHOLD_T5, DESTINATION_CAPACITY_EXCEEDED, DerivedStratum, DescribeOptions, Distance, ENTITY_ALREADY_THERE, ENTITY_CAPACITY_EXCEEDED, ENTITY_CARGO_NOT_LOADED, ENTITY_CARGO_NOT_OWNED, ENTITY_CONTAINER, ENTITY_EXTRACTOR, ENTITY_FACTORY, ENTITY_INVALID_CARGO, ENTITY_INVALID_DESTINATION, ENTITY_INVALID_TRAVEL_DURATION, ENTITY_NEXUS, ENTITY_NOT_ENOUGH_ENERGY, ENTITY_NOT_ENOUGH_ENERGY_CAPACITY, ENTITY_NO_CRAFTER, ENTITY_SHIP, ENTITY_WAREHOUSE, EPOCH_NON_ZERO, EPOCH_NOT_READY, ERROR_SYSTEM_ALREADY_INITIALIZED, ERROR_SYSTEM_DISABLED, ERROR_SYSTEM_NOT_INITIALIZED, EnergyCapability, EntitiesManager, Entity$1 as Entity, EntityCapabilities, EntityClass, EntityInfo, EntityInstance, EntityInventory, EntityLayout, EntityRefInput, EntitySlot, EntityState, EntityStateInput, EntitySubscriptionHandle, EntityTypeName, EpochInfo, EpochsManager, ErrorMessage, EstimateTravelTimeOptions, EstimatedTravelTime, EventCatchupCompleteMessage, EventMessage, Extractor, Factory, FloatPosition, GAME_NOT_FOUND, GAME_SEED_NOT_SET, GATHERER_DEPTH_MAX_TIER, GATHERER_DEPTH_TABLE, GATHER_EXCEEDS_ENERGY_CAPACITY, GATHER_NOT_ENOUGH_ENERGY, GROUP_DUPLICATE_ENTITY, GROUP_EMPTY, GROUP_ENTITY_NOT_MOVABLE, GROUP_HAUL_CAPACITY_EXCEEDED, GROUP_NOT_FOUND, GROUP_NOT_SAME_LOCATION, GROUP_NOT_SAME_OWNER, GROUP_NO_THRUST, GameState, GathererCapability, GathererDepthParams, HasCapacity, HasCargo, HasCargomass, HasScheduleAndLocation, INSUFFICIENT_BALANCE, INSUFFICIENT_ITEM_QUANTITY, INSUFFICIENT_ITEM_SUPPLY, INVALID_AMOUNT, ITEM_BIOMASS_T1, ITEM_BIOMASS_T10, ITEM_BIOMASS_T2, ITEM_BIOMASS_T3, ITEM_BIOMASS_T4, ITEM_BIOMASS_T5, ITEM_BIOMASS_T6, ITEM_BIOMASS_T7, ITEM_BIOMASS_T8, ITEM_BIOMASS_T9, ITEM_CARGO_ARM, ITEM_CARGO_LINING, ITEM_CARGO_LINING_T2, ITEM_CONTAINER_T1_PACKED, ITEM_CONTAINER_T2_PACKED, ITEM_CRAFTER_T1, ITEM_CRYSTAL_T1, ITEM_CRYSTAL_T10, ITEM_CRYSTAL_T2, ITEM_CRYSTAL_T3, ITEM_CRYSTAL_T4, ITEM_CRYSTAL_T5, ITEM_CRYSTAL_T6, ITEM_CRYSTAL_T7, ITEM_CRYSTAL_T8, ITEM_CRYSTAL_T9, ITEM_DOES_NOT_EXIST, ITEM_ENGINE_T1, ITEM_EXTRACTOR_T1_PACKED, ITEM_FACTORY_T1_PACKED, ITEM_FOCUSING_ARRAY, ITEM_GAS_T1, ITEM_GAS_T10, ITEM_GAS_T2, ITEM_GAS_T3, ITEM_GAS_T4, ITEM_GAS_T5, ITEM_GAS_T6, ITEM_GAS_T7, ITEM_GAS_T8, ITEM_GAS_T9, ITEM_GATHERER_T1, ITEM_GENERATOR_T1, ITEM_HAULER_T1, ITEM_HULL_PLATES, ITEM_HULL_PLATES_T2, ITEM_LOADER_T1, ITEM_MATTER_CONDUIT, ITEM_NOT_AVAILABLE_AT_LOCATION, ITEM_NOT_DEPLOYABLE, ITEM_NOT_PACKED_ENTITY, ITEM_ORE_T1, ITEM_ORE_T10, ITEM_ORE_T2, ITEM_ORE_T3, ITEM_ORE_T4, ITEM_ORE_T5, ITEM_ORE_T6, ITEM_ORE_T7, ITEM_ORE_T8, ITEM_ORE_T9, ITEM_POWER_CELL, ITEM_REACTION_CHAMBER, ITEM_REGOLITH_T1, ITEM_REGOLITH_T10, ITEM_REGOLITH_T2, ITEM_REGOLITH_T3, ITEM_REGOLITH_T4, ITEM_REGOLITH_T5, ITEM_REGOLITH_T6, ITEM_REGOLITH_T7, ITEM_REGOLITH_T8, ITEM_REGOLITH_T9, ITEM_SHIP_T1_PACKED, ITEM_STORAGE_T1, ITEM_SURVEY_PROBE, ITEM_THRUSTER_CORE, ITEM_TOOL_BIT, ITEM_TYPE_COMPONENT, ITEM_TYPE_ENTITY, ITEM_TYPE_MODULE, ITEM_TYPE_RESOURCE, ITEM_WAREHOUSE_T1_PACKED, ITEM_WARP_T1, InstalledModule, InventoryAccessor, Item, ItemType, KindMeta, LOCATION_MAX_DEPTH, LOCATION_MIN_DEPTH, LoadTimeBreakdown, LoaderCapability, Location, LocationStratum, LocationType, LocationsManager, MAX_ORBITAL_ALTITUDE, MIN_ORBITAL_ALTITUDE, MIN_TRANSFER_DISTANCE, MODULE_ANY, MODULE_CARGO_NOT_FOUND, MODULE_CRAFTER, MODULE_ENGINE, MODULE_ENTITY_BUSY, MODULE_GATHERER, MODULE_GENERATOR, MODULE_HAULER, MODULE_LAUNCHER, MODULE_LOADER, MODULE_NOT_MODULE, MODULE_SLOT_EMPTY, MODULE_SLOT_INVALID, MODULE_SLOT_OCCUPIED, MODULE_STORAGE, MODULE_TYPE_MISMATCH, MODULE_WARP, MassCapability, ModuleDescription, ModuleEntry, ModuleType, MovementCapability, index as NFT, NFTCargoItem, NFTCommonBase, NFTInstalledModule, NFTModuleSlot, NO_SCHEDULE, NamedStats, Nexus, OwnerSubscriptionHandle, PLANETARY_STRUCTURE_Z, PLANET_SUBTYPE_GAS_GIANT, PLANET_SUBTYPE_ICY, PLANET_SUBTYPE_INDUSTRIAL, PLANET_SUBTYPE_OCEAN, PLANET_SUBTYPE_ROCKY, PLANET_SUBTYPE_TERRESTRIAL, PLAYER_ALREADY_JOINED, PLAYER_NOT_FOUND, PLAYER_NOT_JOINED, PRECISION, PackedModule, PackedModuleInput, PingMessage, PlanetSubtypeInfo, platform as PlatformContract, Types$1 as PlatformTypes, Player, PlayerStateInput, PlayersManager, PongMessage, Projectable, ProjectableSnapshot, ProjectedEntity, ProjectionOptions, RECIPE_INPUTS_EXCESS, RECIPE_INPUTS_INSUFFICIENT, RECIPE_INPUTS_INVALID, RECIPE_INPUTS_MIXED, RECIPE_NOT_FOUND, REQUIRES_MORE_THAN_ONE, REQUIRES_POSITIVE_VALUE, RESERVE_TIERS, RESOLVE_COUNT_EXCEEDS_COMPLETED, RawData, Recipe, RecipeInput, RecipeInputCategory, RecipeInputItemId, RecipeSlotInput, RenderDescriptionOptions, ReserveTier, ResolvedAttributeGroup, ResolvedItem, ResolvedItemStat, ResolvedItemType, ResolvedModuleSlot, ResourceCategory, ResourceStats, SHIP_ALREADY_TRAVELING, SHIP_CANNOT_BUY_TRAVELING, SHIP_CANNOT_CANCEL_TASK, SHIP_CANNOT_UPDATE_TRAVELING, SHIP_NOT_ARRIVED, SHIP_NOT_FOUND, SHIP_NOT_IDLE, SHIP_NOT_OWNED, SHIP_NO_COMPLETED_TASKS, SHIP_NO_TASKS_TO_CANCEL, SLOT_FORMULAS, STARTER_ALREADY_CLAIMED, ScheduleAccessor, ScheduleCapability, ScheduleData, Scheduleable, SchemaField, server as ServerContract, ServerMessage, Types as ServerTypes, Ship, ShipEntity, ShipLike, Shipload, SlotConsumer, SlotConsumerKind, SnapshotMessage, StackInput, StatDefinition, StatMapping, StatSlot, StorageCapability, StratumInfo, SubscribeEntityMessage, SubscribeEventsMessage, SubscribeMessage, SubscriptionEntityType, SubscriptionsManager, SubscriptionsOptions, TIER_ADJECTIVES, TIER_ROLL_MAX, TRAVEL_MAX_DURATION, TaskCancelable, TaskCargoChange, TaskCargoDirection, TaskType, TemplateMeta, TextSpan, TierRange, TransferEntity, UnsubscribeEntityMessage, UnsubscribeEventsMessage, UnsubscribeMessage, UpdateBoundsMessage, UpdateMessage, WAREHOUSE_ALREADY_AT_LOCATION, WAREHOUSE_NOT_FOUND, WARP_HAS_CARGO, WARP_HAS_SCHEDULE, WARP_NOT_FULL_ENERGY, WARP_NO_CAPABILITY, WARP_OUT_OF_RANGE, Warehouse, WarehouseEntity, WebSocketConnection, WebSocketConnectionOptions, WireCoordinates, WireEntity, availableCapacity$1 as availableCapacity, availableCapacityFromMass, blendCargoStacks, blendComponentStacks, blendCrossGroup, blendStacks, buildEntityDescription, calcCargoItemMass, calcCargoMass, calcEnergyUsage, calcLoadDuration, calcStacksMass, calc_acceleration, calc_craft_duration, calc_craft_energy, calc_energyusage, calc_flighttime, calc_gather_duration, calc_gather_energy, calc_loader_acceleration, calc_loader_flighttime, calc_orbital_altitude, calc_rechargetime, calc_ship_acceleration, calc_ship_flighttime, calc_ship_mass, calc_ship_rechargetime, calc_transfer_duration, calculateFlightTime, calculateLoadTimeBreakdown, calculateRefuelingTime, calculateTransferTime, canMove, capabilityAttributes, capabilityNames, capsHasCrafter, capsHasGatherer, capsHasHauler, capsHasLoaders, capsHasMass, capsHasMovement, capsHasStorage, cargoItem, cargoItemToStack, cargoRef, cargoUtils, cargo_item, categoryColors, categoryFromIndex, categoryIconShapes, categoryIcons, categoryLabel, categoryLabelFromIndex, componentIcon, computeBaseCapacity, computeBaseCapacityShip, computeBaseCapacityWarehouse, computeBaseHullmass, computeComponentStats, computeContainerCapabilities, computeContainerT2Capabilities, computeCraftedOutputStats, computeCrafterCapabilities, computeCrafterDrain, computeCrafterSpeed, computeEngineCapabilities, computeEngineDrain, computeEngineThrust, computeEntityCapabilities, computeEntityStats, computeGathererCapabilities, computeGathererDepth, computeGathererDrain, computeGathererSpeed, computeGathererYield, computeGeneratorCap, computeGeneratorCapabilities, computeGeneratorRech, computeHaulPenalty, computeHaulerCapabilities, computeHaulerCapacity, computeHaulerDrain$1 as computeHaulerDrain, computeHaulerEfficiency, computeInputMass, computeLoaderCapabilities, computeLoaderMass, computeLoaderThrust, computeShipHullCapabilities, computeStorageCapabilities, computeWarehouseHullCapabilities, computeWarpCapabilities, computeWarpRange, coordsToLocationId, createInventoryAccessor, createProjectedEntity, createScheduleAccessor, decodeCraftedItemStats, decodeStat, decodeStats, Shipload as default, deriveLocation, deriveLocationSize, deriveLocationStatic, deriveResourceStats, deriveStatMappings, deriveStrata, deriveStratum, describeItem, describeModule, describeModuleForItem, describeModuleForSlot, deserializeAsset, deserializeAtomicData, deserializeComponent, deserializeEntity, deserializeModule, deserializeResource, displayName, distanceBetweenCoordinates, distanceBetweenPoints, easeFlightProgress, encodeGatheredCargoStats, encodeStats, energyPercent, energy_stats, entityDisplayName, entity_row, estimateDealTravelTime, estimateTravelTime, findItemByCategoryAndTier, findNearbyPlanets, flightSpeedFactor, formatMass, formatMassDelta, formatModuleLine, formatTier, gathererDepthForTier, gatherer_stats, getCapabilityAttributes, getCategoryInfo, getComponents, getCurrentEpoch, getDepthThreshold, getDestinationLocation, getEligibleResources, getEntityClass, getEntityItems, getEntityLayout, getEpochInfo, getFlightOrigin, getInterpolatedPosition, getItem, getItems, getKindMeta, getLocationCandidates, getLocationProfile, getLocationType, getLocationTypeName, getModuleCapabilityType, getModules, getPackedEntityType, getPlanetSubtype, getPlanetSubtypes, getPositionAt, getRecipe, getResourceTier, getResourceWeight, getResources, getStatDefinitions, getStatMappings, getStatMappingsForCapability, getStatMappingsForStat, getStatName, getSystemName, getTemplateMeta, hasEnergy, hasEnergyForDistance, hasGatherer, hasLoaders, hasMass, hasSchedule, hasSpace$1 as hasSpace, hasSpaceForMass, hasStorage, hasSystem, hash, hash512, interpolateFlightPosition, isContainer, isCraftedItem, isExtractor, isFactory, isFull$1 as isFull, isFullFromMass, isGatherableLocation, isInvertedAttribute, isLocationBuildable, isModuleItem, isNexus, isRelatedItem, isShip, isSubscriptionsDebugEnabled, isWarehouse, itemAbbreviations, itemCategory, itemIds, itemOffset, itemTier, itemTypeCode, kindCan, lerp, loader_stats, location_derived, location_static, makeEntity, mapEntity, maxTravelDistance, mergeStacks, moduleAccepts, moduleDisplayName, moduleIcon, moduleSlotTypeToCode, movement_stats, needsRecharge, parseWireEntity, projectEntity, projectEntityAt, projectFromCurrentState, projectFromCurrentStateAt, readCommonBase, removeFromStacks, renderDescription, resolveItem, resolveItemCategory, resolveStats, rollTier, rollWithinTier, rotation, schedule, setSubscriptionsDebug, stackKey, stackToCargoItem, stacksEqual, task, taskCargoChanges, tierAdjective, tierColors, toLocation, typeLabel, validateSchedule };