Fixes: #3913#3915
~~You can reproduce the crash by placing a fish bucket on top snow above an unknown node.
I also noticed that the code always uses pointed_thing.above so I fixed that and also added a function to mcl_utils to figure out where a node should be placed (either above or below). Looks like the rest of the code could also use improvement but at least it does not crash now.~~
Cora fixed a bunch of related crashes in Mineclona so I am replacing my commit and cherry picking all her commits here.
https://codeberg.org/mineclonia/mineclonia/pulls/549
Here is the list of fixes from that PR:
- Crash when placing snow layer on unknown nodes
- Crash when snow layers on unknown nodes are flooded
- Crash when placing fishbucket on snow on top of unknown nodes
- Crash when placing chorus flower and stem on unknown
- Crash when placing mob spawners on unknown
- The fishbucket on place to actually replace buildable_to
Co-authored-by: cora <coradelamouche@gmx.ch>
Reviewed-on: MineClone2/MineClone2#3914
Reviewed-by: ancientmarinerdev <ancientmariner_dev@proton.me>
Co-authored-by: 𝕵𝖔𝖍𝖆𝖓𝖓𝖊𝖘 𝕱𝖗𝖎𝖙𝖟 <mrrar@noreply.git.minetest.land>
Co-committed-by: 𝕵𝖔𝖍𝖆𝖓𝖓𝖊𝖘 𝕱𝖗𝖎𝖙𝖟 <mrrar@noreply.git.minetest.land>
The excessive 128 blocks high check has been changed to now check only up to 30 blocks, since the tallest 2x2 jungle tree I seemed to get was only 29 blocks tall.
I also discovered that the search area wasn't wide enough, so sometimes the most outer leaves avoided the check. I also adjusted that.
Basically renaming anything related to leaves in the new function to something more broad such as foliage, so vines aren't indirectly considered leaves. An aesthetic change, basically.
Simply put, this commit changes some code so that leaves don't use `param2` to see if they rot or not, and will now use the biome colours.
This commit also makes it so vines do the same (use biome colours).
* The leaf decay ABM no longer scans all leaves nodes. Now only
"orphaned" leaves are decayed. These nodes are placed by callbacks
in tree trunk nodes upon their destruction.
* This commit also removes the tree trunk node caching system and an
abm throttling mechanism and its associated globalstep function.
* Check if node has a definition table before attempting to evaluate its
attributes.
* Define local variable to cache multiple accesses to `registered_nodes[]`
and improve readability.