Working MP :)
This commit is contained in:
@@ -31,7 +31,7 @@ end
|
|||||||
-------------------------
|
-------------------------
|
||||||
|
|
||||||
local function OnServerRelayCommand(module, command, args)
|
local function OnServerRelayCommand(module, command, args)
|
||||||
if module == CommandsData.modules.TOC_ACTION and ClientRelayCommands[command] then
|
if module == CommandsData.modules.TOC_RELAY and ClientRelayCommands[command] then
|
||||||
ClientRelayCommands[command](args)
|
ClientRelayCommands[command](args)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -45,14 +45,25 @@ function CutLimbAction:start()
|
|||||||
self.handler:damageDuringAmputation()
|
self.handler:damageDuringAmputation()
|
||||||
else
|
else
|
||||||
-- Other player
|
-- Other player
|
||||||
---@type relayDamageDuringAmputationParams
|
----@type relayDamageDuringAmputationParams
|
||||||
|
|
||||||
|
|
||||||
local params = {patientNum = self.patient:getOnlineID(), limbName = self.limbName}
|
local params = {patientNum = self.patient:getOnlineID(), limbName = self.limbName}
|
||||||
sendClientCommand(CommandsData.modules.TOC_RELAY, CommandsData.server.Relay.RelayDamageDuringAmputation, params )
|
sendClientCommand(CommandsData.modules.TOC_RELAY, CommandsData.server.Relay.RelayDamageDuringAmputation, params )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function CutLimbAction:perform()
|
function CutLimbAction:perform()
|
||||||
self.handler:execute()
|
if self.patient == self.character then
|
||||||
|
TOC_DEBUG.print("patient and surgeon are the same, executing on the client")
|
||||||
|
self.handler:execute(true)
|
||||||
|
else
|
||||||
|
TOC_DEBUG.print("patient and surgeon not the same, sending relay to server")
|
||||||
|
-- Other player
|
||||||
|
---@type relayExecuteAmputationActionParams
|
||||||
|
local params = {patientNum = self.patient:getOnlineID(), limbName = self.limbName}
|
||||||
|
sendClientCommand(CommandsData.modules.TOC_RELAY, CommandsData.server.Relay.RelayExecuteAmputationAction, params )
|
||||||
|
end
|
||||||
ISBaseTimedAction.perform(self)
|
ISBaseTimedAction.perform(self)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -103,10 +103,10 @@ end
|
|||||||
function CutLimbHandler:perform(previousAction, itemType)
|
function CutLimbHandler:perform(previousAction, itemType)
|
||||||
--local item = self:getItemOfType(self.items.ITEMS, itemType)
|
--local item = self:getItemOfType(self.items.ITEMS, itemType)
|
||||||
--previousAction = self:toPlayerInventory(item, previousAction)
|
--previousAction = self:toPlayerInventory(item, previousAction)
|
||||||
|
-- TODO This is broken like this!
|
||||||
local limbName = BodyPartType.ToString(self.bodyPart:getType())
|
local limbName = BodyPartType.ToString(self.bodyPart:getType())
|
||||||
TOC_DEBUG.print("perform CutLimbHandler on " .. limbName)
|
TOC_DEBUG.print("perform CutLimbHandler on " .. limbName)
|
||||||
local action = CutLimbAction:new(self:getPatient(), self:getDoctor(), limbName)
|
local action = CutLimbAction:new(self:getDoctor(),self:getPatient(), limbName)
|
||||||
ISTimedActionQueue.add(action)
|
ISTimedActionQueue.add(action)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
require ("TOC/Debug")
|
||||||
local CommandsData = require("TOC/CommandsData")
|
local CommandsData = require("TOC/CommandsData")
|
||||||
--------------------------------------------
|
--------------------------------------------
|
||||||
|
|
||||||
@@ -9,11 +10,11 @@ local ServerRelayCommands = {}
|
|||||||
---@param surgeonPl IsoPlayer
|
---@param surgeonPl IsoPlayer
|
||||||
---@param args relayDamageDuringAmputationParams
|
---@param args relayDamageDuringAmputationParams
|
||||||
function ServerRelayCommands.RelayDamageDuringAmputation(surgeonPl, args)
|
function ServerRelayCommands.RelayDamageDuringAmputation(surgeonPl, args)
|
||||||
local patientPl = getSpecificPlayer(args.patientNum)
|
local patientPl = getPlayerByOnlineID(args.patientNum)
|
||||||
local surgeonNum = surgeonPl:getOnlineID()
|
local surgeonNum = surgeonPl:getOnlineID()
|
||||||
|
|
||||||
---@type receiveDamageDuringAmputationParams
|
---@type receiveDamageDuringAmputationParams
|
||||||
local params = {surgeonNum = surgeonNum, args.limbName}
|
local params = {surgeonNum = surgeonNum, limbName = args.limbName}
|
||||||
sendServerCommand(patientPl, CommandsData.modules.TOC_RELAY, CommandsData.client.Relay.ReceiveDamageDuringAmputation, params)
|
sendServerCommand(patientPl, CommandsData.modules.TOC_RELAY, CommandsData.client.Relay.ReceiveDamageDuringAmputation, params)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -21,11 +22,11 @@ end
|
|||||||
---@param surgeonPl IsoPlayer
|
---@param surgeonPl IsoPlayer
|
||||||
---@param args relayExecuteAmputationActionParams
|
---@param args relayExecuteAmputationActionParams
|
||||||
function ServerRelayCommands.RelayExecuteAmputationAction(surgeonPl, args)
|
function ServerRelayCommands.RelayExecuteAmputationAction(surgeonPl, args)
|
||||||
local patientPl = getSpecificPlayer(args.patientNum)
|
local patientPl = getPlayerByOnlineID(args.patientNum)
|
||||||
local surgeonNum = surgeonPl:getOnlineID()
|
local surgeonNum = surgeonPl:getOnlineID()
|
||||||
|
|
||||||
---@type receiveDamageDuringAmputationParams
|
---@type receiveDamageDuringAmputationParams
|
||||||
local params = {surgeonNum = surgeonNum, args.limbName}
|
local params = {surgeonNum = surgeonNum, limbName = args.limbName}
|
||||||
sendServerCommand(patientPl, CommandsData.modules.TOC_RELAY, CommandsData.client.Relay.ReceiveExecuteAmputationAction, params)
|
sendServerCommand(patientPl, CommandsData.modules.TOC_RELAY, CommandsData.client.Relay.ReceiveExecuteAmputationAction, params)
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -34,7 +35,7 @@ end
|
|||||||
-------------------------
|
-------------------------
|
||||||
|
|
||||||
local function OnClientRelayCommand(module, command, playerObj, args)
|
local function OnClientRelayCommand(module, command, playerObj, args)
|
||||||
if module == CommandsData.modules.TOC_ACTION and ServerRelayCommands[command] then
|
if module == CommandsData.modules.TOC_RELAY and ServerRelayCommands[command] then
|
||||||
ServerRelayCommands[command](playerObj, args)
|
ServerRelayCommands[command](playerObj, args)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -40,4 +40,10 @@ end
|
|||||||
|
|
||||||
function TOC_DEBUG.printAllServerModData()
|
function TOC_DEBUG.printAllServerModData()
|
||||||
sendClientCommand(CommandsData.modules.TOC_DEBUG, CommandsData.server.Debug.PrintAllTocData, {})
|
sendClientCommand(CommandsData.modules.TOC_DEBUG, CommandsData.server.Debug.PrintAllTocData, {})
|
||||||
|
end
|
||||||
|
|
||||||
|
function TOC_DEBUG.testRelayDamage()
|
||||||
|
---@type relayDamageDuringAmputationParams
|
||||||
|
local params = {limbName = "Hand_R", patientNum = getPlayer():getOnlineID()}
|
||||||
|
sendClientCommand(CommandsData.modules.TOC_RELAY, CommandsData.server.Relay.RelayDamageDuringAmputation, params)
|
||||||
end
|
end
|
||||||
Reference in New Issue
Block a user