From 326e17f1aa33b7231a808360654753ac9f1cc0b6 Mon Sep 17 00:00:00 2001 From: Cory Sanin Date: Tue, 4 Jul 2023 04:42:08 -0500 Subject: [PATCH] Fix cheat command --- lib/remote-control.js | 10 ++++++---- package-lock.json | 4 ++-- package.json | 2 +- src/remote-control.ts | 9 +++++---- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/lib/remote-control.js b/lib/remote-control.js index 4217a35..483e346 100644 --- a/lib/remote-control.js +++ b/lib/remote-control.js @@ -78,7 +78,7 @@ function doCommand(command) { } } else if ((args = doesCommandMatch(command, [CHEAT])) !== false && typeof args === 'string' && args.length > 0) { - setCheatAction.apply(this, args.split(' ')); + setCheatAction.apply(this, args.split(' ').map(function (s) { return parseInt(s); })); } else if ((args = doesCommandMatch(command, [CAPTURE])) !== false) { var options = { @@ -245,13 +245,15 @@ function getPlayer(playerID) { } return network.getPlayer(playerID); } -function setCheatAction(type, param1, param2) { +function setCheatAction(type, param1, param2, flags) { if (param1 === void 0) { param1 = 1; } if (param2 === void 0) { param2 = 0; } + if (flags === void 0) { flags = 0; } context.executeAction(SETCHEAT, { type: type, param1: param1, - param2: param2 + param2: param2, + flags: flags }); } function main() { @@ -291,7 +293,7 @@ function main() { } registerPlugin({ name: 'control', - version: '1.1.2', + version: '1.1.3', authors: ['Cory Sanin'], type: 'remote', minApiVersion: 19, diff --git a/package-lock.json b/package-lock.json index a120eed..677bf97 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "openrct2-remote-control", - "version": "1.1.2", + "version": "1.1.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "openrct2-remote-control", - "version": "1.1.2", + "version": "1.1.3", "license": "MIT", "devDependencies": { "typescript": "5.1.6" diff --git a/package.json b/package.json index 2cf21ca..39acc50 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "openrct2-remote-control", - "version": "1.1.2", + "version": "1.1.3", "description": "Control OpenRCT2 servers... remotely", "scripts": { "build": "npm exec tsc", diff --git a/src/remote-control.ts b/src/remote-control.ts index 50804ff..cf42cf1 100644 --- a/src/remote-control.ts +++ b/src/remote-control.ts @@ -89,7 +89,7 @@ function doCommand(command: string): string | boolean { } } else if ((args = doesCommandMatch(command, [CHEAT])) !== false && typeof args === 'string' && args.length > 0) { - setCheatAction.apply(this, args.split(' ')); + setCheatAction.apply(this, args.split(' ').map((s: string) => parseInt(s))); } else if ((args = doesCommandMatch(command, [CAPTURE])) !== false) { // this will totally crash in headless mode 🙃 @@ -270,11 +270,12 @@ function getPlayer(playerID: number): Player { return network.getPlayer(playerID); } -function setCheatAction(type: number, param1: number = 1, param2: number = 0): void { +function setCheatAction(type: number, param1: number = 1, param2: number = 0, flags = 0): void { context.executeAction(SETCHEAT, { type, param1, - param2 + param2, + flags }); } @@ -320,7 +321,7 @@ function main() { registerPlugin({ name: 'control', - version: '1.1.2', + version: '1.1.3', authors: ['Cory Sanin'], type: 'remote', minApiVersion: 19,