Reworked some stuff for MP
This commit is contained in:
21
media/lua/shared/TOC/BodyLocations.lua
Normal file
21
media/lua/shared/TOC/BodyLocations.lua
Normal file
@@ -0,0 +1,21 @@
|
||||
-- TODO This part is still one of the weakest and we don't have a better solution yet
|
||||
require("TOC/Debug")
|
||||
|
||||
local function AddBodyLocationBefore(newLocation, moveToLocation)
|
||||
local group = BodyLocations.getGroup("Human")
|
||||
local list = getClassFieldVal(group, getClassField(group, 1))
|
||||
group:getOrCreateLocation(newLocation)
|
||||
local newItem = list:get(list:size()-1)
|
||||
TOC_DEBUG.print("created new body location" .. newItem:getId())
|
||||
list:remove(newItem) -- We can't use the Index, it works if we pass the item though!
|
||||
local i = group:indexOf(moveToLocation)
|
||||
list:add(i, newItem)
|
||||
end
|
||||
|
||||
|
||||
AddBodyLocationBefore("TOC_ArmRight", "Shoes")
|
||||
AddBodyLocationBefore("TOC_ArmLeft", "Shoes")
|
||||
|
||||
AddBodyLocationBefore("TOC_ArmProstRight", "Shoes")
|
||||
AddBodyLocationBefore("TOC_ArmProstLeft", "Shoes")
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
local StaticData = require("TOC/StaticData")
|
||||
|
||||
local CommandsData = {}
|
||||
|
||||
|
||||
@@ -8,16 +10,23 @@ CommandsData.modules = {
|
||||
|
||||
CommandsData.client = {
|
||||
Sync = {
|
||||
SendPlayerData = "SendPlayerData",
|
||||
ReceivePlayerData = "ReceivePlayerData"
|
||||
SendPlayerData = "SendPlayerData", ---@alias sendPlayerDataParams {surgeonNum : number}
|
||||
ReceivePlayerData = "ReceivePlayerData" ---@alias receivePlayerDataParams {patientNum : number, tocData : tocModData}
|
||||
}
|
||||
}
|
||||
|
||||
CommandsData.server = {
|
||||
Sync = {
|
||||
AskPlayerData = "AskPlayerData",
|
||||
RelayPlayerData = "RelayPlayerData"
|
||||
AskPlayerData = "AskPlayerData", ---@alias askPlayerDataParams {patientNum : number}
|
||||
RelayPlayerData = "RelayPlayerData" ---@alias relayPlayerDataParams {surgeonNum : number, tocData : tocModData}
|
||||
}
|
||||
}
|
||||
|
||||
---Get the correct key for that particular player to be used in the global mod data table
|
||||
---@param username string
|
||||
---@return string
|
||||
function CommandsData.GetKey(username)
|
||||
return StaticData.MOD_NAME .. "_" .. username
|
||||
end
|
||||
|
||||
return CommandsData
|
||||
15
media/lua/shared/TOC/Debug.lua
Normal file
15
media/lua/shared/TOC/Debug.lua
Normal file
@@ -0,0 +1,15 @@
|
||||
TOC_DEBUG = {}
|
||||
TOC_DEBUG.disablePaneMod = false
|
||||
|
||||
|
||||
function TOC_DEBUG.togglePaneMod()
|
||||
TOC_DEBUG.disablePaneMod = not TOC_DEBUG.disablePaneMod
|
||||
end
|
||||
|
||||
---comment
|
||||
---@param string string
|
||||
function TOC_DEBUG.print(string)
|
||||
if isDebugEnabled() then
|
||||
print("TOC: " .. string)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user