diff --git a/media/lua/client/TOC/Handlers/PlayerHandler.lua b/media/lua/client/TOC/Handlers/PlayerHandler.lua index b25ebf1..5c75179 100644 --- a/media/lua/client/TOC/Handlers/PlayerHandler.lua +++ b/media/lua/client/TOC/Handlers/PlayerHandler.lua @@ -169,6 +169,11 @@ local og_ISBaseTimedAction_adjustMaxTime = ISBaseTimedAction.adjustMaxTime ---@diagnostic disable-next-line: duplicate-set-field function ISBaseTimedAction:adjustMaxTime(maxTime) local time = og_ISBaseTimedAction_adjustMaxTime(self, maxTime) + + -- Exceptions handling, if we find that parameter then we just use the original time + local queue = ISTimedActionQueue.getTimedActionQueue(getPlayer()) + if queue.current.skipTOC then return time end + local modDataHandler = ModDataHandler.GetInstance() if time ~= -1 and modDataHandler and modDataHandler:getIsAnyLimbCut() then local pl = getPlayer() @@ -193,6 +198,7 @@ local og_ISBaseTimedAction_perform = ISBaseTimedAction.perform function ISBaseTimedAction:perform() og_ISBaseTimedAction_perform(self) + if ModDataHandler.GetInstance():getIsAnyLimbCut() then for side, _ in pairs(StaticData.SIDES_IND_STR) do local limbName = "Hand_" .. side diff --git a/media/lua/client/TOC/TimedActions/IgnoredActions.lua b/media/lua/client/TOC/TimedActions/IgnoredActions.lua new file mode 100644 index 0000000..e668e74 --- /dev/null +++ b/media/lua/client/TOC/TimedActions/IgnoredActions.lua @@ -0,0 +1,58 @@ +---@diagnostic disable: duplicate-set-field +-- Bunch of actions shouldn't be modified by the adjusted time + +local og_ISEatFoodAction_new = ISEatFoodAction.new +function ISEatFoodAction:new(character, item, percentage) + local action = og_ISEatFoodAction_new(self, character, item, percentage) + TOC_DEBUG.print("Override ISEatFoodAction") + action.skipTOC = true + return action +end + +local og_ISReadABook_new = ISReadABook.new +function ISReadABook:new(character, item, time) + local action = og_ISReadABook_new(self, character, item, time) + TOC_DEBUG.print("Override ISReadABook") + action.skipTOC = true + return action +end + +local og_ISTakePillAction_new = ISTakePillAction.new +function ISTakePillAction:new(character, item, time) + local action = og_ISTakePillAction_new(self, character, item, time) + TOC_DEBUG.print("Override ISTakePillAction") + action.skipTOC = true + return action +end + +local og_ISTakeWaterAction_new = ISTakeWaterAction.new +function ISTakeWaterAction:new(character, item, waterUnit, waterObject, time, oldItem) + local action = og_ISTakeWaterAction_new(self, character, item, waterUnit, waterObject, time, oldItem) + TOC_DEBUG.print("Override ISTakeWaterAction") + action.skipTOC = true + return action +end + +local og_ISDrinkFromBottle_new = ISDrinkFromBottle.new +function ISDrinkFromBottle:new(character, item, uses) + local action = og_ISDrinkFromBottle_new(self, character, item, uses) + TOC_DEBUG.print("Override ISDrinkFromBottle") + action.skipTOC = true + return action +end + +local og_ISFinalizeDealAction_new = ISFinalizeDealAction.new +function ISFinalizeDealAction:new(player, otherPlayer, itemsToGive, itemsToReceive, time) + local action = og_ISFinalizeDealAction_new(self, player, otherPlayer, itemsToGive, itemsToReceive, time) + TOC_DEBUG.print("Override ISFinalizeDealAction") + action.skipTOC = true + return action +end + +local og_ISCampingInfoAction_new = ISCampingInfoAction.new +function ISCampingInfoAction:new(character, campfireObject, campfire) + local action = og_ISCampingInfoAction_new(self, character, campfireObject, campfire) + TOC_DEBUG.print("Override ISCampingInfoAction") + action.skipTOC = true + return action +end \ No newline at end of file diff --git a/media/lua/shared/TOC/Debug.lua b/media/lua/shared/TOC/Debug.lua index 6247130..648d68f 100644 --- a/media/lua/shared/TOC/Debug.lua +++ b/media/lua/shared/TOC/Debug.lua @@ -10,7 +10,7 @@ end ---@param string string function TOC_DEBUG.print(string) if isDebugEnabled() then - print("TOC: " .. string) + print("TOC: " .. tostring(string)) end end