Fix to HandleDamage breaking when getIsIgnoredPartInfected==true
This commit is contained in:
@@ -147,7 +147,6 @@ LocalPlayerController.hasBeenDamaged = false
|
|||||||
---Check if the player has in infected body part or if they have been hit in a cut area
|
---Check if the player has in infected body part or if they have been hit in a cut area
|
||||||
---@param character IsoPlayer|IsoGameCharacter
|
---@param character IsoPlayer|IsoGameCharacter
|
||||||
function LocalPlayerController.HandleDamage(character)
|
function LocalPlayerController.HandleDamage(character)
|
||||||
-- TOC_DEBUG.print("Player got hit!")
|
|
||||||
-- TOC_DEBUG.print(damageType)
|
-- TOC_DEBUG.print(damageType)
|
||||||
if character ~= getPlayer() then return end
|
if character ~= getPlayer() then return end
|
||||||
local bd = character:getBodyDamage()
|
local bd = character:getBodyDamage()
|
||||||
@@ -179,18 +178,17 @@ function LocalPlayerController.HandleDamage(character)
|
|||||||
|
|
||||||
-- Check other body parts that are not included in the mod, if there's a bite there then the player is fucked
|
-- Check other body parts that are not included in the mod, if there's a bite there then the player is fucked
|
||||||
-- We can skip this loop if the player has been infected. The one before we kinda need it to handle correctly the bites in case the player wanna cut stuff off anyway
|
-- We can skip this loop if the player has been infected. The one before we kinda need it to handle correctly the bites in case the player wanna cut stuff off anyway
|
||||||
if dcInst:getIsIgnoredPartInfected() then return end
|
if not dcInst:getIsIgnoredPartInfected() then
|
||||||
|
for i = 1, #StaticData.IGNORED_BODYLOCS_BPT do
|
||||||
for i = 1, #StaticData.IGNORED_BODYLOCS_BPT do
|
local bodyPartType = StaticData.IGNORED_BODYLOCS_BPT[i]
|
||||||
local bodyPartType = StaticData.IGNORED_BODYLOCS_BPT[i]
|
local bodyPart = bd:getBodyPart(bodyPartType)
|
||||||
local bodyPart = bd:getBodyPart(bodyPartType)
|
if bodyPart and (bodyPart:bitten() or bodyPart:IsInfected()) then
|
||||||
if bodyPart and (bodyPart:bitten() or bodyPart:IsInfected()) then
|
dcInst:setIsIgnoredPartInfected(true)
|
||||||
dcInst:setIsIgnoredPartInfected(true)
|
modDataNeedsUpdate = true
|
||||||
modDataNeedsUpdate = true
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- TODO in theory should sync modData, but it's gonna be expensive as fuck. Figure it out
|
|
||||||
if modDataNeedsUpdate then
|
if modDataNeedsUpdate then
|
||||||
dcInst:apply()
|
dcInst:apply()
|
||||||
end
|
end
|
||||||
@@ -205,6 +203,7 @@ end
|
|||||||
---@param damageAmount number
|
---@param damageAmount number
|
||||||
function LocalPlayerController.OnGetDamage(character, damageType, damageAmount)
|
function LocalPlayerController.OnGetDamage(character, damageType, damageAmount)
|
||||||
-- TODO Check if other players in the online triggers this
|
-- TODO Check if other players in the online triggers this
|
||||||
|
TOC_DEBUG.print("Player got hit!")
|
||||||
|
|
||||||
if LocalPlayerController.hasBeenDamaged == false then
|
if LocalPlayerController.hasBeenDamaged == false then
|
||||||
-- Start checks
|
-- Start checks
|
||||||
|
|||||||
Reference in New Issue
Block a user