tell that the npc needs privs as well for some actions

This commit is contained in:
Sokomine 2022-04-17 19:42:42 +02:00
parent e04bc0c8d9
commit 8d65f22bea

View File

@ -1850,14 +1850,21 @@ yl_speak_up.get_fs_edit_option_effect_give_item_or_take_item = function(
end
local text = "The following item shall be created out of thin air and added to the "..
"player's inventory:"
local priv_name = "effect_give_item"
if(data.what == 10) then
text = "The following item shall be removed from the player's inventory and "..
"be destroyed:"
priv_name = "effect_take_item"
end
return formspec..
"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,8.0;"..
"And in order to be able to execute it, this NPC\n"..
"needs the \""..tostring(priv_name).."\" priv.\n\t"..
"Type \"/npc_talk_privs grant "..tostring(yl_speak_up.speak_to[pname].n_id)..
" "..tostring(priv_name).."\"\nin order to grant this.]"..
yl_speak_up.fs_your_inventory_select_item(pname, data)..
save_button
end
@ -1879,7 +1886,11 @@ yl_speak_up.get_fs_edit_option_effect_move = function(
return formspec..
"label[0.2,3.0;Move the player to this position:]"..
"label[0.2,3.5;Note: You can *save* this effect only if you have the "..
"\"npc_master\" priv!]"..
"\"npc_master\" priv!\n"..
"And in order to be able to execute it, this NPC needs the \""..
"effect_move_player\" priv.\n\t"..
"Type \"/npc_talk_privs grant "..tostring(yl_speak_up.speak_to[pname].n_id)..
" effect_move_player\" in order to grant this.]"..
"label[0.2,5.3;X:]"..
"label[3.7,5.3;Y:]"..
"label[7.2,5.3;Z:]"..
@ -1898,11 +1909,19 @@ yl_speak_up.get_fs_edit_option_p_and_e_function = function(
data.lua_code = e[ id_prefix.."value" ]
end
end
local priv_name = "precon_exec_lua"
if(id_prefix == "_r") then
priv_name = "effect_exec_lua"
end
return formspec..
"label[0.2,3.0;Execute the following Lua code (ought to return true or false):]"..
"label[0.2,3.5;Note: You can *save* this effect only if you have the "..
"\"npc_master\" priv!]"..
"textarea[0.2,4.5;20,4.0;lua_code;;"..
"\"npc_master\" priv!\n"..
"And in order to be able to execute it, this NPC needs the \""..
tostring(priv_name).."\" priv.\n\t"..
"Type \"/npc_talk_privs grant "..tostring(yl_speak_up.speak_to[pname].n_id)..
" "..tostring(priv_name).."\" in order to grant this.]"..
"textarea[0.2,5.0;20,4.0;lua_code;;"..
minetest.formspec_escape(tostring(data.lua_code)).."]"..
save_button
end