[Modding Tutorial]New node groups

User avatar
LorenzoVulcan
Member
 
Posts: 437
Joined: Mon Mar 12, 2012 06:46

[Modding Tutorial]New node groups

by LorenzoVulcan » Fri Mar 23, 2012 18:19

Admin Edit: See celeron55's replies.

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:

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
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:

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
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:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
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:
Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
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:

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
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!
Last edited by celeron55 on Sat Mar 24, 2012 17:23, edited 1 time in total.
Developer of the BlockForge 2# Project!
Official thread: http://minetest.net/forum/viewtopic.php?pid=54290#p54290
 

User avatar
sdzen
Member
 
Posts: 1170
Joined: Fri Aug 05, 2011 22:33

by sdzen » Fri Mar 23, 2012 19:08

couldnt you use groups = {immediate=1}
or instant i forget which
Last edited by sdzen on Fri Mar 23, 2012 19:09, edited 1 time in total.
[h]Zen S.D.[/h] The next generation of tranquility!
malheureusement mon français n'est pas bon :<
Owner of the Zelo's
In game name: MuadTralk, spdtainted, sdzen, sd zen, sdzeno
 

User avatar
sfan5
Member
 
Posts: 3636
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5

by sfan5 » Fri Mar 23, 2012 19:25

Nice Tutorial!
Mods: Mesecons | WorldEdit | Nuke
Minetest builds for Windows (32-bit & 64-bit)
 

User avatar
LorenzoVulcan
Member
 
Posts: 437
Joined: Mon Mar 12, 2012 06:46

by LorenzoVulcan » Fri Mar 23, 2012 19:29

sdzen wrote:couldnt you use groups = {immediate=1}
or instant i forget which

Yes you can,you can create every group's name you want (i think) and set 0.00 in the tool's value.
sfan5 wrote:Nice Tutorial!

Thanks++ ;)
Last edited by LorenzoVulcan on Fri Mar 23, 2012 19:30, edited 1 time in total.
Developer of the BlockForge 2# Project!
Official thread: http://minetest.net/forum/viewtopic.php?pid=54290#p54290
 

lord_james
Member
 
Posts: 51
Joined: Sun Mar 11, 2012 22:06

by lord_james » Fri Mar 23, 2012 21:35

Nice documentation!

Could it be posible replace the number for a function that return a number? For example, the hand can't broke obsidian in normal mode, but yes in creative mode

EDIT: Example - [1] = function(0.2)
Last edited by lord_james on Fri Mar 23, 2012 21:36, edited 1 time in total.
 

User avatar
Death Dealer
Member
 
Posts: 1379
Joined: Wed Feb 15, 2012 18:46

by Death Dealer » Fri Mar 23, 2012 23:35

Awesome tut:D
Keep calm and code python^_^
 

User avatar
sfan5
Member
 
Posts: 3636
Joined: Wed Aug 24, 2011 09:44
GitHub: sfan5
IRC: sfan5

by sfan5 » Sat Mar 24, 2012 05:09

lord_james wrote:Nice documentation!

Could it be posible replace the number for a function that return a number? For example, the hand can't broke obsidian in normal mode, but yes in creative mode

EDIT: Example - [1] = function(0.2)

It's not possible

PS.: The code you posted is wrong it must be:
[1] = function() return 0.2 end
Mods: Mesecons | WorldEdit | Nuke
Minetest builds for Windows (32-bit & 64-bit)
 

lord_james
Member
 
Posts: 51
Joined: Sun Mar 11, 2012 22:06

by lord_james » Sat Mar 24, 2012 14:24

sfan5 wrote:
lord_james wrote:EDIT: Example - [1] = function(0.2)


PS.: The code you posted is wrong it must be:
[1] = function() return 0.2 end


Yeah, it's wrong. I wanted to say "name of function".

sfan5 wrote:It's not possible


No, I'm not so sure about that. Now, I have tested it. For example, replace this in "default":

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
-- The hand
minetest.register_item(":", {
    type = "none",
    wield_image = "wieldhand.png",
    wield_scale = {x=1,y=1,z=2.5},
    tool_capabilities = {
        full_punch_interval = 1.0,
        max_drop_level = 0,
        groupcaps = {
            fleshy = {times={[2]=2.00, [3]=1.00}, maxwear=0, maxlevel=1},
            crumbly = {times={[3]=0.70}, maxwear=0, maxlevel=1},
            snappy = {times={[3]=0.40}, maxwear=0, maxlevel=1},
            oddly_breakable_by_hand = {times={[1]=1.50,[2]=1.00,[3]=0.70}, maxwear=0, maxlevel=3},
        }
    }
})


For this:

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
function admin_mode()
    if minetest.setting_getbool("creative_mode") then
    return {cracky={times={[1]=0.2, [2]=0.2, [3]=0.2}, maxwear=0.05, maxlevel=3}, 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}}
    else
    return {fleshy = {times={[2]=2.00, [3]=1.00}, maxwear=0, maxlevel=1}, crumbly = {times={[3]=0.70}, maxwear=0, maxlevel=1}, snappy = {times={[3]=0.40}, maxwear=0, maxlevel=1}, oddly_breakable_by_hand = {times={[1]=1.50,[2]=1.00,[3]=0.70}, maxwear=0, maxlevel=3}}
    end
