This commit is contained in:
ZioPao
2023-11-11 03:04:48 +01:00
parent 9459360948
commit 2cf794552f
7 changed files with 19 additions and 52 deletions

View File

@@ -101,25 +101,17 @@ end
local og_ISInventoryPane_refreshContainer = ISInventoryPane.refreshContainer
---Get the list of items for the container and remove the amputations
---Get the list of items for the container and remove the reference to the amputation items
function ISInventoryPane:refreshContainer()
-- Search into the container and remove the reference to the amputation item
og_ISInventoryPane_refreshContainer(self)
if TOC_DEBUG.disablePaneMod then return end
for i=1, #self.itemslist do
local cItem = self.itemslist[i]
if cItem and cItem.cat == "Amputation" then
--print("TOC: current item is an amputation, removing it from the list")
table.remove(self.itemslist, i)
end
end
end
return ItemsHandler

View File

@@ -34,7 +34,6 @@ function ModDataHandler:setup(force)
self:createData()
end
-- TODO Check compatibility or do we just skip it at this point?
end
function ModDataHandler:createData()
@@ -61,10 +60,8 @@ function ModDataHandler:createData()
modData[StaticData.MOD_NAME][limbName] = {}
self:setLimbParams(StaticData.LIMBS_STRINGS[i], defaultParams, 0)
end
end
-----------------
--* Setters *--
@@ -74,7 +71,6 @@ function ModDataHandler:setIsAnyLimbCut(isAnyLimbCut)
self.tocData.isAnyLimbCut = true
end
---Set isCut
---@param limbName string
---@param isCut boolean
@@ -104,7 +100,6 @@ function ModDataHandler:getIsAnyLimbCut()
return self.tocData.isAnyLimbCut
end
---Get isCut
---@param limbName string
---@return boolean
@@ -124,8 +119,6 @@ function ModDataHandler:getIsVisible(limbName)
return self.tocData[limbName].isVisible
end
--* Limbs data handling *--
---Set a limb and its dependend limbs as cut
@@ -155,10 +148,8 @@ function ModDataHandler:setCutLimb(limbName, isOperated, isCicatrized, isCauteri
-- Set that a limb has been cut, to activate some functions without having to loop through the parts
self:setIsAnyLimbCut(true)
end
---Internal use only, set a limb data
---@param limbName string
---@param ampStatus partData {isCut, isInfected, isOperated, isCicatrized, isCauterized, isVisible}
@@ -176,8 +167,6 @@ function ModDataHandler:setLimbParams(limbName, ampStatus, cicatrizationTime)
if cicatrizationTime ~= nil then limbData.cicatrizationTime = cicatrizationTime end
end
---@return ModDataHandler
function ModDataHandler.GetInstance()
if ModDataHandler.instance ~= nil then
@@ -187,7 +176,4 @@ function ModDataHandler.GetInstance()
end
end
return ModDataHandler

View File

@@ -66,6 +66,9 @@ function PlayerHandler.AddLocalAmputatedLimb(limbName)
end
--* Getters *--
---Get a table with the strings of the amputated limbs
---@return table
function PlayerHandler.GetAmputatedLimbs()
return PlayerHandler.amputatedLimbs or {}
end
@@ -75,7 +78,6 @@ end
---Check if the player has an infected (as in, zombie infection) body part
---@param character IsoGameCharacter
function PlayerHandler.CheckInfection(character)
-- This fucking event barely works. Bleeding seems to be the only thing that triggers it
if character ~= getPlayer() then return end
local bd = character:getBodyDamage()
@@ -104,30 +106,12 @@ function PlayerHandler.CheckInfection(character)
PlayerHandler.modDataHandler:setIsIgnoredPartInfected(true)
end
end
end
Events.OnPlayerGetDamage.Add(PlayerHandler.CheckInfection)
---Handle perks
---@param player IsoPlayer
function PlayerHandler.UpdatePerks(player)
-- TODO If player has an amputated limb, they're gonna level up them while doing normal stuff, getting better at it dynamically
-- TODO We should have a way to check if the player has done any amputation at all instead of having to check manually each time
-- TODO Should be run when player is doing stuff like picking up objects, not randomly
for side, _ in pairs(StaticData.SIDES_STRINGS) do
local limbName = "Hand_" .. side
if ModDataHandler.GetInstance():getIsCut(limbName) then
player:getXp():AddXP(Perks["Side_" .. side], 0.1)
end
end
end
--Events.OnPlayerUpdate.Add(PlayerHandler.UpdatePerks)
--* Some overrides *--
--* Overrides *--
local og_ISBaseTimedAction_adjustMaxTime = ISBaseTimedAction.adjustMaxTime
--- Adjust time
@@ -167,5 +151,4 @@ function ISBaseTimedAction:perform()
end
return PlayerHandler