@etothepii/satisfactory-file-parser 3.0.1 → 3.0.3
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/.github/workflows/publish-jsr.yml +21 -0
- package/.github/workflows/tests.yml +2 -1
- package/CHANGELOG.md +12 -4
- package/README.md +6 -6
- package/build/index.d.ts +2 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +2 -1
- package/build/index.js.map +1 -1
- package/build/parser/parser.d.ts.map +1 -1
- package/build/parser/parser.js +5 -3
- package/build/parser/parser.js.map +1 -1
- package/build/parser/satisfactory/blueprint/blueprint-config.d.ts.map +1 -1
- package/build/parser/satisfactory/blueprint/blueprint-config.js.map +1 -1
- package/build/parser/satisfactory/blueprint/blueprint-header.d.ts +1 -8
- package/build/parser/satisfactory/blueprint/blueprint-header.d.ts.map +1 -1
- package/build/parser/satisfactory/blueprint/blueprint-header.js.map +1 -1
- package/build/parser/satisfactory/blueprint/blueprint-reader.js +2 -2
- package/build/parser/satisfactory/blueprint/blueprint-reader.js.map +1 -1
- package/build/parser/satisfactory/blueprint/blueprint-writer.js +2 -2
- package/build/parser/satisfactory/blueprint/blueprint-writer.js.map +1 -1
- package/build/parser/satisfactory/edit/edit-constants.d.ts +62 -0
- package/build/parser/satisfactory/edit/edit-constants.d.ts.map +1 -1
- package/build/parser/satisfactory/edit/edit-constants.js +62 -0
- package/build/parser/satisfactory/edit/edit-constants.js.map +1 -1
- package/build/parser/satisfactory/save/level-to-destroyed-actors-map.d.ts +9 -0
- package/build/parser/satisfactory/save/level-to-destroyed-actors-map.d.ts.map +1 -0
- package/build/parser/satisfactory/save/level-to-destroyed-actors-map.js +32 -0
- package/build/parser/satisfactory/save/level-to-destroyed-actors-map.js.map +1 -0
- package/build/parser/satisfactory/save/level.class.d.ts +2 -3
- package/build/parser/satisfactory/save/level.class.d.ts.map +1 -1
- package/build/parser/satisfactory/save/level.class.js +17 -27
- package/build/parser/satisfactory/save/level.class.js.map +1 -1
- package/build/parser/satisfactory/save/level.d.ts +29 -0
- package/build/parser/satisfactory/save/level.d.ts.map +1 -0
- package/build/parser/satisfactory/save/level.js +204 -0
- package/build/parser/satisfactory/save/level.js.map +1 -0
- package/build/parser/satisfactory/save/satisfactory-save-header.d.ts.map +1 -1
- package/build/parser/satisfactory/save/satisfactory-save-header.js.map +1 -1
- package/build/parser/satisfactory/save/satisfactory-save.d.ts +1 -1
- package/build/parser/satisfactory/save/satisfactory-save.d.ts.map +1 -1
- package/build/parser/satisfactory/save/satisfactory-save.js.map +1 -1
- package/build/parser/satisfactory/save/save-reader.d.ts +1 -1
- package/build/parser/satisfactory/save/save-reader.d.ts.map +1 -1
- package/build/parser/satisfactory/save/save-reader.js +2 -2
- package/build/parser/satisfactory/save/save-reader.js.map +1 -1
- package/build/parser/satisfactory/save/save-writer.js +2 -2
- package/build/parser/satisfactory/save/save-writer.js.map +1 -1
- package/build/parser/satisfactory/types/property/generic/ArrayProperty/ArrayProperty.d.ts +3 -3
- package/build/parser/satisfactory/types/property/generic/ArrayProperty/ArrayProperty.d.ts.map +1 -1
- package/build/parser/satisfactory/types/property/generic/ArrayProperty/ArrayProperty.js.map +1 -1
- package/build/parser/satisfactory/types/property/generic/SetProperty/SetProperty.d.ts +5 -5
- package/build/parser/satisfactory/types/property/generic/SetProperty/SetProperty.d.ts.map +1 -1
- package/build/parser/satisfactory/types/property/generic/SetProperty/SetProperty.js.map +1 -1
- package/build/parser/satisfactory/types/property/generic/StructProperty.d.ts.map +1 -1
- package/build/parser/satisfactory/types/property/generic/StructProperty.js +3 -3
- package/build/parser/satisfactory/types/property/generic/StructProperty.js.map +1 -1
- package/build/parser/satisfactory/types/property/special/BuildableSubsystemSpecialProperties.d.ts +1 -14
- package/build/parser/satisfactory/types/property/special/BuildableSubsystemSpecialProperties.d.ts.map +1 -1
- package/build/parser/satisfactory/types/property/special/BuildableSubsystemSpecialProperties.js.map +1 -1
- package/build/parser/satisfactory/types/property/special/CircuitSpecialProperties.d.ts.map +1 -1
- package/build/parser/satisfactory/types/property/special/CircuitSpecialProperties.js.map +1 -1
- package/build/parser/satisfactory/types/property/special/ConveyorChainActorSpecialProperties.d.ts.map +1 -1
- package/build/parser/satisfactory/types/property/special/ConveyorChainActorSpecialProperties.js.map +1 -1
- package/build/parser/satisfactory/types/property/special/ConveyorSpecialProperties.d.ts.map +1 -1
- package/build/parser/satisfactory/types/property/special/ConveyorSpecialProperties.js.map +1 -1
- package/build/parser/satisfactory/types/property/special/ObjectsListSpecialProperties.d.ts.map +1 -1
- package/build/parser/satisfactory/types/property/special/ObjectsListSpecialProperties.js.map +1 -1
- package/build/parser/satisfactory/types/property/special/PlayerSpecialProperties.d.ts.map +1 -1
- package/build/parser/satisfactory/types/property/special/PlayerSpecialProperties.js.map +1 -1
- package/build/parser/satisfactory/types/property/special/PowerLineSpecialProperties.d.ts.map +1 -1
- package/build/parser/satisfactory/types/property/special/PowerLineSpecialProperties.js.map +1 -1
- package/build/parser/satisfactory/types/property/special/SpecialDroneActionProperties.d.ts.map +1 -1
- package/build/parser/satisfactory/types/property/special/SpecialDroneActionProperties.js.map +1 -1
- package/build/parser/satisfactory/types/property/special/SpecialProperties.d.ts +2 -2
- package/build/parser/satisfactory/types/property/special/SpecialProperties.d.ts.map +1 -1
- package/build/parser/satisfactory/types/property/special/SpecialProperties.js.map +1 -1
- package/build/parser/satisfactory/types/property/special/VehicleSpecialProperties.d.ts.map +1 -1
- package/build/parser/satisfactory/types/property/special/VehicleSpecialProperties.js.map +1 -1
- package/build/parser/satisfactory/types/structs/VehiclePhysicsData.d.ts.map +1 -1
- package/build/parser/satisfactory/types/structs/VehiclePhysicsData.js.map +1 -1
- package/build/parser/stream/reworked/readable-stream-parser.d.ts.map +1 -1
- package/build/parser/stream/reworked/readable-stream-parser.js +12 -15
- package/build/parser/stream/reworked/readable-stream-parser.js.map +1 -1
- package/build/parser/stream/reworked/save-stream-json-stringifier.d.ts.map +1 -1
- package/build/parser/stream/reworked/save-stream-json-stringifier.js.map +1 -1
- package/build/parser/stream/reworked/save-stream-writer.class.d.ts.map +1 -1
- package/build/parser/stream/reworked/save-stream-writer.class.js.map +1 -1
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/BlueprintConfigReader.html +4 -4
- package/docs/classes/BlueprintConfigWriter.html +4 -4
- package/docs/classes/BlueprintReader.html +4 -4
- package/docs/classes/BlueprintWriter.html +4 -4
- package/docs/classes/CompressionLibraryError.html +2 -2
- package/docs/classes/CorruptBlueprintError.html +2 -2
- package/docs/classes/CorruptSaveError.html +2 -2
- package/docs/classes/Parser.html +6 -6
- package/docs/classes/ParserError.html +2 -2
- package/docs/classes/ReadableStreamParser.html +2 -2
- package/docs/classes/SatisfactorySave.html +2 -2
- package/docs/classes/SaveComponent.html +2 -2
- package/docs/classes/SaveEntity.html +2 -2
- package/docs/classes/SaveObject.html +2 -2
- package/docs/classes/SaveReader.html +4 -4
- package/docs/classes/SaveStreamJsonStringifier.html +5 -4
- package/docs/classes/SaveStreamWriter.html +17 -16
- package/docs/classes/SaveWriter.html +4 -4
- package/docs/classes/TimeoutError.html +2 -2
- package/docs/classes/UnimplementedError.html +2 -2
- package/docs/classes/UnsupportedVersionError.html +2 -2
- package/docs/enums/BlueprintConfigVersion.html +2 -2
- package/docs/enums/CompressionAlgorithmCode.html +2 -2
- package/docs/enums/FactoryGameCustomVersion.html +2 -2
- package/docs/enums/RuntimeBuildableInstanceDataVersion.html +2 -2
- package/docs/enums/SaveCustomVersion.html +10 -10
- package/docs/enums/SaveHeaderType.html +2 -2
- package/docs/functions/AbstractBaseProperty.Create.html +1 -1
- package/docs/functions/ArrayProperty.CalcOverhead.html +1 -1
- package/docs/functions/ArrayProperty.Parse.html +1 -1
- package/docs/functions/ArrayProperty.Serialize.html +1 -1
- package/docs/functions/BlueprintConfig.Parse.html +1 -1
- package/docs/functions/BlueprintConfig.Serialize.html +1 -1
- package/docs/functions/BlueprintHeader.Parse.html +1 -1
- package/docs/functions/BlueprintHeader.Serialize.html +1 -1
- package/docs/functions/BoolArrayProperty.Parse.html +1 -1
- package/docs/functions/BoolArrayProperty.Serialize.html +1 -1
- package/docs/functions/BoolProperty.CalcOverhead.html +1 -1
- package/docs/functions/BoolProperty.Parse.html +1 -1
- package/docs/functions/BoolProperty.ReadValue.html +1 -1
- package/docs/functions/BoolProperty.Serialize.html +1 -1
- package/docs/functions/BoolProperty.SerializeValue.html +1 -1
- package/docs/functions/BuildableSubsystemSpecialProperties.Parse.html +1 -1
- package/docs/functions/BuildableSubsystemSpecialProperties.Serialize.html +1 -1
- package/docs/functions/BuildableTypeInstance.Parse.html +1 -1
- package/docs/functions/BuildableTypeInstance.Serialize.html +1 -1
- package/docs/functions/ByteArrayProperty.Parse.html +1 -1
- package/docs/functions/ByteArrayProperty.Serialize.html +1 -1
- package/docs/functions/ByteProperty.CalcOverhead.html +1 -1
- package/docs/functions/ByteProperty.Parse.html +1 -1
- package/docs/functions/ByteProperty.ReadValue.html +1 -1
- package/docs/functions/ByteProperty.Serialize.html +1 -1
- package/docs/functions/ByteProperty.SerializeValue.html +1 -1
- package/docs/functions/CircuitSpecialProperties.Parse.html +1 -1
- package/docs/functions/CircuitSpecialProperties.Serialize.html +1 -1
- package/docs/functions/ConveyorChainActorSpecialProperties.Parse.html +1 -1
- package/docs/functions/ConveyorChainActorSpecialProperties.Serialize.html +1 -1
- package/docs/functions/ConveyorSpecialProperties.Parse.html +1 -1
- package/docs/functions/ConveyorSpecialProperties.Serialize.html +1 -1
- package/docs/functions/DoubleArrayProperty.Parse.html +1 -1
- package/docs/functions/DoubleArrayProperty.Serialize.html +1 -1
- package/docs/functions/DoubleProperty.CalcOverhead.html +1 -1
- package/docs/functions/DoubleProperty.Parse.html +1 -1
- package/docs/functions/DoubleProperty.ReadValue.html +1 -1
- package/docs/functions/DoubleProperty.Serialize.html +1 -1
- package/docs/functions/DoubleProperty.SerializeValue.html +1 -1
- package/docs/functions/DynamicStructPropertyValue.read.html +1 -1
- package/docs/functions/DynamicStructPropertyValue.write.html +1 -1
- package/docs/functions/EmptySpecialProperties.Parse.html +1 -1
- package/docs/functions/EmptySpecialProperties.Serialize.html +1 -1
- package/docs/functions/EnumArrayProperty.Parse.html +1 -1
- package/docs/functions/EnumArrayProperty.Serialize.html +1 -1
- package/docs/functions/EnumProperty.CalcOverhead.html +1 -1
- package/docs/functions/EnumProperty.Parse.html +1 -1
- package/docs/functions/EnumProperty.ReadValue.html +1 -1
- package/docs/functions/EnumProperty.Serialize.html +1 -1
- package/docs/functions/EnumProperty.SerializeValue.html +1 -1
- package/docs/functions/FGDynamicStruct.Parse.html +1 -1
- package/docs/functions/FGDynamicStruct.Serialize.html +1 -1
- package/docs/functions/FICFrameRange.Parse.html +1 -1
- package/docs/functions/FICFrameRange.Serialize.html +1 -1
- package/docs/functions/FloatArrayProperty.Parse.html +1 -1
- package/docs/functions/FloatArrayProperty.Serialize.html +1 -1
- package/docs/functions/FloatProperty.CalcOverhead.html +1 -1
- package/docs/functions/FloatProperty.Parse.html +1 -1
- package/docs/functions/FloatProperty.ReadValue.html +1 -1
- package/docs/functions/FloatProperty.Serialize.html +1 -1
- package/docs/functions/FloatProperty.SerializeValue.html +1 -1
- package/docs/functions/GUID.read.html +1 -1
- package/docs/functions/GUID.write.html +1 -1
- package/docs/functions/GUIDInfo.read.html +1 -1
- package/docs/functions/GUIDInfo.write.html +1 -1
- package/docs/functions/Int32ArrayProperty.Parse.html +1 -1
- package/docs/functions/Int32ArrayProperty.Serialize.html +1 -1
- package/docs/functions/Int32Property.CalcOverhead.html +1 -1
- package/docs/functions/Int32Property.Parse.html +1 -1
- package/docs/functions/Int32Property.ReadValue.html +1 -1
- package/docs/functions/Int32Property.Serialize.html +1 -1
- package/docs/functions/Int32Property.SerializeValue.html +1 -1
- package/docs/functions/Int32SetProperty.Parse.html +1 -1
- package/docs/functions/Int32SetProperty.Serialize.html +1 -1
- package/docs/functions/Int64ArrayProperty.Parse.html +1 -1
- package/docs/functions/Int64ArrayProperty.Serialize.html +1 -1
- package/docs/functions/Int64Property.CalcOverhead.html +1 -1
- package/docs/functions/Int64Property.Parse.html +1 -1
- package/docs/functions/Int64Property.ReadValue.html +1 -1
- package/docs/functions/Int64Property.Serialize.html +1 -1
- package/docs/functions/Int64Property.SerializeValue.html +1 -1
- package/docs/functions/Int8Property.CalcOverhead.html +1 -1
- package/docs/functions/Int8Property.Parse.html +1 -1
- package/docs/functions/Int8Property.ReadValue.html +1 -1
- package/docs/functions/Int8Property.Serialize.html +1 -1
- package/docs/functions/Int8Property.SerializeValue.html +1 -1
- package/docs/functions/Level.ReadAllObjectContents.html +1 -1
- package/docs/functions/Level.ReadAllObjectHeaders.html +1 -1
- package/docs/functions/Level.ReadLevel.html +1 -1
- package/docs/functions/Level.ReadNObjectContents.html +1 -1
- package/docs/functions/Level.ReadNObjectHeaders.html +1 -1
- package/docs/functions/Level.SerializeAllObjectContents.html +1 -1
- package/docs/functions/Level.SerializeAllObjectHeaders.html +1 -1
- package/docs/functions/Level.SerializeLevel.html +1 -1
- package/docs/functions/LevelToDestroyedActorsMap.read.html +1 -0
- package/docs/functions/LevelToDestroyedActorsMap.write.html +1 -0
- package/docs/functions/MD5Hash.read.html +1 -1
- package/docs/functions/MD5Hash.write.html +1 -1
- package/docs/functions/MapProperty.CalcOverhead.html +1 -1
- package/docs/functions/MapProperty.Parse.html +1 -1
- package/docs/functions/MapProperty.Serialize.html +1 -1
- package/docs/functions/ObjectArrayProperty.Parse.html +1 -1
- package/docs/functions/ObjectArrayProperty.Serialize.html +1 -1
- package/docs/functions/ObjectProperty.CalcOverhead.html +1 -1
- package/docs/functions/ObjectProperty.Parse.html +1 -1
- package/docs/functions/ObjectProperty.ReadValue.html +1 -1
- package/docs/functions/ObjectProperty.Serialize.html +1 -1
- package/docs/functions/ObjectProperty.SerializeValue.html +1 -1
- package/docs/functions/ObjectReference.IsEqual.html +1 -1
- package/docs/functions/ObjectReference.read.html +1 -1
- package/docs/functions/ObjectReference.write.html +1 -1
- package/docs/functions/ObjectSetProperty.Parse.html +1 -1
- package/docs/functions/ObjectSetProperty.Serialize.html +1 -1
- package/docs/functions/ObjectsListSpecialProperties.Parse.html +1 -1
- package/docs/functions/ObjectsListSpecialProperties.Serialize.html +1 -1
- package/docs/functions/PlayerSpecialProperties.Parse.html +1 -1
- package/docs/functions/PlayerSpecialProperties.Serialize.html +1 -1
- package/docs/functions/PowerLineSpecialProperties.Parse.html +1 -1
- package/docs/functions/PowerLineSpecialProperties.Serialize.html +1 -1
- package/docs/functions/PropertiesList.ParseList.html +1 -1
- package/docs/functions/PropertiesList.ParseSingleProperty.html +1 -1
- package/docs/functions/PropertiesList.SerializeList.html +1 -1
- package/docs/functions/PropertiesList.SerializeSingleProperty.html +1 -1
- package/docs/functions/SatisfactorySaveHeader.Parse.html +1 -1
- package/docs/functions/SatisfactorySaveHeader.Serialize.html +1 -1
- package/docs/functions/SaveBodyChunks.CompressDataIntoChunks.html +1 -1
- package/docs/functions/SaveBodyChunks.DecompressChunks.html +1 -1
- package/docs/functions/SetProperty.CalcOverhead.html +1 -1
- package/docs/functions/SetProperty.Parse.html +1 -1
- package/docs/functions/SetProperty.Serialize.html +1 -1
- package/docs/functions/SoftObjectArrayProperty.Parse.html +1 -1
- package/docs/functions/SoftObjectArrayProperty.Serialize.html +1 -1
- package/docs/functions/SoftObjectReference.read.html +1 -1
- package/docs/functions/SoftObjectReference.write.html +1 -1
- package/docs/functions/SpecialDroneActionProperties.Parse.html +1 -1
- package/docs/functions/SpecialDroneActionProperties.Serialize.html +1 -1
- package/docs/functions/SpecialProperties.ParseClassSpecificSpecialProperties.html +1 -1
- package/docs/functions/SpecialProperties.SerializeClassSpecificSpecialProperties.html +1 -1
- package/docs/functions/StrArrayProperty.Parse.html +1 -1
- package/docs/functions/StrArrayProperty.Serialize.html +1 -1
- package/docs/functions/StrProperty.CalcOverhead.html +1 -1
- package/docs/functions/StrProperty.Parse.html +1 -1
- package/docs/functions/StrProperty.ReadValue.html +1 -1
- package/docs/functions/StrProperty.Serialize.html +1 -1
- package/docs/functions/StrProperty.SerializeValue.html +1 -1
- package/docs/functions/StrSetProperty.Parse.html +1 -1
- package/docs/functions/StrSetProperty.Serialize.html +1 -1
- package/docs/functions/StructArrayProperty.Parse.html +1 -1
- package/docs/functions/StructArrayProperty.Serialize.html +1 -1
- package/docs/functions/StructProperty.CalcOverhead.html +1 -1
- package/docs/functions/StructProperty.Parse.html +1 -1
- package/docs/functions/StructProperty.ParseValue.html +1 -1
- package/docs/functions/StructProperty.Serialize.html +1 -1
- package/docs/functions/StructProperty.SerializeValue.html +1 -1
- package/docs/functions/StructSetProperty.Parse.html +1 -1
- package/docs/functions/StructSetProperty.Serialize.html +1 -1
- package/docs/functions/TextArrayProperty.Parse.html +1 -1
- package/docs/functions/TextArrayProperty.Serialize.html +1 -1
- package/docs/functions/TextProperty.CalcOverhead.html +1 -1
- package/docs/functions/TextProperty.Parse.html +1 -1
- package/docs/functions/TextProperty.ReadValue.html +1 -1
- package/docs/functions/TextProperty.Serialize.html +1 -1
- package/docs/functions/TextProperty.SerializeValue.html +1 -1
- package/docs/functions/Transform.Parse.html +1 -1
- package/docs/functions/Transform.ParseF.html +1 -1
- package/docs/functions/Transform.Serialize.html +1 -1
- package/docs/functions/Transform.SerializeF.html +1 -1
- package/docs/functions/Uint32Property.CalcOverhead.html +1 -1
- package/docs/functions/Uint32Property.Parse.html +1 -1
- package/docs/functions/Uint32Property.ReadValue.html +1 -1
- package/docs/functions/Uint32Property.Serialize.html +1 -1
- package/docs/functions/Uint32Property.SerializeValue.html +1 -1
- package/docs/functions/Uint32SetProperty.Parse.html +1 -1
- package/docs/functions/Uint32SetProperty.Serialize.html +1 -1
- package/docs/functions/Uint64Property.CalcOverhead.html +1 -1
- package/docs/functions/Uint64Property.Parse.html +1 -1
- package/docs/functions/Uint64Property.ReadValue.html +1 -1
- package/docs/functions/Uint64Property.Serialize.html +1 -1
- package/docs/functions/Uint64Property.SerializeValue.html +1 -1
- package/docs/functions/Uint8Property.CalcOverhead.html +1 -1
- package/docs/functions/Uint8Property.Parse.html +1 -1
- package/docs/functions/Uint8Property.ReadValue.html +1 -1
- package/docs/functions/Uint8Property.Serialize.html +1 -1
- package/docs/functions/Uint8Property.SerializeValue.html +1 -1
- package/docs/functions/VehiclePhysicsData.Parse.html +1 -1
- package/docs/functions/VehiclePhysicsData.Serialize.html +1 -1
- package/docs/functions/VehicleSpecialProperties.Parse.html +1 -1
- package/docs/functions/VehicleSpecialProperties.Serialize.html +1 -1
- package/docs/functions/col4.ParseBGRA.html +1 -1
- package/docs/functions/col4.ParseRGBA.html +1 -1
- package/docs/functions/col4.SerializeBGRA.html +1 -1
- package/docs/functions/col4.SerializeRGBA.html +1 -1
- package/docs/functions/isArrayProperty.html +1 -1
- package/docs/functions/isBoolArrayProperty.html +1 -1
- package/docs/functions/isBoolProperty.html +1 -1
- package/docs/functions/isBuildableSubsystemSpecialProperties.html +1 -1
- package/docs/functions/isByteArrayProperty.html +1 -1
- package/docs/functions/isByteProperty.html +1 -1
- package/docs/functions/isCircuitSpecialProperties.html +1 -1
- package/docs/functions/isConveyorChainActorSpecialProperties.html +1 -1
- package/docs/functions/isConveyorSpecialProperties.html +1 -1
- package/docs/functions/isDoubleArrayProperty.html +1 -1
- package/docs/functions/isDoubleProperty.html +1 -1
- package/docs/functions/isEmptySpecialProperties.html +1 -1
- package/docs/functions/isEnumArrayProperty.html +1 -1
- package/docs/functions/isEnumProperty.html +1 -1
- package/docs/functions/isFloatArrayProperty.html +1 -1
- package/docs/functions/isFloatProperty.html +1 -1
- package/docs/functions/isInt32ArrayProperty.html +1 -1
- package/docs/functions/isInt32Property.html +1 -1
- package/docs/functions/isInt32SetProperty.html +1 -1
- package/docs/functions/isInt64ArrayProperty.html +1 -1
- package/docs/functions/isInt64Property.html +1 -1
- package/docs/functions/isInt8Property.html +1 -1
- package/docs/functions/isMapProperty.html +1 -1
- package/docs/functions/isObjectArrayProperty.html +1 -1
- package/docs/functions/isObjectProperty.html +1 -1
- package/docs/functions/isObjectSetProperty.html +1 -1
- package/docs/functions/isObjectsListSpecialProperties.html +1 -1
- package/docs/functions/isPlayerSpecialProperties.html +1 -1
- package/docs/functions/isPowerLineSpecialProperties.html +1 -1
- package/docs/functions/isSaveComponent.html +1 -1
- package/docs/functions/isSaveEntity.html +1 -1
- package/docs/functions/isSetProperty.html +1 -1
- package/docs/functions/isSoftObjectArrayProperty.html +1 -1
- package/docs/functions/isSpecialDroneActionProperties.html +1 -1
- package/docs/functions/isStrArrayProperty.html +1 -1
- package/docs/functions/isStrProperty.html +1 -1
- package/docs/functions/isStrSetProperty.html +1 -1
- package/docs/functions/isStructArrayProperty.html +1 -1
- package/docs/functions/isStructProperty.html +1 -1
- package/docs/functions/isStructSetProperty.html +1 -1
- package/docs/functions/isTextArrayProperty.html +1 -1
- package/docs/functions/isTextProperty.html +1 -1
- package/docs/functions/isUInt64Property.html +1 -1
- package/docs/functions/isUint32Property.html +1 -1
- package/docs/functions/isUint32SetProperty.html +1 -1
- package/docs/functions/isUint8Property.html +1 -1
- package/docs/functions/isVehicleSpecialProperties.html +1 -1
- package/docs/functions/vec2.Parse.html +1 -1
- package/docs/functions/vec2.ParseF.html +1 -1
- package/docs/functions/vec2.Serialize.html +1 -1
- package/docs/functions/vec2.SerializeF.html +1 -1
- package/docs/functions/vec3.Parse.html +1 -1
- package/docs/functions/vec3.ParseF.html +1 -1
- package/docs/functions/vec3.ParseInt.html +1 -1
- package/docs/functions/vec3.Serialize.html +1 -1
- package/docs/functions/vec3.SerializeF.html +1 -1
- package/docs/functions/vec3.SerializeInt.html +1 -1
- package/docs/functions/vec3.add.html +1 -1
- package/docs/functions/vec3.length.html +1 -1
- package/docs/functions/vec3.mult.html +1 -1
- package/docs/functions/vec3.norm.html +1 -1
- package/docs/functions/vec3.sub.html +1 -1
- package/docs/functions/vec4.Parse.html +1 -1
- package/docs/functions/vec4.ParseF.html +1 -1
- package/docs/functions/vec4.Serialize.html +1 -1
- package/docs/functions/vec4.SerializeF.html +1 -1
- package/docs/index.html +4 -4
- package/docs/interfaces/Blueprint.html +2 -2
- package/docs/interfaces/BlueprintConfig-1.html +2 -2
- package/docs/interfaces/SaveComponentHeader.html +2 -2
- package/docs/interfaces/SaveEntityHeader.html +2 -2
- package/docs/interfaces/SaveObjectHeader.html +2 -2
- package/docs/modules/AbstractBaseProperty.html +1 -1
- package/docs/modules/ArrayProperty.html +1 -1
- package/docs/modules/BlueprintConfig.html +1 -1
- package/docs/modules/BlueprintHeader.html +1 -1
- package/docs/modules/BoolArrayProperty.html +1 -1
- package/docs/modules/BoolProperty.html +1 -1
- package/docs/modules/BuildableSubsystemSpecialProperties.html +1 -1
- package/docs/modules/BuildableTypeInstance.html +1 -1
- package/docs/modules/ByteArrayProperty.html +1 -1
- package/docs/modules/ByteProperty.html +1 -1
- package/docs/modules/CircuitSpecialProperties.html +1 -1
- package/docs/modules/ConveyorChainActorSpecialProperties.html +1 -1
- package/docs/modules/ConveyorSpecialProperties.html +1 -1
- package/docs/modules/DoubleArrayProperty.html +1 -1
- package/docs/modules/DoubleProperty.html +1 -1
- package/docs/modules/DynamicStructPropertyValue.html +1 -1
- package/docs/modules/EmptySpecialProperties.html +1 -1
- package/docs/modules/EnumArrayProperty.html +1 -1
- package/docs/modules/EnumProperty.html +1 -1
- package/docs/modules/FGDynamicStruct.html +1 -1
- package/docs/modules/FICFrameRange.html +1 -1
- package/docs/modules/FloatArrayProperty.html +1 -1
- package/docs/modules/FloatProperty.html +1 -1
- package/docs/modules/GUID.html +1 -1
- package/docs/modules/GUIDInfo.html +1 -1
- package/docs/modules/Int32ArrayProperty.html +1 -1
- package/docs/modules/Int32Property.html +1 -1
- package/docs/modules/Int32SetProperty.html +1 -1
- package/docs/modules/Int64ArrayProperty.html +1 -1
- package/docs/modules/Int64Property.html +1 -1
- package/docs/modules/Int8Property.html +1 -1
- package/docs/modules/Level.html +1 -1
- package/docs/modules/LevelToDestroyedActorsMap.html +3 -0
- package/docs/modules/MD5Hash.html +1 -1
- package/docs/modules/MapProperty.html +1 -1
- package/docs/modules/ObjectArrayProperty.html +1 -1
- package/docs/modules/ObjectProperty.html +1 -1
- package/docs/modules/ObjectReference.html +1 -1
- package/docs/modules/ObjectSetProperty.html +1 -1
- package/docs/modules/ObjectsListSpecialProperties.html +1 -1
- package/docs/modules/PlayerSpecialProperties.html +1 -1
- package/docs/modules/PowerLineSpecialProperties.html +1 -1
- package/docs/modules/PropertiesList.html +1 -1
- package/docs/modules/SatisfactorySaveHeader.html +1 -1
- package/docs/modules/SaveBodyChunks.html +1 -1
- package/docs/modules/SetProperty.html +1 -1
- package/docs/modules/SoftObjectArrayProperty.html +1 -1
- package/docs/modules/SoftObjectReference.html +1 -1
- package/docs/modules/SpecialDroneActionProperties.html +1 -1
- package/docs/modules/SpecialProperties.html +1 -1
- package/docs/modules/StrArrayProperty.html +1 -1
- package/docs/modules/StrProperty.html +1 -1
- package/docs/modules/StrSetProperty.html +1 -1
- package/docs/modules/StructArrayProperty.html +1 -1
- package/docs/modules/StructProperty.html +1 -1
- package/docs/modules/StructSetProperty.html +1 -1
- package/docs/modules/TextArrayProperty.html +1 -1
- package/docs/modules/TextProperty.html +1 -1
- package/docs/modules/Transform.html +1 -1
- package/docs/modules/Uint32Property.html +1 -1
- package/docs/modules/Uint32SetProperty.html +1 -1
- package/docs/modules/Uint64Property.html +1 -1
- package/docs/modules/Uint8Property.html +1 -1
- package/docs/modules/VehiclePhysicsData.html +1 -1
- package/docs/modules/VehicleSpecialProperties.html +1 -1
- package/docs/modules/col4.html +1 -1
- package/docs/modules/vec2.html +1 -1
- package/docs/modules/vec3.html +1 -1
- package/docs/modules/vec4.html +1 -1
- package/docs/modules.html +4 -2
- package/docs/types/AbstractBaseProperty-1.html +1 -1
- package/docs/types/ArrayProperty.AvailableArrayPropertyTypes.html +1 -1
- package/docs/types/ArrayPropertyStructValueFields.html +1 -1
- package/docs/types/BasicMultipleStructPropertyValue.html +1 -1
- package/docs/types/BasicStructPropertyValue.html +1 -1
- package/docs/types/BlueprintHeader-1.html +1 -1
- package/docs/types/BoolArrayProperty-1.html +1 -1
- package/docs/types/BoolProperty-1.html +1 -1
- package/docs/types/BoxStructPropertyValue.html +1 -1
- package/docs/types/BuildableSubsystemSpecialProperties-1.html +1 -1
- package/docs/types/BuildableTypeInstance-1.html +1 -1
- package/docs/types/ByteArray4.html +1 -1
- package/docs/types/ByteArrayProperty-1.html +1 -1
- package/docs/types/ByteProperty-1.html +1 -1
- package/docs/types/BytePropertyValue.html +1 -1
- package/docs/types/ChunkCompressionInfo.html +1 -1
- package/docs/types/ChunkSummary.html +1 -1
- package/docs/types/CircuitSpecialProperties-1.html +1 -1
- package/docs/types/ClientIdentityInfo.html +1 -1
- package/docs/types/ConveyorChainActorSpecialProperties-1.html +1 -1
- package/docs/types/ConveyorChainSegmentSpecialProperties.html +1 -1
- package/docs/types/ConveyorItemSpecialProperties.html +1 -1
- package/docs/types/ConveyorSpecialProperties-1.html +1 -1
- package/docs/types/DoubleArrayProperty-1.html +1 -1
- package/docs/types/DoubleProperty-1.html +1 -1
- package/docs/types/DynamicStructPropertyValue-1.html +1 -1
- package/docs/types/EmptySpecialProperties-1.html +1 -1
- package/docs/types/EnumArrayProperty-1.html +1 -1
- package/docs/types/EnumProperty-1.html +1 -1
- package/docs/types/FGDynamicStruct-1.html +1 -1
- package/docs/types/FICFrameRange-1.html +1 -1
- package/docs/types/FICFrameRangeStructPropertyValue.html +1 -1
- package/docs/types/FloatArrayProperty-1.html +1 -1
- package/docs/types/FloatProperty-1.html +1 -1
- package/docs/types/GENERIC_MAP_KEY_TYPE.html +1 -1
- package/docs/types/GENERIC_MAP_VALUE_TYPE.html +1 -1
- package/docs/types/GENERIC_STRUCT_PROPERTY_VALUE.html +1 -1
- package/docs/types/GUID-1.html +1 -1
- package/docs/types/GUIDInfo-1.html +1 -1
- package/docs/types/Grids.html +1 -1
- package/docs/types/Int32ArrayProperty-1.html +1 -1
- package/docs/types/Int32Property-1.html +1 -1
- package/docs/types/Int32SetProperty-1.html +1 -1
- package/docs/types/Int64ArrayProperty-1.html +1 -1
- package/docs/types/Int64Property-1.html +1 -1
- package/docs/types/Int8Property-1.html +1 -1
- package/docs/types/InventoryItemStructPropertyValue.html +1 -1
- package/docs/types/Level-1.html +2 -2
- package/docs/types/LevelToDestroyedActorsMap-1.html +1 -0
- package/docs/types/Levels.html +1 -1
- package/docs/types/MAP_STRUCT_KEY_PROXY.html +1 -1
- package/docs/types/MD5Hash-1.html +1 -1
- package/docs/types/MapProperty-1.html +1 -1
- package/docs/types/ModData.html +1 -1
- package/docs/types/ObjectArrayProperty-1.html +1 -1
- package/docs/types/ObjectProperty-1.html +1 -1
- package/docs/types/ObjectReference-1.html +1 -1
- package/docs/types/ObjectSetProperty-1.html +1 -1
- package/docs/types/ObjectsListSpecialProperties-1.html +1 -1
- package/docs/types/PlayerSpecialProperties-1.html +1 -1
- package/docs/types/PowerLineSpecialProperties-1.html +1 -1
- package/docs/types/PropertiesMap.html +1 -1
- package/docs/types/RailroadTrackPositionStructPropertyValue.html +1 -1
- package/docs/types/RoughSaveVersion.html +1 -1
- package/docs/types/SatisfactoryModMetadata.html +1 -1
- package/docs/types/SatisfactorySaveHeader-1.html +1 -1
- package/docs/types/SaveBodyChunks-1.html +1 -1
- package/docs/types/SaveBodyValidation.html +1 -1
- package/docs/types/SetProperty.AvailableSetPropertyTypes.html +1 -1
- package/docs/types/SoftObjectArrayProperty-1.html +1 -1
- package/docs/types/SoftObjectReference-1.html +1 -1
- package/docs/types/SpecialDroneAction.html +1 -1
- package/docs/types/SpecialDroneActionProperties-1.html +1 -1
- package/docs/types/SpecialProperties.AvailableSpecialPropertiesTypes.html +1 -1
- package/docs/types/StrArrayProperty-1.html +1 -1
- package/docs/types/StrProperty-1.html +1 -1
- package/docs/types/StrSetProperty-1.html +1 -1
- package/docs/types/StructArrayProperty-1.html +1 -1
- package/docs/types/StructProperty-1.html +1 -1
- package/docs/types/StructSetProperty-1.html +1 -1
- package/docs/types/TextArrayProperty-1.html +1 -1
- package/docs/types/TextProperty-1.html +1 -1
- package/docs/types/TextPropertyValue.html +1 -1
- package/docs/types/Transform-1.html +1 -1
- package/docs/types/Uint32Property-1.html +1 -1
- package/docs/types/Uint32SetProperty-1.html +1 -1
- package/docs/types/Uint64Property-1.html +1 -1
- package/docs/types/Uint8Property-1.html +1 -1
- package/docs/types/VehiclePhysicsData-1.html +1 -1
- package/docs/types/VehicleSpecialProperties-1.html +1 -1
- package/docs/types/col4-1.html +1 -1
- package/docs/types/vec2-1.html +1 -1
- package/docs/types/vec3-1.html +1 -1
- package/docs/types/vec4-1.html +1 -1
- package/docs/variables/DEFAULT_SATISFACTORY_CHUNK_HEADER_SIZE.html +1 -1
- package/docs/variables/EDIT.html +1 -1
- package/docs/variables/SaveBodyChunks.HEADER_V1.html +1 -1
- package/docs/variables/SaveBodyChunks.HEADER_V2.html +1 -1
- package/jsr.json +6 -0
- package/package.json +1 -3
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ContextReader } from '../../context/context-reader';
|
|
2
|
+
import { ContextWriter } from '../../context/context-writer';
|
|
3
|
+
import { ObjectReference } from '../types/structs/ObjectReference';
|
|
4
|
+
export type LevelToDestroyedActorsMap = Record<string, ObjectReference[]>;
|
|
5
|
+
export declare namespace LevelToDestroyedActorsMap {
|
|
6
|
+
const read: (reader: ContextReader) => LevelToDestroyedActorsMap;
|
|
7
|
+
const write: (writer: ContextWriter, map: LevelToDestroyedActorsMap) => void;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=level-to-destroyed-actors-map.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"level-to-destroyed-actors-map.d.ts","sourceRoot":"","sources":["../../../../src/parser/satisfactory/save/level-to-destroyed-actors-map.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AAEnE,MAAM,MAAM,yBAAyB,GAAG,MAAM,CAAC,MAAM,EAAE,eAAe,EAAE,CAAC,CAAC;AAE1E,yBAAiB,yBAAyB,CAAC;IAChC,MAAM,IAAI,WAAY,aAAa,KAAG,yBAa5C,CAAA;IAEM,MAAM,KAAK,WAAY,aAAa,OAAO,yBAAyB,KAAG,IAU7E,CAAA;CACJ"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LevelToDestroyedActorsMap = void 0;
|
|
4
|
+
const ObjectReference_1 = require("../types/structs/ObjectReference");
|
|
5
|
+
var LevelToDestroyedActorsMap;
|
|
6
|
+
(function (LevelToDestroyedActorsMap) {
|
|
7
|
+
LevelToDestroyedActorsMap.read = (reader) => {
|
|
8
|
+
const count = reader.readInt32();
|
|
9
|
+
const map = {};
|
|
10
|
+
for (let i = 0; i < count; i++) {
|
|
11
|
+
const key = reader.readString();
|
|
12
|
+
const elements = [];
|
|
13
|
+
const elementCount = reader.readInt32();
|
|
14
|
+
for (let j = 0; j < elementCount; j++) {
|
|
15
|
+
elements.push(ObjectReference_1.ObjectReference.read(reader));
|
|
16
|
+
}
|
|
17
|
+
map[key] = elements;
|
|
18
|
+
}
|
|
19
|
+
return map;
|
|
20
|
+
};
|
|
21
|
+
LevelToDestroyedActorsMap.write = (writer, map) => {
|
|
22
|
+
writer.writeInt32(Object.keys(map).length);
|
|
23
|
+
for (const entry of Object.entries(map)) {
|
|
24
|
+
writer.writeString(entry[0]);
|
|
25
|
+
writer.writeInt32(Object.keys(entry[1]).length);
|
|
26
|
+
for (const actor of entry[1]) {
|
|
27
|
+
ObjectReference_1.ObjectReference.write(writer, actor);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
})(LevelToDestroyedActorsMap || (exports.LevelToDestroyedActorsMap = LevelToDestroyedActorsMap = {}));
|
|
32
|
+
//# sourceMappingURL=level-to-destroyed-actors-map.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"level-to-destroyed-actors-map.js","sourceRoot":"","sources":["../../../../src/parser/satisfactory/save/level-to-destroyed-actors-map.ts"],"names":[],"mappings":";;;AAEA,sEAAmE;AAInE,IAAiB,yBAAyB,CA2BzC;AA3BD,WAAiB,yBAAyB;IACzB,8BAAI,GAAG,CAAC,MAAqB,EAA6B,EAAE;QACrE,MAAM,KAAK,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC;QACjC,MAAM,GAAG,GAAsC,EAAE,CAAC;QAClD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC;YAC7B,MAAM,GAAG,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;YAChC,MAAM,QAAQ,GAAsB,EAAE,CAAC;YACvC,MAAM,YAAY,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC;YACxC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,YAAY,EAAE,CAAC,EAAE,EAAE,CAAC;gBACpC,QAAQ,CAAC,IAAI,CAAC,iCAAe,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;YAChD,CAAC;YACD,GAAG,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC;QACxB,CAAC;QACD,OAAO,GAAG,CAAC;IACf,CAAC,CAAA;IAEY,+BAAK,GAAG,CAAC,MAAqB,EAAE,GAA8B,EAAQ,EAAE;QACjF,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC;QAC3C,KAAK,MAAM,KAAK,IAAI,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;YACtC,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;YAE7B,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;YAChD,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC3B,iCAAe,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;YACzC,CAAC;QACL,CAAC;IACL,CAAC,CAAA;AACL,CAAC,EA3BgB,yBAAyB,yCAAzB,yBAAyB,QA2BzC","sourcesContent":["import { ContextReader } from '../../context/context-reader';\nimport { ContextWriter } from '../../context/context-writer';\nimport { ObjectReference } from '../types/structs/ObjectReference';\n\nexport type LevelToDestroyedActorsMap = Record<string, ObjectReference[]>;\n\nexport namespace LevelToDestroyedActorsMap {\n export const read = (reader: ContextReader): LevelToDestroyedActorsMap => {\n const count = reader.readInt32();\n const map: Record<string, ObjectReference[]> = {};\n for (let i = 0; i < count; i++) {\n const key = reader.readString();\n const elements: ObjectReference[] = [];\n const elementCount = reader.readInt32();\n for (let j = 0; j < elementCount; j++) {\n elements.push(ObjectReference.read(reader));\n }\n map[key] = elements;\n }\n return map;\n }\n\n export const write = (writer: ContextWriter, map: LevelToDestroyedActorsMap): void => {\n writer.writeInt32(Object.keys(map).length);\n for (const entry of Object.entries(map)) {\n writer.writeString(entry[0]);\n\n writer.writeInt32(Object.keys(entry[1]).length);\n for (const actor of entry[1]) {\n ObjectReference.write(writer, actor);\n }\n }\n }\n}"]}
|
|
@@ -4,15 +4,14 @@ import { SaveComponent } from "../types/objects/SaveComponent";
|
|
|
4
4
|
import { SaveEntity } from "../types/objects/SaveEntity";
|
|
5
5
|
import { SaveObject } from "../types/objects/SaveObject";
|
|
6
6
|
import { ObjectReference } from "../types/structs/ObjectReference";
|
|
7
|
+
import { LevelToDestroyedActorsMap } from './level-to-destroyed-actors-map';
|
|
7
8
|
import { SaveReader } from './save-reader';
|
|
8
9
|
export type Level = {
|
|
9
10
|
name: string;
|
|
10
11
|
objects: (SaveEntity | SaveComponent)[];
|
|
11
12
|
collectables: ObjectReference[];
|
|
12
13
|
saveCustomVersion?: number;
|
|
13
|
-
destroyedActorsMap?:
|
|
14
|
-
[levelName: string]: ObjectReference[];
|
|
15
|
-
};
|
|
14
|
+
destroyedActorsMap?: LevelToDestroyedActorsMap;
|
|
16
15
|
};
|
|
17
16
|
export type Levels = {
|
|
18
17
|
[levelName: string]: Level;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"level.class.d.ts","sourceRoot":"","sources":["../../../../src/parser/satisfactory/save/level.class.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,OAAO,EAAE,aAAa,EAAmB,MAAM,gCAAgC,CAAC;AAChF,OAAO,EAAE,UAAU,EAAgB,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"level.class.d.ts","sourceRoot":"","sources":["../../../../src/parser/satisfactory/save/level.class.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,OAAO,EAAE,aAAa,EAAmB,MAAM,gCAAgC,CAAC;AAChF,OAAO,EAAE,UAAU,EAAgB,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAC;AACnE,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAG5E,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;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types/objects/SaveComponent");
|
|
6
6
|
const SaveEntity_1 = require("../types/objects/SaveEntity");
|
|
7
|
-
const
|
|
7
|
+
const level_to_destroyed_actors_map_1 = require("./level-to-destroyed-actors-map");
|
|
8
8
|
const object_references_list_1 = require("./object-references-list");
|
|
9
9
|
const save_custom_version_1 = require("./save-custom-version");
|
|
10
10
|
var Level;
|
|
@@ -23,13 +23,18 @@ var Level;
|
|
|
23
23
|
Level.ReadAllObjectHeaders(reader, level.objects);
|
|
24
24
|
let remainingSize = headersBinLen - (reader.getBufferPosition() - posBeforeHeaders);
|
|
25
25
|
if (remainingSize > 0) {
|
|
26
|
-
|
|
26
|
+
if (levelName === reader.context.mapName) {
|
|
27
|
+
level.destroyedActorsMap = level_to_destroyed_actors_map_1.LevelToDestroyedActorsMap.read(reader);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
level.collectables = object_references_list_1.ObjectReferencesList.ReadList(reader);
|
|
31
|
+
}
|
|
27
32
|
}
|
|
28
33
|
else {
|
|
29
34
|
}
|
|
30
35
|
remainingSize = headersBinLen - (reader.getBufferPosition() - posBeforeHeaders);
|
|
31
36
|
if (remainingSize !== 0) {
|
|
32
|
-
console.warn(
|
|
37
|
+
console.warn(`remaining size ${remainingSize} not 0 in level ${levelName}. Save may be corrupt.`);
|
|
33
38
|
}
|
|
34
39
|
const objectContentsBinLen = reader.readInt32();
|
|
35
40
|
if (reader.context.saveVersion >= save_custom_version_1.SaveCustomVersion.UnrealEngine5) {
|
|
@@ -47,19 +52,9 @@ var Level;
|
|
|
47
52
|
}
|
|
48
53
|
}
|
|
49
54
|
if (levelName === reader.context.mapName) {
|
|
50
|
-
|
|
51
|
-
level.destroyedActorsMap = {};
|
|
52
|
-
for (let i = 0; i < entriesCount; i++) {
|
|
53
|
-
const levelName = reader.readString();
|
|
54
|
-
const destroyedActors = [];
|
|
55
|
-
const destroyedActorsCount = reader.readInt32();
|
|
56
|
-
for (let j = 0; j < destroyedActorsCount; j++) {
|
|
57
|
-
destroyedActors.push(ObjectReference_1.ObjectReference.read(reader));
|
|
58
|
-
}
|
|
59
|
-
level.destroyedActorsMap[levelName] = destroyedActors;
|
|
60
|
-
}
|
|
55
|
+
level.destroyedActorsMap = level_to_destroyed_actors_map_1.LevelToDestroyedActorsMap.read(reader);
|
|
61
56
|
}
|
|
62
|
-
|
|
57
|
+
else {
|
|
63
58
|
level.collectables = object_references_list_1.ObjectReferencesList.ReadList(reader);
|
|
64
59
|
}
|
|
65
60
|
return level;
|
|
@@ -71,7 +66,10 @@ var Level;
|
|
|
71
66
|
writer.writeInt32Zero();
|
|
72
67
|
}
|
|
73
68
|
Level.SerializeAllObjectHeaders(writer, level.objects);
|
|
74
|
-
if (level.
|
|
69
|
+
if (level.name === writer.context.mapName && level.destroyedActorsMap !== undefined && Object.keys(level.destroyedActorsMap).length > 0) {
|
|
70
|
+
level_to_destroyed_actors_map_1.LevelToDestroyedActorsMap.write(writer, level.destroyedActorsMap);
|
|
71
|
+
}
|
|
72
|
+
else if (level.name !== writer.context.mapName && level.collectables.length > 0) {
|
|
75
73
|
object_references_list_1.ObjectReferencesList.SerializeList(writer, level.collectables);
|
|
76
74
|
}
|
|
77
75
|
writer.writeBinarySizeFromPosition(lenIndicatorHeaderAndDestroyedEntitiesSize, lenIndicatorHeaderAndDestroyedEntitiesSize + 8);
|
|
@@ -82,24 +80,16 @@ var Level;
|
|
|
82
80
|
}
|
|
83
81
|
}
|
|
84
82
|
if (level.name === writer.context.mapName) {
|
|
85
|
-
|
|
86
|
-
level.destroyedActorsMap = {};
|
|
87
|
-
for (const entry of Object.entries(level.destroyedActorsMap)) {
|
|
88
|
-
writer.writeString(entry[0]);
|
|
89
|
-
writer.writeInt32(Object.keys(entry[1]).length);
|
|
90
|
-
for (const actor of entry[1]) {
|
|
91
|
-
ObjectReference_1.ObjectReference.write(writer, actor);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
83
|
+
level_to_destroyed_actors_map_1.LevelToDestroyedActorsMap.write(writer, level.destroyedActorsMap ?? {});
|
|
94
84
|
}
|
|
95
|
-
|
|
85
|
+
else {
|
|
96
86
|
object_references_list_1.ObjectReferencesList.SerializeList(writer, level.collectables);
|
|
97
87
|
}
|
|
98
88
|
};
|
|
99
89
|
Level.ReadAllObjectContents = (levelName, reader, objectsList, onProgressCallback) => {
|
|
100
90
|
const countEntities = reader.readInt32();
|
|
101
91
|
if (countEntities !== objectsList.length) {
|
|
102
|
-
throw new Error(`possibly corrupt. entity
|
|
92
|
+
throw new Error(`possibly corrupt. entity count ${countEntities} does not equal object count of ${objectsList.length}`);
|
|
103
93
|
}
|
|
104
94
|
const batchSize = 10000;
|
|
105
95
|
let readObjectsCount = 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"level.class.js","sourceRoot":"","sources":["../../../../src/parser/satisfactory/save/level.class.ts"],"names":[],"mappings":";;;AAGA,2DAAgF;AAChF,kEAAgF;AAChF,4DAAuE;AAEvE,sEAAmE;AACnE,qEAAgE;AAChE,+DAA0D;AAgB1D,IAAiB,KAAK,CAoQrB;AApQD,WAAiB,KAAK;IAER,eAAS,GAAG,CAAC,MAAkB,EAAE,SAAiB,EAAS,EAAE;QACzE,MAAM,KAAK,GAAU;YACpB,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,EAAE;YACX,YAAY,EAAE,EAAE;SAChB,CAAA;QAGD,MAAM,aAAa,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC;QACzC,IAAI,MAAM,CAAC,OAAO,CAAC,WAAW,IAAI,uCAAiB,CAAC,aAAa,EAAE,CAAC;YACnE,MAAM,CAAC,aAAa,EAAE,CAAC;QACxB,CAAC;QAGD,MAAM,gBAAgB,GAAG,MAAM,CAAC,iBAAiB,EAAE,CAAC;QACpD,MAAA,oBAAoB,CAAC,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QAG5C,IAAI,aAAa,GAAG,aAAa,GAAG,CAAC,MAAM,CAAC,iBAAiB,EAAE,GAAG,g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ent":["\nimport { ContextReader } from '../../context/context-reader';\nimport { ContextWriter } from '../../context/context-writer';\nimport { CorruptSaveError, UnimplementedError } from '../../error/parser.error';\nimport { SaveComponent, isSaveComponent } from \"../types/objects/SaveComponent\";\nimport { SaveEntity, isSaveEntity } from \"../types/objects/SaveEntity\";\nimport { SaveObject } from \"../types/objects/SaveObject\";\nimport { ObjectReference } from \"../types/structs/ObjectReference\";\nimport { ObjectReferencesList } from './object-references-list';\nimport { SaveCustomVersion } from './save-custom-version';\nimport { SaveReader } from './save-reader';\n\n/**\n * type for levels\n * @param fiftyOne Use unclear. Added in Update 1.1\n */\nexport type Level = {\n\tname: string;\n\tobjects: (SaveEntity | SaveComponent)[];\n\tcollectables: ObjectReference[];\n\tsaveCustomVersion?: number;\n\tdestroyedActorsMap?: { [levelName: string]: ObjectReference[] }\n}\nexport type Levels = { [levelName: string]: Level };\n\nexport namespace Level {\n\n\texport const ReadLevel = (reader: SaveReader, levelName: string): Level => {\n\t\tconst level: Level = {\n\t\t\tname: levelName,\n\t\t\tobjects: [],\n\t\t\tcollectables: []\n\t\t}\n\n\t\t// checksum object headers.\n\t\tconst headersBinLen = reader.readInt32(); // object headers + binary length\n\t\tif (reader.context.saveVersion >= SaveCustomVersion.UnrealEngine5) {\n\t\t\treader.readInt32Zero();\n\t\t}\n\n\t\t// object headers\n\t\tconst posBeforeHeaders = reader.getBufferPosition();\n\t\tReadAllObjectHeaders(reader, level.objects);\n\n\t\t// collected, like slugs Only listed here since U8.\n\t\tlet remainingSize = headersBinLen - (reader.getBufferPosition() - posBeforeHeaders);\n\t\tif (remainingSize > 0) {\n\t\t\tlevel.collectables = ObjectReferencesList.ReadList(reader);\n\t\t} else {\n\t\t\t// its perfectly possible for ported saves to have nothing here.\n\t\t}\n\n\t\tremainingSize = headersBinLen - (reader.getBufferPosition() - posBeforeHeaders);\n\t\tif (remainingSize !== 0) {\n\t\t\tconsole.warn('remaining size not 0. Save may be corrupt.', remainingSize, levelName);\n\t\t}\n\n\t\t// checksum for object content size\n\t\tconst objectContentsBinLen = reader.readInt32();\n\t\tif (reader.context.saveVersion >= SaveCustomVersion.UnrealEngine5) {\n\t\t\treader.readInt32Zero();\n\t\t}\n\n\t\t// objects contents\n\t\tconst posBeforeContents = reader.getBufferPosition();\n\t\tReadAllObjectContents(levelName, reader, level.objects, reader.onProgressCallback);\n\t\tconst posAfterContents = reader.getBufferPosition();\n\t\tif (posAfterContents - posBeforeContents !== objectContentsBinLen) {\n\t\t\t//WARNING\n\t\t\tconsole.warn('save seems corrupt.', level.name);\n\t\t}\n\n\n\t\t// only NOT in the persistent level, we have saveVersion\n\t\tif (levelName !== reader.context.mapName) {\n\t\t\tif (reader.context.saveVersion >= SaveCustomVersion.SerializePerStreamableLevelTOCVersion) {\n\t\t\t\tlevel.saveCustomVersion = reader.readInt32();\n\t\t\t}\n\t\t}\n\n\t\t// only in persistent level, we have LevelToDestroyedActorsMap\n\t\tif (levelName === reader.context.mapName) {\n\t\t\tconst entriesCount = reader.readInt32();\n\t\t\tlevel.destroyedActorsMap = {};\n\t\t\tfor (let i = 0; i < entriesCount; i++) {\n\t\t\t\tconst levelName = reader.readString();\n\t\t\t\tconst destroyedActors: ObjectReference[] = [];\n\t\t\t\tconst destroyedActorsCount = reader.readInt32();\n\t\t\t\tfor (let j = 0; j < destroyedActorsCount; j++) {\n\t\t\t\t\tdestroyedActors.push(ObjectReference.read(reader));\n\t\t\t\t}\n\t\t\t\tlevel.destroyedActorsMap[levelName] = destroyedActors;\n\t\t\t}\n\t\t}\n\n\t\t// only NOT in the persistent level, we have 2nd collectables.\n\t\t// Listed here since < U8 and in U8 as well. So this is the best list you can rely on.\n\t\tif (levelName !== reader.context.mapName) {\n\t\t\tlevel.collectables = ObjectReferencesList.ReadList(reader);\n\t\t}\n\n\t\treturn level;\n\t}\n\n\texport const SerializeLevel = (writer: ContextWriter, level: Level) => {\n\t\tconst lenIndicatorHeaderAndDestroyedEntitiesSize = writer.getBufferPosition();\n\t\twriter.writeInt32(0);\t// len indicator\n\n\t\tif (writer.context.saveVersion >= SaveCustomVersion.UnrealEngine5) {\n\t\t\twriter.writeInt32Zero();\n\t\t}\n\n\t\tSerializeAllObjectHeaders(writer, level.objects);\n\n\t\t// <--- destroyed actors is the same as collectables list. Seems like its not there if count 0.\n\t\tif (level.collectables.length > 0) {\n\t\t\tObjectReferencesList.SerializeList(writer, level.collectables);\n\t\t}\n\n\t\t// replace binary size from earlier for - object headers + collectables\n\t\twriter.writeBinarySizeFromPosition(lenIndicatorHeaderAndDestroyedEntitiesSize, lenIndicatorHeaderAndDestroyedEntitiesSize + 8);\n\n\t\t// write entities\n\t\tSerializeAllObjectContents(writer, level.objects, level.name);\n\n\n\t\t// only NOT in the persistent level, we have saveVersion\n\t\tif (level.name !== writer.context.mapName) {\n\t\t\tif (writer.context.saveVersion >= SaveCustomVersion.SerializePerStreamableLevelTOCVersion) {\n\t\t\t\twriter.writeInt32(level.saveCustomVersion ?? SaveCustomVersion.SerializePerStreamableLevelTOCVersion);\n\t\t\t}\n\t\t}\n\n\t\t// only in persistent level, we have LevelToDestroyedActorsMap\n\t\tif (level.name === writer.context.mapName) {\n\t\t\twriter.writeInt32(Object.keys(level.destroyedActorsMap!).length);\n\t\t\tlevel.destroyedActorsMap = {};\n\t\t\tfor (const entry of Object.entries(level.destroyedActorsMap)) {\n\t\t\t\twriter.writeString(entry[0]);\n\n\t\t\t\twriter.writeInt32(Object.keys(entry[1]).length);\n\t\t\t\tfor (const actor of entry[1]) {\n\t\t\t\t\tObjectReference.write(writer, actor);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// only NOT in the persistent level, we have 2nd collectables.\n\t\tif (level.name !== writer.context.mapName) {\n\t\t\tObjectReferencesList.SerializeList(writer, level.collectables);\n\t\t}\n\t}\n\n\texport const ReadAllObjectContents = (levelName: string, reader: ContextReader, objectsList: SaveObject[], onProgressCallback: (progress: number, msg?: string) => void): void => {\n\t\tconst countEntities = reader.readInt32();\n\t\tif (countEntities !== objectsList.length) {\n\t\t\tthrow new Error(`possibly corrupt. entity content count ${countEntities} does not equal object count of ${objectsList.length}`);\n\t\t}\n\n\t\t// read in batches\n\t\tconst batchSize = 10000;\n\t\tlet readObjectsCount = 0;\n\t\tlet lastProgressReport = 0;\n\t\twhile (readObjectsCount < countEntities) {\n\t\t\tReadNObjectContents(reader, Math.min(batchSize, countEntities - readObjectsCount), objectsList, readObjectsCount);\n\t\t\treadObjectsCount += Math.min(batchSize, countEntities - readObjectsCount);\n\n\t\t\tif (readObjectsCount - lastProgressReport > batchSize) {\n\t\t\t\tonProgressCallback(reader.getBufferProgress(), `read object count [${(readObjectsCount)}/${(countEntities)}] in level ${levelName}`);\n\t\t\t\tlastProgressReport = readObjectsCount;\n\t\t\t}\n\t\t}\n\t}\n\n\texport const ReadNObjectContents = (reader: ContextReader, count: number, objects: SaveObject[], objectListOffset: number = 0, buildVersion: number = 0) => {\n\t\tfor (let i = 0; i < count; i++) {\n\t\t\tif (reader.context.saveVersion >= SaveCustomVersion.IntroducedWorldPartition) {\n\t\t\t\tobjects[i + objectListOffset].saveCustomVersion = reader.readInt32();\n\t\t\t}\n\t\t\tif (reader.context.saveVersion >= SaveCustomVersion.IntroducedWorldPartition) {\n\t\t\t\tobjects[i + objectListOffset].shouldMigrateObjectRefsToPersistent = reader.readInt32() >= 1;\n\t\t\t}\n\n\t\t\tconst binarySize = reader.readInt32();\n\n\t\t\tconst before = reader.getBufferPosition();\n\t\t\tif (isSaveEntity(objects[i + objectListOffset])) {\n\t\t\t\tSaveEntity.ParseData(objects[i + objectListOffset] as SaveEntity, binarySize, reader, objects[i + objectListOffset].typePath);\n\t\t\t} else if (isSaveComponent(objects[i + objectListOffset])) {\n\t\t\t\tSaveComponent.ParseData(objects[i + objectListOffset] as SaveComponent, binarySize, reader, objects[i + objectListOffset].typePath);\n\t\t\t}\n\n\t\t\tconst after = reader.getBufferPosition();\n\t\t\tif (after - before !== binarySize) {\n\t\t\t\tthrow new CorruptSaveError(`Could not read entity ${objects[i + objectListOffset].instanceName}, as ${after - before} bytes were read, but ${binarySize} bytes were indicated.`);\n\t\t\t}\n\t\t}\n\t}\n\n\texport const SerializeAllObjectContents = (writer: ContextWriter, objects: (SaveEntity | SaveComponent)[], levelName: string): void => {\n\t\tconst lenIndicatorEntities = writer.getBufferPosition();\n\t\twriter.writeInt32(0);\n\n\t\tif (writer.context.saveVersion >= SaveCustomVersion.UnrealEngine5) {\n\t\t\twriter.writeInt32Zero();\n\t\t}\n\n\t\twriter.writeInt32(objects.length);\n\t\tfor (const obj of objects) {\n\n\t\t\tif (writer.context.saveVersion >= SaveCustomVersion.IntroducedWorldPartition) {\n\t\t\t\twriter.writeInt32(obj.saveCustomVersion);\n\t\t\t}\n\t\t\tif (writer.context.saveVersion >= SaveCustomVersion.IntroducedWorldPartition) {\n\t\t\t\twriter.writeInt32(obj.shouldMigrateObjectRefsToPersistent ? 1 : 0);\n\t\t\t}\n\t\t\tconst lenReplacementPosition = writer.getBufferPosition();\n\t\t\twriter.writeInt32(0);\n\n\t\t\tif (isSaveEntity(obj)) {\n\t\t\t\tSaveEntity.SerializeData(writer, obj);\n\t\t\t} else if (isSaveComponent(obj)) {\n\t\t\t\tSaveComponent.SerializeData(writer, obj);\n\t\t\t}\n\n\t\t\twriter.writeBinarySizeFromPosition(lenReplacementPosition, lenReplacementPosition + 4);\n\t\t}\n\t\twriter.writeBinarySizeFromPosition(lenIndicatorEntities, lenIndicatorEntities + 8);\n\t}\n\n\texport const ReadAllObjectHeaders = (reader: ContextReader, objectsList: SaveObject[]): void => {\n\t\tlet countObjectHeaders = reader.readInt32();\n\n\t\t// read in batches\n\t\tconst batchSize = 10000;\n\t\tlet readObjectHeadersCount = 0;\n\t\twhile (readObjectHeadersCount < countObjectHeaders) {\n\t\t\tobjectsList.push(...ReadNObjectHeaders(reader, Math.min(batchSize, countObjectHeaders - readObjectHeadersCount)));\n\t\t\treadObjectHeadersCount += Math.min(batchSize, countObjectHeaders - readObjectHeadersCount);\n\t\t}\n\t}\n\n\texport const ReadNObjectHeaders = (reader: ContextReader, count: number): (SaveEntity | SaveComponent)[] => {\n\t\tlet objects: (SaveEntity | SaveComponent)[] = [];\n\t\tlet objectsRead = 0;\n\t\tfor (; objectsRead < count; objectsRead++) {\n\n\t\t\tlet obj: SaveEntity | SaveComponent;\n\t\t\tlet objectType = reader.readInt32();\n\t\t\tswitch (objectType) {\n\t\t\t\tcase SaveEntity.TypeID:\n\t\t\t\t\tobj = new SaveEntity('', '', '', '');\n\t\t\t\t\tSaveEntity.ParseHeader(reader, obj);\n\t\t\t\t\tbreak;\n\t\t\t\tcase SaveComponent.TypeID:\n\t\t\t\t\tobj = new SaveComponent('', '', '', '');\n\t\t\t\t\tSaveComponent.ParseHeader(reader, obj);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new CorruptSaveError('Unknown object type' + objectType);\n\t\t\t}\n\t\t\tobjects.push(obj);\n\t\t}\n\t\treturn objects;\n\t}\n\n\texport const SerializeAllObjectHeaders = (writer: ContextWriter, objects: (SaveEntity | SaveComponent)[]): void => {\n\t\twriter.writeInt32(objects.length);\n\t\tfor (const obj of objects) {\n\n\t\t\tswitch (obj.type) {\n\t\t\t\tcase 'SaveEntity':\n\t\t\t\t\twriter.writeInt32(SaveEntity.TypeID);\n\t\t\t\t\tSaveEntity.SerializeHeader(writer, obj);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'SaveComponent':\n\t\t\t\t\twriter.writeInt32(SaveComponent.TypeID);\n\t\t\t\t\tSaveComponent.SerializeHeader(writer, obj);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new UnimplementedError(`Unknown object type ${(obj as unknown as any).type}. Not implemented.`);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n}"]}
|
|
1
|
+
{"version":3,"file":"level.class.js","sourceRoot":"","sources":["../../../../src/parser/satisfactory/save/level.class.ts"],"names":[],"mappings":";;;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AAC;QACF,CAAC;IACF,CAAC,CAAA;AACF,CAAC,EAtPgB,KAAK,qBAAL,KAAK,QAsPrB","sourcesContent":["\nimport { ContextReader } from '../../context/context-reader';\nimport { ContextWriter } from '../../context/context-writer';\nimport { CorruptSaveError, UnimplementedError } from '../../error/parser.error';\nimport { SaveComponent, isSaveComponent } from \"../types/objects/SaveComponent\";\nimport { SaveEntity, isSaveEntity } from \"../types/objects/SaveEntity\";\nimport { SaveObject } from \"../types/objects/SaveObject\";\nimport { ObjectReference } from \"../types/structs/ObjectReference\";\nimport { LevelToDestroyedActorsMap } from './level-to-destroyed-actors-map';\nimport { ObjectReferencesList } from './object-references-list';\nimport { SaveCustomVersion } from './save-custom-version';\nimport { SaveReader } from './save-reader';\n\n/**\n * type for levels\n * @param fiftyOne Use unclear. Added in Update 1.1\n */\nexport type Level = {\n\tname: string;\n\tobjects: (SaveEntity | SaveComponent)[];\n\tcollectables: ObjectReference[];\n\tsaveCustomVersion?: number;\n\tdestroyedActorsMap?: LevelToDestroyedActorsMap\n}\nexport type Levels = { [levelName: string]: Level };\n\nexport namespace Level {\n\n\texport const ReadLevel = (reader: SaveReader, levelName: string): Level => {\n\t\tconst level: Level = {\n\t\t\tname: levelName,\n\t\t\tobjects: [],\n\t\t\tcollectables: []\n\t\t}\n\n\t\t// checksum object headers.\n\t\tconst headersBinLen = reader.readInt32(); // object headers + binary length\n\t\tif (reader.context.saveVersion >= SaveCustomVersion.UnrealEngine5) {\n\t\t\treader.readInt32Zero();\n\t\t}\n\n\t\t// object headers\n\t\tconst posBeforeHeaders = reader.getBufferPosition();\n\t\tReadAllObjectHeaders(reader, level.objects);\n\n\t\t// for persistent level, we have LevelToDestroyedActorsMap, else collectibles. Only listed here since U8.\n\t\tlet remainingSize = headersBinLen - (reader.getBufferPosition() - posBeforeHeaders);\n\t\tif (remainingSize > 0) {\n\n\t\t\tif (levelName === reader.context.mapName) {\n\t\t\t\tlevel.destroyedActorsMap = LevelToDestroyedActorsMap.read(reader);\n\t\t\t} else {\n\t\t\t\tlevel.collectables = ObjectReferencesList.ReadList(reader);\n\t\t\t}\n\n\t\t} else {\n\t\t\t// its perfectly possible for ported saves to have nothing here.\n\t\t}\n\n\n\t\tremainingSize = headersBinLen - (reader.getBufferPosition() - posBeforeHeaders);\n\t\tif (remainingSize !== 0) {\n\t\t\tconsole.warn(`remaining size ${remainingSize} not 0 in level ${levelName}. Save may be corrupt.`);\n\t\t}\n\n\t\t// checksum for object content size\n\t\tconst objectContentsBinLen = reader.readInt32();\n\t\tif (reader.context.saveVersion >= SaveCustomVersion.UnrealEngine5) {\n\t\t\treader.readInt32Zero();\n\t\t}\n\n\t\t// objects contents\n\t\tconst posBeforeContents = reader.getBufferPosition();\n\t\tReadAllObjectContents(levelName, reader, level.objects, reader.onProgressCallback);\n\t\tconst posAfterContents = reader.getBufferPosition();\n\t\tif (posAfterContents - posBeforeContents !== objectContentsBinLen) {\n\t\t\t//WARNING\n\t\t\tconsole.warn('save seems corrupt.', level.name);\n\t\t}\n\n\n\t\t// only NOT in the persistent level, we have saveVersion\n\t\tif (levelName !== reader.context.mapName) {\n\t\t\tif (reader.context.saveVersion >= SaveCustomVersion.SerializePerStreamableLevelTOCVersion) {\n\t\t\t\tlevel.saveCustomVersion = reader.readInt32();\n\t\t\t}\n\t\t}\n\n\t\t// 2nd time.\n\t\t// for persistent level, we have LevelToDestroyedActorsMap, else collectibles\n\t\t// Listed here since < U8 and in U8 as well. So this is the best list you can rely on.\n\t\tif (levelName === reader.context.mapName) {\n\t\t\tlevel.destroyedActorsMap = LevelToDestroyedActorsMap.read(reader);\n\t\t} else {\n\t\t\tlevel.collectables = ObjectReferencesList.ReadList(reader);\n\t\t}\n\n\t\treturn level;\n\t}\n\n\texport const SerializeLevel = (writer: ContextWriter, level: Level) => {\n\t\tconst lenIndicatorHeaderAndDestroyedEntitiesSize = writer.getBufferPosition();\n\t\twriter.writeInt32(0);\t// len indicator\n\n\t\tif (writer.context.saveVersion >= SaveCustomVersion.UnrealEngine5) {\n\t\t\twriter.writeInt32Zero();\n\t\t}\n\n\t\tSerializeAllObjectHeaders(writer, level.objects);\n\n\t\t// <--- destroyed actors is the same as collectables list. Seems like its not there if count 0.\n\t\tif (level.name === writer.context.mapName && level.destroyedActorsMap !== undefined && Object.keys(level.destroyedActorsMap).length > 0) {\n\t\t\tLevelToDestroyedActorsMap.write(writer, level.destroyedActorsMap);\n\t\t} else if (level.name !== writer.context.mapName && level.collectables.length > 0) {\n\t\t\tObjectReferencesList.SerializeList(writer, level.collectables);\n\t\t}\n\n\t\t// replace binary size from earlier for - object headers + collectables\n\t\twriter.writeBinarySizeFromPosition(lenIndicatorHeaderAndDestroyedEntitiesSize, lenIndicatorHeaderAndDestroyedEntitiesSize + 8);\n\n\t\t// write entities\n\t\tSerializeAllObjectContents(writer, level.objects, level.name);\n\n\n\t\t// only NOT in the persistent level, we have saveVersion\n\t\tif (level.name !== writer.context.mapName) {\n\t\t\tif (writer.context.saveVersion >= SaveCustomVersion.SerializePerStreamableLevelTOCVersion) {\n\t\t\t\twriter.writeInt32(level.saveCustomVersion ?? SaveCustomVersion.SerializePerStreamableLevelTOCVersion);\n\t\t\t}\n\t\t}\n\n\t\t// 2nd time.\n\t\t// for persistent level, we have LevelToDestroyedActorsMap, else collectibles\n\t\tif (level.name === writer.context.mapName) {\n\t\t\tLevelToDestroyedActorsMap.write(writer, level.destroyedActorsMap ?? {});\n\t\t} else {\n\t\t\tObjectReferencesList.SerializeList(writer, level.collectables);\n\t\t}\n\t}\n\n\texport const ReadAllObjectContents = (levelName: string, reader: ContextReader, objectsList: SaveObject[], onProgressCallback: (progress: number, msg?: string) => void): void => {\n\t\tconst countEntities = reader.readInt32();\n\t\tif (countEntities !== objectsList.length) {\n\t\t\tthrow new Error(`possibly corrupt. entity count ${countEntities} does not equal object count of ${objectsList.length}`);\n\t\t}\n\n\t\t// read in batches\n\t\tconst batchSize = 10000;\n\t\tlet readObjectsCount = 0;\n\t\tlet lastProgressReport = 0;\n\t\twhile (readObjectsCount < countEntities) {\n\t\t\tReadNObjectContents(reader, Math.min(batchSize, countEntities - readObjectsCount), objectsList, readObjectsCount);\n\t\t\treadObjectsCount += Math.min(batchSize, countEntities - readObjectsCount);\n\n\t\t\tif (readObjectsCount - lastProgressReport > batchSize) {\n\t\t\t\tonProgressCallback(reader.getBufferProgress(), `read object count [${(readObjectsCount)}/${(countEntities)}] in level ${levelName}`);\n\t\t\t\tlastProgressReport = readObjectsCount;\n\t\t\t}\n\t\t}\n\t}\n\n\texport const ReadNObjectContents = (reader: ContextReader, count: number, objects: SaveObject[], objectListOffset: number = 0, buildVersion: number = 0) => {\n\t\tfor (let i = 0; i < count; i++) {\n\t\t\tif (reader.context.saveVersion >= SaveCustomVersion.IntroducedWorldPartition) {\n\t\t\t\tobjects[i + objectListOffset].saveCustomVersion = reader.readInt32();\n\t\t\t}\n\t\t\tif (reader.context.saveVersion >= SaveCustomVersion.IntroducedWorldPartition) {\n\t\t\t\tobjects[i + objectListOffset].shouldMigrateObjectRefsToPersistent = reader.readInt32() >= 1;\n\t\t\t}\n\n\t\t\tconst binarySize = reader.readInt32();\n\n\t\t\tconst before = reader.getBufferPosition();\n\t\t\tif (isSaveEntity(objects[i + objectListOffset])) {\n\t\t\t\tSaveEntity.ParseData(objects[i + objectListOffset] as SaveEntity, binarySize, reader, objects[i + objectListOffset].typePath);\n\t\t\t} else if (isSaveComponent(objects[i + objectListOffset])) {\n\t\t\t\tSaveComponent.ParseData(objects[i + objectListOffset] as SaveComponent, binarySize, reader, objects[i + objectListOffset].typePath);\n\t\t\t}\n\n\t\t\tconst after = reader.getBufferPosition();\n\t\t\tif (after - before !== binarySize) {\n\t\t\t\tthrow new CorruptSaveError(`Could not read entity ${objects[i + objectListOffset].instanceName}, as ${after - before} bytes were read, but ${binarySize} bytes were indicated.`);\n\t\t\t}\n\t\t}\n\t}\n\n\texport const SerializeAllObjectContents = (writer: ContextWriter, objects: (SaveEntity | SaveComponent)[], levelName: string): void => {\n\t\tconst lenIndicatorEntities = writer.getBufferPosition();\n\t\twriter.writeInt32(0);\n\n\t\tif (writer.context.saveVersion >= SaveCustomVersion.UnrealEngine5) {\n\t\t\twriter.writeInt32Zero();\n\t\t}\n\n\t\twriter.writeInt32(objects.length);\n\t\tfor (const obj of objects) {\n\n\t\t\tif (writer.context.saveVersion >= SaveCustomVersion.IntroducedWorldPartition) {\n\t\t\t\twriter.writeInt32(obj.saveCustomVersion);\n\t\t\t}\n\t\t\tif (writer.context.saveVersion >= SaveCustomVersion.IntroducedWorldPartition) {\n\t\t\t\twriter.writeInt32(obj.shouldMigrateObjectRefsToPersistent ? 1 : 0);\n\t\t\t}\n\t\t\tconst lenReplacementPosition = writer.getBufferPosition();\n\t\t\twriter.writeInt32(0);\n\n\t\t\tif (isSaveEntity(obj)) {\n\t\t\t\tSaveEntity.SerializeData(writer, obj);\n\t\t\t} else if (isSaveComponent(obj)) {\n\t\t\t\tSaveComponent.SerializeData(writer, obj);\n\t\t\t}\n\n\t\t\twriter.writeBinarySizeFromPosition(lenReplacementPosition, lenReplacementPosition + 4);\n\t\t}\n\t\twriter.writeBinarySizeFromPosition(lenIndicatorEntities, lenIndicatorEntities + 8);\n\t}\n\n\texport const ReadAllObjectHeaders = (reader: ContextReader, objectsList: SaveObject[]): void => {\n\t\tlet countObjectHeaders = reader.readInt32();\n\n\t\t// read in batches\n\t\tconst batchSize = 10000;\n\t\tlet readObjectHeadersCount = 0;\n\t\twhile (readObjectHeadersCount < countObjectHeaders) {\n\t\t\tobjectsList.push(...ReadNObjectHeaders(reader, Math.min(batchSize, countObjectHeaders - readObjectHeadersCount)));\n\t\t\treadObjectHeadersCount += Math.min(batchSize, countObjectHeaders - readObjectHeadersCount);\n\t\t}\n\t}\n\n\texport const ReadNObjectHeaders = (reader: ContextReader, count: number): (SaveEntity | SaveComponent)[] => {\n\t\tlet objects: (SaveEntity | SaveComponent)[] = [];\n\t\tlet objectsRead = 0;\n\t\tfor (; objectsRead < count; objectsRead++) {\n\n\t\t\tlet obj: SaveEntity | SaveComponent;\n\t\t\tlet objectType = reader.readInt32();\n\t\t\tswitch (objectType) {\n\t\t\t\tcase SaveEntity.TypeID:\n\t\t\t\t\tobj = new SaveEntity('', '', '', '');\n\t\t\t\t\tSaveEntity.ParseHeader(reader, obj);\n\t\t\t\t\tbreak;\n\t\t\t\tcase SaveComponent.TypeID:\n\t\t\t\t\tobj = new SaveComponent('', '', '', '');\n\t\t\t\t\tSaveComponent.ParseHeader(reader, obj);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new CorruptSaveError('Unknown object type' + objectType);\n\t\t\t}\n\t\t\tobjects.push(obj);\n\t\t}\n\t\treturn objects;\n\t}\n\n\texport const SerializeAllObjectHeaders = (writer: ContextWriter, objects: (SaveEntity | SaveComponent)[]): void => {\n\t\twriter.writeInt32(objects.length);\n\t\tfor (const obj of objects) {\n\n\t\t\tswitch (obj.type) {\n\t\t\t\tcase 'SaveEntity':\n\t\t\t\t\twriter.writeInt32(SaveEntity.TypeID);\n\t\t\t\t\tSaveEntity.SerializeHeader(writer, obj);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'SaveComponent':\n\t\t\t\t\twriter.writeInt32(SaveComponent.TypeID);\n\t\t\t\t\tSaveComponent.SerializeHeader(writer, obj);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new UnimplementedError(`Unknown object type ${(obj as unknown as any).type}. Not implemented.`);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n}"]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ContextReader } from '../../context/context-reader';
|
|
2
|
+
import { ContextWriter } from '../../context/context-writer';
|
|
3
|
+
import { SaveComponent } from "../types/objects/SaveComponent";
|
|
4
|
+
import { SaveEntity } from "../types/objects/SaveEntity";
|
|
5
|
+
import { SaveObject } from "../types/objects/SaveObject";
|
|
6
|
+
import { ObjectReference } from "../types/structs/ObjectReference";
|
|
7
|
+
import { LevelToDestroyedActorsMap } from './level-to-destroyed-actors-map';
|
|
8
|
+
import { SaveReader } from './save-reader';
|
|
9
|
+
export type Level = {
|
|
10
|
+
name: string;
|
|
11
|
+
objects: (SaveEntity | SaveComponent)[];
|
|
12
|
+
collectables: ObjectReference[];
|
|
13
|
+
saveCustomVersion?: number;
|
|
14
|
+
destroyedActorsMap?: LevelToDestroyedActorsMap;
|
|
15
|
+
};
|
|
16
|
+
export type Levels = {
|
|
17
|
+
[levelName: string]: Level;
|
|
18
|
+
};
|
|
19
|
+
export declare namespace Level {
|
|
20
|
+
const ReadLevel: (reader: SaveReader, levelName: string) => Level;
|
|
21
|
+
const SerializeLevel: (writer: ContextWriter, level: Level) => void;
|
|
22
|
+
const ReadAllObjectContents: (levelName: string, reader: ContextReader, objectsList: SaveObject[], onProgressCallback: (progress: number, msg?: string) => void) => void;
|
|
23
|
+
const ReadNObjectContents: (reader: ContextReader, count: number, objects: SaveObject[], objectListOffset?: number) => void;
|
|
24
|
+
const SerializeAllObjectContents: (writer: ContextWriter, objects: (SaveEntity | SaveComponent)[], levelName: string) => void;
|
|
25
|
+
const ReadAllObjectHeaders: (reader: ContextReader, objectsList: SaveObject[]) => void;
|
|
26
|
+
const ReadNObjectHeaders: (reader: ContextReader, count: number) => (SaveEntity | SaveComponent)[];
|
|
27
|
+
const SerializeAllObjectHeaders: (writer: ContextWriter, objects: (SaveEntity | SaveComponent)[]) => void;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=level.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"level.d.ts","sourceRoot":"","sources":["../../../../src/parser/satisfactory/save/level.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,OAAO,EAAE,aAAa,EAAmB,MAAM,gCAAgC,CAAC;AAChF,OAAO,EA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G,aAAa,CAAC,EAsBrG,CAAA;IAEM,MAAM,yBAAyB,WAAY,aAAa,WAAW,CAAC,UAAU,GAAG,aAAa,CAAC,EAAE,KAAG,IAkB1G,CAAA;CACD"}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Level = void 0;
|
|
4
|
+
const parser_error_1 = require("../../error/parser.error");
|
|
5
|
+
const SaveComponent_1 = require("../types/objects/SaveComponent");
|
|
6
|
+
const SaveEntity_1 = require("../types/objects/SaveEntity");
|
|
7
|
+
const level_to_destroyed_actors_map_1 = require("./level-to-destroyed-actors-map");
|
|
8
|
+
const object_references_list_1 = require("./object-references-list");
|
|
9
|
+
const save_custom_version_1 = require("./save-custom-version");
|
|
10
|
+
var Level;
|
|
11
|
+
(function (Level) {
|
|
12
|
+
Level.ReadLevel = (reader, levelName) => {
|
|
13
|
+
const level = {
|
|
14
|
+
name: levelName,
|
|
15
|
+
objects: [],
|
|
16
|
+
collectables: []
|
|
17
|
+
};
|
|
18
|
+
const headersBinLen = reader.readInt32();
|
|
19
|
+
if (reader.context.saveVersion >= save_custom_version_1.SaveCustomVersion.UnrealEngine5) {
|
|
20
|
+
reader.readInt32Zero();
|
|
21
|
+
}
|
|
22
|
+
const posBeforeHeaders = reader.getBufferPosition();
|
|
23
|
+
Level.ReadAllObjectHeaders(reader, level.objects);
|
|
24
|
+
let remainingSize = headersBinLen - (reader.getBufferPosition() - posBeforeHeaders);
|
|
25
|
+
if (remainingSize > 0) {
|
|
26
|
+
if (levelName === reader.context.mapName) {
|
|
27
|
+
level.destroyedActorsMap = level_to_destroyed_actors_map_1.LevelToDestroyedActorsMap.read(reader);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
level.collectables = object_references_list_1.ObjectReferencesList.ReadList(reader);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
}
|
|
35
|
+
remainingSize = headersBinLen - (reader.getBufferPosition() - posBeforeHeaders);
|
|
36
|
+
if (remainingSize !== 0) {
|
|
37
|
+
console.warn(`remaining size ${remainingSize} not 0 in level ${levelName}. Save may be corrupt.`);
|
|
38
|
+
}
|
|
39
|
+
const objectContentsBinLen = reader.readInt32();
|
|
40
|
+
if (reader.context.saveVersion >= save_custom_version_1.SaveCustomVersion.UnrealEngine5) {
|
|
41
|
+
reader.readInt32Zero();
|
|
42
|
+
}
|
|
43
|
+
const posBeforeContents = reader.getBufferPosition();
|
|
44
|
+
Level.ReadAllObjectContents(levelName, reader, level.objects, reader.onProgressCallback);
|
|
45
|
+
const posAfterContents = reader.getBufferPosition();
|
|
46
|
+
if (posAfterContents - posBeforeContents !== objectContentsBinLen) {
|
|
47
|
+
console.warn('save seems corrupt.', level.name);
|
|
48
|
+
}
|
|
49
|
+
if (levelName !== reader.context.mapName) {
|
|
50
|
+
if (reader.context.saveVersion >= save_custom_version_1.SaveCustomVersion.SerializePerStreamableLevelTOCVersion) {
|
|
51
|
+
level.saveCustomVersion = reader.readInt32();
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
if (levelName === reader.context.mapName) {
|
|
55
|
+
level.destroyedActorsMap = level_to_destroyed_actors_map_1.LevelToDestroyedActorsMap.read(reader);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
level.collectables = object_references_list_1.ObjectReferencesList.ReadList(reader);
|
|
59
|
+
}
|
|
60
|
+
return level;
|
|
61
|
+
};
|
|
62
|
+
Level.SerializeLevel = (writer, level) => {
|
|
63
|
+
const lenIndicatorHeaderAndDestroyedEntitiesSize = writer.getBufferPosition();
|
|
64
|
+
writer.writeInt32(0);
|
|
65
|
+
if (writer.context.saveVersion >= save_custom_version_1.SaveCustomVersion.UnrealEngine5) {
|
|
66
|
+
writer.writeInt32Zero();
|
|
67
|
+
}
|
|
68
|
+
Level.SerializeAllObjectHeaders(writer, level.objects);
|
|
69
|
+
if (level.name === writer.context.mapName && level.destroyedActorsMap !== undefined && Object.keys(level.destroyedActorsMap).length > 0) {
|
|
70
|
+
level_to_destroyed_actors_map_1.LevelToDestroyedActorsMap.write(writer, level.destroyedActorsMap);
|
|
71
|
+
}
|
|
72
|
+
else if (level.name !== writer.context.mapName && level.collectables.length > 0) {
|
|
73
|
+
object_references_list_1.ObjectReferencesList.SerializeList(writer, level.collectables);
|
|
74
|
+
}
|
|
75
|
+
writer.writeBinarySizeFromPosition(lenIndicatorHeaderAndDestroyedEntitiesSize, lenIndicatorHeaderAndDestroyedEntitiesSize + 8);
|
|
76
|
+
Level.SerializeAllObjectContents(writer, level.objects, level.name);
|
|
77
|
+
if (level.name !== writer.context.mapName) {
|
|
78
|
+
if (writer.context.saveVersion >= save_custom_version_1.SaveCustomVersion.SerializePerStreamableLevelTOCVersion) {
|
|
79
|
+
writer.writeInt32(level.saveCustomVersion ?? save_custom_version_1.SaveCustomVersion.SerializePerStreamableLevelTOCVersion);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (level.name === writer.context.mapName) {
|
|
83
|
+
level_to_destroyed_actors_map_1.LevelToDestroyedActorsMap.write(writer, level.destroyedActorsMap ?? {});
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
object_references_list_1.ObjectReferencesList.SerializeList(writer, level.collectables);
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
Level.ReadAllObjectContents = (levelName, reader, objectsList, onProgressCallback) => {
|
|
90
|
+
const countEntities = reader.readInt32();
|
|
91
|
+
if (countEntities !== objectsList.length) {
|
|
92
|
+
throw new Error(`possibly corrupt. entity count ${countEntities} does not equal object count of ${objectsList.length}`);
|
|
93
|
+
}
|
|
94
|
+
const batchSize = 10000;
|
|
95
|
+
let readObjectsCount = 0;
|
|
96
|
+
let lastProgressReport = 0;
|
|
97
|
+
while (readObjectsCount < countEntities) {
|
|
98
|
+
Level.ReadNObjectContents(reader, Math.min(batchSize, countEntities - readObjectsCount), objectsList, readObjectsCount);
|
|
99
|
+
readObjectsCount += Math.min(batchSize, countEntities - readObjectsCount);
|
|
100
|
+
if (readObjectsCount - lastProgressReport > batchSize) {
|
|
101
|
+
onProgressCallback(reader.getBufferProgress(), `read object count [${(readObjectsCount)}/${(countEntities)}] in level ${levelName}`);
|
|
102
|
+
lastProgressReport = readObjectsCount;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
Level.ReadNObjectContents = (reader, count, objects, objectListOffset = 0) => {
|
|
107
|
+
for (let i = 0; i < count; i++) {
|
|
108
|
+
if (reader.context.saveVersion >= save_custom_version_1.SaveCustomVersion.IntroducedWorldPartition) {
|
|
109
|
+
objects[i + objectListOffset].saveCustomVersion = reader.readInt32();
|
|
110
|
+
}
|
|
111
|
+
if (reader.context.saveVersion >= save_custom_version_1.SaveCustomVersion.IntroducedWorldPartition) {
|
|
112
|
+
objects[i + objectListOffset].shouldMigrateObjectRefsToPersistent = reader.readInt32() >= 1;
|
|
113
|
+
}
|
|
114
|
+
const binarySize = reader.readInt32();
|
|
115
|
+
const before = reader.getBufferPosition();
|
|
116
|
+
if ((0, SaveEntity_1.isSaveEntity)(objects[i + objectListOffset])) {
|
|
117
|
+
SaveEntity_1.SaveEntity.ParseData(objects[i + objectListOffset], binarySize, reader, objects[i + objectListOffset].typePath);
|
|
118
|
+
}
|
|
119
|
+
else if ((0, SaveComponent_1.isSaveComponent)(objects[i + objectListOffset])) {
|
|
120
|
+
SaveComponent_1.SaveComponent.ParseData(objects[i + objectListOffset], binarySize, reader, objects[i + objectListOffset].typePath);
|
|
121
|
+
}
|
|
122
|
+
const after = reader.getBufferPosition();
|
|
123
|
+
if (after - before !== binarySize) {
|
|
124
|
+
throw new parser_error_1.CorruptSaveError(`Could not read entity ${objects[i + objectListOffset].instanceName}, as ${after - before} bytes were read, but ${binarySize} bytes were indicated.`);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
Level.SerializeAllObjectContents = (writer, objects, levelName) => {
|
|
129
|
+
const lenIndicatorEntities = writer.getBufferPosition();
|
|
130
|
+
writer.writeInt32(0);
|
|
131
|
+
if (writer.context.saveVersion >= save_custom_version_1.SaveCustomVersion.UnrealEngine5) {
|
|
132
|
+
writer.writeInt32Zero();
|
|
133
|
+
}
|
|
134
|
+
writer.writeInt32(objects.length);
|
|
135
|
+
for (const obj of objects) {
|
|
136
|
+
if (writer.context.saveVersion >= save_custom_version_1.SaveCustomVersion.IntroducedWorldPartition) {
|
|
137
|
+
writer.writeInt32(obj.saveCustomVersion);
|
|
138
|
+
}
|
|
139
|
+
if (writer.context.saveVersion >= save_custom_version_1.SaveCustomVersion.IntroducedWorldPartition) {
|
|
140
|
+
writer.writeInt32(obj.shouldMigrateObjectRefsToPersistent ? 1 : 0);
|
|
141
|
+
}
|
|
142
|
+
const lenReplacementPosition = writer.getBufferPosition();
|
|
143
|
+
writer.writeInt32(0);
|
|
144
|
+
if ((0, SaveEntity_1.isSaveEntity)(obj)) {
|
|
145
|
+
SaveEntity_1.SaveEntity.SerializeData(writer, obj);
|
|
146
|
+
}
|
|
147
|
+
else if ((0, SaveComponent_1.isSaveComponent)(obj)) {
|
|
148
|
+
SaveComponent_1.SaveComponent.SerializeData(writer, obj);
|
|
149
|
+
}
|
|
150
|
+
writer.writeBinarySizeFromPosition(lenReplacementPosition, lenReplacementPosition + 4);
|
|
151
|
+
}
|
|
152
|
+
writer.writeBinarySizeFromPosition(lenIndicatorEntities, lenIndicatorEntities + 8);
|
|
153
|
+
};
|
|
154
|
+
Level.ReadAllObjectHeaders = (reader, objectsList) => {
|
|
155
|
+
let countObjectHeaders = reader.readInt32();
|
|
156
|
+
const batchSize = 10000;
|
|
157
|
+
let readObjectHeadersCount = 0;
|
|
158
|
+
while (readObjectHeadersCount < countObjectHeaders) {
|
|
159
|
+
objectsList.push(...Level.ReadNObjectHeaders(reader, Math.min(batchSize, countObjectHeaders - readObjectHeadersCount)));
|
|
160
|
+
readObjectHeadersCount += Math.min(batchSize, countObjectHeaders - readObjectHeadersCount);
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
Level.ReadNObjectHeaders = (reader, count) => {
|
|
164
|
+
let objects = [];
|
|
165
|
+
let objectsRead = 0;
|
|
166
|
+
for (; objectsRead < count; objectsRead++) {
|
|
167
|
+
let obj;
|
|
168
|
+
let objectType = reader.readInt32();
|
|
169
|
+
switch (objectType) {
|
|
170
|
+
case SaveEntity_1.SaveEntity.TypeID:
|
|
171
|
+
obj = new SaveEntity_1.SaveEntity('', '', '', '');
|
|
172
|
+
SaveEntity_1.SaveEntity.ParseHeader(reader, obj);
|
|
173
|
+
break;
|
|
174
|
+
case SaveComponent_1.SaveComponent.TypeID:
|
|
175
|
+
obj = new SaveComponent_1.SaveComponent('', '', '', '');
|
|
176
|
+
SaveComponent_1.SaveComponent.ParseHeader(reader, obj);
|
|
177
|
+
break;
|
|
178
|
+
default:
|
|
179
|
+
throw new parser_error_1.CorruptSaveError('Unknown object type' + objectType);
|
|
180
|
+
}
|
|
181
|
+
objects.push(obj);
|
|
182
|
+
}
|
|
183
|
+
return objects;
|
|
184
|
+
};
|
|
185
|
+
Level.SerializeAllObjectHeaders = (writer, objects) => {
|
|
186
|
+
writer.writeInt32(objects.length);
|
|
187
|
+
for (const obj of objects) {
|
|
188
|
+
switch (obj.type) {
|
|
189
|
+
case 'SaveEntity':
|
|
190
|
+
writer.writeInt32(SaveEntity_1.SaveEntity.TypeID);
|
|
191
|
+
SaveEntity_1.SaveEntity.SerializeHeader(writer, obj);
|
|
192
|
+
break;
|
|
193
|
+
case 'SaveComponent':
|
|
194
|
+
writer.writeInt32(SaveComponent_1.SaveComponent.TypeID);
|
|
195
|
+
SaveComponent_1.SaveComponent.SerializeHeader(writer, obj);
|
|
196
|
+
break;
|
|
197
|
+
default:
|
|
198
|
+
throw new parser_error_1.UnimplementedError(`Unknown object type ${obj.type}. Not implemented.`);
|
|
199
|
+
break;
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
};
|
|
203
|
+
})(Level || (exports.Level = Level = {}));
|
|
204
|
+
//# sourceMappingURL=level.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"level.js","sourceRoot":"","sources":["../../../../src/parser/satisfactory/save/level.ts"],"names":[],"mappings":";;;AAGA,2DAAgF;AAChF,kEAAgF;AAChF,4DAAuE;AAGvE,mFAA4E;AAC5E,qEAAgE;AAChE,+DAA0D;AAgB1D,IAAiB,KAAK,CAsPrB;AAtPD,WAAiB,KAAK;IAER,eAAS,GAAG,CAAC,MAAkB,EAAE,SAAiB,EAAS,EAAE;QACzE,MAAM,KAAK,GAAU;YACpB,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,EAAE;YACX,YAAY,EAAE,EAAE;SAChB,CAAA;QAGD,MAAM,aAAa,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC;QACzC,IAAI,MAAM,CAAC,OAAO,CAAC,WAAW,IAAI,uCAAiB,CAAC,aAAa,EAAE,CAAC;YACnE,MAAM,CAAC,aAAa,EAAE,CAAC;QACxB,CAAC;QAGD,MAAM,gBAAgB,GAAG,MAAM,CAAC,iBAAiB,EAAE,CAAC;QACpD,MAAA,oBAAoB,CAAC,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QAG5C,IAAI,aAAa,GAAG,aAAa,GAAG,CAAC,MAAM,CAAC,iBAAiB,EAAE,GAAG,gBAAgB,CAAC,CAAC;QACpF,IAAI,aAAa,GAAG,CAAC,EAAE,CAAC;YAEvB,IAAI,SAAS,KAAK,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC;gBAC1C,KAAK,CAAC,kBAAkB,GAAG,yDAAyB,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACnE,CAAC;iBAAM,CAAC;gBACP,KAAK,CAAC,YAAY,GAAG,6CAAoB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;YAC5D,CAAC;QAEF,CAAC;aAAM,CAAC;QAER,CAAC;QA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AAC,eAAe,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;oBAC3C,MAAM;gBACP;oBACC,MAAM,IAAI,iCAAkB,CAAC,uBAAwB,GAAsB,CAAC,IAAI,oBAAoB,CAAC,CAAC;oBACtG,MAAM;YACR,CAAC;QACF,CAAC;IACF,CAAC,CAAA;AACF,CAAC,EAtPgB,KAAK,qBAAL,KAAK,QAsPrB","sourcesContent":["\nimport { ContextReader } from '../../context/context-reader';\nimport { ContextWriter } from '../../context/context-writer';\nimport { CorruptSaveError, UnimplementedError } from '../../error/parser.error';\nimport { SaveComponent, isSaveComponent } from \"../types/objects/SaveComponent\";\nimport { SaveEntity, isSaveEntity } from \"../types/objects/SaveEntity\";\nimport { SaveObject } from \"../types/objects/SaveObject\";\nimport { ObjectReference } from \"../types/structs/ObjectReference\";\nimport { LevelToDestroyedActorsMap } from './level-to-destroyed-actors-map';\nimport { ObjectReferencesList } from './object-references-list';\nimport { SaveCustomVersion } from './save-custom-version';\nimport { SaveReader } from './save-reader';\n\n/**\n * type for levels\n * @param fiftyOne Use unclear. Added in Update 1.1\n */\nexport type Level = {\n\tname: string;\n\tobjects: (SaveEntity | SaveComponent)[];\n\tcollectables: ObjectReference[];\n\tsaveCustomVersion?: number;\n\tdestroyedActorsMap?: LevelToDestroyedActorsMap\n}\nexport type Levels = { [levelName: string]: Level };\n\nexport namespace Level {\n\n\texport const ReadLevel = (reader: SaveReader, levelName: string): Level => {\n\t\tconst level: Level = {\n\t\t\tname: levelName,\n\t\t\tobjects: [],\n\t\t\tcollectables: []\n\t\t}\n\n\t\t// checksum object headers.\n\t\tconst headersBinLen = reader.readInt32(); // object headers + binary length\n\t\tif (reader.context.saveVersion >= SaveCustomVersion.UnrealEngine5) {\n\t\t\treader.readInt32Zero();\n\t\t}\n\n\t\t// object headers\n\t\tconst posBeforeHeaders = reader.getBufferPosition();\n\t\tReadAllObjectHeaders(reader, level.objects);\n\n\t\t// for persistent level, we have LevelToDestroyedActorsMap, else collectibles. Only listed here since U8.\n\t\tlet remainingSize = headersBinLen - (reader.getBufferPosition() - posBeforeHeaders);\n\t\tif (remainingSize > 0) {\n\n\t\t\tif (levelName === reader.context.mapName) {\n\t\t\t\tlevel.destroyedActorsMap = LevelToDestroyedActorsMap.read(reader);\n\t\t\t} else {\n\t\t\t\tlevel.collectables = ObjectReferencesList.ReadList(reader);\n\t\t\t}\n\n\t\t} else {\n\t\t\t// its perfectly possible for ported saves to have nothing here.\n\t\t}\n\n\n\t\tremainingSize = headersBinLen - (reader.getBufferPosition() - posBeforeHeaders);\n\t\tif (remainingSize !== 0) {\n\t\t\tconsole.warn(`remaining size ${remainingSize} not 0 in level ${levelName}. Save may be corrupt.`);\n\t\t}\n\n\t\t// checksum for object content size\n\t\tconst objectContentsBinLen = reader.readInt32();\n\t\tif (reader.context.saveVersion >= SaveCustomVersion.UnrealEngine5) {\n\t\t\treader.readInt32Zero();\n\t\t}\n\n\t\t// objects contents\n\t\tconst posBeforeContents = reader.getBufferPosition();\n\t\tReadAllObjectContents(levelName, reader, level.objects, reader.onProgressCallback);\n\t\tconst posAfterContents = reader.getBufferPosition();\n\t\tif (posAfterContents - posBeforeContents !== objectContentsBinLen) {\n\t\t\t//WARNING\n\t\t\tconsole.warn('save seems corrupt.', level.name);\n\t\t}\n\n\n\t\t// only NOT in the persistent level, we have saveVersion\n\t\tif (levelName !== reader.context.mapName) {\n\t\t\tif (reader.context.saveVersion >= SaveCustomVersion.SerializePerStreamableLevelTOCVersion) {\n\t\t\t\tlevel.saveCustomVersion = reader.readInt32();\n\t\t\t}\n\t\t}\n\n\t\t// 2nd time.\n\t\t// for persistent level, we have LevelToDestroyedActorsMap, else collectibles\n\t\t// Listed here since < U8 and in U8 as well. So this is the best list you can rely on.\n\t\tif (levelName === reader.context.mapName) {\n\t\t\tlevel.destroyedActorsMap = LevelToDestroyedActorsMap.read(reader);\n\t\t} else {\n\t\t\tlevel.collectables = ObjectReferencesList.ReadList(reader);\n\t\t}\n\n\t\treturn level;\n\t}\n\n\texport const SerializeLevel = (writer: ContextWriter, level: Level): void => {\n\t\tconst lenIndicatorHeaderAndDestroyedEntitiesSize = writer.getBufferPosition();\n\t\twriter.writeInt32(0);\t// len indicator\n\n\t\tif (writer.context.saveVersion >= SaveCustomVersion.UnrealEngine5) {\n\t\t\twriter.writeInt32Zero();\n\t\t}\n\n\t\tSerializeAllObjectHeaders(writer, level.objects);\n\n\t\t// <--- destroyed actors is the same as collectables list. Seems like its not there if count 0.\n\t\tif (level.name === writer.context.mapName && level.destroyedActorsMap !== undefined && Object.keys(level.destroyedActorsMap).length > 0) {\n\t\t\tLevelToDestroyedActorsMap.write(writer, level.destroyedActorsMap);\n\t\t} else if (level.name !== writer.context.mapName && level.collectables.length > 0) {\n\t\t\tObjectReferencesList.SerializeList(writer, level.collectables);\n\t\t}\n\n\t\t// replace binary size from earlier for - object headers + collectables\n\t\twriter.writeBinarySizeFromPosition(lenIndicatorHeaderAndDestroyedEntitiesSize, lenIndicatorHeaderAndDestroyedEntitiesSize + 8);\n\n\t\t// write entities\n\t\tSerializeAllObjectContents(writer, level.objects, level.name);\n\n\n\t\t// only NOT in the persistent level, we have saveVersion\n\t\tif (level.name !== writer.context.mapName) {\n\t\t\tif (writer.context.saveVersion >= SaveCustomVersion.SerializePerStreamableLevelTOCVersion) {\n\t\t\t\twriter.writeInt32(level.saveCustomVersion ?? SaveCustomVersion.SerializePerStreamableLevelTOCVersion);\n\t\t\t}\n\t\t}\n\n\t\t// 2nd time.\n\t\t// for persistent level, we have LevelToDestroyedActorsMap, else collectibles\n\t\tif (level.name === writer.context.mapName) {\n\t\t\tLevelToDestroyedActorsMap.write(writer, level.destroyedActorsMap ?? {});\n\t\t} else {\n\t\t\tObjectReferencesList.SerializeList(writer, level.collectables);\n\t\t}\n\t}\n\n\texport const ReadAllObjectContents = (levelName: string, reader: ContextReader, objectsList: SaveObject[], onProgressCallback: (progress: number, msg?: string) => void): void => {\n\t\tconst countEntities = reader.readInt32();\n\t\tif (countEntities !== objectsList.length) {\n\t\t\tthrow new Error(`possibly corrupt. entity count ${countEntities} does not equal object count of ${objectsList.length}`);\n\t\t}\n\n\t\t// read in batches\n\t\tconst batchSize = 10000;\n\t\tlet readObjectsCount = 0;\n\t\tlet lastProgressReport = 0;\n\t\twhile (readObjectsCount < countEntities) {\n\t\t\tReadNObjectContents(reader, Math.min(batchSize, countEntities - readObjectsCount), objectsList, readObjectsCount);\n\t\t\treadObjectsCount += Math.min(batchSize, countEntities - readObjectsCount);\n\n\t\t\tif (readObjectsCount - lastProgressReport > batchSize) {\n\t\t\t\tonProgressCallback(reader.getBufferProgress(), `read object count [${(readObjectsCount)}/${(countEntities)}] in level ${levelName}`);\n\t\t\t\tlastProgressReport = readObjectsCount;\n\t\t\t}\n\t\t}\n\t}\n\n\texport const ReadNObjectContents = (reader: ContextReader, count: number, objects: SaveObject[], objectListOffset: number = 0): void => {\n\t\tfor (let i = 0; i < count; i++) {\n\t\t\tif (reader.context.saveVersion >= SaveCustomVersion.IntroducedWorldPartition) {\n\t\t\t\tobjects[i + objectListOffset].saveCustomVersion = reader.readInt32();\n\t\t\t}\n\t\t\tif (reader.context.saveVersion >= SaveCustomVersion.IntroducedWorldPartition) {\n\t\t\t\tobjects[i + objectListOffset].shouldMigrateObjectRefsToPersistent = reader.readInt32() >= 1;\n\t\t\t}\n\n\t\t\tconst binarySize = reader.readInt32();\n\n\t\t\tconst before = reader.getBufferPosition();\n\t\t\tif (isSaveEntity(objects[i + objectListOffset])) {\n\t\t\t\tSaveEntity.ParseData(objects[i + objectListOffset] as SaveEntity, binarySize, reader, objects[i + objectListOffset].typePath);\n\t\t\t} else if (isSaveComponent(objects[i + objectListOffset])) {\n\t\t\t\tSaveComponent.ParseData(objects[i + objectListOffset] as SaveComponent, binarySize, reader, objects[i + objectListOffset].typePath);\n\t\t\t}\n\n\t\t\tconst after = reader.getBufferPosition();\n\t\t\tif (after - before !== binarySize) {\n\t\t\t\tthrow new CorruptSaveError(`Could not read entity ${objects[i + objectListOffset].instanceName}, as ${after - before} bytes were read, but ${binarySize} bytes were indicated.`);\n\t\t\t}\n\t\t}\n\t}\n\n\texport const SerializeAllObjectContents = (writer: ContextWriter, objects: (SaveEntity | SaveComponent)[], levelName: string): void => {\n\t\tconst lenIndicatorEntities = writer.getBufferPosition();\n\t\twriter.writeInt32(0);\n\n\t\tif (writer.context.saveVersion >= SaveCustomVersion.UnrealEngine5) {\n\t\t\twriter.writeInt32Zero();\n\t\t}\n\n\t\twriter.writeInt32(objects.length);\n\t\tfor (const obj of objects) {\n\n\t\t\tif (writer.context.saveVersion >= SaveCustomVersion.IntroducedWorldPartition) {\n\t\t\t\twriter.writeInt32(obj.saveCustomVersion);\n\t\t\t}\n\t\t\tif (writer.context.saveVersion >= SaveCustomVersion.IntroducedWorldPartition) {\n\t\t\t\twriter.writeInt32(obj.shouldMigrateObjectRefsToPersistent ? 1 : 0);\n\t\t\t}\n\t\t\tconst lenReplacementPosition = writer.getBufferPosition();\n\t\t\twriter.writeInt32(0);\n\n\t\t\tif (isSaveEntity(obj)) {\n\t\t\t\tSaveEntity.SerializeData(writer, obj);\n\t\t\t} else if (isSaveComponent(obj)) {\n\t\t\t\tSaveComponent.SerializeData(writer, obj);\n\t\t\t}\n\n\t\t\twriter.writeBinarySizeFromPosition(lenReplacementPosition, lenReplacementPosition + 4);\n\t\t}\n\t\twriter.writeBinarySizeFromPosition(lenIndicatorEntities, lenIndicatorEntities + 8);\n\t}\n\n\texport const ReadAllObjectHeaders = (reader: ContextReader, objectsList: SaveObject[]): void => {\n\t\tlet countObjectHeaders = reader.readInt32();\n\n\t\t// read in batches\n\t\tconst batchSize = 10000;\n\t\tlet readObjectHeadersCount = 0;\n\t\twhile (readObjectHeadersCount < countObjectHeaders) {\n\t\t\tobjectsList.push(...ReadNObjectHeaders(reader, Math.min(batchSize, countObjectHeaders - readObjectHeadersCount)));\n\t\t\treadObjectHeadersCount += Math.min(batchSize, countObjectHeaders - readObjectHeadersCount);\n\t\t}\n\t}\n\n\texport const ReadNObjectHeaders = (reader: ContextReader, count: number): (SaveEntity | SaveComponent)[] => {\n\t\tlet objects: (SaveEntity | SaveComponent)[] = [];\n\t\tlet objectsRead = 0;\n\t\tfor (; objectsRead < count; objectsRead++) {\n\n\t\t\tlet obj: SaveEntity | SaveComponent;\n\t\t\tlet objectType = reader.readInt32();\n\t\t\tswitch (objectType) {\n\t\t\t\tcase SaveEntity.TypeID:\n\t\t\t\t\tobj = new SaveEntity('', '', '', '');\n\t\t\t\t\tSaveEntity.ParseHeader(reader, obj);\n\t\t\t\t\tbreak;\n\t\t\t\tcase SaveComponent.TypeID:\n\t\t\t\t\tobj = new SaveComponent('', '', '', '');\n\t\t\t\t\tSaveComponent.ParseHeader(reader, obj);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new CorruptSaveError('Unknown object type' + objectType);\n\t\t\t}\n\t\t\tobjects.push(obj);\n\t\t}\n\t\treturn objects;\n\t}\n\n\texport const SerializeAllObjectHeaders = (writer: ContextWriter, objects: (SaveEntity | SaveComponent)[]): void => {\n\t\twriter.writeInt32(objects.length);\n\t\tfor (const obj of objects) {\n\n\t\t\tswitch (obj.type) {\n\t\t\t\tcase 'SaveEntity':\n\t\t\t\t\twriter.writeInt32(SaveEntity.TypeID);\n\t\t\t\t\tSaveEntity.SerializeHeader(writer, obj);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'SaveComponent':\n\t\t\t\t\twriter.writeInt32(SaveComponent.TypeID);\n\t\t\t\t\tSaveComponent.SerializeHeader(writer, obj);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new UnimplementedError(`Unknown object type ${(obj as unknown as any).type}. Not implemented.`);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n}"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"satisfactory-save-header.d.ts","sourceRoot":"","sources":["../../../../src/parser/satisfactory/save/satisfactory-save-header.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAGnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAGvD,MAAM,MAAM,sBAAsB,GAAG;IACjC,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,WAAW,CAAC,EAAE,uBAAuB,CAAC;IACtC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACjC,CAAA;AAED,yBAAiB,sBAAsB,CAAC;IAC7B,MAAM,KAAK,WAAY,aAAa,KAAG,sBA2E7C,CAAA;IAEM,MAAM,SAAS,WAAY,aAAa,UAAU,sBAAsB,
|
|
1
|
+
{"version":3,"file":"satisfactory-save-header.d.ts","sourceRoot":"","sources":["../../../../src/parser/satisfactory/save/satisfactory-save-header.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,OAAO,EAAE,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAGnD,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAGvD,MAAM,MAAM,sBAAsB,GAAG;IACjC,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,WAAW,CAAC,EAAE,uBAAuB,CAAC;IACtC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,mBAAmB,CAAC,EAAE,OAAO,CAAC;CACjC,CAAA;AAED,yBAAiB,sBAAsB,CAAC;IAC7B,MAAM,KAAK,WAAY,aAAa,KAAG,sBA2E7C,CAAA;IAEM,MAAM,SAAS,WAAY,aAAa,UAAU,sBAAsB,KAAG,IAiDjF,CAAA;CACJ"}
|