diff --git a/init.lua b/init.lua index 0194b14..ab9c5a3 100644 --- a/init.lua +++ b/init.lua @@ -66,11 +66,6 @@ dofile(MP.."/death.lua") dofile(MP.."/travel/travel.lua") dofile(MP.."/teleport_back.lua") -if minetest.get_modpath("protector") then - -- protector customizations - dofile(MP.."/protector_forceload.lua") -end - if minetest.get_modpath("farming") and farming.mod == "redo" then -- farming customizations dofile(MP.."/farming.lua") diff --git a/protector_forceload.lua b/protector_forceload.lua deleted file mode 100644 index 067c55d..0000000 --- a/protector_forceload.lua +++ /dev/null @@ -1,53 +0,0 @@ - --- Related issue: --- https://github.com/pandorabox-io/pandorabox.io/issues/503 - --- loads a position from cache to ensure that the mapblock there is loaded -local function load_from_cache(pos) - minetest.get_voxel_manip(pos, pos) -end - -local old_can_dig = protector.can_dig -protector.can_dig = function(radius, pos, digger, onlyowner, infolevel) - - local distance = radius * 2 - - -- load mapblocks in a cross pattern - load_from_cache(vector.add(pos, {x=-distance, y=0, z=0})) - load_from_cache(vector.add(pos, {x=0, y=-distance, z=0})) - load_from_cache(vector.add(pos, {x=0, y=0, z=-distance})) - load_from_cache(vector.add(pos, {x=distance, y=0, z=0})) - load_from_cache(vector.add(pos, {x=0, y=distance, z=0})) - load_from_cache(vector.add(pos, {x=0, y=0, z=distance})) - - return old_can_dig(radius, pos, digger, onlyowner, infolevel) -end - - --- additionally do periodic forceloads from cache --- near players --- https://github.com/minetest/minetest/issues/9849 --- https://gitlab.com/h2mm/mapload_boost/-/blob/master/init.lua - -local reload_period = 1 -local time_left = reload_period + 10 - -minetest.register_globalstep(function(dtime) - time_left = time_left - dtime - if time_left < 0 then - time_left = reload_period - for _, player in ipairs(minetest.get_connected_players()) do - local pos = player:get_pos() - local distance = 16 - - -- load mapblocks forcefully - load_from_cache(pos) - load_from_cache(vector.add(pos, {x=-distance, y=0, z=0})) - load_from_cache(vector.add(pos, {x=0, y=-distance, z=0})) - load_from_cache(vector.add(pos, {x=0, y=0, z=-distance})) - load_from_cache(vector.add(pos, {x=distance, y=0, z=0})) - load_from_cache(vector.add(pos, {x=0, y=distance, z=0})) - load_from_cache(vector.add(pos, {x=0, y=0, z=distance})) - end - end -end)