@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.
- package/lib/shipload.d.ts +411 -1025
- package/lib/shipload.js +879 -2057
- package/lib/shipload.js.map +1 -1
- package/lib/shipload.m.js +852 -2028
- package/lib/shipload.m.js.map +1 -1
- package/package.json +1 -1
- package/src/capabilities/crafting.ts +10 -0
- package/src/capabilities/guards.ts +0 -5
- package/src/capabilities/index.ts +1 -0
- package/src/capabilities/storage.ts +0 -8
- package/src/contracts/server.ts +106 -225
- package/src/data/items.json +15 -14
- package/src/data/recipes.ts +129 -0
- package/src/derivation/crafting.ts +120 -0
- package/src/derivation/index.ts +9 -6
- package/src/derivation/resources.ts +54 -53
- package/src/derivation/stats.ts +146 -0
- package/src/derivation/stratum.ts +14 -14
- package/src/entities/cargo-utils.ts +6 -64
- package/src/entities/container.ts +18 -0
- package/src/entities/entity-inventory.ts +0 -4
- package/src/entities/inventory-accessor.ts +0 -4
- package/src/entities/location.ts +2 -197
- package/src/entities/player.ts +1 -274
- package/src/entities/ship.ts +0 -21
- package/src/entities/warehouse.ts +0 -4
- package/src/index-module.ts +43 -47
- package/src/managers/actions.ts +38 -90
- package/src/managers/context.ts +0 -9
- package/src/managers/index.ts +0 -1
- package/src/managers/locations.ts +2 -85
- package/src/market/items.ts +1 -2
- package/src/scheduling/projection.ts +0 -10
- package/src/shipload.ts +0 -5
- package/src/types/capabilities.ts +1 -9
- package/src/types/entity-traits.ts +3 -4
- package/src/types/entity.ts +0 -1
- package/src/types.ts +8 -28
- package/src/utils/system.ts +5 -4
- package/src/managers/trades.ts +0 -119
- package/src/market/market.ts +0 -208
- package/src/market/rolls.ts +0 -8
- package/src/trading/collect.ts +0 -938
- package/src/trading/deal.ts +0 -207
- package/src/trading/trade.ts +0 -203
package/package.json
CHANGED
|
@@ -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
|
}
|
|
@@ -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)
|