Beginnings of tinkering

This commit is contained in:
Evert Prants 2018-04-04 13:31:27 +03:00
parent a1d4b8a9cb
commit 355256073e
Signed by: evert
GPG Key ID: 1688DA83D222D0B5
18 changed files with 337 additions and 1 deletions

View File

@ -7,7 +7,7 @@ metal_melter.max_metal = 16000
metal_melter.spec = {
ingot = 144,
crystal = 144,
block = 1000,
block = 1296,
lump = 288,
ore = 288
}

25
tinkering/init.lua Normal file
View File

@ -0,0 +1,25 @@
-- Tinkering for Minetest 0.5.0+
-- Copyright (c) 2018 Evert "Diamond" Prants <evert@lunasqu.ee>
-- This mod is currently stuck behind https://github.com/minetest/minetest/issues/5686
-- Once this gets implemented, the full abilities of this mod will be available.
tinkering = rawget(_G, "tinkering") or {}
local modpath = minetest.get_modpath(minetest.get_current_modname())
tinkering.modpath = modpath
-- Utilities
dofile(modpath.."/util.lua")
-- Pattern Library
dofile(modpath.."/pattern.lua")
-- Material Database
dofile(modpath.."/materials.lua")
-- Registration
dofile(modpath.."/register.lua")
-- Nodes and items
dofile(modpath.."/nodesitems.lua")

261
tinkering/materials.lua Normal file
View File

