satisfactory-json
Advanced tools
Comparing version 0.0.40 to 0.0.41
@@ -58,5 +58,5 @@ "use strict"; | ||
.loop('_itemCount', function (builder) { | ||
builder.obj('#_index'); | ||
builder.elem('_index'); | ||
TextProperty_1.transformFText(builder); | ||
builder.endObj(); | ||
builder.endElem(); | ||
}) | ||
@@ -89,54 +89,68 @@ .endArr(); | ||
.loop('_itemCount', function (builder) { | ||
// Handle special cases for Guid and LinearColor | ||
// Handle special cases for InventoryItem(FicsIt-Networks mod), Guid and LinearColor | ||
builder.if(function (ctx) { | ||
return ctx.parent !== undefined && | ||
ctx.parent.obj.structInnerType === 'Guid'; | ||
ctx.parent.obj.structInnerType === 'InventoryItem'; | ||
}, function (builder) { | ||
builder.hex('#_index', 16); | ||
builder | ||
.elem('_index') | ||
.str('unk1', false) | ||
.str('itemName') | ||
.str('levelName') | ||
.str('pathName') | ||
// The Inventory Item is stored here without properties | ||
.endElem(); | ||
}, function (builder) { | ||
// else | ||
builder.if(function (ctx) { | ||
return ctx.parent !== undefined && | ||
ctx.parent.obj.structInnerType === 'LinearColor'; | ||
ctx.parent.obj.structInnerType === 'Guid'; | ||
}, function (builder) { | ||
builder | ||
.elem('_index') | ||
.float('r') | ||
.float('g') | ||
.float('b') | ||
.float('a') | ||
.endElem(); | ||
builder.hex('#_index', 16); | ||
}, function (builder) { | ||
// else | ||
builder | ||
.elem('_index') | ||
// parse inner properties | ||
// TODO fix loop for writing | ||
.arr('properties') | ||
.exec(function (ctx) { | ||
return (ctx.tmp._propertiesCount = ctx.isLoading | ||
? 999999999 | ||
: ctx.obj.length); | ||
}) | ||
.loop('_propertiesCount', function (builder) { | ||
builder.if(function (ctx) { | ||
return ctx.parent !== undefined && | ||
ctx.parent.obj.structInnerType === 'LinearColor'; | ||
}, function (builder) { | ||
builder | ||
.elem('_index') | ||
.float('r') | ||
.float('g') | ||
.float('b') | ||
.float('a') | ||
.endElem(); | ||
}, function (builder) { | ||
// else | ||
builder | ||
.elem('_index') | ||
// parse inner properties | ||
// TODO fix loop for writing | ||
.arr('properties') | ||
.exec(function (ctx) { | ||
if (!ctx.isLoading) { | ||
ctx.tmp._name = ctx.obj[ctx.tmp._index].name; | ||
} | ||
return (ctx.tmp._propertiesCount = ctx.isLoading | ||
? 999999999 | ||
: ctx.obj.length); | ||
}) | ||
.str('_name') | ||
.if(function (ctx) { return ctx.tmp._name === 'None'; }, function (builder) { return builder.break(); }) | ||
.elem('_index') | ||
.exec(function (ctx) { return (ctx.obj.name = ctx.tmp._name); }) | ||
.call(TransformationEngine_1.RegisteredFunction.transformProperty) | ||
.loop('_propertiesCount', function (builder) { | ||
builder | ||
.exec(function (ctx) { | ||
if (!ctx.isLoading) { | ||
ctx.tmp._name = ctx.obj[ctx.tmp._index].name; | ||
} | ||
}) | ||
.str('_name') | ||
.if(function (ctx) { return ctx.tmp._name === 'None'; }, function (builder) { return builder.break(); }) | ||
.elem('_index') | ||
.exec(function (ctx) { return (ctx.obj.name = ctx.tmp._name); }) | ||
.call(TransformationEngine_1.RegisteredFunction.transformProperty) | ||
.endElem(); | ||
}) | ||
.if(function (ctx) { return !ctx.isLoading; }, function (builder) { | ||
builder | ||
.exec(function (ctx) { return (ctx.tmp._none = 'None'); }) | ||
.str('_none'); | ||
}) | ||
.endArr() | ||
.endElem(); | ||
}) | ||
.if(function (ctx) { return !ctx.isLoading; }, function (builder) { | ||
builder | ||
.exec(function (ctx) { return (ctx.tmp._none = 'None'); }) | ||
.str('_none'); | ||
}) | ||
.endArr() | ||
.endElem(); | ||
}); | ||
}); | ||
@@ -143,0 +157,0 @@ }); |
@@ -21,2 +21,10 @@ "use strict"; | ||
}, | ||
ObjectProperty: function (builder) { | ||
builder | ||
.arr('values') | ||
.loop('_itemCount', function (builder) { | ||
builder.elem('_index').str('levelName').str('pathName').endElem(); | ||
}) | ||
.endArr(); | ||
}, | ||
$default: function (builder) { | ||
@@ -23,0 +31,0 @@ builder.error(function (ctx) { return "Unknown set type: " + ctx.obj.type; }); |
@@ -16,2 +16,3 @@ "use strict"; | ||
var SlateBrush_1 = require("./structs/SlateBrush"); | ||
var Vector2D_1 = require("./structs/Vector2D"); | ||
function transformStructProperty(builder) { | ||
@@ -57,2 +58,3 @@ builder | ||
EnabledCheats: function (builder) { return ArbitraryStruct_1.transformArbitraryStruct(builder); }, | ||
Vector2D: function (builder) { return Vector2D_1.transformVector2D(builder); }, | ||
$default: function (builder) { | ||
@@ -59,0 +61,0 @@ return builder.error(function (ctx) { return "Unknown struct property: " + ctx.obj.type; }); |
{ | ||
"name": "satisfactory-json", | ||
"version": "0.0.40", | ||
"version": "0.0.41", | ||
"description": "Convert Satisfactory save files to JSON and back", | ||
@@ -13,4 +13,4 @@ "author": "ficsit-felix", | ||
"@types/pako": "^1.0.1", | ||
"@typescript-eslint/eslint-plugin": "^2.33.0", | ||
"@typescript-eslint/parser": "^2.33.0", | ||
"@typescript-eslint/eslint-plugin": "^3.9.0", | ||
"@typescript-eslint/parser": "^3.9.0", | ||
"commander": "^6.0.0", | ||
@@ -17,0 +17,0 @@ "eslint": "^7.0.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
353937
157
6082