mirror of
https://git.minetest.land/Mineclonia/Mineclonia.git
synced 2024-11-23 22:35:11 +00:00
strip newlines from tools in death messages
Players naming their tools with newlines can mess up chat with death messages. This commit strips out newlines (\r and \n ) in the tool name for death messages.
This commit is contained in:
parent
c08f9850f6
commit
5252952555
1 changed files with 4 additions and 4 deletions
|
@ -3,11 +3,11 @@ local N = function(s) return s end
|
|||
|
||||
local function get_tool_name(item)
|
||||
local name = item:get_meta():get_string("name")
|
||||
if name ~= "" then
|
||||
return name
|
||||
end
|
||||
if name == "" then
|
||||
local def = item:get_definition()
|
||||
return def._tt_original_description or def.description
|
||||
name=def._tt_original_description or def.description
|
||||
end
|
||||
return name:gsub("[\r\n]"," ")
|
||||
end
|
||||
|
||||
mcl_death_messages = {}
|
||||
|
|
Loading…
Reference in a new issue