Perks handling

This commit is contained in:
ZioPao
2023-11-09 11:15:04 +01:00
parent 9095d11f41
commit 99ce9bacda
6 changed files with 82 additions and 27 deletions

View File

@@ -6,9 +6,6 @@ local StaticData = require("TOC_StaticData")
-- LIST OF STUFF THAT THIS CLASS NEEDS TO DO
-- Main thing, should contain the other handlers when needed
-- Handling Items (as in amputations spawns)
-- Update current player status (infection checks)
-- handle stats increase\decrease
@@ -77,7 +74,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 and bodyPart:bitten() or bodyPart:IsInfected() then
if bodyPart and (bodyPart:bitten() or bodyPart:IsInfected()) then
PlayerHandler.modDataHandler:setIsIgnoredPartInfected(true)
end
end
@@ -86,4 +83,21 @@ end
Events.OnPlayerGetDamage.Add(PlayerHandler.CheckInfection)
---comment
---@param player IsoPlayer
function PlayerHandler.UpdatePerks(player)
-- TODO If player has an amputated limb, they're gonna level up them while doing normal stuff, getting better at it dynamically
-- TODO We should have a way to check if the player has done any amputation at all instead of having to check manually each time
-- TODO Should be run when player is doing stuff like picking up objects, not randomly
for side, _ in pairs(StaticData.SIDES_STRINGS) do
local limbName = "Hand_" .. side
if ModDataHandler.GetInstance():getIsCut(limbName) then
player:getXp():AddXP(Perks[limbName], 0.1)
end
end
end
Events.OnPlayerUpdate.Add(PlayerHandler.UpdatePerks)
return PlayerHandler

View File

@@ -9,7 +9,6 @@ local AmputationHandler = require("Handlers/TOC_AmputationHandler")
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)
end

View File

@@ -0,0 +1,9 @@
IG_UI_EN = {
IGUI_perks_Amputations = "Amputations",
IGUI_perks_Hand_R = "Right Hand",
IGUI_perks_Hand_L = "Left Hand",
IGUI_perks_Prosthesis = "Prosthesis",
IGUI_perks_ProstFamiliarity= "Familiarity",
}