Added exceptions for the adjusted time

This commit is contained in:
ZioPao
2023-11-16 02:41:27 +01:00
parent cda3a61d2a
commit 16e83955f3
3 changed files with 65 additions and 1 deletions

View File

@@ -169,6 +169,11 @@ local og_ISBaseTimedAction_adjustMaxTime = ISBaseTimedAction.adjustMaxTime
---@diagnostic disable-next-line: duplicate-set-field ---@diagnostic disable-next-line: duplicate-set-field
function ISBaseTimedAction:adjustMaxTime(maxTime) function ISBaseTimedAction:adjustMaxTime(maxTime)
local time = og_ISBaseTimedAction_adjustMaxTime(self, 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() local modDataHandler = ModDataHandler.GetInstance()
if time ~= -1 and modDataHandler and modDataHandler:getIsAnyLimbCut() then if time ~= -1 and modDataHandler and modDataHandler:getIsAnyLimbCut() then
local pl = getPlayer() local pl = getPlayer()
@@ -193,6 +198,7 @@ local og_ISBaseTimedAction_perform = ISBaseTimedAction.perform
function ISBaseTimedAction:perform() function ISBaseTimedAction:perform()
og_ISBaseTimedAction_perform(self) og_ISBaseTimedAction_perform(self)
if ModDataHandler.GetInstance():getIsAnyLimbCut() then if ModDataHandler.GetInstance():getIsAnyLimbCut() then
for side, _ in pairs(StaticData.SIDES_IND_STR) do for side, _ in pairs(StaticData.SIDES_IND_STR) do
local limbName = "Hand_" .. side local limbName = "Hand_" .. side

View File

@@ -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

View File

@@ -10,7 +10,7 @@ end
---@param string string ---@param string string
function TOC_DEBUG.print(string) function TOC_DEBUG.print(string)
if isDebugEnabled() then if isDebugEnabled() then
print("TOC: " .. string) print("TOC: " .. tostring(string))
end end
end end