Limit mob name length to 80 chars on renaming

This commit is contained in:
Wuzzy 2017-03-02 00:25:23 +01:00
parent 01049a52fd
commit bd23bb956a
1 changed files with 7 additions and 1 deletions

View File

@ -3056,8 +3056,14 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
return
end
local mobname
if string.len(fields.name) > 80 then
minetest.chat_send_player(name, "Warning: Your chosen name is very long! It has been shortened to 80 characters.")
mobname = string.sub(fields.name, 1, 80)
end
-- update nametag
mob_obj[name].nametag = fields.name
mob_obj[name].nametag = mobname
update_tag(mob_obj[name])