Add minetest.is_creative_enabled

This commit is contained in:
Wuzzy
2020-05-26 02:11:19 +02:00
committed by sfan5
parent 9a64a9fd94
commit 65a6a316d0
5 changed files with 17 additions and 10 deletions

View File

@@ -582,7 +582,7 @@ function core.node_dig(pos, node, digger)
wielded = wdef.after_use(wielded, digger, node, dp) or wielded
else
-- Wear out tool
if not core.settings:get_bool("creative_mode") then
if not core.is_creative_enabled(diggername) then
wielded:add_wear(dp.wear)
if wielded:get_count() == 0 and wdef.sound and wdef.sound.breaks then
core.sound_play(wdef.sound.breaks, {

View File

@@ -164,6 +164,12 @@ function core.record_protection_violation(pos, name)
end
end
-- To be overridden by Creative mods
local creative_mode_cache = core.settings:get_bool("creative_mode")
function core.is_creative_enabled(name)
return creative_mode_cache
end
-- Checks if specified volume intersects a protected volume