Fixes
This commit is contained in:
@@ -35,14 +35,14 @@ end
|
|||||||
|
|
||||||
---Main function to delete a clothing item
|
---Main function to delete a clothing item
|
||||||
---@param playerObj IsoPlayer
|
---@param playerObj IsoPlayer
|
||||||
---@param clothingItem InventoryItem?
|
---@param clothingItem InventoryItem
|
||||||
---@return boolean
|
---@return boolean
|
||||||
---@private
|
---@private
|
||||||
function ItemsController.Player.RemoveClothingItem(playerObj, clothingItem)
|
function ItemsController.Player.RemoveClothingItem(playerObj, clothingItem)
|
||||||
if clothingItem and instanceof(clothingItem, "InventoryItem") then
|
if clothingItem and instanceof(clothingItem, "InventoryItem") then
|
||||||
playerObj:removeWornItem(clothingItem)
|
playerObj:removeWornItem(clothingItem)
|
||||||
|
|
||||||
playerObj:getInventory():Remove(clothingItem) -- Can be a InventoryItem too.. I guess? todo check it
|
playerObj:getInventory():Remove(clothingItem) -- Umbrella is wrong, can be an InventoryItem too
|
||||||
TOC_DEBUG.print("found and deleted" .. tostring(clothingItem))
|
TOC_DEBUG.print("found and deleted" .. tostring(clothingItem))
|
||||||
|
|
||||||
-- Reset model
|
-- Reset model
|
||||||
@@ -76,6 +76,12 @@ end
|
|||||||
---@param playerObj IsoPlayer
|
---@param playerObj IsoPlayer
|
||||||
function ItemsController.Player.DeleteAllOldAmputationItems(playerObj)
|
function ItemsController.Player.DeleteAllOldAmputationItems(playerObj)
|
||||||
|
|
||||||
|
-- This part is a workaround for a pretty shitty implementation on the java side. Check ProsthesisHandler for more infos
|
||||||
|
-- FIX This doesn't really help in this case.
|
||||||
|
local group = BodyLocations.getGroup("Human")
|
||||||
|
group:setMultiItem("TOC_Arm", 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]
|
||||||
local clothItemName = StaticData.AMPUTATION_CLOTHING_ITEM_BASE .. limbName
|
local clothItemName = StaticData.AMPUTATION_CLOTHING_ITEM_BASE .. limbName
|
||||||
@@ -84,6 +90,8 @@ function ItemsController.Player.DeleteAllOldAmputationItems(playerObj)
|
|||||||
ItemsController.Player.RemoveClothingItem(playerObj, clothItem)
|
ItemsController.Player.RemoveClothingItem(playerObj, clothItem)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
group:setMultiItem("TOC_Arm", true)
|
||||||
|
group:setMultiItem("TOC_ArmProst", true)
|
||||||
-- Reset model just in case
|
-- Reset model just in case
|
||||||
playerObj:resetModelNextFrame()
|
playerObj:resetModelNextFrame()
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -225,37 +225,4 @@ function ISInventoryPaneContextMenu.doEquipOption(context, playerObj, isWeapon,
|
|||||||
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
-- local og_ISInventoryPaneContextMenu_doClothingItemExtraMenu = ISInventoryPaneContextMenu.doClothingItemExtraMenu
|
|
||||||
|
|
||||||
-- ---@param context ISContextMenu
|
|
||||||
-- ---@param clothingItemExtra any
|
|
||||||
-- ---@param playerObj IsoPlayer
|
|
||||||
-- function ISInventoryPaneContextMenu.doClothingItemExtraMenu(context, clothingItemExtra, playerObj)
|
|
||||||
-- og_ISInventoryPaneContextMenu_doClothingItemExtraMenu(context, clothingItemExtra, playerObj)
|
|
||||||
|
|
||||||
-- -- local dc = DataController.GetInstance(playerObj:getUsername())
|
|
||||||
-- -- local text = getText("ContextMenu_InstallProstRight")
|
|
||||||
-- -- local rightOpt = context:getOptionFromName(text)
|
|
||||||
|
|
||||||
-- -- if rightOpt then
|
|
||||||
-- -- -- check if can be equipped
|
|
||||||
-- -- rightOpt.notAvailable = dc:getIsAnyLimbCut() and not dc:getIsCut("UpperArm_R")
|
|
||||||
-- -- end
|
|
||||||
|
|
||||||
|
|
||||||
-- -- text = getText("ContextMenu_InstallProstLeft")
|
|
||||||
-- -- local leftOpt = context:getOptionFromName(text)
|
|
||||||
|
|
||||||
-- -- if leftOpt then
|
|
||||||
-- -- leftOpt.notAvailable = dc:getIsAnyLimbCut() and not dc:getIsCut("UpperArm_L")
|
|
||||||
-- -- end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
-- -- Check if in context there are the options for the prosts
|
|
||||||
-- end
|
|
||||||
-- -- TODO IMPORTANT!!!! ADD LIMIT FOR UPPER ARM AND WHEN YOU DON'T HAVE AMPUTATIONS FOR PROSTHETITCSmhh
|
|
||||||
@@ -35,18 +35,18 @@ function ProsthesisHandler.GetGroup(item)
|
|||||||
end
|
end
|
||||||
|
|
||||||
---Check if a prosthesis is equippable. It depends whether the player has a cut limb or not on that specific side. There's an exception for Upper arm, obviously
|
---Check if a prosthesis is equippable. It depends whether the player has a cut limb or not on that specific side. There's an exception for Upper arm, obviously
|
||||||
---@param name string
|
---@param fullType string
|
||||||
---@return boolean
|
---@return boolean
|
||||||
function ProsthesisHandler.CheckIfEquippable(name)
|
function ProsthesisHandler.CheckIfEquippable(fullType)
|
||||||
TOC_DEBUG.print("Current item is a prosthesis")
|
TOC_DEBUG.print("Current item is a prosthesis")
|
||||||
local side = CommonMethods.GetSide(name)
|
local side = CommonMethods.GetSide(fullType)
|
||||||
TOC_DEBUG.print("Checking side: " .. tostring(side))
|
TOC_DEBUG.print("Checking side: " .. tostring(side))
|
||||||
|
|
||||||
local highestAmputatedLimbs = CachedDataHandler.GetHighestAmputatedLimbs(getPlayer():getUsername())
|
local highestAmputatedLimbs = CachedDataHandler.GetHighestAmputatedLimbs(getPlayer():getUsername())
|
||||||
|
|
||||||
if highestAmputatedLimbs then
|
if highestAmputatedLimbs then
|
||||||
local hal = highestAmputatedLimbs[side]
|
local hal = highestAmputatedLimbs[side]
|
||||||
if not string.contains(hal, "UpperArm") then
|
if hal and not string.contains(hal, "UpperArm") then
|
||||||
TOC_DEBUG.print("Found acceptable limb to use prosthesis => " .. tostring(hal))
|
TOC_DEBUG.print("Found acceptable limb to use prosthesis => " .. tostring(hal))
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@@ -81,9 +81,9 @@ local function HandleProsthesisValidation(item, isEquippable)
|
|||||||
local isProst = ProsthesisHandler.CheckIfProst(item)
|
local isProst = ProsthesisHandler.CheckIfProst(item)
|
||||||
if not isProst then return isEquippable end
|
if not isProst then return isEquippable end
|
||||||
|
|
||||||
local itemName = item:getName() -- use name for side
|
local fullType = item:getFullType() -- use fulltype for side
|
||||||
if isEquippable then
|
if isEquippable then
|
||||||
isEquippable = ProsthesisHandler.CheckIfEquippable(itemName)
|
isEquippable = ProsthesisHandler.CheckIfEquippable(fullType)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@@ -112,9 +112,24 @@ local og_ISClothingExtraAction_isValid = ISClothingExtraAction.isValid
|
|||||||
---@diagnostic disable-next-line: duplicate-set-field
|
---@diagnostic disable-next-line: duplicate-set-field
|
||||||
function ISClothingExtraAction:isValid()
|
function ISClothingExtraAction:isValid()
|
||||||
local isEquippable = og_ISClothingExtraAction_isValid(self)
|
local isEquippable = og_ISClothingExtraAction_isValid(self)
|
||||||
return HandleProsthesisValidation(self.item, isEquippable)
|
-- self.extra is a string, not the item
|
||||||
|
local testItem = InventoryItemFactory.CreateItem(self.extra)
|
||||||
|
return HandleProsthesisValidation(testItem, isEquippable)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
--[[
|
||||||
|
Horrendous workaround
|
||||||
|
|
||||||
|
To unequp items, the java side uses WornItems.setItem, which has
|
||||||
|
a check for multiItem. Basically, if it's active, it won't actually remove the item,
|
||||||
|
fucking things up. So, to be 100% sure that we're removing the items, we're gonna
|
||||||
|
disable and re-enable the multi-item bool for the Unequip Action.
|
||||||
|
]]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
local og_ISClothingExtraAction_perform = ISClothingExtraAction.perform
|
local og_ISClothingExtraAction_perform = ISClothingExtraAction.perform
|
||||||
function ISClothingExtraAction:perform()
|
function ISClothingExtraAction:perform()
|
||||||
og_ISClothingExtraAction_perform(self)
|
og_ISClothingExtraAction_perform(self)
|
||||||
@@ -123,8 +138,12 @@ end
|
|||||||
|
|
||||||
local og_ISUnequipAction_perform = ISUnequipAction.perform
|
local og_ISUnequipAction_perform = ISUnequipAction.perform
|
||||||
function ISUnequipAction:perform()
|
function ISUnequipAction:perform()
|
||||||
og_ISUnequipAction_perform(self)
|
|
||||||
ProsthesisHandler.SearchAndSetupProsthesis(self.item, false)
|
ProsthesisHandler.SearchAndSetupProsthesis(self.item, false)
|
||||||
|
local group = BodyLocations.getGroup("Human")
|
||||||
|
group:setMultiItem("TOC_ArmProst", false)
|
||||||
|
og_ISUnequipAction_perform(self)
|
||||||
|
group:setMultiItem("TOC_ArmProst", true)
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -46,9 +46,10 @@ function TestBodyLocations()
|
|||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local locationArm = BodyLocationsAPI.MoveOrCreateBeforeOrAfter("TOC_Arm", "FullTop", true)
|
-- TODO MultiItem causes a ton of issues... fucking hell
|
||||||
locationArm:setMultiItem(true)
|
|
||||||
|
|
||||||
|
BodyLocationsAPI.MoveOrCreateBeforeOrAfter("TOC_Arm", "FullTop", true)
|
||||||
|
group:setMultiItem("TOC_Arm", true)
|
||||||
|
|
||||||
local locationArmProst = BodyLocationsAPI.MoveOrCreateBeforeOrAfter("TOC_ArmProst", "TOC_Arm", true)
|
BodyLocationsAPI.MoveOrCreateBeforeOrAfter("TOC_ArmProst", "TOC_Arm", true)
|
||||||
locationArmProst:setMultiItem(true)
|
group:setMultiItem("TOC_ArmProst", true)
|
||||||
|
|||||||
Reference in New Issue
Block a user