Renamed some stuff, working tourniquet
This commit is contained in:
@@ -273,7 +273,7 @@ end
|
|||||||
---@param limbName string
|
---@param limbName string
|
||||||
---@return boolean
|
---@return boolean
|
||||||
function DataController:getIsProstEquipped(limbName)
|
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
|
return self.tocData.prostheses[prostGroup].isProstEquipped
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -292,6 +292,40 @@ end
|
|||||||
--* Tourniquet handling
|
--* Tourniquet handling
|
||||||
function LocalPlayerController.HandleTourniquet()
|
function LocalPlayerController.HandleTourniquet()
|
||||||
-- TODO Add it!!!
|
-- 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
|
end
|
||||||
|
|
||||||
Events.OnPuttingTourniquet.Add(LocalPlayerController.HandleTourniquet)
|
Events.OnPuttingTourniquet.Add(LocalPlayerController.HandleTourniquet)
|
||||||
|
|||||||
@@ -41,10 +41,27 @@ end
|
|||||||
|
|
||||||
--* Static methods *--
|
--* Static methods *--
|
||||||
|
|
||||||
---comment
|
|
||||||
---@param player IsoPlayer
|
---@param player IsoPlayer
|
||||||
---@param limbName string
|
---@param limbName string
|
||||||
function AmputationHandler.ApplyDamageDuringAmputation(player, limbName)
|
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 bodyDamage = player:getBodyDamage()
|
||||||
local bodyPartType = BodyPartType[limbName]
|
local bodyPartType = BodyPartType[limbName]
|
||||||
local bodyDamagePart = bodyDamage:getBodyPart(bodyPartType)
|
local bodyDamagePart = bodyDamage:getBodyPart(bodyPartType)
|
||||||
@@ -52,10 +69,18 @@ function AmputationHandler.ApplyDamageDuringAmputation(player, limbName)
|
|||||||
|
|
||||||
bodyDamagePart:setBleeding(true)
|
bodyDamagePart:setBleeding(true)
|
||||||
bodyDamagePart:setCut(true)
|
bodyDamagePart:setCut(true)
|
||||||
bodyDamagePart:setBleedingTime(ZombRand(10, 20))
|
|
||||||
|
local bleedingTime
|
||||||
|
if isTourniquetEquipped then
|
||||||
|
bleedingTime = ZombRand(1,5)
|
||||||
|
else
|
||||||
|
bleedingTime = ZombRand(10, 20)
|
||||||
end
|
end
|
||||||
|
|
||||||
---comment
|
bodyDamagePart:setBleedingTime(bleedingTime)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
---@param prevAction ISBaseTimedAction
|
---@param prevAction ISBaseTimedAction
|
||||||
---@param limbName string
|
---@param limbName string
|
||||||
---@param surgeonPl IsoPlayer
|
---@param surgeonPl IsoPlayer
|
||||||
@@ -88,20 +113,10 @@ function AmputationHandler.PrepareBandagesAction(prevAction, limbName, surgeonPl
|
|||||||
|
|
||||||
return bandageAction
|
return bandageAction
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
--* Main methods *--
|
--* 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
|
---Set the damage to the adjacent part of the cut area
|
||||||
---@param surgeonFactor number
|
---@param surgeonFactor number
|
||||||
function AmputationHandler:damageAfterAmputation(surgeonFactor)
|
function AmputationHandler:damageAfterAmputation(surgeonFactor)
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ function ProsthesisHandler.GetGroup(item)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local index = position .. side
|
local index = position .. side
|
||||||
local group = StaticData.PROSTHESES_GROUPS_IND_STR[index]
|
local group = StaticData.AMP_GROUPS_IND_STR[index]
|
||||||
return group
|
return group
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -67,6 +67,8 @@ function HandleZombiesAmputations(player, zombie, handWeapon, damage)
|
|||||||
|
|
||||||
-- TODO Check type of weapon. No hands, only knifes or such
|
-- TODO Check type of weapon. No hands, only knifes or such
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if damage < 3 or ZombRand(0,100) < 25 then return end
|
if damage < 3 or ZombRand(0,100) < 25 then return end
|
||||||
|
|
||||||
TOC_DEBUG.print(handWeapon:getName())
|
TOC_DEBUG.print(handWeapon:getName())
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ StaticData.MOD_NAME = "TOC"
|
|||||||
--* Base
|
--* Base
|
||||||
|
|
||||||
|
|
||||||
|
-- TODO Add references inside tables instead of making multiple tables
|
||||||
|
|
||||||
StaticData.SIDES_IND_STR = {
|
StaticData.SIDES_IND_STR = {
|
||||||
R = "R",
|
R = "R",
|
||||||
L = "L"
|
L = "L"
|
||||||
@@ -124,52 +126,59 @@ for side, _ in pairs(StaticData.SIDES_IND_STR) do
|
|||||||
end
|
end
|
||||||
|
|
||||||
-----------------
|
-----------------
|
||||||
--* Prostheses
|
--* Amputation Groups
|
||||||
|
|
||||||
StaticData.PROSTHESES_GROUPS_BASE_IND_STR = {
|
StaticData.AMP_GROUPS_BASE_IND_STR = {
|
||||||
Top = "Top",
|
Top = "Top",
|
||||||
Bottom = "Bottom"
|
Bottom = "Bottom"
|
||||||
}
|
}
|
||||||
|
|
||||||
StaticData.PROSTHESES_GROUPS_IND_STR = {}
|
StaticData.AMP_GROUPS_IND_STR = {}
|
||||||
StaticData.PROSTHESES_GROUPS_STR = {}
|
StaticData.AMP_GROUPS_STR = {}
|
||||||
|
|
||||||
for side, _ in pairs(StaticData.SIDES_IND_STR) do
|
for side, _ in pairs(StaticData.SIDES_IND_STR) do
|
||||||
for group, _ in pairs(StaticData.PROSTHESES_GROUPS_BASE_IND_STR) do
|
for group, _ in pairs(StaticData.AMP_GROUPS_BASE_IND_STR) do
|
||||||
local sidedGroup = group .. "_" .. side
|
local sidedGroup = group .. "_" .. side
|
||||||
StaticData.PROSTHESES_GROUPS_IND_STR[sidedGroup] = sidedGroup
|
StaticData.AMP_GROUPS_IND_STR[sidedGroup] = sidedGroup
|
||||||
table.insert(StaticData.PROSTHESES_GROUPS_STR, sidedGroup)
|
table.insert(StaticData.AMP_GROUPS_STR, sidedGroup)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- TODO We can do this in one pass if we do it before
|
-- TODO We can do this in one pass if we do it before
|
||||||
|
|
||||||
StaticData.PROST_TO_LIMBS_GROUP_MATCH_IND_STR = {} -- THis is probably unnecessary
|
StaticData.AMP_GROUP_TO_LIMBS_MATCH_IND_STR = {} -- THis is probably unnecessary
|
||||||
StaticData.LIMBS_TO_PROST_GROUP_MATCH_IND_STR = {}
|
StaticData.LIMBS_TO_AMP_GROUPS_MATCH_IND_STR = {}
|
||||||
|
|
||||||
for side, _ in pairs(StaticData.SIDES_IND_STR) do
|
for side, _ in pairs(StaticData.SIDES_IND_STR) do
|
||||||
for part, _ in pairs(StaticData.PARTS_IND_STR) do
|
for part, _ in pairs(StaticData.PARTS_IND_STR) do
|
||||||
local limbName = part .. "_" .. side
|
local limbName = part .. "_" .. side
|
||||||
local group
|
local group
|
||||||
if part == StaticData.PARTS_IND_STR.Hand or part == StaticData.PARTS_IND_STR.ForeArm or part == StaticData.PARTS_IND_STR.UpperArm then
|
if part == StaticData.PARTS_IND_STR.Hand or part == StaticData.PARTS_IND_STR.ForeArm or part == StaticData.PARTS_IND_STR.UpperArm then
|
||||||
group = StaticData.PROSTHESES_GROUPS_BASE_IND_STR.Top
|
group = StaticData.AMP_GROUPS_BASE_IND_STR.Top
|
||||||
else
|
else
|
||||||
group = StaticData.PROSTHESES_GROUPS_BASE_IND_STR.Bottom
|
group = StaticData.AMP_GROUPS_BASE_IND_STR.Bottom
|
||||||
end
|
end
|
||||||
|
|
||||||
local sidedGroup = group .. "_" .. side
|
local sidedGroup = group .. "_" .. side
|
||||||
if StaticData.PROST_TO_LIMBS_GROUP_MATCH_IND_STR[sidedGroup] == nil then
|
if StaticData.AMP_GROUP_TO_LIMBS_MATCH_IND_STR[sidedGroup] == nil then
|
||||||
StaticData.PROST_TO_LIMBS_GROUP_MATCH_IND_STR[sidedGroup] = {}
|
StaticData.AMP_GROUP_TO_LIMBS_MATCH_IND_STR[sidedGroup] = {}
|
||||||
end
|
end
|
||||||
table.insert(StaticData.PROST_TO_LIMBS_GROUP_MATCH_IND_STR[sidedGroup], limbName)
|
table.insert(StaticData.AMP_GROUP_TO_LIMBS_MATCH_IND_STR[sidedGroup], limbName)
|
||||||
|
|
||||||
StaticData.LIMBS_TO_PROST_GROUP_MATCH_IND_STR[limbName] = sidedGroup
|
StaticData.LIMBS_TO_AMP_GROUPS_MATCH_IND_STR[limbName] = sidedGroup
|
||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
StaticData.TOURNIQUET_BODYLOCS_TO_GROUPS_IND_STR = {
|
||||||
|
["HandsLeft"] = StaticData.AMP_GROUPS_IND_STR.Top_L,
|
||||||
|
["HandsRight"] = StaticData.AMP_GROUPS.IND_STR.Top_R
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-----------------
|
-----------------
|
||||||
|
|||||||
@@ -15,13 +15,12 @@ module TOC
|
|||||||
ClothingItemExtra = Surg_Arm_Tourniquet_R,
|
ClothingItemExtra = Surg_Arm_Tourniquet_R,
|
||||||
ClothingItemExtraOption = PutTourniquetArmRight,
|
ClothingItemExtraOption = PutTourniquetArmRight,
|
||||||
clothingExtraSubmenu = PutTourniquetArmLeft,
|
clothingExtraSubmenu = PutTourniquetArmLeft,
|
||||||
BodyLocation = Hands,
|
BodyLocation = HandsLeft,
|
||||||
BloodLocation = UpperArms;UpperBody,
|
BloodLocation = UpperArms;UpperBody,
|
||||||
|
|
||||||
Weight = 1,
|
Weight = 1,
|
||||||
|
|
||||||
Icon = tourniquet,
|
Icon = tourniquet,
|
||||||
Tooltip = Test,
|
|
||||||
CanHaveHoles = false,
|
CanHaveHoles = false,
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,13 +34,12 @@ module TOC
|
|||||||
ClothingItemExtra = Surg_Arm_Tourniquet_L,
|
ClothingItemExtra = Surg_Arm_Tourniquet_L,
|
||||||
ClothingItemExtraOption = PutTourniquetArmLeft,
|
ClothingItemExtraOption = PutTourniquetArmLeft,
|
||||||
clothingExtraSubmenu = PutTourniquetArmRight,
|
clothingExtraSubmenu = PutTourniquetArmRight,
|
||||||
BodyLocation = Hands,
|
BodyLocation = HandsRight,
|
||||||
BloodLocation = UpperArms;UpperBody,
|
BloodLocation = UpperArms;UpperBody,
|
||||||
|
|
||||||
Weight = 1,
|
Weight = 1,
|
||||||
|
|
||||||
Icon = tourniquet,
|
Icon = tourniquet,
|
||||||
Tooltip = Test,
|
|
||||||
CanHaveHoles = false,
|
CanHaveHoles = false,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user