misc.lua 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. -- this component contains all of the random types of seating previously
  2. -- scattered among homedecor's other mods
  3. local dc_cbox = {
  4. type = "fixed",
  5. fixed = { -0.5, -0.5, -0.5, 0.5, 0, 1 }
  6. }
  7. homedecor.register("deckchair", {
  8. mesh = "homedecor_deckchair.obj",
  9. tiles = {"homedecor_deckchair.png"},
  10. description = "Deck Chair",
  11. groups = { snappy = 3 },
  12. expand = { forward="placeholder" },
  13. sounds = default.node_sound_wood_defaults(),
  14. selection_box = dc_cbox,
  15. collision_box = dc_cbox,
  16. on_rotate = minetest.get_modpath("screwdriver") and screwdriver.disallow or nil,
  17. })
  18. minetest.register_alias("homedecor:deckchair_foot", "homedecor:deckchair")
  19. minetest.register_alias("homedecor:deckchair_head", "air")
  20. homedecor.register("deckchair_striped_blue", {
  21. mesh = "homedecor_deckchair.obj",
  22. tiles = {"homedecor_deckchair_striped_blue.png"},
  23. description = "Deck Chair (blue striped)",
  24. groups = { snappy = 3 },
  25. expand = { forward="placeholder" },
  26. sounds = default.node_sound_wood_defaults(),
  27. selection_box = dc_cbox,
  28. collision_box = dc_cbox,
  29. on_rotate = minetest.get_modpath("screwdriver") and screwdriver.disallow or nil,
  30. })
  31. homedecor.register("simple_bench", {
  32. tiles = { "homedecor_generic_wood_old.png" },
  33. description = "Simple Bench",
  34. groups = {snappy=3},
  35. node_box = {
  36. type = "fixed",
  37. fixed = {
  38. {-0.5, -0.15, 0, 0.5, -0.05, 0.4},
  39. {-0.4, -0.5, 0.1, -0.3, -0.15, 0.3},
  40. { 0.3, -0.5, 0.1, 0.4, -0.15, 0.3},
  41. }
  42. },
  43. sounds = default.node_sound_wood_defaults(),
  44. })
  45. local bl1_sbox = {
  46. type = "fixed",
  47. fixed = { -0.5, -0.5, -0.25, 1.5, 0.5, 0.5 }
  48. }
  49. local bl1_cbox = {
  50. type = "fixed",
  51. fixed = {
  52. {-0.5, -0.5, -0.25, 1.5, 0, 0.5 },
  53. {-0.5, -0.5, 0.45, 1.5, 0.5, 0.5 },
  54. }
  55. }
  56. homedecor.register("bench_large_1", {
  57. mesh = "homedecor_bench_large_1.obj",
  58. tiles = {
  59. "homedecor_generic_wood_old.png",
  60. "homedecor_generic_metal_wrought_iron.png"
  61. },
  62. description = "Garden Bench (style 1)",
  63. inventory_image = "homedecor_bench_large_1_inv.png",
  64. groups = { snappy = 3 },
  65. expand = { right="placeholder" },
  66. sounds = default.node_sound_wood_defaults(),
  67. selection_box = bl1_sbox,
  68. node_box = bl1_cbox,
  69. on_rotate = minetest.get_modpath("screwdriver") and screwdriver.disallow or nil,
  70. })
  71. minetest.register_alias("homedecor:bench_large_1_left", "homedecor:bench_large_1")
  72. minetest.register_alias("homedecor:bench_large_1_right", "air")
  73. local bl2_sbox = {
  74. type = "fixed",
  75. fixed = { -0.5, -0.5, -0.25, 1.5, 0.5, 0.5 }
  76. }
  77. local bl2_cbox = {
  78. type = "fixed",
  79. fixed = {
  80. {-0.5, -0.5, -0.25, 1.5, 0, 0.5 },
  81. {-0.5, -0.5, 0.45, 1.5, 0.5, 0.5 },
  82. }
  83. }
  84. homedecor.register("bench_large_2", {
  85. description = "Garden Bench (style 2)",
  86. mesh = "homedecor_bench_large_2.obj",
  87. tiles = { "homedecor_generic_wood_old.png" },
  88. inventory_image = "homedecor_bench_large_2_inv.png",
  89. groups = {snappy=3},
  90. selection_box = bl2_sbox,
  91. node_box = bl2_cbox,
  92. expand = { right="placeholder" },
  93. sounds = default.node_sound_wood_defaults(),
  94. on_rotate = minetest.get_modpath("screwdriver") and screwdriver.disallow or nil,
  95. })
  96. minetest.register_alias("homedecor:bench_large_2_left", "homedecor:bench_large_2")
  97. minetest.register_alias("homedecor:bench_large_2_right", "air")
  98. local kc_cbox = {
  99. type = "fixed",
  100. fixed = { -0.3125, -0.3125, -0.5, 0.3125, 0.3125, 0.5 },
  101. }
  102. homedecor.register("kitchen_chair_wood", {
  103. description = "Kitchen chair",
  104. mesh = "homedecor_kitchen_chair.obj",
  105. tiles = {
  106. homedecor.plain_wood,
  107. homedecor.plain_wood
  108. },
  109. inventory_image = "homedecor_chair_wood_inv.png",
  110. paramtype2 = "wallmounted",
  111. selection_box = kc_cbox,
  112. collision_box = kc_cbox,
  113. groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},
  114. sounds = default.node_sound_wood_defaults(),
  115. after_place_node = unifieddyes.fix_rotation_nsew,
  116. on_rotate = unifieddyes.fix_after_screwdriver_nsew,
  117. on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
  118. pos.y = pos.y+0 -- where do I put my ass ?
  119. homedecor.sit(pos, node, clicker)
  120. return itemstack
  121. end
  122. })
  123. homedecor.register("kitchen_chair_padded", {
  124. description = "Kitchen chair",
  125. mesh = "homedecor_kitchen_chair.obj",
  126. tiles = {
  127. homedecor.plain_wood,
  128. "wool_white.png",
  129. },
  130. inventory_image = "homedecor_chair_padded_inv.png",
  131. paramtype2 = "colorwallmounted",
  132. palette = "unifieddyes_palette_colorwallmounted.png",
  133. selection_box = kc_cbox,
  134. collision_box = kc_cbox,
  135. groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, ud_param2_colorable = 1},
  136. sounds = default.node_sound_wood_defaults(),
  137. after_place_node = function(pos, placer, itemstack, pointed_thing)
  138. unifieddyes.fix_rotation_nsew(pos, placer, itemstack, pointed_thing)
  139. end,
  140. on_dig = unifieddyes.on_dig,
  141. on_rotate = unifieddyes.fix_after_screwdriver_nsew,
  142. on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
  143. pos.y = pos.y+0 -- where do I put my ass ?
  144. homedecor.sit(pos, node, clicker)
  145. return itemstack
  146. end
  147. })
  148. local ofchairs_sbox = {
  149. type = "fixed",
  150. fixed = { -8/16, -8/16, -8/16, 8/16, 29/32, 8/16 }
  151. }
  152. local ofchairs_cbox = {
  153. type = "fixed",
  154. fixed = {
  155. { -5/16, 1/16, -7/16, 5/16, 4/16, 7/16 }, -- seat
  156. { -5/16, 4/16, 4/16, 5/16, 29/32, 15/32 }, -- seatback
  157. { -1/16, -11/32, -1/16, 1/16, 1/16, 1/16 }, -- cylinder
  158. { -8/16, -8/16, -8/16, 8/16, -11/32, 8/16 } -- legs/wheels
  159. }
  160. }
  161. local chairs = {
  162. { "basic", "Basic office chair" },
  163. { "upscale", "Upscale office chair" },
  164. }
  165. for _, c in pairs(chairs) do
  166. local name, desc = unpack(c)
  167. homedecor.register("office_chair_"..name, {
  168. description = desc,
  169. drawtype = "mesh",
  170. tiles = { "homedecor_office_chair_"..name..".png" },
  171. mesh = "homedecor_office_chair_"..name..".obj",
  172. groups = { snappy = 3 },
  173. sounds = default.node_sound_wood_defaults(),
  174. selection_box = ofchairs_sbox,
  175. collision_box = ofchairs_cbox,
  176. expand = { top = "placeholder" },
  177. on_rotate = minetest.get_modpath("screwdriver") and screwdriver.rotate_simple or nil,
  178. })
  179. end
  180. -- crafts!
  181. minetest.register_craft( {
  182. output = "homedecor:bench_large_1",
  183. recipe = {
  184. { "group:wood", "group:wood", "group:wood" },
  185. { "group:wood", "group:wood", "group:wood" },
  186. { "basic_materials:steel_bar", "", "basic_materials:steel_bar" }
  187. },
  188. })
  189. minetest.register_craft( {
  190. output = "homedecor:bench_large_2_left",
  191. recipe = {
  192. { "homedecor:shutter_oak", "homedecor:shutter_oak", "homedecor:shutter_oak" },
  193. { "group:wood", "group:wood", "group:wood" },
  194. { "stairs:slab_wood", "", "stairs:slab_wood" }
  195. },
  196. })
  197. minetest.register_craft( {
  198. output = "homedecor:bench_large_2_left",
  199. recipe = {
  200. { "homedecor:shutter_oak", "homedecor:shutter_oak", "homedecor:shutter_oak" },
  201. { "group:wood", "group:wood", "group:wood" },
  202. { "moreblocks:slab_wood", "", "moreblocks:slab_wood" }
  203. },
  204. })
  205. minetest.register_craft( {
  206. output = "homedecor:simple_bench",
  207. recipe = {
  208. { "stairs:slab_wood", "stairs:slab_wood", "stairs:slab_wood" },
  209. { "stairs:slab_wood", "", "stairs:slab_wood" }
  210. },
  211. })
  212. minetest.register_craft( {
  213. output = "homedecor:simple_bench",
  214. recipe = {
  215. { "moreblocks:slab_wood", "moreblocks:slab_wood", "moreblocks:slab_wood" },
  216. { "moreblocks:slab_wood", "", "moreblocks:slab_wood" }
  217. },
  218. })
  219. minetest.register_craft({
  220. output = "homedecor:deckchair",
  221. recipe = {
  222. { "group:stick", "building_blocks:terrycloth_towel", "group:stick" },
  223. { "group:stick", "building_blocks:terrycloth_towel", "group:stick" },
  224. { "group:stick", "building_blocks:terrycloth_towel", "group:stick" }
  225. },
  226. })
  227. minetest.register_craft({
  228. output = "homedecor:deckchair_striped_blue",
  229. type = "shapeless",
  230. recipe = {
  231. "homedecor:deckchair",
  232. "dye:blue"
  233. }
  234. })
  235. minetest.register_craft({
  236. output = "homedecor:kitchen_chair_wood 2",
  237. recipe = {
  238. { "group:stick",""},
  239. { "group:wood","group:wood" },
  240. { "group:stick","group:stick" },
  241. },
  242. })
  243. minetest.register_craft({
  244. type = "shapeless",
  245. output = "homedecor:kitchen_chair_padded",
  246. recipe = {
  247. "homedecor:kitchen_chair_wood",
  248. "wool:white",
  249. },
  250. })
  251. unifieddyes.register_color_craft({
  252. output = "homedecor:kitchen_chair_padded",
  253. palette = "wallmounted",
  254. type = "shapeless",
  255. neutral_node = "homedecor:kitchen_chair_padded",
  256. recipe = {
  257. "NEUTRAL_NODE",
  258. "MAIN_DYE"
  259. }
  260. })
  261. minetest.register_craft({
  262. type = "fuel",
  263. recipe = "homedecor:kitchen_chair_wood",
  264. burntime = 15,
  265. })
  266. minetest.register_craft({
  267. type = "fuel",
  268. recipe = "homedecor:kitchen_chair_padded",
  269. burntime = 15,
  270. })
  271. minetest.register_craft({
  272. output = "homedecor:office_chair_basic",
  273. recipe = {
  274. { "", "", "wool:black" },
  275. { "", "wool:black", "default:steel_ingot" },
  276. { "group:stick", "basic_materials:steel_bar", "group:stick" }
  277. },
  278. })
  279. minetest.register_craft({
  280. output = "homedecor:office_chair_upscale",
  281. recipe = {
  282. { "dye:black", "building_blocks:sticks", "group:wool" },
  283. { "basic_materials:plastic_sheet", "group:wool", "default:steel_ingot" },
  284. { "building_blocks:sticks", "basic_materials:steel_bar", "building_blocks:sticks" }
  285. },
  286. })
  287. -- aliases
  288. minetest.register_alias("3dforniture:chair", "homedecor:chair")
  289. minetest.register_alias('chair', 'homedecor:chair')