Added exceptions for various equipping actions
This commit is contained in:
@@ -32,8 +32,12 @@ 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
|
-- Exceptions handling, if we find that parameter then we just use the original time
|
||||||
local queue = ISTimedActionQueue.getTimedActionQueue(getPlayer())
|
local actionsQueue = ISTimedActionQueue.getTimedActionQueue(getPlayer())
|
||||||
if queue and queue.current and queue.current.skipTOC then return time end
|
|
||||||
|
if actionsQueue and actionsQueue.current and actionsQueue.skipTOC then
|
||||||
|
--TOC_DEBUG.print("Should skip TOC stuff")
|
||||||
|
return time
|
||||||
|
end
|
||||||
|
|
||||||
-- Action is valid, check if we have any cut limb and then modify maxTime
|
-- Action is valid, check if we have any cut limb and then modify maxTime
|
||||||
local dcInst = DataController.GetInstance()
|
local dcInst = DataController.GetInstance()
|
||||||
@@ -57,6 +61,10 @@ function ISBaseTimedAction:adjustMaxTime(maxTime)
|
|||||||
time = time * (StaticData.LIMBS_TIME_MULTIPLIER_IND_NUM[limbName] - perkLevelScaled)
|
time = time * (StaticData.LIMBS_TIME_MULTIPLIER_IND_NUM[limbName] - perkLevelScaled)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if actionsQueue and actionsQueue.current then
|
||||||
|
TOC_DEBUG.print("OG Action: " .. tostring(actionsQueue.current.Type))
|
||||||
|
end
|
||||||
|
TOC_DEBUG.print("New time with amputations: " .. tostring(time))
|
||||||
return time
|
return time
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,60 @@
|
|||||||
---@diagnostic disable: duplicate-set-field
|
---@diagnostic disable: duplicate-set-field
|
||||||
-- Bunch of actions shouldn't be modified by the adjusted time
|
-- Bunch of actions shouldn't be modified by the adjusted time
|
||||||
|
|
||||||
|
-----------------------------------------------
|
||||||
|
---* Some actions have specific maxTime calculations and we must account for that
|
||||||
|
---ISAttachItemHotbar
|
||||||
|
---ISDetachItemHotbar
|
||||||
|
---ISEquipWeaponAction
|
||||||
|
---ISUnequipAction
|
||||||
|
|
||||||
|
--- We're forced to re-run this crap to fix it
|
||||||
|
---@param action ISBaseTimedAction
|
||||||
|
local function HandleSpeedSpecificAction(action)
|
||||||
|
action.skipTOC = true
|
||||||
|
action.animSpeed = action.maxTime / action:adjustMaxTime(action.maxTime)
|
||||||
|
action.maxTime = -1
|
||||||
|
end
|
||||||
|
|
||||||
|
local og_ISAttachItemHotbar_new = ISAttachItemHotbar.new
|
||||||
|
function ISAttachItemHotbar:new(character, item, slot, slotIndex, slotDef)
|
||||||
|
local action = og_ISAttachItemHotbar_new(self, character, item, slot, slotIndex, slotDef)
|
||||||
|
HandleSpeedSpecificAction(action)
|
||||||
|
return action
|
||||||
|
end
|
||||||
|
|
||||||
|
local og_ISDetachItemHotbar_new = ISDetachItemHotbar.new
|
||||||
|
function ISDetachItemHotbar:new(character, item)
|
||||||
|
local action = og_ISDetachItemHotbar_new(self, character, item)
|
||||||
|
HandleSpeedSpecificAction(action)
|
||||||
|
return action
|
||||||
|
end
|
||||||
|
|
||||||
|
local og_ISEquipWeaponAction_new = ISEquipWeaponAction.new
|
||||||
|
function ISEquipWeaponAction:new(character, item, time, primary, twoHands)
|
||||||
|
local action = og_ISEquipWeaponAction_new(self, character, item, time, primary, twoHands)
|
||||||
|
--TOC_DEBUG.print("Override ISEquipWeaponAction")
|
||||||
|
if not twoHands then
|
||||||
|
HandleSpeedSpecificAction(action)
|
||||||
|
end
|
||||||
|
return action
|
||||||
|
end
|
||||||
|
|
||||||
|
local og_ISUnequipAction_new = ISUnequipAction.new
|
||||||
|
function ISUnequipAction:new(character, item, time)
|
||||||
|
local action = og_ISUnequipAction_new(self, character, item, time)
|
||||||
|
HandleSpeedSpecificAction(action)
|
||||||
|
return action
|
||||||
|
end
|
||||||
|
|
||||||
|
------------------------------------------------------
|
||||||
|
--- Normal cases
|
||||||
|
|
||||||
|
|
||||||
local og_ISEatFoodAction_new = ISEatFoodAction.new
|
local og_ISEatFoodAction_new = ISEatFoodAction.new
|
||||||
function ISEatFoodAction:new(character, item, percentage)
|
function ISEatFoodAction:new(character, item, percentage)
|
||||||
local action = og_ISEatFoodAction_new(self, character, item, percentage)
|
local action = og_ISEatFoodAction_new(self, character, item, percentage)
|
||||||
TOC_DEBUG.print("Override ISEatFoodAction")
|
--TOC_DEBUG.print("Override ISEatFoodAction")
|
||||||
action.skipTOC = true
|
action.skipTOC = true
|
||||||
return action
|
return action
|
||||||
end
|
end
|
||||||
@@ -12,7 +62,7 @@ end
|
|||||||
local og_ISReadABook_new = ISReadABook.new
|
local og_ISReadABook_new = ISReadABook.new
|
||||||
function ISReadABook:new(character, item, time)
|
function ISReadABook:new(character, item, time)
|
||||||
local action = og_ISReadABook_new(self, character, item, time)
|
local action = og_ISReadABook_new(self, character, item, time)
|
||||||
TOC_DEBUG.print("Override ISReadABook")
|
--TOC_DEBUG.print("Override ISReadABook")
|
||||||
action.skipTOC = true
|
action.skipTOC = true
|
||||||
return action
|
return action
|
||||||
end
|
end
|
||||||
@@ -20,7 +70,7 @@ end
|
|||||||
local og_ISTakePillAction_new = ISTakePillAction.new
|
local og_ISTakePillAction_new = ISTakePillAction.new
|
||||||
function ISTakePillAction:new(character, item, time)
|
function ISTakePillAction:new(character, item, time)
|
||||||
local action = og_ISTakePillAction_new(self, character, item, time)
|
local action = og_ISTakePillAction_new(self, character, item, time)
|
||||||
TOC_DEBUG.print("Override ISTakePillAction")
|
--TOC_DEBUG.print("Override ISTakePillAction")
|
||||||
action.skipTOC = true
|
action.skipTOC = true
|
||||||
return action
|
return action
|
||||||
end
|
end
|
||||||
@@ -28,7 +78,7 @@ end
|
|||||||
local og_ISTakeWaterAction_new = ISTakeWaterAction.new
|
local og_ISTakeWaterAction_new = ISTakeWaterAction.new
|
||||||
function ISTakeWaterAction:new(character, item, waterUnit, waterObject, time, oldItem)
|
function ISTakeWaterAction:new(character, item, waterUnit, waterObject, time, oldItem)
|
||||||
local action = og_ISTakeWaterAction_new(self, character, item, waterUnit, waterObject, time, oldItem)
|
local action = og_ISTakeWaterAction_new(self, character, item, waterUnit, waterObject, time, oldItem)
|
||||||
TOC_DEBUG.print("Override ISTakeWaterAction")
|
--TOC_DEBUG.print("Override ISTakeWaterAction")
|
||||||
action.skipTOC = true
|
action.skipTOC = true
|
||||||
return action
|
return action
|
||||||
end
|
end
|
||||||
@@ -36,7 +86,7 @@ end
|
|||||||
local og_ISDrinkFromBottle_new = ISDrinkFromBottle.new
|
local og_ISDrinkFromBottle_new = ISDrinkFromBottle.new
|
||||||
function ISDrinkFromBottle:new(character, item, uses)
|
function ISDrinkFromBottle:new(character, item, uses)
|
||||||
local action = og_ISDrinkFromBottle_new(self, character, item, uses)
|
local action = og_ISDrinkFromBottle_new(self, character, item, uses)
|
||||||
TOC_DEBUG.print("Override ISDrinkFromBottle")
|
--TOC_DEBUG.print("Override ISDrinkFromBottle")
|
||||||
action.skipTOC = true
|
action.skipTOC = true
|
||||||
return action
|
return action
|
||||||
end
|
end
|
||||||
@@ -44,7 +94,7 @@ end
|
|||||||
local og_ISFinalizeDealAction_new = ISFinalizeDealAction.new
|
local og_ISFinalizeDealAction_new = ISFinalizeDealAction.new
|
||||||
function ISFinalizeDealAction:new(player, otherPlayer, itemsToGive, itemsToReceive, time)
|
function ISFinalizeDealAction:new(player, otherPlayer, itemsToGive, itemsToReceive, time)
|
||||||
local action = og_ISFinalizeDealAction_new(self, player, otherPlayer, itemsToGive, itemsToReceive, time)
|
local action = og_ISFinalizeDealAction_new(self, player, otherPlayer, itemsToGive, itemsToReceive, time)
|
||||||
TOC_DEBUG.print("Override ISFinalizeDealAction")
|
--TOC_DEBUG.print("Override ISFinalizeDealAction")
|
||||||
action.skipTOC = true
|
action.skipTOC = true
|
||||||
return action
|
return action
|
||||||
end
|
end
|
||||||
@@ -52,7 +102,7 @@ end
|
|||||||
local og_ISCampingInfoAction_new = ISCampingInfoAction.new
|
local og_ISCampingInfoAction_new = ISCampingInfoAction.new
|
||||||
function ISCampingInfoAction:new(character, campfireObject, campfire)
|
function ISCampingInfoAction:new(character, campfireObject, campfire)
|
||||||
local action = og_ISCampingInfoAction_new(self, character, campfireObject, campfire)
|
local action = og_ISCampingInfoAction_new(self, character, campfireObject, campfire)
|
||||||
TOC_DEBUG.print("Override ISCampingInfoAction")
|
--TOC_DEBUG.print("Override ISCampingInfoAction")
|
||||||
action.skipTOC = true
|
action.skipTOC = true
|
||||||
return action
|
return action
|
||||||
end
|
end
|
||||||
Reference in New Issue
Block a user