Fixed other stuff, now everything should work. Code is a mess though

This commit is contained in:
Pao
2023-01-12 17:33:05 +01:00
parent 76c6f2f6db
commit 2c81cc1d04
2 changed files with 37 additions and 20 deletions

View File

@@ -16,6 +16,9 @@ local function OnTocServerCommand(module, command, args)
-- todo maybe we cant send a table like this. Let's try something easier -- todo maybe we cant send a table like this. Let's try something easier
--local moneyAmount = playerTwo:getInventory():getCountTypeRecurse("Money") --local moneyAmount = playerTwo:getInventory():getCountTypeRecurse("Money")
print("Giving info") print("Giving info")
-- not fast enough, wont get toc_data in time. FInd a better way to send and get data
sendClientCommand(patient, "TOC", "SendPlayerData", {surgeon_id, toc_data}) sendClientCommand(patient, "TOC", "SendPlayerData", {surgeon_id, toc_data})
elseif command == 'SendTocData' then elseif command == 'SendTocData' then

View File

@@ -323,16 +323,15 @@ function SetConfirmUIMP(action, isBitten, userName, partName)
end end
end end
local function setImageMainUI() local function setImageMainUI(toc_data)
local modData = getPlayer():getModData().TOC mainUI["b11"]:setPath(getImageName("RightArm", toc_data));
mainUI["b11"]:setPath(getImageName("RightArm", modData)); mainUI["b12"]:setPath(getImageName("LeftArm", toc_data));
mainUI["b12"]:setPath(getImageName("LeftArm", modData));
mainUI["b21"]:setPath(getImageName("RightForearm", modData)); mainUI["b21"]:setPath(getImageName("RightForearm", toc_data));
mainUI["b22"]:setPath(getImageName("LeftForearm", modData)); mainUI["b22"]:setPath(getImageName("LeftForearm", toc_data));
mainUI["b31"]:setPath(getImageName("RightHand", modData)); mainUI["b31"]:setPath(getImageName("RightHand", toc_data));
mainUI["b32"]:setPath(getImageName("LeftHand", modData)); mainUI["b32"]:setPath(getImageName("LeftHand", toc_data));
end end
@@ -433,22 +432,18 @@ end
local function SetCorrectArgsMainUI(toc_data) local function SetCorrectArgsMainUI(toc_data)
--mainUI["b11"]:addArg("part", "RightArm")
-- TODO Make it less shitty
mainUI["b11"]:addArg("toc_data", toc_data) mainUI["b11"]:addArg("toc_data", toc_data)
--mainUI["b12"]:addArg("part", "LeftArm");
mainUI["b12"]:addArg("toc_data", toc_data) mainUI["b12"]:addArg("toc_data", toc_data)
--mainUI["b21"]:addArg("part", "RightForearm")
mainUI["b21"]:addArg("toc_data", toc_data) mainUI["b21"]:addArg("toc_data", toc_data)
--mainUI["b22"]:addArg("part", "LeftForearm")
mainUI["b22"]:addArg("toc_data", toc_data) mainUI["b22"]:addArg("toc_data", toc_data)
--mainUI["b31"]:addArg("part", "RightHand")
mainUI["b31"]:addArg("toc_data", toc_data) mainUI["b31"]:addArg("toc_data", toc_data)
--mainUI["b32"]:addArg("part", "LeftHand");
mainUI["b32"]:addArg("toc_data", toc_data) mainUI["b32"]:addArg("toc_data", toc_data)
end end
@@ -632,7 +627,6 @@ function ISNewHealthPanel.onClick_TOC(button)
-- button.character is patient -- button.character is patient
-- button.otherPlayer is surgeon -- button.otherPlayer is surgeon
sendClientCommand(button.otherPlayer, "TOC", "GetPlayerData", {button.otherPlayer:getOnlineID(), button.character:getOnlineID()})
-- if MP_other_player_toc_data ~= nil then -- if MP_other_player_toc_data ~= nil then
-- print("It works") -- print("It works")
@@ -641,11 +635,15 @@ function ISNewHealthPanel.onClick_TOC(button)
-- print("Nopepppp") -- print("Nopepppp")
-- end -- end
if button.character ~= button.otherPlayer then if button.otherPlayer then
if button.character ~= button.otherPlayer then
sendClientCommand(button.otherPlayer, "TOC", "GetPlayerData", {button.otherPlayer:getOnlineID(), button.character:getOnlineID()})
SetCorrectArgsMainUI(MP_other_player_toc_data) --other player is the surgeon
else
SetCorrectArgsMainUI(getPlayer():getModData().TOC) --myself?
SetCorrectArgsMainUI(MP_other_player_toc_data) --other player is the surgeon end
else else
SetCorrectArgsMainUI(getPlayer():getModData().TOC) --myself? SetCorrectArgsMainUI(getPlayer():getModData().TOC) --myself?
@@ -656,7 +654,23 @@ function ISNewHealthPanel.onClick_TOC(button)
mainUI:setInCenterOfScreen() mainUI:setInCenterOfScreen()
setImageMainUI()
if button.otherPlayer then
if button.character ~= button.otherPlayer then
sendClientCommand(button.otherPlayer, "TOC", "GetPlayerData", {button.otherPlayer:getOnlineID(), button.character:getOnlineID()})
setImageMainUI(MP_other_player_toc_data)
else
setImageMainUI(getPlayer():getModData().TOC)
end
else
setImageMainUI(getPlayer():getModData().TOC)
end
end end
local ISHealthPanel_createChildren = ISHealthPanel.createChildren local ISHealthPanel_createChildren = ISHealthPanel.createChildren