File tree 3 files changed +33
-1
lines changed
games/minimal/mods/experimental
3 files changed +33
-1
lines changed Original file line number Diff line number Diff line change @@ -1551,6 +1551,8 @@ Special groups
1551
1551
connect to each other
1552
1552
* `slippery`: Players and items will slide on the node.
1553
1553
Slipperiness rises steadily with `slippery` value, starting at 1.
1554
+ * `disable_repair`: If set to 1 for a tool, it cannot be repaired using the
1555
+ `"toolrepair"` crafting recipe
1554
1556
1555
1557
1556
1558
Known damage and digging time defining groups
@@ -6156,6 +6158,8 @@ Used by `minetest.register_craft`.
6156
6158
additional_wear = -0.02,
6157
6159
}
6158
6160
6161
+ Note: Tools with group `disable_repair=1` will not repairable by this recipe.
6162
+
6159
6163
### Cooking
6160
6164
6161
6165
{
Original file line number Diff line number Diff line change @@ -615,6 +615,34 @@ minetest.register_craftitem("experimental:tester_tool_2", {
615
615
end ,
616
616
})
617
617
618
+ -- Test the disable_repair=1 group
619
+ minetest .register_tool (" experimental:unrepairable_tool" , {
620
+ description = " Unrepairable Tool" ,
621
+ wield_image = " default_stone.png" ,
622
+ inventory_image = " default_stone.png" ,
623
+ tool_capabilities = {
624
+ groupcaps = {
625
+ cracky = {
626
+ times = {3 , 2 , 1 },
627
+ }
628
+ }
629
+ },
630
+ groups = { disable_repair = 1 }
631
+ })
632
+
633
+ minetest .register_tool (" experimental:repairable_tool" , {
634
+ description = " Repairable Tool" ,
635
+ wield_image = " default_dirt.png" ,
636
+ inventory_image = " default_dirt.png" ,
637
+ tool_capabilities = {
638
+ groupcaps = {
639
+ cracky = {
640
+ times = {3 , 2 , 1 },
641
+ }
642
+ }
643
+ },
644
+ })
645
+
618
646
minetest .register_craft ({
619
647
output = ' experimental:tester_tool_2' ,
620
648
recipe = {
Original file line number Diff line number Diff line change @@ -579,7 +579,7 @@ static ItemStack craftToolRepair(
579
579
IItemDefManager *idef = gamedef->idef ();
580
580
if (item1.count != 1 || item2.count != 1 || item1.name != item2.name
581
581
|| idef->get (item1.name ).type != ITEM_TOOL
582
- || idef->get (item2 .name ).type != ITEM_TOOL ) {
582
+ || itemgroup_get ( idef->get (item1 .name ).groups , " disable_repair " ) == 1 ) {
583
583
// Failure
584
584
return ItemStack ();
585
585
}
You can’t perform that action at this time.
0 commit comments