fix: broken skipTOC check for timed actions
This commit is contained in:
@@ -44,11 +44,11 @@ end
|
|||||||
|
|
||||||
|
|
||||||
--------------------------------------------
|
--------------------------------------------
|
||||||
--* TIMED ACTIONS *--
|
--* TIMED ACTIONS
|
||||||
-- We want to be able to modify how long actions are gonna take,
|
--* We want to be able to modify how long actions are gonna take,
|
||||||
-- depending on amputation status and kind of action. Also, when the
|
--* depending on amputation status and kind of action. Also, when the
|
||||||
-- player has not completely cicatrized their own wounds, and try to do any action with
|
--* player has not completely cicatrized their own wounds, and try to do any action with
|
||||||
-- a prosthesis on, that can trigger random bleeds.
|
--* a prosthesis on, that can trigger random bleeds.
|
||||||
|
|
||||||
local function CheckHandFeasibility(limbName)
|
local function CheckHandFeasibility(limbName)
|
||||||
TOC_DEBUG.print("Checking hand feasibility: " .. limbName)
|
TOC_DEBUG.print("Checking hand feasibility: " .. limbName)
|
||||||
@@ -60,18 +60,19 @@ local function CheckHandFeasibility(limbName)
|
|||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--* Time to perform actions overrides *--
|
--* Time to perform actions overrides
|
||||||
local og_ISBaseTimedAction_adjustMaxTime = ISBaseTimedAction.adjustMaxTime
|
local og_ISBaseTimedAction_adjustMaxTime = ISBaseTimedAction.adjustMaxTime
|
||||||
--- Adjust time
|
--- Adjust time
|
||||||
---@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)
|
||||||
|
|
||||||
|
--TOC_DEBUG.print("Running override for adjustMaxTime")
|
||||||
-- Exceptions handling, if we find that parameter then we just use the original time
|
-- Exceptions handling, if we find that parameter then we just use the original time
|
||||||
local actionsQueue = ISTimedActionQueue.getTimedActionQueue(getPlayer())
|
local actionsQueue = ISTimedActionQueue.getTimedActionQueue(getPlayer())
|
||||||
|
|
||||||
if actionsQueue and actionsQueue.current and actionsQueue.skipTOC then
|
if actionsQueue and actionsQueue.current and actionsQueue.current.skipTOC then
|
||||||
--TOC_DEBUG.print("Should skip TOC stuff")
|
TOC_DEBUG.print("Should skip TOC stuff")
|
||||||
return time
|
return time
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -114,23 +115,26 @@ function ISBaseTimedAction:adjustMaxTime(maxTime)
|
|||||||
return time
|
return time
|
||||||
end
|
end
|
||||||
|
|
||||||
--* Random bleeding during cicatrization + Perks leveling override *--
|
--* Random bleeding during cicatrization + Perks leveling override
|
||||||
local og_ISBaseTimedAction_perform = ISBaseTimedAction.perform
|
local og_ISBaseTimedAction_perform = ISBaseTimedAction.perform
|
||||||
--- After each action, level up perks
|
--- After each action, level up perks
|
||||||
---@diagnostic disable-next-line: duplicate-set-field
|
---@diagnostic disable-next-line: duplicate-set-field
|
||||||
function ISBaseTimedAction:perform()
|
function ISBaseTimedAction:perform()
|
||||||
og_ISBaseTimedAction_perform(self)
|
og_ISBaseTimedAction_perform(self)
|
||||||
|
|
||||||
TOC_DEBUG.print("Running ISBaseTimedAction.perform override")
|
|
||||||
TOC_DEBUG.print("max time: " .. tostring(self.maxTime))
|
--TOC_DEBUG.print("Running ISBaseTimedAction.perform override")
|
||||||
|
--TOC_DEBUG.print("max time: " .. tostring(self.maxTime))
|
||||||
|
|
||||||
local dcInst = DataController.GetInstance()
|
local dcInst = DataController.GetInstance()
|
||||||
if not dcInst:getIsAnyLimbCut() then return end
|
if not dcInst:getIsAnyLimbCut() or self.noExp then return end
|
||||||
|
|
||||||
|
|
||||||
|
--* LEVELING
|
||||||
-- First check level of perks. if already at max, skip
|
-- First check level of perks. if already at max, skip
|
||||||
local amputatedLimbs = CachedDataHandler.GetAmputatedLimbs(LocalPlayerController.username)
|
local amputatedLimbs = CachedDataHandler.GetAmputatedLimbs(LocalPlayerController.username)
|
||||||
local xp = self.maxTime / 100
|
local xp = self.maxTime / 100
|
||||||
|
-- TODO Exp should be added while doing the action, not after it's done
|
||||||
|
|
||||||
-- Prevent xp from being negative and decreasing perks
|
-- Prevent xp from being negative and decreasing perks
|
||||||
if xp < 0 then xp = 0 end
|
if xp < 0 then xp = 0 end
|
||||||
@@ -396,4 +400,16 @@ function ISClothingExtraAction:isValid()
|
|||||||
return LimitActionsController.WrapClothingAction(self, og_ISClothingExtraAction_isValid, InventoryItemFactory.CreateItem(self.extra))
|
return LimitActionsController.WrapClothingAction(self, og_ISClothingExtraAction_isValid, InventoryItemFactory.CreateItem(self.extra))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--* Book exception for exp
|
||||||
|
|
||||||
|
local og_ISReadABook_perform = ISReadABook.perform
|
||||||
|
function ISReadABook:perform()
|
||||||
|
self.noExp = true
|
||||||
|
og_ISReadABook_perform(self)
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
return LimitActionsController
|
return LimitActionsController
|
||||||
Reference in New Issue
Block a user