From 28402ca6637118e2a86207899d28ffc0634aba26 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Mon, 5 Apr 2021 10:16:56 +0200 Subject: [PATCH 1/2] store tool wield scale in a global var --- mods/CORE/mcl_init/init.lua | 3 +++ mods/ITEMS/mcl_tools/init.lua | 2 +- mods/ITEMS/mcl_tools/mod.conf | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/mods/CORE/mcl_init/init.lua b/mods/CORE/mcl_init/init.lua index 014a30d1e..066e555df 100644 --- a/mods/CORE/mcl_init/init.lua +++ b/mods/CORE/mcl_init/init.lua @@ -21,6 +21,9 @@ mcl_vars.gui_bg_img = "background9[1,1;1,1;mcl_base_textures_background9.png;tru -- Legacy mcl_vars.inventory_header = "" +-- Tool wield size +mcl_vars.tool_wield_scale = { x = 1.8, y = 1.8, z = 1 } + -- Mapgen variables local mg_name = minetest.get_mapgen_setting("mg_name") local minecraft_height_limit = 256 diff --git a/mods/ITEMS/mcl_tools/init.lua b/mods/ITEMS/mcl_tools/init.lua index bc6bed09f..b50782ec4 100644 --- a/mods/ITEMS/mcl_tools/init.lua +++ b/mods/ITEMS/mcl_tools/init.lua @@ -70,7 +70,7 @@ local shovel_use = S("To turn a grass block into a grass path, hold the shovel i local shears_longdesc = S("Shears are tools to shear sheep and to mine a few block types. Shears are a special mining tool and can be used to obtain the original item from grass, leaves and similar blocks that require cutting.") local shears_use = S("To shear sheep or carve faceless pumpkins, use the “place” key on them. Faces can only be carved at the side of faceless pumpkins. Mining works as usual, but the drops are different for a few blocks.") -local wield_scale = { x = 1.8, y = 1.8, z = 1 } +local wield_scale = mcl_vars.tool_wield_scale -- Picks minetest.register_tool("mcl_tools:pick_wood", { diff --git a/mods/ITEMS/mcl_tools/mod.conf b/mods/ITEMS/mcl_tools/mod.conf index f40547c26..d2d93197b 100644 --- a/mods/ITEMS/mcl_tools/mod.conf +++ b/mods/ITEMS/mcl_tools/mod.conf @@ -1,2 +1,2 @@ name = mcl_tools -depends = mcl_sounds +depends = mcl_sounds, mcl_init From 339e3e2792972f2b0c120e20326b714f4b15d801 Mon Sep 17 00:00:00 2001 From: AFCMS Date: Mon, 5 Apr 2021 14:32:48 +0200 Subject: [PATCH 2/2] fix some tools not using right var --- mods/ITEMS/mcl_bows/bow.lua | 4 ++-- mods/ITEMS/mcl_bows/mod.conf | 2 +- mods/ITEMS/mcl_farming/hoes.lua | 10 +++++----- mods/ITEMS/mcl_farming/mod.conf | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/mods/ITEMS/mcl_bows/bow.lua b/mods/ITEMS/mcl_bows/bow.lua index 87820071d..45912384e 100644 --- a/mods/ITEMS/mcl_bows/bow.lua +++ b/mods/ITEMS/mcl_bows/bow.lua @@ -133,7 +133,7 @@ S("The speed and damage of the arrow increases the longer you charge. The regula _doc_items_usagehelp = S("To use the bow, you first need to have at least one arrow anywhere in your inventory (unless in Creative Mode). Hold down the right mouse button to charge, release to shoot."), _doc_items_durability = BOW_DURABILITY, inventory_image = "mcl_bows_bow.png", - wield_scale = { x = 1.8, y = 1.8, z = 1 }, + wield_scale = mcl_vars.tool_wield_scale, stack_max = 1, range = 4, -- Trick to disable digging as well @@ -198,7 +198,7 @@ for level=0, 2 do description = S("Bow"), _doc_items_create_entry = false, inventory_image = "mcl_bows_bow_"..level..".png", - wield_scale = { x = 1.8, y = 1.8, z = 1 }, + wield_scale = mcl_vars.tool_wield_scale, stack_max = 1, range = 0, -- Pointing range to 0 to prevent punching with bow :D groups = {not_in_creative_inventory=1, not_in_craft_guide=1, bow=1, enchantability=1}, diff --git a/mods/ITEMS/mcl_bows/mod.conf b/mods/ITEMS/mcl_bows/mod.conf index cfb423474..79ae42436 100644 --- a/mods/ITEMS/mcl_bows/mod.conf +++ b/mods/ITEMS/mcl_bows/mod.conf @@ -1,6 +1,6 @@ name = mcl_bows author = Arcelmi description = This mod adds bows and arrows for MineClone 2. -depends = controls, mcl_particles, mcl_enchanting +depends = controls, mcl_particles, mcl_enchanting, mcl_init optional_depends = awards, mcl_achievements, mcl_core, mcl_mobitems, playerphysics, doc, doc_identifier, mesecons_button diff --git a/mods/ITEMS/mcl_farming/hoes.lua b/mods/ITEMS/mcl_farming/hoes.lua index a45b382ed..db470b999 100644 --- a/mods/ITEMS/mcl_farming/hoes.lua +++ b/mods/ITEMS/mcl_farming/hoes.lua @@ -68,7 +68,7 @@ minetest.register_tool("mcl_farming:hoe_wood", { _doc_items_usagehelp = hoe_usagehelp, _doc_items_hidden = false, inventory_image = "farming_tool_woodhoe.png", - wield_scale = { x = 1.8, y = 1.8, z = 1 }, + wield_scale = mcl_vars.tool_wield_scale, on_place = hoe_on_place_function(uses.wood), groups = { tool=1, hoe=1, enchantability=15 }, tool_capabilities = { @@ -111,7 +111,7 @@ minetest.register_tool("mcl_farming:hoe_stone", { _doc_items_longdesc = hoe_longdesc, _doc_items_usagehelp = hoe_usagehelp, inventory_image = "farming_tool_stonehoe.png", - wield_scale = { x = 1.8, y = 1.8, z = 1 }, + wield_scale = mcl_vars.tool_wield_scale, on_place = hoe_on_place_function(uses.stone), groups = { tool=1, hoe=1, enchantability=5 }, tool_capabilities = { @@ -149,7 +149,7 @@ minetest.register_tool("mcl_farming:hoe_iron", { _doc_items_longdesc = hoe_longdesc, _doc_items_usagehelp = hoe_usagehelp, inventory_image = "farming_tool_steelhoe.png", - wield_scale = { x = 1.8, y = 1.8, z = 1 }, + wield_scale = mcl_vars.tool_wield_scale, on_place = hoe_on_place_function(uses.iron), groups = { tool=1, hoe=1, enchantability=14 }, tool_capabilities = { @@ -195,7 +195,7 @@ minetest.register_tool("mcl_farming:hoe_gold", { _doc_items_longdesc = hoe_longdesc, _doc_items_usagehelp = hoe_usagehelp, inventory_image = "farming_tool_goldhoe.png", - wield_scale = { x = 1.8, y = 1.8, z = 1 }, + wield_scale = mcl_vars.tool_wield_scale, on_place = hoe_on_place_function(uses.gold), groups = { tool=1, hoe=1, enchantability=22 }, tool_capabilities = { @@ -242,7 +242,7 @@ minetest.register_tool("mcl_farming:hoe_diamond", { _doc_items_longdesc = hoe_longdesc, _doc_items_usagehelp = hoe_usagehelp, inventory_image = "farming_tool_diamondhoe.png", - wield_scale = { x = 1.8, y = 1.8, z = 1 }, + wield_scale = mcl_vars.tool_wield_scale, on_place = hoe_on_place_function(uses.diamond), groups = { tool=1, hoe=1, enchantability=10 }, tool_capabilities = { diff --git a/mods/ITEMS/mcl_farming/mod.conf b/mods/ITEMS/mcl_farming/mod.conf index 9ab36c39f..fe4bc1564 100644 --- a/mods/ITEMS/mcl_farming/mod.conf +++ b/mods/ITEMS/mcl_farming/mod.conf @@ -1,3 +1,3 @@ name = mcl_farming -depends = mcl_core, mcl_sounds, mcl_wool, mcl_torches, mcl_weather, mobs_mc, mcl_colors +depends = mcl_core, mcl_sounds, mcl_wool, mcl_torches, mcl_weather, mobs_mc, mcl_colors, mcl_init optional_depends = mcl_armor, doc