Page 1 of 1

How can I stop items from dropping when a node (isn't) broken?

PostPosted: Thu Oct 10, 2013 20:33
by bbqroast
Hey,

I'm writing a mod in which some nodes will not break. Right now I have done this by catching the on node break event and placing the old node back in it's original position. This works except the node still drops an item. Is their a better way to stop a node from breaking?

The nodes can be of all types and placed anywhere in the world

PostPosted: Thu Oct 10, 2013 21:21
by Topywo
bbqroast wrote:Hey,

I'm writing a mod in which some nodes will not break. Right now I have done this by catching the on node break event and placing the old node back in it's original position. This works except the node still drops an item. Is their a better way to stop a node from breaking?

The nodes can be of all types and placed anywhere in the world


drop = '', (or drop = "", ) causes no item to be dropped.


Removing the dig type (don't know the proper name) from groups, for example:
groups = {crumbly=3,soil=1}, --> groups = {soil=1},
makes them unbreakable.

Search in this file: minetest/doc/lua_api.txt 'groups' to learn more of them.

PostPosted: Thu Oct 10, 2013 22:19
by bbqroast
I'm not creating new node types. Rather I'm trying to prevent specific nodes in the world from dropping items when they are broken, the nodes that don't drop things could be pretty much anything.

I'm writing a protection plugin.

PostPosted: Fri Oct 11, 2013 00:06
by Menche
See this code from node_ownership. Basically what it does is back up the built-in node_dig, item_place, and node_punch functions, then override them. The permission check is done in the overridden function, and the original function is called only if a player is allowed to dig.