Comparing version 4.0.0 to 4.1.0
{ | ||
"name": "demrec", | ||
"version": "4.0.0", | ||
"version": "4.1.0", | ||
"description": "Demo Recorder Renderer", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -46,2 +46,10 @@ let fs = require('fs') | ||
Object.defineProperty(DemRec.Events, 'add', { | ||
value: function (events) { | ||
let len = Object.keys(this).length | ||
if (!Array.isArray(events)) events = [events] | ||
for (let event of events) this[event] = len++ | ||
} | ||
}) | ||
DemRec.prototype.setGame = function (app) { | ||
@@ -102,3 +110,3 @@ this.game = { | ||
DemRec.prototype.launch = async function () { | ||
DemRec.prototype.launch = async function (silent = false) { | ||
this.updateCustomFiles() | ||
@@ -111,3 +119,3 @@ | ||
this.emit('log', { event: DemRec.Events.GAME_LAUNCH }) | ||
if (!silent) this.emit('log', { event: DemRec.Events.GAME_LAUNCH }) | ||
@@ -125,6 +133,8 @@ this.app = await svr.run(this.game, { | ||
this.emit('log', { event: DemRec.Events.GAME_LAUNCH_END }) | ||
if (!silent) this.emit('log', { event: DemRec.Events.GAME_LAUNCH_END }) | ||
} | ||
DemRec.prototype.record = async function (demo, arr, out) { | ||
if (!this.app) throw new Error('Game not running!') | ||
if (!out) throw new Error('No output directory provided!') | ||
@@ -238,8 +248,8 @@ if (!fs.existsSync(out)) fs.mkdirSync(out) | ||
DemRec.prototype.exit = async function () { | ||
this.emit('log', { event: DemRec.Events.GAME_EXIT }) | ||
DemRec.prototype.exit = async function (silent = false) { | ||
if (!silent) this.emit('log', { event: DemRec.Events.GAME_EXIT }) | ||
if (this.app) await this.app.exit() | ||
await util.sleep(1234) | ||
this.kill() | ||
this.emit('log', { event: DemRec.Events.GAME_EXIT_END }) | ||
if (!silent) this.emit('log', { event: DemRec.Events.GAME_EXIT_END }) | ||
} | ||
@@ -246,0 +256,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29788
620