Initial work for legs amputations

This commit is contained in:
Pao
2023-02-06 23:13:42 +01:00
parent 490d09edf2
commit be5148210e
29 changed files with 232 additions and 51 deletions

View File

@@ -1,12 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<clothingItem>
<m_MaleModel>Amputation_Left_Hand_Male</m_MaleModel>
<m_FemaleModel>Amputation_Left_Hand_Female</m_FemaleModel>
<m_MaleModel>Amputation\Amputation_GenericModel</m_MaleModel>
<m_FemaleModel>Amputation\Amputation_GenericModel</m_FemaleModel>
<m_GUID>45c0b872-bdf1-466f-b810-c7783171bda1</m_GUID>
<m_Static>false</m_Static>
<m_AllowRandomHue>false</m_AllowRandomHue>
<m_AllowRandomTint>false</m_AllowRandomTint>
<m_Masks>8</m_Masks>
<m_MasksFolder>none</m_MasksFolder>
<textureChoices>Amputations\Forearm\skin01_b</textureChoices>
<textureChoices>Amputations\Forearm\skin02_b</textureChoices>
<textureChoices>Amputations\Forearm\skin03_b</textureChoices>
<textureChoices>Amputations\Forearm\skin04_b</textureChoices>
<textureChoices>Amputations\Forearm\skin05_b</textureChoices>
<textureChoices>Amputations\Forearm\skin01_hairy_b</textureChoices>
<textureChoices>Amputations\Forearm\skin02_hairy_b</textureChoices>
<textureChoices>Amputations\Forearm\skin03_hairy_b</textureChoices>
<textureChoices>Amputations\Forearm\skin04_hairy_b</textureChoices>
<textureChoices>Amputations\Forearm\skin05_hairy_b</textureChoices>
<textureChoices>Body\MaleBody01</textureChoices>
<textureChoices>Body\MaleBody02</textureChoices>
<textureChoices>Body\MaleBody03</textureChoices>
<textureChoices>Body\MaleBody04</textureChoices>
<textureChoices>Body\MaleBody05</textureChoices>
<textureChoices>Body\MaleBody01a</textureChoices>
<textureChoices>Body\MaleBody02a</textureChoices>
<textureChoices>Body\MaleBody03a</textureChoices>
<textureChoices>Body\MaleBody04</textureChoices>
<textureChoices>Body\MaleBody05a</textureChoices>
</clothingItem>

View File

@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="utf-8"?>
<clothingItem>
<m_MaleModel>Amputation\Amputation_GenericModel</m_MaleModel>
<m_FemaleModel>Amputation\Amputation_GenericModel</m_FemaleModel>
<m_GUID>d6576bb2-f5f1-4cb6-a17e-aab131214e4b</m_GUID>
<m_Static>false</m_Static>
<m_AllowRandomHue>false</m_AllowRandomHue>
<m_AllowRandomTint>false</m_AllowRandomTint>
<m_Masks>10</m_Masks>
<m_MasksFolder>none</m_MasksFolder>
<textureChoices>Amputations\Forearm\skin01_b</textureChoices>
<textureChoices>Amputations\Forearm\skin02_b</textureChoices>
<textureChoices>Amputations\Forearm\skin03_b</textureChoices>
<textureChoices>Amputations\Forearm\skin04_b</textureChoices>
<textureChoices>Amputations\Forearm\skin05_b</textureChoices>
<textureChoices>Amputations\Forearm\skin01_hairy_b</textureChoices>
<textureChoices>Amputations\Forearm\skin02_hairy_b</textureChoices>
<textureChoices>Amputations\Forearm\skin03_hairy_b</textureChoices>
<textureChoices>Amputations\Forearm\skin04_hairy_b</textureChoices>
<textureChoices>Amputations\Forearm\skin05_hairy_b</textureChoices>
<textureChoices>Body\MaleBody01</textureChoices>
<textureChoices>Body\MaleBody02</textureChoices>
<textureChoices>Body\MaleBody03</textureChoices>
<textureChoices>Body\MaleBody04</textureChoices>
<textureChoices>Body\MaleBody05</textureChoices>
<textureChoices>Body\MaleBody01a</textureChoices>
<textureChoices>Body\MaleBody02a</textureChoices>
<textureChoices>Body\MaleBody03a</textureChoices>
<textureChoices>Body\MaleBody04</textureChoices>
<textureChoices>Body\MaleBody05a</textureChoices>
</clothingItem>

