From 13c5b28936bb8d8af7f0eba302fa59285bd3c07d Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Tue, 17 May 2022 20:46:56 -0500 Subject: [PATCH] Add gate cmds --- scripts/server/command.js | 23 ++++++++++++++++------- scripts/server/gate.js | 2 +- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/scripts/server/command.js b/scripts/server/command.js index a052397b..98d8a224 100644 --- a/scripts/server/command.js +++ b/scripts/server/command.js @@ -213,6 +213,15 @@ function loadCommands() { email: [ new CommandData("testemail", testEmailCommand, "", getStaffFlagValue("Developer"), true, true), ], + gate: [ + new CommandData("gate", triggerGateCommand, "", getStaffFlagValue("None"), true, true, "Opens/closes the nearest gate"), + new CommandData("opengate", triggerGateCommand, "", getStaffFlagValue("None"), true, true, "Opens/closes the nearest gate"), + new CommandData("closegate", triggerGateCommand, "", getStaffFlagValue("None"), true, true, "Opens/closes the nearest gate"), + new CommandData("housegate", triggerGateCommand, "", getStaffFlagValue("None"), true, true, "Opens/closes the nearest gate"), + new CommandData("biz", triggerGateCommand, "", getStaffFlagValue("None"), true, true, "Opens/closes the nearest gate"), + new CommandData("door", triggerGateCommand, "", getStaffFlagValue("None"), true, true, "Opens/closes the nearest gate"), + new CommandData("garagedoor", triggerGateCommand, "", getStaffFlagValue("None"), true, true, "Opens/closes the nearest gate"), + ], help: [ new CommandData("help", helpCommand, "", getStaffFlagValue("None"), false, false, "Shows help messages for information"), new CommandData("commands", helpCommand, "", getStaffFlagValue("None"), false, false, "Shows help messages for information"), @@ -747,13 +756,13 @@ function processPlayerCommand(command, params, client) { } } - //if(isClientFromDiscord(client)) { - // if(!isCommandAllowedOnDiscord(command)) { - // logToConsole(LOG_WARN, `[VRR.Command] ${getPlayerDisplayForConsole(client)} attempted to use command from discord, but failed (not available on discord): /${command} ${paramsDisplay}`); - // messagePlayerError(client, `The {ALTCOLOUR}/${command} {MAINCOLOUR} command isn't available on discord!`); - // return false; - // } - //} + if(isClientFromDiscord(client)) { + if(!isCommandAllowedOnDiscord(command)) { + logToConsole(LOG_WARN, `[VRR.Command] ${getPlayerDisplayForConsole(client)} attempted to use command from discord, but failed (not available on discord): /${command} ${paramsDisplay}`); + messagePlayerError(client, `The {ALTCOLOUR}/${command}{MAINCOLOUR} command isn't available on discord!`); + return false; + } + } if(!isConsole(client)) { if(!doesPlayerHaveStaffPermission(client, getCommandRequiredPermissions(toLowerCase(command)))) { diff --git a/scripts/server/gate.js b/scripts/server/gate.js index 9e4afbe8..c0565345 100644 --- a/scripts/server/gate.js +++ b/scripts/server/gate.js @@ -116,7 +116,7 @@ function triggerGateCommand(command, params, client) { messagePlayerError(client, getLocaleString(client, "InvalidGate")); } - if(!canPlayerUseGate(client, closestGate)) { + if(!doesPlayerHaveGateKeys(client, closestGate)) { messagePlayerError(client, getLocaleString(client, "NoGateAccess")); return false; }