]> git.lizzy.rs Git - xdecor.git/commitdiff
Enchant Table : attract MC-like glyphes when bookshelves are around
authorkilbith <jeanpatrick.guerrero@gmail.com>
Sat, 2 Apr 2016 15:25:08 +0000 (17:25 +0200)
committerkilbith <jeanpatrick.guerrero@gmail.com>
Sat, 2 Apr 2016 15:35:02 +0000 (17:35 +0200)
15 files changed:
enchanting.lua
textures/xdecor_glyph1.png [new file with mode: 0644]
textures/xdecor_glyph10.png [new file with mode: 0644]
textures/xdecor_glyph11.png [new file with mode: 0644]
textures/xdecor_glyph12.png [new file with mode: 0644]
textures/xdecor_glyph13.png [new file with mode: 0644]
textures/xdecor_glyph14.png [new file with mode: 0644]
textures/xdecor_glyph2.png [new file with mode: 0644]
textures/xdecor_glyph3.png [new file with mode: 0644]
textures/xdecor_glyph4.png [new file with mode: 0644]
textures/xdecor_glyph5.png [new file with mode: 0644]
textures/xdecor_glyph6.png [new file with mode: 0644]
textures/xdecor_glyph7.png [new file with mode: 0644]
textures/xdecor_glyph8.png [new file with mode: 0644]
textures/xdecor_glyph9.png [new file with mode: 0644]

index b7d5b9792691257a888bb87bdae7e705bdf1948d..416a6f59e0b0e184cd96fec634d15b485ef60b56 100644 (file)
@@ -113,7 +113,7 @@ function enchanting.construct(pos)
 
        minetest.add_entity({x=pos.x, y=pos.y+0.85, z=pos.z}, "xdecor:book_open")
        local timer = minetest.get_node_timer(pos)
-       timer:start(15.0)
+       timer:start(5.0)
 end
 
 function enchanting.destruct(pos)
@@ -132,6 +132,27 @@ function enchanting.timer(pos)
        if num == 0 then
                minetest.add_entity({x=pos.x, y=pos.y+0.85, z=pos.z}, "xdecor:book_open")
        end
+
+       local minp = {x=pos.x-2, y=pos.y, z=pos.z-2}
+       local maxp = {x=pos.x+2, y=pos.y+1, z=pos.z+2}
+       local bookshelves = minetest.find_nodes_in_area(minp, maxp, "default:bookshelf")
+       if #bookshelves == 0 then return true end
+
+       local bookshelf_pos = bookshelves[math.random(1, #bookshelves)]
+       local x = pos.x - bookshelf_pos.x
+       local y = bookshelf_pos.y - pos.y
+       local z = pos.z - bookshelf_pos.z
+
+       if tostring(x..z):find(2) then
+               minetest.add_particle({
+                       pos = bookshelf_pos,
+                       velocity = {x=x, y=1.7-y, z=z},
+                       acceleration = {x=-0.6, y=-1.5, z=0},
+                       expirationtime = 1,
+                       size = 2,
+                       texture = "xdecor_glyph"..math.random(1,14)..".png"
+               })
+       end
        return true
 end
 
diff --git a/textures/xdecor_glyph1.png b/textures/xdecor_glyph1.png
new file mode 100644 (file)
index 0000000..da77892
Binary files /dev/null and b/textures/xdecor_glyph1.png differ
diff --git a/textures/xdecor_glyph10.png b/textures/xdecor_glyph10.png
new file mode 100644 (file)
index 0000000..27c7c8d
Binary files /dev/null and b/textures/xdecor_glyph10.png differ
diff --git a/textures/xdecor_glyph11.png b/textures/xdecor_glyph11.png
new file mode 100644 (file)
index 0000000..76493c9
Binary files /dev/null and b/textures/xdecor_glyph11.png differ
diff --git a/textures/xdecor_glyph12.png b/textures/xdecor_glyph12.png
new file mode 100644 (file)
index 0000000..72f18fb
Binary files /dev/null and b/textures/xdecor_glyph12.png differ
diff --git a/textures/xdecor_glyph13.png b/textures/xdecor_glyph13.png
new file mode 100644 (file)
index 0000000..70ca494
Binary files /dev/null and b/textures/xdecor_glyph13.png differ
diff --git a/textures/xdecor_glyph14.png b/textures/xdecor_glyph14.png
new file mode 100644 (file)
index 0000000..6862387
Binary files /dev/null and b/textures/xdecor_glyph14.png differ
diff --git a/textures/xdecor_glyph2.png b/textures/xdecor_glyph2.png
new file mode 100644 (file)
index 0000000..a6da2d1
Binary files /dev/null and b/textures/xdecor_glyph2.png differ
diff --git a/textures/xdecor_glyph3.png b/textures/xdecor_glyph3.png
new file mode 100644 (file)
index 0000000..456e030
Binary files /dev/null and b/textures/xdecor_glyph3.png differ
diff --git a/textures/xdecor_glyph4.png b/textures/xdecor_glyph4.png
new file mode 100644 (file)
index 0000000..e93f238
Binary files /dev/null and b/textures/xdecor_glyph4.png differ
diff --git a/textures/xdecor_glyph5.png b/textures/xdecor_glyph5.png
new file mode 100644 (file)
index 0000000..c79537f
Binary files /dev/null and b/textures/xdecor_glyph5.png differ
diff --git a/textures/xdecor_glyph6.png b/textures/xdecor_glyph6.png
new file mode 100644 (file)
index 0000000..f735354
Binary files /dev/null and b/textures/xdecor_glyph6.png differ
diff --git a/textures/xdecor_glyph7.png b/textures/xdecor_glyph7.png
new file mode 100644 (file)
index 0000000..3f91a32
Binary files /dev/null and b/textures/xdecor_glyph7.png differ
diff --git a/textures/xdecor_glyph8.png b/textures/xdecor_glyph8.png
new file mode 100644 (file)
index 0000000..6c65994
Binary files /dev/null and b/textures/xdecor_glyph8.png differ
diff --git a/textures/xdecor_glyph9.png b/textures/xdecor_glyph9.png
new file mode 100644 (file)
index 0000000..4b3e366
Binary files /dev/null and b/textures/xdecor_glyph9.png differ