Tweaked drinks mod

master
NathanSalapat 2020-07-23 08:09:33 -05:00
parent ec18b0dc0f
commit 2de3ba7031
3 changed files with 70 additions and 62 deletions

View File

@ -102,12 +102,8 @@ minetest.register_node('drinks:juice_press', {
local fruitstack = instack:get_name()
local mod, fruit = fruitstack:match("([^:]+):([^:]+)")
if drinks.juiceable[fruit] then
if string.find(fruit, '_') then
local fruit, junk = fruit:match('([^_]+)_([^_]+)')
meta:set_string('fruit', fruit)
else
meta:set_string('fruit', fruit)
end
local fruit_name = drinks.juice_name[fruit]
meta:set_string('fruit', fruit_name)
local outstack = inv:get_stack("dst", 1)
local vessel = outstack:get_name()
if vessel == 'vessels:drinking_glass' then

View File

@ -48,77 +48,86 @@ minetest.register_craft({
}
})
drinks = {
drink_table = {},
juiceable = {},
shortname = {
drinks = {}
drinks.drink_table = {}
drinks.juiceable = {}
drinks.shortname = {
['jcu'] = {size = 2, name = 'vessels:drinking_glass'},
['jbo'] = {size = 4, name = 'vessels:glass_bottle'},
['jsb'] = {size = 4, name = 'vessels:steel_bottle'},
['jbu'] = {size = 16, name = 'bucket:bucket_empty'}
},
longname = {
}
drinks.longname = {
['vessels:drinking_glass'] = {size = 2, name = 'jcu'},
['vessels:glass_bottle'] = {size = 4, name = 'jbo'},
['vessels:steel_bottle'] = {size = 4, name = 'jsb'},
['bucket:bucket_empty'] = {size = 16, name = 'jbu'},
['thirsty:steel_canteen'] = {size = 20, name = 'thirsty:steel_canteen'},
['thirsty:bronze_canteen'] = {size = 30, name = 'thirsty:bronze_canteen'},
},
}
drinks.juice_name = {
['apple'] = 'apple',
['cactus'] = 'cactus',
['blueberries'] = 'blueberries',
['melon_8'] = 'melon',
['melon_slice'] = 'melon',
['tomato'] = 'tomato',
['carrot'] = 'carrot',
['cucumber'] = 'cucumber',
['grapes'] = 'grapes',
['pumpkin'] = 'pumpkin',
['raspberries'] = 'raspberries',
['rhubarb'] = 'rhubarb',
['pineapple'] = 'pineapple',
['pineapple_ring'] = 'pineapple',
['banana'] = 'banana',
['orange'] = 'orange',
['prickly_pear'] = 'cactus',
['barrel_cacti_1'] = 'cactus'
}
-- Honestly not needed for default, but used as an example to add support to other mods.
-- Basically to use this all you need to do is add the name of the fruit to make juiceable (see line 14 for example)
-- Add the new fruit to a table like I've done in line 16.
-- The table should follow this scheme: internal name, Displayed name, colorize code.
-- Check out the drinks.lua file for more info how how the colorize code is used.
--Default
drinks.juiceable['apple'] = true -- Name of fruit to make juiceable.
drinks.juiceable['cactus'] = true
drinks.juiceable['blueberries'] = true
table.insert(drinks.drink_table, {'apple', 'Apple', '#ecff56'})
table.insert(drinks.drink_table, {'cactus', 'Cactus', '#96F97B'})
table.insert(drinks.drink_table, {'blueberries', 'Blueberry', '#521dcb'})
if minetest.get_modpath('default') then
drinks.juiceable['apple'] = true -- Name of fruit to make juiceable.
drinks.juiceable['cactus'] = true
drinks.juiceable['blueberries'] = true
table.insert(drinks.drink_table, {'apple', 'Apple', '#ecff56'})
table.insert(drinks.drink_table, {'cactus', 'Cactus', '#96F97B'})
table.insert(drinks.drink_table, {'blueberries', 'Blueberry', '#521dcb'})
end
--Farming_redo
drinks.juiceable['melon_8'] = true
drinks.juiceable['melon_slice'] = true
drinks.juiceable['tomato'] = true
drinks.juiceable['carrot'] = true
drinks.juiceable['cucumber'] = true
drinks.juiceable['grapes'] = true
drinks.juiceable['pumpkin'] = true
drinks.juiceable['raspberries'] = true
drinks.juiceable['rhubarb'] = true
drinks.juiceable['pineapple'] = true
drinks.juiceable['pineapple_ring'] = true
table.insert(drinks.drink_table, {'melon', 'Melon', '#ef4646'})
table.insert(drinks.drink_table, {'tomato', 'Tomato', '#990000'})
table.insert(drinks.drink_table, {'carrot', 'Carrot', '#ed9121'})
table.insert(drinks.drink_table, {'cucumber', 'Cucumber', '#73af59'})
table.insert(drinks.drink_table, {'grapes', 'Grape', '#b20056'})
table.insert(drinks.drink_table, {'pumpkin', 'Pumpkin', '#ffc04c'})
table.insert(drinks.drink_table, {'raspberries', 'Raspberry', '#C70039'})
table.insert(drinks.drink_table, {'rhubarb', 'Rhubarb', '#fb8461'})
table.insert(drinks.drink_table, {'pineapple', 'Pineapple', '#dcd611'})
if minetest.get_modpath('farming') then
drinks.juiceable['melon_8'] = true
drinks.juiceable['melon_slice'] = true
drinks.juiceable['tomato'] = true
drinks.juiceable['carrot'] = true
drinks.juiceable['cucumber'] = true
drinks.juiceable['grapes'] = true
drinks.juiceable['pumpkin'] = true
drinks.juiceable['raspberries'] = true
drinks.juiceable['rhubarb'] = true
drinks.juiceable['pineapple'] = true
drinks.juiceable['pineapple_ring'] = true
table.insert(drinks.drink_table, {'melon', 'Melon', '#ef4646'})
table.insert(drinks.drink_table, {'tomato', 'Tomato', '#990000'})
table.insert(drinks.drink_table, {'carrot', 'Carrot', '#ed9121'})
table.insert(drinks.drink_table, {'cucumber', 'Cucumber', '#73af59'})
table.insert(drinks.drink_table, {'grapes', 'Grape', '#b20056'})
table.insert(drinks.drink_table, {'pumpkin', 'Pumpkin', '#ffc04c'})
table.insert(drinks.drink_table, {'raspberries', 'Raspberry', '#C70039'})
table.insert(drinks.drink_table, {'rhubarb', 'Rhubarb', '#fb8461'})
table.insert(drinks.drink_table, {'pineapple', 'Pineapple', '#dcd611'})
end
--Epic_trees
drinks.juiceable['banana'] = true
drinks.juiceable['orange'] = true
table.insert(drinks.drink_table, {'banana', 'Banana', '#eced9f'})
table.insert(drinks.drink_table, {'orange', 'Orange', '#ffc417'})
if minetest.get_modpath('epic_trees') then
drinks.juiceable['banana'] = true
drinks.juiceable['orange'] = true
table.insert(drinks.drink_table, {'banana', 'Banana', '#eced9f'})
table.insert(drinks.drink_table, {'orange', 'Orange', '#ffc417'})
end
--Desert_life
drinks.juiceable['prickly_pear'] = true
drinks.juiceable['barrel_cacti_1'] = true
table.insert(drinks.drink_table, {'prickly', 'Cactus', '#96F97B'})
table.insert(drinks.drink_table, {'barrel', 'Cactus', '#96F97B'})
if minetest.get_modpath('desert_life') then
drinks.juiceable['prickly_pear'] = true
drinks.juiceable['barrel_cacti_1'] = true
table.insert(drinks.drink_table, {'prickly', 'Cactus', '#96F97B'})
table.insert(drinks.drink_table, {'barrel', 'Cactus', '#96F97B'})
end
-- replace craftitem to node definition
-- use existing node as template (e.g. 'vessel:glass_bottle')

View File

@ -1,4 +1,7 @@
local news = {
'7/23/20',
'Fixed a little issue in the drinks mod.',
'',
'7/22/20',
'You can ride tamed Ostriches.',
'',