tools.lua.diff 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425
  1. 2a3,11
  2. > local place_tool = function(itemstack, direction, meta1, meta2, pt, tool)
  3. > -- minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="default:" .. tool .. "_deco", param2=direction})
  4. > -- meta1:set_int("wear", itemstack:get_wear())
  5. > -- meta2:set_int("wear", itemstack:get_wear())
  6. > -- itemstack:take_item()
  7. > return itemstack
  8. > end
  9. >
  10. >
  11. 35d43
  12. < groups = {flammable = 2},
  13. 36a45,58
  14. > on_place = function(itemstack, placer, pointed_thing)
  15. > local pt = pointed_thing
  16. > if ( minetest.get_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}).name == "air" ) then
  17. > local wear = itemstack:get_wear()
  18. > local direction = minetest.dir_to_facedir(placer:get_look_dir())
  19. > local meta1 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y , z=pt.under.z})
  20. > local meta2 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y+1, z=pt.under.z})
  21. > minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="default:pick_wood_deco", param2=direction})
  22. > meta1:set_int("wear", wear)
  23. > meta2:set_int("wear", wear)
  24. > itemstack:take_item()
  25. > return itemstack
  26. > end
  27. > end,
  28. 50a73,86
  29. > on_place = function(itemstack, placer, pointed_thing)
  30. > local pt = pointed_thing
  31. > if ( minetest.get_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}).name == "air" ) then
  32. > local wear = itemstack:get_wear()
  33. > local direction = minetest.dir_to_facedir(placer:get_look_dir())
  34. > local meta1 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y , z=pt.under.z})
  35. > local meta2 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y+1, z=pt.under.z})
  36. > minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="default:pick_stone_deco", param2=direction})
  37. > meta1:set_int("wear", wear)
  38. > meta2:set_int("wear", wear)
  39. > itemstack:take_item()
  40. > return itemstack
  41. > end
  42. > end,
  43. 64a101,114
  44. > on_place = function(itemstack, placer, pointed_thing)
  45. > local pt = pointed_thing
  46. > if ( minetest.get_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}).name == "air" ) then
  47. > local wear = itemstack:get_wear()
  48. > local direction = minetest.dir_to_facedir(placer:get_look_dir())
  49. > local meta1 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y , z=pt.under.z})
  50. > local meta2 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y+1, z=pt.under.z})
  51. > minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="default:pick_steel_deco", param2=direction})
  52. > meta1:set_int("wear", wear)
  53. > meta2:set_int("wear", wear)
  54. > itemstack:take_item()
  55. > return itemstack
  56. > end
  57. > end,
  58. 78a129,142
  59. > on_place = function(itemstack, placer, pointed_thing)
  60. > local pt = pointed_thing
  61. > if ( minetest.get_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}).name == "air" ) then
  62. > local wear = itemstack:get_wear()
  63. > local direction = minetest.dir_to_facedir(placer:get_look_dir())
  64. > local meta1 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y , z=pt.under.z})
  65. > local meta2 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y+1, z=pt.under.z})
  66. > minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="default:pick_bronze_deco", param2=direction})
  67. > meta1:set_int("wear", wear)
  68. > meta2:set_int("wear", wear)
  69. > itemstack:take_item()
  70. > return itemstack
  71. > end
  72. > end,
  73. 92a157,170
  74. > on_place = function(itemstack, placer, pointed_thing)
  75. > local pt = pointed_thing
  76. > if ( minetest.get_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}).name == "air" ) then
  77. > local wear = itemstack:get_wear()
  78. > local direction = minetest.dir_to_facedir(placer:get_look_dir())
  79. > local meta1 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y , z=pt.under.z})
  80. > local meta2 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y+1, z=pt.under.z})
  81. > minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="default:pick_mese_deco", param2=direction})
  82. > meta1:set_int("wear", wear)
  83. > meta2:set_int("wear", wear)
  84. > itemstack:take_item()
  85. > return itemstack
  86. > end
  87. > end,
  88. 106a185,198
  89. > on_place = function(itemstack, placer, pointed_thing)
  90. > local pt = pointed_thing
  91. > if ( minetest.get_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}).name == "air" ) then
  92. > local wear = itemstack:get_wear()
  93. > local direction = minetest.dir_to_facedir(placer:get_look_dir())
  94. > local meta1 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y , z=pt.under.z})
  95. > local meta2 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y+1, z=pt.under.z})
  96. > minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="default:pick_diamond_deco", param2=direction})
  97. > meta1:set_int("wear", wear)
  98. > meta2:set_int("wear", wear)
  99. > itemstack:take_item()
  100. > return itemstack
  101. > end
  102. > end,
  103. 126a219,232
  104. > on_place = function(itemstack, placer, pointed_thing)
  105. > local pt = pointed_thing
  106. > if ( minetest.get_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}).name == "air" ) then
  107. > local wear = itemstack:get_wear()
  108. > local direction = minetest.dir_to_facedir(placer:get_look_dir())
  109. > local meta1 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y , z=pt.under.z})
  110. > local meta2 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y+1, z=pt.under.z})
  111. > minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="default:shovel_wood_deco", param2=direction})
  112. > meta1:set_int("wear", wear)
  113. > meta2:set_int("wear", wear)
  114. > itemstack:take_item()
  115. > return itemstack
  116. > end
  117. > end,
  118. 141a248,261
  119. > on_place = function(itemstack, placer, pointed_thing)
  120. > local pt = pointed_thing
  121. > if ( minetest.get_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}).name == "air" ) then
  122. > local wear = itemstack:get_wear()
  123. > local direction = minetest.dir_to_facedir(placer:get_look_dir())
  124. > local meta1 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y , z=pt.under.z})
  125. > local meta2 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y+1, z=pt.under.z})
  126. > minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="default:shovel_stone_deco", param2=direction})
  127. > meta1:set_int("wear", wear)
  128. > meta2:set_int("wear", wear)
  129. > itemstack:take_item()
  130. > return itemstack
  131. > end
  132. > end,
  133. 156a277,296
  134. > on_place = function(itemstack, placer, pointed_thing)
  135. > local pt = pointed_thing
  136. > if ( minetest.get_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}).name == "air" ) then
  137. > local wear = itemstack:get_wear()
  138. > local direction = minetest.dir_to_facedir(placer:get_look_dir())
  139. > local meta1 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y , z=pt.under.z})
  140. > local meta2 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y+1, z=pt.under.z})
  141. > minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="default:shovel_stone_deco", param2=direction})
  142. > meta1:set_int("wear", wear)
  143. > meta2:set_int("wear", wear)
  144. > itemstack:take_item()
  145. > return itemstack
  146. > end
  147. > end,
  148. > on_place = function(itemstack, placer, pointed_thing)
  149. > place_tool(itemstack, minetest.dir_to_facedir(placer:get_look_dir()),
  150. > minetest.env:get_meta({x=pointed_thing.under.x, y=pointed_thing.under.y , z=pointed_thing.under.z}),
  151. > minetest.env:get_meta({x=pointed_thing.under.x, y=pointed_thing.under.y+1, z=pointed_thing.under.z}),
  152. > pointed_thing, "shovel_steel");
  153. > end,
  154. 171a312,325
  155. > on_place = function(itemstack, placer, pointed_thing)
  156. > local pt = pointed_thing
  157. > if ( minetest.get_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}).name == "air" ) then
  158. > local wear = itemstack:get_wear()
  159. > local direction = minetest.dir_to_facedir(placer:get_look_dir())
  160. > local meta1 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y , z=pt.under.z})
  161. > local meta2 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y+1, z=pt.under.z})
  162. > minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="default:shovel_bronze_deco", param2=direction})
  163. > meta1:set_int("wear", wear)
  164. > meta2:set_int("wear", wear)
  165. > itemstack:take_item()
  166. > return itemstack
  167. > end
  168. > end,
  169. 186a341,354
  170. > on_place = function(itemstack, placer, pointed_thing)
  171. > local pt = pointed_thing
  172. > if ( minetest.get_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}).name == "air" ) then
  173. > local wear = itemstack:get_wear()
  174. > local direction = minetest.dir_to_facedir(placer:get_look_dir())
  175. > local meta1 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y , z=pt.under.z})
  176. > local meta2 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y+1, z=pt.under.z})
  177. > minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="default:shovel_mese_deco", param2=direction})
  178. > meta1:set_int("wear", wear)
  179. > meta2:set_int("wear", wear)
  180. > itemstack:take_item()
  181. > return itemstack
  182. > end
  183. > end,
  184. 201a370,383
  185. > on_place = function(itemstack, placer, pointed_thing)
  186. > local pt = pointed_thing
  187. > if ( minetest.get_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}).name == "air" ) then
  188. > local wear = itemstack:get_wear()
  189. > local direction = minetest.dir_to_facedir(placer:get_look_dir())
  190. > local meta1 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y , z=pt.under.z})
  191. > local meta2 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y+1, z=pt.under.z})
  192. > minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="default:shovel_diamond_deco", param2=direction})
  193. > meta1:set_int("wear", wear)
  194. > meta2:set_int("wear", wear)
  195. > itemstack:take_item()
  196. > return itemstack
  197. > end
  198. > end,
  199. 220a403,416
  200. > on_place = function(itemstack, placer, pointed_thing)
  201. > local pt = pointed_thing
  202. > if ( minetest.get_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}).name == "air" ) then
  203. > local wear = itemstack:get_wear()
  204. > local direction = minetest.dir_to_facedir(placer:get_look_dir())
  205. > local meta1 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y , z=pt.under.z})
  206. > local meta2 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y+1, z=pt.under.z})
  207. > minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="default:axe_wood_deco", param2=direction})
  208. > meta1:set_int("wear", wear)
  209. > meta2:set_int("wear", wear)
  210. > itemstack:take_item()
  211. > return itemstack
  212. > end
  213. > end,
  214. 234a431,444
  215. > on_place = function(itemstack, placer, pointed_thing)
  216. > local pt = pointed_thing
  217. > if ( minetest.get_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}).name == "air" ) then
  218. > local wear = itemstack:get_wear()
  219. > local direction = minetest.dir_to_facedir(placer:get_look_dir())
  220. > local meta1 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y , z=pt.under.z})
  221. > local meta2 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y+1, z=pt.under.z})
  222. > minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="default:axe_stone_deco", param2=direction})
  223. > meta1:set_int("wear", wear)
  224. > meta2:set_int("wear", wear)
  225. > itemstack:take_item()
  226. > return itemstack
  227. > end
  228. > end,
  229. 248a459,472
  230. > on_place = function(itemstack, placer, pointed_thing)
  231. > local pt = pointed_thing
  232. > if ( minetest.get_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}).name == "air" ) then
  233. > local wear = itemstack:get_wear()
  234. > local direction = minetest.dir_to_facedir(placer:get_look_dir())
  235. > local meta1 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y , z=pt.under.z})
  236. > local meta2 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y+1, z=pt.under.z})
  237. > minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="default:axe_steel_deco", param2=direction})
  238. > meta1:set_int("wear", wear)
  239. > meta2:set_int("wear", wear)
  240. > itemstack:take_item()
  241. > return itemstack
  242. > end
  243. > end,
  244. 262a487,500
  245. > on_place = function(itemstack, placer, pointed_thing)
  246. > local pt = pointed_thing
  247. > if ( minetest.get_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}).name == "air" ) then
  248. > local wear = itemstack:get_wear()
  249. > local direction = minetest.dir_to_facedir(placer:get_look_dir())
  250. > local meta1 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y , z=pt.under.z})
  251. > local meta2 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y+1, z=pt.under.z})
  252. > minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="default:axe_bronze_deco", param2=direction})
  253. > meta1:set_int("wear", wear)
  254. > meta2:set_int("wear", wear)
  255. > itemstack:take_item()
  256. > return itemstack
  257. > end
  258. > end,
  259. 276a515,528
  260. > on_place = function(itemstack, placer, pointed_thing)
  261. > local pt = pointed_thing
  262. > if ( minetest.get_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}).name == "air" ) then
  263. > local wear = itemstack:get_wear()
  264. > local direction = minetest.dir_to_facedir(placer:get_look_dir())
  265. > local meta1 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y , z=pt.under.z})
  266. > local meta2 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y+1, z=pt.under.z})
  267. > minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="default:axe_mese_deco", param2=direction})
  268. > meta1:set_int("wear", wear)
  269. > meta2:set_int("wear", wear)
  270. > itemstack:take_item()
  271. > return itemstack
  272. > end
  273. > end,
  274. 286c538
  275. < choppy={times={[1]=2.10, [2]=0.90, [3]=0.50}, uses=30, maxlevel=2},
  276. ---
  277. > choppy={times={[1]=2.10, [2]=0.90, [3]=0.50}, uses=30, maxlevel=3},
  278. 290a543,556
  279. > on_place = function(itemstack, placer, pointed_thing)
  280. > local pt = pointed_thing
  281. > if ( minetest.get_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}).name == "air" ) then
  282. > local wear = itemstack:get_wear()
  283. > local direction = minetest.dir_to_facedir(placer:get_look_dir())
  284. > local meta1 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y , z=pt.under.z})
  285. > local meta2 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y+1, z=pt.under.z})
  286. > minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="default:axe_diamond_deco", param2=direction})
  287. > meta1:set_int("wear", wear)
  288. > meta2:set_int("wear", wear)
  289. > itemstack:take_item()
  290. > return itemstack
  291. > end
  292. > end,
  293. 309a576,589
  294. > on_place = function(itemstack, placer, pointed_thing)
  295. > local pt = pointed_thing
  296. > if ( minetest.get_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}).name == "air" ) then
  297. > local wear = itemstack:get_wear()
  298. > local direction = minetest.dir_to_facedir(placer:get_look_dir())
  299. > local meta1 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y , z=pt.under.z})
  300. > local meta2 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y+1, z=pt.under.z})
  301. > minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="default:sword_wood_deco", param2=direction})
  302. > meta1:set_int("wear", wear)
  303. > meta2:set_int("wear", wear)
  304. > itemstack:take_item()
  305. > return itemstack
  306. > end
  307. > end,
  308. 323a604,617
  309. > on_place = function(itemstack, placer, pointed_thing)
  310. > local pt = pointed_thing
  311. > if ( minetest.get_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}).name == "air" ) then
  312. > local wear = itemstack:get_wear()
  313. > local direction = minetest.dir_to_facedir(placer:get_look_dir())
  314. > local meta1 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y , z=pt.under.z})
  315. > local meta2 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y+1, z=pt.under.z})
  316. > minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="default:sword_stone_deco", param2=direction})
  317. > meta1:set_int("wear", wear)
  318. > meta2:set_int("wear", wear)
  319. > itemstack:take_item()
  320. > return itemstack
  321. > end
  322. > end,
  323. 337a632,645
  324. > on_place = function(itemstack, placer, pointed_thing)
  325. > local pt = pointed_thing
  326. > if ( minetest.get_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}).name == "air" ) then
  327. > local wear = itemstack:get_wear()
  328. > local direction = minetest.dir_to_facedir(placer:get_look_dir())
  329. > local meta1 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y , z=pt.under.z})
  330. > local meta2 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y+1, z=pt.under.z})
  331. > minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="default:sword_steel_deco", param2=direction})
  332. > meta1:set_int("wear", wear)
  333. > meta2:set_int("wear", wear)
  334. > itemstack:take_item()
  335. > return itemstack
  336. > end
  337. > end,
  338. 351a660,673
  339. > on_place = function(itemstack, placer, pointed_thing)
  340. > local pt = pointed_thing
  341. > if ( minetest.get_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}).name == "air" ) then
  342. > local wear = itemstack:get_wear()
  343. > local direction = minetest.dir_to_facedir(placer:get_look_dir())
  344. > local meta1 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y , z=pt.under.z})
  345. > local meta2 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y+1, z=pt.under.z})
  346. > minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="default:sword_bronze_deco", param2=direction})
  347. > meta1:set_int("wear", wear)
  348. > meta2:set_int("wear", wear)
  349. > itemstack:take_item()
  350. > return itemstack
  351. > end
  352. > end,
  353. 365a688,701
  354. > on_place = function(itemstack, placer, pointed_thing)
  355. > local pt = pointed_thing
  356. > if ( minetest.get_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}).name == "air" ) then
  357. > local wear = itemstack:get_wear()
  358. > local direction = minetest.dir_to_facedir(placer:get_look_dir())
  359. > local meta1 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y , z=pt.under.z})
  360. > local meta2 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y+1, z=pt.under.z})
  361. > minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="default:sword_mese_deco", param2=direction})
  362. > meta1:set_int("wear", wear)
  363. > meta2:set_int("wear", wear)
  364. > itemstack:take_item()
  365. > return itemstack
  366. > end
  367. > end,
  368. 379a716,729
  369. > on_place = function(itemstack, placer, pointed_thing)
  370. > local pt = pointed_thing
  371. > if ( minetest.get_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}).name == "air" ) then
  372. > local wear = itemstack:get_wear()
  373. > local direction = minetest.dir_to_facedir(placer:get_look_dir())
  374. > local meta1 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y , z=pt.under.z})
  375. > local meta2 = minetest.env:get_meta({x=pt.under.x, y=pt.under.y+1, z=pt.under.z})
  376. > minetest.set_node({x=pt.under.x, y=pt.under.y+1, z=pt.under.z}, {name="default:sword_diamond_deco", param2=direction})
  377. > meta1:set_int("wear", wear)
  378. > meta2:set_int("wear", wear)
  379. > itemstack:take_item()
  380. > return itemstack
  381. > end
  382. > end,
  383. 419a770,810
  384. >
  385. >
  386. > local register_deco_block = function(tool_name, tool_tiles, tool_nodebox)
  387. > minetest.register_node(tool_name.."_deco", {
  388. > drawtype = "nodebox",
  389. > paramtype = "light",
  390. > paramtype2 = "facedir",
  391. > tiles = tool_tiles,
  392. > groups = {
  393. > snappy=3,
  394. > flammable=2,
  395. > not_in_creative_inventory=1
  396. > },
  397. > node_box = {
  398. > type = "fixed",
  399. > fixed = tool_nodebox,
  400. > },
  401. > sounds = default.node_sound_wood_defaults(),
  402. > on_dig = function(pos, node, digger)
  403. > if digger:is_player() and digger:get_inventory() then
  404. > local meta = minetest.env:get_meta(pos)
  405. > local wear_out = meta:get_int("wear")
  406. > digger:get_inventory():add_item("main", {name=tool_name, count=1, wear=wear_out, metadata=""})
  407. > end
  408. > minetest.remove_node(pos)
  409. > end,
  410. > })
  411. > end
  412. >
  413. > local register_deco_block_materials = function(material, top)
  414. > register_deco_block("default:pick_"..material, {top, "default_tool_"..material.."pick.png"}, {{-0.5/3, -1.5/3, -0.5/3, 0.5/3, 0.5/3, 0.5/3},{-0.5/3, 0.5/3, -1.5/3, 0.5/3, 1.5/3, 1.5/3}})
  415. > register_deco_block("default:shovel_"..material, {top, "default_tool_"..material.."shovel.png"}, {{-0.5/3, -1.5/3, -0.5/3, 0.5/3, 1.5/3, 0.5/3}})
  416. > register_deco_block("default:axe_"..material, {top, top, "default_tool_"..material.."axe.png^[transformFX", "default_tool_"..material.."axe.png", "default_tool_"..material.."axe.png^[combine:6x6:2,0=".."default_tool_"..material.."axe.png", "default_tool_"..material.."axe.png"}, {{-0.5/3, -1.5/3, -0.5/3, 0.5/3, 0.5/3, 0.5/3},{-0.5/3, 0.5/3, -0.5/3, 0.5/3, 1.5/3, 1.5/3},{-0.5/3, -0.5/3, 0.5/3, 0.5/3, 0.5/3, 1.5/3}})
  417. > register_deco_block("default:sword_"..material, {top, "default_tool_"..material.."sword.png"}, {{-0.5/3, -1.5/3, -0.5/3, 0.5/3, 1.5/3, 0.5/3}})
  418. > end
  419. > register_deco_block_materials("stone", "default_cobble.png")
  420. > register_deco_block_materials("wood", "default_wood.png")
  421. > register_deco_block_materials("steel", "default_steel_block.png")
  422. > register_deco_block_materials("bronze", "default_bronze_block.png")
  423. > register_deco_block_materials("mese", "default_mese_block.png")
  424. > register_deco_block_materials("diamond", "default_diamond_block.png")