diff options
author | Wuzzy <almikes@aol.com> | 2016-11-06 02:28:45 +0100 |
---|---|---|
committer | Wuzzy <almikes@aol.com> | 2016-11-06 02:28:45 +0100 |
commit | 8770b7df93e42beb9f717662620e509ca74487f7 (patch) | |
tree | 0e3318643d5cdc4912aadaa177bbc9d460ea2914 /internal.lua | |
parent | 5b9a53bf293ee07885a2c1ef35d809d356dd672d (diff) |
Disable useless main buttons
Diffstat (limited to 'internal.lua')
-rw-r--r-- | internal.lua | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/internal.lua b/internal.lua index 42ab722..f143355 100644 --- a/internal.lua +++ b/internal.lua @@ -107,14 +107,23 @@ function unified_inventory.get_formspec(player, page) end if def.type == "image" then - formspec[n] = "image_button[" - formspec[n+1] = ( ui_peruser.main_button_x + 0.65 * (i - 1) - button_col * 0.65 * 4) - formspec[n+2] = ","..(ui_peruser.main_button_y + button_row * 0.7)..";0.8,0.8;" - formspec[n+3] = minetest.formspec_escape(def.image)..";" - formspec[n+4] = minetest.formspec_escape(def.name)..";]" - formspec[n+5] = "tooltip["..minetest.formspec_escape(def.name) - formspec[n+6] = ";"..(def.tooltip or "").."]" - n = n+7 + if (def.condition == nil or def.condition(player) == true) then + formspec[n] = "image_button[" + formspec[n+1] = ( ui_peruser.main_button_x + 0.65 * (i - 1) - button_col * 0.65 * 4) + formspec[n+2] = ","..(ui_peruser.main_button_y + button_row * 0.7)..";0.8,0.8;" + formspec[n+3] = minetest.formspec_escape(def.image)..";" + formspec[n+4] = minetest.formspec_escape(def.name)..";]" + formspec[n+5] = "tooltip["..minetest.formspec_escape(def.name) + formspec[n+6] = ";"..(def.tooltip or "").."]" + n = n+7 + else + formspec[n] = "image[" + formspec[n+1] = ( ui_peruser.main_button_x + 0.65 * (i - 1) - button_col * 0.65 * 4) + formspec[n+2] = ","..(ui_peruser.main_button_y + button_row * 0.7)..";0.8,0.8;" + formspec[n+3] = minetest.formspec_escape(def.image).."^[colorize:#808080:alpha]" + n = n+4 + + end end end |