Fixed more MP stuff
This commit is contained in:
@@ -52,16 +52,6 @@ function AskCanOperateLimb(player, part_name)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
function AskCanResetEverything(other_player)
|
|
||||||
GetConfirmUIMP().responseReceive = false;
|
|
||||||
local arg = {}
|
|
||||||
arg["From"] = getPlayer():getOnlineID()
|
|
||||||
arg["To"] = other_player:getOnlineID()
|
|
||||||
arg["command"] = "CanResetEverything"
|
|
||||||
arg["toSend"] = {}
|
|
||||||
sendClientCommand("TOC", "SendServer", arg)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Patient (receive)
|
-- Patient (receive)
|
||||||
Commands["CutLimb"] = function(arg)
|
Commands["CutLimb"] = function(arg)
|
||||||
local arg = arg["toSend"]
|
local arg = arg["toSend"]
|
||||||
@@ -109,32 +99,41 @@ Commands["ResetEverything"] = function(arg)
|
|||||||
ResetEverything()
|
ResetEverything()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Cheating stuff
|
||||||
|
Commands["AcceptResetEverything"] = function(arg)
|
||||||
|
|
||||||
|
local clicked_player = getPlayerByOnlineID(arg[1]) -- TODO delete this
|
||||||
|
ResetEverything()
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
-- Base stuff
|
||||||
|
Commands["GivePlayerData"] = function(arg)
|
||||||
|
local surgeon_id = arg[1]
|
||||||
|
local patient = getPlayerByOnlineID(arg[2])
|
||||||
|
local toc_data = patient:getModData().TOC
|
||||||
|
sendClientCommand(patient, "TOC", "SendPlayerData", {surgeon_id, toc_data})
|
||||||
|
end
|
||||||
|
|
||||||
|
Commands["SendTocData"] = function(arg)
|
||||||
|
print("Sending TOC data")
|
||||||
|
local patient = getPlayerByOnlineID(arg[1])
|
||||||
|
|
||||||
|
MP_other_player_toc_data = arg[2]
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
local function OnTocServerCommand(module, command, args)
|
local function OnTocServerCommand(module, command, args)
|
||||||
if module == 'TOC' then
|
if module == 'TOC' then
|
||||||
if command == 'GivePlayerData' then
|
print("OnTocServerCommand " .. command)
|
||||||
--local surgeon = getPlayerByOnlineID(args[1])
|
if Commands[command] then
|
||||||
|
|
||||||
local surgeon_id = args[1]
|
|
||||||
|
|
||||||
local patient = getPlayerByOnlineID(args[2])
|
|
||||||
local toc_data = patient:getModData().TOC
|
|
||||||
|
|
||||||
-- todo maybe we cant send a table like this. Let's try something easier
|
|
||||||
--local moneyAmount = playerTwo:getInventory():getCountTypeRecurse("Money")
|
|
||||||
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})
|
|
||||||
|
|
||||||
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]
|
|
||||||
elseif Commands[command] then
|
|
||||||
args = args or {}
|
args = args or {}
|
||||||
Commands[command](args)
|
Commands[command](args)
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,14 @@ local function OperateLocal(_, patient, surgeon, part_name, use_oven)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function TryToToResetEverythingOtherPlayer(_, patient, surgeon)
|
||||||
|
|
||||||
|
sendClientCommand(surgeon, "TOC", "AskToResetEverything", {patient:getOnlineID()})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
--TODO Make the name more unique
|
--TODO Make the name more unique
|
||||||
function TryActionOnOtherPlayerLocal(_, part_name, action, surgeon, patient)
|
function TryActionOnOtherPlayerLocal(_, part_name, action, surgeon, patient)
|
||||||
|
|
||||||
@@ -35,8 +43,6 @@ function TryActionOnOtherPlayerLocal(_, part_name, action, surgeon, patient)
|
|||||||
AskCanCutLimb(patient, part_name)
|
AskCanCutLimb(patient, part_name)
|
||||||
elseif action == "Operate" then
|
elseif action == "Operate" then
|
||||||
AskCanOperateLimb(patient, part_name)
|
AskCanOperateLimb(patient, part_name)
|
||||||
elseif action == "ResetEverything" then
|
|
||||||
AskCanResetEverything(patient)
|
|
||||||
end
|
end
|
||||||
ui.actionAct = action
|
ui.actionAct = action
|
||||||
ui.partNameAct = part_name
|
ui.partNameAct = part_name
|
||||||
@@ -100,10 +106,10 @@ function ISWorldObjectContextMenu.OnFillTOCMenu(player, context, worldObjects, t
|
|||||||
|
|
||||||
|
|
||||||
if clickedPlayer == player_obj then
|
if clickedPlayer == player_obj then
|
||||||
cheat_menu:addOption("Reset TOC for me", worldObjects, ResetEverything, clickedPlayer)
|
cheat_menu:addOption("Reset TOC for me", worldObjects, ResetEverything)
|
||||||
|
|
||||||
else
|
else
|
||||||
cheat_menu:addOption("Reset TOC for " .. clickedPlayer:getUsername(), worldObjects, TryActionOnOtherPlayerLocal, _, "ResetEverything", player_obj, clickedPlayer)
|
cheat_menu:addOption("Reset TOC for " .. clickedPlayer:getUsername(), worldObjects, TryToToResetEverythingOtherPlayer, clickedPlayer, player_obj)
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -616,7 +616,15 @@ function ISNewHealthPanel.onClick_TOC(button)
|
|||||||
if button.otherPlayer then
|
if button.otherPlayer then
|
||||||
if button.character ~= button.otherPlayer then
|
if button.character ~= button.otherPlayer then
|
||||||
sendClientCommand(button.otherPlayer, "TOC", "GetPlayerData", {button.otherPlayer:getOnlineID(), button.character:getOnlineID()})
|
sendClientCommand(button.otherPlayer, "TOC", "GetPlayerData", {button.otherPlayer:getOnlineID(), button.character:getOnlineID()})
|
||||||
SetCorrectArgsMainUI(MP_other_player_toc_data) --other player is the surgeon
|
|
||||||
|
if MP_other_player_toc_data == nil then
|
||||||
|
print("MP_other_player_toc_data is still nil")
|
||||||
|
else
|
||||||
|
SetCorrectArgsMainUI(MP_other_player_toc_data) --other player is the surgeon
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
else
|
else
|
||||||
SetCorrectArgsMainUI(getPlayer():getModData().TOC) --myself?
|
SetCorrectArgsMainUI(getPlayer():getModData().TOC) --myself?
|
||||||
|
|
||||||
|
|||||||
@@ -3,28 +3,47 @@
|
|||||||
|
|
||||||
---Server side
|
---Server side
|
||||||
local Commands = {}
|
local Commands = {}
|
||||||
|
|
||||||
|
|
||||||
|
--TODO how does this work
|
||||||
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
|
||||||
|
|
||||||
|
|
||||||
|
-- To make the UI Work
|
||||||
|
Commands["GetPlayerData"] = function(_, arg)
|
||||||
|
local surgeon_id = arg[1]
|
||||||
|
local patient_id = arg[2]
|
||||||
|
local patient = getPlayerByOnlineID(arg[2])
|
||||||
|
sendServerCommand(patient, "TOC", "GivePlayerData", {surgeon_id, patient_id})
|
||||||
|
end
|
||||||
|
|
||||||
|
Commands["SendPlayerData"] = function(_, arg)
|
||||||
|
local surgeon = getPlayerByOnlineID(arg[1])
|
||||||
|
local surgeon_id = arg[1]
|
||||||
|
local toc_data = arg[2]
|
||||||
|
sendServerCommand(surgeon, "TOC", "SendTocData", {surgeon_id, toc_data})
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
-- CHEATING STUFF
|
||||||
|
Commands["AskToResetEverything"] = function (_, arg)
|
||||||
|
local clicked_player = getPlayerByOnlineID(arg[1])
|
||||||
|
local clicked_player_id = arg[1]
|
||||||
|
|
||||||
|
|
||||||
|
sendServerCommand(clicked_player, "TOC", "AcceptResetEverything", {clicked_player_id})
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
local function OnTocClientCommand(module, command, player, args)
|
local function OnTocClientCommand(module, command, player, args)
|
||||||
if module == 'TOC' then
|
if module == 'TOC' then
|
||||||
print(command)
|
print("OnTocClientCommand " .. command)
|
||||||
if command == 'GetPlayerData' then
|
if Commands[command] then
|
||||||
local surgeon_id = args[1]
|
|
||||||
local patient_id = args[2]
|
|
||||||
--local playerOne = getPlayerByOnlineID(args[1])
|
|
||||||
local patient = getPlayerByOnlineID(args[2])
|
|
||||||
--local playerOneID = args[1]
|
|
||||||
sendServerCommand(patient, "TOC", "GivePlayerData", {surgeon_id, patient_id})
|
|
||||||
elseif command == 'SendPlayerData' then
|
|
||||||
local surgeon = getPlayerByOnlineID(args[1])
|
|
||||||
local surgeon_id = args[1]
|
|
||||||
local toc_data = args[2]
|
|
||||||
sendServerCommand(surgeon, "TOC", "SendTocData", {surgeon_id, toc_data})
|
|
||||||
elseif Commands[command] then
|
|
||||||
args = args or {}
|
args = args or {}
|
||||||
Commands[command](_, args)
|
Commands[command](_, args)
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user