Actor progress

This commit is contained in:
AeonLucid
2022-01-16 23:05:53 +01:00
parent f3b7efca45
commit fe97b7a145
14 changed files with 431 additions and 22 deletions
@@ -5,6 +5,37 @@ namespace Prospect.Unreal.Net.Actors;
public class AGameModeBase : AInfo
{
public AGameModeBase()
{
OptionsString = string.Empty;
}
/// <summary>
/// Save options string and parse it when needed
/// </summary>
public string OptionsString { get; set; }
public AGameSession? GameSession { get; set; }
public virtual void InitGame(string mapName, string options, out string errorMessage)
{
// Save Options for future use
OptionsString = options;
var spawnInfo = new FActorSpawnParameters
{
Instigator = GetInstigator(),
ObjectFlags = EObjectFlags.RF_Transient
};
GameSession = World.SpawnActor();
}
public virtual void InitGameState()
{
throw new NotImplementedException();
}
public void PreLogin(string options, string address, FUniqueNetIdRepl uniqueId, out string? errorMessage)
{
// Login unique id must match server expected unique id type OR No unique id could mean game doesn't use them
@@ -14,8 +45,21 @@ public class AGameModeBase : AInfo
public APlayerController? Login(UPlayer newPlayer, ENetRole inRemoteRole, string portal, string options, FUniqueNetIdRepl uniqueId, out string errorMessage)
{
errorMessage = string.Empty;
if (GameSession == null)
{
errorMessage = "Failed to spawn player controller, GameSession is null";
return null;
}
errorMessage = GameSession.ApproveLogin(options);
if (!string.IsNullOrEmpty(errorMessage))
{
return null;
}
throw new NotImplementedException();
return null;
}
public void PostLogin(APlayerController newPlayer)