end

-- The hand
minetest.register_item(":", {
    type = "none",
    wield_image = "wieldhand.png",
    wield_scale = {x=1,y=1,z=2.5},
    tool_capabilities = {
        full_punch_interval = 1.0,
        max_drop_level=1,
        groupcaps=admin_mode()
    }
})
Last edited by lord_james on Sat Mar 24, 2012 14:26, edited 1 time in total.
 

celeron55
Member
 
Posts: 430
Joined: Tue Apr 19, 2011 10:10

by celeron55 » Sat Mar 24, 2012 17:22

I suggest not reading this; there are so many things wrong in this, and it completely breaks the whole idea of the group system.

If you want to make an extra strong node WHILE using some of the common groups for it (eg. cracky), you specify a higher level group for it. It will prevent lower-leveled tools from breaking it, and will increase the wear that tools take from mining it. You did read the modding API reference, right? 8) MeseTint does not use the levels currently at all; just like most other aspect of it, they are being held back while we work on the engine.

It is a design decision that you cannot make nodes that take an enormous time to destroy. Only ones that you can destroy in somewhat reasonable time, and ones that you cannot destroy with your tool.

However, in MeseTint, the groups need still to be tuned; they are somewhat random currently, and the digging time calculation algorithm of Minetest might require some tuning. I will revise my view on the system based on the brainfart that this topic is.

I support democracy and do not remove this topic.
Last edited by celeron55 on Sat Mar 24, 2012 17:33, edited 1 time in total.
 

User avatar
LorenzoVulcan
Member
 
Posts: 437
Joined: Mon Mar 12, 2012 06:46

by LorenzoVulcan » Sat Mar 24, 2012 17:36

celeron55 wrote:I suggest not reading this; there are so many things wrong in this, and it completely breaks the whole idea of the group system.

If you want to make an extra strong node WHILE using some of the common groups for it (eg. cracky), you specify a higher level group for it. It will prevent lower-leveled tools from breaking it, and will increase the wear that tools take from mining it.

It is a design decision that you cannot make nodes that take an enormous time to destroy. Only ones that you can destroy in somewhat reasonable time, and ones that you cannot destroy with your tool.

However, in MeseTint, the groups need still to be tuned; they are somewhat random currently, and the digging time calculation algorithm of Minetest might require some tuning. I will revise my view on the system based on the brainfart that this topic is.

I just suggested some use of this new API,This is how i see the groups system.
"If you want to make an extra strong node WHILE using some of the common groups for it (eg. cracky), you specify a higher level group for it."
The tutorial just learn this...
I just wanted to help the community,if i didn't do that i'm sorry.
Developer of the BlockForge 2# Project!
Official thread: http://minetest.net/forum/viewtopic.php?pid=54290#p54290
 

celeron55
Member
 
Posts: 430
Joined: Tue Apr 19, 2011 10:10

by celeron55 » Sat Mar 24, 2012 17:39

LorenzoVulcan wrote:I just suggested some use of this new API,This is how i see the groups system.
"If you want to make an extra strong node WHILE using some of the common groups for it (eg. cracky), you specify a higher level group for it."
The tutorial just learn this...
I just wanted to help the community,if i didn't do that i'm sorry.


No, you do not define a level group. You just add a new rating to a digging time / damage group, which is highly discouraged, because it breaks all the cross-compatibility between the engine and mods that the group system intends to provide.
 

User avatar
LorenzoVulcan
Member
 
Posts: 437
Joined: Mon Mar 12, 2012 06:46

by LorenzoVulcan » Sat Mar 24, 2012 17:40

celeron55 wrote:
LorenzoVulcan wrote:I just suggested some use of this new API,This is how i see the groups system.
"If you want to make an extra strong node WHILE using some of the common groups for it (eg. cracky), you specify a higher level group for it."
The tutorial just learn this...
I just wanted to help the community,if i didn't do that i'm sorry.


No, you do not define a level group. You just add a new rating to a digging time / damage group, which is highly discouraged, because it breaks all the cross-compatibility between the engine and mods that the group system intends to provide.

I'm not encountring problems using this method.
Developer of the BlockForge 2# Project!
Official thread: http://minetest.net/forum/viewtopic.php?pid=54290#p54290
 

celeron55
Member
 
Posts: 430
Joined: Tue Apr 19, 2011 10:10

by celeron55 » Sat Mar 24, 2012 17:56

If somebody who is not completely clueless is reading this, I'll mention that I will be considering adding a group called "tough", the only function of which is to always multiply the digging times based on it's rating, independently of other factors. It should provide, in a cross-mod/engine-mod compatible way, what LorenzoVulcan is trying to accomplish here.

I am not trying to spoil anyone's day; I am trying to lay a solid framework for the future of Minetest in terms of mod interoperability and balanceability.
 

