Fixes to extra equip and recipes

This commit is contained in:
ZioPao
2023-12-22 23:04:36 -05:00
parent 97b51e1bcf
commit 2606f664bc
6 changed files with 38 additions and 76 deletions

View File

@@ -88,6 +88,8 @@ end
local og_ISWearClothing_isValid = ISWearClothing.isValid
function ISWearClothing:isValid()
local isEquippable = og_ISWearClothing_isValid(self)
-- TODO Do we actually need this?
local isProst = ProsthesisHandler.CheckIfProst(self.item)
if not isProst then return isEquippable end
@@ -111,27 +113,29 @@ local og_ISClothingExtraAction_isValid = ISClothingExtraAction.isValid
---@diagnostic disable-next-line: duplicate-set-field
function ISClothingExtraAction:isValid()
local isEquippable = og_ISClothingExtraAction_isValid(self)
local isProst = ProsthesisHandler.CheckIfProst(self.itemExtra)
--the item that we gets is the OG one, so if we're coming from the left one and wanna switch to the right one we're still gonna get the Left bodylocation
local testItem = InventoryItemFactory.CreateItem(self.extra)
local isProst = ProsthesisHandler.CheckIfProst(testItem)
-- Early exit if it's not a prostheesis
if not isProst then return isEquippable end
--the item that we gets is the OG one, so if we're coming from the left one and wanna switch to the right one we're still gonna get the Left bodylocation
local testItem = InventoryItemFactory.CreateItem(self.extra)
local bodyLocation = testItem:getBodyLocation()
if isEquippable and string.contains(bodyLocation, bodyLocArmProst) then
if isEquippable and isProst then
local bodyLocation = testItem:getBodyLocation()
isEquippable = ProsthesisHandler.CheckIfEquippable(bodyLocation)
-- Just to let the player know
if not isEquippable then
-- TODO if its in here then it's gonna run at least 2 times
getPlayer():Say(getText("UI_Say_CantEquip"))
end
end
return isEquippable
end
local og_ISClothingExtraAction_stop = ISClothingExtraAction.stop
function ISClothingExtraAction:stop()
og_ISClothingExtraAction_stop(self)
if ProsthesisHandler.CheckIfProst(self.item) then
getPlayer():Say(getText("UI_Say_CantEquip"))
end
end
local og_ISClothingExtraAction_perform = ISClothingExtraAction.perform
function ISClothingExtraAction:perform()

View File

@@ -0,0 +1,4 @@
Recipes_EN = {
Recipe_Craft_Prosthetic_Arm = "Craft Prosthetic Arm",
Recipe_Craft_Prosthetic_Hook = "Craft Prosthetic Hook",
}