Add a creative dig speed setting

This commit is contained in:
Johannes Fritz 2023-01-19 11:30:14 -06:00
parent a1cc24f8d3
commit 66ff8ab8a9
2 changed files with 7 additions and 3 deletions

View file

@ -45,6 +45,7 @@ local node_def = {
-- This is for _mcl_autogroup to know about the survival hand tool capabilites -- This is for _mcl_autogroup to know about the survival hand tool capabilites
mcl_meshhand.survival_hand_tool_caps = node_def.tool_capabilities 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 local creative_hand_range = tonumber(minetest.settings:get("mcl_hand_range_creative")) or 10
if mcl_skins_enabled then if mcl_skins_enabled then
-- Generate a node for every skin -- Generate a node for every skin
@ -57,7 +58,7 @@ if mcl_skins_enabled then
if skin.creative then if skin.creative then
node_def.range = creative_hand_range node_def.range = creative_hand_range
node_def.groups.dig_speed_class = 7 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 end
minetest.register_node("mcl_meshhand:" .. skin.id, node_def) minetest.register_node("mcl_meshhand:" .. skin.id, node_def)
end end
@ -70,7 +71,7 @@ else
node_def = table.copy(node_def) node_def = table.copy(node_def)
node_def.range = creative_hand_range node_def.range = creative_hand_range
node_def.groups.dig_speed_class = 7 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) minetest.register_node("mcl_meshhand:hand_crea", node_def)
end end

View file

@ -76,10 +76,13 @@ mcl_enable_skin_customization (Enable player skin customization) bool true
# Default:4.5 # Default:4.5
mcl_hand_range (Hand range) float 4.5 1 128 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 # Default:10
mcl_hand_range_creative (Creative mode hand range) float 10 1 128 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 # If enabled the hunger mechanic will be active
mcl_enable_hunger (Hunger mechanic) bool true mcl_enable_hunger (Hunger mechanic) bool true