@shipload/sdk 1.0.0-next.10 → 1.0.0-next.12

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.
Files changed (39) hide show
  1. package/lib/shipload.d.ts +759 -868
  2. package/lib/shipload.js +2463 -2588
  3. package/lib/shipload.js.map +1 -1
  4. package/lib/shipload.m.js +2432 -2557
  5. package/lib/shipload.m.js.map +1 -1
  6. package/package.json +1 -1
  7. package/src/data/entities.json +13 -0
  8. package/src/data/item-ids.ts +1 -0
  9. package/src/data/items.json +6 -0
  10. package/src/data/kind-registry.json +78 -0
  11. package/src/data/kind-registry.ts +133 -0
  12. package/src/data/metadata.ts +6 -0
  13. package/src/data/recipes.json +57 -0
  14. package/src/derivation/capabilities.ts +397 -0
  15. package/src/derivation/crafting.ts +1 -1
  16. package/src/entities/entity.ts +98 -0
  17. package/src/entities/makers.ts +76 -170
  18. package/src/errors.ts +10 -13
  19. package/src/index-module.ts +39 -22
  20. package/src/managers/entities.ts +18 -80
  21. package/src/managers/index.ts +1 -1
  22. package/src/nft/atomicdata.ts +5 -0
  23. package/src/nft/description.ts +1 -1
  24. package/src/resolution/resolve-item.ts +3 -2
  25. package/src/scheduling/projection.ts +2 -2
  26. package/src/subscriptions/manager.ts +3 -5
  27. package/src/subscriptions/mappers.ts +3 -8
  28. package/src/subscriptions/types.ts +2 -2
  29. package/src/testing/catalog-hash.ts +19 -0
  30. package/src/testing/index.ts +2 -0
  31. package/src/testing/projection-parity.ts +143 -0
  32. package/src/types/index.ts +0 -1
  33. package/src/types.ts +0 -9
  34. package/src/entities/container.ts +0 -123
  35. package/src/entities/extractor.ts +0 -144
  36. package/src/entities/ship-deploy.ts +0 -316
  37. package/src/entities/ship.ts +0 -221
  38. package/src/entities/warehouse.ts +0 -136
  39. package/src/types/entity-traits.ts +0 -132
package/lib/shipload.d.ts CHANGED
@@ -1306,15 +1306,15 @@ declare const PLAYER_ALREADY_JOINED = "Player has already joined the game.";
1306
1306
  declare const PLAYER_NOT_JOINED = "Player has not joined the game.";
1307
1307
  declare const PLAYER_NOT_FOUND = "Cannot find player for given account name.";
1308
1308
  declare const STARTER_ALREADY_CLAIMED = "Starter ship already claimed; destroy existing ships to re-claim.";
1309
- declare const SHIP_ALREADY_THERE = "Ship cannot travel to the location its already at.";
1309
+ declare const ENTITY_ALREADY_THERE = "Entity cannot travel to the location it is already at.";
1310
1310
  declare const SHIP_ALREADY_TRAVELING = "Ship is already traveling.";
1311
1311
  declare const SHIP_CANNOT_BUY_TRAVELING = "Ship cannot buy goods while traveling.";
1312
1312
  declare const SHIP_CANNOT_UPDATE_TRAVELING = "Ship cannot be updated while traveling.";
1313
- declare const SHIP_INVALID_DESTINATION = "Ship cannot travel, no system at specified destination.";
1314
- declare const SHIP_INVALID_TRAVEL_DURATION = "This trip cannot be made as it would exceed the maximum travel duration.";
1313
+ declare const ENTITY_INVALID_DESTINATION = "Cannot travel: no system at specified destination.";
1314
+ declare const ENTITY_INVALID_TRAVEL_DURATION = "This trip cannot be made as it would exceed the maximum travel duration.";
1315
1315
  declare const SHIP_NOT_ARRIVED = "Ship has not yet arrived at its destination.";
1316
- declare const SHIP_NOT_ENOUGH_ENERGY = "Ship does not have enough energy to travel to the destination.";
1317
- declare const SHIP_NOT_ENOUGH_ENERGY_CAPACITY = "Ship does not have enough energy capacity to travel.";
1316
+ declare const ENTITY_NOT_ENOUGH_ENERGY = "Entity does not have enough energy to travel to the destination.";
1317
+ declare const ENTITY_NOT_ENOUGH_ENERGY_CAPACITY = "Entity does not have enough energy capacity to travel.";
1318
1318
  declare const SHIP_NOT_FOUND = "Cannot find ship for given account.";
1319
1319
  declare const SHIP_NOT_OWNED = "Ship is not owned by this account.";
1320
1320
  declare const NO_SCHEDULE = "No scheduled tasks.";
@@ -1323,16 +1323,13 @@ declare const SHIP_NO_COMPLETED_TASKS = "No completed tasks to resolve.";
1323
1323
  declare const RESOLVE_COUNT_EXCEEDS_COMPLETED = "Requested resolve count exceeds completed tasks.";
1324
1324
  declare const SHIP_CANNOT_CANCEL_TASK = "Cannot cancel task that is immutable or in progress.";
1325
1325
  declare const SHIP_NO_TASKS_TO_CANCEL = "No tasks to cancel.";
1326
- declare const SHIP_INVALID_CARGO = "Invalid cargo specified for load/unload.";
1327
- declare const SHIP_CARGO_NOT_OWNED = "Cannot load cargo that is not owned.";
1328
- declare const SHIP_CARGO_NOT_LOADED = "Cannot unload cargo that is not loaded.";
1329
- declare const SHIP_CAPACITY_EXCEEDED = "Ship cargo capacity would be exceeded.";
1326
+ declare const ENTITY_INVALID_CARGO = "Invalid cargo specified for load/unload.";
1327
+ declare const ENTITY_CARGO_NOT_OWNED = "Cannot load cargo that is not owned.";
1328
+ declare const ENTITY_CARGO_NOT_LOADED = "Cannot unload cargo that is not loaded.";
1330
1329
  declare const ENTITY_CAPACITY_EXCEEDED = "Entity cargo capacity would be exceeded.";
1331
1330
  declare const WAREHOUSE_NOT_FOUND = "Cannot find warehouse for given id.";
1332
1331
  declare const WAREHOUSE_ALREADY_AT_LOCATION = "Warehouse already exists at this location.";
1333
- declare const WAREHOUSE_CAPACITY_EXCEEDED = "Warehouse capacity would be exceeded.";
1334
1332
  declare const CONTAINER_NOT_FOUND = "Cannot find container for given id.";
1335
- declare const CONTAINER_CAPACITY_EXCEEDED = "Container capacity would be exceeded.";
1336
1333
  declare const DESTINATION_CAPACITY_EXCEEDED = "Destination entity does not have enough capacity for the gather.";
1337
1334
  declare const CANCEL_PAIRED_HAS_PENDING = "Cannot cancel transfer, paired entity has pending tasks.";
1338
1335
  declare const GROUP_EMPTY = "Group travel requires at least one entity.";
@@ -1534,6 +1531,7 @@ declare const ITEM_CONTAINER_T1_PACKED = 10200;
1534
1531
  declare const ITEM_SHIP_T1_PACKED = 10201;
1535
1532
  declare const ITEM_WAREHOUSE_T1_PACKED = 10202;
1536
1533
  declare const ITEM_EXTRACTOR_T1_PACKED = 10203;
1534
+ declare const ITEM_FACTORY_T1_PACKED = 10204;
1537
1535
  declare const ITEM_HULL_PLATES_T2 = 20001;
1538
1536
  declare const ITEM_CARGO_LINING_T2 = 20002;
