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