decor.lua 23 KB

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