@shipload/sdk 2.0.0-rc5 → 2.0.0-rc6

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 (44) hide show
  1. package/lib/shipload.d.ts +376 -1008
  2. package/lib/shipload.js +712 -1948
  3. package/lib/shipload.js.map +1 -1
  4. package/lib/shipload.m.js +694 -1924
  5. package/lib/shipload.m.js.map +1 -1
  6. package/package.json +1 -1
  7. package/src/capabilities/crafting.ts +10 -0
  8. package/src/capabilities/guards.ts +0 -5
  9. package/src/capabilities/index.ts +1 -0
  10. package/src/capabilities/storage.ts +0 -8
  11. package/src/contracts/server.ts +103 -220
  12. package/src/data/items.json +15 -15
  13. package/src/data/recipes.ts +129 -0
  14. package/src/derivation/crafting.ts +120 -0
  15. package/src/derivation/index.ts +1 -0
  16. package/src/derivation/stats.ts +91 -15
  17. package/src/derivation/stratum.ts +2 -2
  18. package/src/entities/cargo-utils.ts +6 -64
  19. package/src/entities/container.ts +18 -0
  20. package/src/entities/entity-inventory.ts +0 -4
  21. package/src/entities/inventory-accessor.ts +0 -4
  22. package/src/entities/location.ts +2 -197
  23. package/src/entities/player.ts +1 -274
  24. package/src/entities/ship.ts +0 -21
  25. package/src/entities/warehouse.ts +0 -4
  26. package/src/index-module.ts +34 -41
  27. package/src/managers/actions.ts +38 -90
  28. package/src/managers/context.ts +0 -9
  29. package/src/managers/index.ts +0 -1
  30. package/src/managers/locations.ts +2 -85
  31. package/src/market/items.ts +0 -1
  32. package/src/scheduling/projection.ts +0 -10
  33. package/src/shipload.ts +0 -5
  34. package/src/types/capabilities.ts +1 -9
  35. package/src/types/entity-traits.ts +3 -4
  36. package/src/types/entity.ts +0 -1
  37. package/src/types.ts +5 -25
  38. package/src/utils/system.ts +5 -4
  39. package/src/managers/trades.ts +0 -119
  40. package/src/market/market.ts +0 -195
  41. package/src/market/rolls.ts +0 -8
  42. package/src/trading/collect.ts +0 -938
  43. package/src/trading/deal.ts +0 -207
  44. package/src/trading/trade.ts +0 -203
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@shipload/sdk",
3
3
  "description": "SDKs for Shipload",
4
- "version": "2.0.0-rc5",
4
+ "version": "2.0.0-rc6",
5
5
  "homepage": "https://github.com/shipload/sdk",
6
6
  "license": "MIT",
7
7
  "main": "lib/shipload.js",
@@ -0,0 +1,10 @@
1
+ import type {EntityCapabilities} from '../types/capabilities'
2
+ import {ServerContract} from '../contracts'
3
+
4
+ export interface CrafterCapability {
5
+ crafter: ServerContract.Types.crafter_stats
6
+ }
7
+
8
+ export function capsHasCrafter(caps: EntityCapabilities): boolean {
9
+ return caps.crafter !== undefined
10
+ }
@@ -6,7 +6,6 @@ import {
6
6
  MovementCapability,
7
7
  ScheduleCapability,
8
8
  StorageCapability,
9
- TradeCapability,
10
9
  } from '../types/capabilities'
11
10
  import {Entity} from '../types/entity'
12
11
 
@@ -26,10 +25,6 @@ export function hasLoaders(e: Entity): e is Entity & LoaderCapability {
26
25
  return 'loaders' in e && e.loaders !== undefined
27
26
  }
28
27
 
29
- export function hasTrade(e: Entity): e is Entity & TradeCapability {
30
- return 'trade' in e && e.trade !== undefined
31
- }
32
-
33
28
  export function hasMass(e: Entity): e is Entity & MassCapability {
34
29
  return 'hullmass' in e
35
30
  }
@@ -3,3 +3,4 @@ export * from './movement'
3
3
  export * from './storage'
4
4
  export * from './loading'
5
5
  export * from './extraction'
6
+ export * from './crafting'
@@ -24,14 +24,6 @@ export function calcCargoMass(entity: HasCargo): UInt64 {
24
24
  return mass
25
25
  }
26
26
 
27
- export function calcCargoValue(entity: HasCargo): UInt64 {
28
- let value = UInt64.from(0)
29
- for (const item of entity.cargo) {
30
- value = value.adding(item.unit_cost.multiplying(item.quantity))
31
- }
32
- return value
33
- }
34
-
35
27
  export function availableCapacity(entity: StorageCapability): UInt64 {
36
28
  const cargoMass = calcCargoMass(entity)
37
29
  return entity.capacity.gt(cargoMass)