From 7182197a4d5f840cfebbc19e6e6939cdcd4477bf Mon Sep 17 00:00:00 2001 From: kilbith Date: Sat, 2 Apr 2016 18:24:00 +0200 Subject: [PATCH] Import changes from xdecor --- init.lua | 33 +++++++++++++++++++++++++++++++-- textures/glyph1.png | Bin 0 -> 108 bytes textures/glyph10.png | Bin 0 -> 104 bytes textures/glyph11.png | Bin 0 -> 104 bytes textures/glyph12.png | Bin 0 -> 102 bytes textures/glyph13.png | Bin 0 -> 105 bytes textures/glyph14.png | Bin 0 -> 106 bytes textures/glyph2.png | Bin 0 -> 106 bytes textures/glyph3.png | Bin 0 -> 106 bytes textures/glyph4.png | Bin 0 -> 105 bytes textures/glyph5.png | Bin 0 -> 106 bytes textures/glyph6.png | Bin 0 -> 104 bytes textures/glyph7.png | Bin 0 -> 104 bytes textures/glyph8.png | Bin 0 -> 104 bytes textures/glyph9.png | Bin 0 -> 102 bytes 15 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 textures/glyph1.png create mode 100644 textures/glyph10.png create mode 100644 textures/glyph11.png create mode 100644 textures/glyph12.png create mode 100644 textures/glyph13.png create mode 100644 textures/glyph14.png create mode 100644 textures/glyph2.png create mode 100644 textures/glyph3.png create mode 100644 textures/glyph4.png create mode 100644 textures/glyph5.png create mode 100644 textures/glyph6.png create mode 100644 textures/glyph7.png create mode 100644 textures/glyph8.png create mode 100644 textures/glyph9.png diff --git a/init.lua b/init.lua index 201fd72..ff142ce 100644 --- a/init.lua +++ b/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") 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 = "glyph"..math.random(1,14)..".png" + }) + end return true end @@ -161,7 +182,15 @@ minetest.register_entity(":xdecor:book_open", { visual_size = {x=0.75, y=0.75}, collisionbox = {0}, 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({ diff --git a/textures/glyph1.png b/textures/glyph1.png new file mode 100644 index 0000000000000000000000000000000000000000..da77892eb6cfbc473a42b5b145f07ac000858d33 GIT binary patch literal 108 zcmeAS@N?(olHy`uVBq!ia0vp^Y#_|Y3?y$c)pCP40X`wFK>Fgv=lzMPzCadZNswPK zgTu2MX+VyMr;B3<$MxhN2M-)5XmD(FY-(g=5V*tm@nO!w9-usfr>mdKI;Vst00L|s Ab^rhX literal 0 HcmV?d00001 diff --git a/textures/glyph10.png b/textures/glyph10.png new file mode 100644 index 0000000000000000000000000000000000000000..27c7c8d07d7d8949ea9dbc83b178fe5a59f5611d GIT binary patch literal 104 zcmeAS@N?(olHy`uVBq!ia0vp^Y#_|Y3?y$c)pCP40X`wFK>Fgv=lzMPzCadZNswPK wgTu2MX+VyEr;B3<$MxhD2@e>Y+1U6PSf4P={IhraS)d$)r>mdKI;Vst08!}~?f?J) literal 0 HcmV?d00001 diff --git a/textures/glyph11.png b/textures/glyph11.png new file mode 100644 index 0000000000000000000000000000000000000000..76493c91fdfdb86026d1b95f75603dbc1e864264 GIT binary patch literal 104 zcmeAS@N?(olHy`uVBq!ia0vp^Y#_|Y3?y$c)pCP40X`wFK>Fgv=lzMPzCadZNswPK wgTu2MX+VyEr;B3<$Ms}}Mtg@nt&NNfoIH#hdxZpV0Oc4wUHx3vIVCg!05T#M`~Uy| literal 0 HcmV?d00001 diff --git a/textures/glyph12.png b/textures/glyph12.png new file mode 100644 index 0000000000000000000000000000000000000000..72f18fb56ea0de0e5459220cf50f2ce303f35c48 GIT binary patch literal 102 zcmeAS@N?(olHy`uVBq!ia0vp^Y#_|Y3?y$c)pCP40X`wFK>Fgv=lzMPzCadZNswPK ugTu2MX+RF2r;B3<$Ms|b24^+_P6pOH3?JErel`JR7(8A5T-G@yGywqZycXa9 literal 0 HcmV?d00001 diff --git a/textures/glyph13.png b/textures/glyph13.png new file mode 100644 index 0000000000000000000000000000000000000000..70ca494ae4ee37d6688ac84ad2df3b3cdcfb0b64 GIT binary patch literal 105 zcmeAS@N?(olHy`uVBq!ia0vp^Y#_|Y3?y$c)pCP40X`wFK>Fgv=lzMPzCadZNswPK xgTu2MX+Vykr;B3<$MxidgbxglxY!gJ7+Bsg9AxMItP7N6@O1TaS?83{1OQZ87?1z} literal 0 HcmV?d00001 diff --git a/textures/glyph14.png b/textures/glyph14.png new file mode 100644 index 0000000000000000000000000000000000000000..68623878a089023b3da3a4fa6f2e27d51190cccd GIT binary patch literal 106 zcmeAS@N?(olHy`uVBq!ia0vp^Y#_|Y3?y$c)pCP40X`wFK>Fgv=lzMPzCadZNswPK xgTu2MX+VyUr;B3<$MxiZgan2pW;RAPMh4~@hKX8Q${^DiJYD@<);T3K0RS^>7Dxa9 literal 0 HcmV?d00001 diff --git a/textures/glyph2.png b/textures/glyph2.png new file mode 100644 index 0000000000000000000000000000000000000000..a6da2d187af74bbeb6db2fc5813614a3957f2daf GIT binary patch literal 106 zcmeAS@N?(olHy`uVBq!ia0vp^Y#_|Y3?y$c)pCP40X`wFK>Fgv=lzMPzCadZNswPK ygTu2MX+VyUr;B3<$Ms}`goK12hYv8d)H86&Fd6RbWpW0}GI+ZBxvXFgv=lzMPzCadZNswPK ygTu2MX+VyUr;B3<$Mxh72@euJFgUTZ@iVYrVa#kU-unnB%i!ti=d#Wzp$Pz!?HZ&2 literal 0 HcmV?d00001 diff --git a/textures/glyph4.png b/textures/glyph4.png new file mode 100644 index 0000000000000000000000000000000000000000..e93f2383071de536b4692bf350c7b4ff49118968 GIT binary patch literal 105 zcmeAS@N?(olHy`uVBq!ia0vp^Y#_|Y3?y$c)pCP40X`wFK>Fgv=lzMPzCadZNswPK wgTu2MX+Vykr;B3<$Mxh73{H#+AqfQx4D39Nf=Ojnc|b`9Pgg&ebxsLQ05>%kM*si- literal 0 HcmV?d00001 diff --git a/textures/glyph5.png b/textures/glyph5.png new file mode 100644 index 0000000000000000000000000000000000000000..c79537f6124d4025cd6d8f5d757ae99589a086fa GIT binary patch literal 106 zcmeAS@N?(olHy`uVBq!ia0vp^Y#_|Y3?y$c)pCP40X`wFK>Fgv=lzMPzCadZNswPK ygTu2MX+VyUr;B3<$Mxg@1}8=~J~pv7DF)^>3^!+%tXTz=W$<+Mb6Mw<&;$TWei%9c literal 0 HcmV?d00001 diff --git a/textures/glyph6.png b/textures/glyph6.png new file mode 100644 index 0000000000000000000000000000000000000000..f73535485addddfecfe4092b195dbaab33969efe GIT binary patch literal 104 zcmeAS@N?(olHy`uVBq!ia0vp^Y#_|Y3?y$c)pCP40X`wFK>Fgv=lzMPzCadZNswPK wgTu2MX+VyEr;B3<$Mxg@24`kAMm9zUmN^U?*Dtqi0?ILXy85}Sb4q9e01-SE^Z)<= literal 0 HcmV?d00001 diff --git a/textures/glyph7.png b/textures/glyph7.png new file mode 100644 index 0000000000000000000000000000000000000000..3f91a329a1462482ac582b1e51c9f770f044f6d5 GIT binary patch literal 104 zcmeAS@N?(olHy`uVBq!ia0vp^Y#_|Y3?y$c)pCP40X`wFK>Fgv=lzMPzCadZNswPK wgTu2MX+VyEr;B3<$Mxh12?2=#49@HfEENoQ=NG%n1LYVzUHx3vIVCg!05ZWB_5c6? literal 0 HcmV?d00001 diff --git a/textures/glyph8.png b/textures/glyph8.png new file mode 100644 index 0000000000000000000000000000000000000000..6c6599471745faf67c4c8b93aa24a6ac449c60b2 GIT binary patch literal 104 zcmeAS@N?(olHy`uVBq!ia0vp^Y#_|Y3?y$c)pCP40X`wFK>Fgv=lzMPzCadZNswPK wgTu2MX+VyEr;B3<$Ms|bhQnNJY;9Z&>~9zwcN^(^0?ILXy85}Sb4q9e04hZo0{{R3 literal 0 HcmV?d00001 diff --git a/textures/glyph9.png b/textures/glyph9.png new file mode 100644 index 0000000000000000000000000000000000000000..4b3e366d97b6dfae280e7fd05f2a269855300305 GIT binary patch literal 102 zcmeAS@N?(olHy`uVBq!ia0vp^Y#_|Y3?y$c)pCP40X`wFK>Fgv=lzMPzCadZNswPK ugTu2MX+RF2r;B3<$Mxh72?Y&@xEMI+Fdp>!^l3g&hQZU-&t;ucLK6TsjT$Hb literal 0 HcmV?d00001