Missed a few things

This commit is contained in:
Pao
2023-01-18 03:11:54 +01:00
parent 5b3e10c0db
commit a795a01c19
9 changed files with 85 additions and 76 deletions

View File

@@ -10,17 +10,17 @@ function CheckIfCanBeCut(part_name)
end end
function CheckIfProsthesisAlreadyInstalled(toc_data, part_name) function CheckIfProsthesisAlreadyInstalled(part_data, part_name)
local r = "Right" local r = "Right"
local l = "Left" local l = "Left"
if string.find(part_name, r) then if string.find(part_name, r) then
return (toc_data[r .. "Hand"].is_prosthesis_equipped or toc_data[r .. "Forearm"].is_prosthesis_equipped) return (part_data[r .. "_Hand"].is_prosthesis_equipped or part_data[r .. "_LowerArm"].is_prosthesis_equipped)
elseif string.find(part_name, l) then elseif string.find(part_name, l) then
return (toc_data[l .. "Hand"].is_prosthesis_equipped or toc_data[l .. "Forearm"].is_prosthesis_equipped) return (part_data[l .. "_Hand"].is_prosthesis_equipped or part_data[l .. "_LowerArm"].is_prosthesis_equipped)
end end
@@ -30,9 +30,9 @@ end
function CheckIfCanBeOperated(part_name) function CheckIfCanBeOperated(part_name)
local toc_data = getPlayer():getModData().TOC local part_data = getPlayer():getModData().TOC.Limbs
return toc_data[part_name].is_operated == false and toc_data[part_name].is_amputation_shown return part_data[part_name].is_operated == false and part_data[part_name].is_amputation_shown
end end

View File

@@ -28,7 +28,7 @@ function GetAcceptingProsthesisBodyPartTypes()
end end
-- TODO Change name -- TODO This is just convoluted. Do not use this
function FindTocDataPartNameFromBodyPartType(toc_limbs_data, bodyPartType) function FindTocDataPartNameFromBodyPartType(toc_limbs_data, bodyPartType)
if bodyPartType == BodyPartType.Hand_R then return toc_limbs_data.Right_Hand if bodyPartType == BodyPartType.Hand_R then return toc_limbs_data.Right_Hand
elseif bodyPartType == BodyPartType.ForeArm_R then return toc_limbs_data.Right_LowerArm elseif bodyPartType == BodyPartType.ForeArm_R then return toc_limbs_data.Right_LowerArm

View File

