mirror of
https://gitea.your-land.de/Sokomine/yl_speak_up.git
synced 2025-06-24 08:08:02 +02:00
player names are tabu as NPC names
This commit is contained in:
parent
48482ce23f
commit
2ecab8554e
@ -28,12 +28,20 @@ yl_speak_up.input_fs_initial_config = function(player, formname, fields)
|
||||
end
|
||||
|
||||
local error_msg = nil
|
||||
-- remove leading and tailing spaces from the potential new NPC name in order to avoid
|
||||
-- confusing names where a player's name (or that of another NPC) is beginning/ending
|
||||
-- with blanks
|
||||
if(fields.n_npc) then
|
||||
fields.n_npc = fields.n_npc:match("^%s*(.-)%s*$")
|
||||
end
|
||||
-- the player is trying to save the initial configuration
|
||||
-- is the player allowed to initialize this npc?
|
||||
if(not(yl_speak_up.may_edit_npc(player, n_id))) then
|
||||
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
|
||||
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!"
|
||||
-- sensible length limit
|
||||
|
Loading…
Reference in New Issue
Block a user