diff --git a/craftitems.lua b/craftitems.lua index 460f627..179ab53 100644 --- a/craftitems.lua +++ b/craftitems.lua @@ -55,7 +55,7 @@ minetest.register_craftitem( "birthstones:topaz", { }) minetest.register_craftitem( "birthstones:zircon", { description = "Zircon", - inventory_image = "Zircon.png", + inventory_image = "birthstones_zircon.png", on_place_on_ground = minetest.craftitem_place_item, }) diff --git a/tools.lua b/tools.lua index a28d07b..3c8d2c9 100644 --- a/tools.lua +++ b/tools.lua @@ -1,14 +1,14 @@ -- START OF FUNCTIONS -- (START OF INIT IS FURTHER DOWN) -local function registerpickrecipe(name, durability, time1, time2, time3, maxlev) +local function create_tools_for_material(name, display_name, uses_vs_env, time1, time2, time3, maxlev) minetest.register_tool("birthstones:pick_" .. string.lower(name), { - description = name .. " Pickaxe", + description = display_name .. " Pickaxe", inventory_image = "birthstones_tool_" .. string.lower(name) .. "pick.png", tool_capabilities = { max_drop_level=0, groupcaps={ - cracky={times={[1]=time1, [2]=time2, [3]=time3}, uses=durability, maxlevel=maxlev} + cracky={times={[1]=time1, [2]=time2, [3]=time3}, uses=uses_vs_env, maxlevel=maxlev} } }, }) @@ -21,13 +21,13 @@ minetest.register_craft({ } }) minetest.register_tool("birthstones:axe_" .. string.lower(name), { - description = name .. " Axe", + description = display_name .. " Axe", inventory_image = "birthstones_tool_" .. string.lower(name) .. "axe.png", tool_capabilities = { max_drop_level=1, groupcaps={ - choppy={times={[1]=time1/2.0, [2]=time2/2.0, [3]=time3/2.0}, uses=30, maxlevel=maxlev}, - fleshy={times={[2]=time2, [3]=time3}, uses=40, maxlevel=maxlev} + choppy={times={[1]=time1/2.0, [2]=time2/2.0, [3]=time3/2.0}, uses=uses_vs_env, maxlevel=maxlev}, + fleshy={times={[2]=time2, [3]=time3}, uses=uses_vs_env/3*4, maxlevel=maxlev} } }, }) @@ -40,14 +40,14 @@ minetest.register_craft({ } }) minetest.register_tool("birthstones:shovel_" .. string.lower(name), { - description = name .. " Shovel", + description = display_name .. " Shovel", inventory_image = "birthstones_tool_" .. string.lower(name) .. "shovel.png", wield_image = "birthstones_tool_" .. string.lower(name) .. "shovel.png^[transformR90", tool_capabilities = { full_punch_interval = 1.0, max_drop_level=1, groupcaps={ - crumbly = {times={[1]=1.10, [2]=0.50, [3]=0.30}, uses=30, maxlevel=3}, + crumbly = {times={[1]=1.10, [2]=0.50, [3]=0.30}, uses=uses_vs_env, maxlevel=3}, }, damage_groups = {fleshy=4}, }, @@ -61,22 +61,18 @@ minetest.register_craft({ {'', 'default:stick'} } }) -end - -local function registerswordrecipe(name) minetest.register_tool("birthstones:sword_" .. string.lower(name), { - description = name .. " Pickaxe", + description = display_name .. " Sword", inventory_image = "birthstones_tool_" .. string.lower(name) .. "pick.png", tool_capabilities = { - full_punch_interval = 0.9, - max_drop_level=3, + full_punch_interval = 0.7, + max_drop_level=1, groupcaps={ - cracky = {times={[1]=2.0, [2]=1.0, [3]=0.50}, uses=30, maxlevel=3}, + snappy={times={[1]=1.90, [2]=0.90, [3]=0.30}, uses=uses_vs_env/3*4, maxlevel=3}, }, - damage_groups = {fleshy=5}, + damage_groups = {fleshy=8}, }, sound = {breaks = "default_tool_breaks"}, - }) minetest.register_craft({ output = "birthstones:sword_" .. string.lower(name), @@ -86,81 +82,30 @@ minetest.register_craft({ {'', 'default:stick'} } }) + end -- END OF FUNCTIONS -- START OF INIT -registerswordrecipe("Alexandrite") -registerswordrecipe("Amethyst") -registerswordrecipe("Aquamarine") --- NOTE: Diamond is done manually below so as to be named White Diamond -registerswordrecipe("Emerald") -registerswordrecipe("Garnet") -registerswordrecipe("Opal") -registerswordrecipe("Peridot") -registerswordrecipe("Ruby") -registerswordrecipe("Sapphire") -registerswordrecipe("Topaz") -registerswordrecipe("Zircon") - -minetest.register_tool("birthstones:sword_diamond", { - description = "White Diamond Sword", - inventory_image = "birthstones_tool_diamondsword.png", - tool_capabilities = { - full_punch_interval = 0.7, - max_drop_level=1, - groupcaps={ - snappy={times={[1]=1.90, [2]=0.90, [3]=0.30}, uses=40, maxlevel=3}, - }, - damage_groups = {fleshy=8}, - }, - sound = {breaks = "default_tool_breaks"}, -}) -minetest.register_craft({ - output = "birthstones:sword_diamond", - recipe = { - {'', 'birthstones:diamond'}, - {'', 'birthstones:diamond'}, - {'', 'default:stick'} - } -}) - -minetest.register_tool("birthstones:shovel_diamond", { - description = "White Diamond Shovel", - inventory_image = "birthstones_tool_diamondshovel.png", - wield_image = "birthstones_tool_diamondshovel.png^[transformR90", - tool_capabilities = { - full_punch_interval = 1.0, - max_drop_level=1, - groupcaps={ - crumbly = {times={[1]=1.10, [2]=0.50, [3]=0.30}, uses=30, maxlevel=3}, - }, - damage_groups = {fleshy=4}, - }, - sound = {breaks = "default_tool_breaks"}, -}) -minetest.register_craft({ - output = "birthstones:shovel_diamond", - recipe = { - {'', 'birthstones:diamond'}, - {'', 'default:stick'}, - {'', 'default:stick'} - } -}) - - --- name, durability, time1, time2, time3, maxlev -registerpickrecipe("Alexandrite", 30, 3.2, 1.40, 0.90, 1) -registerpickrecipe("Amethyst", 30, 3.2, 1.40, 0.90, 1) -registerpickrecipe("Aquamarine", 25, 3.2, 1.40, 0.90, 1) -registerpickrecipe("Diamond", 50, 4.5, 1.8, 1.3, 3) -registerpickrecipe("Emerald", 40, 4.2, 1.6, 1.2, 2) -registerpickrecipe("Garnet", 35, 4.0, 1.5, 1.0, 1) -registerpickrecipe("Opal", 32, 3.5, 1.6, 1.5, 2) -registerpickrecipe("Peridot", 34, 4.0, 1.5, 1.0, 1) -registerpickrecipe("Ruby", 40, 4.2, 1.6, 1.2, 2) -registerpickrecipe("Sapphire", 40, 4.2, 1.6, 1.2, 1) -registerpickrecipe("Topaz", 38, 4.1, 1.6, 1.05, 1) -registerpickrecipe("Zircon", 50, 4.1, 1.6, 1.05, 1) +-- default:diamond: +-- sword uses=40 +-- pick uses=30 +-- default:stone: +-- sword uses=20 +-- pick uses=20 +-- name, display_name, uses_vs_env, time1, time2, time3, maxlev +--uses_vs_env: normal use (bonus is added for fleshy target) +create_tools_for_material("Alexandrite", "Alexandrite", 17, 3.2, 1.40, 0.90, 1) +create_tools_for_material("Amethyst", "Amethyst", 17, 3.2, 1.40, 0.90, 1) +create_tools_for_material("Aquamarine", "Aquamarine", 15, 3.2, 1.40, 0.90, 1) +create_tools_for_material("Diamond", "White Diamond", 30, 4.5, 1.8, 1.3, 3) +create_tools_for_material("Emerald", "Emerald", 27, 4.2, 1.6, 1.2, 2) +create_tools_for_material("Garnet", "Garnet", 22, 4.0, 1.5, 1.0, 1) +create_tools_for_material("Opal", "Opal", 19, 3.5, 1.6, 1.5, 2) +create_tools_for_material("Peridot", "Peridot", 24, 4.0, 1.5, 1.0, 1) +create_tools_for_material("Ruby", "Ruby", 27, 4.2, 1.6, 1.2, 2) +create_tools_for_material("Sapphire", "Sapphire", 27, 4.2, 1.6, 1.2, 1) +create_tools_for_material("Topaz", "Topaz", 25, 4.1, 1.6, 1.05, 1) +create_tools_for_material("Zircon", "Zircon", 30, 4.1, 1.6, 1.05, 1)