With the new API we can't use constanttime or something like this,so how can we make a notsoeasytobroke node?
Here's your solution:
Now,for example,i want to make a super-obsidian node,but the cracky level 1 is not enough strong for my level.What can i do?
Don't worry!
Open our init.lua and get an example of the node construction:
- Code: Select all
minetest.register_node("obsidian:superobsidian", {
description = "Super obsidian",
tile_images = {"thegame.png"},
is_ground_content = true,
groups = {cracky=1},
})
This is ready,but the "cracky 1" level doesn't look like an anti-nuclear-geothermal and creeper-pwner block,so how can we make this stronger?
This is so simply,Take "groups" string and make it:
- Code: Select all
groups = {cracky=4},
The 4 is a random number,you can insert every number you want to set,but don't use and already used number or there will be a conflict.
Then go to default/init.lua
Now,We must insert this:
- Code: Select all
[4]=1.00
(1.00 is the constant time that the tool take to destroy the node)
Where?
In a tool.If we insert this snippet in the tool code,this tool can now broke the node.
So there's an example:
- Code: Select all
minetest.register_tool("default:pick_mese", {
description = "Mese Pickaxe",
inventory_image = "default_tool_mesepick.png",
tool_capabilities = {
full_punch_interval = 1.0,
max_drop_level=3,
groupcaps={
cracky={times={[1]=0.2, [2]=0.2, [3]=0.2, [4]=1.00}, maxwear=0.05, maxlevel=4},
crumbly={times={[1]=0.2, [2]=0.2, [3]=0.2}, maxwear=0.05, maxlevel=3},
snappy={times={[1]=0.2, [2]=0.2, [3]=0.2}, maxwear=0.05, maxlevel=3}
}
},
})
Note:"maxlevel=4"is the max level of the group,always modify that when you add a new group's level!
So now the mese pick can destroy the super obsidian.
Here an example for the steel pick:
- Code: Select all
minetest.register_tool("default:pick_steel", {
description = "Steel Pickaxe",
inventory_image = "default_tool_steelpick.png",
tool_capabilities = {
max_drop_level=1,
groupcaps={
cracky={times={[1]=1.00, [2]=0.60, [3]=0.40, [4]=1.20}, maxwear=0.1, maxlevel=4}
}
},
})
Remember to sostitute the code of the tool,never insert 2 definitions of the same tool or the game will not run!
So,The tutorial is finished,Suggestions are accepted.
Good Modding Boihs!