1
0
Fork 0

Fix nodes not breakable in creative

This commit is contained in:
Wuzzy 2017-02-28 00:14:31 +01:00
parent bf2dca21ce
commit c555d7c60f
2 changed files with 9 additions and 1 deletions

View File

@ -55,14 +55,17 @@ local divisors = {
mcl_autogroup = {} mcl_autogroup = {}
mcl_autogroup.digtimes = {} 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 m=1, #materials do
for g=1, #basegroups do for g=1, #basegroups do
mcl_autogroup.digtimes[basegroups[g].."_dig_"..materials[m]] = {} mcl_autogroup.digtimes[basegroups[g].."_dig_"..materials[m]] = {}
mcl_autogroup.creativetimes[basegroups[g].."_dig_"..materials[m]] = {}
end end
end end
for g=1, #minigroups do for g=1, #minigroups do
mcl_autogroup.digtimes[minigroups[g].."_dig"] = {} mcl_autogroup.digtimes[minigroups[g].."_dig"] = {}
mcl_autogroup.creativetimes[minigroups[g].."_dig"] = {}
end end
local overwrite = function() local overwrite = function()
@ -96,6 +99,7 @@ local overwrite = function()
time = math.ceil(time * 20) / 20 time = math.ceil(time * 20) / 20
end end
table.insert(mcl_autogroup.digtimes[diggroup], time) table.insert(mcl_autogroup.digtimes[diggroup], time)
table.insert(mcl_autogroup.creativetimes[diggroup], 0)
newgroups[diggroup] = #mcl_autogroup.digtimes[diggroup] newgroups[diggroup] = #mcl_autogroup.digtimes[diggroup]
return newgroups return newgroups
end end

View File

@ -18,10 +18,14 @@
-- The hand -- The hand
local groupcaps local groupcaps
if minetest.setting_getbool("creative_mode") then if minetest.setting_getbool("creative_mode") then
-- Instant breaking in creative mode
groupcaps = { groupcaps = {
creative_breakable = {times={[1]=0}, uses=0}, 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 else
groupcaps = { groupcaps = {
handy_dig = {times=mcl_autogroup.digtimes.handy_dig, uses=0}, handy_dig = {times=mcl_autogroup.digtimes.handy_dig, uses=0},