allow to set prefix and color for chat_all message

This commit is contained in:
Sokomine 2021-08-01 20:31:05 +02:00
parent 420452e4ff
commit eb7d1701a1
2 changed files with 10 additions and 1 deletions

View File

@ -60,3 +60,10 @@ yl_speak_up.blacklist_effect_on_block_right_click = {}
-- If some items are for some reasons not at all acceptable as quest items,
-- blacklist them here. The data structure is the same as for the tables above.
yl_speak_up.blacklist_action_quest_item = {}
-- NPC can send a message to all players as an effect;
-- this text will be put in front of this message so that you and your players
-- know that it originated from an NPC (just make sure this returns a string)
yl_speak_up.chat_all_prefix = minetest.colorize("#0000FF", "[NPC] ")
-- the NPC will use this color when sending a chat message
yl_speak_up.chat_all_color = "#AAAAFF"

View File

@ -747,7 +747,9 @@ yl_speak_up.execute_effect = function(player, n_id, o_id, r)
local text = r.r_value
-- replace $NPC_NAME$, $OWNER_NAME$, $PLAYER_NAME$ etc.
text = yl_speak_up.replace_vars_in_text(text, dialog, pname)
minetest.chat_send_all(text)
minetest.chat_send_all(
yl_speak_up.chat_all_prefix..
minetest.colorize(yl_speak_up.chat_all_color, text))
-- sending a chat message always counts as successful
return true
-- "Call custom functions that are supposed to be overridden by the server.", -- 11