Modify node definition after registration

Nore
Member
 
Posts: 468
Joined: Wed Nov 28, 2012 11:35
GitHub: Ekdohibs

Modify node definition after registration

by Nore » Fri Jan 11, 2013 18:50

Is it possible to modify the definition a node after it has been registered (for example, modifying a chest without having to change the default mod code) ?
 

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

by LorenzoVulcan » Fri Jan 11, 2013 18:54

Yes,override.

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("default:chest",...)


in ... node properties.

Just overwrite the registration.
Developer of the BlockForge 2# Project!
Official thread: http://minetest.net/forum/viewtopic.php?pid=54290#p54290
 

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

by rubenwardy » Fri Jan 11, 2013 18:56

LorenzoVulcan wrote:Yes,override.

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("default:chest",...)


in ... node properties.

Just overwrite the registration.


minetest.register_node(" : default:chest",...)

remember the :
Last edited by rubenwardy on Fri Jan 11, 2013 18:57, edited 1 time in total.
 

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

by LorenzoVulcan » Fri Jan 11, 2013 19:21

rubenwardy wrote:
minetest.register_node(" : default:chest",...)

remember the :

If you want to overwrite the node you must give a name that's equal to original node,so you need "default:chest",
Developer of the BlockForge 2# Project!
Official thread: http://minetest.net/forum/viewtopic.php?pid=54290#p54290
 

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

by rubenwardy » Fri Jan 11, 2013 19:23

LorenzoVulcan wrote:
rubenwardy wrote:
minetest.register_node(" : default:chest",...)

remember the :

If you want to overwrite the node you must give a name that's equal to original node,so you need "default:chest",


:default:chest

and

default:chest

are the same names, ":" is the override character.
 

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

by LorenzoVulcan » Fri Jan 11, 2013 19:24

rubenwardy wrote:
LorenzoVulcan wrote:
rubenwardy wrote:
minetest.register_node(" : default:chest",...)

remember the :

If you want to overwrite the node you must give a name that's equal to original node,so you need "default:chest",


:default:chest

and

default:chest

are the same names, ":" is the override character.

You don't need to put ":" to override them.
Developer of the BlockForge 2# Project!
Official thread: http://minetest.net/forum/viewtopic.php?pid=54290#p54290
 

User avatar
rubenwardy
Member
 
Posts: 4500
Joined: Tue Jun 12, 2012 18:11
GitHub: rubenwardy
IRC: rubenwardy
In-game: rubenwardy

by rubenwardy » Fri Jan 11, 2013 19:25

He is accessing it from another mod.

Surely he needs it?
 

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

by LorenzoVulcan » Fri Jan 11, 2013 19:55

rubenwardy wrote:He is accessing it from another mod.

Surely he needs it?

I already tried with functions,i think that nodes are the same.
Anyway,modname is a problem but i don't know if ":" will solve it.I never tried with nodes.
Last edited by LorenzoVulcan on Fri Jan 11, 2013 19:55, edited 1 time in total.
Developer of the BlockForge 2# Project!
Official thread: http://minetest.net/forum/viewtopic.php?pid=54290#p54290
 

User avatar
kaeza
Member
 
Posts: 2141
Joined: Thu Oct 18, 2012 05:00
GitHub: kaeza
IRC: kaeza diemartin blaaaaargh
In-game: kaeza

by kaeza » Fri Jan 11, 2013 20:26

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.registered_nodes["default:chest"].blahblah = blahblahblah;

Just sayin' :)

LorenzoVulcan wrote:
rubenwardy wrote:
LorenzoVulcan wrote:If you want to overwrite the node you must give a name that's equal to original node,so you need "default:chest",


:default:chest

and

default:chest

are the same names, ":" is the override character.

You don't need to put ":" to override them.

Yes you do if you want to override or otherwise add a node in a different namespace.
Last edited by kaeza on Fri Jan 11, 2013 20:28, edited 1 time in total.
Your signature is not the place for a blog post. Please keep it as concise as possible. Thank you!

Check out my stuff! | Donations greatly appreciated! PayPal | BTC: 1DFZAa5VtNG7Levux4oP6BuUzr1e83pJK2
 


Return to WIP Mods

Who is online

Users browsing this forum: No registered users and 9 guests

cron