Fix unequip prosthesis for b42

This commit is contained in:
ZioPao
2025-03-31 22:46:12 +02:00
parent 671bf133e3
commit f93c0503f8
3 changed files with 27 additions and 19 deletions

View File

@@ -1,5 +1,7 @@
local ProsthesisHandler = require("TOC/Handlers/ProsthesisHandler") -- declared in common local ProsthesisHandler = require("TOC/Handlers/ProsthesisHandler") -- declared in common
local OverridenMethodsArchive = require("TOC/OverridenMethodsArchive") local OverridenMethodsArchive = require("TOC/OverridenMethodsArchive")
local CommonMethods = require("TOC/CommonMethods")
local CachedDataHandler = require("TOC/Handlers/CachedDataHandler")
-- FIX in B42 for some reason unequipping prosthesis doesn't work. Still not sure why -- FIX in B42 for some reason unequipping prosthesis doesn't work. Still not sure why
@@ -23,10 +25,19 @@ end
local og_ISUnequipAction_complete = ISUnequipAction.complete local og_ISUnequipAction_complete = ISUnequipAction.complete
function ISUnequipAction:complete() function ISUnequipAction:complete()
TOC_DEBUG.print("ISUnequipAction:complete") local isProst = ProsthesisHandler.SearchAndSetupProsthesis(self.item, false)
TOC_DEBUG.print(self.item:getFullType()) local group
self.character:removeWornItem(self.item) if isProst then
group = BodyLocations.getGroup("Human")
group:setMultiItem("TOC_ArmProst", false)
end
og_ISUnequipAction_complete(self) og_ISUnequipAction_complete(self)
if isProst then
group:setMultiItem("TOC_ArmProst", true)
end
-- TODO RUN WORKAROUND FOR MULTI ITEM HERE!!!!
end end

View File

@@ -177,7 +177,6 @@ function ISUnequipAction:perform()
-- This could break if amputated limbs aren't cached for some reason -- This could break if amputated limbs aren't cached for some reason
triggerEvent("OnProsthesisUnequipped", hal) triggerEvent("OnProsthesisUnequipped", hal)
end end
end end
end end
end end

View File

@@ -10,10 +10,21 @@ local WoundCleaningInteractionHandler = require("TOC/UI/Interactions/WoundCleani
local isReady = false local isReady = false
local xMod, yMod
if luautils.stringStarts(StaticData.GAME_VERSION, "41") then
xMod = 0
yMod = 0
else
xMod = 5
yMod = 9
end
function SetHealthPanelTOC() function SetHealthPanelTOC()
-- depending on compatibility -- depending on compatibility
isReady = true isReady = true
end end
@@ -101,19 +112,6 @@ function ISHealthPanel:tryDrawAmputation(highestAmputations, side, username)
local sexPl = self.character:isFemale() and "Female" or "Male" local sexPl = self.character:isFemale() and "Female" or "Male"
texture = StaticData.HEALTH_PANEL_TEXTURES[sexPl][limbName] texture = StaticData.HEALTH_PANEL_TEXTURES[sexPl][limbName]
end end
local xMod, yMod
if luautils.stringStarts(StaticData.GAME_VERSION, "41") then
xMod = 0
yMod = 0
else
xMod = 5
yMod = 9
end
-- B42, for some reason the positioning of the texture changed. Realigned it manually with those fixed values -- B42, for some reason the positioning of the texture changed. Realigned it manually with those fixed values
self:drawTexture(texture, self.healthPanel.x - xMod, self.healthPanel.y - yMod, 1, redColor, 0, 0) self:drawTexture(texture, self.healthPanel.x - xMod, self.healthPanel.y - yMod, 1, redColor, 0, 0)
end end
@@ -121,7 +119,7 @@ function ISHealthPanel:tryDrawProsthesis(highestAmputations, side, username)
local dc = DataController.GetInstance(username) -- TODO CACHE PROSTHESIS!!! Don't use DC here local dc = DataController.GetInstance(username) -- TODO CACHE PROSTHESIS!!! Don't use DC here
local limbName = highestAmputations[side] local limbName = highestAmputations[side]
if limbName and dc:getIsProstEquipped(limbName) then if limbName and dc:getIsProstEquipped(limbName) then
self:drawTexture(StaticData.HEALTH_PANEL_TEXTURES.ProstArm[side], self.healthPanel.x, self.healthPanel.y, 1, 1, 1, 1) self:drawTexture(StaticData.HEALTH_PANEL_TEXTURES.ProstArm[side], self.healthPanel.x - xMod, self.healthPanel.y - yMod, 1, 1, 1, 1)
end end
end end