@shipload/sdk 1.0.0-next.34 → 1.0.0-next.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/lib/shipload.d.ts +398 -51
  2. package/lib/shipload.js +1481 -400
  3. package/lib/shipload.js.map +1 -1
  4. package/lib/shipload.m.js +1442 -401
  5. package/lib/shipload.m.js.map +1 -1
  6. package/lib/testing.d.ts +101 -20
  7. package/lib/testing.js +201 -57
  8. package/lib/testing.js.map +1 -1
  9. package/lib/testing.m.js +201 -57
  10. package/lib/testing.m.js.map +1 -1
  11. package/package.json +1 -1
  12. package/src/capabilities/crafting.ts +2 -3
  13. package/src/capabilities/gathering.test.ts +16 -0
  14. package/src/capabilities/gathering.ts +8 -11
  15. package/src/contracts/server.ts +147 -29
  16. package/src/coordinates/address.ts +88 -0
  17. package/src/coordinates/constants.test.ts +15 -0
  18. package/src/coordinates/constants.ts +23 -0
  19. package/src/coordinates/index.ts +15 -0
  20. package/src/coordinates/memo.test.ts +47 -0
  21. package/src/coordinates/memo.ts +20 -0
  22. package/src/coordinates/permutation.ts +77 -0
  23. package/src/coordinates/regions.ts +48 -0
  24. package/src/coordinates/sectors.ts +115 -0
  25. package/src/data/capability-formulas.ts +0 -1
  26. package/src/data/entities.json +4 -4
  27. package/src/data/items.json +5 -5
  28. package/src/data/recipes.json +39 -65
  29. package/src/derivation/capabilities.test.ts +133 -0
  30. package/src/derivation/capabilities.ts +66 -14
  31. package/src/derivation/rollups.test.ts +55 -0
  32. package/src/derivation/rollups.ts +56 -0
  33. package/src/derivation/wormhole.ts +115 -0
  34. package/src/entities/makers.ts +30 -3
  35. package/src/errors.ts +2 -0
  36. package/src/index-module.ts +38 -2
  37. package/src/managers/actions.ts +79 -5
  38. package/src/managers/construction.ts +6 -4
  39. package/src/managers/context.ts +9 -0
  40. package/src/managers/coordinates.ts +14 -0
  41. package/src/managers/plot.ts +2 -4
  42. package/src/nft/description.ts +25 -6
  43. package/src/planner/index.ts +127 -0
  44. package/src/planner/planner.test.ts +319 -0
  45. package/src/resolution/resolve-item.ts +4 -1
  46. package/src/scheduling/availability.ts +1 -1
  47. package/src/scheduling/cancel.test.ts +348 -0
  48. package/src/scheduling/cancel.ts +209 -0
  49. package/src/scheduling/lanes.test.ts +249 -0
  50. package/src/scheduling/lanes.ts +140 -2
  51. package/src/scheduling/projection.ts +75 -16
  52. package/src/scheduling/schedule.ts +3 -1
  53. package/src/shipload.ts +5 -0
  54. package/src/testing/projection-parity.ts +26 -2
  55. package/src/travel/travel.ts +116 -105
  56. package/src/types/capabilities.ts +23 -6
  57. package/src/types/entity.ts +3 -3
  58. package/src/types.ts +2 -1
  59. package/src/utils/system.ts +11 -0
package/src/types.ts CHANGED
@@ -31,7 +31,7 @@ export interface ShipLike {
31
31
  energy?: UInt16
32
32
  engines?: ServerContract.Types.movement_stats
33
33
  generator?: ServerContract.Types.energy_stats
34
- loaders?: ServerContract.Types.loader_stats
34
+ loader_lanes?: ServerContract.Types.loader_lane[]
35
35
  hauler?: ServerContract.Types.hauler_stats
36
36
  capacity?: UInt32
37
37
  }
@@ -51,6 +51,7 @@ export enum TaskType {
51
51
  WARP = 6,
52
52
  CRAFT = 7,
53
53
  DEPLOY = 8,
54
+ TRANSIT = 9,
54
55
  UNWRAP = 10,
55
56
  UNDEPLOY = 11,
56
57
  DEMOLISH = 13,
@@ -3,6 +3,7 @@ import {hash512} from './hash'
3
3
  import {Coordinates, type CoordinatesType, LocationType} from '../types'
4
4
  import {ServerContract} from '../contracts'
5
5
  import {deriveLocationSize} from '../derivation/location-size'
6
+ import {wormholeAt} from '../derivation/wormhole'
6
7
  import syllables from '../data/syllables.json'
7
8
  import nebulaAdjectives from '../data/nebula-adjectives.json'
8
9
  import nebulaNouns from '../data/nebula-nouns.json'
@@ -110,6 +111,16 @@ export function hasSystem(gameSeed: Checksum256Type, coordinates: CoordinatesTyp
110
111
  return getLocationType(gameSeed, coordinates) !== LocationType.EMPTY
111
112
  }
112
113
 
114
+ export function getLocationKind(
115
+ gameSeed: Checksum256Type,
116
+ x: number,
117
+ y: number
118
+ ): 'wormhole' | 'system' | 'empty' {
119
+ if (wormholeAt(gameSeed, x, y)) return 'wormhole'
120
+ if (hasSystem(gameSeed, {x, y})) return 'system'
121
+ return 'empty'
122
+ }
123
+
113
124
  export function deriveLocationStatic(
114
125
  gameSeed: Checksum256Type,
115
126
  coordinates: CoordinatesType