123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- notify = notify or {}
- local sub = vector.subtract
- local add = vector.add
- local find = minetest.find_nodes_in_area
- local getn = minetest.get_node
- local items = minetest.registered_items
- local after = minetest.after
- function notify.do_notify(pos)
-
- local minp = sub(pos, 1)
- local maxp = add(pos, 1)
- local nodes = find(minp, maxp, "group:want_notify")
- if nodes and #nodes > 0 then
-
- for i=1, #nodes do
- local p = nodes[i]
-
- if p.x ~= pos.x or p.y ~= pos.y or p.z ~= pos.z then
- local nn = getn(p).name
- local def = items[nn]
- if def and def.on_notify then
-
-
- def.on_notify(p, pos)
- end
- end
- end
- end
- end
- local do_notify = notify.do_notify
- function notify.notify_adjacent(pos)
- after(0, do_notify, {x=pos.x, y=pos.y, z=pos.z})
- end
|