forked from your-land-mirror/yl_speak_up
added yl_speak_up.fs_your_inventory_select_item to avoid repetition
This commit is contained in:
parent
6f127bd3b4
commit
e33f713f54
@ -73,6 +73,21 @@ minetest.register_chatcommand( 'npc_talk_debug', {
|
||||
});
|
||||
|
||||
|
||||
-- helper function; get a formspec with the inventory of the player (for selecting items)
|
||||
yl_speak_up.fs_your_inventory_select_item = function(pname, data)
|
||||
return "label[0.2,4.2;Name of the item(stack):]"..
|
||||
"field[4.0,4.0;16.0,0.6;inv_stack_name;;"..(data.inv_stack_name or "").."]"..
|
||||
"tooltip[inv_stack_name;Enter name of the block and amount.\n"..
|
||||
"Example: \"default:apple 3\" for three apples,\n"..
|
||||
" \"farming:bread\" for a bread.]"..
|
||||
"label[0.2,5.7;Or put the item in here\nand click on \"Update\":]"..
|
||||
"button[5.5,5.5;1.5,0.9;store_item_name;Update]"..
|
||||
"list[detached:yl_speak_up_player_"..pname..";npc_wants;4.0,5.5;1,1;]"..
|
||||
"label[8,4.9;Your inventory:]"..
|
||||
"list[current_player;main;8,5.3;8,4;]"
|
||||
end
|
||||
|
||||
|
||||
-- helper function: get the names of the inventory lists of the node at position
|
||||
-- pos on the map and return the index of search_for_list_name in that index
|
||||
yl_speak_up.get_node_inv_lists = function(pos, search_for_list_name)
|
||||
@ -1731,16 +1746,7 @@ yl_speak_up.get_fs_edit_option_precondition_inv = function(
|
||||
end
|
||||
return formspec..
|
||||
intro..
|
||||
"label[0.2,4.2;Name of the item(stack):]"..
|
||||
"field[4.0,4.0;16.0,0.6;inv_stack_name;;"..(data.inv_stack_name or "").."]"..
|
||||
"tooltip[inv_stack_name;Enter name of the block and amount.\n"..
|
||||
"Example: \"default:apple 3\" for three apples,\n"..
|
||||
" \"farming:bread\" for a bread.]"..
|
||||
"label[0.2,5.7;Or put the item in here\nand click on \"Store\":]"..
|
||||
"button[5.5,5.5;1.5,0.9;store_item_name;Store]"..
|
||||
"list[detached:yl_speak_up_player_"..pname..";npc_wants;4.0,5.5;1,1;]"..
|
||||
"label[8,4.9;Your inventory:]"..
|
||||
"list[current_player;main;8,5.3;8,4;]"..
|
||||
yl_speak_up.fs_your_inventory_select_item(pname, data)..
|
||||
block_selection..
|
||||
save_button
|
||||
end
|
||||
@ -1763,16 +1769,7 @@ yl_speak_up.get_fs_edit_option_effect_give_item_or_take_item = function(
|
||||
"label[0.2,3.0;"..text.."]"..
|
||||
"label[0.2,3.5;Note: You can *save* this effect only if you have the "..
|
||||
"\"npc_master\" priv!]"..
|
||||
"label[0.2,4.2;Name of the item(stack):]"..
|
||||
"field[4.0,4.0;16.0,0.6;inv_stack_name;;"..(data.inv_stack_name or "").."]"..
|
||||
"tooltip[inv_stack_name;Enter name of the block and amount.\n"..
|
||||
"Example: \"default:apple 3\" for three apples,\n"..
|
||||
" \"farming:bread\" for a bread.]"..
|
||||
"label[0.2,5.7;Or put the item in here\nand click on \"Store\":]"..
|
||||
"button[5.5,5.5;1.5,0.9;store_item_name;Store]"..
|
||||
"list[detached:yl_speak_up_player_"..pname..";npc_wants;4.0,5.5;1,1;]"..
|
||||
"label[8,4.9;Your inventory:]"..
|
||||
"list[current_player;main;8,5.3;8,4;]"..
|
||||
yl_speak_up.fs_your_inventory_select_item(pname, data)..
|
||||
save_button
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user