Jump to content

Inconsistent Sleeping Trader Bug


lakhnish
  • Pending

Only merms will wake up to accept/refuse trades while other mobs refuse to wake up.

Previous report (which also leads to other reports):


Steps to Reproduce

  This comment from Hornet explains more:

On 8/1/2022 at 10:39 PM, Hornete said:

For any dev reading this, the reason it works specifically for Merms is because they set a specific 'SetAbleToAccept' fn while all the other listed mobs only set a 'SetAcceptTest' function.

Since self.abletoaccepttest is not nil for Merms, it never reaches the check for if the trader is sleeping.

function Trader:AbleToAccept(item, giver)
    local on_inventory = self.inst.components.inventoryitem ~= nil and self.inst.components.inventoryitem.owner ~= nil

    if not self.enabled or item == nil then
        return false
    elseif self.abletoaccepttest ~= nil then
        return self.abletoaccepttest(self.inst, item, giver)
    elseif self.inst.components.health ~= nil and self.inst.components.health:IsDead() then
        return false, "DEAD"
    elseif (self.inst.components.sleeper ~= nil and self.inst.components.sleeper:IsAsleep()) and not on_inventory then
        return false, "SLEEPING"
    elseif self.inst.sg ~= nil and self.inst.sg:HasStateTag("busy") and not on_inventory then
        return false, "BUSY"
    end
    return true
end

It's kind of confusing now, because it seems like mobs should wake up when a player tries to trade with them as mentioned in the OP and as suggested by some comments, but the trader component checks if the trader is sleeping. So which scenario is actually intentional? Who knows! (You do devs, get to fixing >: ) )

 




User Feedback


There are no comments to display.



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...