Fixed admin commands in sp
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
local CommandsData = require("TOC/CommandsData")
|
local CommandsData = require("TOC/CommandsData")
|
||||||
|
local ClientRelayCommands = require("TOC/ClientRelayCommands")
|
||||||
local StaticData = require("TOC/StaticData")
|
local StaticData = require("TOC/StaticData")
|
||||||
local DataController = require("TOC/Controllers/DataController")
|
local DataController = require("TOC/Controllers/DataController")
|
||||||
-------------------
|
-------------------
|
||||||
@@ -7,7 +8,8 @@ local DataController = require("TOC/Controllers/DataController")
|
|||||||
---@param context ISContextMenu
|
---@param context ISContextMenu
|
||||||
---@param worldobjects table
|
---@param worldobjects table
|
||||||
local function AddAdminTocOptions(playerNum, context, worldobjects)
|
local function AddAdminTocOptions(playerNum, context, worldobjects)
|
||||||
if not isAdmin() then return end
|
|
||||||
|
if (isClient() and not isDebugEnabled()) or isAdmin() then return end
|
||||||
|
|
||||||
local players = {}
|
local players = {}
|
||||||
for _, v in ipairs(worldobjects) do
|
for _, v in ipairs(worldobjects) do
|
||||||
@@ -40,8 +42,13 @@ local function AddAdminTocOptions(playerNum, context, worldobjects)
|
|||||||
context:addSubMenu(option, subMenu)
|
context:addSubMenu(option, subMenu)
|
||||||
|
|
||||||
subMenu:addOption(getText("ContextMenu_Admin_ResetTOC"), nil, function()
|
subMenu:addOption(getText("ContextMenu_Admin_ResetTOC"), nil, function()
|
||||||
|
if isClient() then
|
||||||
sendClientCommand(CommandsData.modules.TOC_RELAY, CommandsData.server.Relay.RelayExecuteInitialization,
|
sendClientCommand(CommandsData.modules.TOC_RELAY, CommandsData.server.Relay.RelayExecuteInitialization,
|
||||||
{ patientNum = clickedPlayerNum })
|
{ patientNum = clickedPlayerNum })
|
||||||
|
else
|
||||||
|
-- TODO ugly
|
||||||
|
ClientRelayCommands.ReceiveExecuteInitialization()
|
||||||
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
-- Force amputation
|
-- Force amputation
|
||||||
@@ -54,8 +61,14 @@ local function AddAdminTocOptions(playerNum, context, worldobjects)
|
|||||||
local limbTranslatedName = getText("ContextMenu_Limb_" .. limbName)
|
local limbTranslatedName = getText("ContextMenu_Limb_" .. limbName)
|
||||||
|
|
||||||
forceAmpSubMenu:addOption(limbTranslatedName, nil, function()
|
forceAmpSubMenu:addOption(limbTranslatedName, nil, function()
|
||||||
|
if isClient() then
|
||||||
sendClientCommand(CommandsData.modules.TOC_RELAY, CommandsData.server.Relay.RelayForcedAmputation,
|
sendClientCommand(CommandsData.modules.TOC_RELAY, CommandsData.server.Relay.RelayForcedAmputation,
|
||||||
{ patientNum = clickedPlayerNum, limbName = limbName })
|
{ patientNum = clickedPlayerNum, limbName = limbName })
|
||||||
|
else
|
||||||
|
ClientRelayCommands.ReceiveExecuteAmputationAction({surgeonNum=clickedPlayerNum, limbName=limbName, damagePlayer=false})
|
||||||
|
-- todo ugly
|
||||||
|
end
|
||||||
|
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -72,3 +72,6 @@ local function OnServerRelayCommand(module, command, args)
|
|||||||
end
|
end
|
||||||
|
|
||||||
Events.OnServerCommand.Add(OnServerRelayCommand)
|
Events.OnServerCommand.Add(OnServerRelayCommand)
|
||||||
|
|
||||||
|
-- TODO temporary
|
||||||
|
return ClientRelayCommands
|
||||||
@@ -26,7 +26,7 @@ end
|
|||||||
|
|
||||||
---Returns full name for the side, to be used with BodyLocations
|
---Returns full name for the side, to be used with BodyLocations
|
||||||
---@param side string
|
---@param side string
|
||||||
---@return string
|
---@return string?
|
||||||
function CommonMethods.GetSideFull(side)
|
function CommonMethods.GetSideFull(side)
|
||||||
if side == 'R' then
|
if side == 'R' then
|
||||||
return "Right"
|
return "Right"
|
||||||
|
|||||||
Reference in New Issue
Block a user