Skip to content

Commit

Permalink
Fix cheat command
Browse files Browse the repository at this point in the history
  • Loading branch information
CorySanin committed Jul 4, 2023
1 parent 0e8d426 commit 326e17f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
10 changes: 6 additions & 4 deletions lib/remote-control.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down Expand Up @@ -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() {
Expand Down Expand Up @@ -291,7 +293,7 @@ function main() {
}
registerPlugin({
name: 'control',
version: '1.1.2',
version: '1.1.3',
authors: ['Cory Sanin'],
type: 'remote',
minApiVersion: 19,
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
9 changes: 5 additions & 4 deletions src/remote-control.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 🙃
Expand Down Expand Up @@ -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
});
}

Expand Down Expand Up @@ -320,7 +321,7 @@ function main() {

registerPlugin({
name: 'control',
version: '1.1.2',
version: '1.1.3',
authors: ['Cory Sanin'],
type: 'remote',
minApiVersion: 19,
Expand Down

0 comments on commit 326e17f

Please sign in to comment.