1539
1537
  declare const ITEM_CONTAINER_T2_PACKED = 20200;
@@ -1573,493 +1571,67 @@ declare function getRecipe(outputItemId: number): Recipe | undefined;
1573
1571
  declare function getEntityLayout(entityItemId: number): EntityLayout | undefined;
1574
1572
  declare function findItemByCategoryAndTier(category: ResourceCategory, tier: number): Item;
1575
1573
 
1576
- interface EpochInfo {
1577
- epoch: UInt64;
1578
- start: Date;
1579
- end: Date;
1580
- }
1581
- declare function getCurrentEpoch(game: Types$1.game_row): UInt64;
1582
- declare function getEpochInfo(game: Types$1.game_row, epoch: UInt64): EpochInfo;
1583
-
1584
- /**
1585
- * GameState class extends the state_row from the server contract
1586
- * with helper methods for epoch management and system generation
1587
- */
1588
- declare class GameState extends Types.state_row {
1589
- private _game?;
1590
- /**
1591
- * Create a GameState instance from a state_row
1592
- */
1593
- static from(state: Types.state_row, game?: Types$1.game_row): GameState;
1594
- /**
1595
- * Set the game configuration (needed for epoch calculations)
1596
- */
1597
- setGame(game: Types$1.game_row): void;
1598
- /**
1599
- * Get the current epoch number from the state
1600
- */
1601
- get currentEpoch(): UInt64;
1602
- /**
1603
- * Get the epoch seed (used for market pricing and system generation)
1604
- */
1605
- get epochSeed(): Checksum256;
1606
- /**
1607
- * Get the game seed (from game config, if available)
1608
- */
1609
- get gameSeed(): Checksum256 | undefined;
1610
- /**
1611
- * Check if the game is currently enabled
1612
- */
1613
- get isEnabled(): boolean;
1614
- /**
1615
- * Get the current salt value (used for random number generation)
1616
- */
1617
- get currentSalt(): UInt64;
1618
- /**
1619
- * Get the commit hash for the next epoch
1620
- */
1621
- get nextEpochCommit(): Checksum256;
1622
- /**
1623
- * Calculate the current epoch from game config (if game is set)
1624
- * This might differ from state.epoch if the blockchain hasn't advanced yet
1625
- */
1626
- get calculatedCurrentEpoch(): UInt64 | undefined;
1627
- /**
1628
- * Get epoch info (start/end times) for the current epoch
1629
- */
1630
- get currentEpochInfo(): EpochInfo | undefined;
1631
- /**
1632
- * Get epoch info for a specific epoch number
1633
- */
1634
- getEpochInfo(epoch: UInt64): EpochInfo | undefined;
1635
- /**
1636
- * Check if a system exists at given coordinates
1637
- * Requires game seed from game config
1638
- */
1639
- hasSystemAt(x: number, y: number): boolean;
1640
- /**
1641
- * Check if a system exists at coordinates object
1642
- */
1643
- hasSystemAtCoords(coords: Types.coordinates): boolean;
1644
- /**
1645
- * Get a summary of the game state
1646
- */
1647
- get summary(): {
1648
- enabled: boolean;
1649
- epoch: string;
1650
- hasSeed: boolean;
1651
- hasCommit: boolean;
1652
- };
1653
- }
1654
-
1655
- interface PlayerStateInput {
1656
- owner: NameType;
1657
- }
1658
- declare class Player extends Types.player_row {
1659
- static fromState(state: PlayerStateInput): Player;
1660
- }
1661
-
1662
- declare class PlayersManager extends BaseManager {
1663
- getPlayer(account: NameType): Promise<Player | undefined>;
1664
- }
1665
-
1666
- interface StratumInfo {
1667
- itemId: number;
1668
- seed: bigint;
1669
- richness: number;
1670
- reserve: number;
1671
- }
1672
- interface ResourceStats {
1673
- stat1: number;
1674
- stat2: number;
1675
- stat3: number;
1676
- }
1677
- declare function deriveStratum(epochSeed: Checksum256Type, coords: CoordinatesType, stratum: number, locationType: number, subtype: number, _maxDepth: number): StratumInfo;
1678
- /**
1679
- * Derives the three stat values for a raw resource from a deposit's
1680
- * entropy seed (hash-based, weibull-transformed).
1681
- *
1682
- * **Use only on deposit seeds** — the bigint returned by `deriveStratum`
1683
- * or carried on a `MassDeposit`. Do NOT call this on a cargo item's
1684
- * `stats` field; cargo stats are bit-packed and must be read via
1685
- * `decodeStat` (or `decodeStackStats` for category-mapped output).
1686
- *
1687
- * Passing a cargo `stats` value here produces meaningless output
1688
- * (hash of the packed bits, unrelated to the actual stats).
1689
- */
1690
- declare function deriveResourceStats(seed: bigint): ResourceStats;
1691
-
1692
- interface DerivedStratum {
1693
- index: number;
1694
- itemId: number;
1695
- seed: bigint;
1696
- richness: number;
1697
- reserve: number;
1698
- stats: ResourceStats;
1699
- }
1700
- declare function deriveStrata(coords: CoordinatesType, gameSeed: Checksum256Type, epochSeed: Checksum256Type): DerivedStratum[];
1701
-
1702
- declare function deriveLocationSize(loc: Types.location_static): number;
1703
-
1704
- declare const DEPTH_THRESHOLD_T1 = 0;
1705
- declare const DEPTH_THRESHOLD_T2 = 1500;
1706
- declare const DEPTH_THRESHOLD_T3 = 5000;
1707
- declare const DEPTH_THRESHOLD_T4 = 12000;
1708
- declare const DEPTH_THRESHOLD_T5 = 22000;
1709
- declare const LOCATION_MIN_DEPTH = 500;
1710
- declare const LOCATION_MAX_DEPTH = 65535;
1711
- declare const PLANET_SUBTYPE_GAS_GIANT = 0;
1712
- declare const PLANET_SUBTYPE_ROCKY = 1;
1713
- declare const PLANET_SUBTYPE_TERRESTRIAL = 2;
1714
- declare const PLANET_SUBTYPE_ICY = 3;
1715
- declare const PLANET_SUBTYPE_OCEAN = 4;
1716
- declare const PLANET_SUBTYPE_INDUSTRIAL = 5;
1717
- declare function getDepthThreshold(tier: number): number;
1718
- declare function getResourceTier(itemId: number): number;
1719
- declare function getResourceWeight(itemId: number, stratum: number): number;
1720
- interface LocationProfileEntry {
1721
- category: number;
1722
- maxTier: number;
1723
- }
1724
- declare function getLocationProfile(locationType: number, subtype: number): LocationProfileEntry[];
1725
- declare function getLocationCandidates(locationType: number, subtype: number): number[];
1726
- declare function getEligibleResources(locationType: number, subtype: number, stratum: number): number[];
1727
-
1728
- type ReserveTier = 'small' | 'medium' | 'large' | 'massive' | 'motherlode';
1729
- interface TierRange {
1730
- min: number;
1731
- max: number;
1732
- }
1733
- declare const RESERVE_TIERS: Record<ReserveTier, TierRange>;
1734
- declare const TIER_ROLL_MAX = 65536;
1735
- declare function rollTier(tierRoll: number, stratum: number): ReserveTier;
1736
- declare function rollWithinTier(withinRoll: number, range: TierRange): number;
1737
-
1738
- interface StatDefinition {
1739
- key: string;
1740
- label: string;
1741
- abbreviation: string;
1742
- purpose: string;
1743
- inverted?: boolean;
1744
- }
1745
- declare function getStatDefinitions(category: ResourceCategory): StatDefinition[];
1746
- declare function getStatName(category: ResourceCategory, index: 0 | 1 | 2): StatDefinition;
1747
- interface NamedStats {
1748
- definitions: StatDefinition[];
1749
- values: [number, number, number];
1750
- }
1751
- declare function resolveStats(category: ResourceCategory, stats: {
1752
- stat1: number;
1753
- stat2: number;
1754
- stat3: number;
1755
- }): NamedStats;
1756
-
1757
- interface StackInput {
1758
- quantity: number;
1759
- stats: Record<string, number>;
1760
- }
1761
- interface CategoryStacks {
1762
- category: ResourceCategory;
1763
- stacks: StackInput[];
1764
- }
1765
- declare function encodeStats(values: number[]): bigint;
1766
- declare function decodeStat(stats: bigint, index: number): number;
1767
- declare function decodeStats(stats: bigint, count: number): number[];
1768
- declare function decodeCraftedItemStats(itemId: number, stats: bigint): Record<string, number>;
1769
- declare function blendStacks(stacks: StackInput[], statKey: string): number;
1770
- declare function blendComponentStacks(stacks: {
1771
- quantity: number;
1772
- stats: Record<string, number>;
1773
- }[]): Record<string, number>;
1774
- declare function computeComponentStats(componentId: number, categoryStacks: CategoryStacks[]): {
1775
- key: string;
1776
- value: number;
1777
- }[];
1778
- declare function computeEntityStats(entityItemIdOrLegacyId: number | string, componentStacks: Record<number, {
1779
- quantity: number;
1780
- stats: Record<string, number>;
1781
- }[]>): {
1782
- key: string;
1783
- value: number;
1784
- }[];
1785
- declare function computeInputMass(itemId: number): number;
1786
- declare function blendCrossGroup(sources: {
1787
- value: number;
1788
- weight: number;
1789
- }[]): number;
1790
- declare function blendCargoStacks(itemId: number, stacks: {
1791
- quantity: number;
1792
- stats: UInt64;
1793
- }[]): UInt64;
1794
- interface RecipeSlotInput {
1795
- itemId: number;
1796
- category: ResourceCategory | undefined;
1797
- stacks: {
1798
- quantity: number;
1799
- stats: bigint;
1800
- }[];
1801
- }
1802
- declare function computeCraftedOutputStats(outputItemId: number, slotInputs: RecipeSlotInput[]): UInt64;
1803
- /**
1804
- * Mirrors the contract's gather-time transform. Takes a deposit's entropy
1805
- * seed (bigint from deriveStratum), derives stats via weibull hashing, and
1806
- * returns a UInt64 whose bit-packed form matches what the contract writes
1807
- * to cargo_item.stats on gather.
1808
- *
1809
- * Use this whenever off-chain code simulates a gather (testmap, player
1810
- * scanners that project cargo outcomes) and needs a value that matches
1811
- * what on-chain cargo would carry.
1812
- */
1813
- declare function encodeGatheredCargoStats(depositSeed: bigint): UInt64;
1814
-
1815
- interface LocationStratum extends DerivedStratum {
1816
- reserveMax: number;
1817
- }
1818
- declare class LocationsManager extends BaseManager {
1819
- hasSystem(location: CoordinatesType): Promise<boolean>;
1820
- findNearbyPlanets(origin: CoordinatesType, maxDistance?: UInt16Type): Promise<Distance[]>;
1821
- getStrata(coords: CoordinatesType): Promise<LocationStratum[]>;
1822
- }
1823
-
1824
- declare class EpochsManager extends BaseManager {
1825
- getCurrentHeight(): Promise<UInt64>;
1826
- getCurrent(): Promise<EpochInfo>;
1827
- getByHeight(height: UInt64Type): Promise<EpochInfo>;
1828
- getTimeRemaining(): Promise<number>;
1829
- getProgress(): Promise<number>;
1830
- fitsInCurrentEpoch(durationMs: number): Promise<boolean>;
1831
- }
1832
-
1833
- type EntityRefInput = {
1834
- entityType: NameType;
1835
- entityId: UInt64Type;
1836
- };
1837
- declare class ActionsManager extends BaseManager {
1838
- travel(shipId: UInt64Type, destination: CoordinatesType, recharge?: boolean): Action;
1839
- grouptravel(entities: EntityRefInput[], destination: CoordinatesType, recharge?: boolean): Action;
1840
- resolve(entityId: UInt64Type, count?: UInt64Type): Action;
1841
- cancel(entityId: UInt64Type, count: UInt64Type): Action;
1842
- recharge(entityId: UInt64Type): Action;
1843
- refrshentity(entityId: UInt64Type): Action;
1844
- transfer(sourceId: UInt64Type, destId: UInt64Type, items: ActionParams.Type.cargo_item[]): Action;
1845
- foundCompany(account: NameType, name: string): Action;
1846
- join(account: NameType): Action;
1847
- gather(sourceId: UInt64Type, destinationId: UInt64Type, stratum: UInt16Type, quantity: UInt32Type): Action;
1848
- warp(entityId: UInt64Type, destination: CoordinatesType): Action;
1849
- craft(entityId: UInt64Type, recipeId: number, quantity: number, inputs: ActionParams.Type.cargo_item[]): Action;
1850
- blend(entityId: UInt64Type, inputs: ActionParams.Type.cargo_item[]): Action;
1851
- deploy(entityId: UInt64Type, ref: ActionParams.Type.cargo_ref): Action;
1852
- addmodule(entityId: UInt64Type, moduleIndex: number, moduleRef: ActionParams.Type.cargo_ref, targetRef?: ActionParams.Type.cargo_ref | null): Action;
1853
- rmmodule(entityId: UInt64Type, moduleIndex: number, targetRef?: ActionParams.Type.cargo_ref | null): Action;
1854
- wrap(owner: NameType, entityId: UInt64Type, nexusId: UInt64Type, items: ActionParams.Type.cargo_item[]): Action;
1855
- undeploy(hostId: UInt64Type, targetId: UInt64Type): Action;
1856
- wrapEntity(entityId: UInt64Type, nexusId: UInt64Type): Action;
1857
- demolish(entityId: UInt64Type): Action;
1858
- joinGame(account: NameType, companyName: string): Action[];
1859
- }
1860
-
1861
- type EntityInfo = Types.entity_info;
1862
- interface BoundingBox {
1863
- min_x: number;
1864
- min_y: number;
1865
- max_x: number;
1866
- max_y: number;
1867
- }
1868
- interface WireCoordinates {
1869
- x: number;
1870
- y: number;
1871
- z?: number;
1872
- }
1873
- type SubscribeMessage = {
1874
- type: 'subscribe';
1875
- sub_id: string;
1876
- bounds?: BoundingBox;
1877
- owner?: string;
1878
- prioritize_owner?: string;
1879
- };
1880
- type UpdateBoundsMessage = {
1881
- type: 'update_bounds';
1882
- sub_id: string;
1883
- bounds: BoundingBox;
1884
- };
1885
- type UnsubscribeMessage = {
1886
- type: 'unsubscribe';
1887
- sub_id: string;
1888
- };
1889
- type SubscribeEntityMessage = {
1890
- type: 'subscribe_entity';
1891
- sub_id: string;
1892
- entity_type: 'ship' | 'warehouse' | 'container';
1893
- entity_id: string;
1894
- };
1895
- type UnsubscribeEntityMessage = {
1896
- type: 'unsubscribe_entity';
1897
- sub_id: string;
1898
- };
1899
- type SubscribeEventsMessage = {
1900
- type: 'subscribe_events';
1901
- sub_id: string;
1902
- event_filter?: Record<string, unknown>;
1903
- };
1904
- type UnsubscribeEventsMessage = {
1905
- type: 'unsubscribe_events';
1906
- sub_id: string;
1907
- };
1908
- type PingMessage = {
1909
- type: 'ping';
1910
- };
1911
- type ClientMessage = SubscribeMessage | UpdateBoundsMessage | UnsubscribeMessage | SubscribeEntityMessage | UnsubscribeEntityMessage | SubscribeEventsMessage | UnsubscribeEventsMessage | PingMessage;
1912
- type AckMessage = {
1913
- type: 'subscribed' | 'unsubscribed' | 'bounds_updated';
1914
- sub_id: string;
1915
- };
1916
- type WireEntity = Record<string, unknown> & {
1917
- type: number;
1918
- type_name: 'ship' | 'warehouse' | 'container';
1919
- id: string | number;
1920
- owner: string;
1921
- coordinates: WireCoordinates;
1922
- };
1923
- type SnapshotMessage = {
1924
- type: 'snapshot';
1925
- sub_id: string;
1926
- seq: number;
1927
- entities: WireEntity[];
1928
- truncated?: boolean;
1929
- };
1930
- type UpdateMessage = {
1931
- type: 'update';
1932
- sub_ids: string[];
1933
- entity_id: number;
1934
- entity: WireEntity;
1935
- seq: number;
1936
- };
1937
- type BoundsDeltaMessage = {
1938
- type: 'bounds_delta';
1939
- sub_id: string;
1940
- entered: WireEntity[];
1941
- exited: number[];
1942
- seq: number;
1943
- truncated?: boolean;
1944
- };
1945
- type EventMessage = {
1946
- type: 'event';
1947
- sub_id: string;
1948
- catchup: boolean;
1949
- events: Array<Record<string, unknown>>;
1950
- seq?: number;
1951
- };
1952
- type EventCatchupCompleteMessage = {
1953
- type: 'event_catchup_complete';
1954
- sub_id: string;
1955
- };
1956
- type PongMessage = {
1957
- type: 'pong';
1958
- };
1959
- type ErrorMessage = {
1960
- type: 'error';
1961
- error: string;
1962
- sub_id?: string;
1963
- };
1964
- type ServerMessage = AckMessage | SnapshotMessage | UpdateMessage | BoundsDeltaMessage | EventMessage | EventCatchupCompleteMessage | PongMessage | ErrorMessage;
1965
-
1966
- /**
1967
- * Travel calculations for ship movement, energy usage, and flight times.
1968
- *
1969
- * Functions prefixed with `calc_` are contract-parity functions that mirror
1970
- * the C++ implementation in the server contract (schedule.cpp, ship.cpp).
1971
- * These use snake_case intentionally to match the contract naming convention
1972
- * and signal that they must produce identical results to the on-chain code.
1973
- *
1974
- * Functions prefixed with `calculate` are higher-level SDK helpers that may
1975
- * combine multiple contract calculations for convenience.
1976
- */
1977
-
1978
- declare function calc_orbital_altitude(mass: number): number;
1979
- declare function distanceBetweenCoordinates(origin: ActionParams.Type.coordinates, destination: ActionParams.Type.coordinates): UInt64;
1980
- declare function distanceBetweenPoints(x1: Int64Type, y1: Int64Type, x2: Int64Type, y2: Int64Type): UInt64;
1981
- declare function lerp(origin: ActionParams.Type.coordinates, destination: ActionParams.Type.coordinates, time: number): ActionParams.Type.coordinates;
1982
- interface FloatPosition {
1983
- x: number;
1984
- y: number;
1985
- }
1986
- declare function easeFlightProgress(t: number): number;
1987
- declare function flightSpeedFactor(t: number): number;
1988
- declare function interpolateFlightPosition(origin: {
1989
- x: Int64Type | number;
1990
- y: Int64Type | number;
1991
- }, destination: {
1992
- x: Int64Type | number;
1993
- y: Int64Type | number;
1994
- }, taskProgress: number, options?: {
1995
- easing?: 'physics' | 'linear';
1996
- }): FloatPosition;
1997
- declare function getInterpolatedPosition(entity: HasScheduleAndLocation, taskIndex: number, taskProgress: number): FloatPosition;
1998
- declare function rotation(origin: ActionParams.Type.coordinates, destination: ActionParams.Type.coordinates): number;
1999
- declare function findNearbyPlanets(seed: Checksum256, origin: ActionParams.Type.coordinates, maxDistance?: UInt64Type): Distance[];
2000
- declare function calc_rechargetime(capacity: UInt32Type, energy: UInt32Type, recharge: UInt32Type): UInt32;
2001
- declare function calc_ship_rechargetime(ship: ShipLike): UInt32;
2002
- declare function calc_flighttime(distance: UInt64Type, acceleration: number): UInt32;
2003
- declare function calc_loader_flighttime(ship: ShipLike, mass: UInt64, altitude?: number): UInt32;
2004
- declare function calc_loader_acceleration(ship: ShipLike, mass: UInt64): number;
2005
- declare function calc_ship_flighttime(ship: ShipLike, mass: UInt64, distance: UInt64): UInt32;
2006
- declare function calc_ship_acceleration(ship: ShipLike, mass: UInt64): number;
2007
- declare function calc_acceleration(thrust: number, mass: number): number;
2008
- declare function calc_ship_mass(ship: ShipLike, cargos: CargoMassInfo[]): UInt64;
2009
- declare function calc_energyusage(distance: UInt64Type, drain: UInt32Type): UInt32;
2010
- declare function calculateTransferTime(ship: ShipLike, cargos: CargoMassInfo[], quantities?: Map<number, number>): UInt32;
2011
- declare function calculateRefuelingTime(ship: ShipLike): UInt32;
2012
- declare function calculateFlightTime(ship: ShipLike, cargos: CargoMassInfo[], distance: UInt64Type): UInt32;
2013
- interface LoadTimeBreakdown {
2014
- unloadTime: number;
2015
- loadTime: number;
2016
- totalTime: number;
2017
- unloadMass: number;
2018
- loadMass: number;
2019
- }
2020
- declare function calculateLoadTimeBreakdown(ship: ShipLike, cargos: CargoMassInfo[], loadQuantities?: Map<number, number>, unloadQuantities?: Map<number, number>): LoadTimeBreakdown;
2021
- interface EstimatedTravelTime {
2022
- flightTime: UInt32;
2023
- rechargeTime: UInt32;
2024
- loadTime: UInt32;
2025
- unloadTime: UInt32;
2026
- total: UInt32;
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
2027
1581
  }
