init.lua 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. local slab_str = "stairs:slab_wood"
  2. function applyModSupport()
  3. local moreblocks_found = false
  4. local technic_worldgen = false
  5. local modnames = minetest.get_modnames()
  6. for i, name in ipairs(modnames) do
  7. if name == "moreblocks" then
  8. moreblocks_found = true
  9. end
  10. if name == "technic_worldgen" then
  11. technic_worldgen = true
  12. end
  13. end
  14. if moreblocks_found == true and technic_worldgen == true then
  15. minetest.log("applying patch to mod " .. minetest.get_current_modname())
  16. minetest.log("converting '" .. slab_str .. "' to 'moreblocks:slab_wood'")
  17. slab_str = "moreblocks:slab_wood"
  18. end
  19. end
  20. minetest.register_craft({
  21. output = 'drinks:juice_press',
  22. recipe = {
  23. {'default:stick', 'default:steel_ingot', 'default:stick'},
  24. {'default:stick', 'bucket:bucket_empty', 'default:stick'},
  25. {slab_str, slab_str, 'vessels:drinking_glass'},
  26. }
  27. })
  28. minetest.register_craft({
  29. output = 'drinks:liquid_barrel',
  30. recipe = {
  31. {'group:wood', 'group:wood', 'group:wood'},
  32. {'group:wood', 'group:wood', 'group:wood'},
  33. {slab_str, '', slab_str},
  34. }
  35. })
  36. drinks = {}
  37. drinks.drink_table = {}
  38. drinks.juiceable = {}
  39. drinks.shortname = {
  40. ['jcu'] = {size = 2, name = 'vessels:drinking_glass'},
  41. ['jbo'] = {size = 4, name = 'vessels:glass_bottle'},
  42. ['jsb'] = {size = 4, name = 'vessels:steel_bottle'},
  43. ['jbu'] = {size = 16, name = 'bucket:bucket_empty'}
  44. }
  45. drinks.longname = {
  46. ['vessels:drinking_glass'] = {size = 2, name = 'jcu'},
  47. ['vessels:glass_bottle'] = {size = 4, name = 'jbo'},
  48. ['vessels:steel_bottle'] = {size = 4, name = 'jsb'},
  49. ['bucket:bucket_empty'] = {size = 16, name = 'jbu'},
  50. }
  51. drinks.juice_name = {
  52. ['apple'] = 'apple',
  53. ['cactus'] = 'cactus',
  54. ['blueberries'] = 'blueberries',
  55. ['melon_8'] = 'melon',
  56. ['melon_slice'] = 'melon',
  57. ['tomato'] = 'tomato',
  58. ['carrot'] = 'carrot',
  59. ['cucumber'] = 'cucumber',
  60. ['grapes'] = 'grapes',
  61. ['pumpkin'] = 'pumpkin',
  62. ['raspberries'] = 'raspberries',
  63. ['rhubarb'] = 'rhubarb',
  64. ['pineapple'] = 'pineapple',
  65. ['pineapple_ring'] = 'pineapple',
  66. ['banana'] = 'banana',
  67. ['orange'] = 'orange',
  68. ['prickly_pear'] = 'cactus',
  69. ['barrel_cacti_1'] = 'cactus',
  70. ['barrel_cacti_2'] = 'cactus',
  71. ['barrel_cacti_3'] = 'cactus'
  72. }
  73. --Default
  74. drinks.juiceable['apple'] = true -- Name of fruit to make juiceable.
  75. drinks.juiceable['cactus'] = true
  76. drinks.juiceable['blueberries'] = true
  77. table.insert(drinks.drink_table, {'apple', 'Apple', '#ecff56'})
  78. table.insert(drinks.drink_table, {'cactus', 'Cactus', '#96F97B'})
  79. table.insert(drinks.drink_table, {'blueberries', 'Blueberry', '#521dcb'})
  80. --Farming_redo
  81. drinks.juiceable['melon_8'] = true
  82. drinks.juiceable['melon_slice'] = true
  83. drinks.juiceable['tomato'] = true
  84. drinks.juiceable['carrot'] = true
  85. drinks.juiceable['cucumber'] = true
  86. drinks.juiceable['grapes'] = true
  87. drinks.juiceable['pumpkin'] = true
  88. drinks.juiceable['raspberries'] = true
  89. drinks.juiceable['rhubarb'] = true
  90. drinks.juiceable['pineapple'] = true
  91. drinks.juiceable['pineapple_ring'] = true
  92. table.insert(drinks.drink_table, {'melon', 'Melon', '#ef4646'})
  93. table.insert(drinks.drink_table, {'tomato', 'Tomato', '#990000'})
  94. table.insert(drinks.drink_table, {'carrot', 'Carrot', '#ed9121'})
  95. table.insert(drinks.drink_table, {'cucumber', 'Cucumber', '#73af59'})
  96. table.insert(drinks.drink_table, {'grapes', 'Grape', '#b20056'})
  97. table.insert(drinks.drink_table, {'pumpkin', 'Pumpkin', '#ffc04c'})
  98. table.insert(drinks.drink_table, {'raspberries', 'Raspberry', '#C70039'})
  99. table.insert(drinks.drink_table, {'rhubarb', 'Rhubarb', '#fb8461'})
  100. table.insert(drinks.drink_table, {'pineapple', 'Pineapple', '#dcd611'})
  101. --Epic_trees
  102. drinks.juiceable['banana'] = true
  103. drinks.juiceable['orange'] = true
  104. table.insert(drinks.drink_table, {'banana', 'Banana', '#eced9f'})
  105. table.insert(drinks.drink_table, {'orange', 'Orange', '#ffc417'})
  106. --Desert_life
  107. drinks.juiceable['prickly_pear'] = true
  108. drinks.juiceable['barrel_cacti_1'] = true
  109. drinks.juiceable['barrel_cacti_2'] = true
  110. drinks.juiceable['barrel_cacti_3'] = true
  111. table.insert(drinks.drink_table, {'prickly', 'Cactus', '#96F97B'})
  112. table.insert(drinks.drink_table, {'barrel', 'Cactus', '#96F97B'})
  113. -- replace craftitem to node definition
  114. -- use existing node as template (e.g. 'vessel:glass_bottle')
  115. drinks.register_item = function( name, template, def )
  116. local template_def = minetest.registered_nodes[template]
  117. if template_def then
  118. local drinks_def = table.copy(template_def)
  119. -- replace/add values
  120. for k,v in pairs(def) do
  121. if k == "groups" then
  122. -- special handling for groups: merge instead replace
  123. for g,n in pairs(v) do
  124. drinks_def[k][g] = n
  125. end
  126. else
  127. drinks_def[k]=v
  128. end
  129. end
  130. if def.inventory_image then
  131. drinks_def.wield_image = drinks_def.inventory_image
  132. drinks_def.tiles = { drinks_def.inventory_image }
  133. end
  134. minetest.register_node( name, drinks_def )
  135. end
  136. end
  137. dofile(minetest.get_modpath('drinks')..'/drinks.lua')
  138. dofile(minetest.get_modpath('drinks')..'/drink_machines.lua')
  139. dofile(minetest.get_modpath('drinks')..'/formspecs.lua')