Renamed some stuff, working tourniquet
This commit is contained in:
@@ -273,7 +273,7 @@ end
|
||||
---@param limbName string
|
||||
---@return boolean
|
||||
function DataController:getIsProstEquipped(limbName)
|
||||
local prostGroup = StaticData.LIMBS_TO_PROST_GROUP_MATCH_IND_STR[limbName]
|
||||
local prostGroup = StaticData.LIMBS_TO_AMP_GROUPS_MATCH_IND_STR[limbName]
|
||||
return self.tocData.prostheses[prostGroup].isProstEquipped
|
||||
end
|
||||
|
||||
|
||||
@@ -292,6 +292,40 @@ end
|
||||
--* Tourniquet handling
|
||||
function LocalPlayerController.HandleTourniquet()
|
||||
-- TODO Add it!!!
|
||||
|
||||
-- TODO Triggered at startup or when Clothing Updates.
|
||||
|
||||
|
||||
|
||||
-- local playerObj = getPlayer()
|
||||
|
||||
|
||||
-- for bl, ampGroup in pairs(StaticData.TOURNIQUET_BODYLOCS_TO_GROUPS_IND_STR) do
|
||||
-- local item = playerObj:getWornItem(bl)
|
||||
|
||||
-- if item then
|
||||
-- -- TODO Set to DataControlle
|
||||
-- local cicTime = DataController.GetInstance():setTourniquet
|
||||
|
||||
-- end
|
||||
|
||||
-- end
|
||||
|
||||
-- for i=1, #tourniquetBodyLocations do
|
||||
-- local bl = tourniquetBodyLocations[i]
|
||||
|
||||
|
||||
-- if item and item:getFullType():contains("Surg_Arm_Tourniquet_")
|
||||
|
||||
-- end
|
||||
-- local item = playerObj:getWornItem(bodyLocation)
|
||||
|
||||
-- local wornItems = playerObj:getWornItems()
|
||||
-- for j=1,wornItems:size() do
|
||||
-- local wornItem = wornItems:get(j-1)
|
||||
|
||||
-- end
|
||||
|
||||
end
|
||||
|
||||
Events.OnPuttingTourniquet.Add(LocalPlayerController.HandleTourniquet)
|
||||
|
||||
@@ -41,10 +41,27 @@ end
|
||||
|
||||
--* Static methods *--
|
||||
|
||||
---comment
|
||||
---@param player IsoPlayer
|
||||
---@param limbName string
|
||||
function AmputationHandler.ApplyDamageDuringAmputation(player, limbName)
|
||||
|
||||
|
||||
local ampGroup = StaticData.LIMBS_TO_AMP_GROUPS_MATCH_IND_STR[limbName]
|
||||
local isTourniquetEquipped = false
|
||||
|
||||
-- Check if tourniquet is applied on the zone
|
||||
for bl, tournAmpGroup in pairs(StaticData.TOURNIQUET_BODYLOCS_TO_GROUPS_IND_STR) do
|
||||
local item = player:getWornItem(bl)
|
||||
|
||||
-- LimbName -> Group -> BodyLoc
|
||||
if item and tournAmpGroup == ampGroup then
|
||||
TOC_DEBUG.print("tourniquet is equipped")
|
||||
isTourniquetEquipped = true
|
||||
break
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local bodyDamage = player:getBodyDamage()
|
||||
local bodyPartType = BodyPartType[limbName]
|
||||
local bodyDamagePart = bodyDamage:getBodyPart(bodyPartType)
|
||||
@@ -52,10 +69,18 @@ function AmputationHandler.ApplyDamageDuringAmputation(player, limbName)
|
||||
|
||||
bodyDamagePart:setBleeding(true)
|
||||
bodyDamagePart:setCut(true)
|
||||
bodyDamagePart:setBleedingTime(ZombRand(10, 20))
|
||||
|
||||
local bleedingTime
|
||||
if isTourniquetEquipped then
|
||||
bleedingTime = ZombRand(1,5)
|
||||
else
|
||||
bleedingTime = ZombRand(10, 20)
|
||||
end
|
||||
|
||||
bodyDamagePart:setBleedingTime(bleedingTime)
|
||||
end
|
||||
|
||||
---comment
|
||||
|
||||
---@param prevAction ISBaseTimedAction
|
||||
---@param limbName string
|
||||
---@param surgeonPl IsoPlayer
|
||||
@@ -88,20 +113,10 @@ function AmputationHandler.PrepareBandagesAction(prevAction, limbName, surgeonPl
|
||||
|
||||
return bandageAction
|
||||
end
|
||||
|
||||
|
||||
--* Main methods *--
|
||||
|
||||
|
||||
---Damage the player part during the amputation process
|
||||
function AmputationHandler:damageDuringAmputation()
|
||||
local bodyDamage = self.patientPl:getBodyDamage()
|
||||
local bodyDamagePart = bodyDamage:getBodyPart(self.bodyPartType)
|
||||
TOC_DEBUG.print("damage patient - " .. tostring(self.bodyPartType))
|
||||
|
||||
bodyDamagePart:setBleeding(true)
|
||||
bodyDamagePart:setCut(true)
|
||||
bodyDamagePart:setBleedingTime(ZombRand(10, 20))
|
||||
end
|
||||
|
||||
---Set the damage to the adjacent part of the cut area
|
||||
---@param surgeonFactor number
|
||||
function AmputationHandler:damageAfterAmputation(surgeonFactor)
|
||||
|
||||
@@ -44,7 +44,7 @@ function ProsthesisHandler.GetGroup(item)
|
||||
end
|
||||
|
||||
local index = position .. side
|
||||
local group = StaticData.PROSTHESES_GROUPS_IND_STR[index]
|
||||
local group = StaticData.AMP_GROUPS_IND_STR[index]
|
||||
return group
|
||||
end
|
||||
|
||||
|
||||
@@ -67,6 +67,8 @@ function HandleZombiesAmputations(player, zombie, handWeapon, damage)
|
||||
|
||||
-- TODO Check type of weapon. No hands, only knifes or such
|
||||
|
||||
|
||||
|
||||
if damage < 3 or ZombRand(0,100) < 25 then return end
|
||||
|
||||
TOC_DEBUG.print(handWeapon:getName())
|
||||
|
||||
Reference in New Issue
Block a user