New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TTT: Allow popups to be toggled with their hotkey #1412
Conversation
Can be changed in the settings menu.
Also, apologies if the CVar is not located in the ideal place. It made sense to me to place it there, but you can move it as you see right. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since you declare the convar in that file, you can just cache the return in that file to skip calling GetConVar
@@ -524,6 +524,12 @@ function CLSCORE:Reopen() | |||
end | |||
end | |||
|
|||
function CLSCORE:Toggle() | |||
if self.Panel and self.Panel:IsValid() then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should remove both if
statements and use IsValid(self.Panel)
instead.
@@ -524,6 +524,12 @@ function CLSCORE:Reopen() | |||
end | |||
end | |||
|
|||
function CLSCORE:Toggle() | |||
if self.Panel and self.Panel:IsValid() then | |||
self.Panel:SetVisible(not self.Panel:IsVisible()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a function to do this. self.Panel:ToggleVisible()
* Replaced "self.Panel and self.Panel:IsValid()" with "IsValid(self.Panel)". * Cached the convar in cl_equip
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
To be honest I'd just remove the convar entirely, why disable it if there's no downside? |
Honestly? I don't think it's needed either, but I was adding that in case anyone would prefer it as it is for some crazy reason. People don't always like these changes. 🤷♂️ |
QoL change
Allows popups like the Traitor shop or the round end pop to be closed with their hotkey (Default: C) instead of using the mouse.
It's a small thing but it's a huge relief, really.
Can be changed in the settings menu, if somebody doesn't like (but why the hell not lol)