Merchants don't restock when they should
ethan-sargent opened this issue ยท 2 comments
Sometimes when coming back to a merchant after a long time they still have not restocked.
This seems to be because the restock game time and restock day time are updated before the restock actually happens - then allowedToRestock() is called, which checks the new time and denies the restock.
This means you have to restock at a particular time so that the restock time moves, and then check back quickly before hasDayElapsed becomes true again.
Suggested fix: update the times in restock() at the point of restocking, rather than in shouldRestock(), and only reset the restock counter to 0 in shouldrestock.
That way the time is reset once the restock actually happens, blocking the next restock for half a day from the point of restock as intended.