Skip to content

Commit

Permalink
Merge pull request #48 from Hornwitser/support-0.18
Browse files Browse the repository at this point in the history
Add back support for Factorio 0.18.x
  • Loading branch information
Hornwitser authored Apr 6, 2020
2 parents 716fa38 + 2307813 commit 16f3cfc
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
14 changes: 14 additions & 0 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,24 @@ async function main() {
'pack': { describe: "Pack into zip file", type: 'boolean', default: true },
'source-dir': { describe: "Path to mod source directory", nargs: 1, type: 'string', default: "src" },
'output-dir': { describe: "Path to output built mod", nargs: 1, type: 'string', default: "dist" },
'bump-patch': { describe: "Increment patch number of build", type: 'boolean', default: false },
'factorio-version': { describe: "Override factorio_version", type: 'string' },
})
.argv
;

let info = JSON.parse(await fs.readFile(path.join(args.sourceDir, "info.json")));

if (args.bumpPatch) {
let [major, minor, patch] = info.version.split(".");
patch = String(Number.parseInt(patch, 10) + 1);
info.version = [major, minor, patch].join(".");
}

if (args.factorioVersion) {
info.factorio_version = args.factorioVersion;
}

if (args.clean) {
let splitter = /^(.*)_(\d+\.\d+\.\d+)(\.zip)?$/
for (let entry of await fs.readdir(args.outputDir)) {
Expand Down Expand Up @@ -54,6 +66,7 @@ async function main() {
}
});
await events.once(walker, 'end');
zip.file(path.posix.join(modName, "info.json"), JSON.stringify(info, null, 4));

let modPath = path.join(args.outputDir, `${modName}.zip`);
console.log(`Writing ${modPath}`);
Expand All @@ -68,6 +81,7 @@ async function main() {
}
console.log(`Building ${modDir}`);
await fs.copy(args.sourceDir, modDir);
await fs.writeFile(path.join(modDir, "info.json"), JSON.stringify(info, null, 4));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Version: 2.0.0
Changes:
- Renamed mod to Subspace Storage.
- Ported to Clusterio 2.0.
- Reverted back to supporting Factorio 0.17.
- Added support for both 0.17 and 0.18.
---------------------------------------------------------------------------------------------------
Version: 1.17.1
Date: 03. 10. 2020
Expand Down
8 changes: 4 additions & 4 deletions src/data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ function MakeLogisticEntity(entity, name, pictureFilename, pictureTablePath, ico
type = "item",
name = name,
icon = entity.icon,
icon_size = 32,
icon_size = entity.icon_size,
flags = {},
subgroup = "liquid-subgroup",
order = "a[items]-b["..name.."]",
Expand Down Expand Up @@ -295,7 +295,7 @@ data:extend({
type = "item",
name = INPUT_ELECTRICITY_NAME,
icon = putElectricity.icon,
icon_size = 32,
icon_size = putElectricity.icon_size,
flags = {},
subgroup = "electric-subgroup",
order = "a[items]-b["..INPUT_ELECTRICITY_NAME.."]",
Expand All @@ -321,7 +321,7 @@ data:extend({
type = "item",
name = OUTPUT_ELECTRICITY_NAME,
icon = putElectricity.icon,
icon_size = 32,
icon_size = putElectricity.icon_size,
flags = {},
subgroup = "electric-subgroup",
order = "a[items]-b["..OUTPUT_ELECTRICITY_NAME.."]",
Expand Down Expand Up @@ -376,7 +376,7 @@ data:extend{
type = "item",
name = INV_COMBINATOR_NAME,
icon = inv.icon,
icon_size = 32,
icon_size = inv.icon_size,
flags = {},
subgroup = "signal-subgroup",
place_result=INV_COMBINATOR_NAME,
Expand Down
2 changes: 1 addition & 1 deletion src/info.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "subspace_storage",
"version": "1.99.0",
"version": "1.99.1",
"title": "Subspace Storage (Alpha)",
"author": "Clusterio Team",
"homepage": "https://github.com/clusterio/factorioClusterio",
Expand Down

0 comments on commit 16f3cfc

Please sign in to comment.