From 26729ce21aeda9d47a3383c6617234c3de7792a4 Mon Sep 17 00:00:00 2001 From: Sainan <63328889+Sainan@users.noreply.github.com> Date: Fri, 4 Jul 2025 15:18:53 -0700 Subject: [PATCH] feat: railjack skins (#2400) Technically worked before but some weird behaviour. Also updating saveLoadout again. I think warn is a more appropriate severity. It's certainly not a progession stopper if some category is unimplemented. Closes #2397 Reviewed-on: https://onlyg.it/OpenWF/SpaceNinjaServer/pulls/2400 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com> --- src/services/inventoryService.ts | 6 +++++- src/services/saveLoadoutService.ts | 12 +++++++++++- src/types/saveLoadoutTypes.ts | 1 + 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/services/inventoryService.ts b/src/services/inventoryService.ts index 68e6b7cc..b0e9dbf6 100644 --- a/src/services/inventoryService.ts +++ b/src/services/inventoryService.ts @@ -1395,7 +1395,11 @@ export const addSkin = ( if (inventory.WeaponSkins.some(x => x.ItemType == typeName)) { logger.debug(`refusing to add WeaponSkin ${typeName} because account already owns it`); } else { - const index = inventory.WeaponSkins.push({ ItemType: typeName, IsNew: true }) - 1; + const index = + inventory.WeaponSkins.push({ + ItemType: typeName, + IsNew: typeName.startsWith("/Lotus/Upgrades/Skins/RailJack/") ? undefined : true // railjack skins are incompatible with this flag + }) - 1; // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition inventoryChanges.WeaponSkins ??= []; (inventoryChanges.WeaponSkins as IWeaponSkinClient[]).push( diff --git a/src/services/saveLoadoutService.ts b/src/services/saveLoadoutService.ts index 5b35d079..ed51befd 100644 --- a/src/services/saveLoadoutService.ts +++ b/src/services/saveLoadoutService.ts @@ -172,6 +172,16 @@ export const handleInventoryItemConfigChange = async ( // seems always equal to the id of loadout config NORMAL[0], likely has no purpose and we're free to ignore it break; } + case "ActiveCrewShip": { + if (inventory.CrewShips.length != 1) { + logger.warn(`saving railjack changes with broken inventory?`); + } else if (!inventory.CrewShips[0]._id.equals(equipmentChanges.ActiveCrewShip.$oid)) { + logger.warn( + `client provided CrewShip id ${equipmentChanges.ActiveCrewShip.$oid} but id in inventory is ${inventory.CrewShips[0]._id.toString()}` + ); + } + break; + } default: { if (equipmentKeys.includes(equipmentName as TEquipmentKey)) { logger.debug(`general Item config saved of type ${equipmentName}`, { @@ -221,7 +231,7 @@ export const handleInventoryItemConfigChange = async ( } break; } else { - logger.error(`loadout category not implemented, changes will be lost: ${equipmentName}`, { + logger.warn(`unknown saveLoadout field: ${equipmentName}`, { config: equipment }); } diff --git a/src/types/saveLoadoutTypes.ts b/src/types/saveLoadoutTypes.ts index 18d692c1..06734f89 100644 --- a/src/types/saveLoadoutTypes.ts +++ b/src/types/saveLoadoutTypes.ts @@ -40,6 +40,7 @@ export interface ISaveLoadoutRequest { CrewShips: IItemEntry; CurrentLoadOutIds: IOid[]; ValidNewLoadoutId: string; + ActiveCrewShip: IOid; EquippedGear: string[]; EquippedEmotes: string[]; UseAdultOperatorLoadout: boolean;