@etothepii/satisfactory-file-parser 3.1.2 → 3.2.2
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/tests.yml +1 -1
- package/CHANGELOG.md +18 -0
- package/GUIDE.md +7 -1
- package/README.md +4 -0
- package/build/index.d.ts +1 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +1 -0
- package/build/index.js.map +1 -1
- package/build/parser/context/context.d.ts +1 -0
- package/build/parser/context/context.d.ts.map +1 -1
- package/build/parser/context/context.js.map +1 -1
- package/build/parser/parser.d.ts.map +1 -1
- package/build/parser/parser.js +4 -4
- package/build/parser/parser.js.map +1 -1
- package/build/parser/satisfactory/save/satisfactory-save-header.d.ts.map +1 -1
- package/build/parser/satisfactory/save/satisfactory-save-header.js +4 -3
- package/build/parser/satisfactory/save/satisfactory-save-header.js.map +1 -1
- package/build/parser/satisfactory/save/satisfactory-save.d.ts +2 -3
- package/build/parser/satisfactory/save/satisfactory-save.d.ts.map +1 -1
- package/build/parser/satisfactory/save/satisfactory-save.js +1 -2
- package/build/parser/satisfactory/save/satisfactory-save.js.map +1 -1
- package/build/parser/satisfactory/save/save-reader.d.ts +0 -17
- package/build/parser/satisfactory/save/save-reader.d.ts.map +1 -1
- package/build/parser/satisfactory/save/save-reader.js +1 -37
- package/build/parser/satisfactory/save/save-reader.js.map +1 -1
- package/build/parser/satisfactory/save/save-writer.d.ts +0 -3
- package/build/parser/satisfactory/save/save-writer.d.ts.map +1 -1
- package/build/parser/satisfactory/save/save-writer.js +0 -22
- package/build/parser/satisfactory/save/save-writer.js.map +1 -1
- package/build/parser/satisfactory/types/property/PropertiesList.js +1 -1
- package/build/parser/satisfactory/types/property/PropertiesList.js.map +1 -1
- package/build/parser/satisfactory/types/property/generic/MapProperty.d.ts +3 -3
- package/build/parser/satisfactory/types/property/generic/MapProperty.d.ts.map +1 -1
- package/build/parser/satisfactory/types/property/generic/MapProperty.js +12 -2
- package/build/parser/satisfactory/types/property/generic/MapProperty.js.map +1 -1
- package/build/parser/satisfactory/types/structs/SaveBodyValidation.d.ts +19 -0
- package/build/parser/satisfactory/types/structs/SaveBodyValidation.d.ts.map +1 -0
- package/build/parser/satisfactory/types/structs/SaveBodyValidation.js +41 -0
- package/build/parser/satisfactory/types/structs/SaveBodyValidation.js.map +1 -0
- package/build/parser/stream/reworked/readable-stream-parser.d.ts +1 -1
- package/build/parser/stream/reworked/readable-stream-parser.d.ts.map +1 -1
- package/build/parser/stream/reworked/readable-stream-parser.js +6 -7
- 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 +1 -2
- package/build/parser/stream/reworked/save-stream-json-stringifier.js.map +1 -1
- package/build/parser/stream/reworked/save-stream-writer.class.d.ts +2 -3
- package/build/parser/stream/reworked/save-stream-writer.class.d.ts.map +1 -1
- package/build/parser/stream/reworked/save-stream-writer.class.js +4 -7
- package/build/parser/stream/reworked/save-stream-writer.class.js.map +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 +5 -6
- package/docs/classes/SaveStreamJsonStringifier.html +2 -2
- package/docs/classes/SaveStreamWriter.html +2 -2
- package/docs/classes/SaveWriter.html +5 -6
- 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/BlueprintHeaderVersion.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 -1
- package/docs/functions/LevelToDestroyedActorsMap.write.html +1 -1
- 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 +2 -1
- 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 +1 -1
- 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/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 +1 -1
- package/docs/types/LevelToDestroyedActorsMap-1.html +1 -1
- 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 +5 -5
- package/package.json +1 -2
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { WritableStreamDefaultWriter } from "stream/web";
|
|
2
2
|
import { SatisfactorySaveHeader } from '../../satisfactory/save/satisfactory-save-header';
|
|
3
3
|
import { ChunkCompressionInfo } from "../../satisfactory/save/save-body-chunks";
|
|
4
|
-
import { Grids, SaveBodyValidation } from '../../satisfactory/save/save-reader';
|
|
5
4
|
import { SaveObject } from "../../satisfactory/types/objects/SaveObject";
|
|
6
5
|
import { ObjectReference } from '../../satisfactory/types/structs/ObjectReference';
|
|
6
|
+
import { SaveBodyValidation } from "../../satisfactory/types/structs/SaveBodyValidation";
|
|
7
7
|
export declare class SaveStreamWriter {
|
|
8
8
|
private writer;
|
|
9
9
|
private mode;
|
|
@@ -14,8 +14,7 @@ export declare class SaveStreamWriter {
|
|
|
14
14
|
beginSave: () => Promise<void>;
|
|
15
15
|
writeHeader: (header: SatisfactorySaveHeader) => Promise<void>;
|
|
16
16
|
writeCompressionInfo: (compressionInfo: ChunkCompressionInfo) => Promise<void>;
|
|
17
|
-
|
|
18
|
-
writeGrids: (grids: Grids) => Promise<void>;
|
|
17
|
+
writeSaveBodyValidation: (saveBodyValidation: SaveBodyValidation) => Promise<void>;
|
|
19
18
|
openLevels: () => Promise<void>;
|
|
20
19
|
openLevel: (levelName: string) => Promise<void>;
|
|
21
20
|
writeObjects: (...objects: SaveObject[]) => Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"save-stream-writer.class.d.ts","sourceRoot":"","sources":["../../../../src/parser/stream/reworked/save-stream-writer.class.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AACzD,OAAO,EAAE,sBAAsB,EAAE,MAAM,kDAAkD,CAAC;AAC1F,OAAO,EAAE,oBAAoB,EAAE,MAAM,0CAA0C,CAAC;AAChF,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"save-stream-writer.class.d.ts","sourceRoot":"","sources":["../../../../src/parser/stream/reworked/save-stream-writer.class.ts"],"names":[],"mappings":"AAAA,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C,IAAI,CAAC,CAMhC;IAEW,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAGnC"}
|
|
@@ -31,13 +31,10 @@ class SaveStreamWriter {
|
|
|
31
31
|
this.writeCompressionInfo = (compressionInfo) => this.createExecutionFunction(['FINISHED_HEADER'], async () => {
|
|
32
32
|
await this.writer.write(`, "compressionInfo": ${JSON.stringify(compressionInfo)}`);
|
|
33
33
|
}, 'WROTE_COMPRESSION_INFO');
|
|
34
|
-
this.
|
|
35
|
-
await this.writer.write(`, "
|
|
36
|
-
}, '
|
|
37
|
-
this.
|
|
38
|
-
await this.writer.write(`, "grids": ${JSON.stringify(grids)}`);
|
|
39
|
-
}, 'WROTE_GRIDS');
|
|
40
|
-
this.openLevels = () => this.createExecutionFunction(['WROTE_GRIDS'], async () => {
|
|
34
|
+
this.writeSaveBodyValidation = (saveBodyValidation) => this.createExecutionFunction(['WROTE_COMPRESSION_INFO'], async () => {
|
|
35
|
+
await this.writer.write(`, "saveBodyValidation": ${JSON.stringify(saveBodyValidation)}`);
|
|
36
|
+
}, 'WROTE_SAVE_BODY_VALIDATION');
|
|
37
|
+
this.openLevels = () => this.createExecutionFunction(['WROTE_SAVE_BODY_VALIDATION'], async () => {
|
|
41
38
|
await this.writer.write(`, "levels": [`);
|
|
42
39
|
}, 'OPENED_LEVELS');
|
|
43
40
|
this.openLevel = (levelName) => this.createExecutionFunction(['OPENED_LEVELS', 'FINISHED_LEVEL'], async () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"save-stream-writer.class.js","sourceRoot":"","sources":["../../../../src/parser/stream/reworked/save-stream-writer.class.ts"],"names":[],"mappings":";;;AAUA,MAAM,gBAAgB;IACrB,YAAmB,IAAU;QAAV,SAAI,GAAJ,IAAI,CAAM;IAE7B,CAAC;IAEM,iBAAiB,CAAC,GAAG,mBAA2B;QACtD,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;Y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,CAAC,IAAI,CAAC,CAAC;QAC/C,IAAI,CAAC,aAAa,GAAG;YACpB,MAAM,EAAE,EAAE;SACV,CAAC;IACH,CAAC;IA8HM,KAAK,CAAC,KAAK;QACjB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IAC5B,CAAC;CACD;AApJD,4CAoJC","sourcesContent":["import { WritableStreamDefaultWriter } from \"stream/web\";\nimport { SatisfactorySaveHeader } from '../../satisfactory/save/satisfactory-save-header';\nimport { ChunkCompressionInfo } from \"../../satisfactory/save/save-body-chunks\";\nimport { Grids, SaveBodyValidation } from '../../satisfactory/save/save-reader';\nimport { SaveObject } from \"../../satisfactory/types/objects/SaveObject\";\nimport { ObjectReference } from '../../satisfactory/types/structs/ObjectReference';\n\ntype Mode = 'BEFORE_START' | 'OPENED_SAVE' | 'FINISHED_HEADER' | 'OPENED_LEVELS' | 'FINISHED_LEVELS' | 'OPENED_LEVEL' | 'FINISHED_LEVEL' | 'FINISHED_SAVE'\n\t| 'WROTE_COMPRESSION_INFO' | 'WROTE_OBJECT' | 'SWITCH_TO_COLLECTABLES' | 'WROTE_COLLECTABLE' | 'WROTE_GRID_HASH' | 'WROTE_GRIDS';\n\nclass ModeStateTracker {\n\tconstructor(public mode: Mode) {\n\n\t}\n\n\tpublic checkIsComingFrom(...allowedPredecessors: Mode[]) {\n\t\tif (!allowedPredecessors.includes(this.mode)) {\n\t\t\tthrow new Error(`Wrong order of commands. mode is ${this.mode}. but only ${allowedPredecessors.join(', ')} is/are allowed.`);\n\t\t}\n\t}\n\n\tpublic advance(newMode: Mode) {\n\t\tthis.mode = newMode;\n\t}\n}\n\n/**\n * @deprecated use ReadableStreamParser instead.\n */\nexport class SaveStreamWriter {\n\n\tprivate mode: Mode;\n\tprivate tracker: ModeStateTracker;\n\n\t// we need some flat structure to keep track of number of elements.\n\tprivate formatTracker: {\n\t\tlevels: {\n\t\t\tobjectCount: number;\n\t\t\tcollectablesCount: number;\n\t\t}[]\n\t};\n\n\tconstructor(private writer: WritableStreamDefaultWriter<string>) {\n\t\tthis.mode = 'BEFORE_START';\n\t\tthis.tracker = new ModeStateTracker(this.mode);\n\t\tthis.formatTracker = {\n\t\t\tlevels: []\n\t\t};\n\t}\n\n\tprivate createExecutionFunction = async (allowedInputModes: Mode[], fn: () => Promise<void> | void, targetMode: Mode): Promise<void> => {\n\t\tthis.tracker.checkIsComingFrom(...allowedInputModes);\n\t\tawait fn();\n\t\tthis.tracker.advance(targetMode);\n\t}\n\n\tpublic beginSave = (): Promise<void> => this.createExecutionFunction(\n\t\t['BEFORE_START'],\n\t\tasync () => {\n\t\t\tawait this.writer.write('{');\n\t\t},\n\t\t'OPENED_SAVE'\n\t);\n\n\tpublic writeHeader = (header: SatisfactorySaveHeader): Promise<void> => this.createExecutionFunction(\n\t\t['OPENED_SAVE'],\n\t\tasync () => {\n\t\t\tawait this.writer.write(`\"header\": ${JSON.stringify(header)}`);\n\t\t},\n\t\t'FINISHED_HEADER'\n\t);\n\n\tpublic writeCompressionInfo = (compressionInfo: ChunkCompressionInfo): Promise<void> => this.createExecutionFunction(\n\t\t['FINISHED_HEADER'],\n\t\tasync () => {\n\t\t\tawait this.writer.write(`, \"compressionInfo\": ${JSON.stringify(compressionInfo)}`);\n\t\t},\n\t\t'WROTE_COMPRESSION_INFO'\n\t);\n\n\tpublic writeGridHash = (gridHash: SaveBodyValidation): Promise<void> => this.createExecutionFunction(\n\t\t['WROTE_COMPRESSION_INFO'],\n\t\tasync () => {\n\t\t\tawait this.writer.write(`, \"gridHash\": ${JSON.stringify(gridHash)}`);\n\t\t},\n\t\t'WROTE_GRID_HASH'\n\t);\n\n\tpublic writeGrids = (grids: Grids): Promise<void> => this.createExecutionFunction(\n\t\t['WROTE_GRID_HASH'],\n\t\tasync () => {\n\t\t\tawait this.writer.write(`, \"grids\": ${JSON.stringify(grids)}`);\n\t\t},\n\t\t'WROTE_GRIDS'\n\t);\n\n\tpublic openLevels = (): Promise<void> => this.createExecutionFunction(\n\t\t['WROTE_GRIDS'],\n\t\tasync () => {\n\t\t\tawait this.writer.write(`, \"levels\": [`);\n\t\t},\n\t\t'OPENED_LEVELS'\n\t);\n\n\tpublic openLevel = (levelName: string): Promise<void> => this.createExecutionFunction(\n\t\t['OPENED_LEVELS', 'FINISHED_LEVEL'],\n\t\tasync () => {\n\t\t\tthis.formatTracker.levels.push({\n\t\t\t\tobjectCount: 0, collectablesCount: 0\n\t\t\t});\n\t\t\tconst prefix = this.formatTracker.levels.length > 1 ? ', ' : '';\n\t\t\tawait this.writer.write(`${prefix}{\"name\": \"${levelName}\", \"objects\": [`);\n\t\t},\n\t\t'OPENED_LEVEL'\n\t);\n\n\tpublic writeObjects = (...objects: SaveObject[]): Promise<void> => this.createExecutionFunction(\n\t\t['OPENED_LEVEL', 'WROTE_OBJECT'],\n\t\tasync () => {\n\t\t\tconst stringified = objects.map(saveObj => JSON.stringify(saveObj));\n\n\t\t\tfor (const obj of stringified) {\n\t\t\t\tawait this.writer.write(`${this.formatTracker.levels.at(-1)!.objectCount >= 1 ? ', ' : ''}${obj}`);\n\t\t\t\tthis.formatTracker.levels.at(-1)!.objectCount++;\n\t\t\t}\n\t\t},\n\t\t'WROTE_OBJECT'\n\t);\n\n\tpublic switchInLevelToCollectables = (...objects: SaveObject[]): Promise<void> => this.createExecutionFunction(\n\t\t['OPENED_LEVEL', 'WROTE_OBJECT'],\n\t\tasync () => {\n\t\t\tawait this.writer.write(`], \"collectables\": [`);\n\t\t},\n\t\t'SWITCH_TO_COLLECTABLES'\n\t);\n\n\tpublic writeCollectables = (...collectables: ObjectReference[]): Promise<void> => this.createExecutionFunction(\n\t\t['SWITCH_TO_COLLECTABLES', 'WROTE_COLLECTABLE'],\n\t\tasync () => {\n\t\t\tconst stringified = collectables.map(coll => JSON.stringify(coll));\n\n\t\t\tfor (const obj of stringified) {\n\t\t\t\tawait this.writer.write(`${this.formatTracker.levels.at(-1)!.collectablesCount >= 1 ? ', ' : ''}${obj}`);\n\t\t\t\tthis.formatTracker.levels.at(-1)!.collectablesCount++;\n\t\t\t}\n\t\t},\n\t\t'WROTE_COLLECTABLE'\n\t);\n\n\tpublic endLevel = (): Promise<void> => this.createExecutionFunction(\n\t\t['SWITCH_TO_COLLECTABLES', 'WROTE_COLLECTABLE'],\n\t\tasync () => {\n\t\t\tawait this.writer.write(`]}`);\n\t\t},\n\t\t'FINISHED_LEVEL'\n\t);\n\n\tpublic endLevels = (): Promise<void> => this.createExecutionFunction(\n\t\t['OPENED_LEVELS', 'FINISHED_LEVEL'],\n\t\tasync () => {\n\t\t\tawait this.writer.write(`]`);\n\t\t},\n\t\t'FINISHED_LEVELS'\n\t);\n\n\tpublic endSave = (): Promise<void> => this.createExecutionFunction(\n\t\t['FINISHED_LEVELS'],\n\t\tasync () => {\n\t\t\tawait this.writer.write('}');\n\t\t},\n\t\t'FINISHED_SAVE'\n\t);\n\n\tpublic async close(): Promise<void> {\n\t\treturn this.writer.close();\n\t}\n}"]}
|
|
1
|
+
{"version":3,"file":"save-stream-writer.class.js","sourceRoot":"","sources":["../../../../src/parser/stream/reworked/save-stream-writer.class.ts"],"names":[],"mappings":";;;AAUA,MAAM,gBAAgB;IACrB,YAAmB,IAAU;QAAV,SAAI,GAAJ,IAAI,CAAM;IAE7B,CAAC;IAEM,iBAAiB,CAAC,GAAG,mBAA2B;QACtD,IAAI,CAAC,mBAAmB,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YAC9C,MAAM,IAAI,KAAK,CAAC,oCAAoC,IAAI,CAAC,IAAI,cAAc,mBAAmB,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAC9H,CAAC;IACF,CAAC;IAEM,OAAO,CAAC,OAAa;QAC3B,IAAI,CAAC,IAAI,GAAG,OAAO,CAAC;IACrB,CAAC;CACD;AAKD,MAAa,gBAAgB;IAa5B,YAAoB,MAA2C;QAA3C,WAAM,GAAN,MAAM,CAAqC;QAQvD,4BAAuB,G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,EAC/C,KAAK,IAAI,EAAE;YACV,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC/B,CAAC,EACD,gBAAgB,CAChB,CAAC;QAEK,cAAS,GAAG,GAAkB,EAAE,CAAC,IAAI,CAAC,uBAAuB,CACnE,CAAC,eAAe,EAAE,gBAAgB,CAAC,EACnC,KAAK,IAAI,EAAE;YACV,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC9B,CAAC,EACD,iBAAiB,CACjB,CAAC;QAEK,YAAO,GAAG,GAAkB,EAAE,CAAC,IAAI,CAAC,uBAAuB,CACjE,CAAC,iBAAiB,CAAC,EACnB,KAAK,IAAI,EAAE;YACV,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC9B,CAAC,EACD,eAAe,CACf,CAAC;QA1HD,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;QAC3B,IAAI,CAAC,OAAO,GAAG,IAAI,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC/C,IAAI,CAAC,aAAa,GAAG;YACpB,MAAM,EAAE,EAAE;SACV,CAAC;IACH,CAAC;IAuHM,KAAK,CAAC,KAAK;QACjB,OAAO,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IAC5B,CAAC;CACD;AA7ID,4CA6IC","sourcesContent":["import { WritableStreamDefaultWriter } from \"stream/web\";\nimport { SatisfactorySaveHeader } from '../../satisfactory/save/satisfactory-save-header';\nimport { ChunkCompressionInfo } from \"../../satisfactory/save/save-body-chunks\";\nimport { SaveObject } from \"../../satisfactory/types/objects/SaveObject\";\nimport { ObjectReference } from '../../satisfactory/types/structs/ObjectReference';\nimport { Grids, SaveBodyValidation } from \"../../satisfactory/types/structs/SaveBodyValidation\";\n\ntype Mode = 'BEFORE_START' | 'OPENED_SAVE' | 'FINISHED_HEADER' | 'OPENED_LEVELS' | 'FINISHED_LEVELS' | 'OPENED_LEVEL' | 'FINISHED_LEVEL' | 'FINISHED_SAVE'\n\t| 'WROTE_COMPRESSION_INFO' | 'WROTE_OBJECT' | 'SWITCH_TO_COLLECTABLES' | 'WROTE_COLLECTABLE' | 'WROTE_SAVE_BODY_VALIDATION';\n\nclass ModeStateTracker {\n\tconstructor(public mode: Mode) {\n\n\t}\n\n\tpublic checkIsComingFrom(...allowedPredecessors: Mode[]) {\n\t\tif (!allowedPredecessors.includes(this.mode)) {\n\t\t\tthrow new Error(`Wrong order of commands. mode is ${this.mode}. but only ${allowedPredecessors.join(', ')} is/are allowed.`);\n\t\t}\n\t}\n\n\tpublic advance(newMode: Mode) {\n\t\tthis.mode = newMode;\n\t}\n}\n\n/**\n * @deprecated use ReadableStreamParser instead.\n */\nexport class SaveStreamWriter {\n\n\tprivate mode: Mode;\n\tprivate tracker: ModeStateTracker;\n\n\t// we need some flat structure to keep track of number of elements.\n\tprivate formatTracker: {\n\t\tlevels: {\n\t\t\tobjectCount: number;\n\t\t\tcollectablesCount: number;\n\t\t}[]\n\t};\n\n\tconstructor(private writer: WritableStreamDefaultWriter<string>) {\n\t\tthis.mode = 'BEFORE_START';\n\t\tthis.tracker = new ModeStateTracker(this.mode);\n\t\tthis.formatTracker = {\n\t\t\tlevels: []\n\t\t};\n\t}\n\n\tprivate createExecutionFunction = async (allowedInputModes: Mode[], fn: () => Promise<void> | void, targetMode: Mode): Promise<void> => {\n\t\tthis.tracker.checkIsComingFrom(...allowedInputModes);\n\t\tawait fn();\n\t\tthis.tracker.advance(targetMode);\n\t}\n\n\tpublic beginSave = (): Promise<void> => this.createExecutionFunction(\n\t\t['BEFORE_START'],\n\t\tasync () => {\n\t\t\tawait this.writer.write('{');\n\t\t},\n\t\t'OPENED_SAVE'\n\t);\n\n\tpublic writeHeader = (header: SatisfactorySaveHeader): Promise<void> => this.createExecutionFunction(\n\t\t['OPENED_SAVE'],\n\t\tasync () => {\n\t\t\tawait this.writer.write(`\"header\": ${JSON.stringify(header)}`);\n\t\t},\n\t\t'FINISHED_HEADER'\n\t);\n\n\tpublic writeCompressionInfo = (compressionInfo: ChunkCompressionInfo): Promise<void> => this.createExecutionFunction(\n\t\t['FINISHED_HEADER'],\n\t\tasync () => {\n\t\t\tawait this.writer.write(`, \"compressionInfo\": ${JSON.stringify(compressionInfo)}`);\n\t\t},\n\t\t'WROTE_COMPRESSION_INFO'\n\t);\n\n\tpublic writeSaveBodyValidation = (saveBodyValidation: SaveBodyValidation): Promise<void> => this.createExecutionFunction(\n\t\t['WROTE_COMPRESSION_INFO'],\n\t\tasync () => {\n\t\t\tawait this.writer.write(`, \"saveBodyValidation\": ${JSON.stringify(saveBodyValidation)}`);\n\t\t},\n\t\t'WROTE_SAVE_BODY_VALIDATION'\n\t);\n\n\n\tpublic openLevels = (): Promise<void> => this.createExecutionFunction(\n\t\t['WROTE_SAVE_BODY_VALIDATION'],\n\t\tasync () => {\n\t\t\tawait this.writer.write(`, \"levels\": [`);\n\t\t},\n\t\t'OPENED_LEVELS'\n\t);\n\n\tpublic openLevel = (levelName: string): Promise<void> => this.createExecutionFunction(\n\t\t['OPENED_LEVELS', 'FINISHED_LEVEL'],\n\t\tasync () => {\n\t\t\tthis.formatTracker.levels.push({\n\t\t\t\tobjectCount: 0, collectablesCount: 0\n\t\t\t});\n\t\t\tconst prefix = this.formatTracker.levels.length > 1 ? ', ' : '';\n\t\t\tawait this.writer.write(`${prefix}{\"name\": \"${levelName}\", \"objects\": [`);\n\t\t},\n\t\t'OPENED_LEVEL'\n\t);\n\n\tpublic writeObjects = (...objects: SaveObject[]): Promise<void> => this.createExecutionFunction(\n\t\t['OPENED_LEVEL', 'WROTE_OBJECT'],\n\t\tasync () => {\n\t\t\tconst stringified = objects.map(saveObj => JSON.stringify(saveObj));\n\n\t\t\tfor (const obj of stringified) {\n\t\t\t\tawait this.writer.write(`${this.formatTracker.levels.at(-1)!.objectCount >= 1 ? ', ' : ''}${obj}`);\n\t\t\t\tthis.formatTracker.levels.at(-1)!.objectCount++;\n\t\t\t}\n\t\t},\n\t\t'WROTE_OBJECT'\n\t);\n\n\tpublic switchInLevelToCollectables = (...objects: SaveObject[]): Promise<void> => this.createExecutionFunction(\n\t\t['OPENED_LEVEL', 'WROTE_OBJECT'],\n\t\tasync () => {\n\t\t\tawait this.writer.write(`], \"collectables\": [`);\n\t\t},\n\t\t'SWITCH_TO_COLLECTABLES'\n\t);\n\n\tpublic writeCollectables = (...collectables: ObjectReference[]): Promise<void> => this.createExecutionFunction(\n\t\t['SWITCH_TO_COLLECTABLES', 'WROTE_COLLECTABLE'],\n\t\tasync () => {\n\t\t\tconst stringified = collectables.map(coll => JSON.stringify(coll));\n\n\t\t\tfor (const obj of stringified) {\n\t\t\t\tawait this.writer.write(`${this.formatTracker.levels.at(-1)!.collectablesCount >= 1 ? ', ' : ''}${obj}`);\n\t\t\t\tthis.formatTracker.levels.at(-1)!.collectablesCount++;\n\t\t\t}\n\t\t},\n\t\t'WROTE_COLLECTABLE'\n\t);\n\n\tpublic endLevel = (): Promise<void> => this.createExecutionFunction(\n\t\t['SWITCH_TO_COLLECTABLES', 'WROTE_COLLECTABLE'],\n\t\tasync () => {\n\t\t\tawait this.writer.write(`]}`);\n\t\t},\n\t\t'FINISHED_LEVEL'\n\t);\n\n\tpublic endLevels = (): Promise<void> => this.createExecutionFunction(\n\t\t['OPENED_LEVELS', 'FINISHED_LEVEL'],\n\t\tasync () => {\n\t\t\tawait this.writer.write(`]`);\n\t\t},\n\t\t'FINISHED_LEVELS'\n\t);\n\n\tpublic endSave = (): Promise<void> => this.createExecutionFunction(\n\t\t['FINISHED_LEVELS'],\n\t\tasync () => {\n\t\t\tawait this.writer.write('}');\n\t\t},\n\t\t'FINISHED_SAVE'\n\t);\n\n\tpublic async close(): Promise<void> {\n\t\treturn this.writer.close();\n\t}\n}"]}
|