View File

@@ -90,4 +90,10 @@
<path>media/clothing/clothingItems/Amputation_Left_Foot.xml</path>
<guid>45c0b872-bdf1-466f-b810-c7783171bda1</guid>
</files>
<files>
<path>media/clothing/clothingItems/Amputation_Left_Foot.xml</path>
<guid>d6576bb2-f5f1-4cb6-a17e-aab131214e4b</guid>
</files>
</fileGuidTable>

View File

@@ -104,7 +104,7 @@ local function FindTourniquetInWornItems(patient, side)
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
if string.find(item_full_type, "Surgery_" .. side .. "_Tourniquet") then
return item
end
end
@@ -151,7 +151,7 @@ function TocCutLimb(part_name, surgeon_factor, bandage_table, painkiller_table)
local base_damage_value = 100
if tourniquet_item ~= nil then
base_damage_value = 50
base_damage_value = 50 -- TODO Decrease mostly blood and damage, add pain, not everything else
if part_name == "Left_UpperArm" or part_name == "Right_UpperArm" then
player:removeWornItem(tourniquet_item)
@@ -240,7 +240,11 @@ function TocCutLimb(part_name, surgeon_factor, bandage_table, painkiller_table)
TocDeleteOtherAmputatedLimbs(side)
--Equip new model for amputation
local amputation_clothing_item = player:getInventory():AddItem(TocFindAmputatedClothingFromPartName(part_name))
local amputation_clothing_item_name = TocFindAmputatedClothingFromPartName(part_name)
print(amputation_clothing_item_name)
local amputation_clothing_item = player:getInventory():AddItem(amputation_clothing_item_name)
TocSetCorrectTextureForAmputation(amputation_clothing_item, player, false)
player:setWornItem(amputation_clothing_item:getBodyLocation(), amputation_clothing_item)

View File

@@ -154,6 +154,9 @@ local function SetupTocMainUI(surgeon, patient, limbs_data)
main_ui["b31"]:setPath(GetImageName("Right_Hand", limbs_data))
main_ui["b32"]:setPath(GetImageName("Left_Hand", limbs_data))
main_ui["b41"]:setPath(GetImageName("Right_Foot", limbs_data))
main_ui["b42"]:setPath(GetImageName("Left_Foot", limbs_data))
end
@@ -435,6 +438,15 @@ local function CreateTocMainUI()
main_ui:addImageButton("b32", "", OnClickTocMainUI)
main_ui["b32"]:addArg("part_name", "Left_Hand")
main_ui:nextLine()
main_ui:addImageButton("b41", "", OnClickTocMainUI)
main_ui["b41"]:addArg("part_name", "Right_Foot")
main_ui:addImageButton("b42", "", OnClickTocMainUI)
main_ui["b42"]:addArg("part_name", "Left_Foot")
main_ui:saveLayout()

View File