2028
- interface EstimateTravelTimeOptions {
2029
- needsRecharge?: boolean;
2030
- loadMass?: UInt32Type;
2031
- unloadMass?: UInt32Type;
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;
2032
1589
  }
2033
- declare function estimateTravelTime(ship: ShipLike, travelMass: UInt64Type, distance: UInt64Type, options?: EstimateTravelTimeOptions): EstimatedTravelTime;
2034
- declare function estimateDealTravelTime(ship: ShipLike, shipMass: UInt64Type, distance: UInt64Type, loadMass: UInt32Type): UInt32;
2035
- declare function hasEnergyForDistance(ship: ShipLike, distance: UInt64Type): boolean;
2036
- interface TransferEntity {
2037
- location: {
2038
- z?: {
2039
- toNumber(): number;
2040
- } | number;
2041
- };
2042
- loaders?: {
2043
- thrust: {
2044
- toNumber(): number;
2045
- } | number;
2046
- mass: {
2047
- toNumber(): number;
2048
- } | number;
2049
- quantity: {
2050
- toNumber(): number;
2051
- } | number;
2052
- };
1590
+ interface TemplateMeta {
1591
+ itemId: number;
1592
+ kind: Name;
1593
+ displayLabel: string;
2053
1594
  }
2054
- interface HasScheduleAndLocation {
2055
- coordinates: ActionParams.Type.coordinates;
2056
- schedule?: Types.schedule;
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;
1624
+
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;
2057
1634
  }
2058
- declare function getFlightOrigin(entity: HasScheduleAndLocation, flightTaskIndex: number): ActionParams.Type.coordinates;
2059
- declare function getDestinationLocation(entity: HasScheduleAndLocation): ActionParams.Type.coordinates | undefined;
2060
- /** Returns chain-tile coordinates (rounded). For visual position use getInterpolatedPosition. */
2061
- declare function getPositionAt(entity: HasScheduleAndLocation, taskIndex: number, taskProgress: number): ActionParams.Type.coordinates;
2062
- declare function calc_transfer_duration(source: TransferEntity, dest: TransferEntity, cargoMass: number): number;
2063
1635
 
2064
1636
  interface MovementCapability {
2065
1637
  engines: Types.movement_stats;
@@ -2145,6 +1717,36 @@ declare function stacksEqual(a: CargoStack, b: CargoStack): boolean;
2145
1717
  declare function mergeStacks(stacks: CargoStack[], add: CargoStack): CargoStack[];
2146
1718
  declare function removeFromStacks(stacks: CargoStack[], remove: CargoStack): CargoStack[];
2147
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
+
2148
1750
  type Schedule = Types.schedule;
2149
1751
  type Task$1 = Types.task;
2150
1752
  interface ScheduleData {
@@ -2250,275 +1852,446 @@ declare namespace schedule {
2250
1852
  };
2251
1853
  }
2252
1854
 
2253
- interface ProjectedEntity {
2254
- location: Coordinates;
2255
- energy: UInt16;
2256
- cargo: CargoStack[];
2257
- shipMass: UInt32;
2258
- capacity?: UInt64;
2259
- engines?: Types.movement_stats;
2260
- loaders?: Types.loader_stats;
2261
- generator?: Types.energy_stats;
2262
- hauler?: Types.hauler_stats;
2263
- readonly cargoMass: UInt64;
2264
- readonly totalMass: UInt64;
2265
- hasMovement(): boolean;
2266
- hasStorage(): boolean;
2267
- hasLoaders(): boolean;
2268
- capabilities(): EntityCapabilities;
2269
- 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;
1877
+ }
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;
1901
+ }
1902
+
1903
+ interface EpochInfo {
1904
+ epoch: UInt64;
1905
+ start: Date;
1906
+ end: Date;
1907
+ }
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
+ };
2270
1980
  }
