Fixed wrist thing

This commit is contained in:
Pao
2023-02-28 12:01:18 +01:00
parent b4f5db561d
commit 3470edb648
3 changed files with 36 additions and 17 deletions

View File

@@ -55,6 +55,7 @@
"SandboxVars", "SandboxVars",
"getClassField", "getClassField",
"ISWearClothing", "ISWearClothing",
"SyncXp" "SyncXp",
"ISClothingExtraAction"
] ]
} }

View File

@@ -175,7 +175,7 @@ JCIO.CutLimb = function(partName, surgeonFactor, bandageTable, painkillerTable)
if tourniquetItem ~= nil then if tourniquetItem ~= nil then
baseDamageValue = 50 -- TODO Decrease mostly blood and damage, add pain, not everything else baseDamageValue = 50 -- TODO Decrease mostly blood and damage, add pain, not everything else
if partName == "Left_UpperArm" or partName == "Right_UpperArm" then if partName == side .. "_UpperArm" then
player:removeWornItem(tourniquetItem) player:removeWornItem(tourniquetItem)
end end
end end
@@ -185,8 +185,10 @@ JCIO.CutLimb = function(partName, surgeonFactor, bandageTable, painkillerTable)
local wristWatchItem = FindWristWatchInWornItems(player, side) local wristWatchItem = FindWristWatchInWornItems(player, side)
if wristWatchItem ~= nil then if wristWatchItem ~= nil then
if partName == side .. "_LowerArm" or partName == side .. "_UpperArm" then
player:removeWornItem(wristWatchItem) player:removeWornItem(wristWatchItem)
end end
end

View File

@@ -194,26 +194,42 @@ function ISWearClothing:isValid()
local baseCheck = og_ISWearClothingIsValid(self) local baseCheck = og_ISWearClothingIsValid(self)
local itemFullType = self.item:getFullType() local itemFullType = self.item:getFullType()
local limbsData = self.character:getModData().JCIO.limbs local limbsData = self.character:getModData().JCIO.limbs
local itemsToBeChecked = {
"Surgery_%1_Tourniquet", -- 1
"Watch_%1" -- 2
}
local itemToCheck = "Surgery_%s_Tourniquet"
for _, side in pairs(JCIO.sideNames) do for _, side in pairs(JCIO.sideNames) do
for indexItem, itemName in pairs(itemsToBeChecked) do
local formattedItemName = string.format(itemName, side) local formattedItemName = string.format(itemToCheck, side)
if string.find(itemFullType, formattedItemName) then if string.find(itemFullType, formattedItemName) then
if indexItem == 1 and limbsData[side .. "_UpperArm"].isCut then if limbsData[side .. "_UpperArm"].isCut then
return false return false
elseif indexItem == 2 and limbsData[side .. "_Hand"].isCut then
return false
end
end end
end end
end end
return baseCheck return baseCheck
end
local og_ISWearClothingExtraAction = ISClothingExtraAction.isValid
function ISClothingExtraAction:isValid()
local baseCheck = og_ISWearClothingExtraAction(self)
local itemToCheck = "Watch_%s"
local itemFullType = self.item:getFullType()
local limbsData = self.character:getModData().JCIO.limbs
for _, side in pairs(JCIO.sideNames) do
local formattedItemName = string.format(itemToCheck, side)
if string.find(itemFullType, formattedItemName) then
if limbsData[side .. "_LowerArm"].isCut then
return false
end
end
end
return baseCheck
end end