adopt tool config

master
A. Demant 2018-11-07 06:40:53 +01:00
parent ae8c2cfbd4
commit edbc4ee104
3 changed files with 76 additions and 99 deletions

110
api.lua
View File

@ -47,81 +47,55 @@ minerdream.register_armor = function(adef,tier_definition)
inventory_image=modname.."_inv_"..arm.."_"..adef.name..".png",
groups={armor_heal=adef.heal,armor_use=adef.use,physics_jump=adef.jump,
physics_speed=adef.speed,physics_gravity=adef.gravity},
armor_groups = {fleshy = adef[arm.."fleshy"]},
armor_groups = {fleshy = adef[arm.."_fleshy"]},
damage_groups=damage_groups,
}
armdef.groups[arm_trans[arm]] = 1
print(dump(armdef))
local hdesc=""..core.colorize(tdef.color,adef.name.." "..arm.."\n")..desc
print(hdesc)
local_register_armor(hdesc,armdef)
end
end
if adef.helmet_fleshy then
local helmet={
name=modname..":helmet_"..adef.name,
desc_name=adef.name.." helmet",
inventory_image=modname.."_inv_helmet_"..adef.name..".png",
groups={armor_heal=adef.heal,armor_use=adef.use,physics_jump=adef.jump,
physics_speed=adef.speed,physics_gravity=adef.gravity,
armor_head=1},
armor_groups = {fleshy = adef.helmet_fleshy},
damage_groups=damage_groups,
end
local time_scaled={[1]=1,[2]=0.4,[3]=0.16,[4]=2.4,[5]=3.2,[6]=4.8}
local tool_punch_intervall={
pick = 1, sword = 0.75, shovel = 1, axe = 1}
local tool_damage_groups = {
pick = 1, sword = 1.2, shovel = 0.7, axe = 1.1}
minerdream.register_tool = function(tdef,tier_definition)
local trdef=tier_definition[tdef.tier]
local modname=minetest.get_current_modname()
for _,tool in pairs({"pick","sword","shovel","axe"}) do
print(tool)
if tdef[tool] then
print("pong")
tool_def={name=modname..":"..tool.."_"..tdef.name,
desc_name=tdef.name.." "..tool,
inventory_image=modname.."_"..arm.."_"..tdef.name..".png",
wield_scale = {x=tdef.wield_scale,y=tdef.wield_scale,z=tdef.wield_scale},
range = tdef.tool_range,
tool_capabilities = {
full_punch_interval = tdef.full_punch_intervall * tool_punch_interval[tool],
max_drop_level = 1,
groupcaps = {
},
damage_goups = {fleshy = tdef.tool_fleshy * tool_damage_groups[tool]},
}
local hdesc=""..core.colorize(tdef.color,adef.name.." helmet\n")..desc
local_register_armor(hdesc,helmet)
end
if adef.chest_fleshy then
local chestplate={
name=modname..":chestplate_"..adef.name,
desc_name=adef.name.." chestplate",
inventory_image=modname.."_inv_chestplate_"..adef.name..".png",
groups={armor_heal=adef.heal,armor_use=adef.use,physics_jump=adef.jump,
physics_speed=adef.speed,physics_gravity=adef.gravity,
armor_torso=1},
armor_groups = {fleshy = adef.chest_fleshy},
damage_groups=damage_groups,
}
local hdesc=""..core.colorize(tdef.color,adef.name.." chestplate\n")..desc
local_register_armor(hdesc,chestplate)
end
if adef.leggings_fleshy then
local leggings={
name=modname..":leggings_"..adef.name,
desc_name=adef.name.." leggings",
inventory_image=modname.."_inv_leggings_"..adef.name..".png",
groups={armor_legs=adef.heal,armor_use=adef.use,physics_jump=adef.jump,
physics_speed=adef.speed,physics_gravity=adef.gravity,
armor_torso=1},
armor_groups = {fleshy = adef.leggings_fleshy},
damage_groups=damage_groups,
}
local hdesc=""..core.colorize(tdef.color,adef.name.." leggings\n")..desc
local_register_armor(hdesc,leggings)
end
if adef.boots_fleshy then
local boots={
name=modname..":boots_"..adef.name,
desc_name=adef.name.." boots",
inventory_image=modname.."_inv_boots_"..adef.name..".png",
groups={armor_feet=adef.heal,armor_use=adef.use,physics_jump=adef.jump,
physics_speed=adef.speed,physics_gravity=adef.gravity,
armor_torso=1},
armor_groups = {fleshy = adef.boots_fleshy},
damage_groups=damage_groups,
}
local hdesc=""..core.colorize(tdef.color,adef.name.." boots\n")..desc
local_register_armor(hdesc,boots)
end
if adef.shield_fleshy then
local shield={
name=modname..":shield_"..adef.name,
desc_name=adef.name.." shield",
inventory_image=modname.."_inv_shield_"..adef.name..".png",
groups={armor_shield=adef.heal,armor_use=adef.use,physics_jump=adef.jump,
physics_speed=adef.speed,physics_gravity=adef.gravity,
armor_torso=1},
armor_groups = {fleshy = adef.shield_fleshy},
damage_groups=damage_groups,
}
local hdesc=""..core.colorize(tdef.color,adef.name.." shield\n")..desc
local_register_armor(hdesc,shield)
for tg in pairs({"cracky","crumbly","choppy","snappy"}) do
if line[tool.."_"..tg.."_times"] then
tool_def.tool_capabilities.groupcaps[tg]={}
for ind=1,tdef[tool] do
tool_def.tool_capabilities.groupcaps[tg][ind]=line[tool.."_"..tg.."_times"] * time_scaled[ind]
end
end
end
print(dump(tool_def))
end
end
end

View File

@ -15,7 +15,7 @@ end
local ores_cols={
col_num={"clust_num_ores","clust_size","ymin","ymax","clust_scarcity",
"cooktime","tier","heal","use","jump","speed","gravity",
"helmet_fleshy","chest_fleshy","legging_fleshy","boot_fleshy","shield_fleshy"},
"helmet_fleshy","chestplate_fleshy","leggings_fleshy","boots_fleshy","shield_fleshy"},
groups_num={"crack","dust","block","desert"}
}
local ores_definition = minerdream.import_csv(minerdream.path.."/config.txt",ores_cols)
@ -33,4 +33,5 @@ for _,line in pairs(ores_definition) do
minerdream.register_armor(line,tier_definition)
end
end
minerdream.register_tool(line,tier_definition)
end

View File

@ -1,30 +1,32 @@
name,lump,bar,pick,crack,dust,block,desert,check_mods,override,clust_num_ores,clust_size,ymin,ymax,clust_scarcity,cooktime,tier,heal,use,jump,speed,gravity,helmet_fleshy,chestplate_fleshy,leggings_fleshy,boots_fleshy,shield_fleshy
rhodium,1,1,1,5,1,1,,,,3,3,-31000,-1500,16 * 16 * 16,64,6,8.35,60,0.09,0.12,-0.08,15,20,20,15,15
calcium,1,1,,5,1,1,,,,5,2,-31000,420,12 * 12 * 12,2,,,,,,,,,,,
tantalum,1,1,1,5,1,1,,,,3,3,-31000,-1500,16 * 16 * 16,64,6,8.2,60,0.1,0.16,-0.09,14.5,19.5,19.5,14.5,14.5
ruthenium,1,1,1,4,1,1,,,,3,3,-31000,-500,15 * 15 * 15,32,5,8,80,0.08,0.08,-0.08,13.75,18.75,18.75,13.75,13.75
cobalt,1,1,1,4,1,1,,,,3,3,-31000,-300,14 * 14 * 14,32,5,8.25,80,0.09,0.09,-0.09,13.5,18.5,18.5,13.5,13.5
platinum,1,1,1,1,1,1,,,,4,3,-31000,-300,14 * 14 * 14,16,4,7.75,100,0.03,0.03,-0.03,13.5,18.5,18.5,13.5,13.5
aluminium,1,1,1,1,1,1,,aluminium,,4,3,-31000,-250,14 * 14 * 14,32,4,7.5,100,0.06,0.06,-0.06,13,18,18,13,13
stainlesssteel,,1,1,,,,,,,,,,,,,2,6,175,0.01,,0.01,10,15,15,10,10
zinc,1,1,1,1,1,1,,,,7,3,-31000,-50,14 * 14 * 14,4,,,,,,,,,,,
potassium,1,1,,3,1,1,,,,7,3,-31000,420,13 * 13 * 13,2,,,,,,,,,,,
nickel,1,1,1,2,1,1,,,,7,3,-31000,-40,13 * 13 * 13,4,2,5,350,,-0.01,0.01,11,16,16,11,11
coal,1,1,,3,,,1,,,,,,,,,,,,,,,,,,,
sulfur,1,1,,3,1,,1,,,,,,,,,,,,,,,,,,,
lapislazuli,1,1,,3,,,1,,,,,,,,,,,,,,,,,,,
saltpeter,1,1,,3,1,1,1,,,,,,,,,,,,,,,,,,,
silver,1,1,1,3,,,,,moreores,3,2,-31000,-64,14 * 14 * 14,8,3,7.5,300,0.02,0.02,-0.02,11,16,16,11,11
lead,1,1,1,2,,,,,technic,7,3,-31000,-70,13 * 13 * 13,4,3,0,600,,-0.01,0.04,11,16,16,11,11
spinel,,,,5,,,,,,1,1,-31000,-1700,15 * 15 * 15,,,,,,,,,,,,
garnet,,,,4,,,,,,1,1,-31000,-650,15 * 15 * 15,,,,,,,,,,,,
bituminous_coal,1,1,,4,,,,,,10,3,-31000,-500,13 * 13 * 13,,,,,,,,,,,,
topaz,,,,4,,,,,,1,1,-31000,-1700,15 * 15 * 15,,,,,,,,,,,,
jade,,,,4,,,,,,1,1,-31000,-650,15 * 15 * 15,,,,,,,,,,,,
aquamarine,,,,4,,,,,,1,1,-31000,-1700,16 * 16 * 16,,,,,,,,,,,,
amethyst,,,,4,,,,,,1,1,-31000,-650,15 * 15 * 15,,,,,,,,,,,,
onyx,,,,4,,,,,,1,1,-31000,-1700,16 * 16 * 16,,,,,,,,,,,,
defender,,,,,,,,,,,,,,,,5,8,80,0.08,0.08,-0.08,14.25,19.25,19.25,14.25,14.25
scout,,,,,,,,,,,,,,,,5,8.75,80,0.1,0.13,-0.1,13.5,18.5,18.5,13.5,13.5
shadow,,,,,,,,,,,,,,,,6,9,50,0.1,0.25,-0.1,14.5,19.5,19.5,14.5,14.5
knight,,,,,,,,,,,,,,,,6,8.5,60,0.1,0.13,-0.09,15.25,20.25,20.25,15.25,15.25
name,lump,bar,pick,axe,sword,shovel,crack,dust,block,desert,check_mods,override,clust_num_ores,clust_size,ymin,ymax,clust_scarcity,cooktime,tier,heal,use,jump,speed,gravity,helmet_fleshy,chestplate_fleshy,leggings_fleshy,boots_fleshy,shield_fleshy,tool_range,full_pull_intervall,wield_scale,pick_cracky_times,tool_uses,tool_maxlevel,pick_crumbly_times,tool_fleshy,axe_choppy_times,axe_fleshy,sword_snappy,sword_fleshy,sword_full_punch_interval,shovel_crumbly_times,shovel_fleshy
rhodium,1,1,6,3,3,,5,1,1,,,,3,3,-31000,-1500,16 * 16 * 16,64,6,8.35,60,0.09,0.12,-0.08,15,20,20,15,15,5,0.8,1.55,1.25,105,3,0.6,12,1.2,12,1.25,14,0.6,,
calcium,1,1,,,,,5,1,1,,,,5,2,-31000,420,12 * 12 * 12,2,,,,,,,,,,,,,,,,,,,,,,,,,,
tantalum,1,1,6,3,3,,5,1,1,,,,3,3,-31000,-1500,16 * 16 * 16,64,6,8.2,60,0.1,0.16,-0.09,14.5,19.5,19.5,14.5,14.5,5,0.8,1.55,1.25,105,3,0.6,12,1.2,12,1.25,14,0.6,,
ruthenium,1,1,6,3,3,3,4,1,1,,,,3,3,-31000,-500,15 * 15 * 15,32,5,8,80,0.08,0.08,-0.08,13.75,18.75,18.75,13.75,13.75,4.65,0.8,1.4,1.5,80,3,,10,1.5,11,1.5,11,0.65,0.8,9
cobalt,1,1,6,3,3,3,4,1,1,,,,3,3,-31000,-300,14 * 14 * 14,32,5,8.25,80,0.09,0.09,-0.09,13.5,18.5,18.5,13.5,13.5,4.65,0.7,1.4,1.5,80,3,,9,1.5,10,1.5,10,0.55,0.8,8
platinum,1,1,6,3,3,3,1,1,1,,,,4,3,-31000,-300,14 * 14 * 14,16,4,7.75,100,0.03,0.03,-0.03,13.5,18.5,18.5,13.5,13.5,4.5,0.8,1.3,1.7,60,3,,8,1.7,8,1.5,9,0.65,0.8,7
aluminium,1,1,6,3,3,3,1,1,1,,aluminium,,4,3,-31000,-250,14 * 14 * 14,32,4,7.5,100,0.06,0.06,-0.06,13,18,18,13,13,4.5,0.65,1.3,1.85,60,3,,7,1.85,7,1.65,8,0.5,0.95,5
stainlesssteel,,1,3,3,3,3,,,,,,,,,,,,,2,6,175,0.01,,0.01,10,15,15,10,10,4.25,0.95,1.1,3.6,100,2,,4.75,3.6,4.75,2.35,6.25,0.75,1.35,3.25
zinc,1,1,,,,,1,1,1,,,,7,3,-31000,-50,14 * 14 * 14,4,,,,,,,,,,,,,,,,,,,,,,,,,,
potassium,1,1,,,,,3,1,1,,,,7,3,-31000,420,13 * 13 * 13,2,,,,,,,,,,,,,,,,,,,,,,,,,,
nickel,1,1,3,3,3,3,2,1,1,,,,7,3,-31000,-40,13 * 13 * 13,4,2,5,350,,-0.01,0.01,11,16,16,11,11,4.25,0.9,1.1,3.4,45,2,,5.25,2.2,6.75,2.2,6.75,0.7,1.3,3.75
coal,1,1,,,,,3,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
sulfur,1,1,,,,,3,1,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
lapislazuli,1,1,,,,,3,,,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
saltpeter,1,1,,,,,3,1,1,1,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,
silver,1,1,3,3,3,3,3,,,,,moreores,3,2,-31000,-64,14 * 14 * 14,8,3,7.5,300,0.02,0.02,-0.02,11,16,16,11,11,4.3,0.9,1.15,2.4,45,3,,5.5,2.4,6,2.2,7,7.25,1.4,4
lead,1,1,3,3,3,3,2,,,,,technic,7,3,-31000,-70,13 * 13 * 13,4,3,0,600,,-0.01,0.04,11,16,16,11,11,4.3,1.6,1.15,2.4,5,3,,9,2.4,9,2,10,1.5,1.2,7
spinel,,,,,,,5,,,,,,1,1,-31000,-1700,15 * 15 * 15,,,,,,,,,,,,,,,,,,,,,,,,,,,
garnet,,,,,,,4,,,,,,1,1,-31000,-650,15 * 15 * 15,,,,,,,,,,,,,,,,,,,,,,,,,,,
bituminous_coal,1,1,,,,,4,,,,,,10,3,-31000,-500,13 * 13 * 13,,,,,,,,,,,,,,,,,,,,,,,,,,,
topaz,,,,,,,4,,,,,,1,1,-31000,-1700,15 * 15 * 15,,,,,,,,,,,,,,,,,,,,,,,,,,,
jade,,,,,,,4,,,,,,1,1,-31000,-650,15 * 15 * 15,,,,,,,,,,,,,,,,,,,,,,,,,,,
aquamarine,,,,,,,4,,,,,,1,1,-31000,-1700,16 * 16 * 16,,,,,,,,,,,,,,,,,,,,,,,,,,,
amethyst,,,,,,,4,,,,,,1,1,-31000,-650,15 * 15 * 15,,,,,,,,,,,,,,,,,,,,,,,,,,,
onyx,,,,,,,4,,,,,,1,1,-31000,-1700,16 * 16 * 16,,,,,,,,,,,,,,,,,,,,,,,,,,,
defender,,,,,,,,,,,,,,,,,,,5,8,80,0.08,0.08,-0.08,14.25,19.25,19.25,14.25,14.25,,,,,,,,,,,,,,,
scout,,,,,,,,,,,,,,,,,,,5,8.75,80,0.1,0.13,-0.1,13.5,18.5,18.5,13.5,13.5,,,,,,,,,,,,,,,
shadow,,,,,,,,,,,,,,,,,,,6,9,50,0.1,0.25,-0.1,14.5,19.5,19.5,14.5,14.5,,,,,,,,,,,,,,,
knight,,,,,,,,,,,,,,,,,,,6,8.5,60,0.1,0.13,-0.09,15.25,20.25,20.25,15.25,15.25,,,,,,,,,,,,,,,
gold,,,3,3,3,3,,,,,,,,,,,,,,,,,,,,,,,,4.3,1.1,1.15,2.4,5,3,,5.5,2.2,6,2,7,0.975,1.2,4
flint,,,3,3,,3,,,,,,,,,,,,,,,,,,,,,,,,4.15,1.1,1,4.15,20,2,,4,2.65,5,,,,2.65,5