use of API function set_tool_capabiliti()

User avatar
pandaro
Member
 
Posts: 320
Joined: Sun Jan 08, 2012 21:34
Location: behind
GitHub: pandaro

use of API function set_tool_capabiliti()

by pandaro » Sat Jan 27, 2018 19:10

I'm try to figure out how to use
set_tool_capability()
here my code:
Code: Select all
ismd = {}

minetest.register_tool("ismd:1", {
   description = "Wooden Pickaxe",
   inventory_image = "default_tool_woodpick.png",
   on_place = function(itemstack, placer, pointed_thing)
      print(dump(itemstack:get_tool_capabilities()))
      local meta = itemstack:get_meta()
      meta:set_tool_capabilities({
      max_drop_level=10,
      groupcaps={
         cracky={times={[2]=20.00, [3]=0.20}, uses=100, maxlevel=10}
      },
      damage_groups = {fleshy=20},
      print(dump(itemstack:get_tool_capabilities()))
   })
end,
   tool_capabilities = {
      max_drop_level=0,
      groupcaps={
         cracky={times={[2]=2.00, [3]=1.20}, uses=10, maxlevel=1}
      },
      damage_groups = {fleshy=2},
   },
})


here the output:
Code: Select all
{
        max_drop_level = 0,
        full_punch_interval = 1.3999999761581,
        groupcaps = {
                cracky = {
                        uses = 10,
                        maxlevel = 1,
                        times = {
                                [3] = 1.2000000476837,
                                [2] = 2
                        }
                }
        },
        damage_groups = {
                fleshy = 2
        }
}
{
        fields = {

        }
}
"table: 0x7faf5c047560"
{
        max_drop_level = 0,
        full_punch_interval = 1.3999999761581,
        groupcaps = {
                cracky = {
                        uses = 10,
                        maxlevel = 1,
                        times = {
                                [3] = 1.2000000476837,
                                [2] = 2
                        }
                }
        },
        damage_groups = {
                fleshy = 2
        }
}


No error but nothing happened! thank you in advance
 

Return to Modding Discussion



Who is online

Users browsing this forum: No registered users and 1 guest