2271
- interface Projectable extends ScheduleData {
2272
- coordinates: Coordinates | Types.coordinates;
2273
- energy?: UInt16;
2274
- hullmass?: UInt32;
2275
- generator?: Types.energy_stats;
2276
- engines?: Types.movement_stats;
2277
- loaders?: Types.loader_stats;
2278
- hauler?: Types.hauler_stats;
2279
- capacity?: UInt32;
2280
- cargo: Types.cargo_item[];
2281
- cargomass: UInt32;
2282
- owner?: Name;
1981
+
1982
+ interface PlayerStateInput {
1983
+ owner: NameType;
2283
1984
  }
2284
- declare function createProjectedEntity(entity: Projectable): ProjectedEntity;
2285
- interface ProjectionOptions {
2286
- upToTaskIndex?: number;
1985
+ declare class Player extends Types.player_row {
1986
+ static fromState(state: PlayerStateInput): Player;
2287
1987
  }
2288
- declare function projectEntity(entity: Projectable, options?: ProjectionOptions): ProjectedEntity;
2289
- interface ProjectableSnapshot extends Projectable {
2290
- current_task?: Types.task;
2291
- pending_tasks?: Types.task[];
1988
+
1989
+ declare class PlayersManager extends BaseManager {
1990
+ getPlayer(account: NameType): Promise<Player | undefined>;
2292
1991
  }
2293
- declare function projectFromCurrentState(snapshot: ProjectableSnapshot): ProjectedEntity;
2294
- declare function validateSchedule(entity: Projectable): void;
2295
- declare function projectEntityAt(entity: Projectable, now: Date): ProjectedEntity;
2296
- declare function projectFromCurrentStateAt(snapshot: ProjectableSnapshot, now: Date): ProjectedEntity;
2297
1992
 
2298
- declare class Location {
2299
- readonly coordinates: Coordinates;
2300
- private _gameSeed?;
2301
- private _hasSystem?;
2302
- private _epoch?;
2303
- constructor(coordinates: CoordinatesType);
2304
- static from(coordinates: CoordinatesType): Location;
2305
- hasSystemAt(gameSeed: Checksum256Type): boolean;
2306
- getLocationTypeAt(gameSeed: Checksum256Type): LocationType;
2307
- isGatherableAt(gameSeed: Checksum256Type): boolean;
2308
- findNearby(gameSeed: Checksum256Type, maxDistance?: UInt16Type): Distance[];
2309
- equals(other: CoordinatesType | Location): boolean;
2310
- get epoch(): UInt64 | undefined;
2311
- clearCache(): void;
1993
+ interface StratumInfo {
1994
+ itemId: number;
1995
+ seed: bigint;
1996
+ richness: number;
1997
+ reserve: number;
2312
1998
  }
2313
- declare function toLocation(coords: CoordinatesType | Location): Location;
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;
2314
2018
 
2315
- type Task = Types.task;
2316
- declare class ScheduleAccessor {
2317
- private entity;
2318
- constructor(entity: ScheduleData);
2319
- get hasSchedule(): boolean;
2320
- get isIdle(): boolean;
2321
- get tasks(): Task[];
2322
- duration(): number;
2323
- elapsed(now: Date): number;
2324
- remaining(now: Date): number;
2325
- complete(now: Date): boolean;
2326
- currentTaskIndex(now: Date): number;
2327
- currentTask(now: Date): Task | undefined;
2328
- currentTaskType(now: Date): TaskType | undefined;
2329
- taskStartTime(index: number): number;
2330
- taskElapsed(index: number, now: Date): number;
2331
- taskRemaining(index: number, now: Date): number;
2332
- taskComplete(index: number, now: Date): boolean;
2333
- taskInProgress(index: number, now: Date): boolean;
2334
- currentTaskProgress(now: Date): number;
2335
- currentTaskProgressFloat(now: Date): number;
2336
- progress(now: Date): number;
2019
+ interface DerivedStratum {
2020
+ index: number;
2021
+ itemId: number;
2022
+ seed: bigint;
2023
+ richness: number;
2024
+ reserve: number;
2025
+ stats: ResourceStats;
2337
2026
  }
2338
- declare function createScheduleAccessor(entity: ScheduleData): ScheduleAccessor;
2027
+ declare function deriveStrata(coords: CoordinatesType, gameSeed: Checksum256Type, epochSeed: Checksum256Type): DerivedStratum[];
2339
2028
 
2340
- declare class EntityInventory extends Types.cargo_item {
2341
- private _item?;
2342
- get item(): Item;
2343
- get good(): Item;
2344
- get name(): string;
2345
- get unitMass(): UInt32;
2346
- get totalMass(): UInt64;
2347
- get hasCargo(): boolean;
2348
- get isEmpty(): boolean;
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;
2349
2050
  }
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[];
2350
2054
 
2351
- declare class InventoryAccessor {
2352
- private readonly entity;
2353
- private _items?;
2354
- constructor(entity: HasCargo);
2355
- get items(): EntityInventory[];
2356
- get totalMass(): UInt64;
2357
- forItem(goodId: UInt64Type): EntityInventory | undefined;
2358
- get sellable(): EntityInventory[];
2359
- get hasSellable(): boolean;
2360
- get sellableCount(): number;
2055
+ type ReserveTier = 'small' | 'medium' | 'large' | 'massive' | 'motherlode';
2056
+ interface TierRange {
2057
+ min: number;
2058
+ max: number;
2361
2059
  }
2362
- declare function createInventoryAccessor(entity: HasCargo): InventoryAccessor;
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;
2363
2064
 
2364
- interface PackedModuleInput {
2365
- itemId: UInt16Type;
2366
- stats: UInt64Type;
2065
+ interface StatDefinition {
2066
+ key: string;
2067
+ label: string;
2068
+ abbreviation: string;
2069
+ purpose: string;
2070
+ inverted?: boolean;
2367
2071
  }
2368
- interface ShipStateInput {
2369
- id: UInt64Type;
2370
- owner: string;
2371
- name: string;
2372
- coordinates: CoordinatesType | {
2373
- x: number;
2374
- y: number;
2375
- z?: number;
2376
- };
2377
- hullmass?: number;
2378
- capacity?: number;
2379
- energy?: number;
2380
- modules?: PackedModuleInput[];
2381
- schedule?: Types.schedule;
2382
- cargo?: Types.cargo_item[];
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];
2383
2077
  }
2384
- declare class Ship extends Types.entity_info {
2385
- private _sched?;
2386
- private _inv?;
2387
- get name(): string;
2388
- get entityClass(): 'mobile';
2389
- get canUndeploy(): boolean;
2390
- get inv(): InventoryAccessor;
2391
- get inventory(): EntityInventory[];
2392
- get sched(): ScheduleAccessor;
2393
- get maxDistance(): UInt32;
2394
- get isIdle(): boolean;
2395
- getFlightOrigin(flightTaskIndex: number): Coordinates;
2396
- destinationLocation(): Coordinates | undefined;
2397
- /** Chain-tile coordinates at `now`. For smooth visual position use interpolatedPositionAt. */
2398
- positionAt(now: Date): Coordinates;
2399
- interpolatedPositionAt(now: Date): FloatPosition;
2400
- isInFlight(now: Date): boolean;
2401
- isRecharging(now: Date): boolean;
2402
- isLoading(now: Date): boolean;
2403
- isUnloading(now: Date): boolean;
2404
- isGathering(now: Date): boolean;
2405
- get hasEngines(): boolean;
2406
- get hasGenerator(): boolean;
2407
- get hasGatherer(): boolean;
2408
- get hasWarp(): boolean;
2409
- project(): ProjectedEntity;
2410
- projectAt(now: Date): ProjectedEntity;
2411
- get location(): Location;
2412
- get totalCargoMass(): UInt64;
2413
- get totalMass(): UInt64;
2414
- get maxCapacity(): UInt64;
2415
- hasSpace(goodMass: UInt64, quantity: number): boolean;
2416
- get availableCapacity(): UInt64;
2417
- getCargoForItem(goodId: UInt64Type): EntityInventory | undefined;
2418
- get sellableCargo(): EntityInventory[];
2419
- get hasSellableCargo(): boolean;
2420
- get sellableGoodsCount(): number;
2421
- get isFull(): boolean;
2422
- get energyPercent(): number;
2423
- get needsRecharge(): boolean;
2424
- hasEnergyFor(distance: UInt64): boolean;
2078
+ declare function resolveStats(category: ResourceCategory, stats: {
2079
+ stat1: number;
2080
+ stat2: number;
2081
+ stat3: number;
2082
+ }): NamedStats;
2083
+
2084
+ interface StackInput {
2085
+ quantity: number;
2086
+ stats: Record<string, number>;
2087
+ }
2088
+ interface CategoryStacks {
2089
+ category: ResourceCategory;
2090
+ stacks: StackInput[];
2091
+ }
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
+ }[];
2425
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;
2426
2141
 
2427
- interface InstalledModule {
2428
- slotIndex: number;
2429
- itemId: number;
2430
- stats: bigint;
2142
+ interface LocationStratum extends DerivedStratum {
2143
+ reserveMax: number;
2431
2144
  }
2432
-
2433
- interface WarehouseStateInput {
2434
- id: UInt64Type;
2435
- owner: string;
2436
- name: string;
2437
- coordinates: CoordinatesType | {
2438
- x: number;
2439
- y: number;
2440
- z?: number;
2441
- };
2442
- hullmass?: number;
2443
- capacity: number;
2444
- modules?: PackedModuleInput[];
2445
- schedule?: Types.schedule;
2446
- cargo?: Types.cargo_item[];
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[]>;
2447
2149
  }
2448
- declare class Warehouse extends Types.entity_info {
2449
- private _sched?;
2450
- private _inv?;
2451
- get name(): string;
2452
- get entityClass(): 'building';
2453
- get canDemolish(): boolean;
2454
- get inv(): InventoryAccessor;
2455
- get inventory(): EntityInventory[];
2456
- get sched(): ScheduleAccessor;
2457
- get isIdle(): boolean;
2458
- isLoading(now: Date): boolean;
2459
- isUnloading(now: Date): boolean;
2460
- get location(): Location;
2461
- get totalCargoMass(): UInt64;
2462
- get maxCapacity(): UInt64;
2463
- get availableCapacity(): UInt64;
2464
- hasSpace(goodMass: UInt64, quantity: number): boolean;
2465
- get isFull(): boolean;
2466
- getCargoForItem(goodId: UInt64Type): EntityInventory | undefined;
2467
- get orbitalAltitude(): number;
2468
- get totalMass(): UInt64;
2150
+
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>;
2469
2158
  }
2470
- declare function computeWarehouseCapabilities(modules: InstalledModule[], layout: EntitySlot[]): {
2471
- loaders?: {
2472
- mass: number;
2473
- thrust: number;
2474
- quantity: number;
2475
- };
2159
+
2160
+ type EntityRefInput = {
2161
+ entityType: NameType;
2162
+ entityId: UInt64Type;
2476
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[];
2186
+ }
2477
2187
 
2478
- interface ContainerStateInput {
2479
- id: UInt64Type;
2480
- owner: string;
2481
- name: string;
2482
- coordinates: CoordinatesType | {
2483
- x: number;
2484
- y: number;
2485
- z?: number;
2486
- };
2487
- hullmass: number;
2488
- capacity: number;
2489
- cargomass?: number;
2490
- cargo?: Types.cargo_item[];
2491
- 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;
2492
2194
  }
2493
- declare class Container extends Types.entity_info {
2494
- private _sched?;
2495
- get name(): string;
2496
- get entityClass(): 'mobile';
2497
- get canUndeploy(): boolean;
2498
- get sched(): ScheduleAccessor;
2499
- get isIdle(): boolean;
2500
- interpolatedPositionAt(now: Date): FloatPosition;
2501
- isLoading(now: Date): boolean;
2502
- isUnloading(now: Date): boolean;
2503
- get location(): Location;
2504
- get totalMass(): UInt64;
2505
- get maxCapacity(): UInt64;
2506
- get availableCapacity(): UInt64;
2507
- hasSpace(additionalMass: UInt64): boolean;
2508
- get isFull(): boolean;
2509
- get orbitalAltitude(): number;
2195
+ interface WireCoordinates {
2196
+ x: number;
2197
+ y: number;
2198
+ z?: number;
2510
2199
  }
2511
- declare function computeContainerCapabilities(stats: Record<string, number>): {
2512
- hullmass: number;
2513
- capacity: number;
2200
+ type SubscribeMessage = {
2201
+ type: 'subscribe';
2202
+ sub_id: string;
2203
+ bounds?: BoundingBox;
2204
+ owner?: string;
2205
+ prioritize_owner?: string;
2514
2206
  };
2515
- declare function computeContainerT2Capabilities(stats: Record<string, number>): {
2516
- hullmass: number;
2517
- capacity: number;
2207
+ type UpdateBoundsMessage = {
2208
+ type: 'update_bounds';
2209
+ sub_id: string;
2210
+ bounds: BoundingBox;
2211
+ };
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;
2247
+ owner: string;
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;
2518
2290
  };
2291
+ type ServerMessage = AckMessage | SnapshotMessage | UpdateMessage | BoundsDeltaMessage | EventMessage | EventCatchupCompleteMessage | PongMessage | ErrorMessage;
2519
2292
 
2520
- type SubscriptionEntityType = 'ship' | 'warehouse' | 'container';
2521
- type EntityInstance = Ship | Warehouse | Container;
2293
+ type SubscriptionEntityType = 'ship' | 'warehouse' | 'container' | 'nexus';
2294
+ type EntityInstance = Entity$1;
2522
2295
  interface SubscriptionsOptions {
2523
2296
  url: string;
2524
2297
  minReconnectDelay?: number;
@@ -2593,92 +2366,32 @@ declare class GameContext {
2593
2366
  constructor(client: APIClient, server: Contract$2, platform: Contract$2);
2594
2367
  get entities(): EntitiesManager;
2595
2368
  get players(): PlayersManager;
2596
- get locations(): LocationsManager;
2597
- get epochs(): EpochsManager;
2598
- get actions(): ActionsManager;
2599
- setSubscriptionsUrl(url: string): void;
2600
- get subscriptions(): SubscriptionsManager;
2601
- getGame(reload?: boolean): Promise<Types$1.game_row>;
2602
- getState(reload?: boolean): Promise<GameState>;
2603
- get cachedGame(): Types$1.game_row | undefined;
2604
- get cachedState(): GameState | undefined;
2605
- }
2606
-
2607
- declare abstract class BaseManager {
2608
- protected readonly context: GameContext;
2609
- constructor(context: GameContext);
2610
- protected get client(): _wharfkit_antelope.APIClient;
2611
- protected get server(): _wharfkit_contract.Contract;
2612
- protected get platform(): _wharfkit_contract.Contract;
2613
- protected getGame(): Promise<Types$1.game_row>;
2614
- protected getState(): Promise<GameState>;
2615
- }
2616
-
2617
- interface ExtractorStateInput {
2618
- id: UInt64Type;
2619
- owner: string;
2620
- name: string;
2621
- coordinates: CoordinatesType | {
2622
- x: number;
2623
- y: number;
2624
- z?: number;
2625
- };
2626
- hullmass?: number;
2627
- capacity?: number;
2628
- energy?: number;
2629
- modules?: PackedModuleInput[];
2630
- schedule?: Types.schedule;
2631
- cargo?: Types.cargo_item[];
2632
- }
2633
- declare class Extractor extends Types.entity_info {
2634
- private _sched?;
2635
- private _inv?;
2636
- get name(): string;
2637
- get entityClass(): 'building';
2638
- get canDemolish(): boolean;
2639
- get inv(): InventoryAccessor;
2640
- get inventory(): EntityInventory[];
2641
- get sched(): ScheduleAccessor;
2642
- get isIdle(): boolean;
2643
- get location(): Location;
2644
- get totalCargoMass(): UInt64;
2645
- get maxCapacity(): UInt64;
2646
- get availableCapacity(): UInt64;
2647
- get isFull(): boolean;
2648
- get totalMass(): UInt64;
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;
2649
2378
  }
2650
- interface ExtractorCapabilities {
2651
- generator?: {
2652
- capacity: number;
2653
- recharge: number;
2654
- };
2655
- gatherer?: {
2656
- yield: number;
2657
- drain: number;
2658
- depth: number;
2659
- speed: number;
2660
- };
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>;
2661
2388
  }
2662
- declare function computeExtractorCapabilities(modules: InstalledModule[], layout: EntitySlot[]): ExtractorCapabilities;
2663
2389
 
2664
- type EntityType = 'ship' | 'warehouse' | 'extractor' | 'container';
2665
2390
  declare class EntitiesManager extends BaseManager {
2666
- getEntity(id: UInt64Type): Promise<Ship | Warehouse | Extractor | Container>;
2667
- getEntities(owner: NameType | Types.player_row, type?: EntityType): Promise<(Ship | Warehouse | Extractor | Container)[]>;
2668
- getSummaries(owner: NameType | Types.player_row, type?: EntityType): Promise<Types.entity_summary[]>;
2669
- getShip(id: UInt64Type): Promise<Ship>;
2670
- getWarehouse(id: UInt64Type): Promise<Warehouse>;
2671
- getContainer(id: UInt64Type): Promise<Container>;
2672
- getExtractor(id: UInt64Type): Promise<Extractor>;
2673
- getShips(owner: NameType | Types.player_row): Promise<Ship[]>;
2674
- getWarehouses(owner: NameType | Types.player_row): Promise<Warehouse[]>;
2675
- getContainers(owner: NameType | Types.player_row): Promise<Container[]>;
2676
- getExtractors(owner: NameType | Types.player_row): Promise<Extractor[]>;
2677
- getShipSummaries(owner: NameType | Types.player_row): Promise<Types.entity_summary[]>;
2678
- getWarehouseSummaries(owner: NameType | Types.player_row): Promise<Types.entity_summary[]>;
2679
- getContainerSummaries(owner: NameType | Types.player_row): Promise<Types.entity_summary[]>;
2680
- getExtractorSummaries(owner: NameType | Types.player_row): Promise<Types.entity_summary[]>;
2681
- 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[]>;
2682
2395
  private resolveOwner;
2683
2396
  }
2684
2397
 
@@ -2709,10 +2422,34 @@ declare class Shipload {
2709
2422
  getState(reload?: boolean): Promise<GameState>;
2710
2423
  }
2711
2424
 
2712
- declare function makeShip(state: ShipStateInput): Ship;
2713
- declare function makeWarehouse(state: WarehouseStateInput): Warehouse;
2714
- declare function makeExtractor(state: ExtractorStateInput): Extractor;
2715
- declare function makeContainer(state: ContainerStateInput): Container;
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
+ }
2716
2453
 
2717
2454
  declare const itemIds: number[];
2718
2455
  declare function getItem(itemId: UInt16Type): Item;
@@ -2749,6 +2486,104 @@ declare function deriveLocation(gameSeed: Checksum256Type, coordinates: Coordina
2749
2486
  declare function hash(seed: Checksum256Type, string: string): Checksum256;
2750
2487
  declare function hash512(seed: Checksum256Type, string: string): Checksum512;
2751
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
+
2752
2587
  interface CargoData {
2753
2588
  cargo: EntityInventory[];
2754
2589
  }
@@ -2795,6 +2630,51 @@ declare function cargoItem(src: {
2795
2630
  modules?: Types.module_entry[];
2796
2631
  }, quantity: bigint | number): ActionParams.Type.cargo_item;
2797
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
+
2798
2678
  type TaskCargoDirection = 'in' | 'out';
2799
2679
  interface TaskCargoChange {
2800
2680
  direction: TaskCargoDirection;
@@ -2819,43 +2699,6 @@ type WarehouseEntity = Entity & StorageCapability & Partial<LoaderCapability> &
2819
2699
  type ContainerEntity = Entity & StorageCapability & MassCapability & ScheduleCapability;
2820
2700
  type AnyEntity = ShipEntity | WarehouseEntity | ContainerEntity;
2821
2701
 
2822
- declare const ENTITY_SHIP: Name;
2823
- declare const ENTITY_WAREHOUSE: Name;
2824
- declare const ENTITY_EXTRACTOR: Name;
2825
- declare const ENTITY_CONTAINER: Name;
2826
- declare enum EntityClass {
2827
- OrbitalVessel = 0,
2828
- PlanetaryStructure = 1
2829
- }
2830
- declare function getEntityClass(entityType: Name | EntityTypeName): EntityClass;
2831
- declare function getPackedEntityType(itemId: number): Name | null;
2832
- type EntityTypeName = 'ship' | 'warehouse' | 'extractor' | 'container';
2833
- interface EntityTraits {
2834
- typeName: Name;
2835
- isMovable: boolean;
2836
- hasEnergy: boolean;
2837
- hasLoaders: boolean;
2838
- hasModules: boolean;
2839
- notFoundError: string;
2840
- }
2841
- declare const shipTraits: EntityTraits;
2842
- declare const warehouseTraits: EntityTraits;
2843
- declare const extractorTraits: EntityTraits;
2844
- declare const containerTraits: EntityTraits;
2845
- declare function getEntityTraits(entityType: Name | EntityTypeName): EntityTraits;
2846
- declare function isShip(entity: {
2847
- type?: Name;
2848
- }): boolean;
2849
- declare function isWarehouse(entity: {
2850
- type?: Name;
2851
- }): boolean;
2852
- declare function isExtractor(entity: {
2853
- type?: Name;
2854
- }): boolean;
2855
- declare function isContainer(entity: {
2856
- type?: Name;
2857
- }): boolean;
2858
-
2859
2702
  declare function canMove(e: Entity): e is Entity & MovementCapability & EnergyCapability;
2860
2703
  declare function hasEnergy(e: Entity): e is Entity & EnergyCapability;
2861
2704
  declare function hasStorage(e: Entity): e is Entity & StorageCapability;
@@ -3016,11 +2859,18 @@ declare function computeHaulerCapabilities(stats: Record<string, number>): {
3016
2859
  declare function computeStorageCapabilities(stats: Record<string, number>, baseCapacity: number): {
3017
2860
  capacityBonus: number;
3018
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
+ };
3019
2867
  declare function computeWarehouseHullCapabilities(stats: Record<string, number>): {
3020
2868
  hullmass: number;
3021
2869
  capacity: number;
3022
2870
  };
3023
- interface ShipCapabilities {
2871
+ interface ComputedCapabilities {
2872
+ hullmass: number;
2873
+ capacity: number;
3024
2874
  engines?: {
3025
2875
  thrust: number;
3026
2876
  drain: number;
@@ -3035,11 +2885,6 @@ interface ShipCapabilities {
3035
2885
  depth: number;
3036
2886
  speed: number;
3037
2887
  };
3038
- hauler?: {
3039
- capacity: number;
3040
- efficiency: number;
3041
- drain: number;
3042
- };
3043
2888
  loaders?: {
3044
2889
  mass: number;
3045
2890
  thrust: number;
@@ -3049,8 +2894,24 @@ interface ShipCapabilities {
3049
2894
  speed: number;
3050
2895
  drain: number;
3051
2896
  };
2897
+ hauler?: {
2898
+ capacity: number;
2899
+ efficiency: number;
2900
+ drain: number;
2901
+ };
2902
+ warp?: {
2903
+ range: number;
2904
+ };
3052
2905
  }
3053
- 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
+ };
3054
2915
 
3055
2916
  interface ResolvedItemStat {
3056
2917
  key: string;
@@ -3318,12 +3179,42 @@ declare class WebSocketConnection {
3318
3179
  get isConnected(): boolean;
3319
3180
  }
3320
3181
 
3321
- declare function mapEntity(ei: Types.entity_info): Ship | Warehouse | Container;
3182
+ declare function mapEntity(ei: Types.entity_info): Entity$1;
3322
3183
  declare function parseWireEntity(raw: WireEntity): Types.entity_info;
3323
3184
 
3324
3185
  declare function setSubscriptionsDebug(on: boolean): void;
3325
3186
  declare function isSubscriptionsDebugEnabled(): boolean;
3326
3187
 
3188
+ interface ContractProjectedState {
3189
+ owner: {
3190
+ toString(): string;
3191
+ };
3192
+ coordinates: Types.coordinates;
3193
+ energy?: UInt16;
3194
+ cargomass: UInt32;
3195
+ cargo: Types.cargo_view[];
3196
+ hullmass?: UInt32;
3197
+ capacity?: UInt32;
3198
+ engines?: Types.movement_stats;
3199
+ loaders?: Types.loader_stats;
3200
+ generator?: Types.energy_stats;
3201
+ hauler?: Types.hauler_stats;
3202
+ }
3203
+ interface ProjectionComparisonOptions {
3204
+ step?: number;
3205
+ }
3206
+ declare function assertProjectionEquals(contract: ContractProjectedState, sdk: ProjectedEntity, options?: ProjectionComparisonOptions): void;
3207
+
3208
+ declare const CATALOG_FILES_REL: readonly ["items.json", "recipes.json", "entities.json", "kind-registry.json", "item-ids.ts"];
3209
+ declare function computeCatalogHash(filePaths: ReadonlyArray<string>): string;
3210
+
3211
+ type Ship = Entity$1;
3212
+ type Warehouse = Entity$1;
3213
+ type Container = Entity$1;
3214
+ type Extractor = Entity$1;
3215
+ type Factory = Entity$1;
3216
+ type Nexus = Entity$1;
3217
+
3327
3218
  type movement_stats = Types.movement_stats;
3328
3219
  type energy_stats = Types.energy_stats;
3329
3220
  type loader_stats = Types.loader_stats;
@@ -3334,4 +3225,4 @@ type gatherer_stats = Types.gatherer_stats;
3334
3225
  type location_static = Types.location_static;
3335
3226
  type location_derived = Types.location_derived;
3336
3227
 
3337
- 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_CAPACITY_EXCEEDED, 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_CAPACITY_EXCEEDED, ENTITY_CONTAINER, ENTITY_EXTRACTOR, 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, 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_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, 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_THERE, SHIP_ALREADY_TRAVELING, SHIP_CANNOT_BUY_TRAVELING, SHIP_CANNOT_CANCEL_TASK, SHIP_CANNOT_UPDATE_TRAVELING, SHIP_CAPACITY_EXCEEDED, SHIP_CARGO_NOT_LOADED, SHIP_CARGO_NOT_OWNED, SHIP_INVALID_CARGO, SHIP_INVALID_DESTINATION, SHIP_INVALID_TRAVEL_DURATION, SHIP_NOT_ARRIVED, SHIP_NOT_ENOUGH_ENERGY, SHIP_NOT_ENOUGH_ENERGY_CAPACITY, 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_CAPACITY_EXCEEDED, 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, 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, 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, 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, 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 };
3228
+ 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, CATALOG_FILES_REL, 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, ContractProjectedState, 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, ProjectionComparisonOptions, 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, assertProjectionEquals, 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, computeCatalogHash, 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 };