From b6245310bb8843ac51f8dce5b4048a0ddadf214c Mon Sep 17 00:00:00 2001 From: Pao Date: Sat, 4 Feb 2023 04:40:03 +0100 Subject: [PATCH] Hotfix to sound --- media/lua/client/TOC_Client.lua | 14 +++++++++++++- media/lua/client/TimedActions/ISCutLimb.lua | 6 +++--- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/media/lua/client/TOC_Client.lua b/media/lua/client/TOC_Client.lua index 7a862ec..2cc0a49 100644 --- a/media/lua/client/TOC_Client.lua +++ b/media/lua/client/TOC_Client.lua @@ -22,7 +22,13 @@ function SendCutLimb(player, part_name, surgeon_factor, bandage_table, painkille arg["From"] = getPlayer():getOnlineID() arg["To"] = player:getOnlineID() arg["command"] = "CutLimb" - arg["toSend"] = { part_name, surgeon_factor, bandage_table, painkiller_table } + + + -- TODO Hotfix for sound, fix this later + arg["toSend"] = {part_name, surgeon_factor, bandage_table, painkiller_table, getPlayer():getOnlineID()} + + + sendClientCommand("TOC", "SendServer", arg) end @@ -100,6 +106,12 @@ end -- Patient (receive) Commands["CutLimb"] = function(arg) local arg = arg["toSend"] + local surgeon_id = arg[5] + + getPlayerByOnlineID(surgeon_id):getEmitter():stopSoundByName("Amputation_Sound") + + + TocCutLimb(arg[1], arg[2], arg[3], arg[4]) end diff --git a/media/lua/client/TimedActions/ISCutLimb.lua b/media/lua/client/TimedActions/ISCutLimb.lua index 61687d7..d4e6d68 100644 --- a/media/lua/client/TimedActions/ISCutLimb.lua +++ b/media/lua/client/TimedActions/ISCutLimb.lua @@ -24,7 +24,7 @@ end function ISCutLimb:stop() - self.character:getEmitter():stopSoundByName("Amputation_Sound") + self.surgeon:getEmitter():stopSoundByName("Amputation_Sound") end @@ -36,7 +36,7 @@ function ISCutLimb:start() self:setActionAnim("SawLog") local saw_item = TocGetSawInInventory(self.surgeon) - self.sound = self.character:getEmitter():playSound("Amputation_Sound") + self.surgeon:getEmitter():playSound("Amputation_Sound") -- Return whatever object we've got in the inventory if self.surgeon:getPrimaryHandItem() then @@ -119,7 +119,7 @@ function ISCutLimb:perform() TocCutLimb(self.part_name, surgeon_factor, bandage_table, painkiller_table) end - self.character:getEmitter():stopSoundByName("Amputation_Sound") + self.surgeon:getEmitter():stopSoundByName("Amputation_Sound") -- TODO This doesn't work reliably self.surgeon:getXp():AddXP(Perks.Doctor, 400) ISBaseTimedAction.perform(self)