fix: switched to multiple body locs to fix some old issues and prepare for better visuals overhaul
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -0,0 +1,2 @@
|
|||||||
|
dev_stuff/gen_amp_textures/.venv
|
||||||
|
dev_stuff/gen_amp_textures/output
|
||||||
@@ -25,16 +25,16 @@ local og_ISUnequipAction_complete = ISUnequipAction.complete
|
|||||||
function ISUnequipAction:complete()
|
function ISUnequipAction:complete()
|
||||||
-- Horrendous workaround. For B42, as of now, it will basically happen two times, once with :perform and once with :complete. Shouldn't
|
-- Horrendous workaround. For B42, as of now, it will basically happen two times, once with :perform and once with :complete. Shouldn't
|
||||||
-- matter for performance but it's really ugly.
|
-- matter for performance but it's really ugly.
|
||||||
local isProst = ProsthesisHandler.SearchAndSetupProsthesis(self.item, false)
|
-- local isProst = ProsthesisHandler.SearchAndSetupProsthesis(self.item, false)
|
||||||
local group
|
-- local group
|
||||||
if isProst then
|
-- if isProst then
|
||||||
group = BodyLocations.getGroup("Human")
|
-- group = BodyLocations.getGroup("Human")
|
||||||
group:setMultiItem("TOC_ArmProst", false)
|
-- group:setMultiItem("TOC_ArmProst", false)
|
||||||
end
|
-- end
|
||||||
og_ISUnequipAction_complete(self)
|
og_ISUnequipAction_complete(self)
|
||||||
|
|
||||||
if isProst then
|
-- if isProst then
|
||||||
group:setMultiItem("TOC_ArmProst", true)
|
-- group:setMultiItem("TOC_ArmProst", true)
|
||||||
end
|
-- end
|
||||||
|
|
||||||
end
|
end
|
||||||
@@ -78,13 +78,16 @@ end
|
|||||||
---Deletes all the old amputation items, used for resets
|
---Deletes all the old amputation items, used for resets
|
||||||
---@param playerObj IsoPlayer
|
---@param playerObj IsoPlayer
|
||||||
function ItemsController.Player.DeleteAllOldAmputationItems(playerObj)
|
function ItemsController.Player.DeleteAllOldAmputationItems(playerObj)
|
||||||
|
-- TODO Fix visual bug
|
||||||
-- This part is a workaround for a pretty shitty implementation on the java side. Check ProsthesisHandler for more infos
|
-- This part is a workaround for a pretty shitty implementation on the java side. Check ProsthesisHandler for more infos
|
||||||
local group = BodyLocations.getGroup("Human")
|
-- local group = BodyLocations.getGroup("Human")
|
||||||
group:setMultiItem("TOC_Arm", false)
|
-- group:setMultiItem("TOC_Arm", false)
|
||||||
group:setMultiItem("TOC_ArmProst", false)
|
-- group:setMultiItem("TOC_ArmProst", false)
|
||||||
|
|
||||||
for i = 1, #StaticData.LIMBS_STR do
|
for i = 1, #StaticData.LIMBS_STR do
|
||||||
local limbName = StaticData.LIMBS_STR[i]
|
local limbName = StaticData.LIMBS_STR[i]
|
||||||
|
|
||||||
|
-- TODO Won't work with dedicated clothingItems for multi amps
|
||||||
local clothItemName = StaticData.AMPUTATION_CLOTHING_ITEM_BASE .. limbName
|
local clothItemName = StaticData.AMPUTATION_CLOTHING_ITEM_BASE .. limbName
|
||||||
local clothItem = playerObj:getInventory():FindAndReturn(clothItemName)
|
local clothItem = playerObj:getInventory():FindAndReturn(clothItemName)
|
||||||
---@cast clothItem InventoryItem
|
---@cast clothItem InventoryItem
|
||||||
@@ -93,8 +96,8 @@ function ItemsController.Player.DeleteAllOldAmputationItems(playerObj)
|
|||||||
-- Reset model just in case
|
-- Reset model just in case
|
||||||
playerObj:resetModel()
|
playerObj:resetModel()
|
||||||
|
|
||||||
group:setMultiItem("TOC_Arm", true)
|
-- group:setMultiItem("TOC_Arm", true)
|
||||||
group:setMultiItem("TOC_ArmProst", true)
|
-- group:setMultiItem("TOC_ArmProst", true)
|
||||||
end
|
end
|
||||||
|
|
||||||
---Spawns and equips the correct amputation item to the player.
|
---Spawns and equips the correct amputation item to the player.
|
||||||
|
|||||||
@@ -64,18 +64,18 @@ end
|
|||||||
---@param obj any self
|
---@param obj any self
|
||||||
---@param wrappedFunc function
|
---@param wrappedFunc function
|
||||||
function TourniquetController.WrapClothingAction(obj, wrappedFunc)
|
function TourniquetController.WrapClothingAction(obj, wrappedFunc)
|
||||||
local isTourniquet = TourniquetController.IsItemTourniquet(obj.item:getFullType())
|
-- local isTourniquet = TourniquetController.IsItemTourniquet(obj.item:getFullType())
|
||||||
local group
|
-- local group
|
||||||
if isTourniquet then
|
-- if isTourniquet then
|
||||||
group = BodyLocations.getGroup("Human")
|
-- group = BodyLocations.getGroup("Human")
|
||||||
group:setMultiItem(TourniquetController.bodyLoc, false)
|
-- group:setMultiItem(TourniquetController.bodyLoc, false)
|
||||||
end
|
-- end
|
||||||
|
|
||||||
local ogValue = wrappedFunc(obj)
|
local ogValue = wrappedFunc(obj)
|
||||||
|
|
||||||
if isTourniquet then
|
-- if isTourniquet then
|
||||||
group:setMultiItem(TourniquetController.bodyLoc, true)
|
-- group:setMultiItem(TourniquetController.bodyLoc, true)
|
||||||
end
|
-- end
|
||||||
|
|
||||||
return ogValue -- Needed for isValid
|
return ogValue -- Needed for isValid
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -167,15 +167,15 @@ function ISUnequipAction:perform()
|
|||||||
]]
|
]]
|
||||||
|
|
||||||
local isProst = ProsthesisHandler.SearchAndSetupProsthesis(self.item, false)
|
local isProst = ProsthesisHandler.SearchAndSetupProsthesis(self.item, false)
|
||||||
local group
|
-- local group
|
||||||
if isProst then
|
-- if isProst then
|
||||||
group = BodyLocations.getGroup("Human")
|
-- group = BodyLocations.getGroup("Human")
|
||||||
group:setMultiItem("TOC_ArmProst", false)
|
-- group:setMultiItem("TOC_ArmProst", false)
|
||||||
end
|
-- end
|
||||||
og_ISUnequipAction_perform(self)
|
og_ISUnequipAction_perform(self)
|
||||||
|
|
||||||
if isProst then
|
if isProst then
|
||||||
group:setMultiItem("TOC_ArmProst", true)
|
-- group:setMultiItem("TOC_ArmProst", true)
|
||||||
|
|
||||||
-- we need to fetch the limbname associated to the prosthesis
|
-- we need to fetch the limbname associated to the prosthesis
|
||||||
local side = CommonMethods.GetSide(self.item:getFullType())
|
local side = CommonMethods.GetSide(self.item:getFullType())
|
||||||
|
|||||||
@@ -9,8 +9,19 @@ local group = BodyLocations.getGroup("Human")
|
|||||||
---@type ArrayList
|
---@type ArrayList
|
||||||
local list = customGetVal(group, 1)
|
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 toRelocateOrCreate string
|
||||||
---@param locationElement string
|
---@param locationElement string
|
||||||
---@param afterBoolean boolean
|
---@param afterBoolean boolean
|
||||||
@@ -23,14 +34,7 @@ function BodyLocationsAPI.MoveOrCreateBeforeOrAfter(toRelocateOrCreate, location
|
|||||||
-- Check type of arg 1 == string - if not, error out.
|
-- 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
|
if type(toRelocateOrCreate) ~= "string" then error("Argument 1 is not of type string. Please re-check!", 2) end
|
||||||
|
|
||||||
local curItem
|
local curItem = BodyLocationsAPI.New(toRelocateOrCreate)
|
||||||
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
|
|
||||||
list:remove(curItem) -- remove from the list
|
list:remove(curItem) -- remove from the list
|
||||||
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
|
||||||
@@ -43,6 +47,8 @@ function BodyLocationsAPI.MoveOrCreateBeforeOrAfter(toRelocateOrCreate, location
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- function TestBodyLocations()
|
-- function TestBodyLocations()
|
||||||
-- local group = BodyLocations.getGroup("Human")
|
-- local group = BodyLocations.getGroup("Human")
|
||||||
-- local x = group:getAllLocations()
|
-- local x = group:getAllLocations()
|
||||||
@@ -58,11 +64,17 @@ end
|
|||||||
|
|
||||||
-- MultiItem causes a ton of issues... fucking hell
|
-- MultiItem causes a ton of issues... fucking hell
|
||||||
|
|
||||||
BodyLocationsAPI.MoveOrCreateBeforeOrAfter("TOC_Arm", "FullTop", true)
|
-- local curItem = BodyLocation.new(group, "TOC_Arm_L")
|
||||||
group:setMultiItem("TOC_Arm", true)
|
-- group:getAllLocations():add(curItem)
|
||||||
|
|
||||||
BodyLocationsAPI.MoveOrCreateBeforeOrAfter("TOC_ArmProst", "TOC_Arm", true)
|
-- local curItem = BodyLocation.new(group, "TOC_Arm_R")
|
||||||
group:setMultiItem("TOC_ArmProst", true)
|
-- 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")
|
||||||
@@ -11,7 +11,7 @@ module TOC
|
|||||||
DisplayCategory = Amputation,
|
DisplayCategory = Amputation,
|
||||||
|
|
||||||
ClothingItem = Amputation_Hand_R,
|
ClothingItem = Amputation_Hand_R,
|
||||||
BodyLocation = TOC_Arm,
|
BodyLocation = TOC_Arm_R,
|
||||||
|
|
||||||
Weight = 0,
|
Weight = 0,
|
||||||
CombatSpeedModifier = 0.9,
|
CombatSpeedModifier = 0.9,
|
||||||
@@ -29,7 +29,7 @@ module TOC
|
|||||||
DisplayCategory = Amputation,
|
DisplayCategory = Amputation,
|
||||||
|
|
||||||
ClothingItem = Amputation_ForeArm_R,
|
ClothingItem = Amputation_ForeArm_R,
|
||||||
BodyLocation = TOC_Arm,
|
BodyLocation = TOC_Arm_R,
|
||||||
|
|
||||||
Weight = 0,
|
Weight = 0,
|
||||||
CombatSpeedModifier = 0.8,
|
CombatSpeedModifier = 0.8,
|
||||||
@@ -46,7 +46,7 @@ module TOC
|
|||||||
DisplayCategory = Amputation,
|
DisplayCategory = Amputation,
|
||||||
|
|
||||||
ClothingItem = Amputation_UpperArm_R,
|
ClothingItem = Amputation_UpperArm_R,
|
||||||
BodyLocation = TOC_Arm,
|
BodyLocation = TOC_Arm_R,
|
||||||
BloodLocation = UpperArms;UpperBody,
|
BloodLocation = UpperArms;UpperBody,
|
||||||
Weight = 0,
|
Weight = 0,
|
||||||
CombatSpeedModifier = 0.7,
|
CombatSpeedModifier = 0.7,
|
||||||
@@ -62,7 +62,7 @@ module TOC
|
|||||||
DisplayCategory = Amputation,
|
DisplayCategory = Amputation,
|
||||||
|
|
||||||
ClothingItem = Amputation_Hand_L,
|
ClothingItem = Amputation_Hand_L,
|
||||||
BodyLocation = TOC_Arm,
|
BodyLocation = TOC_Arm_L,
|
||||||
|
|
||||||
Weight = 0,
|
Weight = 0,
|
||||||
CombatSpeedModifier = 0.9,
|
CombatSpeedModifier = 0.9,
|
||||||
@@ -80,7 +80,7 @@ module TOC
|
|||||||
DisplayCategory = Amputation,
|
DisplayCategory = Amputation,
|
||||||
|
|
||||||
ClothingItem = Amputation_ForeArm_L,
|
ClothingItem = Amputation_ForeArm_L,
|
||||||
BodyLocation = TOC_Arm,
|
BodyLocation = TOC_Arm_L,
|
||||||
|
|
||||||
Weight = 0,
|
Weight = 0,
|
||||||
CombatSpeedModifier = 0.8,
|
CombatSpeedModifier = 0.8,
|
||||||
@@ -98,7 +98,7 @@ module TOC
|
|||||||
DisplayCategory = Amputation,
|
DisplayCategory = Amputation,
|
||||||
|
|
||||||
ClothingItem = Amputation_UpperArm_L,
|
ClothingItem = Amputation_UpperArm_L,
|
||||||
BodyLocation = TOC_Arm,
|
BodyLocation = TOC_Arm_L,
|
||||||
|
|
||||||
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,
|
BodyLocation = TOC_ArmProst_L,
|
||||||
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,
|
BodyLocation = TOC_ArmProst_R,
|
||||||
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,
|
BodyLocation = TOC_ArmProst_L,
|
||||||
Weight = 2,
|
Weight = 2,
|
||||||
CombatSpeedModifier = 1.1,
|
CombatSpeedModifier = 1.1,
|
||||||
BloodLocation = UpperArms;UpperBody,
|
BloodLocation = UpperArms;UpperBody,
|
||||||
@@ -82,7 +82,7 @@ module TOC
|
|||||||
ClothingItemExtra = Prost_NormalArm_L,
|
ClothingItemExtra = Prost_NormalArm_L,
|
||||||
ClothingItemExtraOption = InstallProstLeft,
|
ClothingItemExtraOption = InstallProstLeft,
|
||||||
clothingExtraSubmenu = InstallProstRight,
|
clothingExtraSubmenu = InstallProstRight,
|
||||||
BodyLocation = TOC_ArmProst,
|
BodyLocation = TOC_ArmProst_R,
|
||||||
Weight = 2,
|
Weight = 2,
|
||||||
CombatSpeedModifier = 1.1,
|
CombatSpeedModifier = 1.1,
|
||||||
BloodLocation = UpperArms;UpperBody,
|
BloodLocation = UpperArms;UpperBody,
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ module TOC
|
|||||||
ClothingItemExtra = Surg_Arm_Tourniquet_R,
|
ClothingItemExtra = Surg_Arm_Tourniquet_R,
|
||||||
ClothingItemExtraOption = PutTourniquetArmRight,
|
ClothingItemExtraOption = PutTourniquetArmRight,
|
||||||
clothingExtraSubmenu = PutTourniquetArmLeft,
|
clothingExtraSubmenu = PutTourniquetArmLeft,
|
||||||
BodyLocation = TOC_ArmAccessory,
|
BodyLocation = TOC_ArmAccessory_L,
|
||||||
BloodLocation = UpperArms;UpperBody,
|
BloodLocation = UpperArms;UpperBody,
|
||||||
|
|
||||||
Weight = 0.25,
|
Weight = 0.25,
|
||||||
@@ -35,7 +35,7 @@ module TOC
|
|||||||
ClothingItemExtra = Surg_Arm_Tourniquet_L,
|
ClothingItemExtra = Surg_Arm_Tourniquet_L,
|
||||||
ClothingItemExtraOption = PutTourniquetArmLeft,
|
ClothingItemExtraOption = PutTourniquetArmLeft,
|
||||||
clothingExtraSubmenu = PutTourniquetArmRight,
|
clothingExtraSubmenu = PutTourniquetArmRight,
|
||||||
BodyLocation = TOC_ArmAccessory,
|
BodyLocation = TOC_ArmAccessory_R,
|
||||||
BloodLocation = UpperArms;UpperBody,
|
BloodLocation = UpperArms;UpperBody,
|
||||||
|
|
||||||
Weight = 0.25,
|
Weight = 0.25,
|
||||||
|
|||||||
Reference in New Issue
Block a user