How unload instantly forceloaded blocks

Post Reply
User avatar
BrunoMine
Member
Posts: 1073
Joined: Thu Apr 25, 2013 17:29
GitHub: BrunoMine
Location: SP-Brasil
Contact:

How unload instantly forceloaded blocks

by BrunoMine » Post

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: 1073
Joined: Thu Apr 25, 2013 17:29
GitHub: BrunoMine
Location: SP-Brasil
Contact:

Re: How unload instantly forceloaded blocks

by BrunoMine » Post

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

Post Reply

Who is online

Users browsing this forum: GreenXenith and 2 guests