@@ -74,6 +74,11 @@ function TocGetBodyPartFromPartName(part_name)
if part_name == "Left_Hand" then return BodyPartType.Hand_L end
if part_name == "Left_LowerArm" then return BodyPartType.ForeArm_L end
if part_name == "Left_UpperArm" then return BodyPartType.UpperArm_L end
-- New Legs stuff
if part_name == "Right_Foot" then return BodyPartType.Foot_R end
if part_name == "Left_Foot" then return BodyPartType.Foot_L end
end
-- Custom mapping to make more sense when cutting a limb
@@ -85,6 +90,11 @@ function TocGetAdiacentBodyPartFromPartName(part_name)
if part_name == "Left_Hand" then return BodyPartType.ForeArm_L end
if part_name == "Left_LowerArm" then return BodyPartType.UpperArm_L end
if part_name == "Left_UpperArm" then return BodyPartType.Torso_Upper end
if part_name == "Right_Foot" then return BodyPartType.LowerLeg_R end
if part_name == "Left_Foot" then return BodyPartType.LowerLeg_L end
end
function TocFindCorrectClothingProsthesis(item_name, part_name)

View File

@@ -6,16 +6,22 @@ local function TocReapplyAmputationClothingItem(mod_data)
for _, limb in ipairs(TOC_limbs) do
local part_name = side .. "_" .. limb
if mod_data.TOC.Limbs[part_name].is_cut and mod_data.TOC.Limbs[part_name].is_amputation_shown then
local amputated_clothing_name = "TOC.Amputation_" .. part_name
if player_inv:FindAndReturn(amputated_clothing_name) == nil then
local amputation_clothing_item = player:getInventory():AddItem(TocFindAmputatedClothingFromPartName(part_name))
TocSetCorrectTextureForAmputation(amputation_clothing_item, player, mod_data.TOC.Limbs[part_name].is_cicatrized)
player:setWornItem(amputation_clothing_item:getBodyLocation(), amputation_clothing_item)
-- Check this before since we could have changed some stuff about part names before fixing them. Could break things
local part_data = mod_data.TOC.Limbs[part_name]
if part_data then
if part_data.is_cut and part_data.is_amputation_shown then
local amputated_clothing_name = "TOC.Amputation_" .. part_name
if player_inv:FindAndReturn(amputated_clothing_name) == nil then
local amputation_clothing_item = player:getInventory():AddItem(TocFindAmputatedClothingFromPartName(part_name))
TocSetCorrectTextureForAmputation(amputation_clothing_item, player, part_data.is_cicatrized)
player:setWornItem(amputation_clothing_item:getBodyLocation(), amputation_clothing_item)
end
end
end
TocResetClothingItemBodyLocation(player, side, limb)
end
end

View File

@@ -45,31 +45,34 @@ function TocResetEverything()
TheOnlyCure.InitTheOnlyCure(_, player)
-- Destroy the amputation or prosthesis item
for _, v in ipairs(GetBodyParts()) do
-- TODO This is incredibly shitty, but we can't use worn items since we need to consider the case that the item wasn't applied
local amputation_item_name = TocFindAmputationOrProsthesisName(v, player, "Amputation")
local prosthesis_item_name = TocFindAmputationOrProsthesisName(v, player, "Prosthesis")
if amputation_item_name ~= nil then
local amputation_item = player_inventory:FindAndReturn(amputation_item_name)
if amputation_item ~= nil then
print("Resetting " .. amputation_item:getName())
player:removeWornItem(amputation_item)
player:getInventory():Remove(amputation_item)
for _, side in pairs(TOC_sides) do
for _, limb in pairs(TOC_limbs) do
local part_name = side .. "_" .. limb
local amputation_item_name = TocFindAmputationOrProsthesisName(part_name, player, "Amputation")
local prosthesis_item_name = TocFindAmputationOrProsthesisName(part_name, player, "Prosthesis")
if amputation_item_name ~= nil then
local amputation_item = player_inventory:FindAndReturn(amputation_item_name)
if amputation_item ~= nil then
print("Resetting " .. amputation_item:getName())
player:removeWornItem(amputation_item)
player:getInventory():Remove(amputation_item)
end
amputation_item = nil -- reset it
end
amputation_item = nil -- reset it
end
if prosthesis_item_name ~= nil then
local prosthesis_item = player_inventory:FindAndReturn(prosthesis_item_name)
if prosthesis_item ~= nil then
print("Resetting " .. prosthesis_item:getName())
player:removeWornItem(prosthesis_item)
player:getInventory():Remove(prosthesis_item)
if prosthesis_item_name ~= nil then
local prosthesis_item = player_inventory:FindAndReturn(prosthesis_item_name)
if prosthesis_item ~= nil then
print("Resetting " .. prosthesis_item:getName())
player:removeWornItem(prosthesis_item)
player:getInventory():Remove(prosthesis_item)
end
prosthesis_item = nil -- reset it
end
prosthesis_item = nil -- reset it
end
end
end

