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

@@ -37,6 +37,9 @@
"forceDropHeavyItems",
"getPlayerHotbar",
"isServer",
"BodyLocations"
"BodyLocations",
"ISUnequipAction",
"ISInventoryPaneContextMenu",
"ISDropItemAction"
]
}

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
-- 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
@@ -92,3 +99,91 @@ function ISEquipWeaponAction:perform()
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()

View File

@@ -28,4 +28,16 @@ DisplayName_EN = {
ItemName_TOC.ProthesisMag1 = "Prothesis magazine for dummies",
ItemName_TOC.ProthesisMag2 = "Prothesis magazine for experienced",
ItemName_TOC.ProthesisMag3 = "Prothesis magazine for experts",
ItemName_TOC.ArmLeft_noHand = "Amputated left hand",
ItemName_TOC.ArmLeft_noForearm = "Amputated left forearm",
ItemName_TOC.ArmLeft_noArm = "Amputated entire left arm",
ItemName_TOC.ArmRight_noHand = "Amputated left hand",
ItemName_TOC.ArmRight_noForearm = "Amputated left forearm",
ItemName_TOC.ArmRight_noArm = "Amputated entire left arm",
}

View File

@@ -23,4 +23,7 @@ Tooltip_EN = {
Tooltip_ProthesisMag1 = "Learn how to make a wooden hook!"
Tooltip_ProthesisMag2 = "Learn how to make a metal hook!"
Tooltip_ProthesisMag3 = "Learn how to make a metal hand!"
}

Binary file not shown.

View File

@@ -8,79 +8,104 @@ imports
item ArmRight_noHand
{
Type = Clothing,
DisplayName = Amputated right hand,
ClothingItem = ArmRight_noHand,
BodyLocation = ArmRight,
Weight = 0,
CombatSpeedModifier = 0.9,
/*BloodLocation = UpperArms;LowerArms,*/
Insulation = 1.0,
WindResistance = 1.0,
WaterResistance = 1.0,
Icon = genericAmputation,
}
item ArmRight_noForearm
{
Type = Clothing,
DisplayName = Amputated right forearm,
ClothingItem = ArmRight_noForeArm,
BodyLocation = ArmRight,
Weight = 0,
CombatSpeedModifier = 0.8,
BloodLocation = UpperArms;LowerArms,
Insulation = 1.0,
WindResistance = 1.0,
WaterResistance = 1.0,
Icon = genericAmputation,
}
item ArmRight_noArm
{
Type = Clothing,
DisplayName = Amputated entire right arm,
ClothingItem = ArmRight_noArm,
BodyLocation = ArmRight,
/*BloodLocation = UpperArms,*/
Weight = 0,
CombatSpeedModifier = 0.7,
Insulation = 1.0,
WindResistance = 1.0,
WaterResistance = 1.0,
Icon = genericAmputation,
}
item ArmLeft_noHand
{
Type = Clothing,
DisplayName = Amputated left hand,
ClothingItem = ArmLeft_noHand,
BodyLocation = ArmLeft,
Weight = 0,
CombatSpeedModifier = 0.9,
/*BloodLocation = UpperArms;LowerArms,*/
Insulation = 1.0,
WindResistance = 1.0,
WaterResistance = 1.0,
Icon = genericAmputation,
}
item ArmLeft_noForearm
{
Type = Clothing,
DisplayCategory = Amputation,
DisplayName = Amputated left forearm,
ClothingItem = ArmLeft_noForeArm,
BodyLocation = ArmLeft,
Weight = 0,
CombatSpeedModifier = 0.8,
BloodLocation = UpperArms;LowerArms,
Insulation = 1.0,
WindResistance = 1.0,
WaterResistance = 1.0,
Icon = genericAmputation,
}
item ArmLeft_noArm
{
Type = Clothing,
DisplayName = Amputated entire left arm,
ClothingItem = ArmLeft_noArm,
BodyLocation = ArmLeft,
Weight = 0,
CombatSpeedModifier = 0.7,
/*BloodLocation = UpperArms,*/
Insulation = 1.0,
WindResistance = 1.0,
WaterResistance = 1.0,
Icon = genericAmputation,
}
/************************ Other items ************************/

Binary file not shown.

After

Width:  |  Height:  |  Size: 782 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 136 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 820 B