Aaron Suen
f9e7fc9585
Rebuild AISM index after any AISM is registered
This fixes tool infusion/boosting not working after engine commit e7dd9737. Before, minetest.after(0, func) was running in FIFO order, but after it's in LIFO order. Unexpectedly, we were actually relying on the old behavior unknowingly, as the after(0) to build the AISM index was racing against the after(0) to register the AISMs for infusion/boosting. When they were in FIFO order, the AISM index was rebuilt last, so it included the infusion/boosting AISMs. We never really intended AISMs to be registered "long" after load time, but they were never intended not to work "immediately" after load time. Using after(0) rather than on_mods_loaded callbacks ensures that all engine item registration MUST be completed already. However, we don't want to get into an arms race of registering minetest.after(0.00001) to ensure the AISM index gets rebuilt after all after(0) registrations. So it's actually cleaner just to allow AISM registration at any time. Whenever an AISM is registered, rebuild the index on the next tick (it's deferred to debounce, since a bunch of AISMs could get registered in a batch but we only want to rebuild the index once if possible). This ensures that the AISM index is never out of date for a non-trivial amount of time, and thus AISMs should generally work reliably over time now, regardless of when they're registered.
======================================================================== \ /\ \ / \ /\ \ /\ |\ / / \ /\ |\ / | \ | / \ | \ / | / \ | \ / | \ | | | | | |__ | | | | / |__ \ \/ | | | | | \ / | | |/ | \ \ / | / \ \ / \ / |\ \ \ \/ |/ \ \/ \/ | \ \ ======================================================================== NodeCore - Minetest's top original voxel game about emergent mechanics and exploration ------------------------------------------------------------------------ A surreal dream-world where everything is possible but nothing is easy. Peaceful and Zen. Brutally obstinate. Prepare to unlearn everything you thought you knew about voxel sandbox games. Visit the Minetest ContentDB Listing (below) for more details. ------------------------------------------------------------------------ (C) by Aaron Suen <warr1024@gmail.com> (and other contributors) MIT License (http://www.opensource.org/licenses/MIT) See included LICENSE file for full details and credits Minetest ContentDB Listing: https://content.minetest.net/packages/Warr1024/nodecore/ GitLab: https://gitlab.com/sztest/nodecore Chat Networks (all bridged): Discord: https://discord.gg/NNYeF6f Matrix: #+nodecore:matrix.org IRC: #nodecore on irc.libera.chat Donate: https://liberapay.com/NodeCore Semi-Unofficial Wiki: https://nodecore.mine.nu/ Minetest Forum Topic: https://forum.minetest.net/viewtopic.php?t=24857 ------------------------------------------------------------------------ ========================================================================
Languages
Lua
98.7%
JavaScript
1.3%