Merge pull request #59 from ZioPao/dev

v2.0.10
This commit is contained in:
Pao
2024-05-09 14:47:52 +02:00
committed by GitHub
3 changed files with 11 additions and 12 deletions

View File

@@ -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

View File

@@ -6,7 +6,7 @@ require("TOC/Events")
---@class Main ---@class Main
local Main = { local Main = {
_version = "2.0.9" _version = "2.0.10"
} }
function Main.Start() function Main.Start()

View File

@@ -4,5 +4,5 @@ description=You've been bitten. You have only two choices.
id=TheOnlyCure id=TheOnlyCure
icon=icon.png icon=icon.png
url=https://github.com/ZioPao/The-Only-Cure url=https://github.com/ZioPao/The-Only-Cure
modversion=2.0.9 modversion=2.0.10
pzversion=41.65 pzversion=41.65