Implemented random limb side for Zombie Amputations
This commit is contained in:
@@ -61,8 +61,6 @@ end
|
|||||||
|
|
||||||
-------------------------------
|
-------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
local bloodAmount = 10
|
local bloodAmount = 10
|
||||||
|
|
||||||
|
|
||||||
@@ -84,13 +82,22 @@ local function HandleZombiesAmputations(player, zombie, handWeapon, damage)
|
|||||||
if (damage > SandboxVars.TOC.ZombieAmputationDamageThreshold and randomChance) or isCrit then
|
if (damage > SandboxVars.TOC.ZombieAmputationDamageThreshold and randomChance) or isCrit then
|
||||||
TOC_DEBUG.print("Amputating zombie limbs - damage: " .. tostring(damage))
|
TOC_DEBUG.print("Amputating zombie limbs - damage: " .. tostring(damage))
|
||||||
local zombieInv = zombie:getInventory()
|
local zombieInv = zombie:getInventory()
|
||||||
|
|
||||||
-- Check left or right
|
-- Check left or right
|
||||||
if not zombieInv:containsEval(PredicateAmputationItemLeft) then
|
local randSide = ZombRand(2) -- Random side
|
||||||
SpawnAmputation(zombie, "L")
|
local preferredSide = randSide == 0 and "L" or "R"
|
||||||
elseif not zombieInv:containsEval(PredicateAmputationItemRight) then
|
local alternateSide = preferredSide == "L" and "R" or "L"
|
||||||
SpawnAmputation(zombie, "R")
|
|
||||||
|
local predicatePreferred = preferredSide == "L" and PredicateAmputationItemLeft or PredicateAmputationItemRight
|
||||||
|
local predicateAlternate = alternateSide == "L" and PredicateAmputationItemLeft or PredicateAmputationItemRight
|
||||||
|
|
||||||
|
if not zombieInv:containsEval(predicatePreferred) then
|
||||||
|
SpawnAmputation(zombie, preferredSide)
|
||||||
|
elseif not zombieInv:containsEval(predicateAlternate) then
|
||||||
|
SpawnAmputation(zombie, alternateSide)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
TOC_DEBUG.print("Amputating zombie limbs - damage: " .. tostring(damage) .. ", preferred limb side: " .. preferredSide)
|
||||||
|
|
||||||
-- add blood splat every couple of seconds for a while
|
-- add blood splat every couple of seconds for a while
|
||||||
addBloodSplat(getCell():getGridSquare(zombie:getX(), zombie:getY(), zombie:getZ()), bloodAmount)
|
addBloodSplat(getCell():getGridSquare(zombie:getX(), zombie:getY(), zombie:getZ()), bloodAmount)
|
||||||
|
|||||||
Reference in New Issue
Block a user