Merge pull request #123 from ZioPao/main
backmerge to dev since i'm an idiot part 2
This commit is contained in:
@@ -12,8 +12,6 @@ Wait until you succumb to the virus or take matters into your hands. Cut off tha
|
|||||||
|
|
||||||
This version of **The Only Cure** has been rebuilt from scratch to support future additions and to feel as close as possible as a vanilla mechanic.
|
This version of **The Only Cure** has been rebuilt from scratch to support future additions and to feel as close as possible as a vanilla mechanic.
|
||||||
|
|
||||||
**The older version will be delisted shortly and it will not be supported anymore.**
|
|
||||||
|
|
||||||
Supports **Single Player** and **Multiplayer**!
|
Supports **Single Player** and **Multiplayer**!
|
||||||
|
|
||||||
# Setup
|
# Setup
|
||||||
|
|||||||
@@ -416,6 +416,7 @@ function DataController.ReceiveData(key, data)
|
|||||||
handler:setIsResetForced(false)
|
handler:setIsResetForced(false)
|
||||||
handler:setIsDataReady(true)
|
handler:setIsDataReady(true)
|
||||||
|
|
||||||
|
--TOC_DEBUG.print("Finished ReceiveData, triggering OnReceivedTocData")
|
||||||
triggerEvent("OnReceivedTocData", handler.username)
|
triggerEvent("OnReceivedTocData", handler.username)
|
||||||
|
|
||||||
-- TODO We need an event to track if initialization has been finalized
|
-- TODO We need an event to track if initialization has been finalized
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ function ISBaseTimedAction:adjustMaxTime(maxTime)
|
|||||||
-- 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()
|
||||||
if time ~= -1 and dcInst and dcInst:getIsAnyLimbCut() then
|
if time ~= -1 and dcInst and dcInst:getIsAnyLimbCut() then
|
||||||
|
--TOC_DEBUG.print("Overriding adjustMaxTime")
|
||||||
local pl = getPlayer()
|
local pl = getPlayer()
|
||||||
local amputatedLimbs = CachedDataHandler.GetAmputatedLimbs(pl:getUsername())
|
local amputatedLimbs = CachedDataHandler.GetAmputatedLimbs(pl:getUsername())
|
||||||
|
|
||||||
@@ -60,11 +61,10 @@ function ISBaseTimedAction:adjustMaxTime(maxTime)
|
|||||||
if perkLevel ~= 0 then perkLevelScaled = perkLevel / 10 else perkLevelScaled = 0 end
|
if perkLevel ~= 0 then perkLevelScaled = perkLevel / 10 else perkLevelScaled = 0 end
|
||||||
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))
|
--TOC_DEBUG.print("New time with amputations: " .. tostring(time))
|
||||||
end
|
|
||||||
TOC_DEBUG.print("New time with amputations: " .. tostring(time))
|
|
||||||
return time
|
return time
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -122,6 +122,10 @@ function ISEquipWeaponAction:isValid()
|
|||||||
local isPrimaryHandValid = CachedDataHandler.GetHandFeasibility(StaticData.SIDES_IND_STR.R)
|
local isPrimaryHandValid = CachedDataHandler.GetHandFeasibility(StaticData.SIDES_IND_STR.R)
|
||||||
local isSecondaryHandValid = CachedDataHandler.GetHandFeasibility(StaticData.SIDES_IND_STR.L)
|
local isSecondaryHandValid = CachedDataHandler.GetHandFeasibility(StaticData.SIDES_IND_STR.L)
|
||||||
-- Both hands are cut off, so it's impossible to equip in any way
|
-- Both hands are cut off, so it's impossible to equip in any way
|
||||||
|
|
||||||
|
--TOC_DEBUG.print("isPrimaryHandValid : " .. tostring(isPrimaryHandValid))
|
||||||
|
--TOC_DEBUG.print("isSecondaryHandValid : " .. tostring(isSecondaryHandValid))
|
||||||
|
|
||||||
if not isPrimaryHandValid and not isSecondaryHandValid then
|
if not isPrimaryHandValid and not isSecondaryHandValid then
|
||||||
isValid = false
|
isValid = false
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -22,8 +22,6 @@ end
|
|||||||
---Will calculate all the values that we need
|
---Will calculate all the values that we need
|
||||||
function CachedDataHandler.CalculateCacheableValues(username)
|
function CachedDataHandler.CalculateCacheableValues(username)
|
||||||
CachedDataHandler.CalculateHighestAmputatedLimbs(username)
|
CachedDataHandler.CalculateHighestAmputatedLimbs(username)
|
||||||
|
|
||||||
-- FIX This should be run ONLY on the actual client, never on other clients. Just a placeholder fix for now
|
|
||||||
if getPlayer():getUsername() == username then
|
if getPlayer():getUsername() == username then
|
||||||
CachedDataHandler.CalculateBothHandsFeasibility()
|
CachedDataHandler.CalculateBothHandsFeasibility()
|
||||||
end
|
end
|
||||||
@@ -31,7 +29,6 @@ end
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
--* Amputated Limbs caching *--
|
--* Amputated Limbs caching *--
|
||||||
CachedDataHandler.amputatedLimbs = {}
|
CachedDataHandler.amputatedLimbs = {}
|
||||||
|
|
||||||
@@ -120,12 +117,22 @@ CachedDataHandler.handFeasibility = {}
|
|||||||
function CachedDataHandler.CalculateHandFeasibility(limbName)
|
function CachedDataHandler.CalculateHandFeasibility(limbName)
|
||||||
local dcInst = DataController.GetInstance()
|
local dcInst = DataController.GetInstance()
|
||||||
local side = CommonMethods.GetSide(limbName)
|
local side = CommonMethods.GetSide(limbName)
|
||||||
|
|
||||||
|
-- TODO if we re run this too early, it might break everything after a forced re-init
|
||||||
|
|
||||||
CachedDataHandler.handFeasibility[side] = not dcInst:getIsCut(limbName) or dcInst:getIsProstEquipped(limbName)
|
CachedDataHandler.handFeasibility[side] = not dcInst:getIsCut(limbName) or dcInst:getIsProstEquipped(limbName)
|
||||||
|
TOC_DEBUG.print("Calculated hand feasibility: " .. tostring(side))
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param side string Either "L" or "R"
|
---@param side string Either "L" or "R"
|
||||||
---@return boolean
|
---@return boolean
|
||||||
function CachedDataHandler.GetHandFeasibility(side)
|
function CachedDataHandler.GetHandFeasibility(side)
|
||||||
|
|
||||||
|
-- FIX horrendous workaround, but with a forced init we run the caching too early and it breaks this, setting it to nil.
|
||||||
|
if CachedDataHandler.handFeasibility[side] == nil then
|
||||||
|
CachedDataHandler.CalculateBothHandsFeasibility()
|
||||||
|
end
|
||||||
|
|
||||||
return CachedDataHandler.handFeasibility[side]
|
return CachedDataHandler.handFeasibility[side]
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -168,8 +168,12 @@ function ISUnequipAction:perform()
|
|||||||
local highestAmputatedLimbs = CachedDataHandler.GetHighestAmputatedLimbs(getPlayer():getUsername())
|
local highestAmputatedLimbs = CachedDataHandler.GetHighestAmputatedLimbs(getPlayer():getUsername())
|
||||||
if highestAmputatedLimbs then
|
if highestAmputatedLimbs then
|
||||||
local hal = highestAmputatedLimbs[side]
|
local hal = highestAmputatedLimbs[side]
|
||||||
|
if hal then
|
||||||
|
-- This could break if amputated limbs aren't cached for some reason
|
||||||
triggerEvent("OnProsthesisUnequipped", hal)
|
triggerEvent("OnProsthesisUnequipped", hal)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,14 @@ end
|
|||||||
local og_ISUnequipAction_new = ISUnequipAction.new
|
local og_ISUnequipAction_new = ISUnequipAction.new
|
||||||
function ISUnequipAction:new(character, item, time)
|
function ISUnequipAction:new(character, item, time)
|
||||||
local action = og_ISUnequipAction_new(self, character, item, time)
|
local action = og_ISUnequipAction_new(self, character, item, time)
|
||||||
|
---@cast item InventoryItem
|
||||||
|
|
||||||
|
-- For some reason (I have no clue why), if we re-run the method it breaks basically every unequip clothing action. Not for weapons though.
|
||||||
|
if instanceof(item, 'HandWeapon') then
|
||||||
|
--print("Running handlespeedspecificaction")
|
||||||
HandleSpeedSpecificAction(action)
|
HandleSpeedSpecificAction(action)
|
||||||
|
end
|
||||||
|
|
||||||
return action
|
return action
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -159,7 +159,7 @@ description= [/tr]
|
|||||||
|
|
||||||
description= [tr]
|
description= [tr]
|
||||||
|
|
||||||
description= [th]JCloudJalix, Rinary1, pllq, ttaeo[/th]
|
description= [th]JCloudJalix, Rinary1, pllq, ttaeo, pgmbru[/th]
|
||||||
|
|
||||||
description= [th]Translations[/th]
|
description= [th]Translations[/th]
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user