From 66ff8ab8a9d5ef40d80db197f90cf667b8219fa5 Mon Sep 17 00:00:00 2001 From: Johannes Fritz Date: Thu, 19 Jan 2023 11:30:14 -0600 Subject: [PATCH] Add a creative dig speed setting --- mods/PLAYER/mcl_meshhand/init.lua | 5 +++-- settingtypes.txt | 5 ++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/mods/PLAYER/mcl_meshhand/init.lua b/mods/PLAYER/mcl_meshhand/init.lua index db58888c1..d3fa169ca 100644 --- a/mods/PLAYER/mcl_meshhand/init.lua +++ b/mods/PLAYER/mcl_meshhand/init.lua @@ -45,6 +45,7 @@ local node_def = { -- This is for _mcl_autogroup to know about the survival hand tool capabilites mcl_meshhand.survival_hand_tool_caps = node_def.tool_capabilities +local creative_dig_speed = tonumber(minetest.settings:get("mcl_creative_dig_speed")) or 0.2 local creative_hand_range = tonumber(minetest.settings:get("mcl_hand_range_creative")) or 10 if mcl_skins_enabled then -- Generate a node for every skin @@ -57,7 +58,7 @@ if mcl_skins_enabled then if skin.creative then node_def.range = creative_hand_range node_def.groups.dig_speed_class = 7 - node_def.tool_capabilities.groupcaps.creative_breakable = { times = { 0.1 }, uses = 0 } + node_def.tool_capabilities.groupcaps.creative_breakable = { times = { creative_dig_speed }, uses = 0 } end minetest.register_node("mcl_meshhand:" .. skin.id, node_def) end @@ -70,7 +71,7 @@ else node_def = table.copy(node_def) node_def.range = creative_hand_range node_def.groups.dig_speed_class = 7 - node_def.tool_capabilities.groupcaps.creative_breakable = { times = { 0.1 }, uses = 0 } + node_def.tool_capabilities.groupcaps.creative_breakable = { times = { creative_dig_speed }, uses = 0 } minetest.register_node("mcl_meshhand:hand_crea", node_def) end diff --git a/settingtypes.txt b/settingtypes.txt index f980eeb54..7152dd8e9 100644 --- a/settingtypes.txt +++ b/settingtypes.txt @@ -76,10 +76,13 @@ mcl_enable_skin_customization (Enable player skin customization) bool true # Default:4.5 mcl_hand_range (Hand range) float 4.5 1 128 -# How far the player hand can reach in creative mode (not gamemode-creative) +# How far the player hand can reach in creative mode # Default:10 mcl_hand_range_creative (Creative mode hand range) float 10 1 128 +# Creative mode dig speed in seconds +mcl_creative_dig_speed (Creative mode dig speed) float 0.2 + # If enabled the hunger mechanic will be active mcl_enable_hunger (Hunger mechanic) bool true