From 6fdf42e2b7541345b08d2e36c77657af67e2c199 Mon Sep 17 00:00:00 2001 From: luk3yx Date: Sun, 25 Mar 2018 11:22:57 +1300 Subject: [PATCH] Add listring[] as inventory.shift_click --- extras.lua | 2 ++ objects.lua | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/extras.lua b/extras.lua index 7076432..0264106 100644 --- a/extras.lua +++ b/extras.lua @@ -19,6 +19,7 @@ formspeclib.register_object('formspeclib:player_inventory', function(obj, safe_m height = 1, location = 'current_player', name = 'main', + shift_click = true, }, { type = 'inventory', @@ -46,6 +47,7 @@ formspeclib.register_object('formspeclib:node_inventory', function(obj, safe_mod height = obj.height or 4, location = 'context', name = obj.name or 'main', + shift_click = true, }} end) diff --git a/objects.lua b/objects.lua index bb4c22d..5922a21 100644 --- a/objects.lua +++ b/objects.lua @@ -218,7 +218,7 @@ end) -- -- An inventory list -- --- Parameters: location(?), name(?), x, y, width, height, start_at(?) +-- Parameters: location(?), name(?), x, y, width, height, start_at(?), shift_click(?) -- formspeclib.register_object('inventory', function(obj, safe_mode) if not obj.x or not obj.y or not obj.width or not obj.height then @@ -235,6 +235,10 @@ formspeclib.register_object('inventory', function(obj, safe_mode) -- You are not allowed to use other locations in safe mode. return false end + local extra = '' + if shift_click then + extra = 'listring[' .. location .. ';' .. name .. ']' + end return 'list[' .. location .. ';' .. name .. ';' .. x .. ',' .. y .. ';' .. - w .. ',' .. h .. ';' .. start .. ']' + w .. ',' .. h .. ';' .. start .. ']' .. extra end)