chore: enforce that account only owns one of 'singleton items'
All checks were successful
Build / build (18) (push) Successful in 36s
Build / build (22) (pull_request) Successful in 33s
Build / build (20) (pull_request) Successful in 1m7s
Build / build (20) (push) Successful in 56s
Build / build (22) (push) Successful in 35s
Build / build (18) (pull_request) Successful in 56s
All checks were successful
Build / build (18) (push) Successful in 36s
Build / build (22) (pull_request) Successful in 33s
Build / build (20) (pull_request) Successful in 1m7s
Build / build (20) (push) Successful in 56s
Build / build (22) (push) Successful in 35s
Build / build (18) (pull_request) Successful in 56s
This commit is contained in:
parent
00a75a33fa
commit
d1264b3549
@ -830,6 +830,9 @@ const addCrewShip = (
|
||||
typeName: string,
|
||||
inventoryChanges: IInventoryChanges = {}
|
||||
): IInventoryChanges => {
|
||||
if (inventory.CrewShips.length != 0) {
|
||||
throw new Error("refusing to add CrewShip because account already has one");
|
||||
}
|
||||
const index = inventory.CrewShips.push({ ItemType: typeName }) - 1;
|
||||
inventoryChanges.CrewShips ??= [];
|
||||
(inventoryChanges.CrewShips as object[]).push(inventory.CrewShips[index].toJSON());
|
||||
@ -841,6 +844,9 @@ const addCrewShipHarness = (
|
||||
typeName: string,
|
||||
inventoryChanges: IInventoryChanges = {}
|
||||
): IInventoryChanges => {
|
||||
if (inventory.CrewShips.length != 0) {
|
||||
throw new Error("refusing to add CrewShipHarness because account already has one");
|
||||
}
|
||||
const index = inventory.CrewShipHarnesses.push({ ItemType: typeName }) - 1;
|
||||
inventoryChanges.CrewShipHarnesses ??= [];
|
||||
(inventoryChanges.CrewShipHarnesses as object[]).push(inventory.CrewShipHarnesses[index].toJSON());
|
||||
|
Loading…
x
Reference in New Issue
Block a user