From 4d9630d8b008e4a078e3197e1c5dba56fc96cfce Mon Sep 17 00:00:00 2001 From: mckaygerhard Date: Wed, 14 Jun 2023 11:48:58 -0400 Subject: [PATCH] fix privilege definition on older engines --- init.lua | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) diff --git a/init.lua b/init.lua index 77379b5..eea113c 100644 --- a/init.lua +++ b/init.lua @@ -1,14 +1,27 @@ creative = {} -minetest.register_privilege("creative", { - description = "Allow player to use creative inventory", - give_to_singleplayer = false, - give_to_admin = false - on_grant = update_sfinv, - on_revoke = update_sfinv, -}) - local is_53 = minetest.has_feature("object_step_has_moveresult") +local is_50 = minetest.has_feature("object_use_texture_alpha") + +local privs_description = "Allow player to use creative inventory" +local privs_definition = {} + +if is_50 then + privs_definition = { + description = privs_description, + give_to_singleplayer = false, + give_to_admin = false, + on_grant = update_sfinv, + on_revoke = update_sfinv + } +else + privs_definition = { + description = privs_description, + give_to_singleplayer = false + } +end + +minetest.register_privilege("creative", privs_definition) local creative_mode_cache = minetest.settings:get_bool("creative_mode")