From 02a06fa9cdef3a2f2e6527551298cf71721a641c Mon Sep 17 00:00:00 2001 From: jhaakma Date: Tue, 20 Aug 2024 00:40:47 +1200 Subject: [PATCH] Fix backpack container bug --- .../ashfall/activators/config/activatorConfig.lua | 1 + .../ashfall/integrations/carryableContainers.lua | 13 ++++++++++++- Data Files/MWSE/mods/mer/ashfall/interop.lua | 3 +++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Data Files/MWSE/mods/mer/ashfall/activators/config/activatorConfig.lua b/Data Files/MWSE/mods/mer/ashfall/activators/config/activatorConfig.lua index b9e1921a..b7efd308 100644 --- a/Data Files/MWSE/mods/mer/ashfall/activators/config/activatorConfig.lua +++ b/Data Files/MWSE/mods/mer/ashfall/activators/config/activatorConfig.lua @@ -92,6 +92,7 @@ this.list.waterDirty = Activator:new{ ids = {} } this.list.water = this.list.waterDirty + this.list.waterClean = Activator:new{ name = "Water (Clean)", type = this.types.waterSource, diff --git a/Data Files/MWSE/mods/mer/ashfall/integrations/carryableContainers.lua b/Data Files/MWSE/mods/mer/ashfall/integrations/carryableContainers.lua index 36d4f2bc..b6e7416e 100644 --- a/Data Files/MWSE/mods/mer/ashfall/integrations/carryableContainers.lua +++ b/Data Files/MWSE/mods/mer/ashfall/integrations/carryableContainers.lua @@ -16,6 +16,17 @@ local function doEquip(self) self:updateStats() end +local function replaceAndEquip(self) + if not self:isCopy() then + self:replaceInInventory() + timer.frame.delayOneFrame(function() + doEquip(self) + end) + else + doEquip(self) + end +end + ---@param self CarryableContainer local function doOpen(self) logger:debug("Opening backpack `%s`", self.item.id) @@ -29,7 +40,7 @@ local callbacks = { if CraftingFramework.Util.isQuickModifierDown() then doOpen(self) else - doEquip(self) + replaceAndEquip(self) end end, ---@param self CarryableContainer diff --git a/Data Files/MWSE/mods/mer/ashfall/interop.lua b/Data Files/MWSE/mods/mer/ashfall/interop.lua index 7d5fb349..22fc0178 100644 --- a/Data Files/MWSE/mods/mer/ashfall/interop.lua +++ b/Data Files/MWSE/mods/mer/ashfall/interop.lua @@ -513,6 +513,9 @@ end --- brewedOnly: boolean - (Default: true). If true, will only check for brewed tea ---@param e { id: string?, brewedOnly: boolean|nil } | nil function Interop.hasTea(e) + if type(e) == "string" then + e = { id = e } + end e = e or {} for _, stack in pairs(tes3.player.object.inventory) do if stack.variables then