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 all commits
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 @@ -117,6 +117,13 @@
{
"Path": "ui/ui_mouse_capture.nut",
"RunOn": "UI"
},
{
"Path": "spectator_pov_button_fix.nut",
"RunOn": "CLIENT && MP",
"ClientCallback": {
"After": "SpectatorPovButtonFixInit"
}
}
],
"Localisation": [
Expand Down
17 changes: 17 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,17 @@
global function SpectatorPovButtonFixInit

void function SpectatorPovButtonFixInit()
{
RegisterButtonPressedCallback( MOUSE_MIDDLE, SwitchPov )
RegisterButtonPressedCallback( BUTTON_B, SwitchPov )
}

void function SwitchPov(var button)
{
// the vanilla (native) way of calling spec_mode works just fine when in first person spectating
// but not in third person. Duplicate spec_mode commands just result in it going back to what it was
// originally, so only call spec_mode if we are in third person spectate
if ( IsSpectating() && IsValid(GetLocalClientPlayer()) && GetLocalClientPlayer().GetObserverMode() == OBS_MODE_CHASE )
GetLocalClientPlayer().ClientCommand("spec_mode")
ASpoonPlaysGames marked this conversation as resolved.
Show resolved Hide resolved
}