fix: switched to multiple body locs to fix some old issues and prepare for better visuals overhaul
This commit is contained in:
@@ -9,8 +9,19 @@ local group = BodyLocations.getGroup("Human")
|
||||
---@type ArrayList
|
||||
local list = customGetVal(group, 1)
|
||||
|
||||
-- TODO Not sure if this method actually works as intende with b42, but for our use case it's fine...
|
||||
---@param bodyLoc string
|
||||
function BodyLocationsAPI.New(bodyLoc)
|
||||
local curItem
|
||||
if StaticData.COMPAT_42 then
|
||||
curItem = BodyLocation.new(group, bodyLoc) -- create new item
|
||||
group:getAllLocations():add(curItem) -- add to the list
|
||||
else
|
||||
curItem = group:getOrCreateLocation(bodyLoc) -- get current item - or create
|
||||
end
|
||||
return curItem
|
||||
end
|
||||
|
||||
-- TODO Not sure if this method actually works as intende with b42, but for our use case it's fine...
|
||||
---@param toRelocateOrCreate string
|
||||
---@param locationElement string
|
||||
---@param afterBoolean boolean
|
||||
@@ -23,14 +34,7 @@ function BodyLocationsAPI.MoveOrCreateBeforeOrAfter(toRelocateOrCreate, location
|
||||
-- Check type of arg 1 == string - if not, error out.
|
||||
if type(toRelocateOrCreate) ~= "string" then error("Argument 1 is not of type string. Please re-check!", 2) end
|
||||
|
||||
local curItem
|
||||
if StaticData.COMPAT_42 then
|
||||
curItem = BodyLocation.new(group, toRelocateOrCreate) -- create new item
|
||||
group:getAllLocations():add(curItem) -- add to the list
|
||||
else
|
||||
curItem = group:getOrCreateLocation(toRelocateOrCreate) -- get current item - or create
|
||||
|
||||
end
|
||||
local curItem = BodyLocationsAPI.New(toRelocateOrCreate)
|
||||
list:remove(curItem) -- remove from the list
|
||||
local index = group:indexOf(locationElement) -- get current index after removal of the location to move to
|
||||
if afterBoolean then index = index + 1 end -- if we want it after it, we increase the index to move to by one
|
||||
@@ -43,6 +47,8 @@ function BodyLocationsAPI.MoveOrCreateBeforeOrAfter(toRelocateOrCreate, location
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
-- function TestBodyLocations()
|
||||
-- local group = BodyLocations.getGroup("Human")
|
||||
-- local x = group:getAllLocations()
|
||||
@@ -58,11 +64,17 @@ end
|
||||
|
||||
-- MultiItem causes a ton of issues... fucking hell
|
||||
|
||||
BodyLocationsAPI.MoveOrCreateBeforeOrAfter("TOC_Arm", "FullTop", true)
|
||||
group:setMultiItem("TOC_Arm", true)
|
||||
-- local curItem = BodyLocation.new(group, "TOC_Arm_L")
|
||||
-- group:getAllLocations():add(curItem)
|
||||
|
||||
BodyLocationsAPI.MoveOrCreateBeforeOrAfter("TOC_ArmProst", "TOC_Arm", true)
|
||||
group:setMultiItem("TOC_ArmProst", true)
|
||||
-- local curItem = BodyLocation.new(group, "TOC_Arm_R")
|
||||
-- group:getAllLocations():add(curItem)
|
||||
|
||||
BodyLocationsAPI.MoveOrCreateBeforeOrAfter("TOC_ArmAccessory", "TOC_ArmProst", true)
|
||||
group:setMultiItem("TOC_ArmAccessory", true)
|
||||
|
||||
BodyLocationsAPI.New("TOC_Arm_L")
|
||||
BodyLocationsAPI.New("TOC_Arm_R")
|
||||
BodyLocationsAPI.New("TOC_Arm_LR")
|
||||
BodyLocationsAPI.New("TOC_ArmProst_L")
|
||||
BodyLocationsAPI.New("TOC_ArmProst_R")
|
||||
BodyLocationsAPI.New("TOC_ArmAccessory_L")
|
||||
BodyLocationsAPI.New("TOC_ArmAccessory_R")
|
||||
Reference in New Issue
Block a user