dunno at this point
This commit is contained in:
@@ -83,8 +83,48 @@ Commands["CanOperateArm"] = function(arg)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--------------------------------------------------------------------
|
||||||
|
|
||||||
|
function AskGetOtherPlayerData(player)
|
||||||
|
local arg = {}
|
||||||
|
|
||||||
|
arg["From"] = getPlayer():getOnlineID() --surgoen
|
||||||
|
arg["To"] = player:getOnlineID() --patient
|
||||||
|
|
||||||
|
|
||||||
|
arg["command"] = "SendOtherPlayerData";
|
||||||
|
arg["toSend"] = {player:getModData().TOC} -- will it work?
|
||||||
|
sendClientCommand("TOC", "SendServer", arg);
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
function SendGetOtherPlayerData(player)
|
||||||
|
local arg = {}
|
||||||
|
|
||||||
|
arg["From"] = getPlayer():getOnlineID() --surgoen
|
||||||
|
arg["To"] = player:getOnlineID() --patient
|
||||||
|
|
||||||
|
|
||||||
|
arg["command"] = "GetOtherPlayerData";
|
||||||
|
arg["toSend"] = {player:getModData().TOC} -- will it work?
|
||||||
|
sendClientCommand("TOC", "SendServer", arg);
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- todo why is this here? this doesnt make any sense
|
||||||
|
|
||||||
|
|
||||||
-- Event
|
-- Event
|
||||||
local onServerCommand = function(module, command, args)
|
local onServerCommand = function(module, command, args)
|
||||||
|
-- TODO change this name
|
||||||
if module == "TOC" and Commands[command] then
|
if module == "TOC" and Commands[command] then
|
||||||
args = args or {}
|
args = args or {}
|
||||||
Commands[command](args)
|
Commands[command](args)
|
||||||
|
|||||||
34
media/lua/client/TOC_Client.lua
Normal file
34
media/lua/client/TOC_Client.lua
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
local function OnTocServerCommand(module, command, args)
|
||||||
|
-- TODO Change name of the func
|
||||||
|
|
||||||
|
|
||||||
|
if module == 'TOC' then
|
||||||
|
print(command)
|
||||||
|
|
||||||
|
if command == 'GivePlayerData' then
|
||||||
|
--local surgeon = getPlayerByOnlineID(args[1])
|
||||||
|
local surgeon_id = args[1]
|
||||||
|
local patient = getPlayer()
|
||||||
|
|
||||||
|
local toc_data = patient:getModData().TOC
|
||||||
|
|
||||||
|
|
||||||
|
--local moneyAmount = playerTwo:getInventory():getCountTypeRecurse("Money")
|
||||||
|
patient:Say("Giving info")
|
||||||
|
sendClientCommand(patient, "TOC", "SendPlayerData", {surgeon_id, toc_data})
|
||||||
|
|
||||||
|
elseif command == 'SendTocData' then
|
||||||
|
print("Sending TOC data")
|
||||||
|
local patient = getPlayerByOnlineID(args[1]) --todo cant we delete this>?
|
||||||
|
|
||||||
|
|
||||||
|
-- ew a global var.... but dunno if there's a better way to do this
|
||||||
|
MP_other_player_toc_data = args[2]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Events.OnServerCommand.Add(OnTocServerCommand)
|
||||||
@@ -130,23 +130,28 @@ end
|
|||||||
-- end Usefull
|
-- end Usefull
|
||||||
|
|
||||||
-- Function to update text/button of UIs
|
-- Function to update text/button of UIs
|
||||||
local function setDescUI(player, partName)
|
local function setDescUI(toc_data, partName)
|
||||||
|
|
||||||
--we can easily fix this crap from here for MP compat
|
--we can easily fix this crap from here for MP compat
|
||||||
|
-- forces sync?
|
||||||
|
--local player_obj = getSpecificPlayer(player)
|
||||||
-- TODO set correct player
|
-- TODO set correct player
|
||||||
local modData = player:getModData().TOC;
|
|
||||||
local partData = modData[partName];
|
|
||||||
descUI["textTitle"]:setText(getDisplayText_TOC(partName));
|
--local testModData = player:getModData()
|
||||||
descUI.partNameAct = partName;
|
|
||||||
|
|
||||||
|
local partData = toc_data[partName]
|
||||||
|
descUI["textTitle"]:setText(getDisplayText_TOC(partName))
|
||||||
|
descUI.partNameAct = partName
|
||||||
|
|
||||||
-- Cut and equip
|
-- Cut and equip
|
||||||
if partData.is_cut and partData.is_cicatrized and partData.has_prothesis_equipped then
|
if partData.is_cut and partData.is_cicatrized and partData.has_prothesis_equipped then
|
||||||
descUI["textEtat"]:setText("Cut and healed");
|
descUI["textEtat"]:setText("Cut and healed")
|
||||||
descUI["textEtat"]:setColor(1, 0, 1, 0);
|
descUI["textEtat"]:setColor(1, 0, 1, 0)
|
||||||
descUI["b1"]:setText("Unequip");
|
descUI["b1"]:setText("Unequip")
|
||||||
descUI["b1"]:addArg("option", "Unequip");
|
descUI["b1"]:addArg("option", "Unequip")
|
||||||
descUI["b1"]:setVisible(true);
|
descUI["b1"]:setVisible(true)
|
||||||
|
|
||||||
-- Cut and healed
|
-- Cut and healed
|
||||||
elseif partData.is_cut and partData.is_cicatrized and not partData.has_prothesis_equipped and partData.is_amputation_shown then
|
elseif partData.is_cut and partData.is_cicatrized and not partData.has_prothesis_equipped and partData.is_amputation_shown then
|
||||||
@@ -200,7 +205,7 @@ local function setDescUI(player, partName)
|
|||||||
descUI["textEtat"]:setText("Nothing here...");
|
descUI["textEtat"]:setText("Nothing here...");
|
||||||
descUI["textEtat"]:setColor(1, 1, 1, 1);
|
descUI["textEtat"]:setColor(1, 1, 1, 1);
|
||||||
descUI["b1"]:setVisible(false);
|
descUI["b1"]:setVisible(false);
|
||||||
elseif not partData.is_cut and getPlayer():getBodyDamage():getBodyPart(TOC_getBodyPart(partName)):bitten() then
|
elseif not partData.is_cut and getPlayer():getBodyDamage():getBodyPart(TOC_getBodyPart(partName)):bitten() then --TODO fix for MP
|
||||||
descUI["textEtat"]:setText("Bitten...");
|
descUI["textEtat"]:setText("Bitten...");
|
||||||
descUI["textEtat"]:setColor(1, 1, 0, 0);
|
descUI["textEtat"]:setColor(1, 1, 0, 0);
|
||||||
if isPlayerHaveSaw() then
|
if isPlayerHaveSaw() then
|
||||||
@@ -223,7 +228,7 @@ local function setDescUI(player, partName)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Set text for level
|
-- Set text for level
|
||||||
local player = getPlayer();
|
local player = getPlayer()
|
||||||
if string.find(partName, "Right") then
|
if string.find(partName, "Right") then
|
||||||
local lv = player:getPerkLevel(Perks.RightHand) + 1;
|
local lv = player:getPerkLevel(Perks.RightHand) + 1;
|
||||||
descUI["textLV2"]:setText("Level: " .. lv .. " / 10");
|
descUI["textLV2"]:setText("Level: " .. lv .. " / 10");
|
||||||
@@ -386,9 +391,9 @@ local function confirmPressMP(button, args)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function mainPress(button, args)
|
local function mainPress(button, args)
|
||||||
descUI:open();
|
descUI:open()
|
||||||
descUI:setPositionPixel(mainUI:getRight(), mainUI:getY());
|
descUI:setPositionPixel(mainUI:getRight(), mainUI:getY())
|
||||||
setDescUI(args.player, args.part)
|
setDescUI(args.toc_data, args.part)
|
||||||
end
|
end
|
||||||
|
|
||||||
local function descPress(button, args)
|
local function descPress(button, args)
|
||||||
@@ -425,42 +430,67 @@ end
|
|||||||
|
|
||||||
|
|
||||||
-- Make the UIS
|
-- Make the UIS
|
||||||
local function makeMainUI(character)
|
|
||||||
|
local function SetCorrectArgsMainUI(toc_data)
|
||||||
|
|
||||||
|
--mainUI["b11"]:addArg("part", "RightArm")
|
||||||
|
mainUI["b11"]:addArg("toc_data", toc_data)
|
||||||
|
|
||||||
|
--mainUI["b12"]:addArg("part", "LeftArm");
|
||||||
|
mainUI["b12"]:addArg("toc_data", toc_data)
|
||||||
|
|
||||||
|
--mainUI["b21"]:addArg("part", "RightForearm")
|
||||||
|
mainUI["b21"]:addArg("toc_data", toc_data)
|
||||||
|
|
||||||
|
--mainUI["b22"]:addArg("part", "LeftForearm")
|
||||||
|
mainUI["b22"]:addArg("toc_data", toc_data)
|
||||||
|
|
||||||
|
--mainUI["b31"]:addArg("part", "RightHand")
|
||||||
|
mainUI["b31"]:addArg("toc_data", toc_data)
|
||||||
|
|
||||||
|
--mainUI["b32"]:addArg("part", "LeftHand");
|
||||||
|
mainUI["b32"]:addArg("toc_data", toc_data)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
mainUI = NewUI();
|
|
||||||
|
local function makeMainUI(regen)
|
||||||
|
|
||||||
|
|
||||||
|
mainUI = NewUI()
|
||||||
mainUI:setTitle("The Only Cure Menu");
|
mainUI:setTitle("The Only Cure Menu");
|
||||||
mainUI:setWidthPercent(0.1);
|
mainUI:setWidthPercent(0.1);
|
||||||
|
|
||||||
mainUI:addImageButton("b11", "", mainPress)
|
mainUI:addImageButton("b11", "", mainPress)
|
||||||
mainUI["b11"]:addArg("part", "RightArm")
|
mainUI["b11"]:addArg("part", "RightArm")
|
||||||
mainUI["b11"]:addArg("player", character)
|
--mainUI["b11"]:addArg("player", character)
|
||||||
|
|
||||||
|
|
||||||
mainUI:addImageButton("b12", "", mainPress);
|
mainUI:addImageButton("b12", "", mainPress);
|
||||||
mainUI["b12"]:addArg("part", "LeftArm");
|
mainUI["b12"]:addArg("part", "LeftArm");
|
||||||
mainUI["b12"]:addArg("player", character)
|
--mainUI["b12"]:addArg("player", character)
|
||||||
|
|
||||||
mainUI:nextLine();
|
mainUI:nextLine();
|
||||||
|
|
||||||
mainUI:addImageButton("b21", "", mainPress);
|
mainUI:addImageButton("b21", "", mainPress);
|
||||||
mainUI["b21"]:addArg("part", "RightForearm");
|
mainUI["b21"]:addArg("part", "RightForearm");
|
||||||
mainUI["b21"]:addArg("player", character)
|
--mainUI["b21"]:addArg("player", character)
|
||||||
|
|
||||||
|
|
||||||
mainUI:addImageButton("b22", "", mainPress);
|
mainUI:addImageButton("b22", "", mainPress);
|
||||||
mainUI["b22"]:addArg("part", "LeftForearm");
|
mainUI["b22"]:addArg("part", "LeftForearm");
|
||||||
mainUI["b22"]:addArg("player", character)
|
--mainUI["b22"]:addArg("player", character)
|
||||||
|
|
||||||
mainUI:nextLine();
|
mainUI:nextLine();
|
||||||
|
|
||||||
mainUI:addImageButton("b31", "", mainPress);
|
mainUI:addImageButton("b31", "", mainPress);
|
||||||
mainUI["b31"]:addArg("part", "RightHand");
|
mainUI["b31"]:addArg("part", "RightHand");
|
||||||
mainUI["b31"]:addArg("player", character)
|
--mainUI["b31"]:addArg("player", character)
|
||||||
|
|
||||||
mainUI:addImageButton("b32", "", mainPress);
|
mainUI:addImageButton("b32", "", mainPress);
|
||||||
mainUI["b32"]:addArg("part", "LeftHand");
|
mainUI["b32"]:addArg("part", "LeftHand");
|
||||||
mainUI["b32"]:addArg("player", character)
|
--mainUI["b32"]:addArg("player", character)
|
||||||
|
|
||||||
mainUI:saveLayout();
|
mainUI:saveLayout();
|
||||||
end
|
end
|
||||||
@@ -570,17 +600,14 @@ function MakeConfirmUIMP()
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function ISHealthPanel:OnCreateTheOnlyCureUI()
|
function OnCreateTheOnlyCureUI()
|
||||||
|
|
||||||
-- how do we pass the correct player here?
|
-- how do we pass the correct player here?
|
||||||
--print(self.character)
|
--print(self.character)
|
||||||
if ISHealthPanel.otherPlayer then
|
|
||||||
makeMainUI(ISHealthPanel.otherPlayer)
|
makeMainUI();
|
||||||
else
|
makeDescUI();
|
||||||
makeMainUI(getPlayer())
|
makeConfirmUI();
|
||||||
end
|
|
||||||
makeDescUI()
|
|
||||||
makeConfirmUI()
|
|
||||||
|
|
||||||
if isClient() then MakeConfirmUIMP() end
|
if isClient() then MakeConfirmUIMP() end
|
||||||
mainUI:close()
|
mainUI:close()
|
||||||
@@ -595,13 +622,38 @@ local function onCreateUI()
|
|||||||
mainUI:close();
|
mainUI:close();
|
||||||
end
|
end
|
||||||
|
|
||||||
Events.OnCreateUI.Add(ISHealthPanel.OnCreateTheOnlyCureUI)
|
Events.OnCreateUI.Add(OnCreateTheOnlyCureUI)
|
||||||
|
|
||||||
|
|
||||||
-- Add button to health panel
|
-- Add button to health panel
|
||||||
function ISNewHealthPanel.onClick_TOC(button)
|
function ISNewHealthPanel.onClick_TOC(button)
|
||||||
|
|
||||||
|
|
||||||
|
-- button.character is patient
|
||||||
|
-- button.otherPlayer is surgeon
|
||||||
|
|
||||||
|
sendClientCommand(button.character, "TOC", "GetPlayerData", {button.otherPlayer:getOnlineID(), button.character:getOnlineID()}) -- sends 0 & 4 as arguments
|
||||||
|
|
||||||
|
if MP_other_player_toc_data then
|
||||||
|
print("It works")
|
||||||
|
else
|
||||||
|
print("Nopepppp")
|
||||||
|
end
|
||||||
|
|
||||||
|
if button.character ~= button.otherPlayer then
|
||||||
|
|
||||||
|
|
||||||
|
SetCorrectArgsMainUI(MP_other_player_toc_data) --other player is the surgeon
|
||||||
|
|
||||||
|
else
|
||||||
|
SetCorrectArgsMainUI(getPlayer():getModData().TOC) --myself?
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
mainUI:toggle()
|
mainUI:toggle()
|
||||||
|
|
||||||
|
|
||||||
mainUI:setInCenterOfScreen()
|
mainUI:setInCenterOfScreen()
|
||||||
setImageMainUI()
|
setImageMainUI()
|
||||||
end
|
end
|
||||||
@@ -634,5 +686,17 @@ function ISHealthPanel:render()
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function SendOtherPlayerData()
|
||||||
|
|
||||||
|
local mod_data = getPlayer():getModData().TOC
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
function GetOtherPlayerData()
|
||||||
|
local surgeonFact, useBandage, bandageAlcool, usePainkiller, painkillerCount = self:findArgs();
|
||||||
|
|
||||||
|
if self.patient ~= self.surgeon and isClient() then
|
||||||
|
SendCutArm(self.patient, self.partName, surgeonFact, useBandage, bandageAlcool, usePainkiller, painkillerCount);
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -18,8 +18,11 @@ local function dropItem(player, modData)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function everyOneMinute()
|
local function everyOneMinute()
|
||||||
local player = getPlayer();
|
local player = getPlayer()
|
||||||
local modData = player:getModData();
|
local modData = player:getModData()
|
||||||
|
|
||||||
|
--player:transmitModData()
|
||||||
|
|
||||||
if modData.TOC ~= nil then
|
if modData.TOC ~= nil then
|
||||||
dropItem(player, modData);
|
dropItem(player, modData);
|
||||||
CheckIfInfect(player, modData);
|
CheckIfInfect(player, modData);
|
||||||
|
|||||||
@@ -3,16 +3,45 @@
|
|||||||
---Server side
|
---Server side
|
||||||
local Commands = {}
|
local Commands = {}
|
||||||
|
|
||||||
|
-- todo what is this?
|
||||||
Commands["SendServer"] = function(player, arg)
|
Commands["SendServer"] = function(player, arg)
|
||||||
local otherPlayer = getPlayerByOnlineID(arg["To"])
|
local otherPlayer = getPlayerByOnlineID(arg["To"])
|
||||||
print("The Only Cure Command: ", arg['command'])
|
print("The Only Cure Command: ", arg['command'])
|
||||||
sendServerCommand(otherPlayer, "TOC", arg["command"], arg)
|
sendServerCommand(otherPlayer, "TOC", arg["command"], arg)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
local function OnTocClientCommand(module, command, player, args)
|
||||||
|
|
||||||
|
if module == 'TOC' then
|
||||||
|
|
||||||
|
print(command)
|
||||||
|
if command == 'GetPlayerData' then
|
||||||
|
|
||||||
|
local playerOne = getPlayerByOnlineID(args[1])
|
||||||
|
local playerTwo = getPlayerByOnlineID(args[2])
|
||||||
|
local playerOneID = args[1]
|
||||||
|
sendServerCommand(playerTwo, "TOC", "GivePlayerData", {playerOneID})
|
||||||
|
elseif command == 'SendPlayerData' then
|
||||||
|
local playerOne = getPlayerByOnlineID(args[1])
|
||||||
|
local playerOneID = args[1]
|
||||||
|
local toc_data = args[2]
|
||||||
|
sendServerCommand(playerOne, "TOC", "SendTocData", {playerOneID, toc_data})
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
local onClientCommand = function(module, command, player, args)
|
local onClientCommand = function(module, command, player, args)
|
||||||
if module == 'TOC' and Commands[command] then
|
if module == 'TOC' and Commands[command] then
|
||||||
args = args or {}
|
args = args or {}
|
||||||
Commands[command](_, args)
|
Commands[command](_, args)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
Events.OnClientCommand.Add(onClientCommand)
|
Events.OnClientCommand.Add(OnTocClientCommand)
|
||||||
|
|
||||||
|
--Client 1 -> Server -> Client 1
|
||||||
Reference in New Issue
Block a user