Enchant Table : attract MC-like glyphes when bookshelves are around

This commit is contained in:
kilbith 2016-04-02 17:25:08 +02:00
parent 06c3a6f4cd
commit 1fb9850e58
15 changed files with 22 additions and 1 deletions

View 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

BIN
textures/xdecor_glyph1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 108 B

BIN
textures/xdecor_glyph10.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 B

BIN
textures/xdecor_glyph11.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 B

BIN
textures/xdecor_glyph12.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 B

BIN
textures/xdecor_glyph13.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 B

BIN
textures/xdecor_glyph14.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 B

BIN
textures/xdecor_glyph2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 B

BIN
textures/xdecor_glyph3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 B

BIN
textures/xdecor_glyph4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 105 B

BIN
textures/xdecor_glyph5.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 106 B

BIN
textures/xdecor_glyph6.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 B

BIN
textures/xdecor_glyph7.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 B

BIN
textures/xdecor_glyph8.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 B

BIN
textures/xdecor_glyph9.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 102 B