Initial work for legs amputations
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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 = {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user