seating.lua 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. minetest.register_node('furniture:half_seat', {
  2. description = 'Half seat with no back',
  3. drawtype = 'airlike',
  4. paramtype = 'light',
  5. pointable = true,
  6. diggable = false,
  7. drop = '',
  8. groups = {not_in_creative_inventory = 1, empty_node=1},
  9. on_blast = function() end,
  10. tiles = {'epic_blank.png'},
  11. selection_box= {
  12. type = 'fixed',
  13. fixed = {-.375, -.5, -.375, .375, .0125, .375}
  14. },
  15. on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
  16. pos.y = pos.y + 0
  17. furniture.sit(pos, node, clicker, pointed_thing, false)
  18. return itemstack
  19. end,
  20. })
  21. minetest.register_node('furniture:half_seat_back', {
  22. description = 'Half seat with no back',
  23. drawtype = 'airlike',
  24. paramtype = 'light',
  25. pointable = true,
  26. diggable = false,
  27. drop = '',
  28. groups = {not_in_creative_inventory = 1, empty_node=1},
  29. on_blast = function() end,
  30. tiles = {'epic_blank.png'},
  31. selection_box= {
  32. type = 'fixed',
  33. fixed = {-.375, -.5, -.375, .375, .0125, .375}
  34. },
  35. on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
  36. pos.y = pos.y + 0
  37. furniture.sit(pos, node, clicker, pointed_thing, true)
  38. return itemstack
  39. end,
  40. })
  41. minetest.register_node('furniture:stool_short', {
  42. _doc_items_crafting = 'This is crafted in the Woodworking Station.',
  43. description = 'Short stool',
  44. drawtype = 'mesh',
  45. mesh = 'furniture_stool_short.obj',
  46. tiles = {'furniture_stool_short.png'},
  47. paramtype = 'light',
  48. paramtype2 = 'colorfacedir',
  49. palette = 'furniture_stain_palette.png',
  50. selection_box = {
  51. type = 'fixed',
  52. fixed = {-.375, -.5, -.375, .375, 0, .375},
  53. },
  54. collision_box = {
  55. type = 'fixed',
  56. fixed = {-.375, -.5, -.375, .375, 0, .375},
  57. },
  58. groups = {oddly_breakable_by_hand = 2, choppy=3, stainable=1},
  59. on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
  60. pos.y = pos.y + 0
  61. furniture.sit(pos, node, clicker, pointed_thing, false)
  62. return itemstack
  63. end
  64. })
  65. minetest.register_node('furniture:stool_tall', {
  66. _doc_items_crafting = 'This is crafted in the Woodworking Station.',
  67. description = 'Tall stool',
  68. drawtype = 'mesh',
  69. mesh = 'furniture_stool_tall.obj',
  70. tiles = {'furniture_stool_tall.png'},
  71. paramtype = 'light',
  72. paramtype2 = 'colorfacedir',
  73. palette = 'furniture_stain_palette.png',
  74. selection_box = {
  75. type = 'fixed',
  76. fixed = {-.375, -.5, -.375, .375, .5, .375},
  77. },
  78. collision_box = {
  79. type = 'fixed',
  80. fixed = {-.375, -.5, -.375, .375, .5, .375},
  81. },
  82. groups = {oddly_breakable_by_hand = 2, choppy=3, stainable=1},
  83. on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
  84. pos.y = pos.y + .5
  85. furniture.sit(pos, node, clicker, pointed_thing, false)
  86. return itemstack
  87. end
  88. })
  89. minetest.register_node('furniture:chair', {
  90. _doc_items_crafting = 'This is crafted in the Woodworking Station.',
  91. description = 'Chair',
  92. drawtype = 'mesh',
  93. mesh = 'furniture_chair.obj',
  94. tiles = {'furniture_chair.png'},
  95. paramtype = 'light',
  96. paramtype2 = 'colorfacedir',
  97. palette = 'furniture_stain_palette.png',
  98. selection_box = {
  99. type = 'fixed',
  100. fixed = {-.375, -.5, -.375, .375, 0, .375},
  101. },
  102. collision_box = {
  103. type = 'fixed',
  104. fixed = {-.375, -.5, -.375, .375, 0, .375},
  105. },
  106. groups = {oddly_breakable_by_hand = 2, choppy=3, stainable=1},
  107. on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
  108. pos.y = pos.y + 0
  109. furniture.sit(pos, node, clicker, pointed_thing, true)
  110. return itemstack
  111. end
  112. })
  113. minetest.register_node('furniture:bench', {
  114. _doc_items_crafting = 'This is crafted in the Woodworking Station.',
  115. description = 'Bench',
  116. drawtype = 'mesh',
  117. mesh = 'furniture_bench.obj',
  118. tiles = {'furniture_bench.png'},
  119. paramtype = 'light',
  120. paramtype2 = 'colorfacedir',
  121. palette = 'furniture_stain_palette.png',
  122. selection_box = {
  123. type = 'fixed',
  124. fixed = {-.375, -.5, -.375, 1.375, 0, .375},
  125. },
  126. collision_box = {
  127. type = 'fixed',
  128. fixed = {-.375, -.5, -.375, 1.375, 0, .375},
  129. },
  130. groups = {oddly_breakable_by_hand = 2, choppy=3, stainable=1},
  131. on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
  132. pos.y = pos.y + 0
  133. furniture.sit(pos, node, clicker, pointed_thing, false)
  134. return itemstack
  135. end,
  136. after_place_node = function(pos, placer, itemstack)
  137. if not epic.space_to_side(pos, 'furniture:half_seat') then
  138. minetest.remove_node(pos)
  139. return itemstack
  140. end
  141. end,
  142. after_dig_node = function(pos, oldnode, oldmetadata, digger)
  143. epic.remove_side_node(pos, oldnode)
  144. end,
  145. on_rotate = function(pos, node)
  146. return false
  147. end,
  148. })
  149. minetest.register_node('furniture:bench_with_back', {
  150. _doc_items_crafting = 'This is crafted in the Woodworking Station.',
  151. description = 'Bench with Back',
  152. drawtype = 'mesh',
  153. mesh = 'furniture_bench_with_back.obj',
  154. tiles = {'furniture_bench.png'},
  155. paramtype = 'light',
  156. paramtype2 = 'colorfacedir',
  157. palette = 'furniture_stain_palette.png',
  158. selection_box = {
  159. type = 'fixed',
  160. fixed = {{-.375, -.5, -.375, .5, 0, .45}, --seat
  161. {-.375, 0, .275, 1.375, .5, .375}} --back
  162. },
  163. collision_box = {
  164. type = 'fixed',
  165. fixed = {{-.375, -.5, -.375, 1.375, 0, .45},
  166. {-.375, 0, .275, 1.375, .5, .375}}
  167. },
  168. groups = {oddly_breakable_by_hand = 2, choppy=3, stainable=1},
  169. on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
  170. pos.y = pos.y + 0
  171. furniture.sit(pos, node, clicker, pointed_thing, true)
  172. return itemstack
  173. end,
  174. after_place_node = function(pos, placer, itemstack)
  175. if not epic.space_to_side(pos, 'furniture:half_seat_back') then
  176. minetest.remove_node(pos)
  177. return itemstack
  178. end
  179. end,
  180. after_dig_node = function(pos, oldnode, oldmetadata, digger)
  181. epic.remove_side_node(pos, oldnode)
  182. end,
  183. on_rotate = function(pos, node)
  184. return false
  185. end,
  186. })
  187. minetest.register_node('furniture:bench_picnic', {
  188. _doc_items_crafting = 'This is crafted in the Woodworking Station.',
  189. description = 'Picnic Table',
  190. drawtype = 'mesh',
  191. mesh = 'furniture_bench_picnic.obj',
  192. tiles = {'furniture_bench_picnic.png'},
  193. paramtype = 'light',
  194. paramtype2 = 'colorfacedir',
  195. palette = 'furniture_stain_palette.png',
  196. selection_box = {
  197. type = 'fixed',
  198. fixed = {
  199. {-.375, -.5, -.375, 1.375, 0, 1.375},
  200. {-.375, 0, -.0625, 1.375, .5, 1.0625}
  201. }
  202. },
  203. collision_box = {
  204. type = 'fixed',
  205. fixed = {
  206. {-.375, -.5, -.375, 1.375, 0, 1.375},
  207. {-.375, 0, -.0625, 1.375, .5, 1.0625}
  208. }
  209. },
  210. groups = {oddly_breakable_by_hand = 2, choppy=3, stainable=1},
  211. on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
  212. pos.y = pos.y + 0
  213. furniture.sit(pos, node, clicker, pointed_thing, false)
  214. return itemstack
  215. end,
  216. after_place_node = function(pos, placer, itemstack)
  217. if not epic.space_for_picnic(pos, 'furniture:half_seat') then
  218. minetest.remove_node(pos)
  219. return itemstack
  220. end
  221. end,
  222. after_dig_node = function(pos, oldnode, oldmetadata, digger)
  223. epic.remove_picnic_nodes(pos, oldnode)
  224. end,
  225. on_rotate = function(pos, node)
  226. return false
  227. end,
  228. })
  229. ---Cushioned items. Yay. :P
  230. local dye_table = dye.dyes
  231. for i in ipairs(dye_table) do
  232. local name = dye_table[i][1]
  233. local desc = dye_table[i][2]
  234. local hex = dye_table[i][3]
  235. minetest.register_node('furniture:stool_short_'..name, {
  236. _doc_items_crafting = 'This is crafted in the Woodworking Station.',
  237. description = 'Short Stool with '..desc..' Cushion',
  238. drawtype = 'mesh',
  239. mesh = 'furniture_stool_short_cushion.obj',
  240. tiles = {'furniture_stool_short.png', 'furniture_cushion_pad.png'},
  241. overlay_tiles = {'', {name = 'furniture_cushion_pad.png', color = hex}},
  242. paramtype = 'light',
  243. paramtype2 = 'colorfacedir',
  244. palette = 'furniture_stain_palette.png',
  245. selection_box = {
  246. type = 'fixed',
  247. fixed = {-.375, -.5, -.375, .375, 0, .375},
  248. },
  249. collision_box = {
  250. type = 'fixed',
  251. fixed = {-.375, -.5, -.375, .375, 0, .375},
  252. },
  253. groups = {oddly_breakable_by_hand = 2, choppy=3, stainable=1},
  254. on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
  255. pos.y = pos.y + 0
  256. furniture.sit(pos, node, clicker, pointed_thing, false)
  257. return itemstack
  258. end
  259. })
  260. minetest.register_node('furniture:stool_tall_'..name, {
  261. _doc_items_crafting = 'This is crafted in the Woodworking Station.',
  262. description = 'Tall Stool with '..desc..' Cushion',
  263. drawtype = 'mesh',
  264. mesh = 'furniture_stool_tall_cushion.obj',
  265. tiles = {'furniture_stool_tall.png', 'furniture_cushion_pad.png'},
  266. overlay_tiles = {'', {name = 'furniture_cushion_pad.png', color = hex}},
  267. paramtype = 'light',
  268. paramtype2 = 'colorfacedir',
  269. palette = 'furniture_stain_palette.png',
  270. selection_box = {
  271. type = 'fixed',
  272. fixed = {-.375, -.5, -.375, .375, .5, .375},
  273. },
  274. collision_box = {
  275. type = 'fixed',
  276. fixed = {-.375, -.5, -.375, .375, .5, .375},
  277. },
  278. groups = {oddly_breakable_by_hand = 2, choppy=3, stainable=1},
  279. on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
  280. pos.y = pos.y + .5
  281. furniture.sit(pos, node, clicker, pointed_thing, false)
  282. return itemstack
  283. end
  284. })
  285. minetest.register_node('furniture:chair_'..name, {
  286. _doc_items_crafting = 'This is crafted in the Woodworking Station.',
  287. description = 'Chair with '..desc..' Cushion',
  288. drawtype = 'mesh',
  289. mesh = 'furniture_chair_cushion.obj',
  290. tiles = {'furniture_chair.png', 'furniture_cushion_pad.png'},
  291. overlay_tiles = {'', {name = 'furniture_cushion_pad.png', color = hex}},
  292. paramtype = 'light',
  293. paramtype2 = 'colorfacedir',
  294. palette = 'furniture_stain_palette.png',
  295. selection_box = {
  296. type = 'fixed',
  297. fixed = {-.375, -.5, -.375, .375, 0, .375},
  298. },
  299. collision_box = {
  300. type = 'fixed',
  301. fixed = {-.375, -.5, -.375, .375, 0, .375},
  302. },
  303. groups = {oddly_breakable_by_hand = 2, choppy=3, stainable=1},
  304. on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
  305. pos.y = pos.y + 0
  306. furniture.sit(pos, node, clicker, pointed_thing, true)
  307. return itemstack
  308. end
  309. })
  310. minetest.register_node('furniture:cushion_half_'..name, {
  311. _doc_items_crafting = 'This is crafted in the Sewing Station.',
  312. description = desc..' Half Cushion',
  313. drawtype = 'nodebox',
  314. tiles = {'furniture_cushion.png^[multiply:'..hex},
  315. paramtype = 'light',
  316. node_box = {
  317. type = 'fixed',
  318. fixed = {-.5, -.5, -.5, .5, 0, .5},
  319. },
  320. groups = {oddly_breakable_by_hand = 2, snappy=3, bouncy=50},
  321. on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
  322. pos.y = pos.y + 0
  323. furniture.sit(pos, node, clicker, pointed_thing, false)
  324. return itemstack
  325. end
  326. })
  327. minetest.register_node('furniture:cushion_full_'..name, {
  328. _doc_items_crafting = 'This is crafted in the Sewing Station.',
  329. description = desc..' Full Cushion',
  330. tiles = {'furniture_cushion.png^[multiply:'..hex},
  331. groups = {oddly_breakable_by_hand = 2, snappy=3, bouncy=50},
  332. on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
  333. pos.y = pos.y + .5
  334. furniture.sit(pos, node, clicker, pointed_thing, false)
  335. return itemstack
  336. end
  337. })
  338. end