decor.lua 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644
  1. fdir_table = {
  2. { 1, 0 },
  3. { 0, -1 },
  4. { -1, 0 },
  5. { 0, 1 },
  6. { 1, 0 },
  7. { 0, -1 },
  8. { -1, 0 },
  9. { 0, 1 },
  10. }
  11. function furniture.curtain_placement(pos)
  12. local node = minetest.get_node(pos)
  13. local nodename = node.name
  14. local fdir = node.param2
  15. local posr = {x = pos.x + fdir_table[fdir+1][1], y=pos.y, z = pos.z + fdir_table[fdir+1][2]}
  16. local posl = {x = pos.x - fdir_table[fdir+1][1], y=pos.y, z = pos.z - fdir_table[fdir+1][2]}
  17. local noder = minetest.get_node(posr)
  18. local nodel = minetest.get_node(posl)
  19. local nodername = noder.name
  20. local nodelname = nodel.name
  21. local height = string.sub(nodename, 19, 19)
  22. local part = string.sub(nodename, 20, 20)
  23. local color = string.sub(nodename, 22, -3)
  24. local rheight = string.sub(nodername, 19, 19)
  25. local rpart = string.sub(nodername, 20, 20)
  26. local rcolor = string.sub(nodername, 22, -3)
  27. local lheight = string.sub(nodelname, 19, 19)
  28. local lpart = string.sub(nodelname, 20, 20)
  29. local lcolor = string.sub(nodelname, 22, -3)
  30. if lheight == height and lcolor == color then --placing to the right
  31. minetest.set_node(pos,{name = 'furniture:curtain_'..height..'r_'..color..'_1', param2=fdir})
  32. if lpart == 'r' then
  33. minetest.set_node(posl,{name = 'furniture:curtain_'..height..'c_'..color..'_1', param2=fdir})
  34. elseif lpart == 's' then
  35. minetest.set_node(posl,{name = 'furniture:curtain_'..height..'l_'..color..'_1', param2=fdir})
  36. end
  37. end
  38. if rheight == height and rcolor == color then --placing to the left
  39. minetest.set_node(pos,{name = 'furniture:curtain_'..height..'l_'..color..'_1', param2=fdir})
  40. if rpart == 'l' then
  41. minetest.set_node(posr,{name = 'furniture:curtain_'..height..'c_'..color..'_1', param2=fdir})
  42. elseif rpart == 's' then
  43. minetest.set_node(posr,{name = 'furniture:curtain_'..height..'r_'..color..'_1', param2=fdir})
  44. end
  45. end
  46. end
  47. function furniture.curtain_removal(pos, node, digger)
  48. local nodename = node.name
  49. local fdir = node.param2
  50. if fdir >= 3 then
  51. minetest.remove_node(pos)
  52. end
  53. local posr = {x = pos.x + fdir_table[fdir+1][1], y=pos.y, z = pos.z + fdir_table[fdir+1][2]}
  54. local posl = {x = pos.x - fdir_table[fdir+1][1], y=pos.y, z = pos.z - fdir_table[fdir+1][2]}
  55. local noder = minetest.get_node(posr)
  56. local nodel = minetest.get_node(posl)
  57. local nodername = noder.name
  58. local nodelname = nodel.name
  59. local height = string.sub(nodename, 19, 19)
  60. local part = string.sub(nodename, 20, 20)
  61. local color = string.sub(nodename, 22, -3)
  62. local rheight = string.sub(nodername, 19, 19)
  63. local rpart = string.sub(nodername, 20, 20)
  64. local rcolor = string.sub(nodername, 22, -3)
  65. local lheight = string.sub(nodelname, 19, 19)
  66. local lpart = string.sub(nodelname, 20, 20)
  67. local lcolor = string.sub(nodelname, 22, -3)
  68. minetest.remove_node(pos)
  69. local player_inv = digger:get_inventory()
  70. if player_inv:room_for_item('main', 'furniture:curtain_'..height..'s_'..color..'_1') then
  71. player_inv:add_item('main', 'furniture:curtain_'..height..'s_'..color..'_1')
  72. else
  73. local drop_pos = digger:get_pos()
  74. minetest.add_item(drop_pos, 'furniture:curtain_'..height..'s_'..color..'_1')
  75. end
  76. if lheight == height and lcolor == color then --node to the left
  77. if lpart == 'c' then
  78. minetest.set_node(posl,{name = 'furniture:curtain_'..height..'r_'..color..'_1', param2=nodel.param2})
  79. elseif lpart == 'l' then
  80. minetest.set_node(posl,{name = 'furniture:curtain_'..height..'s_'..color..'_1', param2=nodel.param2})
  81. end
  82. end
  83. if rheight == height and rcolor == color then --node to the right
  84. if rpart == 'c' then
  85. minetest.set_node(posr,{name = 'furniture:curtain_'..height..'l_'..color..'_1', param2=noder.param2})
  86. elseif rpart == 'r' then
  87. minetest.set_node(posr,{name = 'furniture:curtain_'..height..'s_'..color..'_1', param2=noder.param2})
  88. end
  89. end
  90. end
  91. function furniture.curtain_toggle(pos, node)
  92. local nodename = node.name
  93. local height = string.sub(nodename, 19, 19)
  94. local part = string.sub(nodename, 20, 20)
  95. local color = string.sub(nodename, 22, -3)
  96. local state = string.sub(nodename, -1, -1)
  97. local new_state = math.abs(state - 1) --if state is zero, subtracting 1 makes it negative one, and the absolute value of negative one is one.
  98. local fdir = node.param2
  99. local curtain = color..'_'..height
  100. if fdir == 0 or fdir == 2 then --Search in the X axis
  101. local next_l_pos = {x=pos.x-1, y=pos.y, z=pos.z}
  102. local next_l_node = minetest.get_node(next_l_pos).name
  103. local next_l_color = string.sub(next_l_node, 22, -3)
  104. local next_l_height = string.sub(next_l_node, 19, 19)
  105. local next_l_part = string.sub(next_l_node, 20, 20)
  106. local next_l_curtain = next_l_color..'_'..next_l_height
  107. local next_r_pos = {x=pos.x+1, y=pos.y, z=pos.z}
  108. local next_r_node = minetest.get_node(next_r_pos).name
  109. local next_r_color = string.sub(next_r_node, 22, -3)
  110. local next_r_height = string.sub(next_r_node, 19, 19)
  111. local next_r_part = string.sub(next_r_node, 20, 20)
  112. local next_r_curtain = next_r_color..'_'..next_r_height
  113. minetest.set_node(pos, {name='furniture:curtain_'..height..part..'_'..color..'_'..new_state, param2 = fdir})
  114. while next_l_curtain == curtain do
  115. minetest.set_node(next_l_pos, {name='furniture:curtain_'..height..next_l_part..'_'..color..'_'..new_state, param2 = fdir})
  116. next_l_pos.x = next_l_pos.x - 1
  117. next_l_node = minetest.get_node(next_l_pos).name
  118. next_l_color = string.sub(next_l_node, 22, -3)
  119. next_l_height = string.sub(next_l_node, 19, 19)
  120. next_l_part = string.sub(next_l_node, 20, 20)
  121. next_l_curtain = next_l_color..'_'..next_l_height
  122. end
  123. while next_r_curtain == curtain do
  124. minetest.set_node(next_r_pos, {name='furniture:curtain_'..height..next_r_part..'_'..color..'_'..new_state, param2 = fdir})
  125. next_r_pos.x = next_r_pos.x + 1
  126. next_r_node = minetest.get_node(next_r_pos).name
  127. next_r_color = string.sub(next_r_node, 22, -3)
  128. next_r_height = string.sub(next_r_node, 19, 19)
  129. next_r_part = string.sub(next_r_node, 20, 20)
  130. next_r_curtain = next_r_color..'_'..next_r_height
  131. end
  132. elseif fdir == 1 or fdir == 3 then --Search in the Z axis
  133. local next_l_pos = {x=pos.x, y=pos.y, z=pos.z-1}
  134. local next_l_node = minetest.get_node(next_l_pos).name
  135. local next_l_color = string.sub(next_l_node, 22, -3)
  136. local next_l_height = string.sub(next_l_node, 19, 19)
  137. local next_l_part = string.sub(next_l_node, 20, 20)
  138. local next_l_curtain = next_l_color..'_'..next_l_height
  139. local next_r_pos = {x=pos.x, y=pos.y, z=pos.z+1}
  140. local next_r_node = minetest.get_node(next_r_pos).name
  141. local next_r_color = string.sub(next_r_node, 22, -3)
  142. local next_r_height = string.sub(next_r_node, 19, 19)
  143. local next_r_part = string.sub(next_r_node, 20, 20)
  144. local next_r_curtain = next_r_color..'_'..next_r_height
  145. minetest.set_node(pos, {name='furniture:curtain_'..height..part..'_'..color..'_'..new_state, param2 = fdir})
  146. while next_l_curtain == curtain do
  147. minetest.set_node(next_l_pos, {name='furniture:curtain_'..height..next_l_part..'_'..color..'_'..new_state, param2 = fdir})
  148. next_l_pos.z = next_l_pos.z - 1
  149. next_l_node = minetest.get_node(next_l_pos).name
  150. next_l_color = string.sub(next_l_node, 22, -3)
  151. next_l_height = string.sub(next_l_node, 19, 19)
  152. next_l_part = string.sub(next_l_node, 20, 20)
  153. next_l_curtain = next_l_color..'_'..next_l_height
  154. end
  155. while next_r_curtain == curtain do
  156. minetest.set_node(next_r_pos, {name='furniture:curtain_'..height..next_r_part..'_'..color..'_'..new_state, param2 = fdir})
  157. next_r_pos.z = next_r_pos.z + 1
  158. next_r_node = minetest.get_node(next_r_pos).name
  159. next_r_color = string.sub(next_r_node, 22, -3)
  160. next_r_height = string.sub(next_r_node, 19, 19)
  161. next_r_part = string.sub(next_r_node, 20, 20)
  162. next_r_curtain = next_r_color..'_'..next_r_height
  163. end
  164. end
  165. end
  166. local dye_table = dye.dyes
  167. for i in ipairs(dye_table) do
  168. local name = dye_table[i][1]
  169. local desc = dye_table[i][2]
  170. local hex = dye_table[i][3]
  171. minetest.register_node('furniture:curtain_ss_'..name..'_0', {
  172. description = 'Short '..desc..' Curtain Closed',
  173. drawtype = 'mesh',
  174. mesh = 'furniture_curtain_short.obj',
  175. tiles = {'furniture_curtain_short_0.png^[multiply:'..hex},
  176. use_texture_alpha = 'clip',
  177. paramtype = 'light',
  178. paramtype2 = 'facedir',
  179. drop = 'furniture:curtain_ss_'..name..'_1',
  180. selection_box = {
  181. type = 'fixed',
  182. fixed = {-.5, -.5, .4, .5, .5, .5},
  183. },
  184. collision_box = {
  185. type = 'fixed',
  186. fixed = {-.5, -.5, .4, .5, .5, .5},
  187. },
  188. groups = {oddly_breakable_by_hand = 3, snappy=3, not_in_creative_inventory=1},
  189. on_rightclick = function(pos, node)
  190. furniture.curtain_toggle(pos, node)
  191. end,
  192. on_dig = function(pos, node, digger)
  193. furniture.curtain_removal(pos, node, digger)
  194. end
  195. })
  196. minetest.register_node('furniture:curtain_ss_'..name..'_1', {
  197. description = 'Short '..desc..' Curtain Open',
  198. drawtype = 'mesh',
  199. mesh = 'furniture_curtain_short.obj',
  200. tiles = {'furniture_curtain_short_1.png^[multiply:'..hex},
  201. use_texture_alpha = 'clip',
  202. inventory_image = 'furniture_curtain_short_1.png^[multiply:'..hex,
  203. paramtype = 'light',
  204. paramtype2 = 'facedir',
  205. walkable = false,
  206. sunlight_propagates = true,
  207. selection_box = {
  208. type = 'fixed',
  209. fixed = {-.5, -.5, .4, .5, .5, .5},
  210. },
  211. collision_box = {
  212. type = 'fixed',
  213. fixed = {-.5, -.5, .4, .5, .5, .5},
  214. },
  215. groups = {oddly_breakable_by_hand = 3, snappy=3},
  216. on_rightclick = function(pos, node)
  217. furniture.curtain_toggle(pos, node)
  218. end,
  219. after_place_node = function(pos, placer, itemstack)
  220. furniture.curtain_placement(pos)
  221. end,
  222. on_dig = function(pos, node, digger)
  223. furniture.curtain_removal(pos, node, digger)
  224. end
  225. })
  226. minetest.register_node('furniture:curtain_sl_'..name..'_0', {
  227. _doc_items_create_entry = false,
  228. description = 'Short Left '..desc..' Curtain Closed',
  229. drawtype = 'mesh',
  230. mesh = 'furniture_curtain_short.obj',
  231. tiles = {'furniture_curtain_short_0.png^[multiply:'..hex},
  232. use_texture_alpha = 'clip',
  233. paramtype = 'light',
  234. paramtype2 = 'facedir',
  235. drop = 'furniture:curtain_ss_'..name..'_1',
  236. selection_box = {
  237. type = 'fixed',
  238. fixed = {-.5, -.5, .4, .5, .5, .5},
  239. },
  240. collision_box = {
  241. type = 'fixed',
  242. fixed = {-.5, -.5, .4, .5, .5, .5},
  243. },
  244. groups = {oddly_breakable_by_hand = 3, snappy=3, not_in_creative_inventory=1},
  245. on_rightclick = function(pos, node)
  246. furniture.curtain_toggle(pos, node)
  247. end,
  248. on_dig = function(pos, node, digger)
  249. furniture.curtain_removal(pos, node, digger)
  250. end
  251. })
  252. minetest.register_node('furniture:curtain_sl_'..name..'_1', {
  253. _doc_items_create_entry = false,
  254. description = 'Short Left '..desc..' Curtain Open',
  255. drawtype = 'mesh',
  256. mesh = 'furniture_curtain_short.obj',
  257. tiles = {'furniture_curtain_sl_1.png^[multiply:'..hex},
  258. use_texture_alpha = 'clip',
  259. inventory_image = 'furniture_curtain_sl_1.png^[multiply:'..hex,
  260. paramtype = 'light',
  261. paramtype2 = 'facedir',
  262. walkable = false,
  263. sunlight_propagates = true,
  264. drop = 'furniture:curtain_ss_'..name..'_1',
  265. selection_box = {
  266. type = 'fixed',
  267. fixed = {-.5, -.5, .4, .5, .5, .5},
  268. },
  269. collision_box = {
  270. type = 'fixed',
  271. fixed = {-.5, -.5, .4, .5, .5, .5},
  272. },
  273. groups = {oddly_breakable_by_hand = 3, snappy=3, not_in_creative_inventory=1},
  274. on_rightclick = function(pos, node)
  275. furniture.curtain_toggle(pos, node)
  276. end,
  277. on_dig = function(pos, node, digger)
  278. furniture.curtain_removal(pos, node, digger)
  279. end
  280. })
  281. minetest.register_node('furniture:curtain_sr_'..name..'_0', {
  282. _doc_items_create_entry = false,
  283. description = 'Short Right '..desc..' Curtain Closed',
  284. drawtype = 'mesh',
  285. mesh = 'furniture_curtain_short.obj',
  286. tiles = {'furniture_curtain_short_0.png^[multiply:'..hex},
  287. use_texture_alpha = 'clip',
  288. paramtype = 'light',
  289. paramtype2 = 'facedir',
  290. drop = 'furniture:curtain_ss_'..name..'_1',
  291. selection_box = {
  292. type = 'fixed',
  293. fixed = {-.5, -.5, .4, .5, .5, .5},
  294. },
  295. collision_box = {
  296. type = 'fixed',
  297. fixed = {-.5, -.5, .4, .5, .5, .5},
  298. },
  299. groups = {oddly_breakable_by_hand = 3, snappy=3, not_in_creative_inventory=1},
  300. on_rightclick = function(pos, node)
  301. furniture.curtain_toggle(pos, node)
  302. end,
  303. on_dig = function(pos, node, digger)
  304. furniture.curtain_removal(pos, node, digger)
  305. end
  306. })
  307. minetest.register_node('furniture:curtain_sr_'..name..'_1', {
  308. _doc_items_create_entry = false,
  309. description = 'Short Right '..desc..' Curtain Open',
  310. drawtype = 'mesh',
  311. mesh = 'furniture_curtain_short.obj',
  312. tiles = {'furniture_curtain_sr_1.png^[multiply:'..hex},
  313. use_texture_alpha = 'clip',
  314. inventory_image = 'furniture_curtain_sr_1.png^[multiply:'..hex,
  315. paramtype = 'light',
  316. paramtype2 = 'facedir',
  317. walkable = false,
  318. sunlight_propagates = true,
  319. drop = 'furniture:curtain_ss_'..name..'_1',
  320. selection_box = {
  321. type = 'fixed',
  322. fixed = {-.5, -.5, .4, .5, .5, .5},
  323. },
  324. collision_box = {
  325. type = 'fixed',
  326. fixed = {-.5, -.5, .4, .5, .5, .5},
  327. },
  328. groups = {oddly_breakable_by_hand = 3, snappy=3, not_in_creative_inventory=1},
  329. on_rightclick = function(pos, node)
  330. furniture.curtain_toggle(pos, node)
  331. end,
  332. on_dig = function(pos, node, digger)
  333. furniture.curtain_removal(pos, node, digger)
  334. end
  335. })
  336. minetest.register_node('furniture:curtain_sc_'..name..'_0', {
  337. _doc_items_create_entry = false,
  338. description = 'Short Middle '..desc..' Curtain Closed',
  339. drawtype = 'mesh',
  340. mesh = 'furniture_curtain_short.obj',
  341. tiles = {'furniture_curtain_short_0.png^[multiply:'..hex},
  342. use_texture_alpha = 'clip',
  343. paramtype = 'light',
  344. paramtype2 = 'facedir',
  345. drop = 'furniture:curtain_ss_'..name..'_1',
  346. selection_box = {
  347. type = 'fixed',
  348. fixed = {-.5, -.5, .4, .5, .5, .5},
  349. },
  350. collision_box = {
  351. type = 'fixed',
  352. fixed = {-.5, -.5, .4, .5, .5, .5},
  353. },
  354. groups = {oddly_breakable_by_hand = 3, snappy=3, not_in_creative_inventory=1},
  355. on_rightclick = function(pos, node)
  356. furniture.curtain_toggle(pos, node)
  357. end,
  358. on_dig = function(pos, node, digger)
  359. furniture.curtain_removal(pos, node, digger)
  360. end
  361. })
  362. minetest.register_node('furniture:curtain_sc_'..name..'_1', {
  363. _doc_items_create_entry = false,
  364. description = 'Short Middle '..desc..' Curtain Open',
  365. drawtype = 'mesh',
  366. mesh = 'furniture_curtain_short.obj',
  367. tiles = {'furniture_curtain_sc_1.png^[multiply:'..hex},
  368. use_texture_alpha = 'clip',
  369. inventory_image = 'furniture_curtain_sc_1.png^[multiply:'..hex,
  370. paramtype = 'light',
  371. paramtype2 = 'facedir',
  372. walkable = false,
  373. sunlight_propagates = true,
  374. drop = 'furniture:curtain_ss_'..name..'_1',
  375. selection_box = {
  376. type = 'fixed',
  377. fixed = {-.5, -.5, .4, .5, .5, .5},
  378. },
  379. collision_box = {
  380. type = 'fixed',
  381. fixed = {-.5, -.5, .4, .5, .5, .5},
  382. },
  383. groups = {oddly_breakable_by_hand = 3, snappy=3, not_in_creative_inventory=1},
  384. on_rightclick = function(pos, node)
  385. furniture.curtain_toggle(pos, node)
  386. end,
  387. on_dig = function(pos, node, digger)
  388. furniture.curtain_removal(pos, node, digger)
  389. end
  390. })
  391. minetest.register_node('furniture:curtain_ts_'..name..'_0', {
  392. _doc_items_create_entry = false,
  393. description = 'Tall '..desc..' Curtain Closed',
  394. drawtype = 'mesh',
  395. mesh = 'furniture_curtain_tall.obj',
  396. tiles = {'furniture_curtain_tall_0.png^[multiply:'..hex},
  397. use_texture_alpha = 'clip',
  398. paramtype = 'light',
  399. paramtype2 = 'facedir',
  400. drop = 'furniture:curtain_tall_'..name..'_1',
  401. selection_box = {
  402. type = 'fixed',
  403. fixed = {-.5, -.5, .4, .5, .5, .5},
  404. },
  405. collision_box = {
  406. type = 'fixed',
  407. fixed = {-.5, -.5, .4, .5, .5, .5},
  408. },
  409. groups = {oddly_breakable_by_hand = 3, snappy=3, not_in_creative_inventory=1},
  410. on_rightclick = function(pos, node)
  411. furniture.curtain_toggle(pos, node)
  412. end,
  413. on_dig = function(pos, node, digger)
  414. furniture.curtain_removal(pos, node, digger)
  415. end
  416. })
  417. minetest.register_node('furniture:curtain_ts_'..name..'_1', {
  418. description = 'Tall '..desc..' Curtain Open',
  419. drawtype = 'mesh',
  420. mesh = 'furniture_curtain_tall.obj',
  421. tiles = {'furniture_curtain_tall_1.png^[multiply:'..hex},
  422. use_texture_alpha = 'clip',
  423. inventory_image = 'furniture_curtain_tall_1.png^[multiply:'..hex,
  424. paramtype = 'light',
  425. paramtype2 = 'facedir',
  426. walkable = false,
  427. sunlight_propagates = true,
  428. selection_box = {
  429. type = 'fixed',
  430. fixed = {-.5, -.5, .4, .5, .5, .5},
  431. },
  432. collision_box = {
  433. type = 'fixed',
  434. fixed = {-.5, -.5, .4, .5, .5, .5},
  435. },
  436. groups = {oddly_breakable_by_hand = 3, snappy=3},
  437. on_rightclick = function(pos, node)
  438. furniture.curtain_toggle(pos, node)
  439. end,
  440. after_place_node = function(pos, placer, itemstack)
  441. furniture.curtain_placement(pos)
  442. end,
  443. on_dig = function(pos, node, digger)
  444. furniture.curtain_removal(pos, node, digger)
  445. end
  446. })
  447. minetest.register_node('furniture:curtain_tl_'..name..'_0', {
  448. _doc_items_create_entry = false,
  449. description = 'Tall Left '..desc..' Curtain Closed',
  450. drawtype = 'mesh',
  451. mesh = 'furniture_curtain_tall.obj',
  452. tiles = {'furniture_curtain_tall_0.png^[multiply:'..hex},
  453. use_texture_alpha = 'clip',
  454. paramtype = 'light',
  455. paramtype2 = 'facedir',
  456. drop = 'furniture:curtain_tl_'..name..'_1',
  457. selection_box = {
  458. type = 'fixed',
  459. fixed = {-.5, -.5, .4, .5, .5, .5},
  460. },
  461. collision_box = {
  462. type = 'fixed',
  463. fixed = {-.5, -.5, .4, .5, .5, .5},
  464. },
  465. groups = {oddly_breakable_by_hand = 3, snappy=3, not_in_creative_inventory=1},
  466. on_rightclick = function(pos, node)
  467. furniture.curtain_toggle(pos, node)
  468. end,
  469. on_dig = function(pos, node, digger)
  470. furniture.curtain_removal(pos, node, digger)
  471. end
  472. })
  473. minetest.register_node('furniture:curtain_tl_'..name..'_1', {
  474. _doc_items_create_entry = false,
  475. description = 'Tall Left '..desc..' Curtain Open',
  476. drawtype = 'mesh',
  477. mesh = 'furniture_curtain_tall.obj',
  478. tiles = {'furniture_curtain_tl_1.png^[multiply:'..hex},
  479. use_texture_alpha = 'clip',
  480. inventory_image = 'furniture_curtain_tl_1.png^[multiply:'..hex,
  481. paramtype = 'light',
  482. paramtype2 = 'facedir',
  483. walkable = false,
  484. sunlight_propagates = true,
  485. drop = 'furniture:curtain_tl_'..name..'_1',
  486. selection_box = {
  487. type = 'fixed',
  488. fixed = {-.5, -.5, .4, .5, .5, .5},
  489. },
  490. collision_box = {
  491. type = 'fixed',
  492. fixed = {-.5, -.5, .4, .5, .5, .5},
  493. },
  494. groups = {oddly_breakable_by_hand = 3, snappy=3, not_in_creative_inventory=1},
  495. on_rightclick = function(pos, node)
  496. furniture.curtain_toggle(pos, node)
  497. end,
  498. on_dig = function(pos, node, digger)
  499. furniture.curtain_removal(pos, node, digger)
  500. end
  501. })
  502. minetest.register_node('furniture:curtain_tr_'..name..'_0', {
  503. _doc_items_create_entry = false,
  504. description = 'Tall Right '..desc..' Curtain Closed',
  505. drawtype = 'mesh',
  506. mesh = 'furniture_curtain_tall.obj',
  507. tiles = {'furniture_curtain_tall_0.png^[multiply:'..hex},
  508. use_texture_alpha = 'clip',
  509. paramtype = 'light',
  510. paramtype2 = 'facedir',
  511. drop = 'furniture:curtain_tl_'..name..'_1',
  512. selection_box = {
  513. type = 'fixed',
  514. fixed = {-.5, -.5, .4, .5, .5, .5},
  515. },
  516. collision_box = {
  517. type = 'fixed',
  518. fixed = {-.5, -.5, .4, .5, .5, .5},
  519. },
  520. groups = {oddly_breakable_by_hand = 3, snappy=3, not_in_creative_inventory=1},
  521. on_rightclick = function(pos, node)
  522. furniture.curtain_toggle(pos, node)
  523. end,
  524. on_dig = function(pos, node, digger)
  525. furniture.curtain_removal(pos, node, digger)
  526. end
  527. })
  528. minetest.register_node('furniture:curtain_tr_'..name..'_1', {
  529. _doc_items_create_entry = false,
  530. description = 'Tall Right '..desc..' Curtain Open',
  531. drawtype = 'mesh',
  532. mesh = 'furniture_curtain_tall.obj',
  533. tiles = {'furniture_curtain_tr_1.png^[multiply:'..hex},
  534. use_texture_alpha = 'clip',
  535. inventory_image = 'furniture_curtain_tr_1.png^[multiply:'..hex,
  536. paramtype = 'light',
  537. paramtype2 = 'facedir',
  538. walkable = false,
  539. sunlight_propagates = true,
  540. drop = 'furniture:curtain_tl_'..name..'_1',
  541. selection_box = {
  542. type = 'fixed',
  543. fixed = {-.5, -.5, .4, .5, .5, .5},
  544. },
  545. collision_box = {
  546. type = 'fixed',
  547. fixed = {-.5, -.5, .4, .5, .5, .5},
  548. },
  549. groups = {oddly_breakable_by_hand = 3, snappy=3, not_in_creative_inventory=1},
  550. on_rightclick = function(pos, node)
  551. furniture.curtain_toggle(pos, node)
  552. end,
  553. on_dig = function(pos, node, digger)
  554. furniture.curtain_removal(pos, node, digger)
  555. end
  556. })
  557. minetest.register_node('furniture:curtain_tc_'..name..'_0', {
  558. _doc_items_create_entry = false,
  559. description = 'Tall Middle '..desc..' Curtain Closed',
  560. drawtype = 'mesh',
  561. mesh = 'furniture_curtain_tall.obj',
  562. tiles = {'furniture_curtain_tall_0.png^[multiply:'..hex},
  563. use_texture_alpha = 'clip',
  564. paramtype = 'light',
  565. paramtype2 = 'facedir',
  566. drop = 'furniture:curtain_tl_'..name..'_1',
  567. selection_box = {
  568. type = 'fixed',
  569. fixed = {-.5, -.5, .4, .5, .5, .5},
  570. },
  571. collision_box = {
  572. type = 'fixed',
  573. fixed = {-.5, -.5, .4, .5, .5, .5},
  574. },
  575. groups = {oddly_breakable_by_hand = 3, snappy=3, not_in_creative_inventory=1},
  576. on_rightclick = function(pos, node)
  577. furniture.curtain_toggle(pos, node)
  578. end,
  579. on_dig = function(pos, node, digger)
  580. furniture.curtain_removal(pos, node, digger)
  581. end
  582. })
  583. minetest.register_node('furniture:curtain_tc_'..name..'_1', {
  584. _doc_items_create_entry = false,
  585. description = 'Tall Middle '..desc..' Curtain Open',
  586. drawtype = 'mesh',
  587. mesh = 'furniture_curtain_tall.obj',
  588. tiles = {'furniture_curtain_tc_1.png^[multiply:'..hex},
  589. use_texture_alpha = 'clip',
  590. inventory_image = 'furniture_curtain_tc_1.png^[multiply:'..hex,
  591. paramtype = 'light',
  592. paramtype2 = 'facedir',
  593. walkable = false,
  594. sunlight_propagates = true,
  595. drop = 'furniture:curtain_tl_'..name..'_1',
  596. selection_box = {
  597. type = 'fixed',
  598. fixed = {-.5, -.5, .4, .5, .5, .5},
  599. },
  600. collision_box = {
  601. type = 'fixed',
  602. fixed = {-.5, -.5, .4, .5, .5, .5},
  603. },
  604. groups = {oddly_breakable_by_hand = 3, snappy=3, not_in_creative_inventory=1},
  605. on_rightclick = function(pos, node)
  606. furniture.curtain_toggle(pos, node)
  607. end,
  608. on_dig = function(pos, node, digger)
  609. furniture.curtain_removal(pos, node, digger)
  610. end
  611. })
  612. end