Add initial elixirs.
This commit is contained in:
parent
04c6051e8a
commit
9193317ca6
13 changed files with 78 additions and 5 deletions
53
armor.lua
Normal file
53
armor.lua
Normal file
|
@ -0,0 +1,53 @@
|
|||
fun_caves.armor_expire = {}
|
||||
|
||||
local function armor(user, factor)
|
||||
local player_name = user:get_player_name()
|
||||
user:set_armor_groups({fleshy=factor})
|
||||
--print(dump(user:get_armor_groups()))
|
||||
minetest.chat_send_player(player_name, 'Your skin feels harder...')
|
||||
fun_caves.armor_expire[player_name] = minetest.get_us_time() + 3600 * 1000000
|
||||
end
|
||||
|
||||
local descs = {
|
||||
{'wood', 95, 'group:wood'},
|
||||
{'stone', 90, 'group:stone'},
|
||||
{'steel', 80, 'default:steel_ingot'},
|
||||
{'copper', 85, 'default:copper_ingot'},
|
||||
{'bronze', 70, 'default:bronze_ingot'},
|
||||
{'gold', 60, 'default:gold_ingot'},
|
||||
{'diamond', 50, 'default:diamond'},
|
||||
{'silver', 40, 'fun_caves:silver_ingot'},
|
||||
{'mese', 30, 'default:mese_crystal'},
|
||||
--{'', 20, ''},
|
||||
--{'adamant', 10, 'fun_caves:adamant'},
|
||||
}
|
||||
|
||||
for _, desc in pairs(descs) do
|
||||
local name = desc[1]
|
||||
local value = desc[2]
|
||||
local cap = name:gsub('^%l', string.upper)
|
||||
minetest.register_craftitem("fun_caves:liquid_"..name, {
|
||||
description = 'Dr Robertson\'s Patented Liquid '..cap..' Elixir',
|
||||
drawtype = "plantlike",
|
||||
paramtype = "light",
|
||||
tiles = {'fun_caves_liquid_'..name..'.png'},
|
||||
inventory_image = 'fun_caves_liquid_'..name..'.png',
|
||||
groups = {dig_immediate = 3},
|
||||
sounds = default.node_sound_glass_defaults(),
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
armor(user, value)
|
||||
itemstack:take_item()
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_craft({
|
||||
type = "shapeless",
|
||||
output = 'fun_caves:liquid_'..name,
|
||||
recipe = {
|
||||
"mobs_slimes:green_slimeball",
|
||||
desc[3],
|
||||
"vessels:glass_bottle",
|
||||
},
|
||||
})
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue