Earu / EasyChat

A modular Garry's Mod chat addon for both users and developers. (EOL 2025)
https://steamcommunity.com/sharedfiles/filedetails/?id=1182471500
GNU General Public License v3.0
90 stars 31 forks source link

easychat_only_local oversights #64

Closed Cynosphere closed 3 years ago

Cynosphere commented 3 years ago

Mainly just greentext found so far but theres probably other text modifying modules that don't have checks

Earu commented 3 years ago

@Cynosphere I'm not sure I understand fully the issue, what happens with greentext and local? Does it not add the (Local) tag or ?

The code in question is this:

local EC_ONLY_LOCAL = CreateConVar("easychat_only_local", "0", FCVAR_ARCHIVE, "Shows only local chat")
EasyChat.RegisterConvar(EC_ONLY_LOCAL, "Only show local chat messages")

hook.Add("OnPlayerChat", "only_local", function(_, _, _, _, is_local)
    if not EC_ONLY_LOCAL:GetBool() then return end
    if not is_local then return true end
end)

return "Only Local"

Which you can find here https://gitlab.com/metastruct/internal/srvaddons/-/blob/master/Chat/lua/easychat/modules/client/only_local.lua

Unfortunately I'm unsure what can be done here as both greentext and this meta-specific module are using the OnPlayerChat hook.

Cynosphere commented 3 years ago

Could either move Only Local to base (not ideal without gamemode checks or what not) or just check if the convar exists and if its active and local chat. Other than that, I didn't realize it was meta-specific and thought it was apart of base.

Earu commented 3 years ago

I've moved the module inside EasyChat where it makes the most sense: https://github.com/Earu/EasyChat/commit/7a33a6b6bbf5353ad1045a79fd8591ca50196e9e