@etothepii/satisfactory-file-parser
Advanced tools
Comparing version 0.0.31 to 0.0.32
@@ -10,2 +10,4 @@ export * from './parser/satisfactory/blueprint/blueprint.types'; | ||
export * from './parser/satisfactory/save/save.types'; | ||
export { BinaryOperable } from './parser/byte/binary-operable.interface'; | ||
export { BinaryReadable } from './parser/byte/binary-readable.interface'; | ||
export { ByteReader } from './parser/byte/byte-reader.class'; | ||
@@ -18,4 +20,6 @@ export { ByteWriter } from './parser/byte/byte-writer.class'; | ||
export * from './parser/satisfactory/structs/util.types'; | ||
export { CompressionLibraryError, CorruptSaveError, ParserError, UnsupportedVersionError } from './parser/error/parser.error'; | ||
export { SaveStreamJsonStringifier } from './parser/stream/save-stream-json-stringifier'; | ||
export { SaveStreamWriter } from './parser/stream/save-stream-writer.class'; | ||
export * from './parser/error/parser.error'; | ||
export * from './parser/file.types'; | ||
export { Parser } from './parser/parser'; |
@@ -21,3 +21,3 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "./parser/satisfactory/blueprint/blueprint.types", "./parser/satisfactory/objects/DataFields", "./parser/satisfactory/objects/ObjectReference", "./parser/satisfactory/objects/Property", "./parser/satisfactory/objects/SaveComponent", "./parser/satisfactory/objects/SaveEntity", "./parser/satisfactory/save/level.class", "./parser/satisfactory/save/satisfactory-save", "./parser/satisfactory/save/save.types", "./parser/byte/byte-reader.class", "./parser/byte/byte-writer.class", "./parser/satisfactory/blueprint/blueprint-reader", "./parser/satisfactory/blueprint/blueprint-writer", "./parser/satisfactory/save/save-reader", "./parser/satisfactory/save/save-writer", "./parser/satisfactory/structs/util.types", "./parser/error/parser.error", "./parser/file.types", "./parser/parser"], factory); | ||
define(["require", "exports", "./parser/satisfactory/blueprint/blueprint.types", "./parser/satisfactory/objects/DataFields", "./parser/satisfactory/objects/ObjectReference", "./parser/satisfactory/objects/Property", "./parser/satisfactory/objects/SaveComponent", "./parser/satisfactory/objects/SaveEntity", "./parser/satisfactory/save/level.class", "./parser/satisfactory/save/satisfactory-save", "./parser/satisfactory/save/save.types", "./parser/byte/byte-reader.class", "./parser/byte/byte-writer.class", "./parser/satisfactory/blueprint/blueprint-reader", "./parser/satisfactory/blueprint/blueprint-writer", "./parser/satisfactory/save/save-reader", "./parser/satisfactory/save/save-writer", "./parser/satisfactory/structs/util.types", "./parser/stream/save-stream-json-stringifier", "./parser/stream/save-stream-writer.class", "./parser/error/parser.error", "./parser/file.types", "./parser/parser"], factory); | ||
} | ||
@@ -27,3 +27,3 @@ })(function (require, exports) { | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Parser = exports.UnsupportedVersionError = exports.ParserError = exports.CorruptSaveError = exports.CompressionLibraryError = exports.SaveWriter = exports.SaveReader = exports.BlueprintWriter = exports.BlueprintConfigWriter = exports.BlueprintReader = exports.BlueprintConfigReader = exports.ByteWriter = exports.ByteReader = exports.SatisfactorySave = exports.Level = exports.SaveEntity = exports.SaveComponent = exports.ObjectReference = exports.DataFields = void 0; | ||
exports.Parser = exports.SaveStreamWriter = exports.SaveStreamJsonStringifier = exports.SaveWriter = exports.SaveReader = exports.BlueprintWriter = exports.BlueprintConfigWriter = exports.BlueprintReader = exports.BlueprintConfigReader = exports.ByteWriter = exports.ByteReader = exports.SatisfactorySave = exports.Level = exports.SaveEntity = exports.SaveComponent = exports.ObjectReference = exports.DataFields = void 0; | ||
__exportStar(require("./parser/satisfactory/blueprint/blueprint.types"), exports); | ||
@@ -59,7 +59,7 @@ var DataFields_1 = require("./parser/satisfactory/objects/DataFields"); | ||
__exportStar(require("./parser/satisfactory/structs/util.types"), exports); | ||
var parser_error_1 = require("./parser/error/parser.error"); | ||
Object.defineProperty(exports, "CompressionLibraryError", { enumerable: true, get: function () { return parser_error_1.CompressionLibraryError; } }); | ||
Object.defineProperty(exports, "CorruptSaveError", { enumerable: true, get: function () { return parser_error_1.CorruptSaveError; } }); | ||
Object.defineProperty(exports, "ParserError", { enumerable: true, get: function () { return parser_error_1.ParserError; } }); | ||
Object.defineProperty(exports, "UnsupportedVersionError", { enumerable: true, get: function () { return parser_error_1.UnsupportedVersionError; } }); | ||
var save_stream_json_stringifier_1 = require("./parser/stream/save-stream-json-stringifier"); | ||
Object.defineProperty(exports, "SaveStreamJsonStringifier", { enumerable: true, get: function () { return save_stream_json_stringifier_1.SaveStreamJsonStringifier; } }); | ||
var save_stream_writer_class_1 = require("./parser/stream/save-stream-writer.class"); | ||
Object.defineProperty(exports, "SaveStreamWriter", { enumerable: true, get: function () { return save_stream_writer_class_1.SaveStreamWriter; } }); | ||
__exportStar(require("./parser/error/parser.error"), exports); | ||
__exportStar(require("./parser/file.types"), exports); | ||
@@ -66,0 +66,0 @@ var parser_1 = require("./parser/parser"); |
import { Alignment } from "./alignment.enum"; | ||
export declare abstract class ByteReader { | ||
import { BinaryReadable } from "./binary-readable.interface"; | ||
export declare abstract class ByteReader implements BinaryReadable { | ||
protected bufferView: DataView; | ||
protected fileBuffer: ArrayBuffer; | ||
protected alignment: Alignment; | ||
alignment: Alignment; | ||
debug: boolean; | ||
protected currentByte: number; | ||
protected handledByte: number; | ||
protected maxByte: number; | ||
protected lastStrRead: number; | ||
constructor(fileBuffer: ArrayBuffer, alignment: Alignment); | ||
@@ -18,2 +19,3 @@ reset(newFileBuffer: ArrayBuffer): void; | ||
readUint8(): number; | ||
readInt16(): number; | ||
readUint16(): number; | ||
@@ -23,8 +25,9 @@ readInt32(): number; | ||
readLong(): bigint; | ||
readFloat(): number; | ||
readInt64(): bigint; | ||
readUint64(): bigint; | ||
readFloat32(): number; | ||
readDouble(): number; | ||
protected getStringInfo(): { | ||
payload: string; | ||
counter: number; | ||
}; | ||
readString(): string; | ||
allocate(count: number): Promise<void>; | ||
getAmountAllocatedLeft: () => number; | ||
getBufferPosition: () => number; | ||
@@ -35,3 +38,2 @@ getBufferSlice: (begin: number, end: number | undefined) => ArrayBuffer; | ||
getBuffer: () => ArrayBuffer; | ||
readString(): string; | ||
} |
@@ -16,6 +16,7 @@ (function (factory) { | ||
constructor(fileBuffer, alignment) { | ||
this.debug = false; | ||
this.currentByte = 0; | ||
this.handledByte = 0; | ||
this.maxByte = 0; | ||
this.lastStrRead = 0; | ||
this.getAmountAllocatedLeft = () => this.bufferView.byteLength - this.currentByte; | ||
this.getBufferPosition = () => this.currentByte; | ||
@@ -38,2 +39,3 @@ this.getBufferSlice = (begin, end) => this.bufferView.buffer.slice(begin, end); | ||
this.currentByte += byteLength; | ||
return; | ||
} | ||
@@ -62,2 +64,7 @@ readByte() { | ||
} | ||
readInt16() { | ||
let data = this.bufferView.getInt16(this.currentByte, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN); | ||
this.currentByte += 2; | ||
return data; | ||
} | ||
readUint16() { | ||
@@ -83,3 +90,11 @@ let data = this.bufferView.getUint16(this.currentByte, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN); | ||
} | ||
readFloat() { | ||
readInt64() { | ||
return this.readLong(); | ||
} | ||
readUint64() { | ||
let data = this.bufferView.getBigUint64(this.currentByte, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN); | ||
this.currentByte += 8; | ||
return data; | ||
} | ||
readFloat32() { | ||
let data = this.bufferView.getFloat32(this.currentByte, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN); | ||
@@ -94,17 +109,4 @@ this.currentByte += 4; | ||
} | ||
getStringInfo() { | ||
let payload = ''; | ||
let counter = this.currentByte; | ||
try { | ||
let strLength = this.bufferView.getInt32(this.currentByte, this.alignment === alignment_enum_1.Alignment.LITTLE_ENDIAN); | ||
counter += 4; | ||
payload = new Array(strLength - 1).fill('').map(c => String.fromCharCode(this.bufferView.getUint8(counter++))).join(''); | ||
} | ||
catch (error) { } | ||
this.currentByte -= counter; | ||
return { payload, counter }; | ||
} | ||
readString() { | ||
let strLength = this.readInt32(); | ||
this.lastStrRead = strLength; | ||
let startBytes = this.currentByte; | ||
@@ -134,4 +136,10 @@ if (strLength === 0) { | ||
} | ||
allocate(count) { | ||
if (this.currentByte + count < this.bufferView.byteLength) { | ||
console.warn('tried to allocate but there is not enough data left.'); | ||
} | ||
return Promise.resolve(); | ||
} | ||
} | ||
exports.ByteReader = ByteReader; | ||
}); |
@@ -13,1 +13,7 @@ export declare class ParserError extends Error { | ||
} | ||
export declare class TimeoutError extends ParserError { | ||
constructor(message?: string); | ||
} | ||
export declare class UnimplementedError extends ParserError { | ||
constructor(message?: string); | ||
} |
@@ -12,3 +12,3 @@ (function (factory) { | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.CompressionLibraryError = exports.CorruptSaveError = exports.UnsupportedVersionError = exports.ParserError = void 0; | ||
exports.UnimplementedError = exports.TimeoutError = exports.CompressionLibraryError = exports.CorruptSaveError = exports.UnsupportedVersionError = exports.ParserError = void 0; | ||
class ParserError extends Error { | ||
@@ -39,2 +39,14 @@ constructor(name, message) { | ||
exports.CompressionLibraryError = CompressionLibraryError; | ||
class TimeoutError extends ParserError { | ||
constructor(message) { | ||
super('TimeoutError', message ?? 'Operation timed out.'); | ||
} | ||
} | ||
exports.TimeoutError = TimeoutError; | ||
class UnimplementedError extends ParserError { | ||
constructor(message) { | ||
super('UnimplementedError', message ?? 'Unimplemented Operation.'); | ||
} | ||
} | ||
exports.UnimplementedError = UnimplementedError; | ||
}); |
/// <reference types="node" /> | ||
/// <reference types="node" /> | ||
import { TransformStream, WritableStream } from "stream/web"; | ||
import { ChunkSummary } from "./file.types"; | ||
@@ -6,5 +8,12 @@ import { Blueprint } from "./satisfactory/blueprint/blueprint.types"; | ||
import { SaveProjectionConfig } from "./satisfactory/save/save-reader"; | ||
export declare class PassthroughWebTransform extends TransformStream<Uint8Array, Uint8Array> { | ||
constructor(); | ||
} | ||
export declare class Parser { | ||
static WriteSave(save: SatisfactorySave, onBinaryBeforeCompressing: (buffer: ArrayBuffer) => void, onHeader: (header: Uint8Array) => void, onChunk: (chunk: Uint8Array) => void): ChunkSummary[]; | ||
private static ParseSaveFileStream; | ||
private static ParseStreamSave; | ||
private static DecompressStreamSave; | ||
static ParseSaveFile(file: Buffer, onDecompressedSaveBody?: (buffer: ArrayBuffer) => void, onProgress?: (progress: number, message?: string) => void): SatisfactorySave; | ||
static ParseSaveFileAsynchronousToOutput(file: Buffer, outputJson: WritableStream<string>, onDecompressedSaveBody?: (buffer: ArrayBuffer) => void, onProgress?: (progress: number, message?: string) => void): Promise<SatisfactorySave>; | ||
static WriteBlueprintFiles(blueprint: Blueprint, onMainFileBinaryBeforeCompressing?: (binary: ArrayBuffer) => void, onMainFileHeader?: (header: Uint8Array) => void, onMainFileChunk?: (chunk: Uint8Array) => void): { | ||
@@ -11,0 +20,0 @@ mainFileChunkSummary: ChunkSummary[]; |
@@ -7,3 +7,3 @@ (function (factory) { | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "./satisfactory/blueprint/blueprint-reader", "./satisfactory/blueprint/blueprint-writer", "./satisfactory/save/level.class", "./satisfactory/save/satisfactory-save", "./satisfactory/save/save-reader", "./satisfactory/save/save-writer"], factory); | ||
define(["require", "exports", "stream/web", "./satisfactory/blueprint/blueprint-reader", "./satisfactory/blueprint/blueprint-writer", "./satisfactory/save/level.class", "./satisfactory/save/satisfactory-save", "./satisfactory/save/save-reader", "./satisfactory/save/save-writer", "./stream/save-stream-reader.class", "./stream/save-stream-writer.class"], factory); | ||
} | ||
@@ -13,3 +13,4 @@ })(function (require, exports) { | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Parser = void 0; | ||
exports.Parser = exports.PassthroughWebTransform = void 0; | ||
const web_1 = require("stream/web"); | ||
const blueprint_reader_1 = require("./satisfactory/blueprint/blueprint-reader"); | ||
@@ -21,2 +22,20 @@ const blueprint_writer_1 = require("./satisfactory/blueprint/blueprint-writer"); | ||
const save_writer_1 = require("./satisfactory/save/save-writer"); | ||
const save_stream_reader_class_1 = require("./stream/save-stream-reader.class"); | ||
const save_stream_writer_class_1 = require("./stream/save-stream-writer.class"); | ||
class PassthroughWebTransform extends web_1.TransformStream { | ||
constructor() { | ||
super({ | ||
start: (controller) => { | ||
}, | ||
transform: async (chunk, controller) => { | ||
chunk = await chunk; | ||
controller.enqueue(chunk); | ||
}, | ||
flush: (controller) => { | ||
console.log('on passthrough dispose.'); | ||
} | ||
}); | ||
} | ||
} | ||
exports.PassthroughWebTransform = PassthroughWebTransform; | ||
class Parser { | ||
@@ -32,2 +51,64 @@ static WriteSave(save, onBinaryBeforeCompressing, onHeader, onChunk) { | ||
} | ||
static async ParseSaveFileStream(input, output, binaryOutput) { | ||
return new Promise(async (resolve, reject) => { | ||
if (input.locked || output.locked || (binaryOutput !== undefined ? binaryOutput.locked : false)) { | ||
throw new Error('One of the input/output streams is locked. Aborting save parsing.'); | ||
} | ||
const binaryOutWriter = binaryOutput ? binaryOutput.getWriter() : undefined; | ||
const writer = new save_stream_writer_class_1.SaveStreamWriter(output.getWriter()); | ||
const reader = new save_stream_reader_class_1.SaveStreamReader(input.getReader(), 500 * 1000 * 1000); | ||
const passthrough = new PassthroughWebTransform(); | ||
const passthroughWriter = passthrough.writable.getWriter(); | ||
const passthroughReader = new save_stream_reader_class_1.SaveStreamReader(passthrough.readable.getReader(), 3000 * 1000 * 1000); | ||
await writer.beginSave(); | ||
const header = await reader.readHeader(); | ||
await writer.writeHeader(header); | ||
let contentParsingPromise; | ||
const decompressionPromise = Parser.DecompressStreamSave(reader, writer, passthroughWriter, async () => { | ||
console.log('start streaming content'); | ||
passthroughReader.debug = true; | ||
contentParsingPromise = await Parser.ParseStreamSave(passthroughReader, writer, header); | ||
await writer.close(); | ||
return resolve(); | ||
}, binaryOutWriter); | ||
}); | ||
} | ||
static async ParseStreamSave(reader, jsonWriter, header) { | ||
return new Promise(async (resolve, reject) => { | ||
reader.onCloseCallback = async () => { | ||
console.log('content reader closes.'); | ||
await jsonWriter.endLevels(); | ||
await jsonWriter.endSave(); | ||
return resolve(); | ||
}; | ||
console.log('before open levels'); | ||
await jsonWriter.openLevels(); | ||
const dataLength = await reader.readInt32(); | ||
await reader.allocate(Math.min(1000, dataLength)); | ||
console.log(`incoming body size should be ${dataLength} bytes big.`); | ||
await reader.streamLevelsToOutput(jsonWriter, header); | ||
await reader.close(); | ||
}); | ||
} | ||
static async DecompressStreamSave(reader, jsonWriter, outputWriter, onDecompressionInfoWritten, debugAdditionalBinaryOutputWriter) { | ||
return new Promise(async (resolve, reject) => { | ||
reader.onCloseCallback = async () => { | ||
console.log('decompress reader closes.'); | ||
return resolve(); | ||
}; | ||
let first = true; | ||
while (reader.hasInput()) { | ||
const decompressedChunk = await reader.readBodyChunk(); | ||
if (first && reader.compressionInfo) { | ||
await jsonWriter.writeCompressionInfo(reader.compressionInfo); | ||
onDecompressionInfoWritten(); | ||
first = false; | ||
} | ||
if (debugAdditionalBinaryOutputWriter) { | ||
debugAdditionalBinaryOutputWriter.write(decompressedChunk); | ||
} | ||
outputWriter.write(decompressedChunk); | ||
} | ||
}); | ||
} | ||
static ParseSaveFile(file, onDecompressedSaveBody = () => { }, onProgress = () => { }) { | ||
@@ -45,2 +126,19 @@ const reader = new save_reader_1.SaveReader(new Uint8Array(file).buffer, onProgress); | ||
} | ||
static async ParseSaveFileAsynchronousToOutput(file, outputJson, onDecompressedSaveBody = () => { }, onProgress = () => { }) { | ||
const reader = new save_reader_1.SaveReader(new Uint8Array(file).buffer, onProgress); | ||
const writer = new save_stream_writer_class_1.SaveStreamWriter(outputJson.getWriter()); | ||
await writer.beginSave(); | ||
const header = reader.readHeader(); | ||
const save = new satisfactory_save_1.SatisfactorySave(header); | ||
await writer.writeHeader(save.header); | ||
await writer.writeCompressionInfo({}); | ||
const inflateResult = reader.inflateChunks(); | ||
onDecompressedSaveBody(reader.getBuffer()); | ||
const levelParseResult = await reader.readLevelsAsynchronously(writer); | ||
save.levels = reader.levels; | ||
save.compressionInfo = reader.compressionInfo; | ||
save.trailingCollectedObjects = reader.trailingCollectedObjects; | ||
await writer.endSave(); | ||
return save; | ||
} | ||
static WriteBlueprintFiles(blueprint, onMainFileBinaryBeforeCompressing = () => { }, onMainFileHeader = () => { }, onMainFileChunk = () => { }) { | ||
@@ -47,0 +145,0 @@ const blueprintWriter = new blueprint_writer_1.BlueprintWriter(); |
@@ -0,1 +1,2 @@ | ||
import { BinaryReadable } from "../../byte/binary-readable.interface"; | ||
import { ByteReader } from "../../byte/byte-reader.class"; | ||
@@ -9,3 +10,3 @@ import { ChunkCompressionInfo } from "../../file.types"; | ||
constructor(bluePrintBuffer: ArrayBuffer); | ||
static ReadHeader(reader: ByteReader): BlueprintHeader; | ||
static ReadHeader(reader: BinaryReadable): BlueprintHeader; | ||
inflateChunks(): any; | ||
@@ -18,3 +19,3 @@ static ParseObjects(reader: ByteReader): (SaveEntity | SaveComponent)[]; | ||
parse: () => BlueprintConfig; | ||
static ParseConfig(reader: ByteReader): BlueprintConfig; | ||
static ParseConfig(reader: BinaryReadable): BlueprintConfig; | ||
} |
@@ -57,3 +57,3 @@ (function (factory) { | ||
writer.writeBinarySizeFromPosition(headersLenIndicator, headersLenIndicator + 4); | ||
level_class_1.Level.SerializeObjectContents(writer, objects, 0); | ||
level_class_1.Level.SerializeObjectContents(writer, objects, 0, ''); | ||
} | ||
@@ -60,0 +60,0 @@ } |
@@ -1,13 +0,41 @@ | ||
import { ByteReader } from "../../byte/byte-reader.class"; | ||
import { ByteWriter } from "../../.."; | ||
import { BinaryReadable } from "../../byte/binary-readable.interface"; | ||
import { SaveWriter } from "../save/save-writer"; | ||
import { vec3 } from "../structs/util.types"; | ||
import { ObjectReference } from "./ObjectReference"; | ||
import { AbstractBaseProperty } from "./Property"; | ||
export type SpecialAnyProperty = {} | PowerLineSpecialProperty; | ||
export type PowerLineSpecialProperty = { | ||
num: number; | ||
source: ObjectReference; | ||
target: ObjectReference; | ||
sourceTranslation?: vec3; | ||
targetTranslation?: vec3; | ||
}; | ||
export type PlayerSpecialProperty = { | ||
flag: number; | ||
eosData?: string; | ||
steamPlayerData?: string; | ||
}; | ||
export type ItemSpecialProperty = { | ||
length: number; | ||
name: string; | ||
position: number; | ||
pathName: string; | ||
}; | ||
export type ConveyorSpecialProperty = { | ||
items: ItemSpecialProperty[]; | ||
}; | ||
export declare class DataFields { | ||
properties: any[]; | ||
properties: AbstractBaseProperty[]; | ||
specialProperties: SpecialAnyProperty; | ||
trailingData: number[]; | ||
shouldBeNulled: boolean; | ||
constructor(); | ||
static Parse(length: number, reader: ByteReader, buildVersion: number): DataFields; | ||
static ParseProperty(reader: ByteReader, buildVersion: number, propertyName: string): AbstractBaseProperty | null; | ||
static Serialize(writer: SaveWriter, fields: DataFields, buildVersion: number): void; | ||
static SerializeProperty(writer: SaveWriter, property: AbstractBaseProperty, propertyName: string, buildVersion: number): void; | ||
static Parse(length: number, reader: BinaryReadable, buildVersion: number, typePath: string): DataFields; | ||
static ParseAdditionalSpecialProperties(reader: BinaryReadable, typePath: string, remainingLen: number): SpecialAnyProperty; | ||
static ParseProperty(reader: BinaryReadable, buildVersion: number, propertyName: string): AbstractBaseProperty | null; | ||
static Serialize(writer: SaveWriter, fields: DataFields, buildVersion: number, typePath: string): void; | ||
static SerializeAdditionalSpecialProperties(writer: ByteWriter, typePath: string, property: SpecialAnyProperty): void; | ||
static SerializeProperty(writer: ByteWriter, property: AbstractBaseProperty, propertyName: string, buildVersion: number): void; | ||
} |
@@ -7,3 +7,3 @@ (function (factory) { | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "./Property"], factory); | ||
define(["require", "exports", "../structs/util.types", "./Property"], factory); | ||
} | ||
@@ -14,2 +14,3 @@ })(function (require, exports) { | ||
exports.DataFields = void 0; | ||
const util_types_1 = require("../structs/util.types"); | ||
const Property_1 = require("./Property"); | ||
@@ -19,6 +20,7 @@ class DataFields { | ||
this.properties = []; | ||
this.specialProperties = {}; | ||
this.trailingData = []; | ||
this.shouldBeNulled = false; | ||
} | ||
static Parse(length, reader, buildVersion) { | ||
static Parse(length, reader, buildVersion, typePath) { | ||
const start = reader.getBufferPosition(); | ||
@@ -39,2 +41,3 @@ const fields = new DataFields(); | ||
} | ||
fields.specialProperties = DataFields.ParseAdditionalSpecialProperties(reader, typePath, start + length - reader.getBufferPosition() - 4); | ||
const end = reader.getBufferPosition(); | ||
@@ -45,2 +48,48 @@ let remainingBytes = start + length - end; | ||
} | ||
static ParseAdditionalSpecialProperties(reader, typePath, remainingLen) { | ||
let property; | ||
switch (typePath) { | ||
case '/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk1/Build_ConveyorBeltMk1.Build_ConveyorBeltMk1_C': | ||
case '/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk2/Build_ConveyorBeltMk2.Build_ConveyorBeltMk2_C': | ||
case '/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk3/Build_ConveyorBeltMk3.Build_ConveyorBeltMk3_C': | ||
case '/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk4/Build_ConveyorBeltMk4.Build_ConveyorBeltMk4_C': | ||
case '/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk5/Build_ConveyorBeltMk5.Build_ConveyorBeltMk5_C': | ||
case '/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk1/Build_ConveyorLiftMk1.Build_ConveyorLiftMk1_C': | ||
case '/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk2/Build_ConveyorLiftMk2.Build_ConveyorLiftMk2_C': | ||
case '/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk3/Build_ConveyorLiftMk3.Build_ConveyorLiftMk3_C': | ||
case '/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk4/Build_ConveyorLiftMk4.Build_ConveyorLiftMk4_C': | ||
case '/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk5/Build_ConveyorLiftMk5.Build_ConveyorLiftMk5_C': | ||
property = {}; | ||
break; | ||
case '/Game/FactoryGame/Buildable/Factory/PowerLine/Build_PowerLine.Build_PowerLine_C': | ||
case '/Game/FactoryGame/Events/Christmas/Buildings/PowerLineLights/Build_XmassLightsLine.Build_XmassLightsLine_C': | ||
property = { | ||
source: Property_1.ObjectProperty.ReadValue(reader), | ||
target: Property_1.ObjectProperty.ReadValue(reader) | ||
}; | ||
if (remainingLen >= 24) { | ||
property.sourceTranslation = (0, util_types_1.ParseVec3)(reader); | ||
property.targetTranslation = (0, util_types_1.ParseVec3)(reader); | ||
} | ||
break; | ||
case '/Game/FactoryGame/Character/Player/BP_PlayerState.BP_PlayerState_C': | ||
property = {}; | ||
property.flag = reader.readByte(); | ||
switch (property.flag) { | ||
case 248: | ||
const eos = reader.readString(); | ||
property.eosData = reader.readString(); | ||
break; | ||
case 25: | ||
break; | ||
default: | ||
break; | ||
} | ||
break; | ||
default: | ||
property = {}; | ||
break; | ||
} | ||
return property; | ||
} | ||
static ParseProperty(reader, buildVersion, propertyName) { | ||
@@ -139,3 +188,3 @@ let currentProperty = {}; | ||
} | ||
static Serialize(writer, fields, buildVersion) { | ||
static Serialize(writer, fields, buildVersion, typePath) { | ||
for (const property of fields.properties) { | ||
@@ -147,4 +196,38 @@ writer.writeString(property.name); | ||
writer.writeInt32(0); | ||
DataFields.SerializeAdditionalSpecialProperties(writer, typePath, fields.specialProperties); | ||
writer.writeBytesArray(fields.trailingData); | ||
} | ||
static SerializeAdditionalSpecialProperties(writer, typePath, property) { | ||
switch (typePath) { | ||
case '/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk1/Build_ConveyorBeltMk1.Build_ConveyorBeltMk1_C': | ||
case '/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk2/Build_ConveyorBeltMk2.Build_ConveyorBeltMk2_C': | ||
case '/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk3/Build_ConveyorBeltMk3.Build_ConveyorBeltMk3_C': | ||
case '/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk4/Build_ConveyorBeltMk4.Build_ConveyorBeltMk4_C': | ||
case '/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk5/Build_ConveyorBeltMk5.Build_ConveyorBeltMk5_C': | ||
case '/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk1/Build_ConveyorLiftMk1.Build_ConveyorLiftMk1_C': | ||
case '/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk2/Build_ConveyorLiftMk2.Build_ConveyorLiftMk2_C': | ||
case '/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk3/Build_ConveyorLiftMk3.Build_ConveyorLiftMk3_C': | ||
case '/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk4/Build_ConveyorLiftMk4.Build_ConveyorLiftMk4_C': | ||
case '/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk5/Build_ConveyorLiftMk5.Build_ConveyorLiftMk5_C': | ||
break; | ||
case '/Game/FactoryGame/Buildable/Factory/PowerLine/Build_PowerLine.Build_PowerLine_C': | ||
case '/Game/FactoryGame/Events/Christmas/Buildings/PowerLineLights/Build_XmassLightsLine.Build_XmassLightsLine_C': | ||
Property_1.ObjectProperty.SerializeValue(writer, property.source); | ||
Property_1.ObjectProperty.SerializeValue(writer, property.target); | ||
break; | ||
case '/Game/FactoryGame/Character/Player/BP_PlayerState.BP_PlayerState_C': | ||
writer.writeByte(property.flag); | ||
switch (property.flag) { | ||
case 248: | ||
writer.writeString('EOS'); | ||
writer.writeString(property.eosData); | ||
break; | ||
case 25: | ||
break; | ||
default: | ||
break; | ||
} | ||
break; | ||
} | ||
} | ||
static SerializeProperty(writer, property, propertyName, buildVersion) { | ||
@@ -151,0 +234,0 @@ writer.writeString(property.ueType); |
@@ -1,2 +0,2 @@ | ||
import { ByteReader } from "../../byte/byte-reader.class"; | ||
import { BinaryReadable } from "../../byte/binary-readable.interface"; | ||
import { ByteWriter } from "../../byte/byte-writer.class"; | ||
@@ -7,4 +7,4 @@ export declare class ObjectReference { | ||
constructor(levelName: string, pathName: string); | ||
static Parse(reader: ByteReader): ObjectReference; | ||
static Parse(reader: BinaryReadable): ObjectReference; | ||
static Serialize(writer: ByteWriter, ref: ObjectReference): void; | ||
} |
@@ -1,3 +0,3 @@ | ||
import { ByteReader } from "../../byte/byte-reader.class"; | ||
import { SaveWriter } from "../save/save-writer"; | ||
import { ByteWriter } from "../../.."; | ||
import { BinaryReadable } from "../../byte/binary-readable.interface"; | ||
import { col4, vec3, vec4 } from "../structs/util.types"; | ||
@@ -23,4 +23,4 @@ import { ObjectReference } from "./ObjectReference"; | ||
export type GUID = undefined | Uint8Array; | ||
export declare const ParseGUID: (reader: ByteReader) => GUID; | ||
export declare const SerializeGUID: (writer: SaveWriter, guid: GUID) => void; | ||
export declare const ParseGUID: (reader: BinaryReadable) => GUID; | ||
export declare const SerializeGUID: (writer: ByteWriter, guid: GUID) => void; | ||
export type OverheadResult = { | ||
@@ -32,7 +32,7 @@ overhead: number; | ||
constructor(value: boolean, ueType?: string, guidInfo?: GUID, index?: number); | ||
static Parse(reader: ByteReader, ueType: string, index?: number): BoolProperty; | ||
static ReadValue(reader: ByteReader): boolean; | ||
static Parse(reader: BinaryReadable, ueType: string, index?: number): BoolProperty; | ||
static ReadValue(reader: BinaryReadable): boolean; | ||
static CalcOverhead(property: BoolProperty): number; | ||
static Serialize(writer: SaveWriter, property: BoolProperty): void; | ||
static SerializeValue(writer: SaveWriter, value: boolean): void; | ||
static Serialize(writer: ByteWriter, property: BoolProperty): void; | ||
static SerializeValue(writer: ByteWriter, value: boolean): void; | ||
} | ||
@@ -46,7 +46,7 @@ export type BytePropertyValue = { | ||
constructor(value: BytePropertyValue, ueType?: string, guidInfo?: GUID, index?: number); | ||
static Parse(reader: ByteReader, ueType: string, index?: number): ByteProperty; | ||
static ReadValue(reader: ByteReader): number; | ||
static Parse(reader: BinaryReadable, ueType: string, index?: number): ByteProperty; | ||
static ReadValue(reader: BinaryReadable): number; | ||
static CalcOverhead(property: ByteProperty): number; | ||
static Serialize(writer: SaveWriter, property: ByteProperty): void; | ||
static SerializeValue(writer: SaveWriter, value: number): void; | ||
static Serialize(writer: ByteWriter, property: ByteProperty): void; | ||
static SerializeValue(writer: ByteWriter, value: number): void; | ||
} | ||
@@ -56,7 +56,7 @@ export declare class Int8Property extends BasicProperty { | ||
constructor(value: number, ueType?: string, guidInfo?: GUID, index?: number); | ||
static Parse(reader: ByteReader, ueType: string, index?: number): Int8Property; | ||
static ReadValue(reader: ByteReader): number; | ||
static Parse(reader: BinaryReadable, ueType: string, index?: number): Int8Property; | ||
static ReadValue(reader: BinaryReadable): number; | ||
static CalcOverhead(property: Int8Property): number; | ||
static Serialize(writer: SaveWriter, property: Int8Property): void; | ||
static SerializeValue(writer: SaveWriter, value: number): void; | ||
static Serialize(writer: ByteWriter, property: Int8Property): void; | ||
static SerializeValue(writer: ByteWriter, value: number): void; | ||
} | ||
@@ -66,7 +66,7 @@ export declare class Uint8Property extends BasicProperty { | ||
constructor(value: number, ueType?: string, guidInfo?: GUID, index?: number); | ||
static Parse(reader: ByteReader, ueType: string, index?: number): Uint8Property; | ||
static ReadValue(reader: ByteReader): number; | ||
static Parse(reader: BinaryReadable, ueType: string, index?: number): Uint8Property; | ||
static ReadValue(reader: BinaryReadable): number; | ||
static CalcOverhead(property: Uint8Property): number; | ||
static Serialize(writer: SaveWriter, property: Uint8Property): void; | ||
static SerializeValue(writer: SaveWriter, value: number): void; | ||
static Serialize(writer: ByteWriter, property: Uint8Property): void; | ||
static SerializeValue(writer: ByteWriter, value: number): void; | ||
} | ||
@@ -76,7 +76,7 @@ export declare class Int32Property extends BasicProperty { | ||
constructor(value: number, ueType?: string, guidInfo?: GUID, index?: number); | ||
static Parse(reader: ByteReader, ueType: string, index?: number): Int32Property; | ||
static ReadValue(reader: ByteReader): number; | ||
static Parse(reader: BinaryReadable, ueType: string, index?: number): Int32Property; | ||
static ReadValue(reader: BinaryReadable): number; | ||
static CalcOverhead(property: Int32Property): number; | ||
static Serialize(writer: SaveWriter, property: Int32Property): void; | ||
static SerializeValue(writer: SaveWriter, value: number): void; | ||
static Serialize(writer: ByteWriter, property: Int32Property): void; | ||
static SerializeValue(writer: ByteWriter, value: number): void; | ||
} | ||
@@ -86,7 +86,7 @@ export declare class Uint32Property extends BasicProperty { | ||
constructor(value: number, ueType?: string, guidInfo?: GUID, index?: number); | ||
static Parse(reader: ByteReader, ueType: string, index?: number): Uint32Property; | ||
static ReadValue(reader: ByteReader): number; | ||
static Parse(reader: BinaryReadable, ueType: string, index?: number): Uint32Property; | ||
static ReadValue(reader: BinaryReadable): number; | ||
static CalcOverhead(property: Uint32Property): number; | ||
static Serialize(writer: SaveWriter, property: Uint32Property): void; | ||
static SerializeValue(writer: SaveWriter, value: number): void; | ||
static Serialize(writer: ByteWriter, property: Uint32Property): void; | ||
static SerializeValue(writer: ByteWriter, value: number): void; | ||
} | ||
@@ -96,7 +96,7 @@ export declare class Int64Property extends BasicProperty { | ||
constructor(value: string, ueType?: string, guidInfo?: GUID, index?: number); | ||
static Parse(reader: ByteReader, ueType: string, index?: number): Int64Property; | ||
static ReadValue(reader: ByteReader): string; | ||
static Parse(reader: BinaryReadable, ueType: string, index?: number): Int64Property; | ||
static ReadValue(reader: BinaryReadable): string; | ||
static CalcOverhead(property: Int64Property): number; | ||
static Serialize(writer: SaveWriter, property: Int64Property): void; | ||
static SerializeValue(writer: SaveWriter, value: string): void; | ||
static Serialize(writer: ByteWriter, property: Int64Property): void; | ||
static SerializeValue(writer: ByteWriter, value: string): void; | ||
} | ||
@@ -106,7 +106,7 @@ export declare class FloatProperty extends BasicProperty { | ||
constructor(value: number, ueType?: string, guidInfo?: GUID, index?: number); | ||
static Parse(reader: ByteReader, ueType: string, index?: number): FloatProperty; | ||
static Parse(reader: BinaryReadable, ueType: string, index?: number): FloatProperty; | ||
static CalcOverhead(property: FloatProperty): number; | ||
static ReadValue(reader: ByteReader): number; | ||
static Serialize(writer: SaveWriter, property: FloatProperty): void; | ||
static SerializeValue(writer: SaveWriter, value: number): void; | ||
static ReadValue(reader: BinaryReadable): number; | ||
static Serialize(writer: ByteWriter, property: FloatProperty): void; | ||
static SerializeValue(writer: ByteWriter, value: number): void; | ||
} | ||
@@ -116,7 +116,7 @@ export declare class DoubleProperty extends BasicProperty { | ||
constructor(value: number, ueType?: string, guidInfo?: GUID, index?: number); | ||
static Parse(reader: ByteReader, ueType: string, index?: number): DoubleProperty; | ||
static ReadValue(reader: ByteReader): number; | ||
static Parse(reader: BinaryReadable, ueType: string, index?: number): DoubleProperty; | ||
static ReadValue(reader: BinaryReadable): number; | ||
static CalcOverhead(property: DoubleProperty): number; | ||
static Serialize(writer: SaveWriter, property: DoubleProperty): void; | ||
static SerializeValue(writer: SaveWriter, value: number): void; | ||
static Serialize(writer: ByteWriter, property: DoubleProperty): void; | ||
static SerializeValue(writer: ByteWriter, value: number): void; | ||
} | ||
@@ -126,7 +126,7 @@ export declare class StrProperty extends BasicProperty { | ||
constructor(value: string, ueType?: string, guidInfo?: GUID, index?: number); | ||
static Parse(reader: ByteReader, ueType: string, index?: number): StrProperty; | ||
static ReadValue(reader: ByteReader): string; | ||
static Parse(reader: BinaryReadable, ueType: string, index?: number): StrProperty; | ||
static ReadValue(reader: BinaryReadable): string; | ||
static CalcOverhead(property: StrProperty): number; | ||
static Serialize(writer: SaveWriter, property: StrProperty): void; | ||
static SerializeValue(writer: SaveWriter, value: string): void; | ||
static Serialize(writer: ByteWriter, property: StrProperty): void; | ||
static SerializeValue(writer: ByteWriter, value: string): void; | ||
} | ||
@@ -136,7 +136,7 @@ export declare class ObjectProperty extends BasicProperty { | ||
constructor(value: ObjectReference, ueType?: string, guidInfo?: GUID, index?: number); | ||
static Parse(reader: ByteReader, ueType: string, index?: number): ObjectProperty; | ||
static ReadValue(reader: ByteReader): ObjectReference; | ||
static Parse(reader: BinaryReadable, ueType: string, index?: number): ObjectProperty; | ||
static ReadValue(reader: BinaryReadable): ObjectReference; | ||
static CalcOverhead(property: ObjectProperty): number; | ||
static Serialize(writer: SaveWriter, property: ObjectProperty): void; | ||
static SerializeValue(writer: SaveWriter, value: { | ||
static Serialize(writer: ByteWriter, property: ObjectProperty): void; | ||
static SerializeValue(writer: ByteWriter, value: { | ||
levelName: string; | ||
@@ -155,7 +155,7 @@ pathName: string; | ||
}, ueType?: string, guidInfo?: GUID, index?: number); | ||
static Parse(reader: ByteReader, ueType: string, index?: number): EnumProperty; | ||
static ReadValue(reader: ByteReader): string; | ||
static Parse(reader: BinaryReadable, ueType: string, index?: number): EnumProperty; | ||
static ReadValue(reader: BinaryReadable): string; | ||
static CalcOverhead(property: EnumProperty): number; | ||
static Serialize(writer: SaveWriter, property: EnumProperty): void; | ||
static SerializeValue(writer: SaveWriter, value: string): void; | ||
static Serialize(writer: ByteWriter, property: EnumProperty): void; | ||
static SerializeValue(writer: ByteWriter, value: string): void; | ||
} | ||
@@ -181,7 +181,7 @@ export type TextPropertyValue = { | ||
constructor(value: TextPropertyValue, ueType?: string, guidInfo?: GUID, index?: number); | ||
static Parse(reader: ByteReader, ueType: string, index?: number): TextProperty; | ||
static ParseValue(reader: ByteReader): TextPropertyValue; | ||
static Parse(reader: BinaryReadable, ueType: string, index?: number): TextProperty; | ||
static ParseValue(reader: BinaryReadable): TextPropertyValue; | ||
static CalcOverhead(property: TextProperty): number; | ||
static Serialize(writer: SaveWriter, property: TextProperty): void; | ||
static SerializeValue(writer: SaveWriter, value: TextPropertyValue): void; | ||
static Serialize(writer: ByteWriter, property: TextProperty): void; | ||
static SerializeValue(writer: ByteWriter, value: TextPropertyValue): void; | ||
} | ||
@@ -230,7 +230,7 @@ export type BasicMultipleStructPropertyValue = { | ||
constructor(subtype: string, ueType?: string, index?: number, guid?: number); | ||
static Parse(reader: ByteReader, ueType: string, index: number, size: number): StructProperty; | ||
static ParseValue(reader: ByteReader, subtype: string, size: number): GENERIC_STRUCT_PROPERTY_VALUE; | ||
static Parse(reader: BinaryReadable, ueType: string, index: number, size: number): StructProperty; | ||
static ParseValue(reader: BinaryReadable, subtype: string, size: number): GENERIC_STRUCT_PROPERTY_VALUE; | ||
static CalcOverhead(property: StructProperty): number; | ||
static Serialize(writer: SaveWriter, property: StructProperty): void; | ||
static SerializeValue(writer: SaveWriter, subtype: string, value: GENERIC_STRUCT_PROPERTY_VALUE): void; | ||
static Serialize(writer: ByteWriter, property: StructProperty): void; | ||
static SerializeValue(writer: ByteWriter, subtype: string, value: GENERIC_STRUCT_PROPERTY_VALUE): void; | ||
} | ||
@@ -251,5 +251,5 @@ export type ArrayPropertyStructValueFields = { | ||
constructor(subtype: string, values: T[], ueType?: string, index?: number, structValueFields?: ArrayPropertyStructValueFields | undefined); | ||
static Parse(reader: ByteReader, ueType: string, index: number, propertyName: string): ArrayProperty<any>; | ||
static Parse(reader: BinaryReadable, ueType: string, index: number, propertyName: string): ArrayProperty<any>; | ||
static CalcOverhead(property: ArrayProperty<any>): number; | ||
static Serialize(writer: SaveWriter, property: ArrayProperty<any>, propertyName: string): void; | ||
static Serialize(writer: ByteWriter, property: ArrayProperty<any>, propertyName: string): void; | ||
} | ||
@@ -260,5 +260,5 @@ export declare class SetProperty<T> extends BasicProperty { | ||
constructor(subtype: string, values: T[], ueType: string, index: number); | ||
static Parse(reader: ByteReader, ueType: string, index: number, propertyName: string): SetProperty<any>; | ||
static Parse(reader: BinaryReadable, ueType: string, index: number, propertyName: string): SetProperty<any>; | ||
static CalcOverhead(property: SetProperty<any>): number; | ||
static Serialize(writer: SaveWriter, property: SetProperty<any>): void; | ||
static Serialize(writer: ByteWriter, property: SetProperty<any>): void; | ||
} | ||
@@ -278,11 +278,11 @@ export declare class MapProperty extends BasicProperty { | ||
constructor(keyType: string, valueType: string, ueType: string, index: number); | ||
static Parse(reader: ByteReader, propertyName: string, buildVersion: number, size: number, ueType?: string, index?: number): MapProperty; | ||
static Parse(reader: BinaryReadable, propertyName: string, buildVersion: number, size: number, ueType?: string, index?: number): MapProperty; | ||
static CalcOverhead(property: MapProperty): number; | ||
static Serialize(writer: SaveWriter, property: MapProperty): void; | ||
static Serialize(writer: ByteWriter, property: MapProperty): void; | ||
} | ||
export declare const ParseDynamicStructData: (reader: ByteReader, buildVersion: number, type: string) => DynamicStructPropertyValue; | ||
export declare const SerializeDynamicStructData: (writer: SaveWriter, buildVersion: number, data: DynamicStructPropertyValue) => void; | ||
export declare const ReadFINNetworkTrace: (reader: ByteReader) => any; | ||
export declare const SerializeFINNetworkTrace: (writer: SaveWriter, obj: any) => void; | ||
export declare const ReadFINLuaProcessorStateStorage: (reader: ByteReader, size: number) => any; | ||
export declare const SerializeFINLuaProcessorStateStorage: (writer: SaveWriter, stateStorage: any) => void; | ||
export declare const ParseDynamicStructData: (reader: BinaryReadable, buildVersion: number, type: string) => DynamicStructPropertyValue; | ||
export declare const SerializeDynamicStructData: (writer: ByteWriter, buildVersion: number, data: DynamicStructPropertyValue) => void; | ||
export declare const ReadFINNetworkTrace: (reader: BinaryReadable) => any; | ||
export declare const SerializeFINNetworkTrace: (writer: ByteWriter, obj: any) => void; | ||
export declare const ReadFINLuaProcessorStateStorage: (reader: BinaryReadable, size: number) => any; | ||
export declare const SerializeFINLuaProcessorStateStorage: (writer: ByteWriter, stateStorage: any) => void; |
@@ -236,3 +236,3 @@ (function (factory) { | ||
static ReadValue(reader) { | ||
return reader.readLong().toString(); | ||
return reader.readInt64().toString(); | ||
} | ||
@@ -265,3 +265,3 @@ static CalcOverhead(property) { | ||
static ReadValue(reader) { | ||
return reader.readFloat(); | ||
return reader.readFloat32(); | ||
} | ||
@@ -552,4 +552,4 @@ static Serialize(writer, property) { | ||
instanceName: reader.readString(), | ||
offset: reader.readFloat(), | ||
forward: reader.readFloat() | ||
offset: reader.readFloat32(), | ||
forward: reader.readFloat32() | ||
}; | ||
@@ -574,3 +574,3 @@ break; | ||
value = { | ||
value: reader.readFloat() | ||
value: reader.readFloat32() | ||
}; | ||
@@ -582,3 +582,3 @@ break; | ||
case 'DateTime': | ||
value = reader.readLong().toString(); | ||
value = reader.readInt64().toString(); | ||
break; | ||
@@ -595,4 +595,4 @@ case 'FINNetworkTrace': | ||
value = { | ||
begin: reader.readLong().toString(), | ||
end: reader.readLong().toString(), | ||
begin: reader.readInt64().toString(), | ||
end: reader.readInt64().toString(), | ||
}; | ||
@@ -713,31 +713,31 @@ break; | ||
case "FloatProperty": | ||
property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(e => FloatProperty.ReadValue(reader)), ueType, index); | ||
property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(() => FloatProperty.ReadValue(reader)), ueType, index); | ||
break; | ||
case "BoolProperty": | ||
property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(e => BoolProperty.ReadValue(reader)), ueType, index); | ||
property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(() => BoolProperty.ReadValue(reader)), ueType, index); | ||
break; | ||
case "IntProperty": | ||
property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(e => Int32Property.ReadValue(reader)), ueType, index); | ||
property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(() => Int32Property.ReadValue(reader)), ueType, index); | ||
break; | ||
case "Int64Property": | ||
property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(e => Int64Property.ReadValue(reader)), ueType, index); | ||
property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(() => Int64Property.ReadValue(reader)), ueType, index); | ||
break; | ||
case "DoubleProperty": | ||
property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(e => DoubleProperty.ReadValue(reader)), ueType, index); | ||
property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(() => DoubleProperty.ReadValue(reader)), ueType, index); | ||
break; | ||
case "ByteProperty": | ||
property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(e => ByteProperty.ReadValue(reader)), ueType, index); | ||
property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(() => ByteProperty.ReadValue(reader)), ueType, index); | ||
break; | ||
case "StrProperty": | ||
property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(e => StrProperty.ReadValue(reader)), ueType, index); | ||
property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(() => StrProperty.ReadValue(reader)), ueType, index); | ||
break; | ||
case "EnumProperty": | ||
property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(e => EnumProperty.ReadValue(reader)), ueType, index); | ||
property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(() => EnumProperty.ReadValue(reader)), ueType, index); | ||
break; | ||
case "TextProperty": | ||
property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(e => TextProperty.ParseValue(reader)), ueType, index); | ||
property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(() => TextProperty.ParseValue(reader)), ueType, index); | ||
break; | ||
case "InterfaceProperty": | ||
case "ObjectProperty": | ||
property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(e => ObjectProperty.ReadValue(reader)), ueType, index); | ||
property = new ArrayProperty(subtype, new Array(elementCount).fill(0).map(() => ObjectProperty.ReadValue(reader)), ueType, index); | ||
break; | ||
@@ -769,3 +769,3 @@ case "StructProperty": | ||
const before = reader.getBufferPosition(); | ||
const maArr = new Array(elementCount).fill(0).map(e => { | ||
const maArr = new Array(elementCount).fill(0).map(() => { | ||
const struct = new StructProperty(allStructType, type, allIndex, allGuid); | ||
@@ -863,13 +863,13 @@ struct.value = StructProperty.ParseValue(reader, allStructType, binarySize); | ||
case "IntProperty": | ||
property = new SetProperty(subtype, new Array(elementCount).fill(0).map(e => Int32Property.ReadValue(reader)), ueType, index); | ||
property = new SetProperty(subtype, new Array(elementCount).fill(0).map(() => Int32Property.ReadValue(reader)), ueType, index); | ||
break; | ||
case "ObjectProperty": | ||
property = new SetProperty(subtype, new Array(elementCount).fill(0).map(e => ObjectProperty.ReadValue(reader)), ueType, index); | ||
property = new SetProperty(subtype, new Array(elementCount).fill(0).map(() => ObjectProperty.ReadValue(reader)), ueType, index); | ||
break; | ||
case "NameProperty": | ||
property = new SetProperty(subtype, new Array(elementCount).fill(0).map(e => StrProperty.ReadValue(reader)), ueType, index); | ||
property = new SetProperty(subtype, new Array(elementCount).fill(0).map(() => StrProperty.ReadValue(reader)), ueType, index); | ||
break; | ||
case "StructProperty": | ||
if (propertyName === 'mRemovalLocations') { | ||
property = new SetProperty(subtype, new Array(elementCount).fill(0).map(e => (0, util_types_1.ParseVec3)(reader)), ueType, index); | ||
property = new SetProperty(subtype, new Array(elementCount).fill(0).map(() => (0, util_types_1.ParseVec3)(reader)), ueType, index); | ||
} | ||
@@ -944,2 +944,3 @@ break; | ||
}; | ||
const pos = reader.getBufferPosition(); | ||
let propertyName = reader.readString(); | ||
@@ -946,0 +947,0 @@ while (propertyName !== 'None') { |
@@ -1,6 +0,9 @@ | ||
import { ByteReader } from "../../byte/byte-reader.class"; | ||
import { BinaryReadable } from "../../byte/binary-readable.interface"; | ||
import { ByteWriter } from "../../byte/byte-writer.class"; | ||
import { SaveObject } from "./SaveObject"; | ||
import { SaveObject, SaveObjectHeader } from "./SaveObject"; | ||
export declare const isSaveComponent: (obj: any) => obj is SaveComponent; | ||
export declare class SaveComponent extends SaveObject { | ||
export interface SaveComponentHeader extends SaveObjectHeader { | ||
parentEntityName: string; | ||
} | ||
export declare class SaveComponent extends SaveObject implements SaveComponentHeader { | ||
typePath: string; | ||
@@ -13,5 +16,5 @@ rootObject: string; | ||
constructor(typePath: string, rootObject: string, instanceName: string, parentEntityName?: string); | ||
static ParseHeader(reader: ByteReader, obj: SaveComponent): void; | ||
static ParseHeader(reader: BinaryReadable, obj: SaveComponent): void; | ||
static SerializeHeader(writer: ByteWriter, component: SaveComponent): void; | ||
static ParseData(component: SaveComponent, length: number, reader: ByteReader, buildVersion: number): void; | ||
static ParseData(component: SaveComponent, length: number, reader: BinaryReadable, buildVersion: number, typePath: string): void; | ||
} |
@@ -35,4 +35,4 @@ (function (factory) { | ||
} | ||
static ParseData(component, length, reader, buildVersion) { | ||
SaveObject_1.SaveObject.ParseData(component, length, reader, buildVersion); | ||
static ParseData(component, length, reader, buildVersion, typePath) { | ||
SaveObject_1.SaveObject.ParseData(component, length, reader, buildVersion, typePath); | ||
} | ||
@@ -39,0 +39,0 @@ } |
@@ -1,7 +0,12 @@ | ||
import { ByteReader } from "../../byte/byte-reader.class"; | ||
import { BinaryReadable } from "../../byte/binary-readable.interface"; | ||
import { ByteWriter } from "../../byte/byte-writer.class"; | ||
import { Transform } from "../structs/util.types"; | ||
import { ObjectReference } from "./ObjectReference"; | ||
import { SaveObject } from "./SaveObject"; | ||
import { SaveObject, SaveObjectHeader } from "./SaveObject"; | ||
export declare const isSaveEntity: (obj: any) => obj is SaveEntity; | ||
export interface SaveEntityHeader extends SaveObjectHeader { | ||
needTransform: boolean; | ||
transform: Transform; | ||
wasPlacedInLevel: boolean; | ||
} | ||
export declare class SaveEntity extends SaveObject { | ||
@@ -21,6 +26,6 @@ typePath: string; | ||
constructor(typePath: string, rootObject: string, instanceName: string, parentEntityName?: string, needsTransform?: boolean); | ||
static ParseHeader(reader: ByteReader, obj: SaveEntity): void; | ||
static ParseData(entity: SaveEntity, length: number, reader: ByteReader, buildVersion: number): void; | ||
static ParseHeader(reader: BinaryReadable, obj: SaveEntity): void; | ||
static ParseData(entity: SaveEntity, length: number, reader: BinaryReadable, buildVersion: number, typePath: string): void; | ||
static SerializeHeader(writer: ByteWriter, entity: SaveEntity): void; | ||
static SerializeData(writer: ByteWriter, entity: SaveEntity, buildVersion: number): void; | ||
} |
@@ -45,3 +45,3 @@ (function (factory) { | ||
} | ||
static ParseData(entity, length, reader, buildVersion) { | ||
static ParseData(entity, length, reader, buildVersion, typePath) { | ||
var newLen = length - 12; | ||
@@ -60,3 +60,3 @@ entity.parentObjectRoot = reader.readString(); | ||
} | ||
SaveObject_1.SaveObject.ParseData(entity, newLen, reader, buildVersion); | ||
return SaveObject_1.SaveObject.ParseData(entity, newLen, reader, buildVersion, typePath); | ||
} | ||
@@ -63,0 +63,0 @@ static SerializeHeader(writer, entity) { |
@@ -1,14 +0,19 @@ | ||
import { ByteReader } from "../../byte/byte-reader.class"; | ||
import { BinaryReadable } from "../../byte/binary-readable.interface"; | ||
import { ByteWriter } from "../../byte/byte-writer.class"; | ||
import { DataFields } from "./DataFields"; | ||
export declare abstract class SaveObject { | ||
export interface SaveObjectHeader { | ||
typePath: string; | ||
rootObject: string; | ||
instanceName: string; | ||
} | ||
export declare abstract class SaveObject implements SaveObjectHeader { | ||
typePath: string; | ||
rootObject: string; | ||
instanceName: string; | ||
dataFields: DataFields; | ||
constructor(typePath: string, rootObject: string, instanceName: string); | ||
protected static ParseHeader(reader: ByteReader, obj: SaveObject): void; | ||
protected static ParseHeader(reader: BinaryReadable, obj: SaveObject): void; | ||
protected static SerializeHeader(writer: ByteWriter, obj: SaveObject): void; | ||
static ParseData(obj: SaveObject, length: number, reader: ByteReader, buildVersion: number): void; | ||
static ParseData(obj: SaveObject, length: number, reader: BinaryReadable, buildVersion: number, typePath: string): void; | ||
static SerializeData(writer: any, obj: SaveObject, buildVersion: number): void; | ||
} |
@@ -31,7 +31,7 @@ (function (factory) { | ||
} | ||
static ParseData(obj, length, reader, buildVersion) { | ||
obj.dataFields = DataFields_1.DataFields.Parse(length, reader, buildVersion); | ||
static ParseData(obj, length, reader, buildVersion, typePath) { | ||
obj.dataFields = DataFields_1.DataFields.Parse(length, reader, buildVersion, typePath); | ||
} | ||
static SerializeData(writer, obj, buildVersion) { | ||
DataFields_1.DataFields.Serialize(writer, obj.dataFields, buildVersion); | ||
DataFields_1.DataFields.Serialize(writer, obj.dataFields, buildVersion, obj.typePath); | ||
} | ||
@@ -38,0 +38,0 @@ } |
@@ -1,2 +0,2 @@ | ||
import { ByteReader } from "../../byte/byte-reader.class"; | ||
import { BinaryReadable } from "../../byte/binary-readable.interface"; | ||
import { ByteWriter } from "../../byte/byte-writer.class"; | ||
@@ -15,8 +15,8 @@ import { ObjectReference } from "../objects/ObjectReference"; | ||
static WriteLevel(writer: ByteWriter, level: Level, buildVersion: number): void; | ||
static SerializeObjectContents(writer: ByteWriter, objects: (SaveEntity | SaveComponent)[], buildVersion: number): void; | ||
static ReadObjectHeaders(reader: ByteReader, objectsList: SaveObject[], onProgressCallback: (progress: number, msg?: string) => void): void; | ||
static ReadObjectContents(reader: ByteReader, objectsList: SaveObject[], buildVersion: number, onProgressCallback: (progress: number, msg?: string) => void): void; | ||
static SerializeObjectContents(writer: ByteWriter, objects: (SaveEntity | SaveComponent)[], buildVersion: number, levelName: string): void; | ||
static ReadObjectHeaders(reader: BinaryReadable, objectsList: SaveObject[], onProgressCallback: (progress: number, msg?: string) => void): void; | ||
static ReadObjectContents(reader: BinaryReadable, objectsList: SaveObject[], buildVersion: number, onProgressCallback: (progress: number, msg?: string) => void): Promise<void>; | ||
static ReadLevel(reader: SaveReader, levelName: string, buildVersion: number): Level; | ||
static SerializeCollectablesList(writer: ByteWriter, collectables: ObjectReference[]): void; | ||
static ReadCollectablesList(reader: SaveReader): ObjectReference[]; | ||
static ReadCollectablesList(reader: BinaryReadable): ObjectReference[]; | ||
} |
@@ -46,6 +46,6 @@ (function (factory) { | ||
writer.writeBinarySizeFromPosition(lenIndicatorHeaderAndCollectableSize, lenIndicatorHeaderAndCollectableSize + 4); | ||
Level.SerializeObjectContents(writer, level.objects, buildVersion); | ||
Level.SerializeObjectContents(writer, level.objects, buildVersion, level.name); | ||
Level.SerializeCollectablesList(writer, level.collectables); | ||
} | ||
static SerializeObjectContents(writer, objects, buildVersion) { | ||
static SerializeObjectContents(writer, objects, buildVersion, levelName) { | ||
const lenIndicatorEntities = writer.getBufferPosition(); | ||
@@ -91,3 +91,3 @@ writer.writeInt32(0); | ||
} | ||
static ReadObjectContents(reader, objectsList, buildVersion, onProgressCallback) { | ||
static async ReadObjectContents(reader, objectsList, buildVersion, onProgressCallback) { | ||
const binarySize = reader.readInt32(); | ||
@@ -97,3 +97,3 @@ const posBefore = reader.getBufferPosition(); | ||
if (countEntities !== objectsList.length) { | ||
throw new Error(`possibly corrupt. entity content count ${countEntities} does not object count of ${objectsList.length}`); | ||
throw new Error(`possibly corrupt. entity content count ${countEntities} does not equal object count of ${objectsList.length}`); | ||
} | ||
@@ -108,6 +108,6 @@ for (let i = 0; i < countEntities; i++) { | ||
if ((0, SaveEntity_1.isSaveEntity)(obj)) { | ||
SaveEntity_1.SaveEntity.ParseData(obj, len, reader, buildVersion); | ||
SaveEntity_1.SaveEntity.ParseData(obj, len, reader, buildVersion, obj.typePath); | ||
} | ||
else if ((0, SaveComponent_1.isSaveComponent)(obj)) { | ||
SaveComponent_1.SaveComponent.ParseData(obj, len, reader, buildVersion); | ||
SaveComponent_1.SaveComponent.ParseData(obj, len, reader, buildVersion, obj.typePath); | ||
} | ||
@@ -130,2 +130,3 @@ const after = reader.getBufferPosition(); | ||
level.collectables = Level.ReadCollectablesList(reader); | ||
console.log(`before object contents buffer pos ${reader.getBufferPosition()}`); | ||
Level.ReadObjectContents(reader, level.objects, buildVersion, reader.onProgressCallback); | ||
@@ -132,0 +133,0 @@ reader.onProgressCallback(reader.getBufferProgress()); |
import { ByteReader } from "../../byte/byte-reader.class"; | ||
import { ChunkCompressionInfo } from "../../file.types"; | ||
import { SaveStreamWriter } from "../../stream/save-stream-writer.class"; | ||
import { ObjectReference } from "../objects/ObjectReference"; | ||
import { SaveComponent } from "../objects/SaveComponent"; | ||
import { SaveEntity } from "../objects/SaveEntity"; | ||
import { SaveObject } from "../objects/SaveObject"; | ||
import { Level } from "./level.class"; | ||
@@ -18,2 +18,4 @@ import { SatisfactorySaveHeader } from "./save.types"; | ||
export declare const projectionFilterApplies: (config: SaveProjectionConfig, object: SaveComponent | SaveEntity) => boolean; | ||
export type ReadMode = 'stream' | 'whole'; | ||
export declare const DEFAULT_SATISFACTORY_CHUNK_HEADER_SIZE = 48; | ||
export declare class SaveReader extends ByteReader { | ||
@@ -33,14 +35,3 @@ onProgressCallback: (progress: number, msg?: string) => void; | ||
readLevels(): Level[]; | ||
readLevelsAsynchronously(writer: SaveStreamWriter): Promise<Level[]>; | ||
} | ||
export declare class Conveyor { | ||
static getConveyorBeltRegex(): RegExp; | ||
static getConveyorLiftRegex(): RegExp; | ||
static isAConveyorBelt(obj: SaveObject): boolean; | ||
static isAConveyorLift(obj: SaveObject): boolean; | ||
static get availableConnections(): string[]; | ||
static get availableConveyorBelts(): string[]; | ||
static get availableConveyorLifts(): string[]; | ||
static isConveyor(currentObject: any): boolean; | ||
static isConveyorBelt(currentObject: any): boolean; | ||
static isConveyorLift(currentObject: any): boolean; | ||
} |
@@ -10,3 +10,3 @@ var __importDefault = (this && this.__importDefault) || function (mod) { | ||
else if (typeof define === "function" && define.amd) { | ||
define(["require", "exports", "pako", "../../byte/alignment.enum", "../../byte/byte-reader.class", "../../error/parser.error", "../objects/SaveComponent", "../objects/SaveEntity", "./level.class"], factory); | ||
define(["require", "exports", "pako", "../../byte/alignment.enum", "../../byte/byte-reader.class", "../../error/parser.error", "../objects/SaveComponent", "../objects/SaveEntity", "./asynchronous-level.class", "./level.class"], factory); | ||
} | ||
@@ -16,3 +16,3 @@ })(function (require, exports) { | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Conveyor = exports.SaveReader = exports.projectionFilterApplies = void 0; | ||
exports.SaveReader = exports.DEFAULT_SATISFACTORY_CHUNK_HEADER_SIZE = exports.projectionFilterApplies = void 0; | ||
const pako_1 = __importDefault(require("pako")); | ||
@@ -24,2 +24,3 @@ const alignment_enum_1 = require("../../byte/alignment.enum"); | ||
const SaveEntity_1 = require("../objects/SaveEntity"); | ||
const asynchronous_level_class_1 = require("./asynchronous-level.class"); | ||
const level_class_1 = require("./level.class"); | ||
@@ -44,2 +45,3 @@ const projectionFilterApplies = (config, object) => { | ||
exports.projectionFilterApplies = projectionFilterApplies; | ||
exports.DEFAULT_SATISFACTORY_CHUNK_HEADER_SIZE = 48; | ||
class SaveReader extends byte_reader_class_1.ByteReader { | ||
@@ -54,3 +56,3 @@ constructor(fileBuffer, onProgressCallback = () => { }) { | ||
maxChunkContentSize: 0, | ||
chunkHeaderSize: 48 | ||
chunkHeaderSize: exports.DEFAULT_SATISFACTORY_CHUNK_HEADER_SIZE | ||
}; | ||
@@ -176,74 +178,17 @@ } | ||
} | ||
async readLevelsAsynchronously(writer) { | ||
const numSubLevels = this.readInt32(); | ||
this.levels = new Array(numSubLevels + 1); | ||
await writer.openLevels(); | ||
for (let j = 0; j <= numSubLevels; j++) { | ||
let levelName = (j === numSubLevels) ? '' + this.header.mapName : this.readString(); | ||
this.onProgressCallback(this.getBufferProgress(), `reading level [${(j + 1)}/${(numSubLevels + 1)}] ${levelName}`); | ||
this.levels[j] = await asynchronous_level_class_1.AsynchronousLevel.StreamReadLevel(this, levelName, this.header.buildVersion, writer); | ||
} | ||
await writer.endLevels(); | ||
return this.levels; | ||
} | ||
} | ||
SaveReader.EPOCH_TICKS = 621355968000000000n; | ||
exports.SaveReader = SaveReader; | ||
class Conveyor { | ||
static getConveyorBeltRegex() { | ||
return /\/Game\/FactoryGame\/Buildable\/Factory\/(ConveyorBeltMk[0-9]+)\/Build_(\1)\.Build_(\1)_C/g; | ||
} | ||
; | ||
static getConveyorLiftRegex() { | ||
return /\/Game\/FactoryGame\/Buildable\/Factory\/(ConveyorLiftMk[0-9]+)\/Build_(\1)\.Build_(\1)_C/g; | ||
} | ||
; | ||
static isAConveyorBelt(obj) { | ||
return obj.typePath.match(this.getConveyorBeltRegex()) !== null; | ||
} | ||
static isAConveyorLift(obj) { | ||
return obj.typePath.match(this.getConveyorLiftRegex()) !== null; | ||
} | ||
static get availableConnections() { return ['.ConveyorAny0', '.ConveyorAny1', '.Input0', '.Input1', '.Input2', '.Input3', '.InPut3', '.Input4', '.Input5', '.Input6', '.Output0', '.Output1', '.Output2', '.Output3']; } | ||
static get availableConveyorBelts() { | ||
return [ | ||
'/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk1/Build_ConveyorBeltMk1.Build_ConveyorBeltMk1_C', | ||
'/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk2/Build_ConveyorBeltMk2.Build_ConveyorBeltMk2_C', | ||
'/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk3/Build_ConveyorBeltMk3.Build_ConveyorBeltMk3_C', | ||
'/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk4/Build_ConveyorBeltMk4.Build_ConveyorBeltMk4_C', | ||
'/Game/FactoryGame/Buildable/Factory/ConveyorBeltMk5/Build_ConveyorBeltMk5.Build_ConveyorBeltMk5_C' | ||
]; | ||
} | ||
static get availableConveyorLifts() { | ||
return [ | ||
'/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk1/Build_ConveyorLiftMk1.Build_ConveyorLiftMk1_C', | ||
'/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk2/Build_ConveyorLiftMk2.Build_ConveyorLiftMk2_C', | ||
'/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk3/Build_ConveyorLiftMk3.Build_ConveyorLiftMk3_C', | ||
'/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk4/Build_ConveyorLiftMk4.Build_ConveyorLiftMk4_C', | ||
'/Game/FactoryGame/Buildable/Factory/ConveyorLiftMk5/Build_ConveyorLiftMk5.Build_ConveyorLiftMk5_C' | ||
]; | ||
} | ||
static isConveyor(currentObject) { | ||
return Conveyor.isConveyorBelt(currentObject) || Conveyor.isConveyorLift(currentObject); | ||
} | ||
static isConveyorBelt(currentObject) { | ||
if (Conveyor.availableConveyorBelts.includes(currentObject.className)) { | ||
return true; | ||
} | ||
if (currentObject.className.startsWith('/Conveyors_Mod/Build_BeltMk') | ||
|| currentObject.className.startsWith('/Game/Conveyors_Mod/Build_BeltMk') | ||
|| currentObject.className.startsWith('/UltraFastLogistics/Buildable/build_conveyorbeltMK') | ||
|| currentObject.className.startsWith('/FlexSplines/Conveyor/Build_Belt') | ||
|| currentObject.className.startsWith('/conveyorbeltmod/Belt/mk') | ||
|| currentObject.className.startsWith('/minerplus/content/buildable/Factory/belt_') | ||
|| currentObject.className.startsWith('/bamfp/content/buildable/Factory/belt_')) { | ||
return true; | ||
} | ||
return false; | ||
} | ||
static isConveyorLift(currentObject) { | ||
if (Conveyor.availableConveyorLifts.includes(currentObject.className)) { | ||
return true; | ||
} | ||
if (currentObject.className.startsWith('/minerplus/content/buildable/Factory/lift') | ||
|| currentObject.className.startsWith('/bamfp/content/buildable/Factory/lift') | ||
|| currentObject.className.startsWith('/Game/Conveyors_Mod/Build_LiftMk') | ||
|| currentObject.className.startsWith('/Conveyors_Mod/Build_LiftMk') | ||
|| currentObject.className.startsWith('/Game/CoveredConveyor') | ||
|| currentObject.className.startsWith('/CoveredConveyor') | ||
|| currentObject.className.startsWith('/conveyorbeltmod/lift/')) { | ||
return true; | ||
} | ||
return false; | ||
} | ||
} | ||
exports.Conveyor = Conveyor; | ||
}); |
@@ -1,2 +0,2 @@ | ||
import { ByteReader } from "../../byte/byte-reader.class"; | ||
import { BinaryReadable } from "../../byte/binary-readable.interface"; | ||
import { ByteWriter } from "../../byte/byte-writer.class"; | ||
@@ -10,9 +10,9 @@ export type col4 = { | ||
export declare const SerializeCol4RGBA: (writer: ByteWriter, value: col4) => void; | ||
export declare const ParseCol4RGBA: (reader: ByteReader) => col4; | ||
export declare const ParseCol4RGBA: (reader: BinaryReadable) => col4; | ||
export declare const SerializeCol4BGRA: (writer: ByteWriter, value: col4) => void; | ||
export declare const ParseCol4BGRA: (reader: ByteReader) => col4; | ||
export declare const ParseCol4BGRA: (reader: BinaryReadable) => col4; | ||
export type vec4 = vec3 & { | ||
w: number; | ||
}; | ||
export declare const ParseVec4: (reader: ByteReader) => vec4; | ||
export declare const ParseVec4: (reader: BinaryReadable) => vec4; | ||
export declare const SerializeVec4: (writer: ByteWriter, vec: vec4) => void; | ||
@@ -27,3 +27,3 @@ export declare const sub: (other: vec3, vec: vec3) => vec3; | ||
}; | ||
export declare const ParseVec3: (reader: ByteReader) => vec3; | ||
export declare const ParseVec3: (reader: BinaryReadable) => vec3; | ||
export declare const SerializeVec3: (writer: ByteWriter, vec: vec3) => void; | ||
@@ -34,3 +34,3 @@ export type vec2 = { | ||
}; | ||
export declare const ParseVec2: (reader: ByteReader) => vec2; | ||
export declare const ParseVec2: (reader: BinaryReadable) => vec2; | ||
export declare const SerializeVec2: (writer: ByteWriter, vec: vec2) => void; | ||
@@ -42,3 +42,3 @@ export type Transform = { | ||
}; | ||
export declare const ParseTransform: (reader: ByteReader) => Transform; | ||
export declare const ParseTransform: (reader: BinaryReadable) => Transform; | ||
export declare const SerializeTransform: (writer: ByteWriter, transform: Transform) => void; |
@@ -22,6 +22,6 @@ (function (factory) { | ||
return { | ||
r: reader.readFloat(), | ||
g: reader.readFloat(), | ||
b: reader.readFloat(), | ||
a: reader.readFloat(), | ||
r: reader.readFloat32(), | ||
g: reader.readFloat32(), | ||
b: reader.readFloat32(), | ||
a: reader.readFloat32(), | ||
}; | ||
@@ -48,4 +48,4 @@ }; | ||
return { | ||
...(0, exports.ParseVec3)(reader), | ||
w: reader.readFloat() | ||
...((0, exports.ParseVec3)(reader)), | ||
w: reader.readFloat32() | ||
}; | ||
@@ -71,4 +71,4 @@ }; | ||
return { | ||
...(0, exports.ParseVec2)(reader), | ||
z: reader.readFloat() | ||
...((0, exports.ParseVec2)(reader)), | ||
z: reader.readFloat32() | ||
}; | ||
@@ -84,4 +84,4 @@ }; | ||
return { | ||
x: reader.readFloat(), | ||
y: reader.readFloat(), | ||
x: reader.readFloat32(), | ||
y: reader.readFloat32(), | ||
}; | ||
@@ -88,0 +88,0 @@ }; |
@@ -0,0 +0,0 @@ MIT License |
{ | ||
"name": "@etothepii/satisfactory-file-parser", | ||
"author": "etothepii", | ||
"version": "0.0.31", | ||
"version": "0.0.32", | ||
"description": "A file parser for satisfactory files. Includes save files and blueprint files.", | ||
@@ -37,2 +37,4 @@ "types": "./build/index.d.ts", | ||
"jest": "^29.5.0", | ||
"json-stream-stringify": "^3.0.1", | ||
"JSONStream": "^1.3.5", | ||
"npm-dts": "^1.3.12", | ||
@@ -39,0 +41,0 @@ "ts-jest": "^29.0.5", |
@@ -0,0 +0,0 @@ # Satisfactory File Parser |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
243394
69
4942
0
14