XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

SpaceNinjaServer

A simple server for a small space ninja game

公开
关注 0 Fork 1 Star 0
返回提交历史

XFEstudio/SpaceNinjaServer

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>

26729ce2
Sainan <63328889+Sainan@users.noreply.github.com>
提交于

代码差异

3 个文件 +17 -2
Modified src/services/inventoryService.ts +5 -1
@@ -1395,7 +1395,11 @@ export const addSkin = (
1395 1395 if (inventory.WeaponSkins.some(x => x.ItemType == typeName)) {
1396 1396 logger.debug(`refusing to add WeaponSkin ${typeName} because account already owns it`);
1397 1397 } else {
1398 const index = inventory.WeaponSkins.push({ ItemType: typeName, IsNew: true }) - 1;
1398 const index =
1399 inventory.WeaponSkins.push({
1400 ItemType: typeName,
1401 IsNew: typeName.startsWith("/Lotus/Upgrades/Skins/RailJack/") ? undefined : true // railjack skins are incompatible with this flag
1402 }) - 1;
1399 1403 // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
1400 1404 inventoryChanges.WeaponSkins ??= [];
1401 1405 (inventoryChanges.WeaponSkins as IWeaponSkinClient[]).push(
Modified src/services/saveLoadoutService.ts +11 -1
@@ -172,6 +172,16 @@ export const handleInventoryItemConfigChange = async (
172 172 // seems always equal to the id of loadout config NORMAL[0], likely has no purpose and we're free to ignore it
173 173 break;
174 174 }
175 case "ActiveCrewShip": {
176 if (inventory.CrewShips.length != 1) {
177 logger.warn(`saving railjack changes with broken inventory?`);
178 } else if (!inventory.CrewShips[0]._id.equals(equipmentChanges.ActiveCrewShip.$oid)) {
179 logger.warn(
180 `client provided CrewShip id ${equipmentChanges.ActiveCrewShip.$oid} but id in inventory is ${inventory.CrewShips[0]._id.toString()}`
181 );
182 }
183 break;
184 }
175 185 default: {
176 186 if (equipmentKeys.includes(equipmentName as TEquipmentKey)) {
177 187 logger.debug(`general Item config saved of type ${equipmentName}`, {
@@ -221,7 +231,7 @@ export const handleInventoryItemConfigChange = async (
221 231 }
222 232 break;
223 233 } else {
224 logger.error(`loadout category not implemented, changes will be lost: ${equipmentName}`, {
234 logger.warn(`unknown saveLoadout field: ${equipmentName}`, {
225 235 config: equipment
226 236 });
227 237 }
Modified src/types/saveLoadoutTypes.ts +1 -0
@@ -40,6 +40,7 @@ export interface ISaveLoadoutRequest {
40 40 CrewShips: IItemEntry;
41 41 CurrentLoadOutIds: IOid[];
42 42 ValidNewLoadoutId: string;
43 ActiveCrewShip: IOid;
43 44 EquippedGear: string[];
44 45 EquippedEmotes: string[];
45 46 UseAdultOperatorLoadout: boolean;