1
0
mirror of https://github.com/Earu/EasyChat.git synced 2025-03-04 03:13:20 -05:00

new cvar to only display local messages, flash window if you get indicated

This commit is contained in:
Earu 2021-05-09 12:12:50 +02:00
parent 519d3a05ff
commit 7a33a6b6bb
3 changed files with 10 additions and 0 deletions

View File

@ -21,6 +21,7 @@ local EC_PLAYER_PASTEL = get_cvar("easychat_pastel")
-- misc
local EC_SECONDARY = get_cvar("easychat_secondary_mode")
local EC_ALWAYS_LOCAL = get_cvar("easychat_always_local")
local EC_ONLY_LOCAL = get_cvar("easychat_only_local")
local EC_LOCAL_MSG_DIST = get_cvar("easychat_local_msg_distance")
local EC_TICK_SOUND = get_cvar("easychat_tick_sound")
local EC_USE_ME = get_cvar("easychat_use_me")
@ -78,6 +79,7 @@ local function create_default_settings()
settings:AddConvarSettingsSet(category_name, {
[EC_ALWAYS_LOCAL] = "Always talk in local mode by default",
[EC_ONLY_LOCAL] = "Only receive local messages"
[EC_LINKS_CLIPBOARD] = "Automatically copy links to your clipboard",
[EC_TEAMS] = "Display teams",
[EC_TEAMS_COLOR] = "Color the team tags",

View File

@ -560,6 +560,7 @@ if CLIENT then
-- misc
local EC_SECONDARY = CreateConVar("easychat_secondary_mode", "team", FCVAR_ARCHIVE, "Opens the chat in the selected mode with the secondary chat bind")
local EC_ALWAYS_LOCAL = CreateConVar("easychat_always_local", "0", FCVAR_ARCHIVE, "Should we always type in local chat by default")
local EC_ONLY_LOCAL = CreateConVar("easychat_only_local", "0", FCVAR_ARCHIVE, "Only receive local messages")
local EC_LOCAL_MSG_DIST = CreateConVar("easychat_local_msg_distance", "300", {FCVAR_ARCHIVE, FCVAR_USERINFO}, "Set the maximum distance for users to receive local messages", 150, 1000)
local EC_TICK_SOUND = CreateConVar("easychat_tick_sound", "0", FCVAR_ARCHIVE, "Should a tick sound be played on new messages or not")
local EC_USE_ME = CreateConVar("easychat_use_me", "0", FCVAR_ARCHIVE, 'Should the chat display your name or "me"')
@ -3103,6 +3104,8 @@ if CLIENT then
is_team = false
end
if EC_ONLY_LOCAL:GetBool() and not is_local then return end
local source_lang, target_lang =
EC_TRANSLATE_INC_SRC_LANG:GetString(),
EC_TRANSLATE_INC_TARGET_LANG:GetString()
@ -3197,6 +3200,7 @@ if CLIENT then
-- this is for the best
function GAMEMODE:OnPlayerChat(ply, msg, is_team, is_dead, is_local)
if EasyChat.IsBlockedPlayer(ply) then return true end
if EC_ONLY_LOCAL:GetBool() and not is_local then return true end
local msg_components = {}

View File

@ -95,6 +95,10 @@ if CLIENT then
if ent:IsPlayer() then
chat.AddText(ply, green_color, INDICATION_TEXT, ent)
if ent == LocalPlayer() then
system.FlashWindow()
end
return
end
end