forked from Sokomine/yl_speak_up
added priv npc_talk_admin for handling generic npc and properties starting with server*
This commit is contained in:
parent
368ec72b29
commit
9d8bff11b2
@ -157,6 +157,12 @@ hint: The command `/npc_talk_debug <npc_id>` allows you to get debug
|
||||
help others with their NPC configuration and/or support
|
||||
NPCs owned by the server.
|
||||
|
||||
`npc_talk_admin` Generic maintenance of NPC. Necessary for the command
|
||||
`npc_talk_generic` - add or remove an NPC from the list of
|
||||
generic dialog providers
|
||||
Also allows to set and change NPC properties starting with
|
||||
the prefix "server".
|
||||
|
||||
`npc_master` allows players to edit *any* NPC supported by this mod.
|
||||
*Does* include usage of the staffs.
|
||||
This is very powerful and allows to enter and execute lua
|
||||
@ -165,8 +171,7 @@ hint: The command `/npc_talk_debug <npc_id>` allows you to get debug
|
||||
|
||||
`privs` Necessary for the commands
|
||||
`npc_talk_privs` - grant NPC privs like e.g. execute lua
|
||||
`npc_talk_generic` - add or remove an NPC from the list of
|
||||
generic dialog providers
|
||||
`npc_talk_reload` - reload code of this mod
|
||||
|
||||
NPC can have privs as well. The NPC...
|
||||
|
||||
|
||||
@ -89,9 +89,9 @@ yl_speak_up.set_npc_property = function(pname, property_name, property_value, re
|
||||
-- players with the npc_master priv
|
||||
if(string.sub(property_name, 1, 6) == "server") then
|
||||
if(not(reason) or reason ~= "manually" or not(pname)
|
||||
or not(minetest.check_player_privs(pname, {npc_master=true}))) then
|
||||
or not(minetest.check_player_privs(pname, {npc_talk_admin=true}))) then
|
||||
return "Properties starting with \"server\" can only be changed by players "..
|
||||
"who have the \"npc_master\" priv."
|
||||
"who have the \"npc_talk_admin\" priv."
|
||||
end
|
||||
end
|
||||
-- store it
|
||||
@ -184,6 +184,10 @@ yl_speak_up.get_fs_properties = function(pname, selected)
|
||||
elseif(string.sub(property_data.prop_names[selected], 1, 5) == "self."
|
||||
and not(yl_speak_up.custom_property_handler[property_data.prop_names[selected]])) then
|
||||
add_selected = "label[3.5,6.5;Properties of the type \"self.\" usually cannot be modified.]"
|
||||
elseif(string.sub(property_data.prop_names[selected], 1, 6) == "server"
|
||||
and not(minetest.check_player_privs(pname, {npc_talk_admin=true}))) then
|
||||
add_selected = "label[3.5,6.5;Properties starting with \"server\" can only be "..
|
||||
"changed by players\nwho have the \"npc_talk_admin\" priv."
|
||||
else
|
||||
local name = property_data.prop_names[selected]
|
||||
local val = minetest.formspec_escape(property_data.properties[name])
|
||||
@ -210,7 +214,8 @@ yl_speak_up.get_fs_properties = function(pname, selected)
|
||||
"label[2.0,4.5;"..
|
||||
"Properties are important for NPC that want to make use of generic dialogs.\n"..
|
||||
"Properties can be used to determine which generic dialog(s) shall apply to\n"..
|
||||
"this particular NPC and how they shall be configured.]"..
|
||||
"this particular NPC and how they shall be configured. You need the\n"..
|
||||
"\"npc_talk_admin\" priv to edit properties starting with the text \"server\".]"..
|
||||
"button[5.0,7.8;2.0,0.9;back;Back]"..
|
||||
add_selected
|
||||
end
|
||||
|
||||
@ -37,6 +37,13 @@ local npc_talk_master_priv_definition = {
|
||||
minetest.register_privilege("npc_talk_master", npc_talk_master_priv_definition)
|
||||
|
||||
|
||||
local npc_talk_admin_priv_definition = {
|
||||
description="Can do maintenance of NPCs (adding generic, adding server_ properties)",
|
||||
give_to_singleplayer = false,
|
||||
give_to_admin = true,
|
||||
}
|
||||
minetest.register_privilege("npc_talk_admin", npc_talk_admin_priv_definition)
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
-- players joining or leaving
|
||||
-----------------------------------------------------------------------------
|
||||
@ -81,7 +88,7 @@ end)
|
||||
minetest.register_chatcommand( 'npc_talk_generic', {
|
||||
description = "Lists, add or removes the dialogs of NPC <n_id> as generic dialogs.\n"..
|
||||
"Call: [list|add|remove|reload] [<n_id>]",
|
||||
privs = {privs = true},
|
||||
privs = {npc_talk_admin = true},
|
||||
func = function(pname, param)
|
||||
return yl_speak_up.command_npc_talk_generic(pname, param)
|
||||
end
|
||||
|
||||
Loading…
Reference in New Issue
Block a user