@shipload/sdk 2.0.0-rc7 → 2.0.0-rc8

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.m.js CHANGED
@@ -6360,7 +6360,7 @@ const components = [
6360
6360
  { key: 'thermal', source: 'gas' },
6361
6361
  ],
6362
6362
  recipe: [{ category: 'gas', quantity: 32 }],
6363
- usedIn: [{ type: 'module', name: 'Engine Module T1' }],
6363
+ usedIn: [{ type: 'module', name: 'Engine' }],
6364
6364
  },
6365
6365
  {
6366
6366
  id: ITEM_POWER_CELL,
@@ -6373,7 +6373,7 @@ const components = [
6373
6373
  { key: 'clarity', source: 'mineral' },
6374
6374
  ],
6375
6375
  recipe: [{ category: 'mineral', quantity: 20 }],
6376
- usedIn: [{ type: 'module', name: 'Generator Module T1' }],
6376
+ usedIn: [{ type: 'module', name: 'Generator' }],
6377
6377
  },
6378
6378
  {
6379
6379
  id: ITEM_DRILL_SHAFT,
@@ -6386,7 +6386,7 @@ const components = [
6386
6386
  { key: 'tolerance', source: 'metal' },
6387
6387
  ],
6388
6388
  recipe: [{ category: 'metal', quantity: 15 }],
6389
- usedIn: [{ type: 'module', name: 'Extractor Module T1' }],
6389
+ usedIn: [{ type: 'module', name: 'Extractor' }],
6390
6390
  },
6391
6391
  {
6392
6392
  id: ITEM_EXTRACTION_PROBE,
@@ -6399,7 +6399,7 @@ const components = [
6399
6399
  { key: 'reflectivity', source: 'precious' },
6400
6400
  ],
6401
6401
  recipe: [{ category: 'precious', quantity: 10 }],
6402
- usedIn: [{ type: 'module', name: 'Extractor Module T1' }],
6402
+ usedIn: [{ type: 'module', name: 'Extractor' }],
6403
6403
  },
6404
6404
  {
6405
6405
  id: ITEM_CARGO_ARM,
@@ -6412,7 +6412,7 @@ const components = [
6412
6412
  { key: 'insulation', source: 'organic' },
6413
6413
  ],
6414
6414
  recipe: [{ category: 'organic', quantity: 32 }],
6415
- usedIn: [{ type: 'module', name: 'Loader Module T1' }],
6415
+ usedIn: [{ type: 'module', name: 'Loader' }],
6416
6416
  },
6417
6417
  {
6418
6418
  id: ITEM_TOOL_BIT,
@@ -6425,7 +6425,7 @@ const components = [
6425
6425
  { key: 'clarity', source: 'mineral' },
6426
6426
  ],
6427
6427
  recipe: [{ category: 'mineral', quantity: 20 }],
6428
- usedIn: [{ type: 'module', name: 'Manufacturing Module T1' }],
6428
+ usedIn: [{ type: 'module', name: 'Manufacturing' }],
6429
6429
  },
6430
6430
  {
6431
6431
  id: ITEM_REACTION_CHAMBER,
@@ -6438,7 +6438,7 @@ const components = [
6438
6438
  { key: 'thermal', source: 'gas' },
6439
6439
  ],
6440
6440
  recipe: [{ category: 'gas', quantity: 32 }],
6441
- usedIn: [{ type: 'module', name: 'Manufacturing Module T1' }],
6441
+ usedIn: [{ type: 'module', name: 'Manufacturing' }],
6442
6442
  },
6443
6443
  ];
6444
6444
  const entityRecipes = [
@@ -6475,12 +6475,19 @@ const entityRecipes = [
6475
6475
  { key: 'ductility', sourceComponentId: ITEM_CARGO_LINING, sourceStatKey: 'ductility' },
6476
6476
  { key: 'purity', sourceComponentId: ITEM_CARGO_LINING, sourceStatKey: 'purity' },
6477
6477
  ],
6478
+ moduleSlots: [
6479
+ { type: MODULE_ANY },
6480
+ { type: MODULE_ANY },
6481
+ { type: MODULE_ANY },
6482
+ { type: MODULE_ANY },
6483
+ { type: MODULE_ANY },
6484
+ ],
6478
6485
  },
6479
6486
  ];