@ -0,0 +1,261 @@
local modifiers = {
wood = {
cracky = {times={[3]=1.60}, uses=10, maxlevel=1},
crumbly = {times={[1]=3.00, [2]=1.60, [3]=0.60}, uses=10, maxlevel=1},
snappy = {times={[2]=1.6, [3]=0.40}, uses=10, maxlevel=1},
choppy = {times={[2]=3.00, [3]=1.60}, uses=10, maxlevel=1},
damagegroups = {fleshy = 2},
explody = nil,
binding = {increase = 0.00, uses = 0},
rod = {increase = 0.00, uses = 0},
tags = {
{name = "cheap", description = "Cheap"},
{name = "wooden", description = "Wooden"}
}
},
stone = {
cracky = {times={[2]=2.0, [3]=1.00}, uses=20, maxlevel=1},
crumbly = {times={[1]=1.80, [2]=1.20, [3]=0.50}, uses=20, maxlevel=1},
snappy = {times={[2]=1.4, [3]=0.40}, uses=20, maxlevel=1},
choppy = {times={[1]=3.00, [2]=2.00, [3]=1.30}, uses=20, maxlevel=1},
damagegroups = {fleshy = 4},
explody = nil,
binding = {increase = 0.05, uses = -1},
rod = {increase = 0.05, uses = -1},
tags = {
{name = "economic", description = "Economic"},
{name = "stonebound", description = "Stonebound"}
}
},
iron = {
cracky = {times={[1]=4.00, [2]=1.60, [3]=0.80}, uses=20, maxlevel=2},
crumbly = {times={[1]=1.50, [2]=0.90, [3]=0.40}, uses=30, maxlevel=2},
snappy = {times={[1]=2.5, [2]=1.20, [3]=0.35}, uses=30, maxlevel=2},
choppy = {times={[1]=2.50, [2]=1.40, [3]=1.00}, uses=20, maxlevel=2},
damagegroups = {fleshy = 6},
explody = nil,
binding = {increase = 0.05, uses = 3},
rod = {increase = 0.10, uses = 5},
tags = {
{name = "economic", description = "Economic"},
{name = "metal", description = "Metallic"}
}
},
copper = {
cracky = {times={[1]=4.00, [2]=1.60, [3]=0.80}, uses=30, maxlevel=2},
crumbly = {times={[1]=1.50, [2]=0.90, [3]=0.40}, uses=40, maxlevel=2},
snappy = {times={[1]=2.50, [2]=1.20, [3]=0.35}, uses=40, maxlevel=2},
choppy = {times={[1]=2.50, [2]=1.40, [3]=1.00}, uses=30, maxlevel=2},
damagegroups = {fleshy = 6},
explody = nil,
binding = {increase = 0.08, uses = 3},
rod = {increase = 0.08, uses = 5},
tags = {
{name = "cold", description = "Cold"}
}
},
tin = {
cracky = {times={[1]=3.80, [2]=1.50, [3]=0.70}, uses=20, maxlevel=2},
crumbly = {times={[1]=1.30, [2]=0.80, [3]=0.30}, uses=30, maxlevel=2},
snappy = {times={[1]=2.30, [2]=1.10, [3]=0.20}, uses=30, maxlevel=2},
choppy = {times={[1]=2.30, [2]=1.30, [3]=0.90}, uses=20, maxlevel=2},
damagegroups = {fleshy = 6},
explody = nil,
binding = {increase = 0.07, uses = -2},
rod = {increase = 0.07, uses = -3},
tags = {
{name = "cheap", description = "Cheap"}
}
},
mese = {
cracky = {times={[1]=2.4, [2]=1.2, [3]=0.60}, uses=20, maxlevel=3},
crumbly = {times={[1]=1.20, [2]=0.60, [3]=0.30}, uses=20, maxlevel=3},
snappy = {times={[1]=2.0, [2]=1.00, [3]=0.35}, uses=30, maxlevel=3},
choppy = {times={[1]=2.20, [2]=1.00, [3]=0.60}, uses=20, maxlevel=3},
damagegroups = {fleshy = 7},
explody = nil,
binding = {increase = 0.10, uses = 10},
rod = {increase = 0.15, uses = 10},
tags = {
{name = "gem", description = "Precious"},
{name = "expensive", description = "Expensive"}
}
},
gold = {
cracky = {times={[1]=3.80, [2]=1.50, [3]=0.70}, uses=10, maxlevel=2},
crumbly = {times={[1]=1.30, [2]=0.80, [3]=0.30}, uses=20, maxlevel=2},
snappy = {times={[1]=2.30, [2]=1.10, [3]=0.20}, uses=20, maxlevel=2},
choppy = {times={[1]=2.30, [2]=1.30, [3]=0.90}, uses=10, maxlevel=2},
damagegroups = {fleshy = 6},
explody = nil,
binding = {increase = -0.07, uses = -10},
rod = {increase = -0.01, uses = -5},
tags = {
{name = "shiny", description = "Shiny"},
{name = "soft", description = "Soft"}
}
},
obsidian = {
cracky = {times={[1]=2.3, [2]=1.0, [3]=0.40}, uses=30, maxlevel=3},
crumbly = {times={[1]=1.10, [2]=0.50, [3]=0.20}, uses=30, maxlevel=3},
snappy = {times={[1]=1.85, [2]=0.85, [3]=0.25}, uses=40, maxlevel=3},
choppy = {times={[1]=2.00, [2]=0.85, [3]=0.40}, uses=30, maxlevel=3},
damagegroups = {fleshy = 6},
explody = nil,
binding = {increase = 0.10, uses = 15},
rod = {increase = 0.05, uses = 5},
tags = {
{name = "reinforced", description = "Reinforced"}
}
},
lead = {
-- TODO: tweak
cracky = {times={[1]=3.70, [2]=1.30, [3]=0.60}, uses=20, maxlevel=2},
crumbly = {times={[1]=1.20, [2]=0.60, [3]=0.20}, uses=30, maxlevel=2},
snappy = {times={[1]=2.20, [2]=1.00, [3]=0.10}, uses=30, maxlevel=2},
choppy = {times={[1]=2.20, [2]=1.20, [3]=0.60}, uses=20, maxlevel=2},
damagegroups = {fleshy = 7},
explody = nil,
binding = {increase = 0.15, uses = 1},
rod = {increase = 0.05, uses = -5},
tags = {
{name = "toxic", description = "Toxic"}
}
},
chromium = {
-- TODO: tweak
cracky = {times={[1]=3.70, [2]=1.30, [3]=0.60}, uses=20, maxlevel=2},
crumbly = {times={[1]=1.20, [2]=0.60, [3]=0.20}, uses=30, maxlevel=2},
snappy = {times={[1]=2.20, [2]=1.00, [3]=0.10}, uses=30, maxlevel=2},
choppy = {times={[1]=2.20, [2]=1.20, [3]=0.60}, uses=20, maxlevel=2},
damagegroups = {fleshy = 5},
explody = nil,
binding = {increase = 0.15, uses = 1},
rod = {increase = -0.05, uses = 2},
tags = {
{name = "shiny", description = "Shiny"}
}
},
zinc = {
-- TODO: tweak
cracky = {times={[1]=3.70, [2]=1.30, [3]=0.60}, uses=20, maxlevel=2},
crumbly = {times={[1]=1.20, [2]=0.60, [3]=0.20}, uses=30, maxlevel=2},
snappy = {times={[1]=2.20, [2]=1.00, [3]=0.10}, uses=30, maxlevel=2},
choppy = {times={[1]=2.20, [2]=1.20, [3]=0.60}, uses=20, maxlevel=2},
damagegroups = {fleshy = 5},
explody = nil,
binding = {increase = -0.05, uses = 1},
rod = {increase = -0.05, uses = 2},
tags = {
{name = "metal", description = "Metallic"}
}
},
silver = {
cracky = {times = {[1] = 2.60, [2] = 1.00, [3] = 0.60}, uses = 100, maxlevel= 1},
crumbly = {times = {[1] = 1.10, [2] = 0.40, [3] = 0.25}, uses = 100, maxlevel= 1},
snappy = {times = {[2] = 0.70, [3] = 0.30}, uses = 100, maxlevel= 1},
choppy = {times = {[1] = 2.50, [2] = 0.80, [3] = 0.50}, uses = 100, maxlevel= 1},
damagegroups = {fleshy = 6},
explody = nil,
binding = {increase = -0.05, uses = 10},
rod = {increase = -0.05, uses = 10},
tags = {
{name = "durable", description = "Durable"},
{name = "shiny", description = "Shiny"}
}
},
mithril = {
cracky = {times = {[1] = 2.25, [2] = 0.55, [3] = 0.35}, uses = 200, maxlevel= 2},
crumbly = {times = {[1] = 0.70, [2] = 0.35, [3] = 0.20}, uses = 200, maxlevel= 2},
snappy = {times = {[2] = 0.70, [3] = 0.25}, uses = 200, maxlevel= 2},
choppy = {times = {[1] = 1.75, [2] = 0.45, [3] = 0.45}, uses = 200, maxlevel= 2},
damagegroups = {fleshy = 9},
explody = nil,
binding = {increase = 0.05, uses = 15},
rod = {increase = -0.10, uses = 15, damage = {fleshy = 8}},
tags = {
{name = "durable", description = "Durable"},
{name = "lethal", description = "Lethal"}
}
},
-- Modifier items
diamond = {
uses = 20,
increase = 0.25,
count = 1,
tags = {
{name = "diamond", description = "Diamond"}
}
},
-- Templates
default_item = {
cracky = {}, -- Pickaxe
crumbly = {}, -- Shovel
snappy = {}, -- Sword
choppy = {}, -- Axe
damagegroups = {fleshy = 0}, -- Sword damage
explody = nil, -- Explody group
-- Binding specifications
binding = {
increase = 0.00, -- Increase in `times`. Divided by group number.
uses = 0, -- Base uses increase
damage = {fleshy = 8} -- Sets the damagegroups to this value.
},
-- Rod specifications, same format as binding
rod = {},
-- Tags added to this tool
tags = {}
},
default_modifier = {
uses = 0, -- Base uses increase
increase = 0.00, -- Times increase. Divided by group number.
count = 1, -- How many times this modifier can be applied
-- Tags added to this tool
tags = {}
}
}
tinkering.materials = {
-- Materials
wood = {name = "Wood", default = "group:wood", color = "#634623", base = "group", modifier = modifiers.wood},
stone = {name = "Stone", default = "group:stone", color = "#8D8988", base = "group", modifier = modifiers.stone},
obsidian = {name = "Obsidian", default = "default:obsidian", color = "#2C384E", base = "node", cast = true, modifier = modifiers.obsidian},
-- Metals
iron = {name = "Iron", default = "default:steel_ingot", color = "#FFF", base = "ingot", cast = true, modifier = modifiers.iron},
copper = {name = "Copper", default = "default:copper_ingot", color = "#FF9F72", base = "ingot", cast = true, modifier = modifiers.copper},
tin = {name = "Tin", default = "default:tin_ingot", color = "#C1C1C1", base = "ingot", cast = true, modifier = modifiers.tin},
gold = {name = "Gold", default = "default:gold_ingot", color = "#FFFF54", base = "ingot", cast = true, modifier = modifiers.gold},
mese = {name = "Mese", default = "default:mese_crystal", color = "#FFFF02", base = "gem", modifier = modifiers.mese},
-- From technic
lead = {name = "Lead", default = "technic:lead_ingot", color = "#C6C6C6", base = "ingot", cast = true, modifier = modifiers.lead},
chromium = {name = "Chromium", default = "technic:chromium_ingot", color = "#DFE8E8", base = "ingot", cast = true, modifier = modifiers.chromium},
zinc = {name = "Zinc", default = "technic:zinc_ingot", color = "#CEE8EF", base = "ingot", cast = true, modifier = modifiers.zinc},
-- From moreores
silver = {name = "Silver", default = "moreores:silver_ingot", color = "#D7E2E8", base = "ingot", cast = true, modifier = modifiers.silver},
mithril = {name = "Mithril", default = "moreores:mithril_ingot", color = "#6868D7", base = "ingot", cast = true, modifier = modifiers.mithril}
}
tinkering.modifiers = {
diamond = {name = "Diamond", default = "default:diamond", modifier = modifiers.diamond}
}

