init.lua 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553
  1. -- Mod: sandwiches
  2. sandwiches = {}
  3. sandwiches.version = 1.9 -- complete overhaul
  4. sandwiches.path = minetest.get_modpath("sandwiches")
  5. sandwiches.ingredient_support = {
  6. ["true"] = true, -- provided by this mod or its dependencies
  7. ["meat"] = false,
  8. ["veggie"] = false,
  9. ["berry"] = false,
  10. ["banana"] = false,
  11. ["choco"] = false,
  12. ["honey"] = minetest.get_modpath("bees") ~= nil or minetest.get_modpath("mobs_animal") ~= nil or minetest.get_modpath("xdecor") ~= nil,
  13. ["fish"] = false,
  14. ["mushroom"] = minetest.get_modpath("flowers") ~= nil,
  15. ["dairy"] = minetest.get_modpath("mobs_animal") ~= nil,
  16. ["herbs"] = minetest.get_modpath("potted_farming") ~= nil,
  17. }
  18. -- for future improvements (need cuisine)
  19. local pot = "sandwiches:pot" --jam and jelly
  20. local skillet = "sandwiches:skillet" -- toasts and tasty veg
  21. local board = "sandwiches:cutting_board" -- ham bacon chicken_strips
  22. local mope = "sandwiches:mortar_pestle" -- tabasco
  23. local mix = "sandwiches:mixing_bowl" --sprinkles
  24. if minetest.global_exists("farming") and farming.mod == "redo" then
  25. pot = "farming:pot"
  26. skillet = "farming:skillet"
  27. board = "farming:cutting_board"
  28. mope = "farming:mortar_pestle"
  29. mix = "farming:mixing_bowl"
  30. sandwiches.ingredient_support.veggie = true
  31. sandwiches.ingredient_support.berry = true
  32. sandwiches.ingredient_support.choco = true
  33. else
  34. dofile(sandwiches.path .. "/luas/tools.lua")
  35. end
  36. -- BREAD --
  37. minetest.register_craftitem("sandwiches:bread_slice", {
  38. description = "Bread slice",
  39. on_use = minetest.item_eat(1),
  40. groups = {food = 1, food_bread_slice = 1, flammable = 1},
  41. inventory_image = "sandwiches_bread_slice.png"
  42. })
  43. minetest.register_craft({
  44. output = "sandwiches:bread_slice 8",
  45. type = "shapeless",
  46. recipe = {"group:food_bread", "group:food_cutting_board", "group:food_bread"},
  47. replacements = { {"group:food_cutting_board", board }, }
  48. })
  49. minetest.register_craftitem("sandwiches:bread_crumbs", {
  50. description = "Bread crumbs",
  51. on_use = minetest.item_eat(1),
  52. groups = {food = 1, food_bread_crumbs = 1, flammable = 1},
  53. inventory_image = "bread_crumbs.png"
  54. })
  55. minetest.register_craft({
  56. output = "sandwiches:bread_crumbs 4",
  57. type = "shapeless",
  58. recipe = {"group:food_bread_slice"},
  59. })
  60. if minetest.get_modpath("animalia") or minetest.get_modpath("mobs") then
  61. if minetest.get_modpath("petz") then
  62. sandwiches.ingredient_support.honey = true
  63. end
  64. dofile(sandwiches.path .. "/luas/meat.lua")
  65. sandwiches.ingredient_support.meat = true
  66. sandwiches.ingredient_support.dairy = true
  67. end
  68. if minetest.get_modpath("cheese") then
  69. sandwiches.ingredient_support.dairy = true
  70. end
  71. if sandwiches.ingredient_support.meat and sandwiches.ingredient_support.dairy and sandwiches.ingredient_support.veggie then
  72. dofile(sandwiches.path .. "/luas/toasts.lua")
  73. end
  74. if minetest.get_modpath("cucina_vegana") then
  75. dofile(sandwiches.path .. "/luas/cucina_vegana.lua")
  76. sandwiches.ingredient_support.banana = true
  77. sandwiches.ingredient_support.veggie = true
  78. sandwiches.ingredient_support.banana = true
  79. sandwiches.ingredient_support.honey = true
  80. end
  81. if minetest.get_modpath("bbq") and sandwiches.ingredient_support.meat then
  82. dofile(sandwiches.path .. "/luas/bbq.lua")
  83. end
  84. if minetest.get_modpath("ethereal") then
  85. dofile(sandwiches.path .. "/luas/fish.lua")
  86. sandwiches.ingredient_support.fish = true
  87. sandwiches.ingredient_support.banana = true
  88. sandwiches.ingredient_support.berry = true
  89. end
  90. if minetest.get_modpath("agriculture") then
  91. dofile(sandwiches.path .. "/luas/agriculture.lua")
  92. sandwiches.ingredient_support.veggie = true
  93. sandwiches.ingredient_support.berry = true
  94. end
  95. if minetest.get_modpath("x_farming") then
  96. dofile(sandwiches.path .. "/luas/xfarming.lua")
  97. sandwiches.ingredient_support.veggie = true
  98. sandwiches.ingredient_support.berry = true
  99. sandwiches.ingredient_support.choco = true
  100. end
  101. if minetest.get_modpath("cacaotree") then
  102. sandwiches.ingredient_support.choco = true
  103. end
  104. if minetest.get_modpath("moretrees") and sandwiches.ingredient_support.choco then
  105. dofile(sandwiches.path .. "/luas/nutella.lua")
  106. end
  107. if minetest.get_modpath("bushes_classic") or sandwiches.ingredient_support.berry then
  108. -- BREAD PUDDING --
  109. -- no jam, no bread pudding
  110. minetest.register_craftitem("sandwiches:sweet_bread_pudding_raw", {
  111. description = "Uncooked sweet bread pudding",
  112. groups = {food_sweet_bread = 1, flammable = 1},
  113. inventory_image = "sweet_bread_pudding_raw.png"
  114. })
  115. minetest.register_craftitem("sandwiches:sweet_bread_pudding", {
  116. description = "Sweet bread pudding",
  117. on_use = minetest.item_eat(10),
  118. groups = {food = 10, food_sweet_bread = 1, flammable = 1},
  119. inventory_image = "sweet_bread_pudding.png"
  120. })
  121. minetest.register_craft({
  122. output = "sandwiches:sweet_bread_pudding_raw",
  123. recipe = {
  124. {"sandwiches:bread_crumbs", "sandwiches:bread_crumbs", "sandwiches:bread_crumbs"},
  125. {"group:food_jam", "group:food_sugar", "group:food_jam"},
  126. {"sandwiches:bread_crumbs", "sandwiches:bread_crumbs", "sandwiches:bread_crumbs"},
  127. }
  128. })
  129. minetest.register_craft({
  130. type = "cooking",
  131. output = "sandwiches:sweet_bread_pudding",
  132. recipe = "sandwiches:sweet_bread_pudding_raw",
  133. cooktime = 15,
  134. })
  135. -- JAM AND JELLY --
  136. local jj = {
  137. ["blue"] = { {food_jam = 1, food_blueberry_jam = 1, flammable = 1},},
  138. ["rasp"] = { {food_jam = 1, food_raspberry_jam = 1, flammable = 1},},
  139. ["straw"] = { {food_jam = 1, food_strawberry_jam = 1, flammable = 1},},
  140. ["black"] = { {food_jam = 1, food_blackberry_jam = 1, flammable = 1},},
  141. }
  142. for k, v in pairs(jj) do
  143. minetest.register_craftitem("sandwiches:".. k .."berry_jam", {
  144. description = k:gsub("(%a)(%a+)", function(a, b) return string.upper(a) .. string.lower(b) end).."berry jam",
  145. on_use = minetest.item_eat(2),
  146. groups = v[1],
  147. inventory_image = "sandwiches_".. k .."berry_jam.png"
  148. })
  149. minetest.register_craft({
  150. output = "sandwiches:".. k .."berry_jam 5",
  151. recipe = {
  152. {"group:food_".. k .."berry", "group:food_sugar", "group:food_".. k .."berry"},
  153. {"group:food_sugar", "group:food_pot", "group:food_sugar"},
  154. {"group:food_".. k .."berry", "group:food_sugar", "group:food_".. k .."berry"},
  155. },
  156. replacements = {{"group:food_pot", pot }},
  157. })
  158. end
  159. minetest.register_craftitem("sandwiches:grape_jelly", {
  160. description = "Grape jelly",
  161. on_use = minetest.item_eat(2),
  162. groups = {food = 2, food_jam = 1, flammable = 1 },
  163. inventory_image = "sandwiches_grape_jelly.png"
  164. })
  165. minetest.register_craft({
  166. output = "sandwiches:grape_jelly 5",
  167. recipe = {
  168. {"group:food_grapes", "group:food_sugar", "group:food_grapes"},
  169. {"group:food_sugar", "group:food_pot", "group:food_sugar"},
  170. {"group:food_grapes", "group:food_sugar", "group:food_grapes"},
  171. },
  172. replacements = {{"group:food_pot", "group:food_pot"}},
  173. })
  174. minetest.register_craftitem("sandwiches:multi_jam", {
  175. description = "Multi jam",
  176. on_use = minetest.item_eat(2),
  177. groups = {food = 2, food_jam = 1, flammable = 1},
  178. inventory_image = "sandwiches_multi_jam.png"
  179. })
  180. minetest.register_craft({
  181. output = "sandwiches:multi_jam 5",
  182. recipe = {
  183. {"group:food_berry", "group:food_sugar", "group:food_berry"},
  184. {"group:food_sugar", "group:food_pot", "group:food_sugar"},
  185. {"group:food_berry", "group:food_sugar", "group:food_berry"},
  186. },
  187. replacements = {{"group:food_pot", "group:food_pot"}},
  188. })
  189. minetest.register_craft({
  190. output = "sandwiches:multi_jam 3",
  191. type = "shapeless";
  192. recipe = { "group:food_jam", "group:food_jam", "group:food_jam", },
  193. })
  194. end -- if merries are registered
  195. -- MEAT -- moved
  196. -- PEANUTS -- moved
  197. -- SAUCE --
  198. minetest.register_node("sandwiches:tabasco", {
  199. description = "Tabasco bottle",
  200. inventory_image = "tabasco.png",
  201. wield_image = "tabasco.png",
  202. drawtype = "plantlike",
  203. paramtype = "light",
  204. is_ground_content = false,
  205. tiles = {"tabasco.png"},
  206. groups = {vessel = 1, dig_immediate = 3, attached_node = 1, food_hot = 1, food_spicy = 1, food_sauce = 1},
  207. sounds = default.node_sound_glass_defaults(),
  208. selection_box = {
  209. type = "fixed",
  210. fixed = {-0.25, -0.5, -0.25, 0.25, 0.3, 0.25}
  211. },
  212. })
  213. minetest.register_craft({
  214. output = "sandwiches:tabasco 3",
  215. type = "shapeless";
  216. recipe = {"group:food_chili_pepper", "group:food_chili_pepper", "group:food_chili_pepper",
  217. "group:food_chili_pepper", "group:food_chili_pepper", "group:food_chili_pepper",
  218. "group:food_mortar_pestle", "vessels:glass_bottle",
  219. },
  220. replacements = {{"group:food_mortar_pestle", mope }}
  221. })
  222. -- TASTY VEGGIES --
  223. local herb = "group:food_parsley"
  224. local rosm = "group:food_pepper_ground"
  225. if sandwiches.ingredient_support.herbs then
  226. herb = "potted_farming:sage"
  227. rosm = "group:food_rosemary"
  228. end
  229. minetest.register_craftitem("sandwiches:butter_carrots", {
  230. description = "Butter carrots",
  231. on_use = minetest.item_eat(3),
  232. groups = {food = 3, food_tasty_veggie = 1, flammable = 1},
  233. inventory_image = "butter_carrots.png"
  234. })
  235. minetest.register_craft({
  236. output = "sandwiches:butter_carrots 5",
  237. type = "shapeless",
  238. recipe = {
  239. "group:food_carrot", "group:food_carrot",
  240. "group:food_skillet", "group:food_butter", herb,
  241. },
  242. replacements = {{"group:food_skillet", skillet }}
  243. })
  244. minetest.register_craftitem("sandwiches:roasted_potatoes", {
  245. description = "Roasted potatoes",
  246. on_use = minetest.item_eat(4),
  247. groups = {food = 4, food_tasty_veggie = 1, flammable = 1},
  248. inventory_image = "roasted_potatoes.png"
  249. })
  250. minetest.register_craft({
  251. output = "sandwiches:roasted_potatoes 5",
  252. type = "shapeless",
  253. recipe = {
  254. "group:food_potato", "group:food_potato",
  255. "group:food_skillet", "group:food_oil", rosm,
  256. },
  257. replacements = {
  258. {"group:food_skillet", skillet },
  259. {"group:food_pepper_ground", "vessels:glass_bottle"},
  260. {"group:food_oil", "vessels:glass_bottle"}, }
  261. })
  262. minetest.register_craftitem("sandwiches:caramelized_onion", {
  263. description = "Caramelized onion",
  264. on_use = minetest.item_eat(3),
  265. groups = {food = 3, food_tasty_veggie = 1, flammable = 1},
  266. inventory_image = "caramelized_onion.png"
  267. })
  268. minetest.register_craft({
  269. output = "sandwiches:caramelized_onion 4",
  270. type = "shapeless";
  271. recipe = {"group:food_onion", "group:food_onion", "group:food_sugar", "group:food_skillet"},
  272. replacements = {{"group:food_skillet", skillet }}
  273. })
  274. if sandwiches.ingredient_support.mushroom then
  275. minetest.register_craftitem("sandwiches:trifolat_mushrooms", {
  276. description = "Trifolat Mushrooms",
  277. on_use = minetest.item_eat(3),
  278. groups = {food = 3, food_tasty_veggie = 1, flammable = 1},
  279. inventory_image = "trifolat_mushrooms.png"
  280. })
  281. minetest.register_craft({
  282. output = "sandwiches:trifolat_mushrooms 4",
  283. type = "shapeless",
  284. recipe = {
  285. "group:food_mushroom", "group:food_mushroom", "group:food_garlic_clove",
  286. "group:food_skillet", "group:food_oil", "group:food_parsley",
  287. },
  288. replacements = {{"group:food_skillet", skillet },
  289. {"group:food_oil", "vessels:glass_bottle" },}
  290. })
  291. end
  292. -- --
  293. dofile(sandwiches.path .. "/crops/peanuts.lua")
  294. local sandwiches_recipes = {
  295. --[[ name, is definable, fancy name, hunger,
  296. recipe,
  297. alternative recipe (optional),
  298. replacements (optional),
  299. ]]--
  300. ["american"] = {{"veggie", "meat", "dairy"}, "American", 8,
  301. {"group:food_cucumber", "group:food_ham", "group:food_cheese"},
  302. {"group:food_cucumber", "group:food_bacon", "group:food_cheese"},
  303. },
  304. ["veggie"] = {{"veggie", "veggie", "veggie"}, "Veggie", 8,
  305. {"group:food_cucumber", "group:food_tomato", "group:food_potato"},
  306. {"group:food_carrot", "group:food_onion", "group:food_beetroot"},
  307. },
  308. ["classic"] = {{"veggie", "meat", "veggie"}, "Classic", 8,
  309. {"group:food_lettuce", "group:food_ham", "group:food_tomato"},
  310. {"group:food_lettuce", "farming:tofu_cooked", "group:food_tomato" }
  311. },
  312. ["blt"] = {{"veggie", "meat", "veggie"}, "BLT", 8,
  313. {"group:food_lettuce", "group:food_bacon" ,"group:food_tomato"},
  314. },
  315. ["ham"] = {{"meat", "meat", "meat"}, "Ham", 8,
  316. {"group:food_ham", "group:food_ham", "group:food_ham"},
  317. },
  318. ["bacon"] = {{"meat", "meat", "meat"}, "Bacon", 8,
  319. {"group:food_bacon", "group:food_bacon", "group:food_bacon"},
  320. },
  321. ["egg_and_bacon"] = {{"meat", "meat", "meat"}, "Egg&Bacon", 10,
  322. {"group:food_bacon", "group:food_egg_fried", "group:food_bacon"},
  323. },
  324. ["tasty_meat"] = {{"veggie", "meat", "veggie"}, "Tasty veggie with meat", 10,
  325. {"group:food_tasty_veggie", "group:food_ham", "group:food_tasty_veggie"},
  326. {"group:food_tasty_veggie", "sandwiches:chicken_strips", "group:food_tasty_veggie"}
  327. },
  328. ["enhanced_bacon"] = {{"meat", "mushroom", "meat"}, "Enhanced bacon", 10,
  329. {"group:food_bacon", "sandwiches:trifolat_mushrooms", "group:food_bacon"},
  330. },
  331. ["tasty_veggie"] = {{"veggie", "veggie", "veggie"}, "Tasty veggie", 10,
  332. {"sandwiches:caramelized_onion", "sandwiches:butter_carrots" ,"sandwiches:roasted_potatoes" },
  333. {"group:food_tasty_veggie", "group:food_tasty_veggie" ,"group:food_tasty_veggie" },
  334. },
  335. ["hot_ham"] = {{"meat", "veggie", "meat"}, "Hot ham", 9,
  336. {"group:food_ham", "sandwiches:tabasco", "group:food_ham"},
  337. nil,
  338. {{"sandwiches:tabasco", "vessels:glass_bottle"},},
  339. },
  340. ["hot_veggie"] = {{"veggie", "veggie", "veggie"}, "Hot veggie", 9,
  341. {"group:food_tomato", "sandwiches:tabasco", "group:food_potato"},
  342. {"group:food_carrot", "sandwiches:tabasco", "group:food_onion"},
  343. {{"sandwiches:tabasco", "vessels:glass_bottle"},}
  344. },
  345. ["italian"] = {{"mushroom", "veggie", "dairy"}, "Italian", 7,
  346. {"flowers:mushroom_brown", "group:food_tomato", "group:food_cheese"},
  347. },
  348. ["cheesy"] = {{"dairy", "dairy", "dairy"}, "Cheesy", 8,
  349. {"group:food_cheese","group:food_cheese", "group:food_cheese"},
  350. },
  351. ["sweet"] = {{"true", "honey", "true"}, "Sweet", 8, -- apples are from default, a dependant mod
  352. {"default:apple", "group:food_honey", "default:apple"},
  353. nil,
  354. {{"cucina_vegana:dandelion_honey", "vessels:glass_bottle"},
  355. {"petz:honey_bottle", "vessels:glass_bottle"}},
  356. },
  357. ["blueberry_jam"] = {{"veggie", "veggie", "veggie"}, "Blueberry jam", 7,
  358. {"sandwiches:blueberry_jam", "sandwiches:blueberry_jam", "sandwiches:blueberry_jam"},
  359. },
  360. ["raspberry_jam"] = {{"veggie", "veggie", "veggie"}, "Rasperry jam", 7,
  361. {"sandwiches:raspberry_jam", "sandwiches:raspberry_jam", "sandwiches:raspberry_jam"},
  362. },
  363. ["strawberry_jam"] = {{"veggie", "veggie", "veggie"}, "Strawberry jam", 7,
  364. {"sandwiches:strawberry_jam", "sandwiches:strawberry_jam", "sandwiches:strawberry_jam"},
  365. },
  366. ["blackberry_jam"] = {{"veggie", "veggie", "veggie"}, "Blackberry jam", 7,
  367. {"sandwiches:blackberry_jam", "sandwiches:blackberry_jam", "sandwiches:blackberry_jam"},
  368. },
  369. ["grape_jelly"] = {{"veggie", "veggie", "veggie"}, "Grape jelly", 7,
  370. {"sandwiches:grape_jelly", "sandwiches:grape_jelly", "sandwiches:grape_jelly"},
  371. },
  372. ["pb_and_j"] = {{"true", "veggie", "true"}, "PeanutButter & Jelly", 10, -- peanut_butter is provided
  373. {"sandwiches:peanut_butter", "sandwiches:grape_jelly", "sandwiches:peanut_butter"},
  374. },
  375. ["jam"] = {{"veggie", "veggie", "veggie"}, "Jam", 7,
  376. {"group:food_jam","group:food_jam", "group:food_jam"},
  377. },
  378. ["banana_and_chocolate"] = {{"banana", "choco", "banana"}, "Banana&Chocolate", 8,
  379. {"group:food_banana", "farming:chocolate_dark", "group:food_banana"},
  380. {"group:food_banana", "cacaotree:milk_chocolate", "group:food_banana"},
  381. },
  382. ["elvis"] = {{"banana", "true", "meat"}, "Elvis", 9,
  383. {"group:food_banana", "sandwiches:peanut_butter", "group:food_bacon"},
  384. },
  385. ["marinated_chicken"] = {{"veggie", "meat", "honey"}, "Marinated chicken", 10,
  386. {"group:food_soy_sauce", "group:food_chicken_strips", "group:food_honey"},
  387. nil,
  388. {{"cucina_vegana:dandelion_honey", "vessels:glass_bottle"},
  389. {"petz:honey_bottle", "vessels:glass_bottle"},
  390. {"farming:soy_sauce", "vessels:glass_bottle"}},
  391. },
  392. }
  393. local function ingredients_registered (ingredient_types)
  394. local s = sandwiches.ingredient_support
  395. local can_register = false
  396. if s[ingredient_types[1]] and s[ingredient_types[2]] and s[ingredient_types[3]] then
  397. can_register = true
  398. end
  399. return can_register
  400. end
  401. for k, v in pairs(sandwiches_recipes) do
  402. if ingredients_registered(v[1]) then
  403. local replace
  404. if v[6] ~= nil then
  405. replace = v[6]
  406. end
  407. minetest.register_craftitem("sandwiches:".. k .."_sandwich", {
  408. description = v[2].." sandwich",
  409. on_use = minetest.item_eat(v[3], "sandwiches:bread_crumbs"),
  410. groups = {food = v[3] ,food_sandwich = 1, flammable = 1},
  411. inventory_image = k .."_sandwich.png",
  412. })
  413. minetest.register_craft({
  414. output = "sandwiches:".. k .."_sandwich",
  415. recipe = {
  416. {"", "sandwiches:bread_slice", ""},
  417. v[4],
  418. {"", "sandwiches:bread_slice", ""},
  419. },
  420. replacements = replace
  421. })
  422. if v[5] ~= nil then
  423. minetest.register_craft({
  424. output = "sandwiches:".. k .."_sandwich",
  425. recipe = {
  426. {"", "sandwiches:bread_slice", ""},
  427. v[5],
  428. {"", "sandwiches:bread_slice", ""},
  429. },
  430. replacements = replace
  431. })
  432. end
  433. end -- registerable
  434. end
  435. -- ALIASES for compatibility, no unknown nodes or items must exist ---
  436. --minetest.register_alias("name", "convert_to")
  437. minetest.register_alias("sandwiches:tasty_bacon", "sandwiches:tasty_meat")
  438. minetest.register_alias("sandwiches:tasty_chicken", "sandwiches:tasty_meat")
  439. minetest.register_alias("sandwiches:classic_vegan_sandwich", "sandwiches:classic_sandwich")
  440. -- SPECIAL SANDWICHES --
  441. minetest.register_craftitem("sandwiches:triple_mega_sandwich", {
  442. description = "Triple Mega sandwich",
  443. on_use = minetest.item_eat(20, "sandwiches:bread_crumbs"),
  444. groups = {food = 20, food_big_sandwich = 1, flammable = 1},
  445. inventory_image = "triple_mega_sandwich.png"
  446. })
  447. minetest.register_craft({
  448. output = "sandwiches:triple_mega_sandwich",
  449. recipe = {
  450. {"", "sandwiches:bread_slice", ""},
  451. {"group:food_sandwich", "group:food_sandwich","group:food_sandwich"},
  452. {"", "sandwiches:bread_slice", ""},
  453. }
  454. })
  455. minetest.register_craftitem("sandwiches:sand_sandwich", {
  456. description = "Sand-sandwich",
  457. inventory_image = "sand_sandwich.png",
  458. groups = {food = 5, food_sandwich = 1, flammable = 1},
  459. on_use = function(itemstack, player, pointed_thing)
  460. if player:get_hp() > 2 then
  461. player:set_hp(player:get_hp() - 2)
  462. minetest.chat_send_player(player:get_player_name(), "Ouch!" )
  463. end
  464. return minetest.do_item_eat(5, nil, itemstack, player, pointed_thing)
  465. end,
  466. })
  467. minetest.register_craft({
  468. output = "sandwiches:sand_sandwich",
  469. recipe = {
  470. {"default:sand", "default:sand", "default:sand"},
  471. {"default:cactus", "default:cactus", "default:cactus"},
  472. {"default:sand", "default:sand", "default:sand"},
  473. }
  474. })
  475. if sandwiches.ingredient_support.dairy then
  476. --fairy bread, (butter and sprinkles)
  477. minetest.register_craftitem("sandwiches:sprinkles", {
  478. description = "Sprinkles",
  479. on_use = minetest.item_eat(1),
  480. groups = {food = 1, food_sprinkles = 1, flammable = 1},
  481. inventory_image = "sugar_sprinkles.png"
  482. })
  483. minetest.register_craft({
  484. output = "sandwiches:sprinkles 5",
  485. recipe = {
  486. {"dye:red", "group:food_sugar", "dye:yellow"},
  487. {"group:food_sugar", "group:food_sugar", "group:food_sugar"},
  488. {"dye:blue", "group:food_mixing_bowl", "dye:green"},
  489. },
  490. replacements = {{"group:food_mixing_bowl", mix }}
  491. })
  492. minetest.register_craftitem("sandwiches:fairy_bread", {
  493. description = "Fairy bread",
  494. on_use = minetest.item_eat(6, "sandwiches:bread_crumbs"),
  495. groups = {food = 6, food_fairy_bread = 1, flammable = 1},
  496. inventory_image = "fairy_bread.png"
  497. })
  498. minetest.register_craft({
  499. output = "sandwiches:fairy_bread 2",
  500. recipe = {
  501. {"sandwiches:sprinkles", "sandwiches:sprinkles", "sandwiches:sprinkles"},
  502. {"sandwiches:sprinkles", "sandwiches:sprinkles", "sandwiches:sprinkles"},
  503. {"sandwiches:bread_slice", "group:food_butter", "sandwiches:bread_slice"},
  504. },
  505. })
  506. end -- if dairy is present ( need butter )