Import changes from xdecor
33
init.lua
@ -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")
|
minetest.add_entity({x=pos.x, y=pos.y+0.85, z=pos.z}, "xdecor:book_open")
|
||||||
local timer = minetest.get_node_timer(pos)
|
local timer = minetest.get_node_timer(pos)
|
||||||
timer:start(15.0)
|
timer:start(5.0)
|
||||||
end
|
end
|
||||||
|
|
||||||
function enchanting.destruct(pos)
|
function enchanting.destruct(pos)
|
||||||
@ -132,6 +132,27 @@ function enchanting.timer(pos)
|
|||||||
if num == 0 then
|
if num == 0 then
|
||||||
minetest.add_entity({x=pos.x, y=pos.y+0.85, z=pos.z}, "xdecor:book_open")
|
minetest.add_entity({x=pos.x, y=pos.y+0.85, z=pos.z}, "xdecor:book_open")
|
||||||
end
|
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 = "glyph"..math.random(1,14)..".png"
|
||||||
|
})
|
||||||
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -161,7 +182,15 @@ minetest.register_entity(":xdecor:book_open", {
|
|||||||
visual_size = {x=0.75, y=0.75},
|
visual_size = {x=0.75, y=0.75},
|
||||||
collisionbox = {0},
|
collisionbox = {0},
|
||||||
physical = false,
|
physical = false,
|
||||||
textures = {"book_open.png"}
|
textures = {"book_open.png"},
|
||||||
|
on_activate = function(self)
|
||||||
|
local pos = self.object:getpos()
|
||||||
|
local pos_under = {x=pos.x, y=pos.y-1, z=pos.z}
|
||||||
|
|
||||||
|
if minetest.get_node(pos_under).name ~= "xdecor:enchantment_table" then
|
||||||
|
self.object:remove()
|
||||||
|
end
|
||||||
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
|
BIN
textures/glyph1.png
Normal file
After Width: | Height: | Size: 108 B |
BIN
textures/glyph10.png
Normal file
After Width: | Height: | Size: 104 B |
BIN
textures/glyph11.png
Normal file
After Width: | Height: | Size: 104 B |
BIN
textures/glyph12.png
Normal file
After Width: | Height: | Size: 102 B |
BIN
textures/glyph13.png
Normal file
After Width: | Height: | Size: 105 B |
BIN
textures/glyph14.png
Normal file
After Width: | Height: | Size: 106 B |
BIN
textures/glyph2.png
Normal file
After Width: | Height: | Size: 106 B |
BIN
textures/glyph3.png
Normal file
After Width: | Height: | Size: 106 B |
BIN
textures/glyph4.png
Normal file
After Width: | Height: | Size: 105 B |
BIN
textures/glyph5.png
Normal file
After Width: | Height: | Size: 106 B |
BIN
textures/glyph6.png
Normal file
After Width: | Height: | Size: 104 B |
BIN
textures/glyph7.png
Normal file
After Width: | Height: | Size: 104 B |
BIN
textures/glyph8.png
Normal file
After Width: | Height: | Size: 104 B |
BIN
textures/glyph9.png
Normal file
After Width: | Height: | Size: 102 B |