2019-02-14 05:00:53 -08:00
|
|
|
local S=minerdream.intllib
|
2018-12-03 09:23:55 -08:00
|
|
|
|
|
|
|
local has_value = basic_functions.has_value
|
|
|
|
local tier_cols={
|
|
|
|
col_num={"name"},}
|
|
|
|
local tier_definition = basic_functions.import_csv(minerdream.path.."/tiers.txt",tier_cols)
|
|
|
|
local tool_cols={
|
|
|
|
col_num={"range","uses"},
|
|
|
|
as_numeric=1,
|
|
|
|
}
|
|
|
|
local tool_definition = basic_functions.import_csv(minerdream.path.."/armor.txt",tool_cols)
|
|
|
|
|
|
|
|
for i,tdef in pairs(tool_definition) do
|
|
|
|
if (i ~= "default") then
|
|
|
|
local tooldef={}
|
|
|
|
for col in pairs(tdef) do
|
|
|
|
tooldef=basic_functions.parse_tree(tooldef,col,tdef[col])
|
|
|
|
end
|
2019-07-17 01:46:02 -07:00
|
|
|
if minerdream.itemdef[i]==nil then
|
|
|
|
minerdream.itemdef[i]={}
|
|
|
|
end
|
|
|
|
|
2018-12-03 09:23:55 -08:00
|
|
|
local tierd=tier_definition[tostring(tdef.tier)]
|
|
|
|
for _,tool in pairs({"helmet","chestplate","boots","leggings","shields"}) do
|
|
|
|
if tooldef[tool] ~= nil then
|
2019-07-17 01:46:02 -07:00
|
|
|
minerdream.itemdef[i][tool]=tooldef[tool]
|
2018-12-03 09:23:55 -08:00
|
|
|
local ttv=tooldef[tool]
|
2019-02-15 03:18:50 -08:00
|
|
|
tdesc=core.colorize("#"..tierd.color, S(i:gsub("^%l", string.upper)).." "..S(tool:gsub("^%l", string.upper)).."\n")..
|
2018-12-03 09:23:55 -08:00
|
|
|
core.colorize("#A0A0A0", "tier: "..tierd.name.." ("..tierd.desc..")")
|
|
|
|
if ttv.fleshy then
|
2019-02-14 05:00:53 -08:00
|
|
|
tdesc=tdesc.."\n"..core.colorize("#A0A0A0",S("Defense")..": "..ttv.fleshy)
|
2018-12-03 09:23:55 -08:00
|
|
|
end
|
|
|
|
if ttv.heal then
|
2019-02-14 05:00:53 -08:00
|
|
|
tdesc=tdesc.."\n"..core.colorize("#A0A0A0",S("Heal")..": "..ttv.heal)
|
2018-12-03 09:23:55 -08:00
|
|
|
end
|
|
|
|
if ttv.speed then
|
2019-02-14 05:00:53 -08:00
|
|
|
tdesc=tdesc.."\n"..core.colorize("#A0A0A0",S("Walking speed")..": "..(ttv.speed*100).."%")
|
2018-12-03 09:23:55 -08:00
|
|
|
end
|
|
|
|
if ttv.gravity then
|
2019-02-14 05:00:53 -08:00
|
|
|
tdesc=tdesc.."\n"..core.colorize("#A0A0A0",S("Gravity")..": "..(ttv.gravity*100).."%")
|
2018-12-03 09:23:55 -08:00
|
|
|
end
|
|
|
|
if ttv.jump then
|
2019-02-14 05:00:53 -08:00
|
|
|
tdesc=tdesc.."\n"..core.colorize("#A0A0A0",S("Jump force")..": "..(ttv.jump*100).."%")
|
2018-12-03 09:23:55 -08:00
|
|
|
end
|
|
|
|
tt_def={description=tdesc,
|
|
|
|
-- tt_def={description=i.." "..tool,
|
|
|
|
inventory_image=minerdream.modname.."_inv_"..tool.."_"..i..".png",
|
|
|
|
damage_groups = {level = ttv.level or 2},
|
|
|
|
armor_groups={fleshy=ttv.fleshy or 10},
|
|
|
|
groups={armor_heal=ttv.heal,armor_use=ttv.use,
|
|
|
|
physics_jump=ttv.jump,physics_speed=ttv.speed,physics_gravity=ttv.gravity}
|
|
|
|
}
|
|
|
|
for _,gc in pairs({"cracky","crumbly","choppy","snappy"}) do
|
|
|
|
tt_def.damage_groups[gc]=ttv[gc]
|
|
|
|
end
|
|
|
|
if tool == "helmet" then
|
|
|
|
tt_def.groups.armor_head=1
|
|
|
|
elseif tool == "chestplate" then
|
|
|
|
tt_def.groups.armor_torso=1
|
|
|
|
elseif tool == "leggings" then
|
|
|
|
tt_def.groups.armor_legs=1
|
|
|
|
elseif tool == "boots" then
|
|
|
|
tt_def.groups.armor_feet=1
|
|
|
|
elseif tool == "shields" then
|
|
|
|
tt_def.groups.armor_shield=1
|
|
|
|
end
|
|
|
|
|
|
|
|
toolname=minerdream.modname..":"..tool.."_"..i
|
|
|
|
armor:register_armor(toolname,tt_def)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|