I've written a few mods that I would like to have continue to perform actions in a region even after all players have left. Specifically, I was wanting to allow a digtron to be able to continue digging off into the wild black yonder without the player who set it in motion having to ride it, and I wanted to be able to place a block that would keep dynamic_liquid's abm running in the local area so that I wouldn't have to wait around for a large pool of liquid to finish draining away. It was a backburnered desire, though, until Rubenwardy posted the "forceload anchor" mod in the content database. Its brief description sounded like exactly what I wanted, though not quite in the form that I wanted, so I sat down and implemented my own version that's got an API and is designed to be safe to use on a server with an arbitrary number of players all placing forceload anchors down willy-nilly. Near as I can tell it functioned perfectly, but then when I actually tried using it to accomplish what I had created it for it didn't work at all. Digtron hit the usual "ignore" blocks when it tried running amuck and ABMs don't appear to run in forceloaded areas.
Then I added a bit of code to Digtron to call minetest.emerge_area whenever it ran into "ignore" blocks and that solved everything without any need for forceload. Digtron could run for kilometers without hesitation. I'm guessing that emerge_area will make ABMs run as well.
So my questions are:
- What does minetest.forceload_block actually do?
- How frequently should I call minetest.emerge_area on a region in order to keep its ABMs running, if this is indeed the correct approach in the first place?