Jump to content

No code path in Trader:AcceptGift() for sleeping entities


Phizuol
  • Pending

The trader (trader.lua) component has no code path to Trader:onrefuse() or Trader:onaccept() within Trader:AcceptGift() for sleeping entities. This is because all paths are blocked by Trader:AbleToAccept() which returns false when their inst is sleeping.

The most visible impact for players is that birds in birdcages will not accept food at night. However, in the current version of single player Don't Starve you can still wake up sleeping birds by feeding them. The birdcage code to wake up the bird is the same for both games.

Several entities have code that appears intended to wake them up if they are asleep when they are given an item. Some have this code in the Trader:onrefuse() function while some have it in the Trader:onaccept() function. A few have it in both. There appears to be an exception for theft attempts. I first found this issue when working on a beefalo mod only to discover the code to wake up a beefalo was already there.

It looks like the function Trader:AbleToAccept() was added to the trader component in DST to trigger ACTIONFAIL strings. The implementation is a bit awkward as the function is called both before Trader:AcceptGift() and within it; but no path is provided to handle situations that cause a false result. In addition, paths that would otherwise have resulted in items being accepted will not have the opportunity to do so. The result is a functionality loss from DS to DST.

I apologize if this has already been reported as I know that this is an issue that has been around for a while and it seems to affect many entities. I uploaded a small mod called "Wake Up, Bird!" to Steam Workshop to demonstrate a simple workaround that allows the original Don't Starve code to execute. I hope that this demonstrates the problem directly, but I do not consider it a satisfying solution.

Thank you!


Steps to Reproduce

Attempt to feed a bird in a birdcage at night. As a bonus, attempt to do the same thing in single player Don't Starve.

  • Like 4



User Feedback




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