SpawnActor stuff

This commit is contained in:
AeonLucid
2022-01-18 03:13:56 +01:00
parent 458bae0523
commit 16ab2aeb48
11 changed files with 262 additions and 9 deletions
+27 -1
View File
@@ -1,4 +1,5 @@
using Prospect.Unreal.Core;
using Prospect.Unreal.Core.Math;
using Prospect.Unreal.Core.Objects;
using Prospect.Unreal.Runtime;
@@ -7,13 +8,20 @@ namespace Prospect.Unreal.Net.Actors;
public class AActor : UObject
{
private bool bActorInitialized;
private bool bActorIsBeingDestroyed;
// TODO: UPROPERTY(BlueprintReadWrite, ReplicatedUsing=OnRep_Instigator, meta=(ExposeOnSpawn=true, AllowPrivateAccess=true), Category=Actor)
/// <summary>
/// Pawn responsible for damage and other gameplay events caused by this actor.
/// </summary>
private APawn? _instigator;
// TODO: UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Actor)
/// <summary>
/// Controls how to handle spawning this actor in a situation where it's colliding with something else. "Default" means AlwaysSpawn here.
/// </summary>
public ESpawnActorCollisionHandlingMethod SpawnCollisionHandlingMethod { get; set; }
/// <summary>
/// Sets the value of Role without causing other side effects to this instance.
/// </summary>
@@ -81,4 +89,22 @@ public class AActor : UObject
{
return bActorInitialized;
}
public bool IsPendingKillPending()
{
return bActorIsBeingDestroyed || IsPendingKill();
}
public void PostSpawnInitialize(FTransform userSpawnTransform, AActor? inOwner, AActor? inInstigator, bool bRemoteOwned, bool bNoFail, bool bDeferConstruction)
{
// General flow here is like so
// - Actor sets up the basics.
// - Actor gets PreInitializeComponents()
// - Actor constructs itself, after which its components should be fully assembled
// - Actor components get OnComponentCreated
// - Actor components get InitializeComponent
// - Actor gets PostInitializeComponents() once everything is set up
//
// This should be the same sequence for deferred or nondeferred spawning.
}
}
+24
View File
@@ -2,6 +2,7 @@
using System.Net;
using Prospect.Unreal.Core.Names;
using Prospect.Unreal.Exceptions;
using Prospect.Unreal.Net.Actors;
using Prospect.Unreal.Net.Channels;
using Prospect.Unreal.Net.Channels.Actor;
using Prospect.Unreal.Net.Channels.Control;
@@ -269,6 +270,29 @@ public abstract class UNetDriver : IAsyncDisposable
};
}
public void AddNetworkActor(AActor actor)
{
// if (!IsDormInitialStartupActor(Actor))
// {
// GetNetworkObjectList().FindOrAdd(Actor, this);
// if (ReplicationDriver)
// {
// ReplicationDriver->AddNetworkActor(Actor);
// }
// }
}
public void RemoveNetworkActor(AActor actor)
{
// Remove from renamed list if destroyed
// RenamedStartupActors.Remove(Actor->GetFName());
//
// if (ReplicationDriver)
// {
// ReplicationDriver->RemoveNetworkActor(Actor);
// }
}
public virtual ValueTask DisposeAsync()
{
return ValueTask.CompletedTask;