123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- potions.utils.spawn_up = function(nodes, height, node, delay, nmax, cb)
-
- local h = 0
- local i = 1
-
- local function go()
- for n = 1,nmax do
-
- if i > #nodes then
- i = 1
- h = h + 1
- if h > height then
- if type(cb) == 'function' then
- minetest.after(0, cb)
- end
- return
- end
- end
-
-
- local p = nodes[i]
-
- minetest.set_node({x=p.x, y=p.y+h, z=p.z}, {name=node})
-
- i = i + 1
- end
-
- minetest.after(delay, go)
- end
-
- go()
-
- end
- potions.utils.spawn_up_fn = function(nodes, height, node, delay, nmax, fn, cb)
-
- local h = 0
- local i = 1
-
- local function go()
- for n = 1,nmax do
-
- if i > #nodes then
- i = 1
- h = h + 1
- if h > height then
- if type(cb) == 'function' then
- minetest.after(0, cb)
- end
- return
- end
- end
-
-
- local p = nodes[i]
-
- minetest.set_node({x=p.x, y=p.y+h, z=p.z}, {name=node})
- fn(p, node)
-
- i = i + 1
- end
-
- minetest.after(delay, go)
- end
-
- go()
-
- end
- potions.utils.spawn_set_fn = function(nodes, delay, nmax, fn, cb)
-
- local i = 1
-
- local function go()
- for n = 1,nmax do
-
- if i > #nodes then
- if type(cb) == 'function' then
- minetest.after(0, cb)
- end
- return
-
- end
-
-
- local pn = nodes[i]
-
- minetest.set_node(pn[1], pn[2])
- fn(pn[1], pn[2])
-
- i = i + 1
- end
-
- minetest.after(delay, go)
- end
-
- go()
-
- end
- potions.utils.spawn_set = function(nodes, delay, nmax, cb)
-
- local i = 1
-
- local function go()
- for n = 1,nmax do
-
- if i > #nodes then
- if type(cb) == 'function' then
- minetest.after(0, cb)
- end
- return
-
- end
-
-
- local pn = nodes[i]
-
- minetest.set_node(pn[1], pn[2])
-
- if pn[3] then
- local meta = minetest.get_meta(pn[1])
- local inv = meta:get_inventory()
-
- for k,v in pairs(pn[3]) do
- inv:set_list(k, v)
- end
- end
-
-
- i = i + 1
- end
-
- minetest.after(delay, go)
- end
-
- go()
-
- end
|