@shipload/sdk 1.0.0-next.39 → 1.0.0-next.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/shipload.d.ts CHANGED
@@ -2736,8 +2736,8 @@ declare const DEPTH_THRESHOLD_T4 = 12000;
2736
2736
  declare const DEPTH_THRESHOLD_T5 = 22000;
2737
2737
  declare const LOCATION_MIN_DEPTH = 500;
2738
2738
  declare const LOCATION_MAX_DEPTH = 65535;
2739
- declare const YIELD_FRACTION_SHALLOW = 0.0025;
2740
- declare const YIELD_FRACTION_DEEP = 0.0005;
2739
+ declare const YIELD_FRACTION_SHALLOW = 0.005;
2740
+ declare const YIELD_FRACTION_DEEP = 0.001;
2741
2741
  declare function yieldThresholdAt(stratum: number): number;
2742
2742
  declare const PLANET_SUBTYPE_GAS_GIANT = 0;
2743
2743
  declare const PLANET_SUBTYPE_ROCKY = 1;
@@ -2765,6 +2765,8 @@ declare const RESERVE_TIERS: Record<ReserveTier, TierRange>;
2765
2765
  declare const TIER_ROLL_MAX = 65536;
2766
2766
  declare function rollTier(tierRoll: number, stratum: number): ReserveTier;
2767
2767
  declare function rollWithinTier(withinRoll: number, range: TierRange, resourceUnitMass: number): number;
2768
+ declare const RESOURCE_TIER_MULT_TENTHS: readonly [200, 154, 118, 91, 70, 54, 41, 32, 24, 19];
2769
+ declare function applyResourceTierMultiplier(units: number, resourceTier: number): number;
2768
2770
  declare function tierOfReserve(reserve: number, itemId: number): ReserveTier | null;
2769
2771
 
