Basic stuff to handle MP envs
This commit is contained in:
33
media/lua/client/TOC/ClientSyncCommands.lua
Normal file
33
media/lua/client/TOC/ClientSyncCommands.lua
Normal 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)
|
||||
@@ -1,10 +1,7 @@
|
||||
local StaticData = require("TOC/StaticData")
|
||||
|
||||
----------------
|
||||
---@alias partData { isCut : boolean?, isInfected : boolean?, isOperated : boolean?, isCicatrized : boolean?, isCauterized : boolean?, isVisible : boolean?, cicatrizationTime : number }
|
||||
---@alias tocModData {Hand_L : partData, ForeArm_L : partData, UpperArm_L : partData, Hand_R : partData, ForeArm_R : partData, UpperArm_R : partData, isIgnoredPartInfected : boolean, isAnyLimbCut : boolean}
|
||||
----------------
|
||||
-- TODO This class should handle all the stuff related to the mod data
|
||||
--This class should handle all the stuff related to the mod data
|
||||
|
||||
---@class ModDataHandler
|
||||
---@field playerObj IsoPlayer
|
||||
@@ -17,6 +14,7 @@ function ModDataHandler:new(playerObj)
|
||||
local o = {}
|
||||
setmetatable(o, self)
|
||||
self.__index = self
|
||||
-- TODO Instead of requiring a player, to make it compatible in a MP env, we should require the table containing the modData for the init
|
||||
|
||||
o.playerObj = playerObj
|
||||
o.tocData = playerObj:getModData()[StaticData.MOD_NAME]
|
||||
@@ -68,7 +66,7 @@ end
|
||||
---Set a generic boolean that toggles varies function of the mod
|
||||
---@param isAnyLimbCut boolean
|
||||
function ModDataHandler:setIsAnyLimbCut(isAnyLimbCut)
|
||||
self.tocData.isAnyLimbCut = true
|
||||
self.tocData.isAnyLimbCut = isAnyLimbCut
|
||||
end
|
||||
|
||||
---Set isCut
|
||||
|
||||
Reference in New Issue
Block a user