@shipload/sdk 1.0.0-next.7 → 1.0.0-next.8
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 +42 -13
- package/lib/shipload.js +157 -1
- package/lib/shipload.js.map +1 -1
- package/lib/shipload.m.js +153 -2
- package/lib/shipload.m.js.map +1 -1
- package/package.json +1 -1
- package/src/index-module.ts +9 -0
- package/src/scheduling/predict-cargo.ts +151 -0
- package/src/travel/travel.ts +3 -1
- package/src/types/entity-traits.ts +38 -0
- package/src/types.ts +2 -0
- package/src/utils/system.ts +7 -0
package/lib/shipload.d.ts
CHANGED
|
@@ -1450,6 +1450,7 @@ declare const TRAVEL_MAX_DURATION = 86400;
|
|
|
1450
1450
|
declare const MIN_ORBITAL_ALTITUDE = 800;
|
|
1451
1451
|
declare const MAX_ORBITAL_ALTITUDE = 3000;
|
|
1452
1452
|
declare const BASE_ORBITAL_MASS = 100000;
|
|
1453
|
+
declare const MIN_TRANSFER_DISTANCE = 100;
|
|
1453
1454
|
interface ShipLike {
|
|
1454
1455
|
coordinates: Types.coordinates;
|
|
1455
1456
|
hullmass?: UInt32;
|
|
@@ -1497,7 +1498,7 @@ declare const EntityType$1: {
|
|
|
1497
1498
|
readonly WAREHOUSE: Name;
|
|
1498
1499
|
readonly CONTAINER: Name;
|
|
1499
1500
|
};
|
|
1500
|
-
type EntityTypeName = (typeof EntityType$1)[keyof typeof EntityType$1];
|
|
1501
|
+
type EntityTypeName$1 = (typeof EntityType$1)[keyof typeof EntityType$1];
|
|
1501
1502
|
type CoordinatesType = Coordinates | Types.coordinates | {
|
|
1502
1503
|
x: Int64Type;
|
|
1503
1504
|
y: Int64Type;
|
|
@@ -1913,20 +1914,20 @@ type EntityRefInput = {
|
|
|
1913
1914
|
declare class ActionsManager extends BaseManager {
|
|
1914
1915
|
travel(shipId: UInt64Type, destination: CoordinatesType, recharge?: boolean): Action;
|
|
1915
1916
|
grouptravel(entities: EntityRefInput[], destination: CoordinatesType, recharge?: boolean): Action;
|
|
1916
|
-
resolve(entityId: UInt64Type, entityType?: EntityTypeName, count?: UInt64Type): Action;
|
|
1917
|
-
cancel(entityId: UInt64Type, count: UInt64Type, entityType?: EntityTypeName): Action;
|
|
1918
|
-
recharge(entityId: UInt64Type, entityType?: EntityTypeName): Action;
|
|
1919
|
-
transfer(sourceType: EntityTypeName, sourceId: UInt64Type, destType: EntityTypeName, destId: UInt64Type, items: ActionParams.Type.cargo_item[]): Action;
|
|
1917
|
+
resolve(entityId: UInt64Type, entityType?: EntityTypeName$1, count?: UInt64Type): Action;
|
|
1918
|
+
cancel(entityId: UInt64Type, count: UInt64Type, entityType?: EntityTypeName$1): Action;
|
|
1919
|
+
recharge(entityId: UInt64Type, entityType?: EntityTypeName$1): Action;
|
|
1920
|
+
transfer(sourceType: EntityTypeName$1, sourceId: UInt64Type, destType: EntityTypeName$1, destId: UInt64Type, items: ActionParams.Type.cargo_item[]): Action;
|
|
1920
1921
|
foundCompany(account: NameType, name: string): Action;
|
|
1921
1922
|
join(account: NameType): Action;
|
|
1922
1923
|
gather(source: EntityRefInput, destination: EntityRefInput, stratum: UInt16Type, quantity: UInt32Type): Action;
|
|
1923
|
-
warp(entityId: UInt64Type, destination: CoordinatesType, entityType?: EntityTypeName): Action;
|
|
1924
|
-
craft(entityType: EntityTypeName, entityId: UInt64Type, recipeId: number, quantity: number, inputs: ActionParams.Type.cargo_item[]): Action;
|
|
1925
|
-
blend(entityType: EntityTypeName, entityId: UInt64Type, inputs: ActionParams.Type.cargo_item[]): Action;
|
|
1926
|
-
deploy(entityType: EntityTypeName, entityId: UInt64Type, ref: ActionParams.Type.cargo_ref): Action;
|
|
1927
|
-
addmodule(entityType: EntityTypeName, entityId: UInt64Type, moduleIndex: number, moduleRef: ActionParams.Type.cargo_ref, targetRef?: ActionParams.Type.cargo_ref | null): Action;
|
|
1928
|
-
rmmodule(entityType: EntityTypeName, entityId: UInt64Type, moduleIndex: number, targetRef?: ActionParams.Type.cargo_ref | null): Action;
|
|
1929
|
-
wrap(owner: NameType, entityType: EntityTypeName, entityId: UInt64Type, items: ActionParams.Type.cargo_item[]): Action;
|
|
1924
|
+
warp(entityId: UInt64Type, destination: CoordinatesType, entityType?: EntityTypeName$1): Action;
|
|
1925
|
+
craft(entityType: EntityTypeName$1, entityId: UInt64Type, recipeId: number, quantity: number, inputs: ActionParams.Type.cargo_item[]): Action;
|
|
1926
|
+
blend(entityType: EntityTypeName$1, entityId: UInt64Type, inputs: ActionParams.Type.cargo_item[]): Action;
|
|
1927
|
+
deploy(entityType: EntityTypeName$1, entityId: UInt64Type, ref: ActionParams.Type.cargo_ref): Action;
|
|
1928
|
+
addmodule(entityType: EntityTypeName$1, entityId: UInt64Type, moduleIndex: number, moduleRef: ActionParams.Type.cargo_ref, targetRef?: ActionParams.Type.cargo_ref | null): Action;
|
|
1929
|
+
rmmodule(entityType: EntityTypeName$1, entityId: UInt64Type, moduleIndex: number, targetRef?: ActionParams.Type.cargo_ref | null): Action;
|
|
1930
|
+
wrap(owner: NameType, entityType: EntityTypeName$1, entityId: UInt64Type, items: ActionParams.Type.cargo_item[]): Action;
|
|
1930
1931
|
undeploy(host: EntityRefInput, target: EntityRefInput): Action;
|
|
1931
1932
|
wrapEntity(entity: EntityRefInput): Action;
|
|
1932
1933
|
demolish(entity: EntityRefInput): Action;
|
|
@@ -2764,6 +2765,7 @@ declare function getLocationTypeName(type: LocationType): string;
|
|
|
2764
2765
|
declare function getSystemName(gameSeed: Checksum256Type, location: CoordinatesType): string;
|
|
2765
2766
|
declare function hasSystem(gameSeed: Checksum256Type, coordinates: CoordinatesType): boolean;
|
|
2766
2767
|
declare function deriveLocationStatic(gameSeed: Checksum256Type, coordinates: CoordinatesType): Types.location_static;
|
|
2768
|
+
declare function isLocationBuildable(gameSeed: Checksum256Type, coordinates: CoordinatesType): boolean;
|
|
2767
2769
|
declare function deriveLocation(gameSeed: Checksum256Type, coordinates: CoordinatesType): Types.location_derived;
|
|
2768
2770
|
|
|
2769
2771
|
declare function hash(seed: Checksum256Type, string: string): Checksum256;
|
|
@@ -2815,6 +2817,25 @@ declare function cargoItem(src: {
|
|
|
2815
2817
|
modules?: Types.module_entry[];
|
|
2816
2818
|
}, quantity: bigint | number): ActionParams.Type.cargo_item;
|
|
2817
2819
|
|
|
2820
|
+
type PredictedCargoTarget = {
|
|
2821
|
+
kind: 'existing';
|
|
2822
|
+
rowId: bigint;
|
|
2823
|
+
} | {
|
|
2824
|
+
kind: 'new';
|
|
2825
|
+
label: string;
|
|
2826
|
+
};
|
|
2827
|
+
interface PredictedCargoAddition {
|
|
2828
|
+
item_id: number;
|
|
2829
|
+
stats: bigint;
|
|
2830
|
+
modules: Types.module_entry[];
|
|
2831
|
+
quantity: number;
|
|
2832
|
+
target: PredictedCargoTarget;
|
|
2833
|
+
}
|
|
2834
|
+
interface TaskCargoEffect {
|
|
2835
|
+
additions: PredictedCargoAddition[];
|
|
2836
|
+
}
|
|
2837
|
+
declare function predictTaskCargoEffects(cargo: readonly Types.cargo_view[], tasks: readonly Types.task[]): TaskCargoEffect[];
|
|
2838
|
+
|
|
2818
2839
|
interface Entity {
|
|
2819
2840
|
id: UInt64;
|
|
2820
2841
|
type: Name;
|
|
@@ -2829,6 +2850,14 @@ type WarehouseEntity = Entity & StorageCapability & Partial<LoaderCapability> &
|
|
|
2829
2850
|
type ContainerEntity = Entity & StorageCapability & MassCapability & ScheduleCapability;
|
|
2830
2851
|
type AnyEntity = ShipEntity | WarehouseEntity | ContainerEntity;
|
|
2831
2852
|
|
|
2853
|
+
declare enum EntityClass {
|
|
2854
|
+
OrbitalVessel = 0,
|
|
2855
|
+
PlanetaryStructure = 1
|
|
2856
|
+
}
|
|
2857
|
+
declare function getEntityClass(entityType: Name | EntityTypeName): EntityClass;
|
|
2858
|
+
declare function getPackedEntityType(itemId: number): Name | null;
|
|
2859
|
+
type EntityTypeName = 'ship' | 'warehouse' | 'container';
|
|
2860
|
+
|
|
2832
2861
|
declare function canMove(e: Entity): e is Entity & MovementCapability & EnergyCapability;
|
|
2833
2862
|
declare function hasEnergy(e: Entity): e is Entity & EnergyCapability;
|
|
2834
2863
|
declare function hasStorage(e: Entity): e is Entity & StorageCapability;
|
|
@@ -3297,4 +3326,4 @@ type location_static = Types.location_static;
|
|
|
3297
3326
|
type location_derived = Types.location_derived;
|
|
3298
3327
|
type location_row = Types.location_row;
|
|
3299
3328
|
|
|
3300
|
-
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_NO_CRAFTER, EPOCH_NON_ZERO, EPOCH_NOT_READY, ERROR_SYSTEM_ALREADY_INITIALIZED, ERROR_SYSTEM_DISABLED, ERROR_SYSTEM_NOT_INITIALIZED, EnergyCapability, EntitiesManager, Entity, EntityCapabilities, EntityInfo, EntityInstance, EntityInventory, EntityLayout, EntityRefInput, EntitySlot, EntityState, EntitySubscriptionHandle, EntityType, EntityTypeName, EpochInfo, EpochsManager, ErrorMessage, EstimateTravelTimeOptions, EstimatedTravelTime, EventCatchupCompleteMessage, EventMessage, 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_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, 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, 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, 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, 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, TaskType, TextSpan, TierRange, TransferEntity, UnsubscribeEntityMessage, UnsubscribeEventsMessage, UnsubscribeMessage, UpdateBoundsMessage, UpdateMessage, WAREHOUSE_ALREADY_AT_LOCATION, WAREHOUSE_CAPACITY_EXCEEDED, WAREHOUSE_NOT_FOUND, WAREHOUSE_Z, 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, computeGathererCapabilities, computeGathererDepth, computeGathererDrain, computeGathererSpeed, computeGathererYield, computeGeneratorCap, computeGeneratorCapabilities, computeGeneratorRech, computeHaulPenalty, computeHaulerCapabilities, computeHaulerDrain$1 as computeHaulerDrain, computeInputMass, computeLoaderCapabilities, computeLoaderMass, computeLoaderThrust, computeShipCapabilities, computeShipHullCapabilities, computeStorageCapabilities, computeWarehouseCapabilities, computeWarehouseHullCapabilities, computeWarpRange, container_row, coordsToLocationId, createInventoryAccessor, createProjectedEntity, createScheduleAccessor, decodeCraftedItemStats, decodeStat, decodeStats, Shipload as default, deriveLocation, deriveLocationSize, deriveLocationStatic, deriveResourceStats, deriveStatMappings, deriveStrata, deriveStratum, describeItem, describeModule, describeModuleForItem, describeModuleForSlot, deserializeAsset, deserializeComponent, deserializeEntity, deserializeModule, deserializeResource, displayName, distanceBetweenCoordinates, distanceBetweenPoints, easeFlightProgress, encodeGatheredCargoStats, encodeStats, energyPercent, energy_stats, entityDisplayName, estimateDealTravelTime, estimateTravelTime, findItemByCategoryAndTier, findNearbyPlanets, flightSpeedFactor, formatMass, formatMassDelta, formatModuleLine, formatTier, gathererDepthForTier, gatherer_stats, getCapabilityAttributes, getCategoryInfo, getComponents, getCurrentEpoch, getDepthThreshold, getDestinationLocation, getEligibleResources, getEntityItems, getEntityLayout, getEpochInfo, getFlightOrigin, getInterpolatedPosition, getItem, getItems, getLocationCandidates, getLocationProfile, getLocationType, getLocationTypeName, getModuleCapabilityType, getModules, 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, isCraftedItem, isFull$1 as isFull, isFullFromMass, isGatherableLocation, isInvertedAttribute, isModuleItem, isRelatedItem, isSubscriptionsDebugEnabled, itemAbbreviations, itemCategory, itemIds, itemOffset, itemTier, itemTypeCode, lerp, loader_stats, location_derived, location_row, location_static, makeContainer, 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, stackKey, stackToCargoItem, stacksEqual, task, tierAdjective, tierColors, toLocation, typeLabel, validateSchedule, warehouse_row };
|
|
3329
|
+
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_NO_CRAFTER, 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, EntityType, EntityTypeName$1 as EntityTypeName, EpochInfo, EpochsManager, ErrorMessage, EstimateTravelTimeOptions, EstimatedTravelTime, EventCatchupCompleteMessage, EventMessage, 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_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, 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, PredictedCargoAddition, PredictedCargoTarget, 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, 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, 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, TaskCargoEffect, TaskType, TextSpan, TierRange, TransferEntity, UnsubscribeEntityMessage, UnsubscribeEventsMessage, UnsubscribeMessage, UpdateBoundsMessage, UpdateMessage, WAREHOUSE_ALREADY_AT_LOCATION, WAREHOUSE_CAPACITY_EXCEEDED, WAREHOUSE_NOT_FOUND, WAREHOUSE_Z, 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, computeGathererCapabilities, computeGathererDepth, computeGathererDrain, computeGathererSpeed, computeGathererYield, computeGeneratorCap, computeGeneratorCapabilities, computeGeneratorRech, computeHaulPenalty, computeHaulerCapabilities, computeHaulerDrain$1 as computeHaulerDrain, computeInputMass, computeLoaderCapabilities, computeLoaderMass, computeLoaderThrust, computeShipCapabilities, computeShipHullCapabilities, computeStorageCapabilities, computeWarehouseCapabilities, computeWarehouseHullCapabilities, computeWarpRange, container_row, coordsToLocationId, createInventoryAccessor, createProjectedEntity, createScheduleAccessor, decodeCraftedItemStats, decodeStat, decodeStats, Shipload as default, deriveLocation, deriveLocationSize, deriveLocationStatic, deriveResourceStats, deriveStatMappings, deriveStrata, deriveStratum, describeItem, describeModule, describeModuleForItem, describeModuleForSlot, deserializeAsset, deserializeComponent, deserializeEntity, deserializeModule, deserializeResource, displayName, distanceBetweenCoordinates, distanceBetweenPoints, easeFlightProgress, encodeGatheredCargoStats, encodeStats, energyPercent, energy_stats, entityDisplayName, 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, 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, isCraftedItem, isFull$1 as isFull, isFullFromMass, isGatherableLocation, isInvertedAttribute, isLocationBuildable, isModuleItem, isRelatedItem, isSubscriptionsDebugEnabled, itemAbbreviations, itemCategory, itemIds, itemOffset, itemTier, itemTypeCode, lerp, loader_stats, location_derived, location_row, location_static, makeContainer, makeShip, makeWarehouse, mapEntity, maxTravelDistance, mergeStacks, moduleAccepts, moduleDisplayName, moduleIcon, moduleSlotTypeToCode, movement_stats, needsRecharge, parseWireEntity, predictTaskCargoEffects, projectEntity, projectEntityAt, projectFromCurrentState, projectFromCurrentStateAt, readCommonBase, removeFromStacks, renderDescription, resolveItem, resolveItemCategory, resolveStats, rollTier, rollWithinTier, rotation, schedule, setSubscriptionsDebug, stackKey, stackToCargoItem, stacksEqual, task, tierAdjective, tierColors, toLocation, typeLabel, validateSchedule, warehouse_row };
|
package/lib/shipload.js
CHANGED
|
@@ -2417,6 +2417,7 @@ const TRAVEL_MAX_DURATION = 86400;
|
|
|
2417
2417
|
const MIN_ORBITAL_ALTITUDE = 800;
|
|
2418
2418
|
const MAX_ORBITAL_ALTITUDE = 3000;
|
|
2419
2419
|
const BASE_ORBITAL_MASS = 100000;
|
|
2420
|
+
const MIN_TRANSFER_DISTANCE = 100;
|
|
2420
2421
|
exports.TaskType = void 0;
|
|
2421
2422
|
(function (TaskType) {
|
|
2422
2423
|
TaskType[TaskType["IDLE"] = 0] = "IDLE";
|
|
@@ -6896,6 +6897,9 @@ function deriveLocationStatic(gameSeed, coordinates) {
|
|
|
6896
6897
|
loc.seed1 = antelope.UInt8.from(hashResult.array[4]);
|
|
6897
6898
|
return loc;
|
|
6898
6899
|
}
|
|
6900
|
+
function isLocationBuildable(gameSeed, coordinates) {
|
|
6901
|
+
return getLocationType(gameSeed, coordinates) === exports.LocationType.PLANET;
|
|
6902
|
+
}
|
|
6899
6903
|
function deriveLocation(gameSeed, coordinates) {
|
|
6900
6904
|
const staticProps = deriveLocationStatic(gameSeed, coordinates);
|
|
6901
6905
|
return exports.ServerTypes.location_derived.from({
|
|
@@ -7322,7 +7326,8 @@ function calc_transfer_duration(source, dest, cargoMass) {
|
|
|
7322
7326
|
? source.location.z
|
|
7323
7327
|
: (source.location.z?.toNumber() ?? 0);
|
|
7324
7328
|
const destZ = typeof dest.location.z === 'number' ? dest.location.z : (dest.location.z?.toNumber() ?? 0);
|
|
7325
|
-
const
|
|
7329
|
+
const rawDistance = Math.abs(sourceZ - destZ);
|
|
7330
|
+
const distance = rawDistance < MIN_TRANSFER_DISTANCE ? MIN_TRANSFER_DISTANCE : rawDistance;
|
|
7326
7331
|
const totalMass = cargoMass + totalLoaderMass;
|
|
7327
7332
|
const acceleration = calc_acceleration(totalThrust, totalMass);
|
|
7328
7333
|
const flightTime = 2 * Math.sqrt(distance / acceleration);
|
|
@@ -10404,6 +10409,152 @@ function cargoItem(src, quantity) {
|
|
|
10404
10409
|
};
|
|
10405
10410
|
}
|
|
10406
10411
|
|
|
10412
|
+
function modulesEqual(a, b) {
|
|
10413
|
+
if (a.length !== b.length)
|
|
10414
|
+
return false;
|
|
10415
|
+
for (let i = 0; i < a.length; i++) {
|
|
10416
|
+
const ai = a[i];
|
|
10417
|
+
const bi = b[i];
|
|
10418
|
+
if (Number(ai.type) !== Number(bi.type))
|
|
10419
|
+
return false;
|
|
10420
|
+
const aInst = ai.installed;
|
|
10421
|
+
const bInst = bi.installed;
|
|
10422
|
+
if (!aInst && !bInst)
|
|
10423
|
+
continue;
|
|
10424
|
+
if (!aInst || !bInst)
|
|
10425
|
+
return false;
|
|
10426
|
+
if (Number(aInst.item_id) !== Number(bInst.item_id))
|
|
10427
|
+
return false;
|
|
10428
|
+
if (BigInt(aInst.stats.toString()) !== BigInt(bInst.stats.toString()))
|
|
10429
|
+
return false;
|
|
10430
|
+
}
|
|
10431
|
+
return true;
|
|
10432
|
+
}
|
|
10433
|
+
function findStack(state, item_id, stats, modules) {
|
|
10434
|
+
for (let i = 0; i < state.length; i++) {
|
|
10435
|
+
const s = state[i];
|
|
10436
|
+
if (s.item_id !== item_id)
|
|
10437
|
+
continue;
|
|
10438
|
+
if (s.stats !== stats)
|
|
10439
|
+
continue;
|
|
10440
|
+
if (!modulesEqual(s.modules, modules))
|
|
10441
|
+
continue;
|
|
10442
|
+
return i;
|
|
10443
|
+
}
|
|
10444
|
+
return -1;
|
|
10445
|
+
}
|
|
10446
|
+
function applyAddition(state, item, nextNewLabel) {
|
|
10447
|
+
const item_id = Number(item.item_id);
|
|
10448
|
+
const stats = BigInt(item.stats.toString());
|
|
10449
|
+
const modules = item.modules ?? [];
|
|
10450
|
+
const quantity = Number(item.quantity);
|
|
10451
|
+
const idx = findStack(state, item_id, stats, modules);
|
|
10452
|
+
if (idx === -1) {
|
|
10453
|
+
const target = { kind: 'new', label: nextNewLabel() };
|
|
10454
|
+
state.push({ item_id, stats, modules, quantity, target });
|
|
10455
|
+
return { item_id, stats, modules, quantity, target };
|
|
10456
|
+
}
|
|
10457
|
+
state[idx].quantity += quantity;
|
|
10458
|
+
return { item_id, stats, modules, quantity, target: state[idx].target };
|
|
10459
|
+
}
|
|
10460
|
+
function applyRemoval(state, item) {
|
|
10461
|
+
const item_id = Number(item.item_id);
|
|
10462
|
+
const stats = BigInt(item.stats.toString());
|
|
10463
|
+
const modules = item.modules ?? [];
|
|
10464
|
+
const quantity = Number(item.quantity);
|
|
10465
|
+
const idx = findStack(state, item_id, stats, modules);
|
|
10466
|
+
if (idx === -1)
|
|
10467
|
+
return;
|
|
10468
|
+
state[idx].quantity -= quantity;
|
|
10469
|
+
if (state[idx].quantity <= 0)
|
|
10470
|
+
state.splice(idx, 1);
|
|
10471
|
+
}
|
|
10472
|
+
function predictTaskCargoEffects(cargo, tasks) {
|
|
10473
|
+
const state = cargo.map((c) => ({
|
|
10474
|
+
item_id: Number(c.item_id),
|
|
10475
|
+
stats: BigInt(c.stats.toString()),
|
|
10476
|
+
modules: c.modules ?? [],
|
|
10477
|
+
quantity: Number(c.quantity),
|
|
10478
|
+
target: { kind: 'existing', rowId: BigInt(c.id.toString()) },
|
|
10479
|
+
}));
|
|
10480
|
+
let newCounter = 0;
|
|
10481
|
+
const nextNewLabel = () => {
|
|
10482
|
+
newCounter += 1;
|
|
10483
|
+
return `new#${newCounter}`;
|
|
10484
|
+
};
|
|
10485
|
+
const effects = [];
|
|
10486
|
+
for (const task of tasks) {
|
|
10487
|
+
const type = Number(task.type);
|
|
10488
|
+
const items = task.cargo ?? [];
|
|
10489
|
+
const additions = [];
|
|
10490
|
+
switch (type) {
|
|
10491
|
+
case exports.TaskType.LOAD:
|
|
10492
|
+
case exports.TaskType.UNWRAP: {
|
|
10493
|
+
for (const item of items)
|
|
10494
|
+
additions.push(applyAddition(state, item, nextNewLabel));
|
|
10495
|
+
break;
|
|
10496
|
+
}
|
|
10497
|
+
case exports.TaskType.GATHER: {
|
|
10498
|
+
if (!task.entitytarget) {
|
|
10499
|
+
for (const item of items)
|
|
10500
|
+
additions.push(applyAddition(state, item, nextNewLabel));
|
|
10501
|
+
}
|
|
10502
|
+
break;
|
|
10503
|
+
}
|
|
10504
|
+
case exports.TaskType.UNLOAD:
|
|
10505
|
+
case exports.TaskType.WRAP: {
|
|
10506
|
+
for (const item of items)
|
|
10507
|
+
applyRemoval(state, item);
|
|
10508
|
+
break;
|
|
10509
|
+
}
|
|
10510
|
+
case exports.TaskType.CRAFT: {
|
|
10511
|
+
if (items.length > 0) {
|
|
10512
|
+
for (let i = 0; i < items.length - 1; i++)
|
|
10513
|
+
applyRemoval(state, items[i]);
|
|
10514
|
+
additions.push(applyAddition(state, items[items.length - 1], nextNewLabel));
|
|
10515
|
+
}
|
|
10516
|
+
break;
|
|
10517
|
+
}
|
|
10518
|
+
}
|
|
10519
|
+
effects.push({ additions });
|
|
10520
|
+
}
|
|
10521
|
+
return effects;
|
|
10522
|
+
}
|
|
10523
|
+
|
|
10524
|
+
const ENTITY_SHIP = antelope.Name.from('ship');
|
|
10525
|
+
const ENTITY_WAREHOUSE = antelope.Name.from('warehouse');
|
|
10526
|
+
const ENTITY_CONTAINER = antelope.Name.from('container');
|
|
10527
|
+
exports.EntityClass = void 0;
|
|
10528
|
+
(function (EntityClass) {
|
|
10529
|
+
EntityClass[EntityClass["OrbitalVessel"] = 0] = "OrbitalVessel";
|
|
10530
|
+
EntityClass[EntityClass["PlanetaryStructure"] = 1] = "PlanetaryStructure";
|
|
10531
|
+
})(exports.EntityClass || (exports.EntityClass = {}));
|
|
10532
|
+
function getEntityClass(entityType) {
|
|
10533
|
+
const typeName = typeof entityType === 'string' ? entityType : entityType.toString();
|
|
10534
|
+
switch (typeName) {
|
|
10535
|
+
case 'ship':
|
|
10536
|
+
case 'container':
|
|
10537
|
+
return exports.EntityClass.OrbitalVessel;
|
|
10538
|
+
case 'warehouse':
|
|
10539
|
+
return exports.EntityClass.PlanetaryStructure;
|
|
10540
|
+
default:
|
|
10541
|
+
throw new Error(`Entity type has no class: ${typeName}`);
|
|
10542
|
+
}
|
|
10543
|
+
}
|
|
10544
|
+
function getPackedEntityType(itemId) {
|
|
10545
|
+
switch (itemId) {
|
|
10546
|
+
case ITEM_SHIP_T1_PACKED:
|
|
10547
|
+
return ENTITY_SHIP;
|
|
10548
|
+
case ITEM_CONTAINER_T1_PACKED:
|
|
10549
|
+
case ITEM_CONTAINER_T2_PACKED:
|
|
10550
|
+
return ENTITY_CONTAINER;
|
|
10551
|
+
case ITEM_WAREHOUSE_T1_PACKED:
|
|
10552
|
+
return ENTITY_WAREHOUSE;
|
|
10553
|
+
default:
|
|
10554
|
+
return null;
|
|
10555
|
+
}
|
|
10556
|
+
}
|
|
10557
|
+
|
|
10407
10558
|
function canMove(e) {
|
|
10408
10559
|
return 'engines' in e && 'generator' in e && 'energy' in e;
|
|
10409
10560
|
}
|
|
@@ -11675,6 +11826,7 @@ exports.Location = Location;
|
|
|
11675
11826
|
exports.LocationsManager = LocationsManager;
|
|
11676
11827
|
exports.MAX_ORBITAL_ALTITUDE = MAX_ORBITAL_ALTITUDE;
|
|
11677
11828
|
exports.MIN_ORBITAL_ALTITUDE = MIN_ORBITAL_ALTITUDE;
|
|
11829
|
+
exports.MIN_TRANSFER_DISTANCE = MIN_TRANSFER_DISTANCE;
|
|
11678
11830
|
exports.MODULE_ANY = MODULE_ANY;
|
|
11679
11831
|
exports.MODULE_CARGO_NOT_FOUND = MODULE_CARGO_NOT_FOUND;
|
|
11680
11832
|
exports.MODULE_CRAFTER = MODULE_CRAFTER;
|
|
@@ -11893,6 +12045,7 @@ exports.getCurrentEpoch = getCurrentEpoch;
|
|
|
11893
12045
|
exports.getDepthThreshold = getDepthThreshold;
|
|
11894
12046
|
exports.getDestinationLocation = getDestinationLocation;
|
|
11895
12047
|
exports.getEligibleResources = getEligibleResources;
|
|
12048
|
+
exports.getEntityClass = getEntityClass;
|
|
11896
12049
|
exports.getEntityItems = getEntityItems;
|
|
11897
12050
|
exports.getEntityLayout = getEntityLayout;
|
|
11898
12051
|
exports.getEpochInfo = getEpochInfo;
|
|
@@ -11906,6 +12059,7 @@ exports.getLocationType = getLocationType;
|
|
|
11906
12059
|
exports.getLocationTypeName = getLocationTypeName;
|
|
11907
12060
|
exports.getModuleCapabilityType = getModuleCapabilityType;
|
|
11908
12061
|
exports.getModules = getModules;
|
|
12062
|
+
exports.getPackedEntityType = getPackedEntityType;
|
|
11909
12063
|
exports.getPlanetSubtype = getPlanetSubtype;
|
|
11910
12064
|
exports.getPlanetSubtypes = getPlanetSubtypes;
|
|
11911
12065
|
exports.getPositionAt = getPositionAt;
|
|
@@ -11937,6 +12091,7 @@ exports.isFull = isFull$1;
|
|
|
11937
12091
|
exports.isFullFromMass = isFullFromMass;
|
|
11938
12092
|
exports.isGatherableLocation = isGatherableLocation;
|
|
11939
12093
|
exports.isInvertedAttribute = isInvertedAttribute;
|
|
12094
|
+
exports.isLocationBuildable = isLocationBuildable;
|
|
11940
12095
|
exports.isModuleItem = isModuleItem;
|
|
11941
12096
|
exports.isRelatedItem = isRelatedItem;
|
|
11942
12097
|
exports.isSubscriptionsDebugEnabled = isSubscriptionsDebugEnabled;
|
|
@@ -11959,6 +12114,7 @@ exports.moduleIcon = moduleIcon;
|
|
|
11959
12114
|
exports.moduleSlotTypeToCode = moduleSlotTypeToCode;
|
|
11960
12115
|
exports.needsRecharge = needsRecharge;
|
|
11961
12116
|
exports.parseWireEntity = parseWireEntity;
|
|
12117
|
+
exports.predictTaskCargoEffects = predictTaskCargoEffects;
|
|
11962
12118
|
exports.projectEntity = projectEntity;
|
|
11963
12119
|
exports.projectEntityAt = projectEntityAt;
|
|
11964
12120
|
exports.projectFromCurrentState = projectFromCurrentState;
|