Added sandbox option for the phantom pain

This commit is contained in:
Pao
2023-04-03 00:51:18 +02:00
parent 20883a1c38
commit 0a46fd3ab9
3 changed files with 26 additions and 12 deletions

View File

@@ -45,13 +45,13 @@ local function ManagePhantomPain(player, TOCModData)
for _, partName in pairs(TOC_Common.GetPartNames()) do
if limbsData[partName].isCut and limbsData[partName].isAmputationShown and ZombRand(1, 100) < 10 then
local body_part = body_damage:getBodyPart(TOC_Common.GetBodyPartFromPartName(partName))
local added_pain
if limbsData[partName].isCauterized then added_pain = 60 else added_pain = 30 end
body_part:setAdditionalPain(ZombRand(1, added_pain))
local bodyPart = body_damage:getBodyPart(TOC_Common.GetBodyPartFromPartName(partName))
local addedPain
if limbsData[partName].isCauterized then addedPain = 60 else addedPain = 30 end
bodyPart:setAdditionalPain(ZombRand(1, addedPain))
for _, depended_v in pairs(limbParameters[partName].dependsOn) do
if limbsData[depended_v].isCauterized then added_pain = 60 else added_pain = 30 end
body_part:setAdditionalPain(ZombRand(1, added_pain))
if limbsData[depended_v].isCauterized then addedPain = 60 else addedPain = 30 end
bodyPart:setAdditionalPain(ZombRand(1, addedPain))
end
@@ -231,12 +231,18 @@ TOC.UpdateEveryOneMinute = function()
local TOCModData = player:getModData().TOC
if TOCModData ~= nil then
ManagePhantomPain(player, TOCModData)
if SandboxVars.TOC.EnablePhantomPain then
if TOCModData ~= nil then
ManagePhantomPain(player, TOCModData)
end
end
-- Updates TOC data in a global way, basically player:transmitModData but it works
-- Sends only Limbs since the other stuff is mostly static
if TOCModData ~= nil then