Fixed Tests
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
local ModDataHandler = require("Handlers/TOC_ModDataHandler")
|
local ModDataHandler = require("Handlers/TOC_ModDataHandler")
|
||||||
local StaticData = require("TOC_StaticData")
|
local StaticData = require("TOC_StaticData")
|
||||||
local CommonMethods = require("TOC_Common")
|
|
||||||
local ItemsHandler = require("Handlers/TOC_ItemsHandler")
|
local ItemsHandler = require("Handlers/TOC_ItemsHandler")
|
||||||
|
|
||||||
---------------------------
|
---------------------------
|
||||||
@@ -54,7 +53,8 @@ end
|
|||||||
function AmputationHandler:execute()
|
function AmputationHandler:execute()
|
||||||
|
|
||||||
-- TODO Calculate surgeonStats
|
-- TODO Calculate surgeonStats
|
||||||
local surgeonFactor = 100
|
-- TODO Cap it to a certain amount, it shouldn't be more than ...?
|
||||||
|
local surgeonFactor = 1
|
||||||
|
|
||||||
|
|
||||||
local patientStats = self.patient:getStats()
|
local patientStats = self.patient:getStats()
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
local StaticData = require("TOC_StaticData")
|
local StaticData = require("TOC_StaticData")
|
||||||
local CommonMethods = require("TOC_Common")
|
local CommonMethods = require("TOC_Common")
|
||||||
|
|
||||||
|
---------------------------
|
||||||
|
|
||||||
|
|
||||||
--- Submodule to handle spawning the correct items after certain actions (ie: cutting a hand)
|
--- Submodule to handle spawning the correct items after certain actions (ie: cutting a hand)
|
||||||
---@class ItemsHandler
|
---@class ItemsHandler
|
||||||
local ItemsHandler = {}
|
local ItemsHandler = {}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
---Returns the correct index for the textures of the amputation
|
---Returns the correct index for the textures of the amputation
|
||||||
---@param isCicatrized boolean
|
---@param isCicatrized boolean
|
||||||
---@return number
|
---@return number
|
||||||
@@ -47,6 +46,7 @@ end
|
|||||||
function ItemsHandler.RemoveClothingItem(playerObj, clothingItem)
|
function ItemsHandler.RemoveClothingItem(playerObj, clothingItem)
|
||||||
if clothingItem and instanceof(clothingItem, "InventoryItem") then
|
if clothingItem and instanceof(clothingItem, "InventoryItem") then
|
||||||
playerObj:removeWornItem(clothingItem)
|
playerObj:removeWornItem(clothingItem)
|
||||||
|
|
||||||
playerObj:getInventory():Remove(clothingItem) -- Can be a InventoryItem too.. I guess? todo check it
|
playerObj:getInventory():Remove(clothingItem) -- Can be a InventoryItem too.. I guess? todo check it
|
||||||
print("TOC: found and deleted " .. tostring(clothingItem))
|
print("TOC: found and deleted " .. tostring(clothingItem))
|
||||||
return true
|
return true
|
||||||
|
|||||||
@@ -49,8 +49,6 @@ end
|
|||||||
|
|
||||||
---Check if the player has an infected (as in, zombie infection) body part
|
---Check if the player has an infected (as in, zombie infection) body part
|
||||||
---@param character IsoGameCharacter
|
---@param character IsoGameCharacter
|
||||||
---@param damageType string
|
|
||||||
---@param damage number
|
|
||||||
function PlayerHandler.CheckInfection(character)
|
function PlayerHandler.CheckInfection(character)
|
||||||
|
|
||||||
-- This fucking event barely works. Bleeding seems to be the only thing that triggers it
|
-- This fucking event barely works. Bleeding seems to be the only thing that triggers it
|
||||||
@@ -79,7 +77,7 @@ function PlayerHandler.CheckInfection(character)
|
|||||||
for i=1, #StaticData.IGNORED_PARTS_STRINGS do
|
for i=1, #StaticData.IGNORED_PARTS_STRINGS do
|
||||||
local bodyPartType = BodyPartType[StaticData.IGNORED_PARTS_STRINGS[i]]
|
local bodyPartType = BodyPartType[StaticData.IGNORED_PARTS_STRINGS[i]]
|
||||||
local bodyPart = bd:getBodyPart(bodyPartType)
|
local bodyPart = bd:getBodyPart(bodyPartType)
|
||||||
if bodyPart:bitten() or bodyPart:IsInfected() then
|
if bodyPart and bodyPart:bitten() or bodyPart:IsInfected() then
|
||||||
PlayerHandler.modDataHandler:setIsIgnoredPartInfected(true)
|
PlayerHandler.modDataHandler:setIsIgnoredPartInfected(true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -6,51 +6,55 @@ local PlayerHandler = require("Handlers/TOC_PlayerHandler")
|
|||||||
local AmputationHandler = require("Handlers/TOC_AmputationHandler")
|
local AmputationHandler = require("Handlers/TOC_AmputationHandler")
|
||||||
|
|
||||||
|
|
||||||
|
TestFramework.registerTestModule("Functionality", "PlayerHandler", function()
|
||||||
TestFramework.registerTestModule("Functionality", "Amputation", function()
|
|
||||||
local Tests = {}
|
local Tests = {}
|
||||||
|
|
||||||
function Tests.InitializePlayer()
|
function Tests.InitializePlayer()
|
||||||
-- TODO This breaks the Test Framework mod for some reason.
|
-- TODO This breaks the Test Framework mod for some reason.
|
||||||
local pl = getPlayer()
|
local pl = getPlayer()
|
||||||
PlayerHandler.InitializePlayer(_, pl, true)
|
PlayerHandler.InitializePlayer(_, pl, true)
|
||||||
return true
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
return Tests
|
||||||
|
end)
|
||||||
|
|
||||||
|
|
||||||
|
TestFramework.registerTestModule("Functionality", "Amputation", function()
|
||||||
|
local Tests = {}
|
||||||
|
|
||||||
function Tests.CutLeftHand()
|
function Tests.CutLeftHand()
|
||||||
local handler = AmputationHandler:new("Hand_L")
|
local handler = AmputationHandler:new("Hand_L")
|
||||||
handler:execute()
|
handler:execute()
|
||||||
return PlayerHandler.modDataHandler:getIsCut("Hand_L")
|
TestUtils.assert(PlayerHandler.modDataHandler:getIsCut("Hand_L"))
|
||||||
end
|
end
|
||||||
|
|
||||||
function Tests.CutLeftForearm()
|
function Tests.CutLeftForearm()
|
||||||
local handler = AmputationHandler:new("ForeArm_L")
|
local handler = AmputationHandler:new("ForeArm_L")
|
||||||
handler:execute()
|
handler:execute()
|
||||||
return PlayerHandler.modDataHandler:getIsCut("ForeArm_L") and PlayerHandler.modDataHandler:getIsCut("Hand_L")
|
TestUtils.assert(PlayerHandler.modDataHandler:getIsCut("ForeArm_L") and PlayerHandler.modDataHandler:getIsCut("Hand_L"))
|
||||||
end
|
end
|
||||||
|
|
||||||
function Tests.CutLeftUpperarm()
|
function Tests.CutLeftUpperarm()
|
||||||
local handler = AmputationHandler:new("UpperArm_L")
|
local handler = AmputationHandler:new("UpperArm_L")
|
||||||
handler:execute()
|
handler:execute()
|
||||||
return PlayerHandler.modDataHandler:getIsCut("UpperArm_L") and PlayerHandler.modDataHandler:getIsCut("ForeArm_L") and PlayerHandler.modDataHandler:getIsCut("Hand_L")
|
TestUtils.assert(PlayerHandler.modDataHandler:getIsCut("UpperArm_L") and PlayerHandler.modDataHandler:getIsCut("ForeArm_L") and PlayerHandler.modDataHandler:getIsCut("Hand_L"))
|
||||||
end
|
end
|
||||||
|
|
||||||
function Tests.CutRightHand()
|
function Tests.CutRightHand()
|
||||||
local handler = AmputationHandler:new("Hand_R")
|
local handler = AmputationHandler:new("Hand_R")
|
||||||
handler:execute()
|
handler:execute()
|
||||||
return PlayerHandler.modDataHandler:getIsCut("Hand_R")
|
TestUtils.assert(PlayerHandler.modDataHandler:getIsCut("Hand_R"))
|
||||||
end
|
end
|
||||||
|
|
||||||
function Tests.CutRightForearm()
|
function Tests.CutRightForearm()
|
||||||
local handler = AmputationHandler:new("ForeArm_R")
|
local handler = AmputationHandler:new("ForeArm_R")
|
||||||
handler:execute()
|
handler:execute()
|
||||||
return PlayerHandler.modDataHandler:getIsCut("ForeArm_R") and PlayerHandler.modDataHandler:getIsCut("Hand_R")
|
TestUtils.assert(PlayerHandler.modDataHandler:getIsCut("ForeArm_R") and PlayerHandler.modDataHandler:getIsCut("Hand_R"))
|
||||||
end
|
end
|
||||||
|
|
||||||
function Tests.CutRightUpperarm()
|
function Tests.CutRightUpperarm()
|
||||||
local handler = AmputationHandler:new("UpperArm_R")
|
local handler = AmputationHandler:new("UpperArm_R")
|
||||||
handler:execute()
|
handler:execute()
|
||||||
return PlayerHandler.modDataHandler:getIsCut("UpperArm_R") and PlayerHandler.modDataHandler:getIsCut("ForeArm_R") and PlayerHandler.modDataHandler:getIsCut("Hand_R")
|
TestUtils.assert(PlayerHandler.modDataHandler:getIsCut("UpperArm_R") and PlayerHandler.modDataHandler:getIsCut("ForeArm_R") and PlayerHandler.modDataHandler:getIsCut("Hand_R"))
|
||||||
end
|
end
|
||||||
|
|
||||||
return Tests
|
return Tests
|
||||||
|
|||||||
Reference in New Issue
Block a user