Fixes to CutLimbHandler
This commit is contained in:
@@ -7,14 +7,16 @@ local CommandsData = require("TOC/CommandsData")
|
||||
---@field patient IsoPlayer
|
||||
---@field character IsoPlayer
|
||||
---@field limbName string
|
||||
---@field item InventoryItem
|
||||
local CutLimbAction = ISBaseTimedAction:derive("CutLimbAction")
|
||||
|
||||
---Starts CutLimbAction
|
||||
---@param patient IsoPlayer
|
||||
---@param surgeon IsoPlayer
|
||||
---@param limbName string
|
||||
---@param item InventoryItem
|
||||
---@return CutLimbAction
|
||||
function CutLimbAction:new(surgeon, patient, limbName)
|
||||
function CutLimbAction:new(surgeon, patient, limbName, item)
|
||||
local o = {}
|
||||
setmetatable(o, self)
|
||||
self.__index = self
|
||||
@@ -23,6 +25,7 @@ function CutLimbAction:new(surgeon, patient, limbName)
|
||||
o.character = surgeon
|
||||
o.patient = patient
|
||||
o.limbName = limbName
|
||||
o.item = item
|
||||
|
||||
o.stopOnWalk = true
|
||||
o.stopOnRun = true
|
||||
@@ -41,22 +44,45 @@ end
|
||||
function CutLimbAction:start()
|
||||
if self.patient == self.character then
|
||||
-- Self
|
||||
self.handler = AmputationHandler:new(self.limbName)
|
||||
self.handler:damageDuringAmputation()
|
||||
AmputationHandler.ApplyDamageDuringAmputation(self.patient, self.limbName)
|
||||
else
|
||||
-- Other player
|
||||
----@type relayDamageDuringAmputationParams
|
||||
|
||||
|
||||
-- Another player
|
||||
---@type relayDamageDuringAmputationParams
|
||||
local params = {patientNum = self.patient:getOnlineID(), limbName = self.limbName}
|
||||
sendClientCommand(CommandsData.modules.TOC_RELAY, CommandsData.server.Relay.RelayDamageDuringAmputation, params )
|
||||
end
|
||||
|
||||
-- Setup cosmetic stuff
|
||||
self:setActionAnim("SawLog")
|
||||
self:setOverrideHandModels(self.item:getStaticModel())
|
||||
-- if self.character:getPrimaryHandItem() then
|
||||
-- ISTimedActionQueue.add(ISUnequipAction:new(self.character, self.character:getPrimaryHandItem(), 2))
|
||||
-- end
|
||||
-- if self.character:getSecondaryHandItem() and self.character:getSecondaryHandItem() ~= self.character:getPrimaryHandItem() then
|
||||
-- ISTimedActionQueue.add(ISUnequipAction:new(self.character, self.surgeon:getSecondaryHandItem(), 2))
|
||||
-- end
|
||||
|
||||
-- if sawItem then
|
||||
-- self:setOverrideHandModels(sawItem:getStaticModel(), nil)
|
||||
|
||||
-- end
|
||||
|
||||
|
||||
end
|
||||
|
||||
function CutLimbAction:waitToStart()
|
||||
if self.character == self.patient then
|
||||
return false
|
||||
end
|
||||
self.character:faceThisObject(self.patient)
|
||||
return self.character:shouldBeTurning()
|
||||
end
|
||||
|
||||
function CutLimbAction:perform()
|
||||
if self.patient == self.character then
|
||||
TOC_DEBUG.print("patient and surgeon are the same, executing on the client")
|
||||
self.handler:execute(true)
|
||||
local handler = AmputationHandler:new(self.limbName)
|
||||
handler:execute(true)
|
||||
else
|
||||
TOC_DEBUG.print("patient and surgeon not the same, sending relay to server")
|
||||
-- Other player
|
||||
|
||||
Reference in New Issue
Block a user