Blood and cleaning on amputated limbs

This commit is contained in:
Pao
2023-01-17 13:55:14 +01:00
parent 64c2010a60
commit 0d840baeff
12 changed files with 197 additions and 5 deletions

View File

@@ -69,3 +69,34 @@ function FixSingleBodyPartType(body_part_type, use_oven)
--body_part_type:setBleedingTime(ZombRand(1, 5)) -- Reset the bleeding, maybe make it random
end
end
-------------------------------------
-- Override helper
function CheckIfItemIsAmputatedLimb(item)
local item_full_type = item:getFullType()
local sides = {"Left", "Right"}
local limbs_to_check = {"Hand", "Forearm", "Arm"}
local is_amputated_limb = false
for _, part_name in ipairs(limbs_to_check) do
for _, side in ipairs(sides) do
local check_name = "TOC.Arm" .. side .. "_no" .. part_name
print(check_name)
if item_full_type == check_name then
is_amputated_limb = true
break
end
end
end
return is_amputated_limb
end

View File

@@ -1,9 +1,11 @@
require "TimedActions/ISBaseTimedAction"
require "TimedActions/ISEquipWeaponAction"
require "TimedActions/ISUnequipAction"
require "TimedActions/ISDropItemAction"
local og_ISEquipTimedActionAdjustMaxTime = ISBaseTimedAction.adjustMaxTime
local og_ISEquipTimedActionAdjustMaxTime = ISBaseTimedAction.adjustMaxTime
-- FIXME something is seriously broken here, it stacks up
function ISBaseTimedAction:adjustMaxTime(maxTime)
local original_max_time = og_ISEquipTimedActionAdjustMaxTime(self, maxTime) -- TODO will it work?
@@ -42,6 +44,11 @@ function ISBaseTimedAction:adjustMaxTime(maxTime)
end
if modified_max_time > 10 * original_max_time then modified_max_time = 10 * original_max_time end
print("MODIFIED MAX TIME: " .. modified_max_time)
return modified_max_time
end
@@ -91,4 +98,92 @@ function ISEquipWeaponAction:perform()
end
end
-- local og_ISInventoryPaneContextMenuDoWearClothingMenu = ISInventoryPaneContextMenu.doWearClothingMenu
-- function ISInventoryPaneContextMenu.doWearClothingMenu(player, clothing, items, context)
-- og_ISInventoryPaneContextMenuDoWearClothingMenu(self, player, clothing, items, context)
-- end
local og_ISUnequipActionPerform = ISUnequipAction.perform
function ISUnequipAction:perform()
-- -- check if the "clothing" is actually an amputation
-- -- for _, v in ipairs(GetBodyParts()) do
-- -- local amputation = TocFindAmputatedClothingFromPartName(v)
-- -- if amputation then
-- -- end
-- -- end
if not CheckIfItemIsAmputatedLimb(self.item) then
og_ISUnequipActionPerform(self)
end
end
local og_ISDropItemActionPerform = ISDropItemAction.perform
function ISDropItemAction:perform()
if not CheckIfItemIsAmputatedLimb(self.item) then
og_ISDropItemActionPerform(self)
end
end
-- TODO Add "Clean Wound" to make the cicatrization faster
-- local og_ISInventoryPaneContextMenuCreateMenu = ISInventoryPaneContextMenu.createMenu
-- function ISInventoryPaneContextMenu.createMenu(player, isInPlayerInventory, items, x, y, origin)
-- og_ISInventoryPaneContextMenuCreateMenu(player, isInPlayerInventory, items, x, y, origin)
-- local items_to_delete = GetAmputatedLimbFullTypes()
-- local item_try_again
-- local test_item = nil
-- local item_to_test = nil
-- --local seccontext = ISContextMenu.get(player, x, y);
-- for index, v in ipairs(items) do
-- test_item = v
-- if not instanceof(v, "InventoryItem") then
-- item_to_test = v.items[1]
-- for _, item_to_delete in ipairs(items_to_delete) do
-- local item_type = item_to_test:getFullType()
-- print("ITEM IN INV " ..item_type)
-- print("CHECKING STRING " .. item_to_delete)
-- if item_type == item_to_delete then
-- --seccontext:removeOptionByName(getText("ContextMenu_Unequip")) -- IT IS ALREADY DEFINED!!!
-- end
-- end
-- end
-- end
-- end

View File

@@ -40,6 +40,14 @@ end
function GetNonAcceptingProsthesisBodyParts()
return {"RightArm", "LeftArm"}
end
function GetAmputatedLimbFullTypes()
return {"TOC.ArmRight_noHand", "TOC.ArmRight_noForearm", "TOC.ArmRight_noArm",
"TOC.ArmLeft_noHand", "TOC.ArmLeft_noForearm", "TOC.ArmLeft_noArm"}
end
local function PartNameToBodyLocation(name)
if name == "RightHand" then return "ArmRight_Prot" end
if name == "RightForearm" then return "ArmRight_Prot" end
@@ -127,6 +135,21 @@ function TocFindAmputatedClothingFromPartName(part_name)
end
-- TODO finish this
-- function TocFindIfClothingItemIsAmputatedLimb(item_name)
-- if item_name == "ArmRight_noHand"
-- local check =
-- end
function TocFindProsthesisFactorFromItem(item)
local itemType = item:getType()