Skip to content

Commit

Permalink
feat(secure): Mark Splatfest sessions as OpenParticipation
Browse files Browse the repository at this point in the history
Bit of a hack but good enough to make things work for now
  • Loading branch information
ashquarky committed Jul 18, 2024
1 parent fa20014 commit dcec920
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions nex/register_common_secure_server_protocols.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package nex
import (
"github.com/PretendoNetwork/nex-go/v2"
"github.com/PretendoNetwork/nex-go/v2/types"
common_globals "github.com/PretendoNetwork/nex-protocols-common-go/v2/globals"
commonnattraversal "github.com/PretendoNetwork/nex-protocols-common-go/v2/nat-traversal"
commonsecure "github.com/PretendoNetwork/nex-protocols-common-go/v2/secure-connection"
nattraversal "github.com/PretendoNetwork/nex-protocols-go/v2/nat-traversal"
Expand Down Expand Up @@ -106,6 +107,16 @@ func gameSpecificMatchmakeSessionSearchCriteriaChecksHandler(searchCriteria *mat
return true
}

func onAfterAutoMatchmakeWithParamPostpone(_ nex.PacketInterface, _ *matchmakingtypes.AutoMatchmakeParam) {
// * This is ugly but I can't work out a better way to do this
// * Set Splatfest rooms to open participation
for _, session := range common_globals.Sessions {
if session.GameMatchmakeSession != nil && session.GameMatchmakeSession.GameMode.Value == 12 {
session.GameMatchmakeSession.OpenParticipation = types.NewPrimitiveBool(true)
}
}
}

func registerCommonSecureServerProtocols() {
secureProtocol := secure.NewProtocol()
globals.SecureEndpoint.RegisterServiceProtocol(secureProtocol)
Expand All @@ -130,4 +141,5 @@ func registerCommonSecureServerProtocols() {
commonMatchmakeExtensionProtocol := commonmatchmakeextension.NewCommonProtocol(matchmakeExtensionProtocol)
matchmakeExtensionProtocol.SetHandlerGetPlayingSession(stubGetPlayingSession)
commonMatchmakeExtensionProtocol.GameSpecificMatchmakeSessionSearchCriteriaChecks = gameSpecificMatchmakeSessionSearchCriteriaChecksHandler
commonMatchmakeExtensionProtocol.OnAfterAutoMatchmakeWithParamPostpone = onAfterAutoMatchmakeWithParamPostpone
}

0 comments on commit dcec920

Please sign in to comment.