Add breathing elixir.
This commit is contained in:
parent
8eedc5afc3
commit
1caf0fba61
3 changed files with 82 additions and 38 deletions
82
elixir.lua
82
elixir.lua
|
@ -11,7 +11,6 @@ local elixir_ingredients = {
|
||||||
'default:aspen_sapling',
|
'default:aspen_sapling',
|
||||||
'default:aspen_tree',
|
'default:aspen_tree',
|
||||||
'default:aspen_wood',
|
'default:aspen_wood',
|
||||||
'default:bronze_lump',
|
|
||||||
'default:cactus',
|
'default:cactus',
|
||||||
'default:clay_lump',
|
'default:clay_lump',
|
||||||
'default:cloud',
|
'default:cloud',
|
||||||
|
@ -32,8 +31,6 @@ local elixir_ingredients = {
|
||||||
'default:jungletree',
|
'default:jungletree',
|
||||||
'default:junglewood',
|
'default:junglewood',
|
||||||
'default:leaves',
|
'default:leaves',
|
||||||
'default:mese_crystal',
|
|
||||||
'default:obsidian',
|
|
||||||
'default:pine_needles',
|
'default:pine_needles',
|
||||||
'default:pine_sapling',
|
'default:pine_sapling',
|
||||||
'default:pine_tree',
|
'default:pine_tree',
|
||||||
|
@ -61,7 +58,6 @@ local elixir_ingredients = {
|
||||||
'fun_caves:bird_of_paradise',
|
'fun_caves:bird_of_paradise',
|
||||||
'fun_caves:black_sand',
|
'fun_caves:black_sand',
|
||||||
'fun_caves:brain_coral',
|
'fun_caves:brain_coral',
|
||||||
'fun_caves:cloud',
|
|
||||||
'fun_caves:diamondwood',
|
'fun_caves:diamondwood',
|
||||||
'fun_caves:dragon_eye',
|
'fun_caves:dragon_eye',
|
||||||
'fun_caves:dry_fiber',
|
'fun_caves:dry_fiber',
|
||||||
|
@ -69,25 +65,15 @@ local elixir_ingredients = {
|
||||||
'fun_caves:giant_mushroom_cap',
|
'fun_caves:giant_mushroom_cap',
|
||||||
'fun_caves:giant_mushroom_stem',
|
'fun_caves:giant_mushroom_stem',
|
||||||
'fun_caves:hibiscus',
|
'fun_caves:hibiscus',
|
||||||
'fun_caves:hot_brass',
|
|
||||||
'fun_caves:hot_cobble',
|
|
||||||
'fun_caves:hot_iron',
|
|
||||||
'fun_caves:huge_mushroom_cap',
|
'fun_caves:huge_mushroom_cap',
|
||||||
'fun_caves:icicle_down',
|
'fun_caves:icicle_down',
|
||||||
'fun_caves:icicle_up',
|
'fun_caves:icicle_up',
|
||||||
'fun_caves:ironwood',
|
'fun_caves:ironwood',
|
||||||
'fun_caves:leaves',
|
'fun_caves:leaves',
|
||||||
'fun_caves:leaves_black',
|
|
||||||
'fun_caves:leaves_lumin',
|
|
||||||
'fun_caves:lumin_tree',
|
|
||||||
'fun_caves:moon_weed',
|
|
||||||
'fun_caves:onion',
|
'fun_caves:onion',
|
||||||
'fun_caves:orchid',
|
'fun_caves:orchid',
|
||||||
'fun_caves:petrified_wood',
|
'fun_caves:petrified_wood',
|
||||||
'fun_caves:pillar_coral',
|
'fun_caves:pillar_coral',
|
||||||
'fun_caves:polluted_dirt',
|
|
||||||
'fun_caves:precious_coral',
|
|
||||||
'fun_caves:radioactive_ore',
|
|
||||||
'fun_caves:small_rocks',
|
'fun_caves:small_rocks',
|
||||||
'fun_caves:staghorn_coral',
|
'fun_caves:staghorn_coral',
|
||||||
'fun_caves:stalactite',
|
'fun_caves:stalactite',
|
||||||
|
@ -96,21 +82,18 @@ local elixir_ingredients = {
|
||||||
'fun_caves:stalagmite',
|
'fun_caves:stalagmite',
|
||||||
'fun_caves:stalagmite_mossy',
|
'fun_caves:stalagmite_mossy',
|
||||||
'fun_caves:stalagmite_slimy',
|
'fun_caves:stalagmite_slimy',
|
||||||
'fun_caves:storm_cloud',
|
|
||||||
'fun_caves:thin_ice',
|
'fun_caves:thin_ice',
|
||||||
'fun_caves:tree',
|
'fun_caves:tree',
|
||||||
'wool:white',
|
'wool:white',
|
||||||
'wool:black',
|
'wool:black',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
local count = 0
|
||||||
for _, name in pairs(elixir_ingredients) do
|
for _, name in pairs(elixir_ingredients) do
|
||||||
local item = minetest.registered_items[name]
|
local item = minetest.registered_items[name]
|
||||||
if not item then
|
if not item then
|
||||||
item = minetest.registered_nodes[name]
|
item = minetest.registered_nodes[name]
|
||||||
end
|
end
|
||||||
if not item then
|
|
||||||
break
|
|
||||||
end
|
|
||||||
if item then
|
if item then
|
||||||
if item.groups then
|
if item.groups then
|
||||||
groups = table.copy(item.groups)
|
groups = table.copy(item.groups)
|
||||||
|
@ -119,10 +102,13 @@ for _, name in pairs(elixir_ingredients) do
|
||||||
end
|
end
|
||||||
groups.elixir_ingredient = 1
|
groups.elixir_ingredient = 1
|
||||||
minetest.override_item(name, {groups = groups})
|
minetest.override_item(name, {groups = groups})
|
||||||
|
count = count + 1
|
||||||
else
|
else
|
||||||
--print(name)
|
--print(name)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if count > 15 then
|
||||||
--for _, list in pairs({'registered_items', 'registered_nodes', 'registered_craftitems'}) do
|
--for _, list in pairs({'registered_items', 'registered_nodes', 'registered_craftitems'}) do
|
||||||
-- for _, item in pairs(minetest[list]) do
|
-- for _, item in pairs(minetest[list]) do
|
||||||
-- if item and item.groups.elixir_ingredient then
|
-- if item and item.groups.elixir_ingredient then
|
||||||
|
@ -131,8 +117,10 @@ end
|
||||||
-- end
|
-- end
|
||||||
--end
|
--end
|
||||||
|
|
||||||
|
local elixirs = {}
|
||||||
|
|
||||||
minetest.register_craftitem("fun_caves:elixir", {
|
minetest.register_craftitem("fun_caves:elixir", {
|
||||||
description = "Unknown Elixir",
|
description = "unknown elixir",
|
||||||
inventory_image = "fun_caves_elixir.png",
|
inventory_image = "fun_caves_elixir.png",
|
||||||
on_use = minetest.item_eat(-2),
|
on_use = minetest.item_eat(-2),
|
||||||
})
|
})
|
||||||
|
@ -160,6 +148,62 @@ minetest.register_craft({
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
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_breathe',
|
||||||
|
recipe = {
|
||||||
|
'mobs_slimes:green_slimeball',
|
||||||
|
'fun_caves:coral_gem',
|
||||||
|
"vessels:glass_bottle",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
minetest.register_craft({
|
||||||
|
type = "shapeless",
|
||||||
|
output = 'fun_caves:elixir_breathe',
|
||||||
|
recipe = {
|
||||||
|
'fun_caves:syrup',
|
||||||
|
'fun_caves:coral_gem',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
fun_caves.register_status({
|
fun_caves.register_status({
|
||||||
name = 'armor_elixir',
|
name = 'armor_elixir',
|
||||||
|
|
2
init.lua
2
init.lua
|
@ -56,7 +56,7 @@ end
|
||||||
if not fun_caves.db then
|
if not fun_caves.db then
|
||||||
fun_caves.db = {}
|
fun_caves.db = {}
|
||||||
end
|
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
|
if not fun_caves.db[i] then
|
||||||
fun_caves.db[i] = {}
|
fun_caves.db[i] = {}
|
||||||
end
|
end
|
||||||
|
|
BIN
textures/fun_caves_elixir_breathe.png
Normal file
BIN
textures/fun_caves_elixir_breathe.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
Loading…
Add table
Add a link
Reference in a new issue