terrarium-earth / Heracles

A tree style questing mod allowing creators to set completable quests for their users
MIT License
35 stars 19 forks source link

Improve GatherTask Reliability #84

Closed sisby-folk closed 1 year ago

sisby-folk commented 1 year ago

Closes #67

Tldr - only picking up items off the floor worked, they only worked for the full amount, and odysseus was putting out counts as strings, bricking the tasks. we'll PR to odysseus later on if that isn't fixed by the time we're done with heracles.

https://github.com/terrarium-earth/Heracles/assets/55819817/890ba3ef-4f67-4625-b5c0-9ba6dc70f288

picking up, partial picking up, inventory transfers, and /give now work.

Inventory transfers were fixed by passing the index of changed slots to an injected inventory interface via a slot mixin, then mixing into setChanged.

Partial picking up was fixed by just setting the value in storage regardless of whether the target is met.

/give was fixed by caching a copy of the stack at the start of add(), then using it at return. This means the stack is intact (it's cleared in many cases) and therefore can pass preliminary matching tests for tasks, but the inventory is in the correct post-add state.