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