From 96f907c023b687206df6233be383d724e2810088 Mon Sep 17 00:00:00 2001 From: Leon Krause Date: Thu, 10 May 2018 13:43:58 +0200 Subject: Accept non-default main packs in engine.js startGame() Allows using startGame() with main packs exported as .zip, but also any other custom extension, for example if a web game host does not allow the .pck filename extension. --- platform/javascript/engine.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'platform') diff --git a/platform/javascript/engine.js b/platform/javascript/engine.js index 0c1337cc3..1d78f28bb 100644 --- a/platform/javascript/engine.js +++ b/platform/javascript/engine.js @@ -130,13 +130,17 @@ this.startGame = function(mainPack) { executableName = getBaseName(mainPack); + var mainArgs = []; + if (!getPathLeaf(mainPack).endsWith('.pck')) { + mainArgs = ['--main-pack', getPathLeaf(mainPack)]; + } return Promise.all([ // Load from directory, this.init(getBasePath(mainPack)), // ...but write to root where the engine expects it. this.preloadFile(mainPack, getPathLeaf(mainPack)) ]).then( - Function.prototype.apply.bind(synchronousStart, this, []) + Function.prototype.apply.bind(synchronousStart, this, mainArgs) ); }; -- cgit v1.2.3-70-g09d2