diff --git a/elixir.lua b/elixir.lua index 1ac8c56..b681e02 100644 --- a/elixir.lua +++ b/elixir.lua @@ -11,7 +11,6 @@ local elixir_ingredients = { 'default:aspen_sapling', 'default:aspen_tree', 'default:aspen_wood', - 'default:bronze_lump', 'default:cactus', 'default:clay_lump', 'default:cloud', @@ -32,8 +31,6 @@ local elixir_ingredients = { 'default:jungletree', 'default:junglewood', 'default:leaves', - 'default:mese_crystal', - 'default:obsidian', 'default:pine_needles', 'default:pine_sapling', 'default:pine_tree', @@ -61,7 +58,6 @@ local elixir_ingredients = { 'fun_caves:bird_of_paradise', 'fun_caves:black_sand', 'fun_caves:brain_coral', - 'fun_caves:cloud', 'fun_caves:diamondwood', 'fun_caves:dragon_eye', 'fun_caves:dry_fiber', @@ -69,25 +65,15 @@ local elixir_ingredients = { 'fun_caves:giant_mushroom_cap', 'fun_caves:giant_mushroom_stem', 'fun_caves:hibiscus', - 'fun_caves:hot_brass', - 'fun_caves:hot_cobble', - 'fun_caves:hot_iron', 'fun_caves:huge_mushroom_cap', 'fun_caves:icicle_down', 'fun_caves:icicle_up', 'fun_caves:ironwood', 'fun_caves:leaves', - 'fun_caves:leaves_black', - 'fun_caves:leaves_lumin', - 'fun_caves:lumin_tree', - 'fun_caves:moon_weed', 'fun_caves:onion', 'fun_caves:orchid', 'fun_caves:petrified_wood', 'fun_caves:pillar_coral', - 'fun_caves:polluted_dirt', - 'fun_caves:precious_coral', - 'fun_caves:radioactive_ore', 'fun_caves:small_rocks', 'fun_caves:staghorn_coral', 'fun_caves:stalactite', @@ -96,21 +82,18 @@ local elixir_ingredients = { 'fun_caves:stalagmite', 'fun_caves:stalagmite_mossy', 'fun_caves:stalagmite_slimy', - 'fun_caves:storm_cloud', 'fun_caves:thin_ice', 'fun_caves:tree', 'wool:white', 'wool:black', } +local count = 0 for _, name in pairs(elixir_ingredients) do local item = minetest.registered_items[name] if not item then item = minetest.registered_nodes[name] end - if not item then - break - end if item then if item.groups then groups = table.copy(item.groups) @@ -119,44 +102,105 @@ for _, name in pairs(elixir_ingredients) do end groups.elixir_ingredient = 1 minetest.override_item(name, {groups = groups}) + count = count + 1 else --print(name) end end ---for _, list in pairs({'registered_items', 'registered_nodes', 'registered_craftitems'}) do --- for _, item in pairs(minetest[list]) do --- if item and item.groups.elixir_ingredient then --- print(item.name) --- end --- end ---end -minetest.register_craftitem("fun_caves:elixir", { - description = "Unknown Elixir", - inventory_image = "fun_caves_elixir.png", - on_use = minetest.item_eat(-2), +if count > 15 then + --for _, list in pairs({'registered_items', 'registered_nodes', 'registered_craftitems'}) do + -- for _, item in pairs(minetest[list]) do + -- if item and item.groups.elixir_ingredient then + -- print(item.name) + -- end + -- end + --end + + local elixirs = {} + + minetest.register_craftitem("fun_caves:elixir", { + description = "unknown elixir", + inventory_image = "fun_caves_elixir.png", + on_use = minetest.item_eat(-2), + }) + + minetest.register_craft({ + type = "shapeless", + output = 'fun_caves:elixir', + recipe = { + 'mobs_slimes:green_slimeball', + 'group:elixir_ingredient', + 'group:elixir_ingredient', + 'group:elixir_ingredient', + "vessels:glass_bottle", + }, + }) + + minetest.register_craft({ + type = "shapeless", + output = 'fun_caves:elixir', + recipe = { + 'fun_caves:syrup', + 'group:elixir_ingredient', + 'group:elixir_ingredient', + 'group:elixir_ingredient', + }, + }) + + minetest.register_on_craft(function(itemstack, player, old_craft_grid, craft_inv) + if itemstack:get_name() ~= "fun_caves:elixir" then + return + end + + local ingredients = {} + for i = 1, player:get_inventory():get_size("craft") do + local name = old_craft_grid[i]:get_name() + if name ~= '' and name ~= 'fun_caves:syrup' and not name:find('green_slimeball$') then + ingredients[#ingredients+1] = name + print(name) + end + end + end) +end + + +fun_caves.register_status({ + name = 'breathe', + terminate = function(player) + local player_name = player:get_player_name() + minetest.chat_send_player(player_name, minetest.colorize('#FF0000', 'Your breathing becomes more difficult...')) + end, +}) + +minetest.register_craftitem("fun_caves:elixir_breathe", { + description = 'Dr Robertson\'s Patented Easy Breathing Elixir', + inventory_image = "fun_caves_elixir_breathe.png", + on_use = function(itemstack, user, pointed_thing) + local player_name = user:get_player_name() + fun_caves.set_status(user:get_player_name(), 'breathe', elixir_duration) + minetest.chat_send_player(player_name, 'Your breathing becomes easier...') + itemstack:take_item() + return itemstack + end, }) minetest.register_craft({ type = "shapeless", - output = 'fun_caves:elixir', + output = 'fun_caves:elixir_breathe', recipe = { 'mobs_slimes:green_slimeball', - 'group:elixir_ingredient', - 'group:elixir_ingredient', - 'group:elixir_ingredient', + 'fun_caves:coral_gem', "vessels:glass_bottle", }, }) minetest.register_craft({ type = "shapeless", - output = 'fun_caves:elixir', + output = 'fun_caves:elixir_breathe', recipe = { 'fun_caves:syrup', - 'group:elixir_ingredient', - 'group:elixir_ingredient', - 'group:elixir_ingredient', + 'fun_caves:coral_gem', }, }) diff --git a/init.lua b/init.lua index 9bc2ea3..df6c48d 100644 --- a/init.lua +++ b/init.lua @@ -56,7 +56,7 @@ end if not fun_caves.db then fun_caves.db = {} end -for _, i in pairs({'teleport_data', 'hunger', 'status', 'translocators'}) do +for _, i in pairs({'teleport_data', 'hunger', 'status', 'translocators', 'elixir_formulae'}) do if not fun_caves.db[i] then fun_caves.db[i] = {} end diff --git a/textures/fun_caves_elixir_breathe.png b/textures/fun_caves_elixir_breathe.png new file mode 100644 index 0000000..8f157de Binary files /dev/null and b/textures/fun_caves_elixir_breathe.png differ