init.lua 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558
  1. -- This file supplies Kitchen stuff like refrigerators, sinks, etc.
  2. local S = minetest.get_translator("homedecor_kitchen")
  3. -- steel-textured fridge
  4. homedecor.register("refrigerator_steel", {
  5. mesh = "homedecor_refrigerator.obj",
  6. tiles = { "homedecor_refrigerator_steel.png" },
  7. inventory_image = "homedecor_refrigerator_steel_inv.png",
  8. description = S("Refrigerator (stainless steel)"),
  9. groups = {snappy=3},
  10. sounds = default.node_sound_stone_defaults(),
  11. selection_box = homedecor.nodebox.slab_y(2),
  12. collision_box = homedecor.nodebox.slab_y(2),
  13. expand = { top="placeholder" },
  14. infotext=S("Refrigerator"),
  15. inventory = {
  16. size=50,
  17. lockable=true,
  18. },
  19. on_rotate = minetest.get_modpath("screwdriver") and screwdriver.rotate_simple or nil,
  20. })
  21. -- white, enameled fridge
  22. homedecor.register("refrigerator_white", {
  23. mesh = "homedecor_refrigerator.obj",
  24. tiles = { "homedecor_refrigerator_white.png" },
  25. inventory_image = "homedecor_refrigerator_white_inv.png",
  26. description = S("Refrigerator"),
  27. groups = {snappy=3},
  28. selection_box = homedecor.nodebox.slab_y(2),
  29. collision_box = homedecor.nodebox.slab_y(2),
  30. sounds = default.node_sound_stone_defaults(),
  31. expand = { top="placeholder" },
  32. infotext=S("Refrigerator"),
  33. inventory = {
  34. size=50,
  35. lockable=true,
  36. },
  37. on_rotate = minetest.get_modpath("screwdriver") and screwdriver.rotate_simple or nil,
  38. })
  39. minetest.register_alias("homedecor:refrigerator_white_bottom", "homedecor:refrigerator_white")
  40. minetest.register_alias("homedecor:refrigerator_white_top", "air")
  41. minetest.register_alias("homedecor:refrigerator_steel_bottom", "homedecor:refrigerator_steel")
  42. minetest.register_alias("homedecor:refrigerator_steel_top", "air")
  43. minetest.register_alias("homedecor:refrigerator_white_bottom_locked", "homedecor:refrigerator_white_locked")
  44. minetest.register_alias("homedecor:refrigerator_white_top_locked", "air")
  45. minetest.register_alias("homedecor:refrigerator_locked", "homedecor:refrigerator_white_locked")
  46. minetest.register_alias("homedecor:refrigerator_steel_bottom_locked", "homedecor:refrigerator_steel_locked")
  47. minetest.register_alias("homedecor:refrigerator_steel_top_locked", "air")
  48. -- kitchen "furnaces"
  49. homedecor.register_furnace("oven", {
  50. description = S("Oven"),
  51. tile_format = "homedecor_oven_%s%s.png",
  52. output_slots = 4,
  53. output_width = 2,
  54. cook_speed = 1.25,
  55. })
  56. homedecor.register_furnace("oven_steel", {
  57. description = S("Oven (stainless steel)"),
  58. tile_format = "homedecor_oven_steel_%s%s.png",
  59. output_slots = 4,
  60. output_width = 2,
  61. cook_speed = 1.25,
  62. })
  63. homedecor.register_furnace("microwave_oven", {
  64. description = S("Microwave Oven"),
  65. tiles = {
  66. "homedecor_microwave_top.png", "homedecor_microwave_top.png^[transformR180",
  67. "homedecor_microwave_top.png^[transformR270", "homedecor_microwave_top.png^[transformR90",
  68. "homedecor_microwave_top.png^[transformR180", "homedecor_microwave_front.png"
  69. },
  70. tiles_active = {
  71. "homedecor_microwave_top.png", "homedecor_microwave_top.png^[transformR180",
  72. "homedecor_microwave_top.png^[transformR270", "homedecor_microwave_top.png^[transformR90",
  73. "homedecor_microwave_top.png^[transformR180", "homedecor_microwave_front_active.png"
  74. },
  75. output_slots = 2,
  76. output_width = 2,
  77. cook_speed = 1.5,
  78. extra_nodedef_fields = {
  79. node_box = {
  80. type = "fixed",
  81. fixed = { -0.5, -0.5, -0.125, 0.5, 0.125, 0.5 },
  82. },
  83. },
  84. })
  85. homedecor.register("dishwasher", {
  86. description = S("Dishwasher"),
  87. drawtype = "nodebox",
  88. tiles = {
  89. "homedecor_dishwasher_top.png",
  90. "homedecor_dishwasher_bottom.png",
  91. "homedecor_dishwasher_sides.png",
  92. "homedecor_dishwasher_sides.png^[transformFX",
  93. "homedecor_dishwasher_back.png",
  94. "homedecor_dishwasher_front.png"
  95. },
  96. node_box = {
  97. type = "fixed",
  98. fixed = {
  99. {-0.5, -0.5, -0.5, 0.5, -0.4375, 0.5},
  100. {-0.5, -0.5, -0.5, 0.5, 0.5, -0.4375},
  101. {-0.5, -0.5, -0.5, 0.5, 0.1875, 0.1875},
  102. {-0.4375, -0.5, -0.5, 0.4375, 0.4375, 0.4375},
  103. }
  104. },
  105. selection_box = { type = "regular" },
  106. sounds = default.node_sound_stone_defaults(),
  107. groups = { snappy = 3 },
  108. })
  109. local materials = { ["granite"] = S("granite"), ["marble"] = S("marble"), ["steel"] = S("steel"), ["wood"] = S("wood") }
  110. for m, m_loc in pairs(materials) do
  111. homedecor.register("dishwasher_"..m, {
  112. description = S("Dishwasher (@1)", m_loc),
  113. tiles = {
  114. "homedecor_kitchen_cabinet_top_"..m..".png",
  115. "homedecor_dishwasher_bottom.png",
  116. "homedecor_dishwasher_sides.png",
  117. "homedecor_dishwasher_sides.png^[transformFX",
  118. "homedecor_dishwasher_back.png",
  119. "homedecor_dishwasher_front.png"
  120. },
  121. groups = { snappy = 3 },
  122. sounds = default.node_sound_stone_defaults(),
  123. })
  124. end
  125. local cabinet_sides = "(default_wood.png^[transformR90)^homedecor_kitchen_cabinet_bevel.png"
  126. local cabinet_bottom = "(default_wood.png^[colorize:#000000:100)"
  127. .."^(homedecor_kitchen_cabinet_bevel.png^[colorize:#46321580)"
  128. local function N_(x) return x end
  129. local counter_materials = { "", N_("granite"), N_("marble"), N_("steel") }
  130. for _, mat in ipairs(counter_materials) do
  131. local desc = S("Kitchen Cabinet")
  132. local material = ""
  133. if mat ~= "" then
  134. desc = S("Kitchen Cabinet (@1 top)", S(mat))
  135. material = "_"..mat
  136. end
  137. homedecor.register("kitchen_cabinet"..material, {
  138. description = desc,
  139. tiles = { 'homedecor_kitchen_cabinet_top'..material..'.png',
  140. cabinet_bottom,
  141. cabinet_sides,
  142. cabinet_sides,
  143. cabinet_sides,
  144. 'homedecor_kitchen_cabinet_front.png'},
  145. groups = { snappy = 3 },
  146. sounds = default.node_sound_wood_defaults(),
  147. infotext=S("Kitchen Cabinet"),
  148. inventory = {
  149. size=24,
  150. lockable=true,
  151. },
  152. })
  153. end
  154. local kitchen_cabinet_half_box = homedecor.nodebox.slab_y(0.5, 0.5)
  155. homedecor.register("kitchen_cabinet_half", {
  156. description = S('Half-height Kitchen Cabinet (on ceiling)'),
  157. tiles = {
  158. cabinet_sides,
  159. cabinet_bottom,
  160. cabinet_sides,
  161. cabinet_sides,
  162. cabinet_sides,
  163. 'homedecor_kitchen_cabinet_front_half.png'
  164. },
  165. selection_box = kitchen_cabinet_half_box,
  166. node_box = kitchen_cabinet_half_box,
  167. groups = { snappy = 3 },
  168. sounds = default.node_sound_wood_defaults(),
  169. infotext=S("Kitchen Cabinet"),
  170. inventory = {
  171. size=12,
  172. lockable=true,
  173. },
  174. })
  175. homedecor.register("kitchen_cabinet_with_sink", {
  176. description = S("Kitchen Cabinet with sink"),
  177. mesh = "homedecor_kitchen_sink.obj",
  178. tiles = {
  179. "homedecor_kitchen_sink_top.png",
  180. "homedecor_kitchen_cabinet_front.png",
  181. cabinet_sides,
  182. cabinet_bottom
  183. },
  184. groups = { snappy = 3 },
  185. sounds = default.node_sound_wood_defaults(),
  186. infotext=S("Under-sink cabinet"),
  187. inventory = {
  188. size=16,
  189. lockable=true,
  190. },
  191. node_box = {
  192. type = "fixed",
  193. fixed = {
  194. { -8/16, -8/16, -8/16, 8/16, 6/16, 8/16 },
  195. { -8/16, 6/16, -8/16, -6/16, 8/16, 8/16 },
  196. { 6/16, 6/16, -8/16, 8/16, 8/16, 8/16 },
  197. { -8/16, 6/16, -8/16, 8/16, 8/16, -6/16 },
  198. { -8/16, 6/16, 6/16, 8/16, 8/16, 8/16 },
  199. }
  200. },
  201. on_destruct = function(pos)
  202. homedecor.stop_particle_spawner({x=pos.x, y=pos.y+1, z=pos.z})
  203. end
  204. })
  205. local cp_cbox = {
  206. type = "fixed",
  207. fixed = { -0.375, -0.5, -0.5, 0.375, -0.3125, 0.3125 }
  208. }
  209. homedecor.register("copper_pans", {
  210. description = S("Copper pans"),
  211. mesh = "homedecor_copper_pans.obj",
  212. tiles = { "homedecor_polished_copper.png" },
  213. inventory_image = "homedecor_copper_pans_inv.png",
  214. groups = { snappy=3 },
  215. selection_box = cp_cbox,
  216. walkable = false,
  217. on_place = minetest.rotate_node
  218. })
  219. local kf_cbox = {
  220. type = "fixed",
  221. fixed = { -2/16, -8/16, 1/16, 2/16, -1/16, 8/16 }
  222. }
  223. homedecor.register("kitchen_faucet", {
  224. mesh = "homedecor_kitchen_faucet.obj",
  225. tiles = { "homedecor_generic_metal_bright.png" },
  226. inventory_image = "homedecor_kitchen_faucet_inv.png",
  227. description = S("Kitchen Faucet"),
  228. groups = {snappy=3},
  229. selection_box = kf_cbox,
  230. walkable = false,
  231. on_rotate = minetest.get_modpath("screwdriver") and screwdriver.disallow or nil,
  232. on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
  233. local below = minetest.get_node_or_nil({x=pos.x, y=pos.y-1, z=pos.z})
  234. if below and
  235. below.name == "homedecor:sink" or
  236. below.name == "homedecor:kitchen_cabinet_with_sink" or
  237. below.name == "homedecor:kitchen_cabinet_with_sink_locked" then
  238. local particledef = {
  239. outlet = { x = 0, y = -0.19, z = 0.13 },
  240. velocity_x = { min = -0.05, max = 0.05 },
  241. velocity_y = -0.3,
  242. velocity_z = { min = -0.1, max = 0 },
  243. spread = 0
  244. }
  245. homedecor.start_particle_spawner(pos, node, particledef, "homedecor_faucet")
  246. end
  247. return itemstack
  248. end,
  249. on_destruct = homedecor.stop_particle_spawner
  250. })
  251. homedecor.register("paper_towel", {
  252. mesh = "homedecor_paper_towel.obj",
  253. tiles = {
  254. "homedecor_generic_quilted_paper.png",
  255. "default_wood.png"
  256. },
  257. inventory_image = "homedecor_paper_towel_inv.png",
  258. description = S("Paper towels"),
  259. groups = { snappy=3 },
  260. walkable = false,
  261. selection_box = {
  262. type = "fixed",
  263. fixed = { -0.4375, 0.125, 0.0625, 0.4375, 0.4375, 0.5 }
  264. },
  265. })
  266. -- crafting
  267. minetest.register_craft({
  268. output = "homedecor:oven_steel",
  269. recipe = {
  270. {"basic_materials:heating_element", "default:steel_ingot", "basic_materials:heating_element", },
  271. {"default:steel_ingot", "moreblocks:iron_glass", "default:steel_ingot", },
  272. {"default:steel_ingot", "basic_materials:heating_element", "default:steel_ingot", },
  273. }
  274. })
  275. minetest.register_craft({
  276. output = "homedecor:oven_steel",
  277. recipe = {
  278. {"basic_materials:heating_element", "default:steel_ingot", "basic_materials:heating_element", },
  279. {"default:steel_ingot", "default:glass", "default:steel_ingot", },
  280. {"default:steel_ingot", "basic_materials:heating_element", "default:steel_ingot", },
  281. }
  282. })
  283. minetest.register_craft({
  284. type = "shapeless",
  285. output = "homedecor:oven",
  286. recipe = {
  287. "homedecor:oven_steel",
  288. "dye:white",
  289. "dye:white",
  290. }
  291. })
  292. minetest.register_craft({
  293. output = "homedecor:microwave_oven 2",
  294. recipe = {
  295. {"default:steel_ingot", "default:steel_ingot", "default:steel_ingot", },
  296. {"default:steel_ingot", "moreblocks:iron_glass", "basic_materials:ic", },
  297. {"default:steel_ingot", "default:copper_ingot", "basic_materials:energy_crystal_simple", },
  298. }
  299. })
  300. minetest.register_craft({
  301. output = "homedecor:microwave_oven 2",
  302. recipe = {
  303. {"default:steel_ingot", "default:steel_ingot", "default:steel_ingot", },
  304. {"default:steel_ingot", "default:glass", "basic_materials:ic", },
  305. {"default:steel_ingot", "default:copper_ingot", "basic_materials:energy_crystal_simple", },
  306. }
  307. })
  308. minetest.register_craft({
  309. output = "homedecor:refrigerator_steel",
  310. recipe = {
  311. {"default:steel_ingot", "homedecor:glowlight_small_cube", "default:steel_ingot", },
  312. {"default:steel_ingot", "default:copperblock", "default:steel_ingot", },
  313. {"default:steel_ingot", "default:clay", "default:steel_ingot", },
  314. }
  315. })
  316. minetest.register_craft({
  317. type = "shapeless",
  318. output = "homedecor:refrigerator_white",
  319. recipe = {
  320. "homedecor:refrigerator_steel",
  321. "dye:white",
  322. "dye:white",
  323. "dye:white",
  324. }
  325. })
  326. minetest.register_craft({
  327. output = "homedecor:kitchen_cabinet",
  328. recipe = {
  329. {"group:wood", "group:stick", "group:wood", },
  330. {"group:wood", "group:stick", "group:wood", },
  331. {"group:wood", "group:stick", "group:wood", },
  332. }
  333. })
  334. minetest.register_craft({
  335. output = "homedecor:kitchen_cabinet_steel",
  336. recipe = {
  337. {"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
  338. {"", "homedecor:kitchen_cabinet", ""},
  339. }
  340. })
  341. minetest.register_craft({
  342. output = "homedecor:kitchen_cabinet_steel",
  343. recipe = {
  344. {"moreblocks:slab_steelblock_1"},
  345. { "homedecor:kitchen_cabinet" },
  346. }
  347. })
  348. minetest.register_craft({
  349. output = "homedecor:kitchen_cabinet_marble",
  350. recipe = {
  351. {"building_blocks:slab_marble"},
  352. {"homedecor:kitchen_cabinet"},
  353. }
  354. })
  355. minetest.register_craft({
  356. output = "homedecor:kitchen_cabinet_marble",
  357. recipe = {
  358. {"technic:slab_marble_1"},
  359. {"homedecor:kitchen_cabinet"},
  360. }
  361. })
  362. minetest.register_craft({
  363. output = "homedecor:kitchen_cabinet_granite",
  364. recipe = {
  365. {"technic:slab_granite_1"},
  366. {"homedecor:kitchen_cabinet"},
  367. }
  368. })
  369. minetest.register_craft({
  370. type = "shapeless",
  371. output = "homedecor:kitchen_cabinet_half 2",
  372. recipe = { "homedecor:kitchen_cabinet" }
  373. })
  374. minetest.register_craft({
  375. output = "homedecor:kitchen_cabinet_with_sink",
  376. recipe = {
  377. {"group:wood", "default:steel_ingot", "group:wood", },
  378. {"group:wood", "default:steel_ingot", "group:wood", },
  379. {"group:wood", "group:stick", "group:wood", },
  380. }
  381. })
  382. minetest.register_craft( {
  383. output = "homedecor:dishwasher",
  384. recipe = {
  385. { "basic_materials:ic", "building_blocks:slab_grate_1", "default:steel_ingot", },
  386. { "default:steel_ingot", "homedecor:shower_head", "basic_materials:motor" },
  387. { "default:steel_ingot", "basic_materials:heating_element", "bucket:bucket_water" }
  388. },
  389. })
  390. minetest.register_craft( {
  391. output = "homedecor:dishwasher",
  392. recipe = {
  393. { "basic_materials:ic", "homedecor:fence_chainlink", "default:steel_ingot", },
  394. { "default:steel_ingot", "homedecor:shower_head", "basic_materials:motor" },
  395. { "default:steel_ingot", "basic_materials:heating_element", "bucket:bucket_water" }
  396. },
  397. })
  398. minetest.register_craft( {
  399. output = "homedecor:dishwasher_wood",
  400. recipe = {
  401. { "stairs:slab_wood" },
  402. { "homedecor:dishwasher" },
  403. },
  404. })
  405. minetest.register_craft( {
  406. output = "homedecor:dishwasher_wood",
  407. recipe = {
  408. { "moreblocks:slab_wood" },
  409. { "homedecor:dishwasher" },
  410. },
  411. })
  412. minetest.register_craft( {
  413. output = "homedecor:dishwasher_wood",
  414. recipe = {
  415. { "moreblocks:slab_wood_1" },
  416. { "homedecor:dishwasher" },
  417. },
  418. })
  419. minetest.register_craft( {
  420. output = "homedecor:dishwasher_steel",
  421. recipe = {
  422. { "default:steel_ingot", "default:steel_ingot", "default:steel_ingot" },
  423. { "", "homedecor:dishwasher", "" },
  424. },
  425. })
  426. minetest.register_craft( {
  427. output = "homedecor:dishwasher_steel",
  428. recipe = {
  429. { "moreblocks:slab_steelblock_1" },
  430. { "homedecor:dishwasher" },
  431. },
  432. })
  433. minetest.register_craft( {
  434. output = "homedecor:dishwasher_marble",
  435. recipe = {
  436. { "building_blocks:slab_marble" },
  437. { "homedecor:dishwasher" },
  438. },
  439. })
  440. minetest.register_craft( {
  441. output = "homedecor:dishwasher_marble",
  442. recipe = {
  443. { "technic:slab_marble_1" },
  444. { "homedecor:dishwasher" },
  445. },
  446. })
  447. minetest.register_craft( {
  448. output = "homedecor:dishwasher_granite",
  449. recipe = {
  450. { "technic:slab_granite_1" },
  451. { "homedecor:dishwasher" },
  452. },
  453. })
  454. minetest.register_craft( {
  455. output = "homedecor:kitchen_faucet",
  456. recipe = {
  457. { "", "default:steel_ingot" },
  458. { "default:steel_ingot", "" },
  459. { "homedecor:taps", "" }
  460. },
  461. })
  462. minetest.register_craft( {
  463. output = "homedecor:kitchen_faucet",
  464. recipe = {
  465. { "default:steel_ingot","" },
  466. { "", "default:steel_ingot" },
  467. { "", "homedecor:taps" }
  468. },
  469. })
  470. minetest.register_craft( {
  471. output = "homedecor:cutlery_set",
  472. recipe = {
  473. { "", "vessels:drinking_glass", "" },
  474. { "basic_materials:steel_strip", "building_blocks:slab_marble", "basic_materials:steel_strip" },
  475. },
  476. })
  477. minetest.register_craft( {
  478. output = "homedecor:cutlery_set",
  479. recipe = {
  480. { "", "vessels:drinking_glass", "" },
  481. { "basic_materials:steel_strip", "building_blocks:micro_marble_1", "basic_materials:steel_strip" },
  482. },
  483. })
  484. minetest.register_craft({
  485. output = "homedecor:copper_pans",
  486. recipe = {
  487. { "basic_materials:copper_strip","","basic_materials:copper_strip" },
  488. { "default:copper_ingot","","default:copper_ingot" },
  489. { "default:copper_ingot","","default:copper_ingot" }
  490. },
  491. })
  492. minetest.register_craft({
  493. output = "homedecor:paper_towel",
  494. recipe = {
  495. { "homedecor:toilet_paper", "homedecor:toilet_paper" }
  496. },
  497. })