4
tinkering/mod.conf Normal file
View File

@ -0,0 +1,4 @@
name = tinkering
description = Combine materials to create tools
depends = metal_melter
optional_depends = unified_inventory,technic,moreores

0
tinkering/nodesitems.lua Normal file
View File

0
tinkering/pattern.lua Normal file
View File

42
tinkering/register.lua Normal file
View File

@ -0,0 +1,42 @@
local textures = {
pick = {"tinkering_pickaxe_head.png", "tinkering_overlay_handle_pickaxe.png"},
axe = {"tinkering_axe_head.png", "tinkering_overlay_handle_axe.png"},
sword = {"tinkering_sword_blade.png", "tinkering_overlay_handle_sword.png"},
shover = {"tinkering_shovel_head.png", "tinkering_overlay_handle_shovel.png"},
rod = "tinkering_tool_rod.png",
binding = "tinkering_binding.png"
}
local components = {
pickaxe_head = {description = "%s Pickaxe Head", materials = 1, image = textures.pick[1]},
axe_head = {description = "%s Axe Head", materials = 1, image = textures.axe[1]},
sword_blade = {description = "%s Sword Blade", materials = 1, image = textures.sword[1]},
shover_head = {description = "%s Shovel Head", materials = 1, image = textures.shover[1]},
tool_rod = {description = "%s Tool Rod", materials = 1, image = textures.rod},
tool_binding = {description = "%s Binding", materials = 1, image = textures.binding}
}
function tinkering.register_component(data)
local desc = data.description
local name = data.name
local mod = data.mod_name or "tinkering"
minetest.register_craftitem(mod..":"..name, {
description = desc,
groups = {tinker_component = 1},
inventory_image = data.image
})
end
for i, v in pairs(components) do
if v.materials == 1 then
for m, s in pairs(tinkering.materials) do
tinkering.register_component({
name = m.."_"..i,
description = v.description:format(s.name),
image = tinkering.color_filter(v.image, s.color)
})
end
end
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 289 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 402 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 245 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 271 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 238 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 293 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 340 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 287 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 230 B

4
tinkering/util.lua Normal file
View File

@ -0,0 +1,4 @@
function tinkering.color_filter(texture, color)
return texture.."^[multiply:"..color
end