0 |
From e85ad205f1041e18639a9310ccdeb3beedf7dbc6 Mon Sep 17 00:00:00 2001 |
1 |
From: Jaidyn Ann <10477760+JadedCtrl@users.noreply.github.com> |
2 |
Date: Thu, 1 Aug 2024 13:51:26 -0500 |
3 |
Subject: [PATCH] Allow a custom message-suffix |
4 |
|
5 |
Via the message_bubles_suffix setting. |
6 |
--- |
7 |
init.lua | 7 ++++--- |
8 |
1 file changed, 4 insertions(+), 3 deletions(-) |
9 |
|
10 |
diff --git a/init.lua b/init.lua |
11 |
index 30ace03..e4acf29 100644 |
12 |
--- a/init.lua |
13 |
+++ b/init.lua |
14 |
@@ -5,6 +5,7 @@ local MSG_BUBBLE_LIFETIME = tonumber(settings:get("message_bubbles_lifetime")) o |
15 |
local MAX_CHARS_PER_LINE = tonumber(settings:get("message_bubbles_char_limit")) or 40 |
16 |
local MAX_NUM_LINES = tonumber(settings:get("message_bubbles_max_num_lines")) or 1 |
17 |
local MSG_BUBBLE_PREFIX = settings:get("message_bubbles_prefix") or "Says: " |
18 |
+local MSG_BUBBLE_SUFFIX = settings:get("message_bubbles_suffix") or "" |
19 |
|
20 |
local cumulativeTime = 0 |
21 |
|
22 |
@@ -30,7 +31,7 @@ local function trim(msg) |
23 |
local line = "" |
24 |
while currLine <= MAX_NUM_LINES do |
25 |
local adjMaxChPerLine = MAX_CHARS_PER_LINE |
26 |
- if currLine == 1 then adjMaxChPerLine = MAX_CHARS_PER_LINE - string.len(MSG_BUBBLE_PREFIX) end |
27 |
+ if currLine == 1 then adjMaxChPerLine = MAX_CHARS_PER_LINE - string.len(MSG_BUBBLE_PREFIX) - string.len(MSG_BUBBLE_SUFFIX) end |
28 |
local space = "" |
29 |
if string.len(line) > 0 then space = " " end |
30 |
local tmp = line..space |
31 |
@@ -64,7 +65,7 @@ minetest.register_on_chat_message(function(name, origMessage) |
32 |
if minetest.get_player_privs(name).shout then |
33 |
local player = minetest.get_player_by_name(name) |
34 |
if not player then return end |
35 |
- local msg = "\n"..MSG_BUBBLE_PREFIX..trim(origMessage) |
36 |
+ local msg = "\n"..MSG_BUBBLE_PREFIX..trim(origMessage)..MSG_BUBBLE_SUFFIX |
37 |
msg = removeEscape(msg) |
38 |
local nametag = player:get_nametag_attributes() |
39 |
local nametagText = nametag.text |
40 |
@@ -120,4 +121,4 @@ minetest.register_globalstep(function(dtime) |
41 |
end |
42 |
end |
43 |
end |
44 |
-end) |
45 |
\ No newline at end of file |
46 |
+end) |
47 |
-- |
48 |
2.45.2 |
49 |
|