Redoing user experience
This commit is contained in:
@@ -41,6 +41,7 @@ function PlayerHandler.CutLimb(patient, surgeon, limbName, surgeryHelpItems)
|
||||
|
||||
-- TODO Get surgeon ability from his aid skill
|
||||
local surgeonSkill = 50
|
||||
local surgeonFactor = surgeonSkill - 1 -- TODO Should be decided by surgeryHelpItems
|
||||
|
||||
local bd = patient:getBodyDamage()
|
||||
local bodyPart = bd:getBodyPart(BodyPartType[limbName])
|
||||
@@ -56,9 +57,7 @@ function PlayerHandler.CutLimb(patient, surgeon, limbName, surgeryHelpItems)
|
||||
patientStats:setEndurance(surgeonSkill)
|
||||
patientStats:setStress(baseDamage - surgeonSkill)
|
||||
|
||||
---@type amputationTable
|
||||
local amputationValues = {isOperated = false, isCicatrized = false, isCauterized = false}
|
||||
PlayerHandler.modDataHandler:setCutLimb(limbName, amputationValues)
|
||||
PlayerHandler.modDataHandler:setCutLimb(limbName, false, false, false, surgeonFactor)
|
||||
|
||||
end
|
||||
|
||||
@@ -70,4 +69,36 @@ function PlayerHandler.ForceCutLimb(limbName)
|
||||
-- TODO Spawn amputation item
|
||||
end
|
||||
|
||||
return PlayerHandler
|
||||
|
||||
|
||||
--* Events *--
|
||||
|
||||
---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, damageType, damage)
|
||||
|
||||
-- This fucking event barely works. Bleeding seems to be the only thing that triggers it
|
||||
-- TODO Check other body parts that are not included in the mod, if there's a bite there then the player is fucked
|
||||
local bd = character:getBodyDamage()
|
||||
|
||||
for i=1, #StaticData.LIMBS_STRINGS do
|
||||
local limbName = StaticData.LIMBS_STRINGS[i]
|
||||
local bptEnum = StaticData.BODYPARTSTYPES_ENUM[limbName]
|
||||
local bodyPart = bd:getBodyPart(bptEnum)
|
||||
|
||||
if bodyPart:bitten() then
|
||||
if PlayerHandler.modDataHandler:getIsCut(limbName) then
|
||||
bodyPart:SetBitten(false)
|
||||
else
|
||||
PlayerHandler.modDataHandler:setIsInfected(limbName, true)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Events.OnPlayerGetDamage.Add(PlayerHandler.CheckInfection)
|
||||
|
||||
return PlayerHandler
|
||||
Reference in New Issue
Block a user