@@ -66,21 +66,21 @@ TocContextMenus.CreateOperateWithOvenMenu = function(player, context, worldObjec
-- TODO Add a way to move the player towards the oven -- TODO Add a way to move the player towards the oven
local toc_data = player_obj:getModData().TOC local part_data = player_obj:getModData().TOC.Limbs
local is_main_menu_already_created = false local is_main_menu_already_created = false
--local props = v:getSprite() and v:getSprite():getProperties() or nil --local props = v:getSprite() and v:getSprite():getProperties() or nil
for k_stove, v_stove in pairs(worldObjects) do for _, v_stove in pairs(worldObjects) do
if instanceof(v_stove, "IsoStove") and (player_obj:HasTrait("Brave") or player_obj:getPerkLevel(Perks.Strength) >= 6) then if instanceof(v_stove, "IsoStove") and (player_obj:HasTrait("Brave") or player_obj:getPerkLevel(Perks.Strength) >= 6) then
-- Check temperature -- Check temperature
if v_stove:getCurrentTemperature() > 250 then if v_stove:getCurrentTemperature() > 250 then
for k_bodypart, v_bodypart in ipairs(GetBodyParts()) do for _, v_bodypart in ipairs(GetBodyParts()) do
if toc_data[v_bodypart].is_cut and toc_data[v_bodypart].is_amputation_shown and not toc_data[v_bodypart].is_operated then if part_data[v_bodypart].is_cut and part_data[v_bodypart].is_amputation_shown and not part_data[v_bodypart].is_operated then
local subMenu = context:getNew(context); local subMenu = context:getNew(context);
if is_main_menu_already_created == false then if is_main_menu_already_created == false then
@@ -125,16 +125,15 @@ end
TocContextMenus.FillCutAndOperateMenus = function(local_player, clicked_player, world_objects, cut_menu, operate_menu) TocContextMenus.FillCutAndOperateMenus = function(local_player, clicked_player, world_objects, cut_menu, operate_menu)
local local_toc_data = local_player:getModData().TOC local local_part_data = local_player:getModData().TOC.Limbs
for _, v in ipairs(GetBodyParts()) do for _, v in ipairs(GetBodyParts()) do
if local_player == clicked_player then -- Local player if local_player == clicked_player then -- Local player
if CheckIfCanBeCut(v) and not CheckIfProsthesisAlreadyInstalled(local_toc_data, v) then if CheckIfCanBeCut(v) and not CheckIfProsthesisAlreadyInstalled(local_part_data, v) then
cut_menu:addOption(getText('UI_ContextMenu_' .. v), _, TryTocAction, v, "Cut", local_player, local_player) cut_menu:addOption(getText('UI_ContextMenu_' .. v), _, TryTocAction, v, "Cut", local_player, local_player)
--cut_menu:addOption(getText('UI_ContextMenu_' .. v), _, TocCutLocal, local_player, local_player, v)
elseif CheckIfCanBeOperated(v) then elseif CheckIfCanBeOperated(v) then
operate_menu:addOption(getText('UI_ContextMenu_' .. v), _, TryTocAction, v, "Operate", local_player, local_player) operate_menu:addOption(getText('UI_ContextMenu_' .. v), _, TryTocAction, v, "Operate", local_player, local_player)
end end

View File

@@ -1,7 +1,7 @@
-- CutLimb -- CutLimb
-- TODO if TheONlyCure. triggers an errors -- TODO if TheONlyCure. triggers an errors
function CheckIfStillInfected(toc_data) function CheckIfStillInfected(part_data)
if toc_data == nil then if part_data == nil then
return return
end end
-- Check ALL body part types to check if the player is still gonna die -- Check ALL body part types to check if the player is still gonna die
@@ -9,12 +9,12 @@ function CheckIfStillInfected(toc_data)
for _, v in ipairs(GetBodyParts()) do for _, v in ipairs(GetBodyParts()) do
if toc_data[v].is_infected then if part_data[v].is_infected then
check = true check = true
end end
end end
if toc_data.is_other_bodypart_infected then if part_data.is_other_bodypart_infected then
check = true check = true
end end
@@ -40,14 +40,14 @@ end
-- OperateLimb -- OperateLimb
function SetBodyPartsStatusAfterOperation(player, toc_data, part_name, use_oven) function SetBodyPartsStatusAfterOperation(player, part_data, part_name, use_oven)
--for _, v in ipairs(GetBodyParts()) do --for _, v in ipairs(GetBodyParts()) do
local body_part_type = player:getBodyDamage():getBodyPart(TocGetBodyPartTypeFromBodyPart(part_name)) local body_part_type = player:getBodyDamage():getBodyPart(TocGetBodyPartTypeFromBodyPart(part_name))
FixSingleBodyPartType(body_part_type, use_oven) FixSingleBodyPartType(body_part_type, use_oven)
for _, v in ipairs(toc_data[part_name].depends_on) do for _, v in ipairs(part_data[part_name].depends_on) do
local depended_body_part_type = player:getBodyDamage():getBodyPart(TocGetBodyPartTypeFromBodyPart(v)) local depended_body_part_type = player:getBodyDamage():getBodyPart(TocGetBodyPartTypeFromBodyPart(v))
FixSingleBodyPartType(depended_body_part_type, use_oven) FixSingleBodyPartType(depended_body_part_type, use_oven)

View File

@@ -60,9 +60,9 @@ local function GetImageName(part_name, toc_data)
end end
-- If foreaerm equip, change hand -- If foreaerm equip, change hand
if part_name == "Right_Hand" and toc_data["Right_LowerArm"].is_prosthesis_equipped then if part_name == "Right_Hand" and toc_data.Limbs["Right_LowerArm"].is_prosthesis_equipped then
name = "media/ui/TOC/" .. part_name .. "/Hook.png" name = "media/ui/TOC/" .. part_name .. "/Hook.png"
elseif part_name == "Left_Hand" and toc_data["Left_LowerArm"].is_prosthesis_equipped then elseif part_name == "Left_Hand" and toc_data.Limbs["Left_LowerArm"].is_prosthesis_equipped then
name = "media/ui/TOC/" .. part_name .. "/Hook.png" name = "media/ui/TOC/" .. part_name .. "/Hook.png"
end end
return name return name

View File

@@ -1,5 +1,7 @@
-- Makes the player drop an item if they don't have a limb or haven't equipped a prosthesis -- Makes the player drop an item if they don't have a limb or haven't equipped a prosthesis
function TheOnlyCure.TryDropItem(player, toc_data) function TheOnlyCure.TryDropItem(player, toc_data)
-- TODO this is old, was used in the update thing
if TheOnlyCure.CheckIfCanPickUpItem(toc_data, Right, Hand, Forearm) and player:getPrimaryHandItem() ~= nil then if TheOnlyCure.CheckIfCanPickUpItem(toc_data, Right, Hand, Forearm) and player:getPrimaryHandItem() ~= nil then
if player:getPrimaryHandItem():getName() ~= "Bare Hands" then if player:getPrimaryHandItem():getName() ~= "Bare Hands" then
player:dropHandItems() player:dropHandItems()
@@ -18,6 +20,8 @@ end
-- Helper for DropItem -- Helper for DropItem
function TheOnlyCure.CheckIfCanPickUpItem(toc_data, side, limb, secondary_limb) function TheOnlyCure.CheckIfCanPickUpItem(toc_data, side, limb, secondary_limb)
-- TODO we can use this when uninstall prost or when cutting
local full_primary_limb = side .. limb local full_primary_limb = side .. limb
local full_secondary_limb = side .. secondary_limb local full_secondary_limb = side .. secondary_limb
@@ -33,10 +37,13 @@ function TheOnlyCure.CheckIfPlayerIsInfected(player, toc_data)
local body_damage = player:getBodyDamage() local body_damage = player:getBodyDamage()
for _, v in ipairs(GetLimbsBodyPartTypes()) do for _, v in ipairs(GetLimbsBodyPartTypes()) do
local toc_bodypart = FindTocDataPartNameFromBodyPartType(toc_data.Limbs, v) local part_name = FindTocBodyPartNameFromBodyPartType(v)
if body_damage:getBodyPart(v):bitten() and toc_bodypart ~= nil then local part_data = toc_data.Limbs[part_name]
if toc_bodypart.is_cut == false then
toc_bodypart.is_infected = true
if body_damage:getBodyPart(v):bitten() and part_data ~= nil then
if part_data.is_cut == false then
part_data.is_infected = true
player:transmitModData() player:transmitModData()
end end
@@ -45,14 +52,14 @@ function TheOnlyCure.CheckIfPlayerIsInfected(player, toc_data)
for _, v in ipairs(GetOtherBodyPartTypes()) do for _, v in ipairs(GetOtherBodyPartTypes()) do
if body_damage:getBodyPart(v):bitten() then if body_damage:getBodyPart(v):bitten() then
toc_data.is_other_bodypart_infected = true -- Even one is enough, stop cycling if we find it toc_data.Limbs.is_other_bodypart_infected = true -- Even one is enough, stop cycling if we find it
player:transmitModData() player:transmitModData()
break break
end end
end end
end end
function TheOnlyCure.UpdatePlayerHealth(player, toc_data) function TheOnlyCure.UpdatePlayerHealth(player, part_data)
local body_damage = player:getBodyDamage() local body_damage = player:getBodyDamage()
@@ -60,8 +67,8 @@ function TheOnlyCure.UpdatePlayerHealth(player, toc_data)
if player:HasTrait("Insensitive") then body_damage:setPainReduction(49) end if player:HasTrait("Insensitive") then body_damage:setPainReduction(49) end
for i, part_name in pairs(GetBodyParts()) do for i, part_name in pairs(GetBodyParts()) do
if toc_data[part_name].is_cut then if part_data[part_name].is_cut then
TheOnlyCure.HealSpecificPart(toc_data, part_name, player) TheOnlyCure.HealSpecificPart(part_data, part_name, player)
end end
end end
@@ -72,7 +79,7 @@ function TheOnlyCure.UpdatePlayerHealth(player, toc_data)
end end
--Helper function for UpdatePlayerHealth --Helper function for UpdatePlayerHealth
function TheOnlyCure.HealSpecificPart(toc_data, part_name, player) function TheOnlyCure.HealSpecificPart(part_data, part_name, player)
local body_damage = player:getBodyDamage() local body_damage = player:getBodyDamage()
@@ -98,7 +105,7 @@ function TheOnlyCure.HealSpecificPart(toc_data, part_name, player)
-- Set max health -- Set max health
if toc_data[part_name].is_cicatrized and body_part_type:getHealth() > 80 then if part_data[part_name].is_cicatrized and body_part_type:getHealth() > 80 then
body_part_type:SetHealth(80) body_part_type:SetHealth(80)
elseif body_part_type:getHealth() > 40 then elseif body_part_type:getHealth() > 40 then
body_part_type:SetHealth(40) body_part_type:SetHealth(40)
@@ -114,7 +121,11 @@ function TheOnlyCure.HealSpecificPart(toc_data, part_name, player)
-- Check if we can heal the infection -- Check if we can heal the infection
if body_part_type:bitten() then if body_part_type:bitten() then
body_part_type:SetBitten(false) body_part_type:SetBitten(false)
if not toc_data[part_name].is_other_bodypart_infected and not TheOnlyCure.CheckIfOtherLimbsAreInfected(toc_data, part_name) then
local is_other_bodypart_infected = player:getModData().TOC.Limbs.is_other_bodypart_infected
if not is_other_bodypart_infected and not TheOnlyCure.CheckIfOtherLimbsAreInfected(part_data, part_name) then
body_part_type:setInfected(false) body_part_type:setInfected(false)
body_part_type:setInfectionMortalityDuration(-1) body_part_type:setInfectionMortalityDuration(-1)
body_part_type:setInfectionTime(-1) body_part_type:setInfectionTime(-1)
@@ -138,9 +149,9 @@ function TheOnlyCure.HealSpecificPart(toc_data, part_name, player)
if body_part_type:getFractureTime()>0 then body_part_type:setFractureTime(0) end if body_part_type:getFractureTime()>0 then body_part_type:setFractureTime(0) end
-- Cicatrization check -- Cicatrization check
if toc_data[part_name].is_cut and not toc_data[part_name].is_cicatrized then if part_data[part_name].is_cut and not part_data[part_name].is_cicatrized then
if toc_data[part_name].cicatrization_time < 0 then if part_data[part_name].cicatrization_time < 0 then
toc_data[part_name].is_cicatrized = true part_data[part_name].is_cicatrized = true
-- TODO make this random if the player gets it or not -- TODO make this random if the player gets it or not
--FIXME they're gonna stack!!!! --FIXME they're gonna stack!!!!
@@ -158,9 +169,9 @@ function TheOnlyCure.HealSpecificPart(toc_data, part_name, player)
end end
-- Phantom Pain -- Phantom Pain
if toc_data[part_name].is_amputation_shown and ZombRand(1, 100) < 10 then if part_data[part_name].is_amputation_shown and ZombRand(1, 100) < 10 then
local added_pain local added_pain
if toc_data[part_name].is_cauterized then added_pain = 60 else added_pain = 30 end if part_data[part_name].is_cauterized then added_pain = 60 else added_pain = 30 end
body_part_type:setAdditionalPain(ZombRand(1, added_pain)) body_part_type:setAdditionalPain(ZombRand(1, added_pain))
end end
@@ -170,14 +181,14 @@ function TheOnlyCure.HealSpecificPart(toc_data, part_name, player)
end end
--Helper function for UpdatePlayerHealth --Helper function for UpdatePlayerHealth
function TheOnlyCure.CheckIfOtherLimbsAreInfected(toc_data, part_name) function TheOnlyCure.CheckIfOtherLimbsAreInfected(part_data, part_name)
local body_parts = GetBodyParts() local body_parts = GetBodyParts()
body_parts[part_name] = nil body_parts[part_name] = nil
for _,v in pairs(body_parts) do for _,v in pairs(body_parts) do
if toc_data[v].is_infected then if part_data[v].is_infected then
return true return true
end end
end end
@@ -200,7 +211,7 @@ function TheOnlyCure.UpdateEveryOneMinute()
if toc_data ~= nil then if toc_data ~= nil then
--TheOnlyCure.TryDropItem(player, toc_data) -- TODO this must be set only in the cut\equipping function, not here --TheOnlyCure.TryDropItem(player, toc_data) -- TODO this must be set only in the cut\equipping function, not here
TheOnlyCure.CheckIfPlayerIsInfected(player, toc_data) TheOnlyCure.CheckIfPlayerIsInfected(player, toc_data)
TheOnlyCure.UpdatePlayerHealth(player, toc_data) TheOnlyCure.UpdatePlayerHealth(player, toc_data.Limbs)
end end
end end

View File

@@ -20,7 +20,9 @@ function TheOnlyCure.InitTheOnlyCure(_, player)
mod_data.TOC = { mod_data.TOC = {
Limbs = {}, Limbs = {
is_other_bodypart_infected = false
},
Prosthesis = {}, Prosthesis = {},
Generic = {}, Generic = {},
} }
@@ -159,6 +161,7 @@ function TheOnlyCure.CutLimb(part_name, surgeon_factor, bandage_table, painkille
-- TODO Check if this works in MP through MENU UI -- TODO Check if this works in MP through MENU UI
local player = getPlayer() local player = getPlayer()
local toc_data = player:getModData().TOC local toc_data = player:getModData().TOC
local part_data = toc_data.Limbs
local body_part_type = player:getBodyDamage():getBodyPart(TocGetBodyPartTypeFromBodyPart(part_name)) local body_part_type = player:getBodyDamage():getBodyPart(TocGetBodyPartTypeFromBodyPart(part_name))
local stats = player:getStats(); local stats = player:getStats();
@@ -184,19 +187,19 @@ function TheOnlyCure.CutLimb(part_name, surgeon_factor, bandage_table, painkille
-- Remove object in hand -- Remove object in hand
-- TODO do this -- TODO do this
if toc_data[part_name].is_cut == false then if part_data[part_name].is_cut == false then
toc_data[part_name].is_cut = true part_data[part_name].is_cut = true
toc_data[part_name].is_amputation_shown = true part_data[part_name].is_amputation_shown = true
toc_data[part_name].cicatrization_time = toc_data[part_name].cicatrization_base_time - surgeon_factor * 50 part_data[part_name].cicatrization_time = part_data[part_name].cicatrization_base_time - surgeon_factor * 50
-- Heal the infection here -- Heal the infection here
local body_damage = player:getBodyDamage() local body_damage = player:getBodyDamage()
if toc_data[part_name].is_infected and body_damage.getInfectionLevel() < 20 then if part_data[part_name].is_infected and body_damage.getInfectionLevel() < 20 then
toc_data[part_name].is_infected = false part_data[part_name].is_infected = false
body_part_type:SetBitten(false) body_part_type:SetBitten(false)
-- Second check, let's see if there is any other infected limb. -- Second check, let's see if there is any other infected limb.
if CheckIfStillInfected(toc_data) == false then if CheckIfStillInfected(part_data) == false then
CureInfection(body_damage) CureInfection(body_damage)
getPlayer():Say("I'm gonna be fine") getPlayer():Say("I'm gonna be fine")
else else
@@ -205,10 +208,10 @@ function TheOnlyCure.CutLimb(part_name, surgeon_factor, bandage_table, painkille
end end
-- Cut the depended part -- Cut the depended part
for _, depended_v in pairs(toc_data[part_name].depends_on) do for _, depended_v in pairs(part_data[part_name].depends_on) do
toc_data[depended_v].is_cut = true part_data[depended_v].is_cut = true
toc_data[depended_v].is_amputation_shown = false -- TODO why was it true before? part_data[depended_v].is_amputation_shown = false -- TODO why was it true before?
toc_data[depended_v].cicatrization_time = toc_data[part_name].cicatrization_base_time - surgeon_factor * 50 part_data[depended_v].cicatrization_time = part_data[part_name].cicatrization_base_time - surgeon_factor * 50
end end
--Equip model for amputation --Equip model for amputation
@@ -226,7 +229,7 @@ end
function TheOnlyCure.OperateLimb(part_name, surgeon_factor, use_oven) function TheOnlyCure.OperateLimb(part_name, surgeon_factor, use_oven)
local player = getPlayer() local player = getPlayer()
local toc_data = player:getModData().TOC local part_data = player:getModData().TOC.Limbs
if use_oven then if use_oven then
local stats = player:getStats() local stats = player:getStats()
@@ -234,20 +237,20 @@ function TheOnlyCure.OperateLimb(part_name, surgeon_factor, use_oven)
stats:setStress(100) stats:setStress(100)
end end
if toc_data[part_name].is_operated == false and toc_data[part_name].is_cut == true then if part_data[part_name].is_operated == false and part_data[part_name].is_cut == true then
toc_data[part_name].is_operated = true part_data[part_name].is_operated = true
toc_data[part_name].cicatrization_time = toc_data[part_name].cicatrization_time - (surgeon_factor * 200) part_data[part_name].cicatrization_time = part_data[part_name].cicatrization_time - (surgeon_factor * 200)
if use_oven then toc_data[part_name].is_cauterized = true end if use_oven then part_data[part_name].is_cauterized = true end
for _, depended_v in pairs(toc_data[part_name].depends_on) do for _, depended_v in pairs(part_data[part_name].depends_on) do
toc_data[depended_v].is_operated = true part_data[depended_v].is_operated = true
toc_data[depended_v].cicatrization_time = toc_data[depended_v].cicatrization_time - (surgeon_factor * 200) part_data[depended_v].cicatrization_time = part_data[depended_v].cicatrization_time - (surgeon_factor * 200)
if use_oven then toc_data[depended_v].is_cauterized = true end -- TODO does this make sense? if use_oven then part_data[depended_v].is_cauterized = true end -- TODO does this make sense?
end end
end end
SetBodyPartsStatusAfterOperation(player, toc_data, part_name, use_oven) SetBodyPartsStatusAfterOperation(player, part_data, part_name, use_oven)
player:transmitModData() player:transmitModData()
end end

View File

@@ -56,9 +56,6 @@ function ISUninstallProsthesis:perform()
print("Found prost in " .. part_name) print("Found prost in " .. part_name)
if part_name then if part_name then
toc_data.Limbs[part_name].is_prosthesis_equipped = false toc_data.Limbs[part_name].is_prosthesis_equipped = false
--toc_data.Limbs[part_name].prosthesis_factor = 1 -- TODO This is wrong
--local side = string.gsub(part_name, "Hand" or "Forearm", "")
local item_full_type = self.item:getFullType() local item_full_type = self.item:getFullType()
print("Searching for " .. item_full_type) print("Searching for " .. item_full_type)
for _, prost_v in ipairs(GetProsthesisList()) do for _, prost_v in ipairs(GetProsthesisList()) do

View File

@@ -11,7 +11,7 @@ function ISBaseTimedAction:adjustMaxTime(maxTime)
local original_max_time = og_ISEquipTimedActionAdjustMaxTime(self, maxTime) -- TODO will it work? local original_max_time = og_ISEquipTimedActionAdjustMaxTime(self, maxTime) -- TODO will it work?
local modified_max_time = original_max_time local modified_max_time = original_max_time
local toc_data = getPlayer():getModData().TOC local part_data = getPlayer():getModData().TOC.Limbs
local burn_factor = 1.3 local burn_factor = 1.3
-- To make it faster, let's have everything already written in another func -- To make it faster, let's have everything already written in another func
@@ -21,17 +21,16 @@ function ISBaseTimedAction:adjustMaxTime(maxTime)
-- TODO this gets awfully slow really quick, doesn't even make much sense. -- TODO this gets awfully slow really quick, doesn't even make much sense.
for _, part_name in ipairs(all_body_parts) do for _, part_name in ipairs(all_body_parts) do
if part_data[part_name].is_cut then
if toc_data.Limbs[part_name].is_cut then
if toc_data.Limbs[part_name].is_prosthesis_equipped then if part_data[part_name].is_prosthesis_equipped then
modified_max_time = modified_max_time * toc_data.Limbs[part_name].equipped_prosthesis.prosthesis_factor modified_max_time = modified_max_time * part_data[part_name].equipped_prosthesis.prosthesis_factor
else else
modified_max_time = modified_max_time * 2 modified_max_time = modified_max_time * 2
end end
if toc_data.Limbs[part_name].is_cauterized then if part_data[part_name].is_cauterized then
modified_max_time = modified_max_time * burn_factor modified_max_time = modified_max_time * burn_factor
end end
@@ -61,18 +60,18 @@ local og_ISEquipWeaponActionPerform = ISEquipWeaponAction.perform
function ISEquipWeaponAction:perform() function ISEquipWeaponAction:perform()
og_ISEquipWeaponActionPerform(self) og_ISEquipWeaponActionPerform(self)
local toc_data = self.character:getModData().TOC local part_data = self.character:getModData().TOC.Limbs
local can_be_held = {} local can_be_held = {}
for _, side in ipairs ({"Left", "Right"}) do for _, side in ipairs ({"Left", "Right"}) do
can_be_held[side] = true can_be_held[side] = true
if toc_data[side .. "Hand"].is_cut then if part_data[side .. "_Hand"].is_cut then
if toc_data[side .. "Forearm"].is_cut then if part_data[side .. "_LowerArm"].is_cut then
if not toc_data[side .. "Forearm"].is_prosthesis_equipped then if not part_data[side .. "_LowerArm"].is_prosthesis_equipped then
can_be_held[side] = false can_be_held[side] = false
end end
elseif not toc_data[side .. "Hand"].is_prosthesis_equipped then elseif not part_data[side .. "_Hand"].is_prosthesis_equipped then
can_be_held[side] = false can_be_held[side] = false
end end
end end