View File

@@ -25,6 +25,9 @@ local function PartNameToBodyLocationAmputation(name)
if name == "Left_Hand" then return "TOC_ArmLeft" end
if name == "Left_LowerArm" then return "TOC_ArmLeft" end
if name == "Left_UpperArm" then return "TOC_ArmLeft" end
if name == "Left_Foot" then return "TOC_LegLeft" end
if name == "Right_Foot" then return "TOC_LegRight" end
end
function TocFindItemInProstBodyLocation(part_name, patient)

View File

@@ -8,7 +8,7 @@ if not TheOnlyCure then
end
TOC_sides = { "Left", "Right" }
TOC_limbs = { "Hand", "LowerArm", "UpperArm" }
TOC_limbs = { "Hand", "LowerArm", "UpperArm", "Foot"}
local function TocCutLimbForTrait(player, limbs_data, part_name)
local amputation_clothing_item = player:getInventory():AddItem("TOC.Amputation_" .. part_name)
@@ -27,6 +27,33 @@ local function TocCutLimbForTrait(player, limbs_data, part_name)
limbs_data[v].is_cicatrized = true
end
end
local function InitSpecificPart(mod_data, part_name)
if mod_data.TOC.Limbs[part_name] == nil then
mod_data.TOC.Limbs[part_name] = {}
end
mod_data.TOC.Limbs[part_name].is_cut = false
mod_data.TOC.Limbs[part_name].is_infected = false
mod_data.TOC.Limbs[part_name].is_operated = false
mod_data.TOC.Limbs[part_name].is_cicatrized = false
mod_data.TOC.Limbs[part_name].is_cauterized = false
mod_data.TOC.Limbs[part_name].is_amputation_shown = false
mod_data.TOC.Limbs[part_name].cicatrization_time = 0
mod_data.TOC.Limbs[part_name].is_prosthesis_equipped = false
mod_data.TOC.Limbs[part_name].equipped_prosthesis = {}
end
local function TocUpdateBaseData(mod_data)
-- TODO The prosthetic knife needs to be a weapon first and foremost, so other than a
@@ -37,12 +64,25 @@ local function TocUpdateBaseData(mod_data)
local accepted_prosthesis_hand = { "WoodenHook", "MetalHook", "MetalHand", "ProstheticKnife" }
local accepted_prosthesis_lowerarm = { "WoodenHook", "MetalHook", "MetalHand", "ProstheticKnife" }
local accepted_prosthesis_upperarm = {} -- For future stuff
local accepted_prosthesis_foot = {}
for _, side in ipairs(TOC_sides) do
for _, limb in ipairs(TOC_limbs) do
local part_name = side .. "_" .. limb
-- Check if part was initialized
if mod_data.TOC.Limbs[part_name] == nil then
InitSpecificPart(mod_data, part_name)
end
if limb == "Hand" then
mod_data.TOC.Limbs[part_name].cicatrization_base_time = 1700
mod_data.TOC.Limbs[part_name].depends_on = {}
@@ -69,6 +109,11 @@ local function TocUpdateBaseData(mod_data)
mod_data.TOC.Limbs[part_name].cicatrization_base_time = 2000
mod_data.TOC.Limbs[part_name].depends_on = { side .. "_Hand", side .. "_LowerArm", }
mod_data.TOC.Prosthesis.Accepted_Prosthesis[part_name] = accepted_prosthesis_upperarm
elseif limb == "Foot" then
mod_data.TOC.Limbs[part_name].cicatrization_base_time = 1700
mod_data.TOC.Limbs[part_name].depends_on = {}
mod_data.TOC.Prosthesis.Accepted_Prosthesis[part_name] = accepted_prosthesis_foot
end
end
@@ -102,6 +147,10 @@ local function TocSetInitData(mod_data, player)
Left_Hand = {},
Left_LowerArm = {},
Left_UpperArm = {},
Left_Foot = {},
Right_Foot = {},
is_other_bodypart_infected = false
},
Prosthesis = {

View File

@@ -3,9 +3,8 @@ require "TimedActions/ISEquipWeaponAction"
require "TimedActions/ISUnequipAction"
require "ISUI/ISInventoryPaneContextMenu"
local og_ISBaseTimedActionAdjustMaxTime = ISBaseTimedAction.adjustMaxTime
function ISBaseTimedAction:adjustMaxTime(maxTime)
local original_max_time = og_ISBaseTimedActionAdjustMaxTime(self, maxTime)
@@ -128,7 +127,6 @@ end
local og_ISEquipWeaponActionPerform = ISEquipWeaponAction.perform
function ISEquipWeaponAction:perform()
-- TODO this is only for weapons, not items. Won't work for everything I think
--TODO Block it before even performing
-- TODO in the inventory menu there is something broken, even though this works

View File

@@ -13,11 +13,14 @@ end
addBodyLocationBefore("TOC_ArmRight", "Shoes")
addBodyLocationBefore("TOC_ArmLeft", "Shoes")
addBodyLocationBefore("TOC_LegRight", "Shoes")
addBodyLocationBefore("TOC_LegLeft", "Shoes")
addBodyLocationBefore("TOC_ArmRightProsthesis", "Shoes")
addBodyLocationBefore("TOC_ArmLeftProsthesis", "Shoes")
addBodyLocationBefore("TOC_LegRightProsthesis", "Shoes")
addBodyLocationBefore("TOC_LegLeftProsthesis", "Shoes")
addBodyLocationBefore("TOC_LegRight", "FannyPackFront")
addBodyLocationBefore("TOC_LegLeft", "FannyPackFront")
addBodyLocationBefore("TOC_LegRightProsthesis", "FannyPackFront")
addBodyLocationBefore("TOC_LegLeftProsthesis", "FannyPackFront")

Binary file not shown.

View File

@@ -481,18 +481,46 @@ item Surgery_Right_Tourniquet
item Amputation_Left_Foot
{
Weight = 1,
Type = Clothing,
DisplayCategory = Test,
DisplayName = amp test foot,
DisplayName = Amputated Left Foot,
ClothingItem = Amputation_Left_Foot,
BodyLocation = TOC_LegLeft,
BloodLocation = Hands,
Icon = woodenHook,
Tooltip = test,
CanHaveHoles = false,
}
Weight = 0,
CombatSpeedModifier = 0.9,
BloodLocation = Hands;LowerArms,
Insulation = 1.0,
WindResistance = 1.0,
WaterResistance = 1.0,
Icon = genericAmputation,
CanHaveHoles = false,
}
item Amputation_Right_Foot
{
Type = Clothing,
DisplayName = Amputated Right Foot,
ClothingItem = Amputation_Right_Foot,
BodyLocation = TOC_LegRight,
Weight = 0,
CombatSpeedModifier = 0.9,
BloodLocation = Hands;LowerArms,
Insulation = 1.0,
WindResistance = 1.0,
WaterResistance = 1.0,
Icon = genericAmputation,
CanHaveHoles = false,
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 671 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 981 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 282 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 683 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 724 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 680 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 671 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 381 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 683 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 724 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 843 B