Creative: Add 'creative' privilege for survival servers
authortenplus1 <tenplus1@users.noreply.github.com>
Wed, 1 Feb 2017 19:07:30 +0000 (19:07 +0000)
committerparamat <mat.gregory@virginmedia.com>
Wed, 14 Jun 2017 19:47:11 +0000 (20:47 +0100)
This adds a 'creative' privilege to survival servers which OPs can bestow
on admin or competent builders to give access to the creative inventory.

mods/creative/init.lua

index 51d6f792e543bcc343248f521ac72b68a4714044..7b842eda65047ede361e7efc9de1108889911e49 100644 (file)
@@ -1,9 +1,15 @@
 creative = {}
 
+minetest.register_privilege("creative", {
+       description = "Allow player to use creative inventory",
+       give_to_singleplayer = false
+})
+
 local creative_mode_cache = minetest.settings:get_bool("creative_mode")
 
 function creative.is_enabled_for(name)
-       return creative_mode_cache
+       return creative_mode_cache or
+               minetest.check_player_privs(name, {creative = true})
 end
 
 dofile(minetest.get_modpath("creative") .. "/inventory.lua")