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()
|
||||
-- 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.
|
||||
local isProst = ProsthesisHandler.SearchAndSetupProsthesis(self.item, false)
|
||||
local group
|
||||
if isProst then
|
||||
group = BodyLocations.getGroup("Human")
|
||||
group:setMultiItem("TOC_ArmProst", false)
|
||||
end
|
||||
-- local isProst = ProsthesisHandler.SearchAndSetupProsthesis(self.item, false)
|
||||
-- local group
|
||||
-- if isProst then
|
||||
-- group = BodyLocations.getGroup("Human")
|
||||
-- group:setMultiItem("TOC_ArmProst", false)
|
||||
-- end
|
||||
og_ISUnequipAction_complete(self)
|
||||
|
||||
if isProst then
|
||||
group:setMultiItem("TOC_ArmProst", true)
|
||||
end
|
||||
-- if isProst then
|
||||
-- group:setMultiItem("TOC_ArmProst", true)
|
||||
-- end
|
||||
|
||||
end
|
||||
@@ -78,13 +78,16 @@ end
|
||||
---Deletes all the old amputation items, used for resets
|
||||
---@param playerObj IsoPlayer
|
||||
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
|
||||
local group = BodyLocations.getGroup("Human")
|
||||
group:setMultiItem("TOC_Arm", false)
|
||||
group:setMultiItem("TOC_ArmProst", false)
|
||||
-- local group = BodyLocations.getGroup("Human")
|
||||
-- group:setMultiItem("TOC_Arm", false)
|
||||
-- group:setMultiItem("TOC_ArmProst", false)
|
||||
|
||||
for i = 1, #StaticData.LIMBS_STR do
|
||||
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 clothItem = playerObj:getInventory():FindAndReturn(clothItemName)
|
||||
---@cast clothItem InventoryItem
|
||||
@@ -93,8 +96,8 @@ function ItemsController.Player.DeleteAllOldAmputationItems(playerObj)
|
||||
-- Reset model just in case
|
||||
playerObj:resetModel()
|
||||
|
||||
group:setMultiItem("TOC_Arm", true)
|
||||
group:setMultiItem("TOC_ArmProst", true)
|
||||
-- group:setMultiItem("TOC_Arm", true)
|
||||
-- group:setMultiItem("TOC_ArmProst", true)
|
||||
end
|
||||
|
||||
---Spawns and equips the correct amputation item to the player.
|
||||
|
||||
@@ -64,18 +64,18 @@ end
|
||||
---@param obj any self
|
||||
---@param wrappedFunc function
|
||||
function TourniquetController.WrapClothingAction(obj, wrappedFunc)
|
||||
local isTourniquet = TourniquetController.IsItemTourniquet(obj.item:getFullType())
|
||||
local group
|
||||
if isTourniquet then
|
||||
group = BodyLocations.getGroup("Human")
|
||||
group:setMultiItem(TourniquetController.bodyLoc, false)
|
||||
end
|
||||
-- local isTourniquet = TourniquetController.IsItemTourniquet(obj.item:getFullType())
|
||||
-- local group
|
||||
-- if isTourniquet then
|
||||
-- group = BodyLocations.getGroup("Human")
|
||||
-- group:setMultiItem(TourniquetController.bodyLoc, false)
|
||||
-- end
|
||||
|
||||
local ogValue = wrappedFunc(obj)
|
||||
|
||||
if isTourniquet then
|
||||
group:setMultiItem(TourniquetController.bodyLoc, true)
|
||||
end
|
||||
-- if isTourniquet then
|
||||
-- group:setMultiItem(TourniquetController.bodyLoc, true)
|
||||
-- end
|
||||
|
||||
return ogValue -- Needed for isValid
|
||||
end
|
||||
|
||||
@@ -167,15 +167,15 @@ function ISUnequipAction:perform()
|
||||
]]
|
||||
|
||||
local isProst = ProsthesisHandler.SearchAndSetupProsthesis(self.item, false)
|
||||
local group
|
||||
if isProst then
|
||||
group = BodyLocations.getGroup("Human")
|
||||
group:setMultiItem("TOC_ArmProst", false)
|
||||
end
|
||||
-- local group
|
||||
-- if isProst then
|
||||
-- group = BodyLocations.getGroup("Human")
|
||||
-- group:setMultiItem("TOC_ArmProst", false)
|
||||
-- end
|
||||
og_ISUnequipAction_perform(self)
|
||||
|
||||
if isProst then
|
||||
group:setMultiItem("TOC_ArmProst", true)
|
||||
-- group:setMultiItem("TOC_ArmProst", true)
|
||||
|
||||
-- we need to fetch the limbname associated to the prosthesis
|
||||
local side = CommonMethods.GetSide(self.item:getFullType())
|
||||
|
||||
@@ -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")
|
||||
@@ -11,7 +11,7 @@ module TOC
|
||||
DisplayCategory = Amputation,
|
||||
|
||||
ClothingItem = Amputation_Hand_R,
|
||||
BodyLocation = TOC_Arm,
|
||||
BodyLocation = TOC_Arm_R,
|
||||
|
||||
Weight = 0,
|
||||
CombatSpeedModifier = 0.9,
|
||||
@@ -29,7 +29,7 @@ module TOC
|
||||
DisplayCategory = Amputation,
|
||||
|
||||
ClothingItem = Amputation_ForeArm_R,
|
||||
BodyLocation = TOC_Arm,
|
||||
BodyLocation = TOC_Arm_R,
|
||||
|
||||
Weight = 0,
|
||||
CombatSpeedModifier = 0.8,
|
||||
@@ -46,7 +46,7 @@ module TOC
|
||||
DisplayCategory = Amputation,
|
||||
|
||||
ClothingItem = Amputation_UpperArm_R,
|
||||
BodyLocation = TOC_Arm,
|
||||
BodyLocation = TOC_Arm_R,
|
||||
BloodLocation = UpperArms;UpperBody,
|
||||
Weight = 0,
|
||||
CombatSpeedModifier = 0.7,
|
||||
@@ -62,7 +62,7 @@ module TOC
|
||||
DisplayCategory = Amputation,
|
||||
|
||||
ClothingItem = Amputation_Hand_L,
|
||||
BodyLocation = TOC_Arm,
|
||||
BodyLocation = TOC_Arm_L,
|
||||
|
||||
Weight = 0,
|
||||
CombatSpeedModifier = 0.9,
|
||||
@@ -80,7 +80,7 @@ module TOC
|
||||
DisplayCategory = Amputation,
|
||||
|
||||
ClothingItem = Amputation_ForeArm_L,
|
||||
BodyLocation = TOC_Arm,
|
||||
BodyLocation = TOC_Arm_L,
|
||||
|
||||
Weight = 0,
|
||||
CombatSpeedModifier = 0.8,
|
||||
@@ -98,7 +98,7 @@ module TOC
|
||||
DisplayCategory = Amputation,
|
||||
|
||||
ClothingItem = Amputation_UpperArm_L,
|
||||
BodyLocation = TOC_Arm,
|
||||
BodyLocation = TOC_Arm_L,
|
||||
|
||||
Weight = 0,
|
||||
CombatSpeedModifier = 0.7,
|
||||
|
||||
@@ -16,7 +16,7 @@ module TOC
|
||||
ClothingItemExtra = Prost_HookArm_R,
|
||||
ClothingItemExtraOption = InstallProstRight,
|
||||
clothingExtraSubmenu = InstallProstLeft,
|
||||
BodyLocation = TOC_ArmProst,
|
||||
BodyLocation = TOC_ArmProst_L,
|
||||
Weight = 1.5,
|
||||
CombatSpeedModifier = 1.05,
|
||||
BloodLocation = UpperArms;UpperBody,
|
||||
@@ -38,7 +38,7 @@ module TOC
|
||||
ClothingItemExtra = Prost_HookArm_L,
|
||||
ClothingItemExtraOption = InstallProstLeft,
|
||||
clothingExtraSubmenu = InstallProstRight,
|
||||
BodyLocation = TOC_ArmProst,
|
||||
BodyLocation = TOC_ArmProst_R,
|
||||
Weight = 1.5,
|
||||
CombatSpeedModifier = 1.05,
|
||||
BloodLocation = UpperArms;UpperBody,
|
||||
@@ -60,7 +60,7 @@ module TOC
|
||||
ClothingItemExtra = Prost_NormalArm_R,
|
||||
ClothingItemExtraOption = InstallProstRight,
|
||||
clothingExtraSubmenu = InstallProstLeft,
|
||||
BodyLocation = TOC_ArmProst,
|
||||
BodyLocation = TOC_ArmProst_L,
|
||||
Weight = 2,
|
||||
CombatSpeedModifier = 1.1,
|
||||
BloodLocation = UpperArms;UpperBody,
|
||||
@@ -82,7 +82,7 @@ module TOC
|
||||
ClothingItemExtra = Prost_NormalArm_L,
|
||||
ClothingItemExtraOption = InstallProstLeft,
|
||||
clothingExtraSubmenu = InstallProstRight,
|
||||
BodyLocation = TOC_ArmProst,
|
||||
BodyLocation = TOC_ArmProst_R,
|
||||
Weight = 2,
|
||||
CombatSpeedModifier = 1.1,
|
||||
BloodLocation = UpperArms;UpperBody,
|
||||
|
||||
@@ -15,7 +15,7 @@ module TOC
|
||||
ClothingItemExtra = Surg_Arm_Tourniquet_R,
|
||||
ClothingItemExtraOption = PutTourniquetArmRight,
|
||||
clothingExtraSubmenu = PutTourniquetArmLeft,
|
||||
BodyLocation = TOC_ArmAccessory,
|
||||
BodyLocation = TOC_ArmAccessory_L,
|
||||
BloodLocation = UpperArms;UpperBody,
|
||||
|
||||
Weight = 0.25,
|
||||
@@ -35,7 +35,7 @@ module TOC
|
||||
ClothingItemExtra = Surg_Arm_Tourniquet_L,
|
||||
ClothingItemExtraOption = PutTourniquetArmLeft,
|
||||
clothingExtraSubmenu = PutTourniquetArmRight,
|
||||
BodyLocation = TOC_ArmAccessory,
|
||||
BodyLocation = TOC_ArmAccessory_R,
|
||||
BloodLocation = UpperArms;UpperBody,
|
||||
|
||||
Weight = 0.25,
|
||||
|
||||
Reference in New Issue
Block a user