From bd23bb956a669904e9766f3a545c7f123169cf53 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Thu, 2 Mar 2017 00:25:23 +0100 Subject: [PATCH] Limit mob name length to 80 chars on renaming --- mods/ENTITIES/mobs/api.lua | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mods/ENTITIES/mobs/api.lua b/mods/ENTITIES/mobs/api.lua index 06ccb33bb0..8000e4876d 100644 --- a/mods/ENTITIES/mobs/api.lua +++ b/mods/ENTITIES/mobs/api.lua @@ -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])