diff --git a/mods/ITEMS/REDSTONE/mcl_observers/init.lua b/mods/ITEMS/REDSTONE/mcl_observers/init.lua index 759e05996c..932f4f6431 100644 --- a/mods/ITEMS/REDSTONE/mcl_observers/init.lua +++ b/mods/ITEMS/REDSTONE/mcl_observers/init.lua @@ -284,6 +284,7 @@ if realtime then mcl_observers.set_node = minetest.set_node mcl_observers.swap_node = minetest.swap_node mcl_observers.remove_node = minetest.remove_node + mcl_observers.bulk_set_node = minetest.bulk_set_node minetest.add_node=function(pos,node) mcl_observers.add_node(pos,node) @@ -393,6 +394,35 @@ if realtime then mcl_observers.observer_activate({x=pos.x,y=pos.y+1,z=pos.z}) end end + minetest.bulk_set_node=function(lst, node) + mcl_observers.bulk_set_node(lst, node) + for _, pos in pairs(lst) do + local n=minetest.get_node({x=pos.x+1,y=pos.y,z=pos.z}) + if n and n.name and string.sub(n.name,1,24)=="mcl_observers:observer_o" and minetest.facedir_to_dir(n.param2).x==-1 then + mcl_observers.observer_activate({x=pos.x+1,y=pos.y,z=pos.z}) + end + n=minetest.get_node({x=pos.x-1,y=pos.y,z=pos.z}) + if n and n.name and string.sub(n.name,1,24)=="mcl_observers:observer_o" and minetest.facedir_to_dir(n.param2).x==1 then + mcl_observers.observer_activate({x=pos.x-1,y=pos.y,z=pos.z}) + end + n=minetest.get_node({x=pos.x,y=pos.y,z=pos.z+1}) + if n and n.name and string.sub(n.name,1,24)=="mcl_observers:observer_o" and minetest.facedir_to_dir(n.param2).z==-1 then + mcl_observers.observer_activate({x=pos.x,y=pos.y,z=pos.z+1}) + end + n=minetest.get_node({x=pos.x,y=pos.y,z=pos.z-1}) + if n and n.name and string.sub(n.name,1,24)=="mcl_observers:observer_o" and minetest.facedir_to_dir(n.param2).z==1 then + mcl_observers.observer_activate({x=pos.x,y=pos.y,z=pos.z-1}) + end + n=minetest.get_node({x=pos.x,y=pos.y-1,z=pos.z}) + if n and n.name and string.sub(n.name,1,24)=="mcl_observers:observer_u" then + mcl_observers.observer_activate({x=pos.x,y=pos.y-1,z=pos.z}) + end + n=minetest.get_node({x=pos.x,y=pos.y+1,z=pos.z}) + if n and n.name and string.sub(n.name,1,24)=="mcl_observers:observer_d" then + mcl_observers.observer_activate({x=pos.x,y=pos.y+1,z=pos.z}) + end + end + end else -- if realtime then ^^^ else: minetest.register_abm({ diff --git a/mods/PLAYER/mcl_spawn/init.lua b/mods/PLAYER/mcl_spawn/init.lua index 33bcce1e60..cb042426c1 100644 --- a/mods/PLAYER/mcl_spawn/init.lua +++ b/mods/PLAYER/mcl_spawn/init.lua @@ -372,11 +372,15 @@ function mcl_spawn.shadow_worker() minetest.after(respawn_search_interval, mcl_spawn.shadow_worker) end -minetest.after(respawn_search_initial_delay, mcl_spawn.shadow_worker) -minetest.register_on_shutdown(function() +minetest.after(respawn_search_initial_delay, function() + mcl_spawn.shadow_worker() + + minetest.register_on_shutdown(function() storage:set_int("mcl_spawn_success", success and 1 or 0) - storage:set_string("mcl_spawn_world_spawn_point", minetest.pos_to_string(wsp)) + if wsp and wsp.x then + storage:set_string("mcl_spawn_world_spawn_point", minetest.pos_to_string(wsp)) + end storage:set_int("mcl_spawn_searched", searched and 1 or 0) storage:set_int("mcl_spawn_check", check) storage:set_string("mcl_spawn_cp", minetest.pos_to_string(cp)) @@ -384,5 +388,5 @@ minetest.register_on_shutdown(function() storage:set_int("mcl_spawn_edge_dist", edge_dist) storage:set_int("mcl_spawn_dir_step", dir_step) storage:set_int("mcl_spawn_dir_ind", dir_ind) - end -) + end) +end)