User avatar
LorenzoVulcan
Member
 
Posts: 437
Joined: Mon Mar 12, 2012 06:46

by LorenzoVulcan » Sat Mar 24, 2012 18:06

celeron55 wrote:If somebody who is not completely clueless is reading this, I'll mention that I will be considering adding a group called "tough", the only function of which is to always multiply the digging times based on it's rating, independently of other factors. It should provide, in a cross-mod/engine-mod compatible way, what LorenzoVulcan is trying to accomplish here.

I am not trying to spoil anyone's day; I am trying to lay a solid framework for the future of Minetest in terms of mod interoperability and balanceability.

I did this tutorial for show a method to bypass the limit of the easy-breakable node,i dunno why you don't want this.
Developer of the BlockForge 2# Project!
Official thread: http://minetest.net/forum/viewtopic.php?pid=54290#p54290
 

celeron55
Member
 
Posts: 430
Joined: Tue Apr 19, 2011 10:10

by celeron55 » Sat Mar 24, 2012 18:51

For the sake of completeness, here is the correct way to make a node that you can break only by using the mese pickaxe of the default tools:

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.register_node("obsidian:superobsidian", {
    description = "Super obsidian",
    tile_images = {"thegame.png"},
    groups = {cracky=1, level=3},
})


Actually, I am not sure if this even works yet - let me see...

EDIT: Oh, I found a bug; apparently you need to set level=2 because there is a < somewhere instead of <=... 8)
Last edited by celeron55 on Sat Mar 24, 2012 18:55, edited 1 time in total.
 

User avatar
LorenzoVulcan
Member
 
Posts: 437
Joined: Mon Mar 12, 2012 06:46

by LorenzoVulcan » Sat Mar 24, 2012 18:52

celeron55 wrote:For the sake of completeness, here is the correct way to make a node that you can break only by using the mese pickaxe of the default tools:

Your phone or window isn't wide enough to display the code box. If it's a phone, try rotating it to landscape mode.
Code: Select all
minetest.register_node("obsidian:superobsidian", {
    description = "Super obsidian",
    tile_images = {"thegame.png"},
    groups = {cracky=1, level=3},
})

I don't want to make this,i want to make the node more strong too.
Developer of the BlockForge 2# Project!
Official thread: http://minetest.net/forum/viewtopic.php?pid=54290#p54290
 

celeron55
Member
 
Posts: 430
Joined: Tue Apr 19, 2011 10:10

by celeron55 » Sat Mar 24, 2012 19:17

LorenzoVulcan wrote:I don't want to make this,i want to make the node more strong too.


I do understand this issue, which is why I think the tough group could help. Let me think for a bit.

The whole definition of the cracky group is that it is either 0, 1, 2 or 3. Thus it *cannot* be anything else. It is not strictly enforced because it would disallow some rare tricks. I want to trust the modders; you are not babies or animals, you are grown-up people. Also 3 is the *crackiest*, thus *easiest* to break. A level 4 for a tough node does not make any sense.

The cracky group is not really suitable for defining a large range of digging times; it exists to be able to define with what kind of tool the node can be destroyed, and roughly how much easier it is to destroy with that kind of tool than some other kind of tool (the 0, 1, 2 and 3 values between cracky/crumbly/whatever).

When you use the level group, then somebody else can, in a different mod, define a tool that is as good as a mese pick at digging your node by just setting the correct maxlevel value for the cracky group in tool_properties. He doesn't need to try to guess what non-standard values you put as the ratings of the cracky group or whatnot.

He can for example leave out the crumbly and snappy groups and make the tool a bit easier to get than the mese pick, which keeps the game well balanced still in terms of your node too.

The problem comes when the tool directly uses the digging time values *regardless* of how much higher level it is than the node.

Hmm... I just realized that the system could possibly work so that the level difference of the tool and the node would scale the digging times in some good way; that way no "tough" group is required and everything would work pretty much like expected... I need to try it out. Just bear with the current system until I get to trying it; I have other important development going on currently.
 

User avatar
LorenzoVulcan
Member
 
Posts: 437
Joined: Mon Mar 12, 2012 06:46

by LorenzoVulcan » Sat Mar 24, 2012 19:26

I just toke in example the cracky group but i wrote that you can create every group you want.
Developer of the BlockForge 2# Project!
Official thread: http://minetest.net/forum/viewtopic.php?pid=54290#p54290
 

User avatar
bgsmithjr
Member
 
Posts: 436
Joined: Thu Mar 08, 2012 23:21

by bgsmithjr » Sun Mar 25, 2012 02:58

Don't be discouraged. I thought it was very well written and informative. But if 'default:stone' is set to cracky=3, a wood shovel's max level for cracky should be 2 because it is too weak. Setting a weak tool's max level to a strong tool's max level isn't realistic. But that's a personal opinion, your tutorial is 100% correct syntax-wise.
Last edited by bgsmithjr on Sun Mar 25, 2012 02:59, edited 1 time in total.
 


Return to WIP Mods

Who is online

Users browsing this forum: No registered users and 11 guests

cron