Local reset for admins
This commit is contained in:
31
media/lua/client/TOC/Admin.lua
Normal file
31
media/lua/client/TOC/Admin.lua
Normal file
@@ -0,0 +1,31 @@
|
||||
|
||||
local CommandsData = require("TOC/CommandsData")
|
||||
|
||||
---@param playerNum number
|
||||
---@param context ISContextMenu
|
||||
---@param items any
|
||||
local function AddAdminTocOptions(playerNum, context, items)
|
||||
if not isAdmin() then return end
|
||||
|
||||
-- This is a global var already handled in vanilla zomboid, we don't need to find the player once again
|
||||
---@cast clickedPlayer IsoPlayer
|
||||
if clickedPlayer then
|
||||
|
||||
local clickedPlayerNum = clickedPlayer:getOnlineID()
|
||||
|
||||
local option = context:addOption(getText("ContextMenu_Admin_TOC"), items, nil)
|
||||
local subMenu = ISContextMenu:getNew(context)
|
||||
context:addSubMenu(option, subMenu)
|
||||
|
||||
subMenu:addOption(getText("ContextMenu_Admin_ResetTOC"), items, function()
|
||||
sendClientCommand(CommandsData.modules.TOC_RELAY, CommandsData.server.Relay.RelayExecuteInitialization, {patientNum=clickedPlayerNum} )
|
||||
end)
|
||||
|
||||
-- TODO add other options
|
||||
|
||||
end
|
||||
|
||||
|
||||
|
||||
end
|
||||
Events.OnFillWorldObjectContextMenu.Add(AddAdminTocOptions)
|
||||
@@ -28,6 +28,16 @@ function ClientRelayCommands.ReceiveExecuteAmputationAction(args)
|
||||
local handler = InitAmputationHandler(args.limbName, args.surgeonNum)
|
||||
handler:execute(true)
|
||||
end
|
||||
|
||||
|
||||
|
||||
--* TRIGGERED BY ADMINS *--
|
||||
|
||||
function ClientRelayCommands.ReceiveExecuteInitialization()
|
||||
local LocalPlayerController = require("TOC/Controllers/LocalPlayerController")
|
||||
LocalPlayerController.InitializePlayer(true)
|
||||
end
|
||||
|
||||
-------------------------
|
||||
|
||||
local function OnServerRelayCommand(module, command, args)
|
||||
|
||||
@@ -136,7 +136,7 @@ LocalPlayerController.hasBeenDamaged = false
|
||||
|
||||
|
||||
---Check if the player has in infected body part or if they have been hit in a cut area
|
||||
---@param character IsoPlayer
|
||||
---@param character IsoPlayer|IsoGameCharacter
|
||||
function LocalPlayerController.HandleDamage(character)
|
||||
-- TOC_DEBUG.print("Player got hit!")
|
||||
-- TOC_DEBUG.print(damageType)
|
||||
@@ -193,7 +193,7 @@ function LocalPlayerController.HandleDamage(character)
|
||||
end
|
||||
|
||||
---Setup HandleDamage, triggered by OnPlayerGetDamage
|
||||
---@param character IsoGameCharacter
|
||||
---@param character IsoPlayer|IsoGameCharacter
|
||||
---@param damageType string
|
||||
---@param damageAmount number
|
||||
function LocalPlayerController.OnGetDamage(character, damageType, damageAmount)
|
||||
@@ -291,7 +291,7 @@ end
|
||||
|
||||
--* Tourniquet handling
|
||||
function LocalPlayerController.HandleTourniquet()
|
||||
print("test")
|
||||
-- TODO Add it!!!
|
||||
end
|
||||
|
||||
Events.OnPuttingTourniquet.Add(LocalPlayerController.HandleTourniquet)
|
||||
|
||||
@@ -89,6 +89,3 @@ end
|
||||
Events.OnGameStart.Add(Main.Start)
|
||||
Events.OnCreatePlayer.Add(Main.InitializePlayer)
|
||||
Events.OnPlayerDeath.Add(Main.WipeData)
|
||||
|
||||
-- TODO Disable windows interaction when no hands
|
||||
|
||||
|
||||
Reference in New Issue
Block a user