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
+13
View File
@@ -1,9 +1,12 @@
using Prospect.Unreal.Core;
using Prospect.Unreal.Runtime;
namespace Prospect.Unreal.Net.Actors;
public class AActor
{
private bool bActorInitialized;
/// <summary>
/// Sets the value of Role without causing other side effects to this instance.
/// </summary>
@@ -32,4 +35,14 @@ public class AActor
// TODO: Implement
throw new NotImplementedException();
}
public UWorld GetWorld()
{
// if ()
}
public bool IsActorInitialized()
{
return bActorInitialized;
}
}
@@ -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)
@@ -0,0 +1,12 @@
namespace Prospect.Unreal.Net.Actors;
public class AGameSession : AInfo
{
public string ApproveLogin(string options)
{
// Check;
// - SpectatorOnly
// - SplitscreenCount
return string.Empty;
}
}