Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loss of items when using listring #2

Closed
Qwertymine opened this issue Sep 20, 2016 · 0 comments · Fixed by #4
Closed

Loss of items when using listring #2

Qwertymine opened this issue Sep 20, 2016 · 0 comments · Fixed by #4

Comments

@Qwertymine
Copy link
Contributor

Qwertymine commented Sep 20, 2016

When using the listring to move items from the output to the main inventory, items can be lost when you have a partial stack already in your inventory.
This is caused by how the engine handles the overflow of the stack in your inventory.

Quick example:
You are crafting 99 stone, and have a stack of 9 in your inventory already.

The engine will cause an on_take callback, and the moved stack will be reported as 99 stone - however, only 90 stone will be moved, and 9 will be left in the output slot.

Your mod then deducts 99 ingredients from the player to pay for the stack, and clears the output, losing 9 stone.

The engine then tries to cause another on_take callback, trying to move 9 of whatever item is still in the inventory slot the stone was in. Since this is empty the engine gives up.


You need to check that the sum of the moved stack and the items remaining in the output is < stack:get_max()

Qwertymine added a commit to Qwertymine/node_texture_modifier that referenced this issue Sep 21, 2016
Fixes cx384#3 and a partial fix for cx384#2
Qwertymine added a commit to Qwertymine/node_texture_modifier that referenced this issue Sep 21, 2016
Fixes cx384#2 and a partial fix for cx384#3
@cx384 cx384 closed this as completed in #4 Sep 23, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant