tools -> new config

master
A. Demant 2018-11-19 07:28:20 +01:00
parent 0d079ca3e0
commit b5d13b734c
7 changed files with 136 additions and 59 deletions

View File

@ -20,6 +20,10 @@ minerdream.import_csv = function(infile,def)
if def.seperator then
splitchar=def.seperator
end
local as_numeric=false
if def.as_numeric then
as_numeric = true
end
local header = file:read():gsub("\r",""):split(splitchar,true)
-- read each line, split in separat fields and stores in array
-- by header the value is stored as numeric, in the group environment or as text
@ -43,8 +47,16 @@ minerdream.import_csv = function(infile,def)
dsaved = true
end
end
if not dsaved then
nrow[th]=d
if th == "name" then
nrow[th] = d
else
if not dsaved then
if as_numeric then
nrow[th] = tonumber(d)
else
nrow[th]=d
end
end
end
end
end

View File

@ -6,7 +6,8 @@ minerdream.items={}
dofile(minerdream.path .. "/functions.lua")
dofile(minerdream.path .. "/config.lua")
dofile(minerdream.path .. "/api.lua")
dofile(minerdream.path .. "/read_config.lua")
dofile(minerdream.path .. "/read_ore_config.lua")
dofile(minerdream.path .. "/read_tool_config.lua")
dofile(minerdream.path .. "/items.lua")
dofile(minerdream.path .. "/tools.lua")
dofile(minerdream.path .. "/overrides.lua")

View File

@ -1,41 +1,39 @@
name,overrides,orig_mod,crack,has_dust,has_block,has_nugget,has_rich,in_desert,has_brick,has_bar_block,has_dust,scarcity,num_ores,clust_size,y_min,y_max,tier,has_lump,has_bar,lump_cooking_time,has_pick,has_axe,has_sword,has_shovel,has_spear,has_bow,tool_stick,tool_cotton,has_helmet,has_chestplate,has_leggings,has_boots,has_shield
default,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
rhodium,,,5,1,1,,,,3,3,3,16,3,3,-31000,-1500,6,1,1,64,1,1,1,,1,1,minerdream:expensivestick,steel_wire,1,1,1,1,1
calcium,,,5,1,1,,,,3,3,3,12,5,2,-31000,420,1,1,1,2,,,,,,,,,,,,,
tantalum,,,5,1,1,,,,3,3,3,16,3,3,-31000,-1500,6,1,1,64,1,1,1,,1,1,minerdream:expensivestick,steel_wire,1,1,1,1,1
ruthenium,,,4,1,1,,,,3,3,3,15,3,3,-31000,-500,5,1,1,32,1,1,1,1,1,1,minerdream:steelstick,steel_wire,1,1,1,1,1
cobalt,,,4,1,1,,,,3,3,3,15,3,3,-31000,-500,5,1,1,32,1,1,1,1,1,1,minerdream:steelstick,steel_wire,1,1,1,1,1
platinum,,,1,1,1,,,,3,3,3,14,4,3,-31000,-300,4,1,1,16,1,1,1,1,1,1,,,1,1,1,1,1
aluminium,,,1,1,1,,,,3,3,3,14,4,3,-31000,-250,4,1,1,32,1,1,1,1,1,1,,,1,1,1,1,1
zinc,,,1,1,1,,,,3,3,3,14,7,3,-31000,-50,2,1,1,4,,,,,,1,,,,,,,
lead,technic:mineral_lead,,2,1,1,,,,3,3,3,13,7,3,-31000,-70,3,1,1,4,,,,,1,1,,,,,,,
silver,moreores:mineral_silver,,2,1,1,,,,3,3,3,14,3,2,-31000,-64,3,1,1,8,,,,,1,1,,,,,,,
potassium,,,3,1,1,,,,3,3,3,12,7,3,-31000,420,1,1,1,2,,,,,,1,,,,,,,
nickel,,,2,1,1,,,,3,3,3,13,7,3,-31000,-40,2,1,1,4,,,,,1,1,,,,,,,
flint,,,,,,,,,,,,,,,,,,,,,1,1,1,1,1,,,,1,1,1,1,1
tin,,technic,,,,,,,3,3,3,,,,,,,,,,,,,,,,,,,,,,
iron,,default,,,,,,,3,3,,,,,,,,,,,,,,,,,,,,,,,
gold,,default,,,,,,,3,3,,,,,,,,,,,,,,,1,1,,,,,,,
copper,,default,,,3,,,,3,3,,,,,,,,,,,,,,,,1,,,,,,,
steel,,default,,,,,,,,3,,,,,,,,,,,,,,,1,1,,,,,,,
diamond,,,,,,,,,,,,,,,,,,,,,,,,,1,1,,,,,,,
mese,,,,,,,,,,,,,,,,,,,,,,,,,1,1,,,,,,,
stainlesssteel,,,,,,,,,,,,,,,,,,,,,1,1,1,1,1,1,,,1,1,1,1,1
brass,,,,,3,,,,3,3,,,,,,,,,,,,,,,,,,,,,,,
coal,,,2,,1,,,1,,,,,,,,,,,,,,,,,,,,,,,,,
sulfur,,,3,1,,,,1,,,,,,,,,2,1,,,,,,,,,,,,,,,
lapislazuli,,,3,,3,,,1,3,,,,,,,,2,1,,,,,,,,,,,,,,,
saltpeter,,,3,1,1,,,1,,,,,,,,,2,1,,,,,,,,,,,,,,,
spinel,,,5,,1,,,,3,,,16,1,1,-31000,-1700,,,,,,,,,,,,,,,,,
garnet,,,4,,1,,,,3,,,15,1,1,-31000,-650,,,,,,,,,,,,,,,,,
bituminous_coal,,,4,,,,,,,,,13,10,3,-31000,-500,5,1,,,,,,,,,,,,,,,
jade,,,4,,1,,,,3,,,15,1,1,-31000,-650,,,,,,,,,,,,,,,,,
amethyst,,,4,,1,,,,3,,,15,1,1,-31000,-650,,,,,,,,,,,,,,,,,
onyx,,,,,1,,,,3,,,16,1,1,-31000,-1700,,,,,,,,,,,,,,,,,
aquamarine,,,,,1,,,,3,,,16,1,1,-31000,-1700,,,,,,,,,,,,,,,,,
topaz,,,,,1,,,,3,,,15,1,1,-31000,-1700,,,,,,,,,,,,,,,,,
treasure1,,,,,,,,,,,,8,1,1,-200,50,,,,,,,,,,,,,,,,,
treasure2,,,,,,,,,,,,10,1,1,-400,-100,,,,,,,,,,,,,,,,,
treasure3,,,,,,,,,,,,12,1,1,-750,-250,,,,,,,,,,,,,,,,,
treasure4,,,,,,,,,,,,14,1,1,-2000,-500,,,,,,,,,,,,,,,,,
treasure5,,,,,,,,,,,,15,1,1,-2500,-1500,,,,,,,,,,,,,,,,,
name,overrides,orig_mod,drop_as_lump,crack,has_dust,has_block,has_nugget,has_rich,in_desert,has_brick,has_bar_block,has_dust,scarcity,num_ores,clust_size,y_min,y_max,tier,has_lump,has_bar,lump_cooking_time,has_pick,has_axe,has_sword,has_shovel,has_spear,has_bow,tool_stick,tool_cotton,has_helmet,has_chestplate,has_leggings,has_boots,has_shield,has_brick
default,,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
rhodium,,,1,5,1,1,,,,3,3,3,16,3,3,-31000,-1500,6,1,1,64,1,1,1,,1,1,minerdream:expensivestick,steel_wire,1,1,1,1,1,
calcium,,,1,5,1,1,,,,3,3,3,12,5,2,-31000,420,1,1,1,2,,,,,,,,,,,,,,
tantalum,,,1,5,1,1,,,,3,3,3,16,3,3,-31000,-1500,6,1,1,64,1,1,1,,1,1,minerdream:expensivestick,steel_wire,1,1,1,1,1,
ruthenium,,,1,4,1,1,,,,3,3,3,15,3,3,-31000,-500,5,1,1,32,1,1,1,1,1,1,minerdream:steelstick,steel_wire,1,1,1,1,1,
cobalt,,,1,4,1,1,,,,3,3,3,15,3,3,-31000,-500,5,1,1,32,1,1,1,1,1,1,minerdream:steelstick,steel_wire,1,1,1,1,1,
platinum,,,1,1,1,1,,,,3,3,3,14,4,3,-31000,-300,4,1,1,16,1,1,1,1,1,1,,,1,1,1,1,1,
aluminium,,,1,1,1,1,,,,3,3,3,14,4,3,-31000,-250,4,1,1,32,1,1,1,1,1,1,,,1,1,1,1,1,
zinc,,,1,1,1,1,,,,3,3,3,14,7,3,-31000,-50,2,1,1,4,,,,,,1,,,,,,,,
lead,technic:mineral_lead,,1,2,1,1,,,,3,3,3,13,7,3,-31000,-70,3,1,1,4,,,,,1,1,,,,,,,,
silver,moreores:mineral_silver,,1,2,1,1,,,,3,3,3,14,3,2,-31000,-64,3,1,1,8,,,,,1,1,,,,,,,,
potassium,,,1,3,1,1,,,,3,3,3,12,7,3,-31000,420,1,1,1,2,,,,,,1,,,,,,,,
nickel,,,1,2,1,1,,,,3,3,3,13,7,3,-31000,-40,2,1,1,4,,,,,1,1,,,,,,,,
flint,,,,,,,,,,,,,,,,,,,,,,1,1,1,1,1,,,,1,1,1,1,1,
tin,,technic,,,,,,,,3,3,3,,,,,,,,,,,,,,,,,,,,,,,
gold,,default,,,,,,,,3,3,,,,,,,,,,,,,,,1,1,,,,,,,,
copper,,default,,,,3,,,,3,3,,,,,,,,,,,,,,,,1,,,,,,,,
steel,,default,,,,,,,,,3,,,,,,,,,,,,,,,1,1,,,,,,,,
diamond,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,,,,,,,,
mese,,,,,,,,,,,,,,,,,,,,,,,,,,1,1,,,,,,,,
stainlesssteel,,,,,,,,,,,,,,,,,,,,,,1,1,1,1,1,1,,,1,1,1,1,1,
brass,,,,,,3,,,,3,3,,,,,,,,,,,,,,,,,,,,,,,,
sulfur,,,,3,1,,,,1,,,,,,,,,2,1,,,,,,,,,,,,,,,,
lapislazuli,,,,3,,3,,,1,3,,,,,,,,2,1,,,,,,,,,,,,,,,,
saltpeter,,,,3,1,1,,,1,,,,,,,,,2,1,,,,,,,,,,,,,,,,
spinel,,,,5,,1,,,,3,,,16,1,1,-31000,-1700,,,,,,,,,,,,,,,,,,
garnet,,,,4,,1,,,,3,,,15,1,1,-31000,-650,,,,,,,,,,,,,,,,,,
bituminous_coal,,,,4,,,,,,,,,13,10,3,-31000,-500,5,1,,,,,,,,,,,,,,,,
jade,,,,4,,1,,,,3,,,15,1,1,-31000,-650,,,,,,,,,,,,,,,,,,
amethyst,,,,4,,1,,,,3,,,15,1,1,-31000,-650,,,,,,,,,,,,,,,,,,
onyx,,,,,,1,,,,3,,,16,1,1,-31000,-1700,,,,,,,,,,,,,,,,,,
aquamarine,,,,,,1,,,,3,,,16,1,1,-31000,-1700,,,,,,,,,,,,,,,,,,
topaz,,,,,,1,,,,3,,,15,1,1,-31000,-1700,,,,,,,,,,,,,,,,,,
treasure1,,,,,,,,,,,,,8,1,1,-200,50,,,,,,,,,,,,,,,,,,
treasure2,,,,,,,,,,,,,10,1,1,-400,-100,,,,,,,,,,,,,,,,,,
treasure3,,,,,,,,,,,,,12,1,1,-750,-250,,,,,,,,,,,,,,,,,,
treasure4,,,,,,,,,,,,,14,1,1,-2000,-500,,,,,,,,,,,,,,,,,,
treasure5,,,,,,,,,,,,,15,1,1,-2500,-1500,,,,,,,,,,,,,,,,,,

View File

@ -166,10 +166,10 @@ for i,tdef in pairs(miner_definition) do
}
lump_def={description=i.." lump",
name=lump_name,
inventory_image=minerdream.modname.."_"..i.."_lump.png",
inventory_image=lump_name:gsub(":","_")..".png",
stack_max=minerdream.lump_max_stack,
}
print(lump_name)
-- print(lump_name)
-- override existing ore?
local to_override = false
if tdef.overrides ~= nil then

66
read_tool_config.lua Normal file
View File

@ -0,0 +1,66 @@
local has_value = minerdream.has_value
local tool_cols={
col_num={"range","uses"},
as_numeric=1,
}
local tool_definition = minerdream.import_csv(minerdream.path.."/tools.txt",tool_cols)
--print(dump2(tool_definition))
minerdream.parse_tree=function(mat,ind,val)
if string.find(ind,"_") == nil then
mat[ind] = {}
mat[ind] = tonumber(val)
else
local ind_split=string.split(ind,"_")
local first=ind_split[1]
local second=string.split(ind,"_")[2]
if #ind_split > 2 then
for n=3,#ind_split do
second = second.."_"..ind_split[n]
end
end
if mat[first] == nil then
mat[first]={}
end
mat[first]=minerdream.parse_tree(mat[first],second,val)
end
return(mat)
end
for i,tdef in pairs(tool_definition) do
if i ~= "default" then
local tooldef={}
for col in pairs(tdef) do
tooldef=minerdream.parse_tree(tooldef,col,tdef[col])
end
for tool in pairs({"pick"}) do
if tooldef[tool] ~= nil then
local ttv=tooldef[tool]
tt_def={description=i.." "..tool,
inventory_image=minderdream.modname.."_"..tool.."_"..i..".png",
range=tooldef.range or 2,
tool_capabilities={max_drop_level = 1},
damage_groups = {fleshy = ttv.fleshy or 4},
}
minetest.register_tool('minerdream:pick_rhodium', {
description = "".. core.colorize("#00FF00", "rhodium pickaxe\n")..core.colorize("#A0A0A0", "tier: 6 (epic)\n")..core.colorize("#A0A0A0", "mele damage: 12\n")..core.colorize("#A0A0A0", "range: 5.0 \n")..core.colorize("#A0A0A0", "attack interval: 0.75 "),
wield_scale = {x=1.55,y=1.55,z=1.2},
inventory_image = "minerdream_pick_rhodium.png",
range = 5.0,
tool_capabilities = {
full_punch_interval = 0.8,
max_drop_level=1,
groupcaps={
cracky={times={[6]=6.00, [5]=4.00, [4]=3.00, [1]=1.25, [2]=0.5, [3]=0.20}, uses=105, maxlevel=3},
crumbly={times={[1]=0.6, [2]=0.25, [3]=0.10}, uses=105, maxlevel=3},
},
damage_groups = {fleshy=12},
},
})
end
end
end
end

Binary file not shown.

View File

@ -1,13 +1,13 @@
,pick_cracky_6,pick_cracky_5,pick_cracky_4,pick_cracky_1,pick_cracky_2,pick_cracky_3,pick_crumbly_1,pick_crumbly_2,pick_crumbly_3,pick_maxlevel,pick_fleshy,axe_choppy_1,axe_choppy_2,axe_choppy_3,axe_maxlevel,axe_fleshy,sword_snappy_1,sword_snappy_2,sword_snappy_3,sword_max_level,sword_fleshy,shovel_crumbly_1,shovel_crumbly_2,shovel_crumbly_3,shovel_maxlevel,shovel_fleshy,fleshy,range,punch_interv,uses
rhodium,6,4,3,1.25,0.5,0.2,0.6,0.25,0.1,3,12,1.2,0.4,0.25,3,12,1.25,0.55,0.05,3,14,,,,,,12,5,0.8,105
tantalum,6,4,3,1.25,0.5,0.2,0.6,0.25,0.1,3,12,1.2,0.4,0.25,3,12,1.25,0.55,0.05,3,14,,,,,,12,5,0.8,105
ruthenium,,5,3.5,1.5,0.7,0.25,,,,3,10,1.5,0.5,0.3,3,11,1.5,0.7,0.1,3,11,0.8,0.3,0.15,3,9,10,4.65,0.8,80
cobalt,,5,3.5,1.5,0.7,0.25,,,,3,9,1.5,0.5,0.3,3,10,1.5,0.7,0.1,3,10,0.8,0.3,0.15,3,8,9,4.65,0.7,80
platinum,,,3.8,1.7,0.8,0.3,,,,3,8,1.7,0.65,0.35,3,8,1.5,0.7,0.1,3,9,0.8,0.3,0.15,3,7,8,4.5,0.8,60
aluminum,,,4,1.85,0.9,0.35,,,,3,7,1.85,0.7,0.4,3,7,1.65,0.8,0.15,3,8,0.95,0.4,0.2,3,5,7,4.5,0.65,60
stainlesssteel,,,,3.6,1.4,0.7,,,,2,4.75,2.35,1.3,0.9,2,5.25,2.35,1.1,0.3,2,6.25,1.35,0.8,0.35,2,3.25,4.75,4.25,0.95,100
lead,,,,2.4,1.2,0.6,,,,3,9,2.2,1,0.6,3,9,2,1,0.25,3,10,1.2,0.6,0.3,3,7,9,4.3,1.6,5
nickel,,,,3.4,1.3,0.65,,,,2,5.25,2.275,1.2,0.75,2,6.75,2.2,0.95,0.275,2,6.75,1.3,0.75,0.325,2,3.75,5.25,4.25,0.9,45
gold,,,,2.4,1.2,0.6,,,,3,5.5,2.2,1,0.6,3,6,2,1,0.25,3,7,1.2,0.6,0.3,3,4,5.5,4.3,1.1,5
silver,,,,2.4,1.2,0.6,,,,3,5.5,2.4,1.1,0.65,3,6,2.2,1.1,0.3,3,7,1.4,0.7,0.35,3,4,5.5,45,0.9,45
flint,,,,4.15,1.7,0.85,,,,2,4,2.65,1.5,1.05,2,5,2.65,1.6,0.4,2,5,1.65,1,0.45,2,4,4,4.15,1.1,20
name,pick_cracky_6,pick_cracky_5,pick_cracky_4,pick_cracky_1,pick_cracky_2,pick_cracky_3,pick_crumbly_1,pick_crumbly_2,pick_crumbly_3,pick_maxlevel,pick_fleshy,axe_choppy_1,axe_choppy_2,axe_choppy_3,axe_maxlevel,axe_fleshy,sword_snappy_1,sword_snappy_2,sword_snappy_3,sword_maxlevel,sword_fleshy,shovel_crumbly_1,shovel_crumbly_2,shovel_crumbly_3,shovel_maxlevel,shovel_fleshy,fleshy,range,punch_intervall,uses
rhodium,6,4,3,1.25,0.5,0.2,0.6,0.25,0.1,3,12,1.2,0.4,0.25,3,12,1.25,0.55,0.05,3,14,,,,,,12,5,0.8,105
tantalum,6,4,3,1.25,0.5,0.2,0.6,0.25,0.1,3,12,1.2,0.4,0.25,3,12,1.25,0.55,0.05,3,14,,,,,,12,5,0.8,105
ruthenium,,5,3.5,1.5,0.7,0.25,,,,3,10,1.5,0.5,0.3,3,11,1.5,0.7,0.1,3,11,0.8,0.3,0.15,3,9,10,4.65,0.8,80
cobalt,,5,3.5,1.5,0.7,0.25,,,,3,9,1.5,0.5,0.3,3,10,1.5,0.7,0.1,3,10,0.8,0.3,0.15,3,8,9,4.65,0.7,80
platinum,,,3.8,1.7,0.8,0.3,,,,3,8,1.7,0.65,0.35,3,8,1.5,0.7,0.1,3,9,0.8,0.3,0.15,3,7,8,4.5,0.8,60
aluminum,,,4,1.85,0.9,0.35,,,,3,7,1.85,0.7,0.4,3,7,1.65,0.8,0.15,3,8,0.95,0.4,0.2,3,5,7,4.5,0.65,60
stainlesssteel,,,,3.6,1.4,0.7,,,,2,4.75,2.35,1.3,0.9,2,5.25,2.35,1.1,0.3,2,6.25,1.35,0.8,0.35,2,3.25,4.75,4.25,0.95,100
lead,,,,2.4,1.2,0.6,,,,3,9,2.2,1,0.6,3,9,2,1,0.25,3,10,1.2,0.6,0.3,3,7,9,4.3,1.6,5
nickel,,,,3.4,1.3,0.65,,,,2,5.25,2.275,1.2,0.75,2,6.75,2.2,0.95,0.275,2,6.75,1.3,0.75,0.325,2,3.75,5.25,4.25,0.9,45
gold,,,,2.4,1.2,0.6,,,,3,5.5,2.2,1,0.6,3,6,2,1,0.25,3,7,1.2,0.6,0.3,3,4,5.5,4.3,1.1,5
silver,,,,2.4,1.2,0.6,,,,3,5.5,2.4,1.1,0.65,3,6,2.2,1.1,0.3,3,7,1.4,0.7,0.35,3,4,5.5,45,0.9,45
flint,,,,4.15,1.7,0.85,,,,2,4,2.65,1.5,1.05,2,5,2.65,1.6,0.4,2,5,1.65,1,0.45,2,4,4,4.15,1.1,20