mirror of
https://github.com/mordentral/AdvancedSessionsPlugin.git
synced 2025-10-22 16:04:18 +00:00
Merge pull request #30 from uno1982/master
Add server travel blueprint node.
This commit is contained in:

committed by
Joshua

parent
aee6c013d6
commit
707c055f49
@@ -199,6 +199,12 @@ public:
|
||||
// Checks if the stated session subsystem is active
|
||||
UFUNCTION(BlueprintPure, Category = "Online|AdvancedSessions|Misc")
|
||||
static bool HasOnlineSubsystem(FName SubSystemName);
|
||||
|
||||
//**** Seamless travel Functions ****//
|
||||
|
||||
//Exposes Server travel to blueprint
|
||||
UFUNCTION(BlueprintCallable, BlueprintAuthorityOnly, Category = "Online|AdvancedSessions|Seamless", meta = (HidePin = "WorldContextObject", DefaultToSelf = "WorldContextObject"))
|
||||
static bool ServerTravel(UObject* WorldContextObject, const FString& InURL, bool bAbsolute, bool bShouldSkipGameNotify);
|
||||
|
||||
|
||||
};
|
||||
|
@@ -528,3 +528,14 @@ void UAdvancedSessionsLibrary::GetNumberOfNetworkPlayers(UObject* WorldContextOb
|
||||
|
||||
NumNetPlayers = TheWorld->GetGameState()->PlayerArray.Num();
|
||||
}
|
||||
|
||||
bool UAdvancedSessionsLibrary::ServerTravel(UObject* WorldContextObject, const FString& FURL, bool bAbsolute, bool bShouldSkipGameNotify)
|
||||
{
|
||||
if (!WorldContextObject) return false;
|
||||
|
||||
//using a context object to get the world
|
||||
UWorld* const World = GEngine->GetWorldFromContextObject(WorldContextObject, EGetWorldErrorMode::ReturnNull);
|
||||
if (!World) return false;
|
||||
World->ServerTravel(FURL,bAbsolute,bShouldSkipGameNotify);
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user