mirror of
https://github.com/luanti-org/luanti.git
synced 2025-09-15 18:57:08 +00:00
Add minetest.is_creative_enabled
This commit is contained in:
parent
9a64a9fd94
commit
65a6a316d0
5 changed files with 17 additions and 10 deletions
|
@ -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, {
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue