From c555d7c60fb0803f846128d523ef9bccff072885 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Tue, 28 Feb 2017 00:14:31 +0100 Subject: [PATCH] Fix nodes not breakable in creative --- mods/CORE/mcl_autogroup/init.lua | 4 ++++ mods/ITEMS/mcl_tools/init.lua | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/mods/CORE/mcl_autogroup/init.lua b/mods/CORE/mcl_autogroup/init.lua index 63743f37fe..63ddec9e5f 100644 --- a/mods/CORE/mcl_autogroup/init.lua +++ b/mods/CORE/mcl_autogroup/init.lua @@ -55,14 +55,17 @@ local divisors = { mcl_autogroup = {} mcl_autogroup.digtimes = {} +mcl_autogroup.creativetimes = {} -- Copy of digtimes, except that all values are 0. Used for creative mode for m=1, #materials do for g=1, #basegroups do mcl_autogroup.digtimes[basegroups[g].."_dig_"..materials[m]] = {} + mcl_autogroup.creativetimes[basegroups[g].."_dig_"..materials[m]] = {} end end for g=1, #minigroups do mcl_autogroup.digtimes[minigroups[g].."_dig"] = {} + mcl_autogroup.creativetimes[minigroups[g].."_dig"] = {} end local overwrite = function() @@ -96,6 +99,7 @@ local overwrite = function() time = math.ceil(time * 20) / 20 end table.insert(mcl_autogroup.digtimes[diggroup], time) + table.insert(mcl_autogroup.creativetimes[diggroup], 0) newgroups[diggroup] = #mcl_autogroup.digtimes[diggroup] return newgroups end diff --git a/mods/ITEMS/mcl_tools/init.lua b/mods/ITEMS/mcl_tools/init.lua index 1accb61b6d..a5a7e80e01 100644 --- a/mods/ITEMS/mcl_tools/init.lua +++ b/mods/ITEMS/mcl_tools/init.lua @@ -18,10 +18,14 @@ -- The hand local groupcaps if minetest.setting_getbool("creative_mode") then + -- Instant breaking in creative mode groupcaps = { creative_breakable = {times={[1]=0}, uses=0}, - } + -- mcl_autogroup provides the creative digging times for all digging groups + for k,v in pairs(mcl_autogroup.creativetimes) do + groupcaps[k] = { times = v, uses = 0 } + end else groupcaps = { handy_dig = {times=mcl_autogroup.digtimes.handy_dig, uses=0},