Added working tourniquet for left side
This commit is contained in:
10
media/clothing/clothingItems/Test_Tourniquet_Left.xml
Normal file
10
media/clothing/clothingItems/Test_Tourniquet_Left.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<clothingItem>
|
||||
<m_MaleModel>test_left_tourniquet</m_MaleModel>
|
||||
<m_FemaleModel>test_left_tourniquet</m_FemaleModel>
|
||||
<m_GUID>afbab35d-8bd4-4d61-87c7-054651ead1bd</m_GUID>
|
||||
<m_Static>false</m_Static>
|
||||
<m_AllowRandomHue>false</m_AllowRandomHue>
|
||||
<m_AllowRandomTint>false</m_AllowRandomTint>
|
||||
<textureChoices>Prosthesis\wood_base</textureChoices>
|
||||
</clothingItem>
|
||||
@@ -76,4 +76,11 @@
|
||||
<path>media/clothing/clothingItems/Prost_Left_LowerArm_MetalHand.xml</path>
|
||||
<guid>0405a4c0-f71b-45a8-9edc-489fc81dca39</guid>
|
||||
</files>
|
||||
|
||||
<files>
|
||||
<path>media/clothing/clothingItems/Test_Tourniquet_Left.xml</path>
|
||||
<guid>afbab35d-8bd4-4d61-87c7-054651ead1bd</guid>
|
||||
</files>
|
||||
|
||||
|
||||
</fileGuidTable>
|
||||
@@ -98,6 +98,20 @@ function TocDamagePlayerDuringAmputation(patient, part_name)
|
||||
body_damage_part:setBleedingTime(ZombRand(10, 20))
|
||||
end
|
||||
|
||||
local function FindTourniquetInWornItems(patient, side)
|
||||
local worn_items = patient:getWornItems()
|
||||
|
||||
for i = 1, worn_items:size() - 1 do -- Maybe wornItems:size()-1
|
||||
local item = worn_items:get(i):getItem()
|
||||
local item_full_type = item:getFullType()
|
||||
if string.find(item_full_type, "Test_Tourniquet_" .. side) then
|
||||
return item
|
||||
end
|
||||
end
|
||||
|
||||
return nil
|
||||
|
||||
end
|
||||
----------------------------------------------------------------------------------
|
||||
|
||||
--- Main function for cutting a limb
|
||||
@@ -116,13 +130,9 @@ function TocCutLimb(part_name, surgeon_factor, bandage_table, painkiller_table)
|
||||
local limbs_data = toc_data.Limbs
|
||||
|
||||
|
||||
|
||||
-- TODO Stop for a bit,
|
||||
|
||||
-- Cut Hand -> Damage in forearm
|
||||
-- Cut Forearm -> Damage in Upperarm
|
||||
-- Cut UpperArm -> Damage to torso
|
||||
|
||||
local body_damage = player:getBodyDamage()
|
||||
local body_part = body_damage:getBodyPart(TocGetBodyPartFromPartName(part_name))
|
||||
local adiacent_body_part = player:getBodyDamage():getBodyPart(TocGetAdiacentBodyPartFromPartName(part_name))
|
||||
@@ -135,18 +145,33 @@ function TocCutLimb(part_name, surgeon_factor, bandage_table, painkiller_table)
|
||||
-- The bit will be checked later since we're not sure if the player is not infected from another wound
|
||||
TocSetParametersForMissingLimb(body_part, false)
|
||||
|
||||
-- Use a tourniquet if available
|
||||
local tourniquet_item = FindTourniquetInWornItems(player, TocGetSideFromPartName(part_name))
|
||||
|
||||
local base_damage_value = 100
|
||||
|
||||
if tourniquet_item ~= nil then
|
||||
base_damage_value = 50
|
||||
|
||||
if part_name == "Left_UpperArm" or part_name == "Right_UpperArm" then
|
||||
player:removeWornItem(tourniquet_item)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
-- Set damage, stress, and low endurance after amputation
|
||||
adiacent_body_part:AddDamage(100 - surgeon_factor)
|
||||
adiacent_body_part:setAdditionalPain(100 - surgeon_factor)
|
||||
adiacent_body_part:AddDamage(base_damage_value - surgeon_factor)
|
||||
adiacent_body_part:setAdditionalPain(base_damage_value - surgeon_factor)
|
||||
adiacent_body_part:setBleeding(true)
|
||||
adiacent_body_part:setBleedingTime(100 - surgeon_factor)
|
||||
adiacent_body_part:setBleedingTime(base_damage_value - surgeon_factor)
|
||||
adiacent_body_part:setDeepWounded(true)
|
||||
adiacent_body_part:setDeepWoundTime(100 - surgeon_factor)
|
||||
adiacent_body_part:setDeepWoundTime(base_damage_value - surgeon_factor)
|
||||
stats:setEndurance(surgeon_factor)
|
||||
stats:setStress(100 - surgeon_factor)
|
||||
stats:setStress(base_damage_value - surgeon_factor)
|
||||
|
||||
|
||||
-- Set malus for strength and fitness
|
||||
-- TODO Make it more "random" with just some XP scaling down instead of a whole level, depending on the limb that we're cutting
|
||||
player:LoseLevel(Perks.Fitness)
|
||||
player:LoseLevel(Perks.Strength)
|
||||
|
||||
@@ -161,8 +186,9 @@ function TocCutLimb(part_name, surgeon_factor, bandage_table, painkiller_table)
|
||||
-- If painkillers are available, use them
|
||||
-- TODO add painkiller support
|
||||
|
||||
-- Use a tourniquet if available
|
||||
-- TODO add tourniquet
|
||||
|
||||
|
||||
-- A check for is_cut shouldn't be necessary here since if we've got here we've already checked it out enough
|
||||
|
||||
if limbs_data[part_name].is_cut == false then
|
||||
limbs_data[part_name].is_cut = true
|
||||
|
||||
@@ -109,3 +109,13 @@ function TocGetSawInInventory(surgeon)
|
||||
player_inv:getItemFromType("Chainsaw")
|
||||
return item
|
||||
end
|
||||
|
||||
function TocGetSideFromPartName(part_name)
|
||||
|
||||
if string.find(part_name, "Left") then
|
||||
return "Left"
|
||||
else
|
||||
return "Right"
|
||||
end
|
||||
|
||||
end
|
||||
@@ -185,3 +185,30 @@ function ISInventoryPaneContextMenu.dropItem(item, player)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
-- Make the player unable to equip a tourniquet on an already fully amputated limb
|
||||
local og_ISWearClothingIsValid = ISWearClothing.isValid
|
||||
function ISWearClothing:isValid()
|
||||
local base_check = og_ISWearClothingIsValid(self)
|
||||
--return self.character:getInventory():contains(self.item);
|
||||
|
||||
local item_full_type = self.item:getFullType()
|
||||
|
||||
-- TODO Sides
|
||||
local limbs_data = self.character:getModData().TOC.Limbs
|
||||
|
||||
for _, side in pairs(TOC_sides) do
|
||||
if string.find(item_full_type, "Test_Tourniquet_" .. side) then
|
||||
if limbs_data[side .. "_UpperArm"].is_cut then
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
return base_check
|
||||
|
||||
|
||||
end
|
||||
|
||||
BIN
media/models_X/test_left_tourniquet.fbx
Normal file
BIN
media/models_X/test_left_tourniquet.fbx
Normal file
Binary file not shown.
@@ -440,4 +440,23 @@ item ProthesisMag3
|
||||
ReplaceOnUse = ProthesisMag3,
|
||||
Tooltip = Tooltip_ProthesisMag2,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
item Test_Tourniquet_Left
|
||||
{
|
||||
Weight = 1,
|
||||
Type = Clothing,
|
||||
DisplayCategory = Prosthesis,
|
||||
DisplayName = Tourniquet Left,
|
||||
ClothingItem = Test_Tourniquet_Left,
|
||||
BodyLocation = Hands,
|
||||
BloodLocation = Hands,
|
||||
Icon = tourniquet,
|
||||
Tooltip = Test,
|
||||
CanHaveHoles = false,
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user