BodyLocations should be FINALLY fine
This commit is contained in:
@@ -6,9 +6,11 @@
|
|||||||
<m_Static>false</m_Static>
|
<m_Static>false</m_Static>
|
||||||
<m_AllowRandomHue>false</m_AllowRandomHue>
|
<m_AllowRandomHue>false</m_AllowRandomHue>
|
||||||
<m_AllowRandomTint>false</m_AllowRandomTint>
|
<m_AllowRandomTint>false</m_AllowRandomTint>
|
||||||
|
|
||||||
<m_Masks>3</m_Masks>
|
<m_Masks>3</m_Masks>
|
||||||
<m_Masks>4</m_Masks>
|
<m_Masks>4</m_Masks>
|
||||||
<m_MasksFolder>none</m_MasksFolder>
|
|
||||||
|
|
||||||
|
|
||||||
<!-- HUMAN -->
|
<!-- HUMAN -->
|
||||||
<textureChoices>Amputations\Human\Forearm\skin01_b</textureChoices>
|
<textureChoices>Amputations\Human\Forearm\skin01_b</textureChoices>
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
<m_Static>false</m_Static>
|
<m_Static>false</m_Static>
|
||||||
<m_AllowRandomHue>false</m_AllowRandomHue>
|
<m_AllowRandomHue>false</m_AllowRandomHue>
|
||||||
<m_AllowRandomTint>false</m_AllowRandomTint>
|
<m_AllowRandomTint>false</m_AllowRandomTint>
|
||||||
|
|
||||||
<m_Masks>5</m_Masks>
|
<m_Masks>5</m_Masks>
|
||||||
<m_Masks>6</m_Masks>
|
<m_Masks>6</m_Masks>
|
||||||
|
|
||||||
|
|||||||
@@ -44,6 +44,10 @@ function ItemsController.Player.RemoveClothingItem(playerObj, clothingItem)
|
|||||||
|
|
||||||
playerObj:getInventory():Remove(clothingItem) -- Can be a InventoryItem too.. I guess? todo check it
|
playerObj:getInventory():Remove(clothingItem) -- Can be a InventoryItem too.. I guess? todo check it
|
||||||
TOC_DEBUG.print("found and deleted" .. tostring(clothingItem))
|
TOC_DEBUG.print("found and deleted" .. tostring(clothingItem))
|
||||||
|
|
||||||
|
-- Reset model
|
||||||
|
playerObj:resetModelNextFrame()
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
|
|||||||
@@ -1,17 +1,18 @@
|
|||||||
-- TODO This part is still one of the weakest and we don't have a better solution yet
|
|
||||||
require("TOC/Debug")
|
require("TOC/Debug")
|
||||||
require("NPCs/BodyLocations")
|
require("NPCs/BodyLocations")
|
||||||
|
|
||||||
local BodyLocationsAPI = {}
|
local BodyLocationsAPI = {}
|
||||||
local function customGetVal(obj, int) return getClassFieldVal(obj, getClassField(obj, int)) end
|
local function customGetVal(obj, int) return getClassFieldVal(obj, getClassField(obj, int)) end
|
||||||
local group = BodyLocations.getGroup("Human")
|
local group = BodyLocations.getGroup("Human")
|
||||||
|
|
||||||
|
---@type ArrayList
|
||||||
local list = customGetVal(group, 1)
|
local list = customGetVal(group, 1)
|
||||||
|
|
||||||
---@param toRelocateOrCreate string
|
---@param toRelocateOrCreate string
|
||||||
---@param locationElement string
|
---@param locationElement string
|
||||||
---@param afterBoolean boolean
|
---@param afterBoolean boolean
|
||||||
---@return BodyLocation
|
---@return BodyLocation
|
||||||
function BodyLocationsAPI:moveOrCreateBeforeOrAfter(toRelocateOrCreate, locationElement, afterBoolean)
|
function BodyLocationsAPI.MoveOrCreateBeforeOrAfter(toRelocateOrCreate, locationElement, afterBoolean)
|
||||||
-- Check type of arg 2 == string - if not error out.
|
-- Check type of arg 2 == string - if not error out.
|
||||||
if type(locationElement) ~= "string" then error("Argument 2 is not of type string. Please re-check!", 2) end
|
if type(locationElement) ~= "string" then error("Argument 2 is not of type string. Please re-check!", 2) end
|
||||||
local itemToMoveTo = group:getLocation(locationElement) -- get location to move to
|
local itemToMoveTo = group:getLocation(locationElement) -- get location to move to
|
||||||
@@ -23,74 +24,14 @@ function BodyLocationsAPI:moveOrCreateBeforeOrAfter(toRelocateOrCreate, location
|
|||||||
local index = group:indexOf(locationElement) -- get current index after removal of the location to move to
|
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
|
if afterBoolean then index = index + 1 end -- if we want it after it, we increase the index to move to by one
|
||||||
list:add(index, curItem) -- we add the item again
|
list:add(index, curItem) -- we add the item again
|
||||||
|
|
||||||
|
|
||||||
return curItem
|
return curItem
|
||||||
else -- we did not find the location to move to, so we throw an error.
|
else -- we did not find the location to move to, so we throw an error.
|
||||||
error("Could not find the BodyLocation [",locationElement,"] - please check the passed arguments!", 2)
|
error("Could not find the BodyLocation [".. tostring(locationElement) .."] - please check the passed arguments!", 2)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
---@param toRelocateOrCreate string
|
|
||||||
---@param locationElement string
|
|
||||||
---@return BodyLocation
|
|
||||||
function BodyLocationsAPI.moveOrCreateBefore(toRelocateOrCreate, locationElement) -- for simpler and clearer usage
|
|
||||||
return BodyLocationsAPI.moveOrCreateBeforeOrAfter(toRelocateOrCreate, locationElement, false)
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
---@param toRelocateOrCreate string
|
|
||||||
---@param locationElement string
|
|
||||||
---@return BodyLocation
|
|
||||||
function BodyLocationsAPI.moveOrCreateAfter(toRelocateOrCreate, locationElement) -- for simpler and clearer usage
|
|
||||||
return BodyLocationsAPI.moveOrCreateBeforeOrAfter(toRelocateOrCreate, locationElement, true)
|
|
||||||
end
|
|
||||||
|
|
||||||
---@param loc1 string
|
|
||||||
---@param alias string
|
|
||||||
---@return BodyLocation
|
|
||||||
function BodyLocationsAPI.removeAlias(loc1, alias) -- will remove 2nd arg (alias) from location 1
|
|
||||||
local item = group:getLocation(loc1)
|
|
||||||
if item ~= nil and type(alias) == "string" then
|
|
||||||
local aliases = customGetVal(item, 2)
|
|
||||||
aliases:remove(alias)
|
|
||||||
end
|
|
||||||
return item
|
|
||||||
end
|
|
||||||
|
|
||||||
---@param loc1 string
|
|
||||||
---@param loc2 string
|
|
||||||
---@return BodyLocation
|
|
||||||
function BodyLocationsAPI.unsetExclusive(loc1, loc2) -- will remove exclusive from each other
|
|
||||||
local item1 = group:getLocation(loc1)
|
|
||||||
local item2 = group:getLocation(loc2)
|
|
||||||
if item1 ~= nil and item2 ~= nil then
|
|
||||||
local exclusives1 = customGetVal(item1, 3)
|
|
||||||
exclusives1:remove(loc2)
|
|
||||||
local exclusives2 = customGetVal(item2, 3)
|
|
||||||
exclusives2:remove(loc1)
|
|
||||||
end
|
|
||||||
return item1
|
|
||||||
end
|
|
||||||
|
|
||||||
---@param loc1 string
|
|
||||||
---@param loc2 string
|
|
||||||
---@return BodyLocation
|
|
||||||
function BodyLocationsAPI.unhideModel(loc1, loc2) -- remove loc2 from loc1's hidemodel list
|
|
||||||
local item1 = group:getLocation(loc1)
|
|
||||||
local item2 = group:getLocation(loc2)
|
|
||||||
if item1 ~= nil and item2 ~= nil then
|
|
||||||
local hidemodels = customGetVal(item1, 4)
|
|
||||||
hidemodels:remove(loc2)
|
|
||||||
end
|
|
||||||
return item1
|
|
||||||
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")
|
|
||||||
|
|
||||||
-- Locations must be declared in render-order.
|
|
||||||
-- Location IDs must match BodyLocation= and CanBeEquipped= values in items.txt.
|
|
||||||
function TestBodyLocations()
|
function TestBodyLocations()
|
||||||
local group = BodyLocations.getGroup("Human")
|
local group = BodyLocations.getGroup("Human")
|
||||||
local x = group:getAllLocations()
|
local x = group:getAllLocations()
|
||||||
@@ -105,12 +46,9 @@ function TestBodyLocations()
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local locationArm = BodyLocationsAPI.MoveOrCreateBeforeOrAfter("TOC_Arm", "FullTop", true)
|
||||||
|
locationArm:setMultiItem(true)
|
||||||
|
|
||||||
|
|
||||||
-- TODO Breaks if both arms are cut with one prost!!!
|
local locationArmProst = BodyLocationsAPI.MoveOrCreateBeforeOrAfter("TOC_ArmProst", "TOC_Arm", true)
|
||||||
-- TODO Breaks even if you have both amputations in general. We need a way to fix this piece of shit before realising
|
locationArmProst:setMultiItem(true)
|
||||||
group:getOrCreateLocation("TOC_Arm_R")
|
|
||||||
group:getOrCreateLocation("TOC_Arm_L")
|
|
||||||
|
|
||||||
group:getOrCreateLocation("TOC_ArmProst_R")
|
|
||||||
group:getOrCreateLocation("TOC_ArmProst_L")
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ module TOC
|
|||||||
DisplayCategory = Amputation,
|
DisplayCategory = Amputation,
|
||||||
|
|
||||||
ClothingItem = Amputation_ForeArm_R,
|
ClothingItem = Amputation_ForeArm_R,
|
||||||
BodyLocation = TOC_Arm_R,
|
BodyLocation = TOC_Arm,
|
||||||
|
|
||||||
Weight = 0,
|
Weight = 0,
|
||||||
CombatSpeedModifier = 0.8,
|
CombatSpeedModifier = 0.8,
|
||||||
@@ -65,7 +65,7 @@ module TOC
|
|||||||
DisplayCategory = Amputation,
|
DisplayCategory = Amputation,
|
||||||
|
|
||||||
ClothingItem = Amputation_Hand_L,
|
ClothingItem = Amputation_Hand_L,
|
||||||
BodyLocation = TOC_Arm_L,
|
BodyLocation = TOC_Arm,
|
||||||
|
|
||||||
Weight = 0,
|
Weight = 0,
|
||||||
CombatSpeedModifier = 0.9,
|
CombatSpeedModifier = 0.9,
|
||||||
@@ -84,7 +84,7 @@ module TOC
|
|||||||
DisplayCategory = Amputation,
|
DisplayCategory = Amputation,
|
||||||
|
|
||||||
ClothingItem = Amputation_ForeArm_L,
|
ClothingItem = Amputation_ForeArm_L,
|
||||||
BodyLocation = TOC_Arm_L,
|
BodyLocation = TOC_Arm,
|
||||||
|
|
||||||
Weight = 0,
|
Weight = 0,
|
||||||
CombatSpeedModifier = 0.8,
|
CombatSpeedModifier = 0.8,
|
||||||
@@ -103,7 +103,7 @@ module TOC
|
|||||||
DisplayCategory = Amputation,
|
DisplayCategory = Amputation,
|
||||||
|
|
||||||
ClothingItem = Amputation_UpperArm_L,
|
ClothingItem = Amputation_UpperArm_L,
|
||||||
BodyLocation = TOC_Arm_L,
|
BodyLocation = TOC_Arm,
|
||||||
|
|
||||||
Weight = 0,
|
Weight = 0,
|
||||||
CombatSpeedModifier = 0.7,
|
CombatSpeedModifier = 0.7,
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ module TOC
|
|||||||
ClothingItemExtra = Prost_HookArm_R,
|
ClothingItemExtra = Prost_HookArm_R,
|
||||||
ClothingItemExtraOption = InstallProstRight,
|
ClothingItemExtraOption = InstallProstRight,
|
||||||
clothingExtraSubmenu = InstallProstLeft,
|
clothingExtraSubmenu = InstallProstLeft,
|
||||||
BodyLocation = TOC_ArmProst_L,
|
BodyLocation = TOC_ArmProst,
|
||||||
Weight = 1.5,
|
Weight = 1.5,
|
||||||
CombatSpeedModifier = 1.05,
|
CombatSpeedModifier = 1.05,
|
||||||
BloodLocation = UpperArms;UpperBody,
|
BloodLocation = UpperArms;UpperBody,
|
||||||
@@ -38,7 +38,7 @@ module TOC
|
|||||||
ClothingItemExtra = Prost_HookArm_L,
|
ClothingItemExtra = Prost_HookArm_L,
|
||||||
ClothingItemExtraOption = InstallProstLeft,
|
ClothingItemExtraOption = InstallProstLeft,
|
||||||
clothingExtraSubmenu = InstallProstRight,
|
clothingExtraSubmenu = InstallProstRight,
|
||||||
BodyLocation = TOC_ArmProst_R,
|
BodyLocation = TOC_ArmProst,
|
||||||
Weight = 1.5,
|
Weight = 1.5,
|
||||||
CombatSpeedModifier = 1.05,
|
CombatSpeedModifier = 1.05,
|
||||||
BloodLocation = UpperArms;UpperBody,
|
BloodLocation = UpperArms;UpperBody,
|
||||||
@@ -60,7 +60,7 @@ module TOC
|
|||||||
ClothingItemExtra = Prost_NormalArm_R,
|
ClothingItemExtra = Prost_NormalArm_R,
|
||||||
ClothingItemExtraOption = InstallProstRight,
|
ClothingItemExtraOption = InstallProstRight,
|
||||||
clothingExtraSubmenu = InstallProstLeft,
|
clothingExtraSubmenu = InstallProstLeft,
|
||||||
BodyLocation = TOC_ArmProst_L,
|
BodyLocation = TOC_ArmProst,
|
||||||
Weight = 2,
|
Weight = 2,
|
||||||
CombatSpeedModifier = 1.1,
|
CombatSpeedModifier = 1.1,
|
||||||
BloodLocation = UpperArms;UpperBody,
|
BloodLocation = UpperArms;UpperBody,
|
||||||
@@ -81,7 +81,7 @@ module TOC
|
|||||||
ClothingItemExtra = Prost_NormalArm_L,
|
ClothingItemExtra = Prost_NormalArm_L,
|
||||||
ClothingItemExtraOption = InstallProstLeft,
|
ClothingItemExtraOption = InstallProstLeft,
|
||||||
clothingExtraSubmenu = InstallProstRight,
|
clothingExtraSubmenu = InstallProstRight,
|
||||||
BodyLocation = TOC_ArmProst_R,
|
BodyLocation = TOC_ArmProst,
|
||||||
Weight = 2,
|
Weight = 2,
|
||||||
CombatSpeedModifier = 1.1,
|
CombatSpeedModifier = 1.1,
|
||||||
BloodLocation = UpperArms;UpperBody,
|
BloodLocation = UpperArms;UpperBody,
|
||||||
|
|||||||
Reference in New Issue
Block a user