Jump to content

[RE-REPORT] Only Merms can be traded with when they are asleep

  • Pending

Only merms will wake up to accept/refuse trades (I see attempts at code trying to do the same for other mobs and a dev comment suggesting that it should work like merms in birdcage.lua).

Steps to Reproduce

Please refer to this post for more details:

Previous report:


  • Like 3

User Feedback

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"
    return true

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 >: ) )

  • Thanks 2
  • GL Happy 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...