BuckarooBanzay / epic

epic -- Enhanced Programmer for Ingame Control
Other
6 stars 2 forks source link

Unstash inventory does not seem to work #42

Closed oversword closed 2 years ago

oversword commented 2 years ago

Using minetest 5.4.1

On a local game, using the unstash block does not seem to restore the inventory saved by a stash block

With a basic setup, a stash block, and unstash block, and a function block pointing into each - when the inventory is stashed by executing the stash block it is not restored when executing the unstash block.

I did a little logging to try and figure out why this was happening, it seems that the ctx.data variable is empty when we would expect it to have the stashed data available at ctx.data.stashed_items

Stashing seems to work, it executes fine and logging it out shows that the list at ctx.data.stashed_items is being added to, it seems to me that the context is not persisting through multiple calls properly.

This also happens when the local game is hosted as a server, not just singleplayer mode.

oversword commented 2 years ago

Do you maybe have to be in a started game for this to work? I'm new with this mod, just learning how it works for testing the logging PR I did https://github.com/damocles-minetest/epic/pull/41

If that's the case then stash shouldn't work either until a game is active

BuckarooBanzay commented 2 years ago

it seems to me that the context is not persisting through multiple calls properly.

Yes, thats correct, that did previously only work within a single (epic) execution. Now it persists into the player meta, works across restarts too :wink:

oversword commented 2 years ago

Now it persists into the player meta, works across restarts too

Oh fantastic! That's actually why I added the extra logging in the first place xD Someone stashed an inventory then the server crashed, making it irretrievable. Might as well keep the logging now, but nice to know this won't occur again