summaryrefslogtreecommitdiff
path: root/callbacks.lua
diff options
context:
space:
mode:
authorVanessa Ezekowitz <vanessaezekowitz@gmail.com>2015-10-05 04:24:01 -0400
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>2015-10-05 04:24:01 -0400
commit9fe84789bad32f1e915d4a452347ce4021d87c2d (patch)
tree4e7750653b5eac5a8b0f1ef67c94b63e3fc637d1 /callbacks.lua
parentbabe4380acf1fcd89c3658e72ded9942fbec21bf (diff)
Allow per-user "full" mode when "lite" mode is set as global
default (give the user "ui_full" priv to turn it on). Also, a few whitespace fixes.
Diffstat (limited to 'callbacks.lua')
-rw-r--r--callbacks.lua15
1 files changed, 9 insertions, 6 deletions
diff --git a/callbacks.lua b/callbacks.lua
index c0f9d04..392e855 100644
--- a/callbacks.lua
+++ b/callbacks.lua
@@ -14,7 +14,7 @@ minetest.register_on_joinplayer(function(player)
unified_inventory.players[player_name] = {}
unified_inventory.current_index[player_name] = 1
unified_inventory.filtered_items_list[player_name] =
- unified_inventory.items_list
+ unified_inventory.items_list
unified_inventory.activefilter[player_name] = ""
unified_inventory.active_search_direction[player_name] = "nochange"
unified_inventory.apply_filter(player, "", "nochange")
@@ -23,7 +23,7 @@ minetest.register_on_joinplayer(function(player)
unified_inventory.current_item[player_name] = nil
unified_inventory.current_craft_direction[player_name] = "recipe"
unified_inventory.set_inventory_formspec(player,
- unified_inventory.default)
+ unified_inventory.default)
-- Refill slot
local refill = minetest.create_detached_inventory(player_name.."refill", {
@@ -48,10 +48,13 @@ minetest.register_on_joinplayer(function(player)
end)
minetest.register_on_player_receive_fields(function(player, formname, fields)
+ local player_name = player:get_player_name()
+
+ local ui_peruser,draw_lite_mode = unified_inventory.get_per_player_formspec(player_name)
+
if formname ~= "" then
return
end
- local player_name = player:get_player_name()
-- always take new search text, even if not searching on it yet
if fields.searchbox
@@ -71,11 +74,11 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
-- Inventory page controls
local start = math.floor(
- unified_inventory.current_index[player_name] / unified_inventory.items_per_page + 1)
+ unified_inventory.current_index[player_name] / ui_peruser.items_per_page + 1)
local start_i = start
local pagemax = math.floor(
(#unified_inventory.filtered_items_list[player_name] - 1)
- / (unified_inventory.items_per_page) + 1)
+ / (ui_peruser.items_per_page) + 1)
if fields.start_list then
start_i = 1
@@ -104,7 +107,7 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
if start_i ~= start then
minetest.sound_play("paperflip1",
{to_player=player_name, gain = 1.0})
- unified_inventory.current_index[player_name] = (start_i - 1) * unified_inventory.items_per_page + 1
+ unified_inventory.current_index[player_name] = (start_i - 1) * ui_peruser.items_per_page + 1
unified_inventory.set_inventory_formspec(player,
unified_inventory.current_page[player_name])
end