mirror of
https://github.com/minetest/minetest_game.git
synced 2025-01-05 04:50:18 +01:00
make tool registration functions local, remove general tool registration function, change to tables instead of arguments for registration, leave tool descriptions as is for translation
This commit is contained in:
parent
99d505c34d
commit
ded4d5c917
@ -19,126 +19,374 @@ minetest.override_item("", {
|
||||
}
|
||||
})
|
||||
|
||||
-- Default-type tool registration function
|
||||
|
||||
function default.register_tool_of_type(name, desc, img, wimg, punch_interval, max_drop_lvl, gc1, gc2, gc3, use_count, maxlvl, dmg, extra_groups, mat, typename, typedesc, typebreak, typetool, typeshape)
|
||||
extra_groups[typetool] = 1
|
||||
local mygroupcaps = {}
|
||||
mygroupcaps[typebreak] = {times={[1]=gc1, [2]=gc2, [3]=gc3}, uses=use_count, maxlevel=maxlvl}
|
||||
minetest.register_tool("default:"..typename.."_"..name, {
|
||||
description = S(desc.." "..typedesc),
|
||||
inventory_image = img,
|
||||
wield_image = wimg,
|
||||
tool_capabilities = {
|
||||
full_punch_interval = punch_interval,
|
||||
max_drop_level=max_drop_lvl,
|
||||
groupcaps=mygroupcaps,
|
||||
damage_groups = {fleshy=dmg},
|
||||
},
|
||||
sound = {breaks = "default_tool_breaks"},
|
||||
groups = extra_groups
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "default:"..typename.."_"..name,
|
||||
recipe = typeshape
|
||||
})
|
||||
end
|
||||
|
||||
--
|
||||
-- Picks
|
||||
--
|
||||
|
||||
function default.register_pick(name, desc, img, punch_interval, max_drop_lvl, gc1, gc2, gc3, use_count, maxlvl, dmg, extra_groups, mat)
|
||||
default.register_tool_of_type(name, desc, img, nil, punch_interval, max_drop_lvl, gc1, gc2, gc3, use_count, maxlvl, dmg, extra_groups, mat, "pick", "Pickaxe", "cracky", "pickaxe", {
|
||||
{mat, mat, mat},
|
||||
{"", "group:stick", ""},
|
||||
{"", "group:stick", ""}
|
||||
local function register_pick(tool_def)
|
||||
if tool_def.groups == nil then
|
||||
tool_def.groups = {}
|
||||
end
|
||||
tool_def.groups["pickaxe"] = 1
|
||||
minetest.register_tool("default:pick_"..tool_def.name, {
|
||||
description = tool_def.desc,
|
||||
inventory_image = "default_tool_"..tool_def.name.."pick.png",
|
||||
tool_capabilities = {
|
||||
full_punch_interval = tool_def.punch_interval,
|
||||
max_drop_level = tool_def.max_drop_level,
|
||||
groupcaps = {cracky = tool_def.caps},
|
||||
damage_groups = {fleshy = tool_def.damage},
|
||||
},
|
||||
sound = {breaks = "default_tool_breaks"},
|
||||
groups = tool_def.groups,
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "default:pick_"..tool_def.name,
|
||||
recipe = {
|
||||
{tool_def.material, tool_def.material, tool_def.material},
|
||||
{"", "group:stick", ""},
|
||||
{"", "group:stick", ""}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
default.register_pick("wood", "Wooden", "default_tool_woodpick.png", 1.2, 0, nil, nil, 1.60, 10, 1, 2, {flammable = 2}, "group:wood")
|
||||
register_pick({
|
||||
name = "wood",
|
||||
desc = S("Wooden Pickaxe"),
|
||||
punch_interval = 1.2,
|
||||
max_drop_level = 0,
|
||||
caps = {times = {[3]=1.60}, uses=10, maxlevel=1},
|
||||
damage = 2,
|
||||
groups = {flammable = 2},
|
||||
material = "group:wood"
|
||||
})
|
||||
|
||||
default.register_pick("stone", "Stone", "default_tool_stonepick.png", 1.3, 0, nil, 2.0, 1.00, 20, 1, 3, {}, "group:stone")
|
||||
register_pick({
|
||||
name = "stone",
|
||||
desc = S("Stone Pickaxe"),
|
||||
punch_interval = 1.3,
|
||||
max_drop_level = 0,
|
||||
caps = {times = {[2]=2.0, [3]=1.00}, uses=20, maxlevel = 1},
|
||||
damage = 3,
|
||||
material = "group:stone"
|
||||
})
|
||||
|
||||
default.register_pick("bronze", "Bronze", "default_tool_bronzepick.png", 1.0, 1, 4.50, 1.80, 0.90, 20, 2, 4, {}, "default:bronze_ingot")
|
||||
register_pick({
|
||||
name = "bronze",
|
||||
desc = S("Bronze Pickaxe"),
|
||||
punch_interval = 1.0,
|
||||
max_drop_level = 1,
|
||||
caps = {times = {[1]=4.50, [2]=1.80, [3]=0.90}, uses=20, maxlevel = 2},
|
||||
damage = 4,
|
||||
material = "default:bronze_ingot"
|
||||
})
|
||||
|
||||
default.register_pick("steel", "Steel", "default_tool_steelpick.png", 1.0, 1, 4.00, 1.60, 0.80, 20, 2, 4, {}, "default:steel_ingot")
|
||||
register_pick({
|
||||
name = "steel",
|
||||
desc = S("Steel Pickaxe"),
|
||||
punch_interval = 1.0,
|
||||
max_drop_level = 1,
|
||||
caps = {times = {[1]=4.00, [2]=1.60, [3]=0.80}, uses=20, maxlevel = 2},
|
||||
damage = 4,
|
||||
material = "default:steel_ingot"
|
||||
})
|
||||
|
||||
default.register_pick("mese", "Mese", "default_tool_mesepick.png", 0.9, 3, 2.4, 1.2, 0.60, 20, 3, 5, {}, "default:mese_crystal")
|
||||
register_pick({
|
||||
name = "mese",
|
||||
desc = S("Mese Pickaxe"),
|
||||
punch_interval = 0.9,
|
||||
max_drop_level = 3,
|
||||
caps = {times = {[1]=2.4, [2]=1.2, [3]=0.60}, uses=20, maxlevel = 3},
|
||||
damage = 5,
|
||||
material = "default:mese_crystal"
|
||||
})
|
||||
|
||||
default.register_pick("diamond", "Diamond", "default_tool_diamondpick.png", 0.9, 3, 2.0, 1.0, 0.50, 30, 3, 5, {}, "default:diamond")
|
||||
register_pick({
|
||||
name = "diamond",
|
||||
desc = S("Diamond Pickaxe"),
|
||||
punch_interval = 0.9,
|
||||
max_drop_level = 3,
|
||||
caps = {times = {[1]=2.0, [2]=1.0, [3]=0.50}, uses=30, maxlevel = 3},
|
||||
damage = 5,
|
||||
material = "default:diamond"
|
||||
})
|
||||
|
||||
--
|
||||
-- Shovels
|
||||
--
|
||||
|
||||
function default.register_shovel(name, desc, img, punch_interval, max_drop_lvl, gc1, gc2, gc3, use_count, maxlvl, dmg, extra_groups, mat)
|
||||
default.register_tool_of_type(name, desc, img, img.."^[transformR90", punch_interval, max_drop_lvl, gc1, gc2, gc3, use_count, maxlvl, dmg, extra_groups, mat, "shovel", "Shovel", "crumbly", "shovel", {
|
||||
{mat},
|
||||
{"group:stick"},
|
||||
{"group:stick"}
|
||||
local function register_shovel(tool_def)
|
||||
if tool_def.groups == nil then
|
||||
tool_def.groups = {}
|
||||
end
|
||||
tool_def.groups["shovel"] = 1
|
||||
minetest.register_tool("default:shovel_"..tool_def.name, {
|
||||
description = tool_def.desc,
|
||||
inventory_image = "default_tool_"..tool_def.name.."shovel.png",
|
||||
wield_image = "default_tool_"..tool_def.name.."shovel.png^[transformR90",
|
||||
tool_capabilities = {
|
||||
full_punch_interval = tool_def.punch_interval,
|
||||
max_drop_level = tool_def.max_drop_level,
|
||||
groupcaps = {crumbly = tool_def.caps},
|
||||
damage_groups = {fleshy = tool_def.damage},
|
||||
},
|
||||
sound = {breaks = "default_tool_breaks"},
|
||||
groups = tool_def.groups
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "default:shovel_"..tool_def.name,
|
||||
recipe = {
|
||||
{tool_def.material},
|
||||
{"group:stick"},
|
||||
{"group:stick"}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
default.register_shovel("wood", "Wooden", "default_tool_woodshovel.png", 1.2, 0, 3.00, 1.60, 0.60, 10, 1, 2, {flammable = 2}, "group:wood")
|
||||
register_shovel({
|
||||
name = "wood",
|
||||
desc = S("Wooden Shovel"),
|
||||
punch_interval = 1.2,
|
||||
max_drop_level = 0,
|
||||
caps = {times = {[1]=3.00, [2]=1.60, [3]=0.60}, uses=10, maxlevel=1},
|
||||
damage = 2,
|
||||
groups = {flammable = 2},
|
||||
material = "group:wood"
|
||||
})
|
||||
|
||||
default.register_shovel("stone", "Stone", "default_tool_stoneshovel.png", 1.4, 0, 1.80, 1.20, 0.50, 20, 1, 2, {}, "group:stone")
|
||||
register_shovel({
|
||||
name = "stone",
|
||||
desc = S("Stone Shovel"),
|
||||
punch_interval = 1.4,
|
||||
max_drop_level = 0,
|
||||
caps = {times = {[1]=1.80, [2]=1.20, [3]=0.50}, uses=20, maxlevel=1},
|
||||
damage = 2,
|
||||
material = "group:stone"
|
||||
})
|
||||
|
||||
default.register_shovel("bronze", "Bronze", "default_tool_bronzeshovel.png", 1.1, 1, 1.65, 1.05, 0.45, 25, 2, 3, {}, "default:bronze_ingot")
|
||||
register_shovel({
|
||||
name = "bronze",
|
||||
desc = S("Bronze Shovel"),
|
||||
punch_interval = 1.1,
|
||||
max_drop_level = 1,
|
||||
caps = {times = {[1]=1.65, [2]=1.05, [3]=0.45}, uses=25, maxlevel=2},
|
||||
damage = 3,
|
||||
material = "default:bronze_ingot"
|
||||
})
|
||||
|
||||
default.register_shovel("steel", "Steel", "default_tool_steelshovel.png", 1.1, 1, 1.50, 0.90, 0.40, 30, 2, 3, {}, "default:steel_ingot")
|
||||
register_shovel({
|
||||
name = "steel",
|
||||
desc = S("Steel Shovel"),
|
||||
punch_interval = 1.1,
|
||||
max_drop_level = 1,
|
||||
caps = {times = {[1]=1.50, [2]=0.90, [3]=0.40}, uses=30, maxlevel=2},
|
||||
damage = 3,
|
||||
material = "default:steel_ingot"
|
||||
})
|
||||
|
||||
default.register_shovel("mese", "Mese", "default_tool_meseshovel.png", 1.0, 3, 1.20, 0.60, 0.30, 20, 3, 4, {}, "default:mese_crystal")
|
||||
register_shovel({
|
||||
name = "mese",
|
||||
desc = S("Mese Shovel"),
|
||||
punch_interval = 1.0,
|
||||
max_drop_level = 3,
|
||||
caps = {times = {[1]=1.20, [2]=0.60, [3]=0.30}, uses=20, maxlevel=3},
|
||||
damage = 4,
|
||||
material = "default:mese_crystal"
|
||||
})
|
||||
|
||||
default.register_shovel("diamond", "Diamond", "default_tool_diamondshovel.png", 1.0, 1, 1.10, 0.50, 0.30, 30, 3, 4, {}, "default:diamond")
|
||||
register_shovel({
|
||||
name = "diamond",
|
||||
desc = S("Diamond Shovel"),
|
||||
punch_interval = 1.0,
|
||||
max_drop_level = 1,
|
||||
caps = {times = {[1]=1.10, [2]=0.50, [3]=0.30}, uses=30, maxlevel=3},
|
||||
damage = 4,
|
||||
material = "default:diamond"
|
||||
})
|
||||
|
||||
--
|
||||
-- Axes
|
||||
--
|
||||
|
||||
function default.register_axe(name, desc, img, punch_interval, max_drop_lvl, gc1, gc2, gc3, use_count, maxlvl, dmg, extra_groups, mat)
|
||||
default.register_tool_of_type(name, desc, img, nil, punch_interval, max_drop_lvl, gc1, gc2, gc3, use_count, maxlvl, dmg, extra_groups, mat, "axe", "Axe", "choppy", "axe", {
|
||||
{mat, mat},
|
||||
{mat, "group:stick"},
|
||||
{"", "group:stick"}
|
||||
local function register_axe(tool_def)
|
||||
if tool_def.groups == nil then
|
||||
tool_def.groups = {}
|
||||
end
|
||||
tool_def.groups["axe"] = 1
|
||||
minetest.register_tool("default:axe_"..tool_def.name, {
|
||||
description = tool_def.desc,
|
||||
inventory_image = "default_tool_"..tool_def.name.."axe.png",
|
||||
tool_capabilities = {
|
||||
full_punch_interval = tool_def.punch_interval,
|
||||
max_drop_level = tool_def.max_drop_level,
|
||||
groupcaps = {choppy = tool_def.caps},
|
||||
damage_groups = {fleshy = tool_def.damage},
|
||||
},
|
||||
sound = {breaks = "default_tool_breaks"},
|
||||
groups = tool_def.groups
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "default:axe_"..tool_def.name,
|
||||
recipe = {
|
||||
{tool_def.material, tool_def.material},
|
||||
{tool_def.material, "group:stick"},
|
||||
{"", "group:stick"}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
default.register_axe("wood", "Wooden", "default_tool_woodaxe.png", 1.0, 0, nil, 3.00, 1.60, 10, 1, 2, {flammable = 2}, "group:wood")
|
||||
register_axe({
|
||||
name = "wood",
|
||||
desc = S("Wooden Axe"),
|
||||
punch_interval = 1.0,
|
||||
max_drop_level = 0,
|
||||
caps = {times = {[2]=3.00, [3]=1.60}, uses=10, maxlevel=1},
|
||||
damage = 2,
|
||||
groups = {flammable = 2},
|
||||
material = "group:wood"
|
||||
})
|
||||
|
||||
default.register_axe("stone", "Stone", "default_tool_stoneaxe.png", 1.2, 0, 3.00, 2.00, 1.30, 20, 1, 3, {}, "group:stone")
|
||||
register_axe({
|
||||
name = "stone",
|
||||
desc = S("Stone Axe"),
|
||||
punch_interval = 1.2,
|
||||
max_drop_level = 0,
|
||||
caps = {times = {[1]=3.00, [2]=2.00, [3]=1.30}, uses=20, maxlevel=1},
|
||||
damage = 3,
|
||||
material = "group:stone"
|
||||
})
|
||||
|
||||
default.register_axe("bronze", "Bronze", "default_tool_bronzeaxe.png", 1.0, 1, 2.75, 1.70, 1.15, 20, 2, 4, {}, "default:bronze_ingot")
|
||||
register_axe({
|
||||
name = "bronze",
|
||||
desc = S("Bronze Axe"),
|
||||
punch_interval = 1.0,
|
||||
max_drop_level = 1,
|
||||
caps = {times = {[1]=2.75, [2]=1.70, [3]=1.15}, uses=20, maxlevel=2},
|
||||
damage = 4,
|
||||
material = "default:bronze_ingot"
|
||||
})
|
||||
|
||||
default.register_axe("steel", "Steel", "default_tool_steelaxe.png", 1.0, 1, 2.50, 1.40, 1.00, 20, 2, 4, {}, "default:steel_ingot")
|
||||
register_axe({
|
||||
name = "steel",
|
||||
desc = S("Steel Axe"),
|
||||
punch_interval = 1.0,
|
||||
max_drop_level = 1,
|
||||
caps = {times = {[1]=2.50, [2]=1.40, [3]=1.00}, uses=20, maxlevel=2},
|
||||
damage = 4,
|
||||
material = "default:steel_ingot"
|
||||
})
|
||||
|
||||
default.register_axe("mese", "Mese", "default_tool_meseaxe.png", 0.9, 1, 2.20, 1.00, 0.60, 20, 3, 6, {}, "default:mese_crystal")
|
||||
register_axe({
|
||||
name = "mese",
|
||||
desc = S("Mese Axe"),
|
||||
punch_interval = 0.9,
|
||||
max_drop_level = 1,
|
||||
caps = {times = {[1]=2.20, [2]=1.00, [3]=0.60}, uses=20, maxlevel=3},
|
||||
damage = 6,
|
||||
material = "default:mese_crystal"
|
||||
})
|
||||
|
||||
default.register_axe("diamond", "Diamond", "default_tool_diamondaxe.png", 0.9, 1, 2.10, 0.90, 0.50, 30, 3, 7, {}, "default:diamond")
|
||||
register_axe({
|
||||
name = "diamond",
|
||||
desc = S("Diamond Axe"),
|
||||
punch_interval = 0.9,
|
||||
max_drop_level = 1,
|
||||
caps = {times = {[1]=2.10, [2]=0.90, [3]=0.50}, uses=30, maxlevel=3},
|
||||
damage = 7,
|
||||
material = "default:diamond"
|
||||
})
|
||||
|
||||
--
|
||||
-- Swords
|
||||
--
|
||||
|
||||
function default.register_sword(name, desc, img, punch_interval, max_drop_lvl, gc1, gc2, gc3, use_count, maxlvl, dmg, extra_groups, mat)
|
||||
default.register_tool_of_type(name, desc, img, nil, punch_interval, max_drop_lvl, gc1, gc2, gc3, use_count, maxlvl, dmg, extra_groups, mat, "sword", "Sword", "snappy", "sword", {
|
||||
{mat},
|
||||
{mat},
|
||||
{"group:stick"}
|
||||
local function register_sword(tool_def)
|
||||
if tool_def.groups == nil then
|
||||
tool_def.groups = {}
|
||||
end
|
||||
tool_def.groups["sword"] = 1
|
||||
minetest.register_tool("default:sword_"..tool_def.name, {
|
||||
description = tool_def.desc,
|
||||
inventory_image = "default_tool_"..tool_def.name.."sword.png",
|
||||
tool_capabilities = {
|
||||
full_punch_interval = tool_def.punch_interval,
|
||||
max_drop_level = tool_def.max_drop_level,
|
||||
groupcaps = {snappy = tool_def.caps},
|
||||
damage_groups = {fleshy = tool_def.damage},
|
||||
},
|
||||
sound = {breaks = "default_tool_breaks"},
|
||||
groups = tool_def.groups
|
||||
})
|
||||
minetest.register_craft({
|
||||
output = "default:sword_"..tool_def.name,
|
||||
recipe = {
|
||||
{tool_def.material},
|
||||
{tool_def.material},
|
||||
{"group:stick"}
|
||||
}
|
||||
})
|
||||
end
|
||||
|
||||
default.register_sword("wood", "Wooden", "default_tool_woodsword.png", 1, 0, nil, 1.6, 0.40, 10, 1, 2, {flammable = 2}, "group:wood")
|
||||
register_sword({
|
||||
name = "wood",
|
||||
desc = S("Wooden Sword"),
|
||||
punch_interval = 1,
|
||||
max_drop_level = 0,
|
||||
caps = {times = {[2]=1.6, [3]=0.40}, uses=10, maxlevel=1},
|
||||
damage = 2,
|
||||
groups = {flammable = 2},
|
||||
material = "group:wood"
|
||||
})
|
||||
|
||||
default.register_sword("stone", "Stone", "default_tool_stonesword.png", 1.2, 0, nil, 1.4, 0.40, 20, 1, 4, {}, "group:stone")
|
||||
register_sword({
|
||||
name = "stone",
|
||||
desc = S("Stone Sword"),
|
||||
punch_interval = 1.2,
|
||||
max_drop_level = 0,
|
||||
caps = {times = {[2]=1.4, [3]=0.40}, uses=20, maxlevel=1},
|
||||
damage = 4,
|
||||
material = "group:stone"
|
||||
})
|
||||
|
||||
default.register_sword("bronze", "Bronze", "default_tool_bronzesword.png", 0.8, 1, 2.75, 1.30, 0.375, 25, 2, 6, {}, "default:bronze_ingot")
|
||||
register_sword({
|
||||
name = "bronze",
|
||||
desc = S("Bronze Sword"),
|
||||
punch_interval = 0.8,
|
||||
max_drop_level = 1,
|
||||
caps = {times = {[1]=2.75, [2]=1.30, [3]=0.375}, uses=25, maxlevel=2},
|
||||
damage = 6,
|
||||
material = "default:bronze_ingot"
|
||||
})
|
||||
|
||||
default.register_sword("steel", "Steel", "default_tool_steelsword.png", 0.8, 1, 2.5, 1.20, 0.35, 30, 2, 6, {}, "default:steel_ingot")
|
||||
register_sword({
|
||||
name = "steel",
|
||||
desc = S("Steel Sword"),
|
||||
punch_interval = 0.8,
|
||||
max_drop_level = 1,
|
||||
caps = {times = {[1]=2.5, [2]=1.20, [3]=0.35}, uses=30, maxlevel=2},
|
||||
damage = 6,
|
||||
material = "default:steel_ingot"
|
||||
})
|
||||
|
||||
default.register_sword("mese", "Mese", "default_tool_mesesword.png", 0.7, 1, 2.0, 1.00, 0.35, 30, 3, 7, {}, "default:mese_crystal")
|
||||
register_sword({
|
||||
name = "mese",
|
||||
desc = S("Mese Sword"),
|
||||
punch_interval = 0.7,
|
||||
max_drop_level = 1,
|
||||
caps = {times = {[1]=2.0, [2]=1.00, [3]=0.35}, uses=30, maxlevel=3},
|
||||
damage = 7,
|
||||
material = "default:mese_crystal"
|
||||
})
|
||||
|
||||
default.register_sword("diamond", "Diamond", "default_tool_diamondsword.png", 0.7, 1, 1.90, 0.90, 0.30, 40, 3, 8, {}, "default:diamond")
|
||||
register_sword({
|
||||
name = "diamond",
|
||||
desc = S("Diamond Sword"),
|
||||
punch_interval = 0.7,
|
||||
max_drop_level = 1,
|
||||
caps = {times = {[1]=1.90, [2]=0.90, [3]=0.30}, uses=40, maxlevel=3},
|
||||
damage = 8,
|
||||
material = "default:diamond"
|
||||
})
|
||||
|
||||
-- Fuel recipes for wooden tools
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user