added some debug commands
This commit is contained in:
@@ -86,7 +86,7 @@ function AmputationHandler:execute(damagePlayer)
|
|||||||
ItemsHandler.SpawnAmputationItem(self.patient, self.limbName)
|
ItemsHandler.SpawnAmputationItem(self.patient, self.limbName)
|
||||||
|
|
||||||
-- Add it to the list of cut limbs
|
-- Add it to the list of cut limbs
|
||||||
PlayerHandler.AddLocalAmputatedLimb(self.limbName)
|
PlayerHandler.AddLocalAmputatedLimb(self.patient:getUsername(), self.limbName)
|
||||||
|
|
||||||
-- Set the highest amputation and caches them.
|
-- Set the highest amputation and caches them.
|
||||||
--ISHealthPanel.GetHighestAmputation()
|
--ISHealthPanel.GetHighestAmputation()
|
||||||
|
|||||||
23
media/lua/server/TOC/DebugCommands.lua
Normal file
23
media/lua/server/TOC/DebugCommands.lua
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
local CommandsData = require("TOC/CommandsData")
|
||||||
|
|
||||||
|
local DebugCommands = {}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
---comment
|
||||||
|
---@param playerObj IsoPlayer
|
||||||
|
---@param args {username : string}
|
||||||
|
function DebugCommands.PrintTocData(playerObj, args)
|
||||||
|
local data = ModData.get(CommandsData.GetKey(args.username))
|
||||||
|
TOC_DEBUG.printTable(data)
|
||||||
|
end
|
||||||
|
|
||||||
|
--------------------
|
||||||
|
|
||||||
|
local function OnClientDebugCommand(module, command, playerObj, args)
|
||||||
|
if module == CommandsData.modules.TOC_DEBUG and DebugCommands[command] then
|
||||||
|
DebugCommands[command](playerObj, args)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
Events.OnClientCommand.Add(OnClientDebugCommand)
|
||||||
@@ -4,7 +4,8 @@ local CommandsData = {}
|
|||||||
|
|
||||||
|
|
||||||
CommandsData.modules = {
|
CommandsData.modules = {
|
||||||
TOC_SYNC = "TOC_SYNC"
|
TOC_SYNC = "TOC_SYNC",
|
||||||
|
TOC_DEBUG = "TOC_DEBUG"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -19,6 +20,10 @@ CommandsData.server = {
|
|||||||
Sync = {
|
Sync = {
|
||||||
AskPlayerData = "AskPlayerData", ---@alias askPlayerDataParams {patientNum : number}
|
AskPlayerData = "AskPlayerData", ---@alias askPlayerDataParams {patientNum : number}
|
||||||
RelayPlayerData = "RelayPlayerData" ---@alias relayPlayerDataParams {surgeonNum : number, tocData : tocModData}
|
RelayPlayerData = "RelayPlayerData" ---@alias relayPlayerDataParams {surgeonNum : number, tocData : tocModData}
|
||||||
|
},
|
||||||
|
|
||||||
|
Debug = {
|
||||||
|
PrintTocData = "PrintTocData" ---@alias printTocDataParams {username : string}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,10 +6,32 @@ function TOC_DEBUG.togglePaneMod()
|
|||||||
TOC_DEBUG.disablePaneMod = not TOC_DEBUG.disablePaneMod
|
TOC_DEBUG.disablePaneMod = not TOC_DEBUG.disablePaneMod
|
||||||
end
|
end
|
||||||
|
|
||||||
---comment
|
---Print debug
|
||||||
---@param string string
|
---@param string string
|
||||||
function TOC_DEBUG.print(string)
|
function TOC_DEBUG.print(string)
|
||||||
if isDebugEnabled() then
|
if isDebugEnabled() then
|
||||||
print("TOC: " .. string)
|
print("TOC: " .. string)
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function TOC_DEBUG.printTable(table, indent)
|
||||||
|
if not table then return end
|
||||||
|
indent = indent or ""
|
||||||
|
|
||||||
|
for key, value in pairs(table) do
|
||||||
|
if type(value) == "table" then
|
||||||
|
print(indent .. key .. " (table):")
|
||||||
|
TOC_DEBUG.printTable(value, indent .. " ")
|
||||||
|
else
|
||||||
|
print(indent .. key .. ":", value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function TOC_DEBUG.printGlobalModDataServer(username)
|
||||||
|
local CommandsData = require("TOC/CommandsData")
|
||||||
|
|
||||||
|
---@type printTocDataParams
|
||||||
|
local params = {username = username}
|
||||||
|
sendClientCommand(CommandsData.modules.TOC_DEBUG, CommandsData.server.Debug.PrintTocData, params)
|
||||||
end
|
end
|
||||||
Reference in New Issue
Block a user