mirror of
https://github.com/tobspr/shapez.io.git
synced 2025-06-13 13:04:03 +00:00
Include private artifacts in standalone builds
This commit is contained in:
parent
7c22ff3081
commit
fd406b7a03
@ -10,8 +10,6 @@ const steam = require('./steam');
|
|||||||
const isDev = process.argv.indexOf("--dev") >= 0;
|
const isDev = process.argv.indexOf("--dev") >= 0;
|
||||||
const isLocal = process.argv.indexOf("--local") >= 0;
|
const isLocal = process.argv.indexOf("--local") >= 0;
|
||||||
|
|
||||||
steam.init(isDev);
|
|
||||||
|
|
||||||
const roamingFolder =
|
const roamingFolder =
|
||||||
process.env.APPDATA ||
|
process.env.APPDATA ||
|
||||||
(process.platform == "darwin"
|
(process.platform == "darwin"
|
||||||
@ -226,4 +224,5 @@ ipcMain.on("fs-sync-job", (event, arg) => {
|
|||||||
event.returnValue = result;
|
event.returnValue = result;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
steam.init(isDev);
|
||||||
steam.listen();
|
steam.listen();
|
||||||
|
6
electron/package-lock.json
generated
6
electron/package-lock.json
generated
@ -788,7 +788,8 @@
|
|||||||
},
|
},
|
||||||
"node_modules/shapez.io-private-artifacts": {
|
"node_modules/shapez.io-private-artifacts": {
|
||||||
"version": "0.1.0",
|
"version": "0.1.0",
|
||||||
"resolved": "git+ssh://git@github.com/tobspr/shapez.io-private-artifacts.git#af8d792fe1429af95d990bba4a68362c2aa907c9",
|
"resolved": "git+ssh://git@github.com/tobspr/shapez.io-private-artifacts.git",
|
||||||
|
"integrity": "sha512-Sp3JL2gSJloqkZ5hINBTcrFomwnCD0mguuRMfJb91SkcZfZuySPEtfi7m2S+96GedA1BI6+gLygDRY217ElTFg==",
|
||||||
"license": "UNLICENSED",
|
"license": "UNLICENSED",
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
@ -1544,7 +1545,8 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"shapez.io-private-artifacts": {
|
"shapez.io-private-artifacts": {
|
||||||
"version": "git+ssh://git@github.com/tobspr/shapez.io-private-artifacts.git#af8d792fe1429af95d990bba4a68362c2aa907c9",
|
"version": "git+ssh://git@github.com/tobspr/shapez.io-private-artifacts.git",
|
||||||
|
"integrity": "sha512-Sp3JL2gSJloqkZ5hINBTcrFomwnCD0mguuRMfJb91SkcZfZuySPEtfi7m2S+96GedA1BI6+gLygDRY217ElTFg==",
|
||||||
"from": "shapez.io-private-artifacts@github:tobspr/shapez.io-private-artifacts",
|
"from": "shapez.io-private-artifacts@github:tobspr/shapez.io-private-artifacts",
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
|
@ -8,9 +8,10 @@ let initialized = false;
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
greenworks = require("shapez.io-private-artifacts/steam/greenworks");
|
greenworks = require("shapez.io-private-artifacts/steam/greenworks");
|
||||||
appId = fs.readFileSync(path.join(__dirname, "steam_appid.txt"), "utf8");
|
appId = parseInt(fs.readFileSync(path.join(__dirname, "steam_appid.txt"), "utf8"));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// greenworks is not installed
|
// greenworks is not installed
|
||||||
|
// throw err;
|
||||||
}
|
}
|
||||||
|
|
||||||
function init (isDev) {
|
function init (isDev) {
|
||||||
@ -26,7 +27,7 @@ function init (isDev) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!greenworks.init()) {
|
if (!greenworks.init()) {
|
||||||
console.error("Failed to initialize greenworks");
|
console.log("Failed to initialize greenworks");
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -36,7 +37,8 @@ function init (isDev) {
|
|||||||
function listen () {
|
function listen () {
|
||||||
ipcMain.handle("steam:is-initialized", isInitialized);
|
ipcMain.handle("steam:is-initialized", isInitialized);
|
||||||
|
|
||||||
if (!greenworks) {
|
if (!greenworks || !initialized) {
|
||||||
|
console.log("Ignoring Steam IPC events");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -499,7 +499,8 @@
|
|||||||
"type-fest" "^0.13.1"
|
"type-fest" "^0.13.1"
|
||||||
|
|
||||||
"shapez.io-private-artifacts@github:tobspr/shapez.io-private-artifacts":
|
"shapez.io-private-artifacts@github:tobspr/shapez.io-private-artifacts":
|
||||||
"resolved" "git+ssh://git@github.com/tobspr/shapez.io-private-artifacts.git#af8d792fe1429af95d990bba4a68362c2aa907c9"
|
"integrity" "sha512-Sp3JL2gSJloqkZ5hINBTcrFomwnCD0mguuRMfJb91SkcZfZuySPEtfi7m2S+96GedA1BI6+gLygDRY217ElTFg=="
|
||||||
|
"resolved" "git+ssh://git@github.com/tobspr/shapez.io-private-artifacts.git"
|
||||||
"version" "0.1.0"
|
"version" "0.1.0"
|
||||||
|
|
||||||
"sprintf-js@^1.1.2":
|
"sprintf-js@^1.1.2":
|
||||||
|
@ -21,7 +21,7 @@ function gulptasksCSS($, gulp, buildFolder, browserSync) {
|
|||||||
const plugins = [postcssAssetsPlugin(cachebust)];
|
const plugins = [postcssAssetsPlugin(cachebust)];
|
||||||
if (prod) {
|
if (prod) {
|
||||||
plugins.unshift(
|
plugins.unshift(
|
||||||
$.postcssUnprefix(),
|
// $.postcssUnprefix(),
|
||||||
$.postcssPresetEnv({
|
$.postcssPresetEnv({
|
||||||
browsers: ["> 0.1%"],
|
browsers: ["> 0.1%"],
|
||||||
})
|
})
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
require("colors");
|
require("colors");
|
||||||
const packager = require("electron-packager");
|
const packager = require("electron-packager");
|
||||||
|
const pj = require("../electron/package.json");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
const { getVersion } = require("./buildutils");
|
const { getVersion } = require("./buildutils");
|
||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
@ -20,9 +21,9 @@ function gulptasksStandalone($, gulp) {
|
|||||||
gulp.task("standalone.prepare.copyPrefab", () => {
|
gulp.task("standalone.prepare.copyPrefab", () => {
|
||||||
// const requiredFiles = $.glob.sync("../electron/");
|
// const requiredFiles = $.glob.sync("../electron/");
|
||||||
const requiredFiles = [
|
const requiredFiles = [
|
||||||
path.join(electronBaseDir, "lib", "**", "*.node"),
|
|
||||||
path.join(electronBaseDir, "node_modules", "**", "*.*"),
|
path.join(electronBaseDir, "node_modules", "**", "*.*"),
|
||||||
path.join(electronBaseDir, "node_modules", "**", ".*"),
|
path.join(electronBaseDir, "node_modules", "**", ".*"),
|
||||||
|
// path.join(electronBaseDir, "steam_appid.txt"),
|
||||||
path.join(electronBaseDir, "favicon*"),
|
path.join(electronBaseDir, "favicon*"),
|
||||||
|
|
||||||
// fails on platforms which support symlinks
|
// fails on platforms which support symlinks
|
||||||
@ -33,18 +34,13 @@ function gulptasksStandalone($, gulp) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
gulp.task("standalone.prepare.writePackageJson", cb => {
|
gulp.task("standalone.prepare.writePackageJson", cb => {
|
||||||
fs.writeFileSync(
|
const packageJsonString = JSON.stringify({
|
||||||
path.join(tempDestBuildDir, "package.json"),
|
optionalDependencies: pj.optionalDependencies,
|
||||||
JSON.stringify(
|
devDependencies: pj.devDependencies
|
||||||
{
|
}, null, 4);
|
||||||
devDependencies: {
|
|
||||||
electron: "9.4.3",
|
fs.writeFileSync(path.join(tempDestBuildDir, "package.json"), packageJsonString);
|
||||||
},
|
|
||||||
},
|
|
||||||
null,
|
|
||||||
4
|
|
||||||
)
|
|
||||||
);
|
|
||||||
cb();
|
cb();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -100,6 +96,14 @@ function gulptasksStandalone($, gulp) {
|
|||||||
*/
|
*/
|
||||||
function packageStandalone(platform, arch, cb, isRelease = true) {
|
function packageStandalone(platform, arch, cb, isRelease = true) {
|
||||||
const tomlFile = fs.readFileSync(path.join(__dirname, ".itch.toml"));
|
const tomlFile = fs.readFileSync(path.join(__dirname, ".itch.toml"));
|
||||||
|
const privateArtifactsPath = "node_modules/shapez.io-private-artifacts";
|
||||||
|
|
||||||
|
let asar;
|
||||||
|
if (fs.existsSync(path.join(tempDestBuildDir, privateArtifactsPath))) {
|
||||||
|
asar = { unpackDir: privateArtifactsPath };
|
||||||
|
} else {
|
||||||
|
asar = true;
|
||||||
|
}
|
||||||
|
|
||||||
packager({
|
packager({
|
||||||
dir: tempDestBuildDir,
|
dir: tempDestBuildDir,
|
||||||
@ -108,7 +112,7 @@ function gulptasksStandalone($, gulp) {
|
|||||||
buildVersion: "1.0.0",
|
buildVersion: "1.0.0",
|
||||||
arch,
|
arch,
|
||||||
platform,
|
platform,
|
||||||
asar: true,
|
asar: asar,
|
||||||
executableName: "shapezio",
|
executableName: "shapezio",
|
||||||
icon: path.join(electronBaseDir, "favicon"),
|
icon: path.join(electronBaseDir, "favicon"),
|
||||||
name: "shapez.io-standalone",
|
name: "shapez.io-standalone",
|
||||||
|
@ -3,6 +3,7 @@ import { DrawParameters } from "../core/draw_parameters";
|
|||||||
import { findNiceIntegerValue } from "../core/utils";
|
import { findNiceIntegerValue } from "../core/utils";
|
||||||
import { Vector } from "../core/vector";
|
import { Vector } from "../core/vector";
|
||||||
import { Entity } from "./entity";
|
import { Entity } from "./entity";
|
||||||
|
import { ACHIEVEMENTS } from "../platform/achievements";
|
||||||
import { GameRoot } from "./root";
|
import { GameRoot } from "./root";
|
||||||
|
|
||||||
export class Blueprint {
|
export class Blueprint {
|
||||||
@ -162,6 +163,11 @@ export class Blueprint {
|
|||||||
root.entityMgr.registerEntity(clone);
|
root.entityMgr.registerEntity(clone);
|
||||||
anyPlaced = true;
|
anyPlaced = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (anyPlaced) {
|
||||||
|
root.signals.achievementUnlocked.dispatch(ACHIEVEMENTS.blueprints);
|
||||||
|
}
|
||||||
|
|
||||||
return anyPlaced;
|
return anyPlaced;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -194,6 +194,9 @@ export class ShapeDefinitionManager extends BasicSerializableObject {
|
|||||||
if (this.operationCache[key]) {
|
if (this.operationCache[key]) {
|
||||||
return /** @type {ShapeDefinition} */ (this.operationCache[key]);
|
return /** @type {ShapeDefinition} */ (this.operationCache[key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.root.signals.achievementUnlocked.dispatch(ACHIEVEMENTS.stacking);
|
||||||
|
|
||||||
const stacked = lowerDefinition.cloneAndStackWith(upperDefinition);
|
const stacked = lowerDefinition.cloneAndStackWith(upperDefinition);
|
||||||
return /** @type {ShapeDefinition} */ (this.operationCache[key] = this.registerOrReturnHandle(
|
return /** @type {ShapeDefinition} */ (this.operationCache[key] = this.registerOrReturnHandle(
|
||||||
stacked
|
stacked
|
||||||
|
@ -7,10 +7,11 @@ const logger = createLogger("achievements/steam");
|
|||||||
|
|
||||||
const IDS = {
|
const IDS = {
|
||||||
painting: "<id>",
|
painting: "<id>",
|
||||||
cutting: "<id>",
|
cutting: "achievement_01", // Test ID
|
||||||
rotating: "<id>",
|
rotating: "<id>",
|
||||||
stacking: "<id>",
|
stacking: "<id>",
|
||||||
blueprints: "<id>"
|
blueprints: "<id>",
|
||||||
|
wires: "<id>",
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @typedef {object} SteamAchievement
|
/** @typedef {object} SteamAchievement
|
||||||
|
Loading…
Reference in New Issue
Block a user