curtains.lua 23 KB

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