The way the amount of damage is actually determined is by calculating how many nodes with the matching group the tool could dig in the time between swings (with the initial and maximum time being the tool's "full punch interval"), and applying this directly as hit point loss (TODO: figure out what happens when MULTIPLE groups match is the best one taken, or are results added, or.?). For example, in the default game living things usually have a rating from 1 to 3 in the "fleshy" group, and a weapon will specify that it can damage "fleshy" things, whereas a shovel can only dig/damage "crumbly" things. For a tool to damage an entity, the tool's capabilities must specify that it can damage things belonging to a group that the entity has a rating for (the armor_groups field). This relies heavily on the Groups mechanism. It must return a string, and this string will be passed to on_activate(self, staticdata) when the entity is re-instantiated.īy default damage to entities is handled automatically by the engine in a way that is designed to be generic enough to mix use of tools both to dig nodes and act as weapons against entities.
![minetest armor minetest armor](https://raw.githubusercontent.com/IIIullaIII/IMMAGINI/master/immagini%20minetest%20forum/canapa_ice2.png)
#Minetest armor code#
Runtime values may then be set for each instance individually inside the on_activate(self, staticdata) callback (see below) or by the code causing the entity to be spawned. User code may include arbitrary fields and methods in the Lua entity by adding them to the prototype. The Lua entity object may be obtained from the LuaEntitySAO using get_luaentity(). object - Reference back to the LuaEntitySAO object.name - The registered name passed to minetest.register_entity(.).In addition it has the following added properties: The Lua entity's properties are initialized from the prototype's properties.
#Minetest armor mod#
This Lua entity is the place where a mod should store the data and methods it uses to implement custom entities.
![minetest armor minetest armor](https://static.planetminecraft.com/files/resource_media/screenshot/1310/2013-03-09_163822_5014369.jpg)