Difference between revisions of "Proposals/Damage system"

From Minetest Developer Wiki
Jump to navigation Jump to search
(Created page with "For tools: <code> Old: minetest.register_tool("default:sword_steel", { description = "Steel Sword", inventory_image = "default_tool_steelsword.png", tool_capabilit...")
 
Line 1: Line 1:
 
For tools:
 
For tools:
<code>
+
<pre>
 
Old:
 
Old:
 
minetest.register_tool("default:sword_steel", {
 
minetest.register_tool("default:sword_steel", {
Line 32: Line 32:
 
     }
 
     }
 
})
 
})
</code>
+
</pre>
  
 
For entities:
 
For entities:
<code>
+
<pre>
 
Old:
 
Old:
 
     self.object:set_armor_groups({fleshy=3})
 
     self.object:set_armor_groups({fleshy=3})
 
New:
 
New:
 
     self.object:set_armor_groups({fleshy=-1})
 
     self.object:set_armor_groups({fleshy=-1})
</code>
+
</pre>

Revision as of 20:45, 26 March 2013

For tools:

Old:
minetest.register_tool("default:sword_steel", {
    description = "Steel Sword",
    inventory_image = "default_tool_steelsword.png",
    tool_capabilities = {
        full_punch_interval = 0.8,
        max_drop_level=1,
        groupcaps={
            fleshy={times={[1]=2.00, [2]=0.80, [3]=0.40}, uses=10, maxlevel=2},
            snappy={times={[2]=0.70, [3]=0.30}, uses=40, maxlevel=1},
            choppy={times={[3]=0.65}, uses=40, maxlevel=0}
        }
    }
})
New:
minetest.register_tool("default:sword_steel", {
    description = "Steel Sword",
    inventory_image = "default_tool_steelsword.png",
    tool_capabilities = {
        -- Digging capabilities
        max_drop_level = 1,
        groupcaps = {
            fleshy={times={[1]=2.00, [2]=0.80, [3]=0.40}, uses=10, maxlevel=2},
            snappy={times={[2]=0.70, [3]=0.30}, uses=40, maxlevel=1},
            choppy={times={[3]=0.65}, uses=40, maxlevel=0}
        },
        -- Damage capabilities
        full_punch_interval = 0.8,
        damage_groups = {fleshy=8, snappy=4, choppy=2},
    }
})

For entities:

Old:
    self.object:set_armor_groups({fleshy=3})
New:
    self.object:set_armor_groups({fleshy=-1})