Basic stuff to handle MP envs

This commit is contained in:
ZioPao
2023-11-12 04:48:02 +01:00
parent 5e89a05b26
commit a691a729cf
6 changed files with 96 additions and 13 deletions

View File

@@ -0,0 +1,33 @@
local CommandsData = require("TOC/CommandsData")
local ClientSyncCommands = {}
local moduleName = CommandsData.modules.TOC_SYNC
------------------------------
---Send the toc mod data to the server to relay it to someone else
---@param args {surgeonNum : number}
function ClientSyncCommands.SendPlayerData(args)
-- TODO get moddata and send it
sendClientCommand(moduleName, CommandsData.server.Sync.RelayPlayerData, {surgeonNum = args.surgeonNum, tocData = {}})
end
---Receives and store the toc mod data from another player
---@param args {patientNum : number}
function ClientSyncCommands.ReceivePlayerData(args)
local patientPl = getSpecificPlayer(args.patientNum)
local patientUsername patientPl:getUsername()
-- TODO Save the data somewhere that makes sense.
end
------------------------------
local function OnServerSyncCommand(module, command, args)
if module == moduleName and ClientSyncCommands[command] then
args = args or {}
ClientSyncCommands[command](args)
end
end
Events.OnServerCommand.Add(OnServerSyncCommand)