Open Emojigit opened 7 months ago
Node timers might be even more efficient because Minetest doesn't need to scan the mapblock for trash_can
nodes.
Node timers might be even more efficient
Done in commit 3322a30
The change works.. but only partially.
It turns out the on_step
override also allowed the item to fall into the trash can for proper position detection. With this PR the items usually get teleported back to the last collision point when falling into the node - which is generally the top corner of the trash can.
@Emojigit Did you yet have a chance to have a look at the issue mentioned above? Thank you.
This PR optimizes the codes handling throwing items into wooden trash cans.
__builtin:item
entities will be checked on EACH global step, regardless of whether they are inside a trash can__builtin:item
if any.Under normal circumstances, the number of entities inside trash cans (even after counting non-items) would be less than the number of dropped items coexisting in the world (unless a group of fools decided to stand inside trash cans forever). Therefore, this mod optimizes the runtime load.
This PR is optimized in commit 3322a30 using node timers (set up when placing a trash can or loading an old one for the first time) instead of ABM (scanning all nodes every run).
This PR is tested and ready for review. Here is the footage of the testing:
https://github.com/minetest-mods/trash_can/assets/55009343/1897f274-daa5-43fb-b755-81cb840b1051