From e4fb7ae533615172592fd7335b9d3e1bc2742a14 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Wed, 19 Feb 2020 15:53:51 +0100 Subject: [PATCH] Add punch_attack_uses to weapons --- mods/ITEMS/mcl_farming/hoes.lua | 33 +++++++++++++++++++++++---------- mods/ITEMS/mcl_tools/init.lua | 20 ++++++++++++++++++++ 2 files changed, 43 insertions(+), 10 deletions(-) diff --git a/mods/ITEMS/mcl_farming/hoes.lua b/mods/ITEMS/mcl_farming/hoes.lua index 04105b0a..e48e8a43 100644 --- a/mods/ITEMS/mcl_farming/hoes.lua +++ b/mods/ITEMS/mcl_farming/hoes.lua @@ -49,6 +49,14 @@ local hoe_on_place_function = function(wear_divisor) end end +local uses = { + wood = 60, + stone = 132, + iron = 251, + gold = 33, + diamond = 1561, +} + local hoe_longdesc = S("Hoes are essential tools for growing crops. They are used to create farmland in order to plant seeds on it. Hoes can also be used as very weak weapons in a pinch.") local hoe_usagehelp = S("Use the hoe on a cultivatable block (by rightclicking it) to turn it into farmland. Dirt, grass blocks and grass paths are cultivatable blocks. Using a hoe on coarse dirt turns it into dirt.") @@ -58,11 +66,12 @@ minetest.register_tool("mcl_farming:hoe_wood", { _doc_items_usagehelp = hoe_usagehelp, _doc_items_hidden = false, inventory_image = "farming_tool_woodhoe.png", - on_place = hoe_on_place_function(60), + on_place = hoe_on_place_function(uses.wood), groups = { tool=1, hoe=1 }, tool_capabilities = { full_punch_interval = 1, - damage_groups = { fleshy = 1, } + damage_groups = { fleshy = 1, }, + punch_attack_uses = uses.wood, }, _repair_material = "group:wood", }) @@ -94,11 +103,12 @@ minetest.register_tool("mcl_farming:hoe_stone", { _doc_items_longdesc = hoe_longdesc, _doc_items_usagehelp = hoe_usagehelp, inventory_image = "farming_tool_stonehoe.png", - on_place = hoe_on_place_function(132), + on_place = hoe_on_place_function(uses.stone), groups = { tool=1, hoe=1 }, tool_capabilities = { full_punch_interval = 0.5, - damage_groups = { fleshy = 1, } + damage_groups = { fleshy = 1, }, + punch_attack_uses = uses.stone, }, _repair_material = "mcl_core:cobblestone", }) @@ -125,12 +135,13 @@ minetest.register_tool("mcl_farming:hoe_iron", { _doc_items_longdesc = hoe_longdesc, _doc_items_usagehelp = hoe_usagehelp, inventory_image = "farming_tool_steelhoe.png", - on_place = hoe_on_place_function(251), + on_place = hoe_on_place_function(uses.iron), groups = { tool=1, hoe=1 }, tool_capabilities = { -- 1/3 full_punch_interval = 0.33333333, - damage_groups = { fleshy = 1, } + damage_groups = { fleshy = 1, }, + punch_attack_uses = uses.iron, }, _repair_material = "mcl_core:iron_ingot", }) @@ -164,11 +175,12 @@ minetest.register_tool("mcl_farming:hoe_gold", { _doc_items_longdesc = hoe_longdesc, _doc_items_usagehelp = hoe_usagehelp, inventory_image = "farming_tool_goldhoe.png", - on_place = hoe_on_place_function(33), + on_place = hoe_on_place_function(uses.gold), groups = { tool=1, hoe=1 }, tool_capabilities = { full_punch_interval = 1, - damage_groups = { fleshy = 1, } + damage_groups = { fleshy = 1, }, + punch_attack_uses = uses.gold, }, _repair_material = "mcl_core:gold_ingot", }) @@ -204,11 +216,12 @@ minetest.register_tool("mcl_farming:hoe_diamond", { _doc_items_longdesc = hoe_longdesc, _doc_items_usagehelp = hoe_usagehelp, inventory_image = "farming_tool_diamondhoe.png", - on_place = hoe_on_place_function(1562), + on_place = hoe_on_place_function(uses.diamond), groups = { tool=1, hoe=1 }, tool_capabilities = { full_punch_interval = 0.25, - damage_groups = { fleshy = 1, } + damage_groups = { fleshy = 1, }, + punch_attack_uses = uses.diamond, }, _repair_material = "mcl_core:diamond", }) diff --git a/mods/ITEMS/mcl_tools/init.lua b/mods/ITEMS/mcl_tools/init.lua index bb8f620c..31d091c6 100644 --- a/mods/ITEMS/mcl_tools/init.lua +++ b/mods/ITEMS/mcl_tools/init.lua @@ -87,6 +87,7 @@ minetest.register_tool("mcl_tools:pick_wood", { pickaxey_dig_wood = {times=mcl_autogroup.digtimes.pickaxey_dig_wood, uses=60, maxlevel=0}, }, damage_groups = {fleshy=2}, + punch_attack_uses = 30, }, sound = { breaks = "default_tool_breaks" }, _repair_material = "group:wood", @@ -104,6 +105,7 @@ minetest.register_tool("mcl_tools:pick_stone", { pickaxey_dig_stone = {times=mcl_autogroup.digtimes.pickaxey_dig_stone, uses=132, maxlevel=0}, }, damage_groups = {fleshy=3}, + punch_attack_uses = 66, }, sound = { breaks = "default_tool_breaks" }, _repair_material = "mcl_core:cobble", @@ -121,6 +123,7 @@ minetest.register_tool("mcl_tools:pick_iron", { pickaxey_dig_iron = {times=mcl_autogroup.digtimes.pickaxey_dig_iron , uses=251, maxlevel=0}, }, damage_groups = {fleshy=4}, + punch_attack_uses = 126, }, sound = { breaks = "default_tool_breaks" }, _repair_material = "mcl_core:iron_ingot", @@ -138,6 +141,7 @@ minetest.register_tool("mcl_tools:pick_gold", { pickaxey_dig_gold = {times=mcl_autogroup.digtimes.pickaxey_dig_gold , uses=33, maxlevel=0}, }, damage_groups = {fleshy=2}, + punch_attack_uses = 17, }, sound = { breaks = "default_tool_breaks" }, _repair_material = "mcl_core:gold_ingot", @@ -155,6 +159,7 @@ minetest.register_tool("mcl_tools:pick_diamond", { pickaxey_dig_diamond = {times=mcl_autogroup.digtimes.pickaxey_dig_diamond, uses=1562, maxlevel=0}, }, damage_groups = {fleshy=5}, + punch_attack_uses = 781, }, sound = { breaks = "default_tool_breaks" }, _repair_material = "mcl_core:diamond", @@ -272,6 +277,7 @@ minetest.register_tool("mcl_tools:shovel_wood", { shovely_dig_wood = {times=mcl_autogroup.digtimes.shovely_dig_wood, uses=60, maxlevel=0}, }, damage_groups = {fleshy=2}, + punch_attack_uses = 30, }, on_place = make_grass_path, sound = { breaks = "default_tool_breaks" }, @@ -291,6 +297,7 @@ minetest.register_tool("mcl_tools:shovel_stone", { shovely_dig_stone = {times=mcl_autogroup.digtimes.shovely_dig_stone, uses=132, maxlevel=0}, }, damage_groups = {fleshy=3}, + punch_attack_uses = 66, }, on_place = make_grass_path, sound = { breaks = "default_tool_breaks" }, @@ -310,6 +317,7 @@ minetest.register_tool("mcl_tools:shovel_iron", { shovely_dig_iron = {times=mcl_autogroup.digtimes.shovely_dig_iron, uses=251, maxlevel=0}, }, damage_groups = {fleshy=4}, + punch_attack_uses = 126, }, on_place = make_grass_path, sound = { breaks = "default_tool_breaks" }, @@ -329,6 +337,7 @@ minetest.register_tool("mcl_tools:shovel_gold", { shovely_dig_gold = {times=mcl_autogroup.digtimes.shovely_dig_gold, uses=33, maxlevel=0}, }, damage_groups = {fleshy=2}, + punch_attack_uses = 17, }, on_place = make_grass_path, sound = { breaks = "default_tool_breaks" }, @@ -348,6 +357,7 @@ minetest.register_tool("mcl_tools:shovel_diamond", { shovely_dig_diamond = {times=mcl_autogroup.digtimes.shovely_dig_diamond, uses=1562, maxlevel=0}, }, damage_groups = {fleshy=5}, + punch_attack_uses = 781, }, on_place = make_grass_path, sound = { breaks = "default_tool_breaks" }, @@ -368,6 +378,7 @@ minetest.register_tool("mcl_tools:axe_wood", { axey_dig_wood = {times=mcl_autogroup.digtimes.axey_dig_wood, uses=60, maxlevel=0}, }, damage_groups = {fleshy=7}, + punch_attack_uses = 30, }, sound = { breaks = "default_tool_breaks" }, _repair_material = "group:wood", @@ -384,6 +395,7 @@ minetest.register_tool("mcl_tools:axe_stone", { axey_dig_stone = {times=mcl_autogroup.digtimes.axey_dig_stone, uses=132, maxlevel=0}, }, damage_groups = {fleshy=9}, + punch_attack_uses = 66, }, sound = { breaks = "default_tool_breaks" }, _repair_material = "mcl_core:cobble", @@ -401,6 +413,7 @@ minetest.register_tool("mcl_tools:axe_iron", { axey_dig_iron = {times=mcl_autogroup.digtimes.axey_dig_iron, uses=251, maxlevel=0}, }, damage_groups = {fleshy=9}, + punch_attack_uses = 126, }, sound = { breaks = "default_tool_breaks" }, _repair_material = "mcl_core:iron_ingot", @@ -417,6 +430,7 @@ minetest.register_tool("mcl_tools:axe_gold", { axey_dig_gold= {times=mcl_autogroup.digtimes.axey_dig_gold, uses=33, maxlevel=0}, }, damage_groups = {fleshy=7}, + punch_attack_uses = 17, }, sound = { breaks = "default_tool_breaks" }, _repair_material = "mcl_core:gold_ingot", @@ -433,6 +447,7 @@ minetest.register_tool("mcl_tools:axe_diamond", { axey_dig_diamond = {times=mcl_autogroup.digtimes.axey_dig_diamond, uses=1562, maxlevel=0}, }, damage_groups = {fleshy=9}, + punch_attack_uses = 781, }, sound = { breaks = "default_tool_breaks" }, _repair_material = "mcl_core:diamond", @@ -453,6 +468,7 @@ minetest.register_tool("mcl_tools:sword_wood", { swordy_cobweb_dig = {times=mcl_autogroup.digtimes.swordy_cobweb_dig , uses=60, maxlevel=0}, }, damage_groups = {fleshy=4}, + punch_attack_uses = 60, }, sound = { breaks = "default_tool_breaks" }, _repair_material = "group:wood", @@ -470,6 +486,7 @@ minetest.register_tool("mcl_tools:sword_stone", { swordy_cobweb_dig = {times=mcl_autogroup.digtimes.swordy_cobweb_dig , uses=132, maxlevel=0}, }, damage_groups = {fleshy=5}, + punch_attack_uses = 132, }, sound = { breaks = "default_tool_breaks" }, _repair_material = "mcl_core:cobble", @@ -487,6 +504,7 @@ minetest.register_tool("mcl_tools:sword_iron", { swordy_cobweb_dig = {times=mcl_autogroup.digtimes.swordy_cobweb_dig , uses=251, maxlevel=0}, }, damage_groups = {fleshy=6}, + punch_attack_uses = 251, }, sound = { breaks = "default_tool_breaks" }, _repair_material = "mcl_core:iron_ingot", @@ -504,6 +522,7 @@ minetest.register_tool("mcl_tools:sword_gold", { swordy_cobweb_dig = {times=mcl_autogroup.digtimes.swordy_cobweb_dig, uses=33, maxlevel=0}, }, damage_groups = {fleshy=4}, + punch_attack_uses = 33, }, sound = { breaks = "default_tool_breaks" }, _repair_material = "mcl_core:gold_ingot", @@ -521,6 +540,7 @@ minetest.register_tool("mcl_tools:sword_diamond", { swordy_cobweb_dig = {times=mcl_autogroup.digtimes.swordy_cobweb_dig, uses=1562, maxlevel=0}, }, damage_groups = {fleshy=7}, + punch_attack_uses = 1562, }, sound = { breaks = "default_tool_breaks" }, _repair_material = "mcl_core:diamond",