sorcery  Diff

Differences From Artifact [ea0569acf8]:

To Artifact [3ae145b117]:


    88     88   				end
    89     89   			end
    90     90   			checked[#checked+1] = pos
    91     91   			i = i + 1
    92     92   		until i > #stack
    93     93   		return nodes, positions
    94     94   	end;
           95  +
           96  +	forneighbor = function(pos, n, fn)
           97  +		for _,p in pairs(n) do
           98  +			local sum = vector.add(pos, p)
           99  +			fn(sum, minetest.get_node(sum))
          100  +		end
          101  +	end;
          102  +
          103  +	-- when items have already been removed; notify cannot be relied on
          104  +	-- to reach the entire network; this function accounts for the gap
          105  +	notifyneighbors = function(pos)
          106  +		sorcery.lib.node.forneighbor(pos, sorcery.ley.txofs, function(pos,node)
          107  +			if minetest.get_item_group(node.name,'sorcery_ley_device') ~= 0 then
          108  +				sorcery.ley.notify(sum)
          109  +			end
          110  +		end)
          111  +	end;
          112  +
          113  +	blockpos = function(pos)
          114  +		return {
          115  +			x = math.floor(pos.x / 16);
          116  +			y = math.floor(pos.y / 16);
          117  +			z = math.floor(pos.z / 16);
          118  +		}
          119  +	end;
          120  +
          121  +	preload = function(pos, user)
          122  +		minetest.load_area(pos)
          123  +		user:send_mapblock(sorcery.lib.node.blockpos(pos))
          124  +	end;
    95    125   }