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: #2400 Co-authored-by: Sainan <63328889+Sainan@users.noreply.github.com> Co-committed-by: Sainan <63328889+Sainan@users.noreply.github.com>
This commit is contained in:
		
							parent
							
								
									ee4adc7d55
								
							
						
					
					
						commit
						26729ce21a
					
				@ -1395,7 +1395,11 @@ export const addSkin = (
 | 
				
			|||||||
    if (inventory.WeaponSkins.some(x => x.ItemType == typeName)) {
 | 
					    if (inventory.WeaponSkins.some(x => x.ItemType == typeName)) {
 | 
				
			||||||
        logger.debug(`refusing to add WeaponSkin ${typeName} because account already owns it`);
 | 
					        logger.debug(`refusing to add WeaponSkin ${typeName} because account already owns it`);
 | 
				
			||||||
    } else {
 | 
					    } 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
 | 
					        // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
 | 
				
			||||||
        inventoryChanges.WeaponSkins ??= [];
 | 
					        inventoryChanges.WeaponSkins ??= [];
 | 
				
			||||||
        (inventoryChanges.WeaponSkins as IWeaponSkinClient[]).push(
 | 
					        (inventoryChanges.WeaponSkins as IWeaponSkinClient[]).push(
 | 
				
			||||||
 | 
				
			|||||||
@ -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
 | 
					                // seems always equal to the id of loadout config NORMAL[0], likely has no purpose and we're free to ignore it
 | 
				
			||||||
                break;
 | 
					                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: {
 | 
					            default: {
 | 
				
			||||||
                if (equipmentKeys.includes(equipmentName as TEquipmentKey)) {
 | 
					                if (equipmentKeys.includes(equipmentName as TEquipmentKey)) {
 | 
				
			||||||
                    logger.debug(`general Item config saved of type ${equipmentName}`, {
 | 
					                    logger.debug(`general Item config saved of type ${equipmentName}`, {
 | 
				
			||||||
@ -221,7 +231,7 @@ export const handleInventoryItemConfigChange = async (
 | 
				
			|||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    break;
 | 
					                    break;
 | 
				
			||||||
                } else {
 | 
					                } else {
 | 
				
			||||||
                    logger.error(`loadout category not implemented, changes will be lost: ${equipmentName}`, {
 | 
					                    logger.warn(`unknown saveLoadout field: ${equipmentName}`, {
 | 
				
			||||||
                        config: equipment
 | 
					                        config: equipment
 | 
				
			||||||
                    });
 | 
					                    });
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
 | 
				
			|||||||
@ -40,6 +40,7 @@ export interface ISaveLoadoutRequest {
 | 
				
			|||||||
    CrewShips: IItemEntry;
 | 
					    CrewShips: IItemEntry;
 | 
				
			||||||
    CurrentLoadOutIds: IOid[];
 | 
					    CurrentLoadOutIds: IOid[];
 | 
				
			||||||
    ValidNewLoadoutId: string;
 | 
					    ValidNewLoadoutId: string;
 | 
				
			||||||
 | 
					    ActiveCrewShip: IOid;
 | 
				
			||||||
    EquippedGear: string[];
 | 
					    EquippedGear: string[];
 | 
				
			||||||
    EquippedEmotes: string[];
 | 
					    EquippedEmotes: string[];
 | 
				
			||||||
    UseAdultOperatorLoadout: boolean;
 | 
					    UseAdultOperatorLoadout: boolean;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user