forked from Sokomine/yl_speak_up
players with npc_talk_master priv can assign names to npc that are already taken by players
This commit is contained in:
parent
bd67fa2ea7
commit
e94d879b2a
@ -51,7 +51,8 @@ yl_speak_up.input_fs_initial_config = function(player, formname, fields)
|
||||
error_msg = "You are not allowed to edit this NPC."
|
||||
elseif(not(fields.n_npc) or string.len(fields.n_npc) < 2) then
|
||||
error_msg = "The name of your NPC needs to be\nat least two characters long."
|
||||
elseif(minetest.check_player_privs(fields.n_npc, {interact=true})) then
|
||||
elseif(minetest.check_player_privs(fields.n_npc, {interact=true})
|
||||
and not(minetest.check_player_privs(player, {npc_talk_master=true}))) then
|
||||
error_msg = "You cannot name your NPC\nafter an existing player."
|
||||
elseif(not(fields.n_description) or string.len(fields.n_description) < 2) then
|
||||
error_msg = "Please provide a description of your NPC!"
|
||||
@ -124,6 +125,11 @@ yl_speak_up.input_fs_initial_config = function(player, formname, fields)
|
||||
"button[2,1.5;1,0.9;back_from_error_msg;Back]"})
|
||||
return
|
||||
end
|
||||
-- warn players with npc_talk_master priv if the name of an npc is used by a player already
|
||||
if(minetest.check_player_privs(fields.n_npc, {interact=true})) then
|
||||
minetest.chat_send_player(pname, "WARNING: A player named \'"..tostring(fields.n_npc)..
|
||||
"\' exists. This NPC got assigned the same name!")
|
||||
end
|
||||
|
||||
local d_id = yl_speak_up.speak_to[pname].d_id
|
||||
local count = 0
|
||||
|
Loading…
Reference in New Issue
Block a user