Skip to content
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

Merged
merged 4 commits into from Sep 22, 2017
Merged

TTT: Allow popups to be toggled with their hotkey #1412

merged 4 commits into from Sep 22, 2017

Conversation

TheOpalium
Copy link
Contributor

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)

Can be changed in the settings menu.
@TheOpalium
Copy link
Contributor Author

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.

Copy link
Contributor

@Kefta Kefta left a 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
Copy link
Contributor

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())
Copy link
Contributor

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()

@robotboy655 robotboy655 added the TTT The pull request is for TTT and will be handled by svdm. label Sep 19, 2017
Opalium added 2 commits September 19, 2017 11:24
* Replaced "self.Panel and self.Panel:IsValid()" with "IsValid(self.Panel)".
* Cached the convar in cl_equip
Copy link
Contributor Author

@TheOpalium TheOpalium left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@svdm
Copy link
Collaborator

svdm commented Sep 20, 2017

To be honest I'd just remove the convar entirely, why disable it if there's no downside?

@TheOpalium
Copy link
Contributor Author

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. 🤷‍♂️

@svdm svdm merged commit 9a22732 into Facepunch:master Sep 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TTT The pull request is for TTT and will be handled by svdm.
Projects
None yet
5 participants