mirror of
https://gitea.your-land.de/Sokomine/yl_speak_up.git
synced 2025-07-04 21:18:03 +02:00
always show show-me-your-inventory to owner
This commit is contained in:
parent
b251e27830
commit
4e4ae0da9e
@ -54,7 +54,8 @@ yl_speak_up.input_talk = function(player, formname, fields)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- the player wants to access the inventory of the NPC
|
-- the player wants to access the inventory of the NPC
|
||||||
if(edit_mode and fields.show_inventory) then
|
if((edit_mode and fields.show_inventory)
|
||||||
|
or (fields.show_inventory and yl_speak_up.may_edit_npc(player, n_id))) then
|
||||||
-- the inventory is just an inventory with a back button; come back to this dialog here
|
-- the inventory is just an inventory with a back button; come back to this dialog here
|
||||||
yl_speak_up.show_fs(player, "inventory")
|
yl_speak_up.show_fs(player, "inventory")
|
||||||
return
|
return
|
||||||
@ -661,7 +662,7 @@ yl_speak_up.get_fs_talkdialog = function(player, n_id, d_id, alternate_text, rec
|
|||||||
(edit_mode or dialog.n_dialogs["d_got_item"]), nil, nil, pname_for_old_fs)
|
(edit_mode or dialog.n_dialogs["d_got_item"]), nil, nil, pname_for_old_fs)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local may_edit_npc = yl_speak_up.may_edit_npc(player, n_id)
|
||||||
-- If in edit mode, add new menu entries: "add new options", "end edit mode" and what else is needed.
|
-- If in edit mode, add new menu entries: "add new options", "end edit mode" and what else is needed.
|
||||||
if(edit_mode) then
|
if(edit_mode) then
|
||||||
h = yl_speak_up.add_edit_button_fs_talkdialog(formspec, h,
|
h = yl_speak_up.add_edit_button_fs_talkdialog(formspec, h,
|
||||||
@ -721,14 +722,6 @@ yl_speak_up.get_fs_talkdialog = function(player, n_id, d_id, alternate_text, rec
|
|||||||
"The start dialog automaticly counts as *a* start dialog where buttons for "..
|
"The start dialog automaticly counts as *a* start dialog where buttons for "..
|
||||||
"trade etc. are shown.", nil, pname_for_old_fs)
|
"trade etc. are shown.", nil, pname_for_old_fs)
|
||||||
|
|
||||||
h = yl_speak_up.add_edit_button_fs_talkdialog(formspec, h,
|
|
||||||
"show_inventory",
|
|
||||||
"Access and manage the inventory of the NPC. This is used for adding trade "..
|
|
||||||
"items, getting collected payments and managing quest items.",
|
|
||||||
"Show your inventory (only accessible to owner)!",
|
|
||||||
true, nil, nil, pname_for_old_fs)
|
|
||||||
|
|
||||||
|
|
||||||
-- chat option: Mute/Unmute NPC
|
-- chat option: Mute/Unmute NPC
|
||||||
local obj = yl_speak_up.speak_to[pname].obj
|
local obj = yl_speak_up.speak_to[pname].obj
|
||||||
-- some precautions - someone else might have eliminated the NPC in the meantime
|
-- some precautions - someone else might have eliminated the NPC in the meantime
|
||||||
@ -765,7 +758,7 @@ yl_speak_up.get_fs_talkdialog = function(player, n_id, d_id, alternate_text, rec
|
|||||||
|
|
||||||
-- Offer to enter edit mode if the player has the npc_talk_owner priv AND owns the npc.
|
-- Offer to enter edit mode if the player has the npc_talk_owner priv AND owns the npc.
|
||||||
-- The npc_master priv allows to edit all NPC.
|
-- The npc_master priv allows to edit all NPC.
|
||||||
elseif(yl_speak_up.may_edit_npc(player, n_id)) then
|
elseif(may_edit_npc) then
|
||||||
h = yl_speak_up.add_edit_button_fs_talkdialog(formspec, h,
|
h = yl_speak_up.add_edit_button_fs_talkdialog(formspec, h,
|
||||||
"button_start_edit_mode",
|
"button_start_edit_mode",
|
||||||
"Enters edit mode. In this mode, you can edit the texts the NPC says and the "..
|
"Enters edit mode. In this mode, you can edit the texts the NPC says and the "..
|
||||||
@ -790,6 +783,15 @@ yl_speak_up.get_fs_talkdialog = function(player, n_id, d_id, alternate_text, rec
|
|||||||
"Show a list of trades the NPC has to offer.",
|
"Show a list of trades the NPC has to offer.",
|
||||||
"Let's trade!",
|
"Let's trade!",
|
||||||
(has_trades), nil, nil, pname_for_old_fs)
|
(has_trades), nil, nil, pname_for_old_fs)
|
||||||
|
|
||||||
|
elseif(is_a_start_dialog and may_edit_npc) then
|
||||||
|
-- show the "show your inventory"-button even when not in edit mode
|
||||||
|
h = yl_speak_up.add_edit_button_fs_talkdialog(formspec, h,
|
||||||
|
"show_inventory",
|
||||||
|
"Access and manage the inventory of the NPC. This is used for adding trade "..
|
||||||
|
"items, getting collected payments and managing quest items.",
|
||||||
|
"Show your inventory (only accessible to owner)!",
|
||||||
|
true, nil, nil, pname_for_old_fs)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- we are finished with adding buttons to the bottom of the formspec
|
-- we are finished with adding buttons to the bottom of the formspec
|
||||||
|
Loading…
Reference in New Issue
Block a user