Add listring[] as inventory.shift_click

This commit is contained in:
luk3yx 2018-03-25 11:22:57 +13:00
parent 0561ee99dc
commit 6fdf42e2b7
2 changed files with 8 additions and 2 deletions

View File

@ -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)

View File

@ -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)