Jump to content

Loot Stash Can't Unlock


Luis95R
  • Fixed

I have tried to open the Loot Stash with the correct key and it works fine, but when I turn on one of my mods that is server sided it says  "I can't do that." when I try to open it.

Here is an example of this happening to someone else. Are mods able to conflict with the Klaus Sack? and if so, what type of mods?

 

EDIT: I removed this part of code from the mod and the loot stash started working. So this is highly likely responsible for the Loot Stash not opening.

local Action = GLOBAL.Action
local ActionHandler = GLOBAL.ActionHandler
local ACTIONS = GLOBAL.ACTIONS

AddAction("CLOSE", "Close", function(act)
    local tar = act.target
    if tar and tar.components.wallgates and tar.components.wallgates:IsOpen() then
        tar.components.wallgates:CloseWall(tar)
        return true
    end
end)

AddStategraphActionHandler("wilson", ActionHandler(GLOBAL.ACTIONS.CLOSE, "give"))

AddStategraphActionHandler("wilson_client", ActionHandler(GLOBAL.ACTIONS.CLOSE, "give"))

AddAction("OPEN", "Open", function(act)
    local tar = act.target
    if tar and tar.components.wallgates and not tar.components.wallgates:IsOpen() then
        tar.components.wallgates:OpenWall(tar)
        return true
    end
end)

AddStategraphActionHandler("wilson", ActionHandler(GLOBAL.ACTIONS.OPEN, "give"))

AddStategraphActionHandler("wilson_client", ActionHandler(GLOBAL.ACTIONS.OPEN, "give"))

AddComponentAction("SCENE", "wallgates", function(inst, doer, actions, right)
    if inst and not inst:HasTag("broken") then
            if right and inst:HasTag("opened") then
                table.insert(actions, GLOBAL.ACTIONS.CLOSE)
            elseif right and not inst:HasTag("opened") then
                table.insert(actions, GLOBAL.ACTIONS.OPEN)
            end
    end
end)

AddAction("UNLOCK", "Unlock", function(act)
    local tar = act.target
    if tar and tar.components.lockedwallgates and not tar.components.lockedwallgates:IsOpen() then
        tar.components.lockedwallgates:OpenWall(tar)
        return true
    end
end)

AddStategraphActionHandler("wilson", ActionHandler(GLOBAL.ACTIONS.UNLOCK, "give"))

AddStategraphActionHandler("wilson_client", ActionHandler(GLOBAL.ACTIONS.UNLOCK, "give"))

AddAction("LOCK", "Lock", function(act)
    local tar = act.target
    if tar and tar.components.lockedwallgates and tar.components.lockedwallgates:IsOpen() then
        tar.components.lockedwallgates:CloseWall(tar)
        return true
    end
end)

AddStategraphActionHandler("wilson", ActionHandler(GLOBAL.ACTIONS.LOCK, "give"))

AddStategraphActionHandler("wilson_client", ActionHandler(GLOBAL.ACTIONS.LOCK, "give"))

AddComponentAction("SCENE", "lockedwallgates", function(inst, doer, actions, right)
    local tag = doer.userid
    if inst and inst:HasTag(tag) then
        if inst and not inst:HasTag("broken") then
            if right and not inst:HasTag("opened") then
                table.insert(actions, GLOBAL.ACTIONS.UNLOCK)
            elseif right and inst:HasTag("opened") then
                table.insert(actions, GLOBAL.ACTIONS.LOCK)
            end
        end
    end
end)
    
function HighlightPostInit(self)
    self.Highlight = function(self,r,g,b)
        self.highlit = true
        if self.inst:IsValid() and self.inst:HasTag("player") or GLOBAL.CanEntitySeeTarget(GLOBAL.ThePlayer, self.inst) then
            local m = .2
            if self.inst:HasTag("wallgate") or self.inst:HasTag("wallgateitem") then
                self.highlight_add_colour_red = 0.3
                self.highlight_add_colour_green = 0.3
                self.highlight_add_colour_blue = 0
            elseif self.inst:HasTag("lockedwallgate") or self.inst:HasTag("lockedwallgateitem") then
                self.highlight_add_colour_red = 0.0
                self.highlight_add_colour_green = 0.3
                self.highlight_add_colour_blue = 0.3
            else
                self.highlight_add_colour_red = r or m
                self.highlight_add_colour_green = g or m
                self.highlight_add_colour_blue = b or m
            end
        end
        self:ApplyColour()    
    end
end    
    
AddComponentPostInit("highlight", HighlightPostInit)

 


Steps to Reproduce
Use Deer Antler or Stag Antler with a server sided mod. It seems to only happen with some but not all server sided mods.



User Feedback


A developer has marked this issue as fixed. This means that the issue has been addressed in the current development build and will likely be in the next update.

Hi. Thank you for posting your mod's code, it showed me the cause of the issue right away. ACTIONS.UNLOCK is already being defined in our scripts but it was not actually used until we added the Loot Stash. I'll make a new action for the Loot Stash as I believe other mods may be running into the same issue. I'll also investigate changing AddAction and the related functions to prevent these issues from happening again, as well as better cross mod support (so if any other mods add an "OPEN" or "UNLOCK" action it will not conflict with yours")

  • Like 1

Share this comment


Link to comment
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
  • Create New...