2770
2772
  interface EffectiveReserveInput {
@@ -4011,6 +4013,33 @@ declare function getStatMappings(): StatMapping[];
4011
4013
  declare function getStatMappingsForStat(stat: string): StatMapping[];
4012
4014
  declare function getStatMappingsForCapability(capability: string): StatMapping[];
4013
4015
 
4016
+ declare function getAllRecipes(): Recipe[];
4017
+ type ResourceDemand = Partial<Record<ResourceCategory, number>>;
4018
+ declare function getResourceDemand(itemId: number, quantity?: number): ResourceDemand;
4019
+ interface StatFlow {
4020
+ slotIndex: number;
4021
+ capability?: string;
4022
+ attribute?: string;
4023
+ sourceStatIndex: number;
4024
+ sourceStatLabel?: string;
4025
+ }
4026
+ interface RecipeConsumer {
4027
+ outputItemId: number;
4028
+ quantity: number;
4029
+ statFlows: StatFlow[];
4030
+ }
4031
+ /** Every recipe that consumes `componentItemId`, with how its stats flow through. */
4032
+ declare function getRecipeConsumers(componentItemId: number): RecipeConsumer[];
4033
+ interface DemandRow {
4034
+ itemId: number;
4035
+ consumerCount: number;
4036
+ statSourceCount: number;
4037
+ sinkOnlyCount: number;
4038
+ consumers: number[];
4039
+ }
4040
+ /** Demand tally for every item consumed as a recipe input, ascending by usage. */
4041
+ declare function getComponentDemand(): DemandRow[];
4042
+
4014
4043
  type BuildMethod = 'craft+deploy' | 'plot';
4015
4044
  declare function availableBuildMethods(itemId: number): BuildMethod[];
4016
4045
  declare function isBuildable(itemId: number): boolean;
@@ -4649,4 +4678,4 @@ type entity_row = Types.entity_row;
4649
4678
  type location_static = Types.location_static;
4650
4679
  type location_derived = Types.location_derived;
4651
4680
 
4652
- export { ALL_ENTITY_TYPES, ATOMICASSETS_ACCOUNT, AckMessage, ActionsManager, AnyEntity, AtomicAssetRow, AtomicAttributeType, AtomicSchemaRow, BASE_ORBITAL_MASS, BLEND_INPUTS_MUST_MATCH, BLEND_REQUIRES_MULTIPLE, BLEND_STAT_LESS_NOT_SUPPORTED, BoundingBox, BoundsDeltaMessage, BoundsSubscriptionHandle, BroadEntitySubscriptionFilter, BuildMethod, BuildState, BuildableTarget, CANCEL_CONTAINS_GROUPED_TASK, CAP_DEMOLISH, CAP_MODULES, CAP_UNDEPLOY, CAP_WRAP, CATEGORY_LABELS, COMMIT_ALREADY_SET, COMMIT_CANNOT_MATCH, COMMIT_NOT_SET, COMPANY_NOT_FOUND, COMPONENT_TIER_PREFIXES, CONTAINER_NOT_FOUND, CONTAINER_Z, COORD_MAX, COORD_MIN, COORD_OFFSET, CRAFT_ENERGY_DIVISOR, CRAFT_EXCEEDS_ENERGY_CAPACITY, CRAFT_NOT_ENOUGH_ENERGY, CancelBlockReason, CancelEffects, CancelEligibilityInput, CancelPlan, CancelRefund, CancelReleasedHold, CapabilityAttribute, CapabilityInput, CargoData, CargoMassInfo, CargoStack, CategoryInfo, CategoryStacks, ClientMessage, ComputedCapabilities, ConnectionState, ConstructionManager, Container, ContainerEntity, Coord, CoordinateAddress, Coordinates, CoordinatesType, CounterpartLookup, CraftedItemCategory, CrafterCapability, CrafterStats, DEPLOY_ENTITY_HAS_SCHEDULE, DEPTH_THRESHOLD_T1, DEPTH_THRESHOLD_T2, DEPTH_THRESHOLD_T3, DEPTH_THRESHOLD_T4, DEPTH_THRESHOLD_T5, DESTINATION_CAPACITY_EXCEEDED, DecodedAtomicAsset, DerivedStratum, DescribeOptions, DisplayNameResult, Distance, ENGINE_DRAIN_BASE, ENGINE_DRAIN_REF_THM, ENGINE_DRAIN_REF_THRUST, 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, EffectiveReserveInput, EnergyCapability, EntitiesManager, EntitiesSubscriptionHandle, Entity$1 as Entity, EntityCapabilities, EntityClass, EntityDeletedMessage, EntityInfo$2 as EntityInfo, EntityInstance, EntityInventory, EntityLayout, EntityRefInput, EntitySlot, EntityState, EntityStateInput, EntitySubscriptionFilter, EntitySubscriptionHandle, EntitySubscriptionHandlers, EntitySubscriptionMeta, EntityTypeName, EpochInfo, EpochsManager, ErrorMessage, EstimateTravelTimeOptions, EstimatedTravelTime, EventCatchupCompleteMessage, EventMessage, ExactEntitySubscriptionFilter, Extractor, Factory, FetchAssetsOptions, FinalizerCapability, FinalizerEntityRef, FloatPosition, GAME_NOT_FOUND, GAME_SEED_NOT_SET, GATHERER_DEPTH_MAX_TIER, GATHERER_DEPTH_TABLE, GATHER_EXCEEDS_ENERGY_CAPACITY, GATHER_MASS_DIVISOR, 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, GatherPlanEntity, GathererCapability, GathererDepthParams, GathererStats, HasCapacity, HasCargo, HasCargomass, HasScheduleAndLocation, HoldKind, INSUFFICIENT_BALANCE, INSUFFICIENT_ITEM_QUANTITY, INSUFFICIENT_ITEM_SUPPLY, INVALID_AMOUNT, ITEM_BATTERY_T1, ITEM_BEAM, 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_CERAMIC, 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_FRAME, ITEM_FRAME_T2, 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_LAUNCHER_T1, ITEM_LOADER_T1, ITEM_MASS_CATCHER_T1_PACKED, ITEM_MASS_DRIVER_T1_PACKED, 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_PLASMA_CELL, ITEM_PLATE, ITEM_PLATE_T2, ITEM_POLYMER, ITEM_REACTOR, 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_RESIN, ITEM_RESONATOR, ITEM_SENSOR, ITEM_SHIP_T1_PACKED, ITEM_STORAGE_T1, ITEM_TYPE_COMPONENT, ITEM_TYPE_ENTITY, ITEM_TYPE_MODULE, ITEM_TYPE_RESOURCE, ITEM_WAREHOUSE_T1_PACKED, ITEM_WARP_T1, IdleResolveTarget, ImmutableEntry, ImmutableModuleSlot, InboundTransfer, InstalledModule, InventoryAccessor, Item, ItemType, KindMeta, LANE_BARRIER, LANE_MOBILITY, LOCAL_HALF, LOCATION_MAX_DEPTH, LOCATION_MIN_DEPTH, LanePlanEntry, LaneView, LaunchNumericInput, LaunchQuote, LaunchQuoteCatcher, LaunchQuoteLauncher, LaunchStatsInput, LoadTimeBreakdown, LoaderCapability, LoaderStats, Location, LocationStratum, LocationType, LocationsManager, MAX_LEGS, MAX_ORBITAL_ALTITUDE, MAX_STARS_PER_STAT, MAX_STAR_RATING, MIN_ORBITAL_ALTITUDE, MIN_TRANSFER_DISTANCE_ORBITAL_VESSEL, MIN_TRANSFER_DISTANCE_PLANETARY_STRUCTURE, MODULE_ANY, MODULE_BATTERY, 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_TIER_PREFIXES, MODULE_TYPE_MISMATCH, MODULE_WARP, MassCapability, MintAssetParams, ModuleDescription, ModuleEntry, ModuleType, MovementCapability, index as NFT, NFTCargoItem, NFTCommonBase, NFTInstalledModule, NFTModuleSlot, NO_SCHEDULE, NamedStats, Neighbor, Nexus, NftConfigForItem, NftManager, OrderedTask, 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, PlanRouteParams, PlanTarget, PlanetSubtypeInfo, platform as PlatformContract, Types$1 as PlatformTypes, Player, PlayerStateInput, PlayersManager, PongMessage, Projectable, ProjectedEntity, ProjectionOptions, RECIPE_INPUTS_EXCESS, RECIPE_INPUTS_INSUFFICIENT, RECIPE_INPUTS_INVALID, RECIPE_INPUTS_MIXED, RECIPE_NOT_FOUND, REGION_DIV, REGION_PER_AXIS, REQUIRES_MORE_THAN_ONE, REQUIRES_POSITIVE_VALUE, RESERVE_TIERS, RESOLVE_COUNT_EXCEEDS_COMPLETED, RESOURCE_TIER_ADJECTIVES, RawData, ReachStats, Recipe, RecipeInput, RecipeSlotInput, RenderDescriptionOptions, Reservation, ReserveTier, ResolvedAttributeGroup, ResolvedCrafterLane, ResolvedEvent, ResolvedGathererLane, ResolvedItem, ResolvedItemStat, ResolvedItemType, ResolvedLoaderLane, ResolvedModuleSlot, ResourceCategory, ResourceStats, RouteFailure, RouteFailureReason, RoutePlan, RouteResult, SECTORS_PER_AXIS, SECTOR_DIV, SHIPLOAD_COLLECTION, 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, STAR_STEP, ScheduleAccessor, ScheduleCapability, ScheduleData, ScheduledBuild, SchemaField, server as ServerContract, ServerMessage, Types as ServerTypes, Ship, ShipEntity, ShipLike, Shipload, SlotConsumer, SlotConsumerKind, SnapshotMessage, SourceCargoStack, SourceEntityRef, StackInput, StatDefinition, StatMapping, StatSlot, StorageCapability, StratumInfo, SubscribeEntityMessage, SubscribeEventsMessage, SubscribeMessage, SubscriptionEntityType, SubscriptionsManager, SubscriptionsOptions, SystemGraph, TIER_ROLL_MAX, TRAVEL_MAX_DURATION, TaskCancelable, TaskCargoChange, TaskCargoDirection, TaskType, TemplateMeta, TextSpan, TierRange, TransferEntity, UnsubscribeEntityMessage, UnsubscribeEventsMessage, UnsubscribeMessage, UpdateBoundsMessage, UpdateMessage, ValidateDisplayNameOptions, WAREHOUSE_ALREADY_AT_LOCATION, WAREHOUSE_NOT_FOUND, WARP_HAS_CARGO, WARP_HAS_SCHEDULE, WARP_NOT_FULL_ENERGY, WARP_NO_CAPABILITY, WARP_OUT_OF_RANGE, WH, WOULD_OVERFILL, WOULD_STRAND, Warehouse, WarehouseEntity, WebSocketConnection, WebSocketConnectionOptions, WireCoordinates, WireEntity, WrapDeposit, YIELD_FRACTION_DEEP, YIELD_FRACTION_SHALLOW, addressFromCoordinates, allBuildableItems, allPlotBuildableItems, availableBuildMethods, availableCapacity$1 as availableCapacity, availableCapacityFromMass, availableForItem, baseName, blendCargoStacks, blendComponentStacks, blendCrossGroup, blendStacks, buildComponentImmutable, buildEntityDescription, buildEntityImmutable, buildImmutableData, buildMintAssetAction, buildModuleImmutable, buildResourceImmutable, calcCargoItemMass, calcCargoMass, calcEnergyUsage, calcStacksMass, calc_acceleration, calc_craft_duration, calc_craft_energy, calc_energyusage, calc_flighttime, calc_gather_duration, calc_gather_energy, calc_gather_rate, calc_loader_acceleration, calc_loader_flighttime, calc_onesided_duration, calc_orbital_altitude, calc_rechargetime, calc_ship_acceleration, calc_ship_flighttime, calc_ship_mass, calc_ship_rechargetime, calc_transfer_duration, calc_transit_duration, calculateFlightTime, calculateLoadTimeBreakdown, calculateRefuelingTime, calculateTransferTime, canMove, cancelEligibility, candidateLaneCompletesAt, capabilityAttributes, capabilityNames, capsHasCrafter, capsHasGatherer, capsHasHauler, capsHasLauncher, capsHasLoaders, capsHasMass, capsHasMovement, capsHasStorage, cargoItem, cargoItemToStack, cargoReadyAt, cargoRef, cargoUtils, cargo_item, categoryColors, categoryFromIndex, categoryLabel, categoryLabelFromIndex, componentIcon, composeIdleResolve, computeBaseCapacity, computeBaseCapacityShip, computeBaseCapacityWarehouse, computeBaseHullmass, computeBatteryCapabilities, computeComponentStats, computeContainerCapabilities, computeContainerT2Capabilities, computeCraftedOutputStats, computeCrafterCapabilities, computeCrafterDrain, computeCrafterSpeed, computeEngineCapabilities, computeEngineDrain, computeEngineThrust, computeEntityCapabilities, computeEntityStats, computeGathererCapabilities, computeGathererDepth, computeGathererDrain, computeGathererYield, computeGeneratorCap, computeGeneratorCapabilities, computeGeneratorRech, computeGroupPerLegReach, computeHaulPenalty, computeHaulerCapabilities, computeHaulerCapacity, computeHaulerDrain$1 as computeHaulerDrain, computeHaulerEfficiency, computeInputMass, computeLauncherCapabilities, computeLoaderCapabilities, computeLoaderMass, computeLoaderThrust, computeNftImageUrl, computePerLegReach, computeShipHullCapabilities, computeStorageCapabilities, computeTravelDrain, computeWarehouseHullCapabilities, computeWarpCapabilities, computeWarpRange, coordsToLocationId, createInventoryAccessor, createProjectedEntity, createScheduleAccessor, decodeAddress, decodeAtomicAsset, decodeCraftedItemStats, decodeRegion, decodeSector, 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, encodeAddress, encodeAddressMemo, encodeGatheredCargoStats, encodeRegion, encodeSector, encodeStats, energyAtTime, energyPercent, energy_stats, entityDisplayName, entity_row, estimateDealTravelTime, estimateTravelTime, feistel, feistelInv, fetchAtomicAssetsForOwner, fetchAtomicSchemas, filterByBuildMethod, findNearbyPlanets, flightSpeedFactor, formatLocation, formatMass, formatMassDelta, formatMassScaled, formatModuleLine, formatTier, gathererDepthForTier, getCapabilityAttributes, getCategoryInfo, getComponents, getCurrentEpoch, getDepthThreshold, getDestinationLocation, getEffectiveReserve, getEligibleResources, getEntityClass, getEntityItems, getEntityLayout, getEpochInfo, getFlightOrigin, getInterpolatedPosition, getItem, getItems, getKindMeta, getLocationCandidates, getLocationKind, 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, isBuildable, isContainer, isCraftedItem, isExtractor, isFactory, isFull$1 as isFull, isFullFromMass, isGatherableLocation, isInvertedAttribute, isLocationBuildable, isModuleItem, isNexus, isPlot, isPlotBuildable, isRelatedItem, isShip, isSubscriptionsDebugEnabled, isValidWormholePair, isWarehouse, itemAbbreviations, itemCategory, itemIds, itemOffset, itemTier, itemTypeCode, kindCan, lane, laneKeyForModule, lerp, location_derived, location_static, makeEntity, mapEntity, maxCraftable, maxTravelDistance, mergeStacks, moduleAccepts, moduleDisplayName, moduleIcon, moduleSlotTypeToCode, movement_stats, needsRecharge, normalizeDisplayName, parseWireEntity, partnerRegion, planParallelGather, planParallelTransfer, planRoute, projectEntity, projectEntityAt, projectRemainingAt, projectedCargoAvailableAt, rawScheduleEnd, readCommonBase, regionOf, removeFromStacks, renderDescription, resolveItem, resolveItemCategory, resolveLaneCrafter, resolveLaneGatherer, resolveLaneLoader, resolveLockedAmount, resolveStats, rollTier, rollWithinTier, rollupCrafter, rollupGatherer, rollupLoaders, rotation, schedule, sdkSystemGraph, selectGatherLane, setSubscriptionsDebug, stackKey, stackToCargoItem, stacksEqual, starRating, starsForStat, statMagnitude, subtractFromStacks, task, taskCargoChanges, taskCargoEffect, tierAdjective, tierColors, tierOfReserve, toLocation, typeLabel, validateDisplayName, validateSchedule, workerLaneKey, wormholeAt, wormholeAtRegionEndpoint, yieldThresholdAt };
4681
+ export { ALL_ENTITY_TYPES, ATOMICASSETS_ACCOUNT, AckMessage, ActionsManager, AnyEntity, AtomicAssetRow, AtomicAttributeType, AtomicSchemaRow, BASE_ORBITAL_MASS, BLEND_INPUTS_MUST_MATCH, BLEND_REQUIRES_MULTIPLE, BLEND_STAT_LESS_NOT_SUPPORTED, BoundingBox, BoundsDeltaMessage, BoundsSubscriptionHandle, BroadEntitySubscriptionFilter, BuildMethod, BuildState, BuildableTarget, CANCEL_CONTAINS_GROUPED_TASK, CAP_DEMOLISH, CAP_MODULES, CAP_UNDEPLOY, CAP_WRAP, CATEGORY_LABELS, COMMIT_ALREADY_SET, COMMIT_CANNOT_MATCH, COMMIT_NOT_SET, COMPANY_NOT_FOUND, COMPONENT_TIER_PREFIXES, CONTAINER_NOT_FOUND, CONTAINER_Z, COORD_MAX, COORD_MIN, COORD_OFFSET, CRAFT_ENERGY_DIVISOR, CRAFT_EXCEEDS_ENERGY_CAPACITY, CRAFT_NOT_ENOUGH_ENERGY, CancelBlockReason, CancelEffects, CancelEligibilityInput, CancelPlan, CancelRefund, CancelReleasedHold, CapabilityAttribute, CapabilityInput, CargoData, CargoMassInfo, CargoStack, CategoryInfo, CategoryStacks, ClientMessage, ComputedCapabilities, ConnectionState, ConstructionManager, Container, ContainerEntity, Coord, CoordinateAddress, Coordinates, CoordinatesType, CounterpartLookup, CraftedItemCategory, CrafterCapability, CrafterStats, DEPLOY_ENTITY_HAS_SCHEDULE, DEPTH_THRESHOLD_T1, DEPTH_THRESHOLD_T2, DEPTH_THRESHOLD_T3, DEPTH_THRESHOLD_T4, DEPTH_THRESHOLD_T5, DESTINATION_CAPACITY_EXCEEDED, DecodedAtomicAsset, DemandRow, DerivedStratum, DescribeOptions, DisplayNameResult, Distance, ENGINE_DRAIN_BASE, ENGINE_DRAIN_REF_THM, ENGINE_DRAIN_REF_THRUST, 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, EffectiveReserveInput, EnergyCapability, EntitiesManager, EntitiesSubscriptionHandle, Entity$1 as Entity, EntityCapabilities, EntityClass, EntityDeletedMessage, EntityInfo$2 as EntityInfo, EntityInstance, EntityInventory, EntityLayout, EntityRefInput, EntitySlot, EntityState, EntityStateInput, EntitySubscriptionFilter, EntitySubscriptionHandle, EntitySubscriptionHandlers, EntitySubscriptionMeta, EntityTypeName, EpochInfo, EpochsManager, ErrorMessage, EstimateTravelTimeOptions, EstimatedTravelTime, EventCatchupCompleteMessage, EventMessage, ExactEntitySubscriptionFilter, Extractor, Factory, FetchAssetsOptions, FinalizerCapability, FinalizerEntityRef, FloatPosition, GAME_NOT_FOUND, GAME_SEED_NOT_SET, GATHERER_DEPTH_MAX_TIER, GATHERER_DEPTH_TABLE, GATHER_EXCEEDS_ENERGY_CAPACITY, GATHER_MASS_DIVISOR, 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, GatherPlanEntity, GathererCapability, GathererDepthParams, GathererStats, HasCapacity, HasCargo, HasCargomass, HasScheduleAndLocation, HoldKind, INSUFFICIENT_BALANCE, INSUFFICIENT_ITEM_QUANTITY, INSUFFICIENT_ITEM_SUPPLY, INVALID_AMOUNT, ITEM_BATTERY_T1, ITEM_BEAM, 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_CERAMIC, 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_FRAME, ITEM_FRAME_T2, 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_LAUNCHER_T1, ITEM_LOADER_T1, ITEM_MASS_CATCHER_T1_PACKED, ITEM_MASS_DRIVER_T1_PACKED, 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_PLASMA_CELL, ITEM_PLATE, ITEM_PLATE_T2, ITEM_POLYMER, ITEM_REACTOR, 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_RESIN, ITEM_RESONATOR, ITEM_SENSOR, ITEM_SHIP_T1_PACKED, ITEM_STORAGE_T1, ITEM_TYPE_COMPONENT, ITEM_TYPE_ENTITY, ITEM_TYPE_MODULE, ITEM_TYPE_RESOURCE, ITEM_WAREHOUSE_T1_PACKED, ITEM_WARP_T1, IdleResolveTarget, ImmutableEntry, ImmutableModuleSlot, InboundTransfer, InstalledModule, InventoryAccessor, Item, ItemType, KindMeta, LANE_BARRIER, LANE_MOBILITY, LOCAL_HALF, LOCATION_MAX_DEPTH, LOCATION_MIN_DEPTH, LanePlanEntry, LaneView, LaunchNumericInput, LaunchQuote, LaunchQuoteCatcher, LaunchQuoteLauncher, LaunchStatsInput, LoadTimeBreakdown, LoaderCapability, LoaderStats, Location, LocationStratum, LocationType, LocationsManager, MAX_LEGS, MAX_ORBITAL_ALTITUDE, MAX_STARS_PER_STAT, MAX_STAR_RATING, MIN_ORBITAL_ALTITUDE, MIN_TRANSFER_DISTANCE_ORBITAL_VESSEL, MIN_TRANSFER_DISTANCE_PLANETARY_STRUCTURE, MODULE_ANY, MODULE_BATTERY, 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_TIER_PREFIXES, MODULE_TYPE_MISMATCH, MODULE_WARP, MassCapability, MintAssetParams, ModuleDescription, ModuleEntry, ModuleType, MovementCapability, index as NFT, NFTCargoItem, NFTCommonBase, NFTInstalledModule, NFTModuleSlot, NO_SCHEDULE, NamedStats, Neighbor, Nexus, NftConfigForItem, NftManager, OrderedTask, 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, PlanRouteParams, PlanTarget, PlanetSubtypeInfo, platform as PlatformContract, Types$1 as PlatformTypes, Player, PlayerStateInput, PlayersManager, PongMessage, Projectable, ProjectedEntity, ProjectionOptions, RECIPE_INPUTS_EXCESS, RECIPE_INPUTS_INSUFFICIENT, RECIPE_INPUTS_INVALID, RECIPE_INPUTS_MIXED, RECIPE_NOT_FOUND, REGION_DIV, REGION_PER_AXIS, REQUIRES_MORE_THAN_ONE, REQUIRES_POSITIVE_VALUE, RESERVE_TIERS, RESOLVE_COUNT_EXCEEDS_COMPLETED, RESOURCE_TIER_ADJECTIVES, RESOURCE_TIER_MULT_TENTHS, RawData, ReachStats, Recipe, RecipeConsumer, RecipeInput, RecipeSlotInput, RenderDescriptionOptions, Reservation, ReserveTier, ResolvedAttributeGroup, ResolvedCrafterLane, ResolvedEvent, ResolvedGathererLane, ResolvedItem, ResolvedItemStat, ResolvedItemType, ResolvedLoaderLane, ResolvedModuleSlot, ResourceCategory, ResourceDemand, ResourceStats, RouteFailure, RouteFailureReason, RoutePlan, RouteResult, SECTORS_PER_AXIS, SECTOR_DIV, SHIPLOAD_COLLECTION, 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, STAR_STEP, ScheduleAccessor, ScheduleCapability, ScheduleData, ScheduledBuild, SchemaField, server as ServerContract, ServerMessage, Types as ServerTypes, Ship, ShipEntity, ShipLike, Shipload, SlotConsumer, SlotConsumerKind, SnapshotMessage, SourceCargoStack, SourceEntityRef, StackInput, StatDefinition, StatFlow, StatMapping, StatSlot, StorageCapability, StratumInfo, SubscribeEntityMessage, SubscribeEventsMessage, SubscribeMessage, SubscriptionEntityType, SubscriptionsManager, SubscriptionsOptions, SystemGraph, TIER_ROLL_MAX, TRAVEL_MAX_DURATION, TaskCancelable, TaskCargoChange, TaskCargoDirection, TaskType, TemplateMeta, TextSpan, TierRange, TransferEntity, UnsubscribeEntityMessage, UnsubscribeEventsMessage, UnsubscribeMessage, UpdateBoundsMessage, UpdateMessage, ValidateDisplayNameOptions, WAREHOUSE_ALREADY_AT_LOCATION, WAREHOUSE_NOT_FOUND, WARP_HAS_CARGO, WARP_HAS_SCHEDULE, WARP_NOT_FULL_ENERGY, WARP_NO_CAPABILITY, WARP_OUT_OF_RANGE, WH, WOULD_OVERFILL, WOULD_STRAND, Warehouse, WarehouseEntity, WebSocketConnection, WebSocketConnectionOptions, WireCoordinates, WireEntity, WrapDeposit, YIELD_FRACTION_DEEP, YIELD_FRACTION_SHALLOW, addressFromCoordinates, allBuildableItems, allPlotBuildableItems, applyResourceTierMultiplier, availableBuildMethods, availableCapacity$1 as availableCapacity, availableCapacityFromMass, availableForItem, baseName, blendCargoStacks, blendComponentStacks, blendCrossGroup, blendStacks, buildComponentImmutable, buildEntityDescription, buildEntityImmutable, buildImmutableData, buildMintAssetAction, buildModuleImmutable, buildResourceImmutable, calcCargoItemMass, calcCargoMass, calcEnergyUsage, calcStacksMass, calc_acceleration, calc_craft_duration, calc_craft_energy, calc_energyusage, calc_flighttime, calc_gather_duration, calc_gather_energy, calc_gather_rate, calc_loader_acceleration, calc_loader_flighttime, calc_onesided_duration, calc_orbital_altitude, calc_rechargetime, calc_ship_acceleration, calc_ship_flighttime, calc_ship_mass, calc_ship_rechargetime, calc_transfer_duration, calc_transit_duration, calculateFlightTime, calculateLoadTimeBreakdown, calculateRefuelingTime, calculateTransferTime, canMove, cancelEligibility, candidateLaneCompletesAt, capabilityAttributes, capabilityNames, capsHasCrafter, capsHasGatherer, capsHasHauler, capsHasLauncher, capsHasLoaders, capsHasMass, capsHasMovement, capsHasStorage, cargoItem, cargoItemToStack, cargoReadyAt, cargoRef, cargoUtils, cargo_item, categoryColors, categoryFromIndex, categoryLabel, categoryLabelFromIndex, componentIcon, composeIdleResolve, computeBaseCapacity, computeBaseCapacityShip, computeBaseCapacityWarehouse, computeBaseHullmass, computeBatteryCapabilities, computeComponentStats, computeContainerCapabilities, computeContainerT2Capabilities, computeCraftedOutputStats, computeCrafterCapabilities, computeCrafterDrain, computeCrafterSpeed, computeEngineCapabilities, computeEngineDrain, computeEngineThrust, computeEntityCapabilities, computeEntityStats, computeGathererCapabilities, computeGathererDepth, computeGathererDrain, computeGathererYield, computeGeneratorCap, computeGeneratorCapabilities, computeGeneratorRech, computeGroupPerLegReach, computeHaulPenalty, computeHaulerCapabilities, computeHaulerCapacity, computeHaulerDrain$1 as computeHaulerDrain, computeHaulerEfficiency, computeInputMass, computeLauncherCapabilities, computeLoaderCapabilities, computeLoaderMass, computeLoaderThrust, computeNftImageUrl, computePerLegReach, computeShipHullCapabilities, computeStorageCapabilities, computeTravelDrain, computeWarehouseHullCapabilities, computeWarpCapabilities, computeWarpRange, coordsToLocationId, createInventoryAccessor, createProjectedEntity, createScheduleAccessor, decodeAddress, decodeAtomicAsset, decodeCraftedItemStats, decodeRegion, decodeSector, 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, encodeAddress, encodeAddressMemo, encodeGatheredCargoStats, encodeRegion, encodeSector, encodeStats, energyAtTime, energyPercent, energy_stats, entityDisplayName, entity_row, estimateDealTravelTime, estimateTravelTime, feistel, feistelInv, fetchAtomicAssetsForOwner, fetchAtomicSchemas, filterByBuildMethod, findNearbyPlanets, flightSpeedFactor, formatLocation, formatMass, formatMassDelta, formatMassScaled, formatModuleLine, formatTier, gathererDepthForTier, getAllRecipes, getCapabilityAttributes, getCategoryInfo, getComponentDemand, getComponents, getCurrentEpoch, getDepthThreshold, getDestinationLocation, getEffectiveReserve, getEligibleResources, getEntityClass, getEntityItems, getEntityLayout, getEpochInfo, getFlightOrigin, getInterpolatedPosition, getItem, getItems, getKindMeta, getLocationCandidates, getLocationKind, getLocationProfile, getLocationType, getLocationTypeName, getModuleCapabilityType, getModules, getPackedEntityType, getPlanetSubtype, getPlanetSubtypes, getPositionAt, getRecipe, getRecipeConsumers, getResourceDemand, 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, isBuildable, isContainer, isCraftedItem, isExtractor, isFactory, isFull$1 as isFull, isFullFromMass, isGatherableLocation, isInvertedAttribute, isLocationBuildable, isModuleItem, isNexus, isPlot, isPlotBuildable, isRelatedItem, isShip, isSubscriptionsDebugEnabled, isValidWormholePair, isWarehouse, itemAbbreviations, itemCategory, itemIds, itemOffset, itemTier, itemTypeCode, kindCan, lane, laneKeyForModule, lerp, location_derived, location_static, makeEntity, mapEntity, maxCraftable, maxTravelDistance, mergeStacks, moduleAccepts, moduleDisplayName, moduleIcon, moduleSlotTypeToCode, movement_stats, needsRecharge, normalizeDisplayName, parseWireEntity, partnerRegion, planParallelGather, planParallelTransfer, planRoute, projectEntity, projectEntityAt, projectRemainingAt, projectedCargoAvailableAt, rawScheduleEnd, readCommonBase, regionOf, removeFromStacks, renderDescription, resolveItem, resolveItemCategory, resolveLaneCrafter, resolveLaneGatherer, resolveLaneLoader, resolveLockedAmount, resolveStats, rollTier, rollWithinTier, rollupCrafter, rollupGatherer, rollupLoaders, rotation, schedule, sdkSystemGraph, selectGatherLane, setSubscriptionsDebug, stackKey, stackToCargoItem, stacksEqual, starRating, starsForStat, statMagnitude, subtractFromStacks, task, taskCargoChanges, taskCargoEffect, tierAdjective, tierColors, tierOfReserve, toLocation, typeLabel, validateDisplayName, validateSchedule, workerLaneKey, wormholeAt, wormholeAtRegionEndpoint, yieldThresholdAt };
package/lib/shipload.js CHANGED
@@ -5425,8 +5425,8 @@ const DEPTH_THRESHOLD_T9 = 57000;
5425
5425
  const DEPTH_THRESHOLD_T10 = 63000;
5426
5426
  const LOCATION_MIN_DEPTH = 500;
5427
5427
  const LOCATION_MAX_DEPTH = 65535;
5428
- const YIELD_FRACTION_SHALLOW = 0.0025;
5429
- const YIELD_FRACTION_DEEP = 0.0005;
5428
+ const YIELD_FRACTION_SHALLOW = 0.005;
5429
+ const YIELD_FRACTION_DEEP = 0.001;
5430
5430
  function yieldThresholdAt(stratum) {
5431
5431
  const clamped = stratum > 65535 ? 65535 : stratum;
5432
5432
  const t = clamped / 65535;
@@ -5697,6 +5697,23 @@ function wormholeAt(seed, x, y) {
5697
5697
  return null;
5698
5698
  return w.B;
5699
5699
  }
5700
+ function nearbyWormholes(seed, x, y, reachTiles) {
5701
+ const min = regionOf(x - reachTiles, y - reachTiles);
5702
+ const max = regionOf(x + reachTiles, y + reachTiles);
5703
+ const out = [];
5704
+ for (let rx = min.rx; rx <= max.rx; rx++) {
5705
+ for (let ry = min.ry; ry <= max.ry; ry++) {
5706
+ const w = wormholeOfRegion(seed, { rx, ry });
5707
+ if (!w)
5708
+ continue;
5709
+ if (w.A.x === x && w.A.y === y)
5710
+ continue;
5711
+ if (dist$1({ x, y }, w.A) <= reachTiles)
5712
+ out.push(w.A);
5713
+ }
5714
+ }
5715
+ return out;
5716
+ }
5700
5717
  function isValidWormholePair(seed, ax, ay, bx, by) {
5701
5718
  const to = wormholeAt(seed, ax, ay);
5702
5719
  return to !== null && to.x === bx && to.y === by;
@@ -9379,15 +9396,23 @@ function rollWithinTier(withinRoll, range, resourceUnitMass) {
9379
9396
  const depositMass = range.min + skewed * (range.max - range.min);
9380
9397
  return Math.max(1, Math.floor(depositMass / resourceUnitMass));
9381
9398
  }
9399
+ const RESOURCE_TIER_MULT_TENTHS = [200, 154, 118, 91, 70, 54, 41, 32, 24, 19];
9400
+ function applyResourceTierMultiplier(units, resourceTier) {
9401
+ const idx = resourceTier < 1 ? 0 : resourceTier > 10 ? 9 : resourceTier - 1;
9402
+ const scaled = Math.floor((units * RESOURCE_TIER_MULT_TENTHS[idx]) / 10);
9403
+ return scaled > 0 ? scaled : 1;
9404
+ }
9382
9405
  const RESERVE_TIER_ENTRIES = Object.entries(RESERVE_TIERS);
9383
9406
  function tierOfReserve(reserve, itemId) {
9384
9407
  if (reserve <= 0)
9385
9408
  return null;
9386
- const unitMass = getItem(itemId).mass;
9387
- if (unitMass <= 0)
9409
+ const item = getItem(itemId);
9410
+ if (item.mass <= 0)
9388
9411
  return null;
9389
- const impliedMassLow = reserve * unitMass;
9390
- const impliedMassHigh = impliedMassLow + unitMass;
9412
+ const idx = item.tier < 1 ? 0 : item.tier > 10 ? 9 : item.tier - 1;
9413
+ const baseReserve = (reserve * 10) / RESOURCE_TIER_MULT_TENTHS[idx];
9414
+ const impliedMassLow = baseReserve * item.mass;
9415
+ const impliedMassHigh = impliedMassLow + item.mass;
9391
9416
  for (const [tier, range] of RESERVE_TIER_ENTRIES) {
9392
9417
  if (impliedMassHigh > range.min && impliedMassLow <= range.max)
9393
9418
  return tier;
@@ -9427,8 +9452,9 @@ function deriveStratum(epochSeed, coords, stratum, locationType, subtype, _maxDe
9427
9452
  const tierRoll = ((bytes[18] << 8) | bytes[19]) >>> 0;
9428
9453
  const withinRoll = ((bytes[20] << 8) | bytes[21]) >>> 0;
9429
9454
  const tier = rollTier(tierRoll, stratum);
9430
- const unitMass = getItem(selectedItemId).mass;
9431
- const reserve = rollWithinTier(withinRoll, RESERVE_TIERS[tier], unitMass);
9455
+ const selected = getItem(selectedItemId);
9456
+ const baseReserve = rollWithinTier(withinRoll, RESERVE_TIERS[tier], selected.mass);
9457
+ const reserve = applyResourceTierMultiplier(baseReserve, selected.tier);
9432
9458
  const seedBigInt = (BigInt(bytes[8]) << 56n) |
9433
9459
  (BigInt(bytes[9]) << 48n) |
9434
9460
  (BigInt(bytes[10]) << 40n) |
@@ -14524,13 +14550,27 @@ function reconstruct(cameFrom, origin, dest) {
14524
14550
  function sdkSystemGraph(seed) {
14525
14551
  const s = antelope.Checksum256.from(seed);
14526
14552
  return {
14527
- hasSystem: (c) => hasSystem(s, { x: c.x, y: c.y }),
14528
- nearby: (c, reachTiles) => findNearbyPlanets(s, { x: c.x, y: c.y }, reachTiles * PRECISION$1)
14529
- .map((d) => ({
14530
- coord: { x: Number(d.destination.x), y: Number(d.destination.y) },
14531
- dist: Number(d.distance) / PRECISION$1,
14532
- }))
14533
- .filter((n) => !(n.coord.x === c.x && n.coord.y === c.y)),
14553
+ hasSystem: (c) => hasSystem(s, { x: c.x, y: c.y }) || wormholeAt(s, c.x, c.y) !== null,
14554
+ nearby: (c, reachTiles) => {
14555
+ const seen = new Set([`${c.x},${c.y}`]);
14556
+ const out = [];
14557
+ for (const d of findNearbyPlanets(s, { x: c.x, y: c.y }, reachTiles * PRECISION$1)) {
14558
+ const coord = { x: Number(d.destination.x), y: Number(d.destination.y) };
14559
+ const k = `${coord.x},${coord.y}`;
14560
+ if (seen.has(k))
14561
+ continue;
14562
+ seen.add(k);
14563
+ out.push({ coord, dist: Number(d.distance) / PRECISION$1 });
14564
+ }
14565
+ for (const coord of nearbyWormholes(s, c.x, c.y, reachTiles)) {
14566
+ const k = `${coord.x},${coord.y}`;
14567
+ if (seen.has(k))
14568
+ continue;
14569
+ seen.add(k);
14570
+ out.push({ coord, dist: Math.hypot(coord.x - c.x, coord.y - c.y) });
14571
+ }
14572
+ return out;
14573
+ },
14534
14574
  };
14535
14575
  }
14536
14576
 
@@ -16060,6 +16100,112 @@ function getStatMappingsForCapability(capability) {
16060
16100
  return deriveStatMappings().filter((m) => m.capability === capability);
16061
16101
  }
16062
16102
 
16103
+ function getAllRecipes() {
16104
+ return recipes;
16105
+ }
16106
+ function accumulateResourceDemand(itemId, quantity, out) {
16107
+ const item = getItem(itemId);
16108
+ if (item.type === 'resource' && item.category) {
16109
+ out[item.category] = (out[item.category] ?? 0) + quantity;
16110
+ return;
16111
+ }
16112
+ const recipe = getRecipe(itemId);
16113
+ if (!recipe)
16114
+ return;
16115
+ for (const input of recipe.inputs) {
16116
+ accumulateResourceDemand(input.itemId, input.quantity * quantity, out);
16117
+ }
16118
+ }
16119
+ function getResourceDemand(itemId, quantity = 1) {
16120
+ const out = {};
16121
+ accumulateResourceDemand(itemId, quantity, out);
16122
+ return out;
16123
+ }
16124
+ const ITEM_ID_TO_KIND = new Map();
16125
+ for (const [kind, itemId] of Object.entries(KIND_TO_ITEM_ID)) {
16126
+ ITEM_ID_TO_KIND.set(itemId, kind);
16127
+ }
16128
+ function resolveComponentStatLabel(itemId, statIndex) {
16129
+ let item;
16130
+ try {
16131
+ item = getItem(itemId);
16132
+ }
16133
+ catch {
16134
+ return undefined;
16135
+ }
16136
+ if (item.type === 'resource' && item.category) {
16137
+ return getStatDefinitions(item.category)[statIndex]?.label;
16138
+ }
16139
+ const recipe = getRecipe(itemId);
16140
+ const slot = recipe?.statSlots[statIndex];
16141
+ const source = slot?.sources[0];
16142
+ if (!recipe || !source)
16143
+ return undefined;
16144
+ const input = recipe.inputs[source.inputIndex];
16145
+ if (!input)
16146
+ return undefined;
16147
+ return resolveComponentStatLabel(input.itemId, source.statIndex);
16148
+ }
16149
+ function getRecipeConsumers(componentItemId) {
16150
+ const out = [];
16151
+ for (const recipe of getAllRecipes()) {
16152
+ for (let inputIndex = 0; inputIndex < recipe.inputs.length; inputIndex++) {
16153
+ if (recipe.inputs[inputIndex].itemId !== componentItemId)
16154
+ continue;
16155
+ const kind = ITEM_ID_TO_KIND.get(recipe.outputItemId);
16156
+ const formulas = kind ? SLOT_FORMULAS[kind] : undefined;
16157
+ const statFlows = [];
16158
+ for (let slotIndex = 0; slotIndex < recipe.statSlots.length; slotIndex++) {
16159
+ for (const source of recipe.statSlots[slotIndex].sources) {
16160
+ if (source.inputIndex !== inputIndex)
16161
+ continue;
16162
+ const consumer = formulas?.[slotIndex];
16163
+ statFlows.push({
16164
+ slotIndex,
16165
+ capability: consumer?.capability,
16166
+ attribute: consumer?.attribute,
16167
+ sourceStatIndex: source.statIndex,
16168
+ sourceStatLabel: resolveComponentStatLabel(componentItemId, source.statIndex),
16169
+ });
16170
+ }
16171
+ }
16172
+ out.push({
16173
+ outputItemId: recipe.outputItemId,
16174
+ quantity: recipe.inputs[inputIndex].quantity,
16175
+ statFlows,
16176
+ });
16177
+ }
16178
+ }
16179
+ return out;
16180
+ }
16181
+ function getComponentDemand() {
16182
+ const inputIds = new Set();
16183
+ for (const recipe of getAllRecipes()) {
16184
+ for (const input of recipe.inputs)
16185
+ inputIds.add(input.itemId);
16186
+ }
16187
+ const rows = [];
16188
+ for (const itemId of inputIds) {
16189
+ const consumers = getRecipeConsumers(itemId);
16190
+ let statSourceCount = 0;
16191
+ let sinkOnlyCount = 0;
16192
+ for (const c of consumers) {
16193
+ if (c.statFlows.length > 0)
16194
+ statSourceCount++;
16195
+ else
16196
+ sinkOnlyCount++;
16197
+ }
16198
+ rows.push({
16199
+ itemId,
16200
+ consumerCount: consumers.length,
16201
+ statSourceCount,
16202
+ sinkOnlyCount,
16203
+ consumers: consumers.map((c) => c.outputItemId),
16204
+ });
16205
+ }
16206
+ return rows.sort((a, b) => a.consumerCount - b.consumerCount || a.itemId - b.itemId);
16207
+ }
16208
+
16063
16209
  function availableBuildMethods(itemId) {
16064
16210
  const recipe = getRecipe(itemId);
16065
16211
  if (!recipe)
@@ -17209,6 +17355,7 @@ exports.REQUIRES_POSITIVE_VALUE = REQUIRES_POSITIVE_VALUE;
17209
17355
  exports.RESERVE_TIERS = RESERVE_TIERS;
17210
17356
  exports.RESOLVE_COUNT_EXCEEDS_COMPLETED = RESOLVE_COUNT_EXCEEDS_COMPLETED;
17211
17357
  exports.RESOURCE_TIER_ADJECTIVES = RESOURCE_TIER_ADJECTIVES;
17358
+ exports.RESOURCE_TIER_MULT_TENTHS = RESOURCE_TIER_MULT_TENTHS;
17212
17359
  exports.SECTORS_PER_AXIS = SECTORS_PER_AXIS;
17213
17360
  exports.SECTOR_DIV = SECTOR_DIV;
17214
17361
  exports.SHIPLOAD_COLLECTION = SHIPLOAD_COLLECTION;
@@ -17246,6 +17393,7 @@ exports.YIELD_FRACTION_SHALLOW = YIELD_FRACTION_SHALLOW;
17246
17393
  exports.addressFromCoordinates = addressFromCoordinates;
17247
17394
  exports.allBuildableItems = allBuildableItems;
17248
17395
  exports.allPlotBuildableItems = allPlotBuildableItems;
17396
+ exports.applyResourceTierMultiplier = applyResourceTierMultiplier;
17249
17397
  exports.availableBuildMethods = availableBuildMethods;
17250
17398
  exports.availableCapacity = availableCapacity;
17251
17399
  exports.availableCapacityFromMass = availableCapacityFromMass;
@@ -17414,8 +17562,10 @@ exports.formatMassScaled = formatMassScaled;
17414
17562
  exports.formatModuleLine = formatModuleLine;
17415
17563
  exports.formatTier = formatTier;
17416
17564
  exports.gathererDepthForTier = gathererDepthForTier;
17565
+ exports.getAllRecipes = getAllRecipes;
17417
17566
  exports.getCapabilityAttributes = getCapabilityAttributes;
17418
17567
  exports.getCategoryInfo = getCategoryInfo;
17568
+ exports.getComponentDemand = getComponentDemand;
17419
17569
  exports.getComponents = getComponents;
17420
17570
  exports.getCurrentEpoch = getCurrentEpoch;
17421
17571
  exports.getDepthThreshold = getDepthThreshold;
@@ -17443,6 +17593,8 @@ exports.getPlanetSubtype = getPlanetSubtype;
17443
17593
  exports.getPlanetSubtypes = getPlanetSubtypes;
17444
17594
  exports.getPositionAt = getPositionAt;
17445
17595
  exports.getRecipe = getRecipe;
17596
+ exports.getRecipeConsumers = getRecipeConsumers;
17597
+ exports.getResourceDemand = getResourceDemand;
17446
17598
  exports.getResourceTier = getResourceTier;
17447
17599
  exports.getResourceWeight = getResourceWeight;
17448
17600
  exports.getResources = getResources;