Innital concept

Innital draft for diffrent shaped science packs.
This commit is contained in:
Hornwitser 2019-12-04 12:01:39 +01:00
commit f58ffe3d56
14 changed files with 152 additions and 0 deletions

9
.gitignore vendored Normal file
View file

@ -0,0 +1,9 @@
# Default build dir
/dist/
# Node.js files
/node_modules/
package-lock.json
# Blender backup files
*.blend[1-9]

77
build.js Normal file
View file

@ -0,0 +1,77 @@
"use strict";
const events = require("events");
const fs = require("fs-extra");
const JSZip = require("jszip");
const klaw = require("klaw");
const path = require("path");
const yargs = require("yargs");
async function main() {
const args = yargs
.scriptName("build")
.options({
'clean': { describe: "Remove previous builds", type: 'boolean', default: false },
'build': { describe: "Build mod", type: 'boolean', default: true },
'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" },
})
.argv
;
let info = JSON.parse(await fs.readFile(path.join(args.sourceDir, "info.json")));
if (args.clean) {
let splitter = /^(.*)_(\d+\.\d+\.\d+)(\.zip)?$/
for (let entry of await fs.readdir(args.outputDir)) {
let match = splitter.exec(entry);
if (match) {
let [, name, version] = match;
if (name === info.name) {
let modPath = path.join(args.outputDir, entry);
console.log(`Removing ${modPath}`);
await fs.remove(modPath);
}
}
}
}
if (args.build) {
await fs.ensureDir(args.outputDir);
let modName = `${info.name}_${info.version}`;
if (args.pack) {
let zip = new JSZip();
let walker = klaw(args.sourceDir)
.on('data', item => {
if (item.stats.isFile()) {
// On Windows the path created uses backslashes as the directory sepparator
// but the zip file needs to use forward slashes. We can't use the posix
// version of relative here as it doesn't work with Windows style paths.
let basePath = path.relative(args.sourceDir, item.path).replace(/\\/g, "/");
zip.file(path.posix.join(modName, basePath), fs.createReadStream(item.path));
}
});
await events.once(walker, 'end');
let modPath = path.join(args.outputDir, `${modName}.zip`);
console.log(`Writing ${modPath}`);
let writeStream = zip.generateNodeStream().pipe(fs.createWriteStream(modPath));
await events.once(writeStream, 'finish');
} else {
let modDir = path.join(args.outputDir, modName);
if (await fs.exists(modDir)) {
console.log(`Removing existing build ${modDir}`);
await fs.remove(modDir);
}
console.log(`Building ${modDir}`);
await fs.copy(args.sourceDir, modDir);
}
}
}
if (module === require.main) {
main().catch(err => { console.log(err) });
}

BIN
model.blend Normal file

Binary file not shown.

14
package.json Normal file
View file

@ -0,0 +1,14 @@
{
"name": "clusterioMod",
"repository": "https://github.com/Danielv123/factorioClusterioMod",
"license": "MIT",
"engines": {
"node": ">=10"
},
"dependencies": {
"fs-extra": "^6.0.1",
"jszip": "^3.2.2",
"klaw": "^3.0.0",
"yargs": "^14.2.2"
}
}

43
src/data.lua Normal file
View file

@ -0,0 +1,43 @@
local items = {
["automation-science-pack"] = {
icon_size = 256,
icon = "__cb-science__/graphics/red.png",
},
["logistic-science-pack"] = {
icon_size = 256,
icon = "__cb-science__/graphics/green.png",
},
["military-science-pack"] = {
icon_size = 256,
icon = "__cb-science__/graphics/black.png",
},
["chemical-science-pack"] = {
icon_size = 256,
icon = "__cb-science__/graphics/cyan.png",
},
["production-science-pack"] = {
icon_size = 256,
icon = "__cb-science__/graphics/purple.png",
},
["utility-science-pack"] = {
icon_size = 256,
icon = "__cb-science__/graphics/yellow.png",
},
["space-science-pack"] = {
icon_size = 256,
icon = "__cb-science__/graphics/white.png",
},
}
for name, definition in pairs(items) do
print(name)
for property, value in pairs(definition) do
if data.raw.technology[name] then
print("setting tech "..name.." property "..property)
data.raw.technology[name][property] = value
end
if data.raw.tool[name] then
data.raw.tool[name][property] = value
end
end
end

BIN
src/graphics/black.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 69 KiB

BIN
src/graphics/cyan.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

BIN
src/graphics/green.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 78 KiB

BIN
src/graphics/purple.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

BIN
src/graphics/red.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

BIN
src/graphics/white.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 61 KiB

BIN
src/graphics/yellow.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 87 KiB

9
src/info.json Normal file
View file

@ -0,0 +1,9 @@
{
"name": "cb-science",
"version": "0.1.0",
"title": "Colour Blind Science",
"author": "Hornwitser",
"contact": "Hornwitser#6431 on Discord",
"description": "Alternative icons for science packs",
"factorio_version": "0.17"
}

BIN
src/thumbnail.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 306 KiB