24 lines
765 B
Lua
24 lines
765 B
Lua
local S = minetest.get_translator("playerfactions_ext")
|
|
|
|
local chat_line_length_threshold = tonumber(minetest.settings:get("player_factions.chat_line_max_length") or "100")
|
|
|
|
playerfactions_ext.summarize_iteration = function (names_by_outcome)
|
|
local summary = S("Effect on players:").."\n"
|
|
for outcome, names_list in pairs(names_by_outcome) do
|
|
local line = outcome.." ("..tostring(#names_list).."):"
|
|
local omitted_players = 0
|
|
for _, name in ipairs(names_list) do
|
|
if string.len(line) < chat_line_length_threshold then
|
|
line = line.." "..name
|
|
else
|
|
omitted_players = omitted_players + 1
|
|
end
|
|
end
|
|
if omitted_players > 0 then
|
|
line = line.." "..S("and @1 more.",omitted_players)
|
|
end
|
|
summary = summary..line.."\n"
|
|
end
|
|
return summary
|
|
end
|