From 5c03cea8c41869f01e22d108aa24a915f9838ec8 Mon Sep 17 00:00:00 2001 From: ZioPao Date: Sun, 21 Apr 2024 02:20:05 +0200 Subject: [PATCH] Equip saw before cutting --- .../TOC/Controllers/LocalPlayerController.lua | 15 +++++++++++++++ .../lua/client/TOC/Handlers/AmputationHandler.lua | 2 +- .../UI/Interactions/CutLimbInteractionHandler.lua | 10 ++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/media/lua/client/TOC/Controllers/LocalPlayerController.lua b/media/lua/client/TOC/Controllers/LocalPlayerController.lua index ef3b02a..05dc242 100644 --- a/media/lua/client/TOC/Controllers/LocalPlayerController.lua +++ b/media/lua/client/TOC/Controllers/LocalPlayerController.lua @@ -331,4 +331,19 @@ end Events.OnPuttingTourniquet.Add(LocalPlayerController.HandleTourniquet) +--* Object drop handling when amputation occurs + +function LocalPlayerController.DropItemsAfterAmputation(limbName) + + -- TODO Check for watches and stuff like that + + + +end + +Events.OnAmputatedLimb.Add(LocalPlayerController.DropItemsAfterAmputation) + + + + return LocalPlayerController \ No newline at end of file diff --git a/media/lua/client/TOC/Handlers/AmputationHandler.lua b/media/lua/client/TOC/Handlers/AmputationHandler.lua index c8fd3d9..0f8c9ae 100644 --- a/media/lua/client/TOC/Handlers/AmputationHandler.lua +++ b/media/lua/client/TOC/Handlers/AmputationHandler.lua @@ -182,7 +182,7 @@ function AmputationHandler:execute(damagePlayer) self:damageAfterAmputation(surgeonFactor) -- Trigger this event - triggerEvent("OnAmputatedLimb") + triggerEvent("OnAmputatedLimb", self.limbName) end ---Deletes the instance diff --git a/media/lua/client/TOC/UI/Interactions/CutLimbInteractionHandler.lua b/media/lua/client/TOC/UI/Interactions/CutLimbInteractionHandler.lua index 4e26d42..9099bc6 100644 --- a/media/lua/client/TOC/UI/Interactions/CutLimbInteractionHandler.lua +++ b/media/lua/client/TOC/UI/Interactions/CutLimbInteractionHandler.lua @@ -69,6 +69,16 @@ end ---@param stitchesItem InventoryItem? ---@param bandageItem InventoryItem? local function PerformAction(surgeon, patient, limbName, sawItem, stitchesItem, bandageItem) + -- get saw in hand + -- todo primary or secondary depending on amputation status of surgeon + ISTimedActionQueue.add(ISEquipWeaponAction:new(surgeon, sawItem, 50, true, false)) + + local lHandItem = surgeon:getSecondaryHandItem() + if lHandItem then + ISTimedActionQueue.add(ISUnequipAction:new(surgeon, lHandItem, 50)) + end + + ISTimedActionQueue.add(CutLimbAction:new(surgeon, patient, limbName, sawItem, stitchesItem, bandageItem)) end