@shipload/sdk 2.0.0-rc4 → 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 (45) hide show
  1. package/lib/shipload.d.ts +411 -1025
  2. package/lib/shipload.js +879 -2057
  3. package/lib/shipload.js.map +1 -1
  4. package/lib/shipload.m.js +852 -2028
  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 +106 -225
  12. package/src/data/items.json +15 -14
  13. package/src/data/recipes.ts +129 -0
  14. package/src/derivation/crafting.ts +120 -0
  15. package/src/derivation/index.ts +9 -6
  16. package/src/derivation/resources.ts +54 -53
  17. package/src/derivation/stats.ts +146 -0
  18. package/src/derivation/stratum.ts +14 -14
  19. package/src/entities/cargo-utils.ts +6 -64
  20. package/src/entities/container.ts +18 -0
  21. package/src/entities/entity-inventory.ts +0 -4
  22. package/src/entities/inventory-accessor.ts +0 -4
  23. package/src/entities/location.ts +2 -197
  24. package/src/entities/player.ts +1 -274
  25. package/src/entities/ship.ts +0 -21
  26. package/src/entities/warehouse.ts +0 -4
  27. package/src/index-module.ts +43 -47
  28. package/src/managers/actions.ts +38 -90
  29. package/src/managers/context.ts +0 -9
  30. package/src/managers/index.ts +0 -1
  31. package/src/managers/locations.ts +2 -85
  32. package/src/market/items.ts +1 -2
  33. package/src/scheduling/projection.ts +0 -10
  34. package/src/shipload.ts +0 -5
  35. package/src/types/capabilities.ts +1 -9
  36. package/src/types/entity-traits.ts +3 -4
  37. package/src/types/entity.ts +0 -1
  38. package/src/types.ts +8 -28
  39. package/src/utils/system.ts +5 -4
  40. package/src/managers/trades.ts +0 -119
  41. package/src/market/market.ts +0 -208
  42. package/src/market/rolls.ts +0 -8
  43. package/src/trading/collect.ts +0 -938
  44. package/src/trading/deal.ts +0 -207
  45. 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-rc4",
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)