X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=bookshelf_particles.lua;fp=bookshelf_particles.lua;h=3920efa6cf50ab7e94a6c5efc794683e8d7fac64;hb=07268084b00a19979ebf3f36d134529bb964cd91;hp=0000000000000000000000000000000000000000;hpb=13ea31ce121d1bf002b355f5acd8cca4a1c52072;p=mcl_enchanting.git diff --git a/bookshelf_particles.lua b/bookshelf_particles.lua new file mode 100644 index 0000000..3920efa --- /dev/null +++ b/bookshelf_particles.lua @@ -0,0 +1,28 @@ +local bookshelf_positions = {{x = 1}, {x = -1}, {z = 1}, {z = -1}} + +for _, p in pairs(bookshelf_positions) do + for _, d in pairs({"x", "y", "z"}) do + p[d] = p[d] or 0 + end +end + +minetest.register_abm({ + name = "Enchanting table bookshelf particles", + interval = 0.1, + chance = 1, + nodenames = "mcl_books:bookshelf", + action = function(pos) + for _, relative_pos in pairs(bookshelf_positions) do + if minetest.get_node(vector.add(pos, vector.multiply(relative_pos, 2))).name == "mcl_enchanting:table" and minetest.get_node(vector.add(pos, relative_pos, 2)).name == "air" then + minetest.add_particle({ + pos = pos, + velocity = vector.subtract(relative_pos, vector.new(0, -2, 0)), + acceleration = {x = 0, y = -2, z = 0}, + expirationtime = 2, + size = 2, + texture = "mcl_enchanting_glyph_" .. math.random(18) .. ".png" + }) + end + end + end +})