How unload instantly forceloaded blocks

User avatar
BrunoMine
Member
 
Posts: 1046
Joined: Thu Apr 25, 2013 17:29
Location: SP-Brasil
GitHub: BrunoMine

How unload instantly forceloaded blocks

by BrunoMine » Wed May 22, 2019 15:03

I have used the following methods in a mapblock:
Code: Select all
minetest.forceload_block(pos, true)
minetest.forceload_free_block(pos)

But I noticed that the entities are still active (even though I am very far away), however if I approach and then move away from this mapblock, it becomes inactive.
 

User avatar
BrunoMine
Member
 
Posts: 1046
Joined: Thu Apr 25, 2013 17:29
Location: SP-Brasil
GitHub: BrunoMine

Re: How unload instantly forceloaded blocks

by BrunoMine » Wed May 22, 2019 18:31

This was the only way I found of spawning a mob in an unloaded blocks.
But it is inefficient because it runs ABM and LBMs.
Code: Select all
-- Force spawn
local force_spawn = function(pos, mob_name)

   minetest.forceload_block(pos)
   
   minetest.after(3, minetest.add_entity, pos, mob_name)
   
   minetest.after(3, minetest.forceload_free_block, pos)
end
 


Return to Modding Discussion



Who is online

Users browsing this forum: Miniontoby and 1 guest