6480
6487
  const moduleRecipes = [
6481
6488
  {
6482
6489
  id: 'engine-t1',
6483
- name: 'Engine Module T1',
6490
+ name: 'Engine',
6484
6491
  description: 'Basic propulsion system. Converts volatile gases into thrust.',
6485
6492
  color: '#E86344',
6486
6493
  itemId: ITEM_ENGINE_T1,
@@ -6493,7 +6500,7 @@ const moduleRecipes = [
6493
6500
  },
6494
6501
  {
6495
6502
  id: 'generator-t1',
6496
- name: 'Generator Module T1',
6503
+ name: 'Generator',
6497
6504
  description: 'Basic energy system. Stores and recharges energy from resonant minerals.',
6498
6505
  color: '#7B5AE8',
6499
6506
  itemId: ITEM_GENERATOR_T1,
@@ -6506,7 +6513,7 @@ const moduleRecipes = [
6506
6513
  },
6507
6514
  {
6508
6515
  id: 'extractor-t1',
6509
- name: 'Extractor Module T1',
6516
+ name: 'Extractor',
6510
6517
  description: 'Basic extraction system. Drills and probes for raw resources.',
6511
6518
  color: '#7B8D9E',
6512
6519
  itemId: ITEM_EXTRACTOR_T1,
@@ -6525,7 +6532,7 @@ const moduleRecipes = [
6525
6532
  },
6526
6533
  {
6527
6534
  id: 'loader-t1',
6528
- name: 'Loader Module T1',
6535
+ name: 'Loader',
6529
6536
  description: 'Basic cargo handling system. Loads and unloads cargo with articulated arms.',
6530
6537
  color: '#6B8E5A',
6531
6538
  itemId: ITEM_LOADER_T1,
@@ -6541,7 +6548,7 @@ const moduleRecipes = [
6541
6548
  },
6542
6549
  {
6543
6550
  id: 'manufacturing-t1',
6544
- name: 'Manufacturing Module T1',
6551
+ name: 'Manufacturing',
6545
6552
  description: 'Basic crafting system. Processes materials using reaction chambers and cutting tools.',
6546
6553
  color: '#7EC8E3',
6547
6554
  itemId: ITEM_MANUFACTURING_T1,
@@ -6814,7 +6821,7 @@ function calc_craft_energy(drain, duration) {
6814
6821
  }
6815
6822
 
6816
6823
  const categoryColors = {
6817
- metal: '#7B8D9E',
6824
+ metal: '#5B9BD5',
6818
6825
  precious: '#D4A843',
6819
6826
  gas: '#7EC8E3',
6820
6827
  mineral: '#B8A9C9',
@@ -6836,6 +6843,24 @@ const categoryIcons = {
6836
6843
  };
6837
6844
  const componentIcon = '▣';
6838
6845
  const moduleIcon = '⬢';
6846
+ const itemIcons = {
6847
+ 10001: 'HP',
6848
+ 10002: 'CL',
6849
+ 10003: 'CT',
6850
+ 10004: 'TC',
6851
+ 10005: 'PC',
6852
+ 10006: 'EN',
6853
+ 10007: 'GN',
6854
+ 10008: 'SH',
6855
+ 10009: 'DS',
6856
+ 10010: 'EP',
6857
+ 10011: 'CA',
6858
+ 10012: 'TB',
6859
+ 10013: 'RC',
6860
+ 10014: 'EX',
6861
+ 10015: 'LD',
6862
+ 10016: 'MF',
6863
+ };
6839
6864
 
6840
6865
  function computeShipHullCapabilities(stats) {
6841
6866
  const density = stats.density ?? 500;
@@ -6957,7 +6982,7 @@ function resolveComponent(id, seed) {
6957
6982
  return {
6958
6983
  itemId: id,
6959
6984
  name: comp.name,
6960
- icon: componentIcon,
6985
+ icon: itemIcons[id] ?? componentIcon,
6961
6986
  tier: 't1',
6962
6987
  mass: comp.mass,
6963
6988
  itemType: 'component',
@@ -7021,7 +7046,7 @@ function resolveModule(id, seed) {
7021
7046
  return {
7022
7047
  itemId: id,
7023
7048
  name: recipe.name,
7024
- icon: moduleIcon,
7049
+ icon: itemIcons[id] ?? moduleIcon,
7025
7050
  tier: 't1',
7026
7051
  mass: 0,
7027
7052
  itemType: 'module',
@@ -7031,6 +7056,7 @@ function resolveModule(id, seed) {
7031
7056
  function resolveEntity(id, seed, modules) {
7032
7057
  const recipe = getEntityRecipeByItemId(id);
7033
7058
  let attributes;
7059
+ let moduleSlots;
7034
7060
  if (seed !== undefined) {
7035
7061
  const stats = decodeCraftedItemStats(id, toBigSeed(seed));
7036
7062
  attributes = [];
@@ -7049,28 +7075,35 @@ function resolveEntity(id, seed, modules) {
7049
7075
  { label: 'Capacity', value: containerCaps.capacity },
7050
7076
  ] });
7051
7077
  }
7052
- if (modules) {
7053
- for (const mod of modules) {
7054
- if (!mod.installed)
7055
- continue;
7078
+ }
7079
+ if (recipe.moduleSlots) {
7080
+ moduleSlots = recipe.moduleSlots.map((slot, i) => {
7081
+ const mod = modules?.[i];
7082
+ if (mod?.installed) {
7056
7083
  const modItemId = Number(mod.installed.item_id.value.toString());
7057
7084
  const modSeed = BigInt(mod.installed.seed.toString());
7058
7085
  const modStats = decodeCraftedItemStats(modItemId, modSeed);
7059
7086
  const modType = getModuleCapabilityType(modItemId);
7060
7087
  const group = computeCapabilityGroup(modType, modStats);
7061
- if (group)
7062
- attributes.push(group);
7088
+ const modRecipe = getModuleRecipeByItemId(modItemId);
7089
+ return {
7090
+ name: modRecipe?.name ?? 'Module',
7091
+ installed: true,
7092
+ attributes: group?.attributes,
7093
+ };
7063
7094
  }
7064
- }
7095
+ return { installed: false };
7096
+ });
7065
7097
  }
7066
7098
  return {
7067
7099
  itemId: id,
7068
7100
  name: recipe.name,
7069
- icon: componentIcon,
7101
+ icon: itemIcons[id] ?? componentIcon,
7070
7102
  tier: 't1',
7071
7103
  mass: 0,
7072
7104
  itemType: 'entity',
7073
7105
  attributes,
7106
+ moduleSlots,
7074
7107
  };
7075
7108
  }
7076
7109
  function resolveItem(itemId, seed, modules) {
@@ -7084,5 +7117,5 @@ function resolveItem(itemId, seed, modules) {
7084
7117
  return resolveResource(id, seed);
7085
7118
  }
7086
7119
 
7087
- export { ActionsManager, BASE_ORBITAL_MASS, COMMIT_ALREADY_SET, COMMIT_CANNOT_MATCH, COMMIT_NOT_SET, COMPANY_NOT_FOUND, CONTAINER_Z, Container, Coordinates, DEPTH_THRESHOLD_T1, DEPTH_THRESHOLD_T2, DEPTH_THRESHOLD_T3, DEPTH_THRESHOLD_T4, DEPTH_THRESHOLD_T5, EPOCH_NON_ZERO, EPOCH_NOT_READY, ERROR_SYSTEM_ALREADY_INITIALIZED, ERROR_SYSTEM_DISABLED, ERROR_SYSTEM_NOT_INITIALIZED, EntitiesManager, EntityInventory, EntityType, EpochsManager, GAME_NOT_FOUND, GAME_SEED_NOT_SET, GameState, INITIAL_CONTAINER_CAPACITY, INITIAL_CONTAINER_HULLMASS, INITIAL_WAREHOUSE_CAPACITY, INSUFFICIENT_BALANCE, INSUFFICIENT_ITEM_QUANTITY, INSUFFICIENT_ITEM_SUPPLY, INVALID_AMOUNT, ITEM_CARGO_ARM, ITEM_CARGO_LINING, ITEM_CONTAINER_PACKED, ITEM_DOES_NOT_EXIST, ITEM_DRILL_SHAFT, ITEM_ENGINE_T1, ITEM_EXTRACTION_PROBE, ITEM_EXTRACTOR_T1, ITEM_GENERATOR_T1, ITEM_HULL_PLATES, ITEM_LOADER_T1, ITEM_MANUFACTURING_T1, ITEM_NOT_AVAILABLE_AT_LOCATION, ITEM_POWER_CELL, ITEM_REACTION_CHAMBER, ITEM_SHIP_T1_PACKED, ITEM_THRUSTER_CORE, ITEM_TOOL_BIT, InventoryAccessor, Item, LOCATION_MAX_DEPTH, LOCATION_MIN_DEPTH, Location, LocationType, LocationsManager, MAX_ORBITAL_ALTITUDE, MIN_ORBITAL_ALTITUDE, MODULE_ANY, MODULE_CRAFTER, MODULE_ENGINE, MODULE_EXTRACTOR, MODULE_GENERATOR, MODULE_LAUNCHER, MODULE_LOADER, MODULE_WARP, NO_SCHEDULE, 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, PRECISION, platform as PlatformContract, Player, PlayersManager, REQUIRES_MORE_THAN_ONE, REQUIRES_POSITIVE_VALUE, SHIP_ALREADY_THERE, SHIP_ALREADY_TRAVELING, SHIP_CANNOT_BUY_TRAVELING, SHIP_CANNOT_CANCEL_TASK, SHIP_CANNOT_UPDATE_TRAVELING, 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, ScheduleAccessor, server as ServerContract, Ship, Shipload, TRAVEL_MAX_DURATION, TaskCancelable, TaskType, WAREHOUSE_ALREADY_AT_LOCATION, WAREHOUSE_CAPACITY_EXCEEDED, WAREHOUSE_NOT_FOUND, WAREHOUSE_Z, Warehouse, availableCapacity$1 as availableCapacity, availableCapacityFromMass, blendCargoStacks, blendComponentStacks, blendStacks, calcCargoMass, calcEnergyUsage, calcLoadDuration, calc_acceleration, calc_craft_duration, calc_craft_energy, calc_energyusage, calc_extraction_duration, calc_extraction_energy, calc_flighttime, 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, capsHasCrafter, capsHasExtractor, capsHasLoaders, capsHasMass, capsHasMovement, capsHasStorage, cargoUtils, categoryColors, categoryIcons, componentIcon, components, computeComponentStats, computeContainerCapabilities, computeEngineCapabilities, computeEntityStats, computeExtractorCapabilities, computeGeneratorCapabilities, computeLoaderCapabilities, computeManufacturingCapabilities, computeShipHullCapabilities, coordsToLocationId, createInventoryAccessor, createProjectedEntity, createScheduleAccessor, decodeCraftedItemStats, decodeStats, Shipload as default, depthScaleFactor, deriveLocation, deriveLocationEpoch, deriveLocationSize, deriveLocationStatic, deriveResourceStats, deriveStratum, distanceBetweenCoordinates, distanceBetweenPoints, encodeStats, energyPercent, entityRecipes, estimateDealTravelTime, estimateTravelTime, findNearbyPlanets, getAllCraftableItems, getComponentById, getComponentsForCategory, getComponentsForStat, getCurrentEpoch, getDepthThreshold, getDestinationLocation, getEligibleResources, getEntityRecipe, getEntityRecipeByItemId, getEpochInfo, getFlightOrigin, getItem, getItems, getLocationCandidates, getLocationType, getModuleCapabilityType, getModuleRecipe, getModuleRecipeByItemId, getPositionAt, getResourceTier, getResourceWeight, getStatDefinitions, getStatName, getSystemName, hasEnergy, hasEnergyForDistance$1 as hasEnergyForDistance, hasExtractor, hasLoaders, hasMass, hasSchedule, hasSpace$1 as hasSpace, hasSpaceForMass, hasStorage, hasSystem, hash, hash512, isExtractableLocation, isFull$1 as isFull, isFullFromMass, isModuleItem, itemIds, lerp, makeContainer, makeShip, makeWarehouse, maxTravelDistance, moduleAccepts, moduleIcon, moduleRecipes, needsRecharge, projectEntity, projectEntityAt, resolveItem, resolveStats, rotation, schedule, tierColors, toLocation };
7120
+ export { ActionsManager, BASE_ORBITAL_MASS, COMMIT_ALREADY_SET, COMMIT_CANNOT_MATCH, COMMIT_NOT_SET, COMPANY_NOT_FOUND, CONTAINER_Z, Container, Coordinates, DEPTH_THRESHOLD_T1, DEPTH_THRESHOLD_T2, DEPTH_THRESHOLD_T3, DEPTH_THRESHOLD_T4, DEPTH_THRESHOLD_T5, EPOCH_NON_ZERO, EPOCH_NOT_READY, ERROR_SYSTEM_ALREADY_INITIALIZED, ERROR_SYSTEM_DISABLED, ERROR_SYSTEM_NOT_INITIALIZED, EntitiesManager, EntityInventory, EntityType, EpochsManager, GAME_NOT_FOUND, GAME_SEED_NOT_SET, GameState, INITIAL_CONTAINER_CAPACITY, INITIAL_CONTAINER_HULLMASS, INITIAL_WAREHOUSE_CAPACITY, INSUFFICIENT_BALANCE, INSUFFICIENT_ITEM_QUANTITY, INSUFFICIENT_ITEM_SUPPLY, INVALID_AMOUNT, ITEM_CARGO_ARM, ITEM_CARGO_LINING, ITEM_CONTAINER_PACKED, ITEM_DOES_NOT_EXIST, ITEM_DRILL_SHAFT, ITEM_ENGINE_T1, ITEM_EXTRACTION_PROBE, ITEM_EXTRACTOR_T1, ITEM_GENERATOR_T1, ITEM_HULL_PLATES, ITEM_LOADER_T1, ITEM_MANUFACTURING_T1, ITEM_NOT_AVAILABLE_AT_LOCATION, ITEM_POWER_CELL, ITEM_REACTION_CHAMBER, ITEM_SHIP_T1_PACKED, ITEM_THRUSTER_CORE, ITEM_TOOL_BIT, InventoryAccessor, Item, LOCATION_MAX_DEPTH, LOCATION_MIN_DEPTH, Location, LocationType, LocationsManager, MAX_ORBITAL_ALTITUDE, MIN_ORBITAL_ALTITUDE, MODULE_ANY, MODULE_CRAFTER, MODULE_ENGINE, MODULE_EXTRACTOR, MODULE_GENERATOR, MODULE_LAUNCHER, MODULE_LOADER, MODULE_WARP, NO_SCHEDULE, 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, PRECISION, platform as PlatformContract, Player, PlayersManager, REQUIRES_MORE_THAN_ONE, REQUIRES_POSITIVE_VALUE, SHIP_ALREADY_THERE, SHIP_ALREADY_TRAVELING, SHIP_CANNOT_BUY_TRAVELING, SHIP_CANNOT_CANCEL_TASK, SHIP_CANNOT_UPDATE_TRAVELING, 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, ScheduleAccessor, server as ServerContract, Ship, Shipload, TRAVEL_MAX_DURATION, TaskCancelable, TaskType, WAREHOUSE_ALREADY_AT_LOCATION, WAREHOUSE_CAPACITY_EXCEEDED, WAREHOUSE_NOT_FOUND, WAREHOUSE_Z, Warehouse, availableCapacity$1 as availableCapacity, availableCapacityFromMass, blendCargoStacks, blendComponentStacks, blendStacks, calcCargoMass, calcEnergyUsage, calcLoadDuration, calc_acceleration, calc_craft_duration, calc_craft_energy, calc_energyusage, calc_extraction_duration, calc_extraction_energy, calc_flighttime, 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, capsHasCrafter, capsHasExtractor, capsHasLoaders, capsHasMass, capsHasMovement, capsHasStorage, cargoUtils, categoryColors, categoryIcons, componentIcon, components, computeComponentStats, computeContainerCapabilities, computeEngineCapabilities, computeEntityStats, computeExtractorCapabilities, computeGeneratorCapabilities, computeLoaderCapabilities, computeManufacturingCapabilities, computeShipHullCapabilities, coordsToLocationId, createInventoryAccessor, createProjectedEntity, createScheduleAccessor, decodeCraftedItemStats, decodeStats, Shipload as default, depthScaleFactor, deriveLocation, deriveLocationEpoch, deriveLocationSize, deriveLocationStatic, deriveResourceStats, deriveStratum, distanceBetweenCoordinates, distanceBetweenPoints, encodeStats, energyPercent, entityRecipes, estimateDealTravelTime, estimateTravelTime, findNearbyPlanets, getAllCraftableItems, getComponentById, getComponentsForCategory, getComponentsForStat, getCurrentEpoch, getDepthThreshold, getDestinationLocation, getEligibleResources, getEntityRecipe, getEntityRecipeByItemId, getEpochInfo, getFlightOrigin, getItem, getItems, getLocationCandidates, getLocationType, getModuleCapabilityType, getModuleRecipe, getModuleRecipeByItemId, getPositionAt, getResourceTier, getResourceWeight, getStatDefinitions, getStatName, getSystemName, hasEnergy, hasEnergyForDistance$1 as hasEnergyForDistance, hasExtractor, hasLoaders, hasMass, hasSchedule, hasSpace$1 as hasSpace, hasSpaceForMass, hasStorage, hasSystem, hash, hash512, isExtractableLocation, isFull$1 as isFull, isFullFromMass, isModuleItem, itemIcons, itemIds, lerp, makeContainer, makeShip, makeWarehouse, maxTravelDistance, moduleAccepts, moduleIcon, moduleRecipes, needsRecharge, projectEntity, projectEntityAt, resolveItem, resolveStats, rotation, schedule, tierColors, toLocation };
7088
7121
  //# sourceMappingURL=shipload.m.js.map