equipping weapons working with prosts

This commit is contained in:
ZioPao
2023-11-15 02:52:02 +01:00
parent 0fdc0de27d
commit 6adb694077
5 changed files with 90 additions and 46 deletions

View File

@@ -1,21 +1,18 @@
-- TODO This part is still one of the weakest and we don't have a better solution yet
require("TOC/Debug")
local function AddBodyLocationBefore(newLocation, moveToLocation)
local group = BodyLocations.getGroup("Human")
local list = getClassFieldVal(group, getClassField(group, 1))
group:getOrCreateLocation(newLocation)
local newItem = list:get(list:size()-1)
TOC_DEBUG.print("created new body location" .. newItem:getId())
list:remove(newItem) -- We can't use the Index, it works if we pass the item though!
local i = group:indexOf(moveToLocation)
list:add(i, newItem)
end
-- AddBodyLocationBefore("TOC_Arm_R", "Shoes")
-- AddBodyLocationBefore("TOC_Arm_L", "Shoes")
-- AddBodyLocationBefore("TOC_ArmProst_R", "TOC_Arm_R")
-- AddBodyLocationBefore("TOC_ArmProst_L", "TOC_Arm_L")
AddBodyLocationBefore("TOC_Arm_R", "Shoes")
AddBodyLocationBefore("TOC_Arm_L", "Shoes")
-- Locations must be declared in render-order.
-- Location IDs must match BodyLocation= and CanBeEquipped= values in items.txt.
local group = BodyLocations.getGroup("Human")
AddBodyLocationBefore("TOC_ArmProst_R", "Shoes")
AddBodyLocationBefore("TOC_ArmProst_L", "Shoes")
group:getOrCreateLocation("TOC_Arm_R")
group:getOrCreateLocation("TOC_ArmProst_R")
group:getOrCreateLocation("TOC_Arm_L")
group:getOrCreateLocation("TOC_ArmProst_L")

View File

@@ -1,6 +1,6 @@
---@alias partData { isCut : boolean?, isInfected : boolean?, isOperated : boolean?, isCicatrized : boolean?, isCauterized : boolean?, isVisible : boolean?, cicatrizationTime : number }
---@alias limbsTable {Hand_L : partData, ForeArm_L : partData, UpperArm_L : partData, Hand_R : partData, ForeArm_R : partData, UpperArm_R : partData }
---@alias prosthesisData {isEquipped : boolean, prostFactor : number }
---@alias prosthesisData {isProstEquipped : boolean, prostFactor : number }
---@alias prosthesesTable {top : prosthesisData, bottom : prosthesisData }
---@alias tocModData { limbs : limbsTable, prostheses : prosthesesTable, isIgnoredPartInfected : boolean, isAnyLimbCut : boolean }
---------------------------
@@ -39,7 +39,7 @@ StaticData.MOD_BODYLOCS_BASE_IND_STR = {
}
-- No "MAX" here.
StaticData.IGNORED_BODYLOCS_IND_BPT = {
StaticData.IGNORED_BODYLOCS_BPT = {
BodyPartType.Foot_L, BodyPartType.Foot_R, BodyPartType.Groin, BodyPartType.Head,
BodyPartType.LowerLeg_L, BodyPartType.LowerLeg_R, BodyPartType.Neck, BodyPartType.Torso_Lower,
BodyPartType.Torso_Upper, BodyPartType.UpperLeg_L, BodyPartType.UpperLeg_R
@@ -98,11 +98,22 @@ end
-----------------
--* Prostheses
StaticData.PROSTHESES_GROUPS = {
top = "top",
bottom = "bottom"
StaticData.PROSTHESE_GROUPS_BASE_IND_STR = {
Top = "Top",
Bottom = "Bottom"
}
StaticData.PROSTHESES_GROUPS_IND_STR = {}
StaticData.PROSTHESES_GROUPS_STR = {}
for side, _ in pairs(StaticData.SIDES_IND_STR) do
for group, _ in pairs(StaticData.PROSTHESE_GROUPS_BASE_IND_STR) do
local sidedGroup = group .. "_" .. side
StaticData.PROSTHESES_GROUPS_IND_STR[sidedGroup] = sidedGroup
table.insert(StaticData.PROSTHESES_GROUPS_STR, sidedGroup)
end
end
-----------------
--* Traits