bunch of cleaning
This commit is contained in:
@@ -60,7 +60,7 @@ end
|
||||
local function DeleteOtherAmputatedLimbs(side)
|
||||
-- if left hand is cut and we cut left lowerarm, then delete hand
|
||||
for _, limb in pairs(TOC.limbNames) do
|
||||
local partName = "TOC.Amputation_" .. side .. "_" .. limb
|
||||
local partName = "TOC.Amputation_" .. TOC_Common.ConcatPartName(side, limb)
|
||||
local amputatedLimbItem = getPlayer():getInventory():FindAndReturn(partName)
|
||||
if amputatedLimbItem then
|
||||
getPlayer():getInventory():Remove(amputatedLimbItem)
|
||||
@@ -175,7 +175,7 @@ TOC.CutLimb = function(partName, surgeonFactor, bandageTable, painkillerTable)
|
||||
if tourniquetItem ~= nil then
|
||||
baseDamageValue = 50 -- TODO Decrease mostly blood and damage, add pain, not everything else
|
||||
|
||||
if partName == side .. "_UpperArm" then
|
||||
if partName == TOC_Common.ConcatPartName(side, "UpperArm") then
|
||||
player:removeWornItem(tourniquetItem)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -15,7 +15,7 @@ TOC_Common.GeneratePartNames = function()
|
||||
local partNamesTable = {}
|
||||
for _, side in ipairs(TOC.sideNames) do
|
||||
for _, limb in ipairs(TOC.limbNames) do
|
||||
local tempPartName = side .. "_" .. limb
|
||||
local tempPartName = TOC_Common.ConcatPartName(side, limb)
|
||||
table.insert(partNamesTable, tempPartName)
|
||||
end
|
||||
end
|
||||
@@ -42,6 +42,11 @@ TOC_Common.GetSideFromPartName = function(partName)
|
||||
|
||||
end
|
||||
|
||||
TOC_Common.ConcatPartName = function(side, limb)
|
||||
|
||||
return side .. "_" .. limb
|
||||
|
||||
end
|
||||
---------------------------------
|
||||
|
||||
TOC_Common.GetAcceptableBodyPartTypes = function()
|
||||
@@ -157,9 +162,6 @@ end
|
||||
-----------------------------------
|
||||
-- Online Handling checks
|
||||
|
||||
|
||||
-----------------------------------------
|
||||
-- MP HANDLING CHECKS
|
||||
TOC_Common.CheckIfCanBeCut = function(partName, limbsData)
|
||||
|
||||
if limbsData == nil then
|
||||
@@ -246,7 +248,7 @@ TOC_Common.CheckIfProsthesisAlreadyInstalled = function(limbsData, partName)
|
||||
|
||||
for _, side in pairs(TOC.sideNames) do
|
||||
if string.find(partName, side) then
|
||||
return (limbsData[side .. "_Hand"].isProsthesisEquipped or limbsData[side .. "_LowerArm"].isProsthesisEquipped)
|
||||
return (limbsData[TOC_Common.ConcatPartName(side, "Hand")].isProsthesisEquipped or limbsData[TOC_Common.ConcatPartName(side, "LowerArm")].isProsthesisEquipped)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -259,12 +261,12 @@ TOC_Common.GetCanBeHeldTable = function(limbs_data)
|
||||
for _, side in pairs(TOC.sideNames) do
|
||||
canBeHeld[side] = true
|
||||
|
||||
if limbs_data[side .. "_Hand"].isCut then
|
||||
if limbs_data[side .. "_LowerArm"].isCut then
|
||||
if not limbs_data[side .. "_LowerArm"].isProsthesisEquipped then
|
||||
if limbs_data[TOC_Common.ConcatPartName(side, "Hand")].isCut then
|
||||
if limbs_data[TOC_Common.ConcatPartName(side, "LowerArm")].isCut then
|
||||
if not limbs_data[TOC_Common.ConcatPartName(side, "LowerArm")].isProsthesisEquipped then
|
||||
canBeHeld[side] = false
|
||||
end
|
||||
elseif not limbs_data[side .. "_Hand"].isProsthesisEquipped then
|
||||
elseif not limbs_data[TOC_Common.ConcatPartName(side, "Hand")].isProsthesisEquipped then
|
||||
canBeHeld[side] = false
|
||||
end
|
||||
end
|
||||
|
||||
@@ -93,7 +93,7 @@ TOC.SetInitData = function(modData, player)
|
||||
}
|
||||
for _, side in pairs(TOC.sideNames) do
|
||||
for _, limb in pairs(TOC.limbNames) do
|
||||
local partName = side .. "_" .. limb
|
||||
local partName = TOC_Common.ConcatPartName(side, limb)
|
||||
TOC.InitPart(modData.TOC.limbs, partName)
|
||||
end
|
||||
end
|
||||
@@ -145,7 +145,7 @@ local function InitializeTheOnlyCure()
|
||||
TOC.limbParameters = {}
|
||||
for _, side in pairs(TOC.sideNames) do
|
||||
for _, limb in pairs(TOC.limbNames) do
|
||||
local partName = side .. "_" .. limb
|
||||
local partName = TOC_Common.ConcatPartName(side, limb)
|
||||
TOC.limbParameters[partName] = {}
|
||||
|
||||
if limb == "Hand" then
|
||||
@@ -153,10 +153,10 @@ local function InitializeTheOnlyCure()
|
||||
TOC.limbParameters[partName].dependsOn = {}
|
||||
elseif limb == "LowerArm" then
|
||||
TOC.limbParameters[partName].cicatrizationBaseTime = 1800
|
||||
TOC.limbParameters[partName].dependsOn = { side .. "_Hand", }
|
||||
TOC.limbParameters[partName].dependsOn = { TOC_Common.ConcatPartName(side, "Hand") }
|
||||
elseif limb == "UpperArm" then
|
||||
TOC.limbParameters[partName].cicatrizationBaseTime = 2000
|
||||
TOC.limbParameters[partName].dependsOn = { side .. "_Hand", side .. "_LowerArm", }
|
||||
TOC.limbParameters[partName].dependsOn = { TOC_Common.ConcatPartName(side, "Hand"), TOC_Common.ConcatPartName(side, "LowerArm"), }
|
||||
elseif limb == "Foot" then
|
||||
TOC.limbParameters[partName].cicatrizationBaseTime = 1700
|
||||
TOC.limbParameters[partName].dependsOn = {}
|
||||
|
||||
@@ -70,3 +70,6 @@ end
|
||||
TOC_Compat.getHands = function(player)
|
||||
return ((TOC_Compat.hasArm(player, parts[1], parts[3]) and 1) or 0) + ((TOC_Compat.hasArm(player, parts[2], parts[4]) and 10) or 0)
|
||||
end
|
||||
|
||||
|
||||
return TOC_Compat
|
||||
@@ -235,7 +235,7 @@ function ISClothingExtraAction:isValid()
|
||||
for _, side in pairs (TOC.sideNames) do
|
||||
|
||||
if location == side .. "Wrist" then
|
||||
if limbsData[side .. "_LowerArm"].isCut then
|
||||
if limbsData[TOC_Common.ConcatPartName(side, "LowerArm")].isCut then
|
||||
return false
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
-- Side functions
|
||||
local function TocGetAmputationFullTypeFromInventory(player, side, limb)
|
||||
local player_inventory = player:getInventory()
|
||||
local item_name = "TOC.Amputation_" .. side .. "_" .. limb
|
||||
local item_name = "TOC.Amputation_" .. TOC_Common.ConcatPartName(side, limb)
|
||||
local found_item = player_inventory:FindAndReturn(item_name)
|
||||
if found_item then
|
||||
return found_item:getFullType()
|
||||
@@ -18,12 +18,12 @@ local function TocGetAmputationFullTypeFromInventory(player, side, limb)
|
||||
end
|
||||
|
||||
local function TocGetEquippedProsthesisFullTypeFromInventory(player, side, limb)
|
||||
local player_inventory = player:getInventory()
|
||||
local playerInventory = player:getInventory()
|
||||
for _, prost in ipairs(GetProsthesisList()) do
|
||||
local item_name = TocFindCorrectClothingProsthesis(prost, side .."_" .. limb)
|
||||
local found_item = player_inventory:FindAndReturn(item_name)
|
||||
if found_item then
|
||||
return found_item:getFullType()
|
||||
local itemName = TocFindCorrectClothingProsthesis(prost, TOC_Common.ConcatPartName(side, limb))
|
||||
local foundItem = playerInventory:FindAndReturn(itemName)
|
||||
if foundItem then
|
||||
return foundItem:getFullType()
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -44,7 +44,7 @@ function TocResetClothingItemBodyLocation(player, side, limb)
|
||||
player:removeWornItem(amputationItem)
|
||||
player:getInventory():Remove(amputationItem)
|
||||
amputationItem = playerInv:AddItem(amputationItemName)
|
||||
TOC_Visuals.SetTextureForAmputation(amputationItem, player, limbsData[side .. "_" .. limb].is_cicatrized)
|
||||
TOC_Visuals.SetTextureForAmputation(amputationItem, player, limbsData[TOC_Common.ConcatPartName(side, limb)].isCicatrized)
|
||||
player:setWornItem(amputationItem:getBodyLocation(), amputationItem)
|
||||
end
|
||||
amputationItem = nil -- reset it
|
||||
|
||||
@@ -191,8 +191,8 @@ TOC.UpdateEveryTenMinutes = function()
|
||||
|
||||
--Experience for prosthesis user
|
||||
for _, side in pairs(TOC.sideNames) do
|
||||
if partData[side .. "_Hand"].isProsthesisEquipped or partData[side .. "_LowerArm"].isProsthesisEquipped then
|
||||
player:getXp():AddXP(Perks[side .. "_Hand"], 4)
|
||||
if partData[TOC_Common.ConcatPartName(side, "Hand")].isProsthesisEquipped or partData[TOC_Common.ConcatPartName(side, "LowerArm")].isProsthesisEquipped then
|
||||
player:getXp():AddXP(Perks[TOC_Common.ConcatPartName(side, "Hand")], 4)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user