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

Fix the POV button in spectator mode #611

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Northstar.Client/mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,13 @@
{
"Path": "ui/ui_mouse_capture.nut",
"RunOn": "UI"
},
{
"Path": "spectator_pov_button_fix.nut",
"RunOn": "CLIENT && MP",
"ClientCallback": {
"After": "SpectatorPovButtonFixInit"
}
}
],
"Localisation": [
Expand Down
12 changes: 12 additions & 0 deletions Northstar.Client/mod/scripts/vscripts/spectator_pov_button_fix.nut
ASpoonPlaysGames marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
global function SpectatorPovButtonFixInit

void function SpectatorPovButtonFixInit(){
RegisterButtonPressedCallback(MOUSE_MIDDLE, SwitchPov)
Copy link
Contributor

Choose a reason for hiding this comment

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

The button callback needs to be only registered when spectating

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Registering and deregistering it would be pain, especially because all of the possible combinations of spectating/respawning/joining a game/switching players etc., so unless I manage do find proper callbacks for that I'd leave it as it is, since it only does something when spectating

ASpoonPlaysGames marked this conversation as resolved.
Show resolved Hide resolved
}

void function SwitchPov(var button){
if(IsSpectating() && GetLocalClientPlayer() != null){
GetLocalClientPlayer().ClientCommand("spec_mode")
ASpoonPlaysGames marked this conversation as resolved.
Show resolved Hide resolved
}
}