Section 2.6.5. rdInstBase- Proxy Routines, Data and Structures

// [rdInst v1.36] Sets the Proxies state to Destroyed
void rdSetProxyToDestroyed(AActor* proxy,const FTransform& offset=FTransform());

// [rdInst v1.35] Swaps the Mesh Instance over to its ProxyActor
AActor* rdSwapInstanceToProxyActor(UStaticMesh* mesh,int32 index,const FTransform& transform,bool forImpact=false,bool forLongDistance=false);

// [rdInst v1.35] Swaps the Mesh Instances List over to their ProxyActors
void rdSwapInstancesToProxyActors(TArray<FrdInstanceItems>& instances,const TArray<FTransform>& transforms,TArray<AActor*>& outActors,bool forImpact=false,bool forLongDistance=false);

// [rdInst v1.35] Swaps the Prefab over to its ProxyActor
AActor* rdSwapPrefabToProxyActor(ArdActor* prefab,bool forImpact=false,bool forLongDistance=false);

// [rdInst v1.35] Swaps the ProxyActor back to its Instanced Mesh
void rdSwapProxyActorToInstance(AActor* actor);

// [rdInst v1.35] Swaps the ProxyActors back to their Mesh Instances
void rdSwapProxyActorsToInstances(TArray<FrdInstanceItems>& instances);

// [rdInst v1.35] Swaps the ProxyActor back to its Prefab
void rdSwapProxyActorToPrefab(AActor* actor);

// [rdInst v1.35] Swaps any Actors/Instances to ProxyActors around the impact point
void rdProcessImpactProxies(FVector loc);

// [rdInst v1.35] Spawn the assets from the rdSpawner struct
int32 rdSpawnStuff(const ArdSpawnStuffActor* spawner);

// [rdInst v1.35] C++ only wrapper
int32 rdSpawnStuffData(const FrdSpawnStuffData* spawnData,bool bake=false);

// [rdInst v1.35] Moves the specified Instances (whole mesh proxies only) in the specified way
void rdMassMove(const UStaticMesh* mesh,TEnumAsByte<rdMassMovementType> moveType,float maxDistance=0.0f);

// [rdInst v1.35] Returns a reference to the InstancedMeshToProxy Map
TMap<UStaticMesh*,FrdProxyItem>& rdGetInstancedMeshToProxyMap();

// [rdInst v1.35] Returns a reference to the InstancesToProxy Map
TMap<UStaticMesh*,FrdProxyInstanceItems>& rdGetInstancesToProxyMap();

// [rdInst v1.35] Returns a reference to the PrefabsToProxy Map
TMap<ArdActor*,FrdProxyItem>& rdGetPrefabsToProxyMap();

// [rdInst v1.35] Returns a reference to the LongDistanceInstancesToProxy Map
TMap<UStaticMesh*,FrdProxyInstanceItems>& rdGetLongDistanceInstancesToProxyMap();

// [rdInst v1.35] Returns a reference to the LongDistancePrefabsToProxy Map
TMap<ArdActor*,FrdProxyItem>& rdGetLongDistancePrefabsToProxyMap();

// [rdInst v1.35] Returns a reference to the ProxyActor Map
TMap<AActor*,FrdProxyActorItem>&  rdGetProxyActorMap();

// [rdInst v1.35] Does a SphereTrace, returning found actors and instances
void rdSphereTrace(const FVector location,float radius,TArray<AActor*>& actors,TArray<FrdInstanceItems>& instances,TArray<AActor*>& ignoreActors);

// [rdInst v1.35] Does a BoxTrace, returning found actors and instances
void rdBoxTrace(const FVector location,FVector halfSize,FRotator rot,TArray<AActor*>& actors,TArray<FrdInstanceItems>& instances,TArray<AActor*>& ignoreActors);

// [rdInst v1.35] FrdProxySetup
USTRUCT(BlueprintType)
struct FrdProxySetup {
	GENERATED_BODY()

	UPROPERTY(Category=rdProxies,EditAnywhere)
	UClass* proxyActor=nullptr;

	UPROPERTY(Category=rdProxies,EditAnywhere)
	UStaticMesh* destroyedMesh=nullptr;

	UPROPERTY(Category=rdProxies,EditAnywhere)
	UClass* destroyedPrefab=nullptr;

	UPROPERTY(Category=rdProxies,EditAnywhere)
	uint8 bUseWithSphereTrace:1;

	UPROPERTY(Category=rdProxies,EditAnywhere)
	uint8 bUseWithLongDistance:1;

	UPROPERTY(Category=rdProxies,EditAnywhere)
	float longDistance=50000.0f;

	UPROPERTY(Category=rdProxies,EditAnywhere)
	uint8 bUseWithDestruction:1;

	UPROPERTY(Category=rdProxies,EditAnywhere)
	uint8 bPooled:1;

	UPROPERTY(Category=rdProxies,EditAnywhere)
	int32 pooledAmount=20;

	UPROPERTY(Category=rdProxies,EditAnywhere)
	uint8 bDontRemove:1;

	UPROPERTY(Category=rdProxies,EditAnywhere)
	uint8 bDontHide:1;

	UPROPERTY(Category=rdProxies,EditAnywhere)
	UrdStateDataAsset* savedState=nullptr;
};

// [rdInst v1.35] FrdProxyItem
USTRUCT(BlueprintType,meta=(HasNativeBreak="rdActor.BreakProxyItem",HasNativeMake="rdActor.MakeProxyItem"))
struct FrdProxyItem {
	GENERATED_BODY()
	FrdProxyItem() : bUseWithSphereTrace(true),bUseWithDestruction(false),bPooled(true),bDontRemove(false),bDontHide(false) {}
	FrdProxyItem(const FrdProxyItem& o) :	mesh(o.mesh),destroyedMesh(o.destroyedMesh),destroyedPrefab(o.destroyedPrefab),instanceIndex(o.instanceIndex),
					prefab(o.prefab),actorClass(o.actorClass),distance(o.distance),transform(o.transform),proxyActor(o.proxyActor),
					bUseWithSphereTrace(o.bUseWithSphereTrace),bUseWithDestruction(o.bUseWithDestruction),bPooled(o.bPooled),bDontRemove(o.bDontRemove),bDontHide(o.bDontHide) {}
	FrdProxyItem(UStaticMesh* m,UStaticMesh* dm,UClass* dp,int32 ii,ArdActor* pf,UClass* ac,float d,const FTransform& t,AActor* ia,bool ust,bool ud,bool p,bool dr,bool dh) : 
					mesh(m),destroyedMesh(dm),destroyedPrefab(dp),instanceIndex(ii),prefab(pf),actorClass(ac),distance(d),transform(t),
					proxyActor(ia),bUseWithSphereTrace(ust),bUseWithDestruction(ud),bPooled(p),bDontRemove(dr),bDontHide(dh) {}

public:
	UPROPERTY(Category=rdProxies,EditAnywhere)
	UStaticMesh* mesh=nullptr;

	UPROPERTY(Category=rdProxies,EditAnywhere)
	UStaticMesh* destroyedMesh=nullptr;

	UPROPERTY(Category=rdProxies,EditAnywhere)
	UClass* destroyedPrefab=nullptr;

	UPROPERTY(Category=rdProxies,EditAnywhere)
	int32 instanceIndex=-1;

	UPROPERTY(Category=rdProxies,EditAnywhere)
	ArdActor* prefab=nullptr;

	UPROPERTY(Category=rdProxies,EditAnywhere)
	UClass*	actorClass=nullptr;

	UPROPERTY(Category=rdProxies,EditAnywhere)
	double distance=20000.0f;

	UPROPERTY(Category=rdProxies,EditAnywhere)
	FTransform	transform;

	UPROPERTY(Category=rdProxies,EditAnywhere)
	AActor* proxyActor=nullptr;

	UPROPERTY(Category=rdProxies,EditAnywhere)
	uint8 bUseWithSphereTrace:1;

	UPROPERTY(Category=rdProxies,EditAnywhere)
	uint8 bUseWithDestruction:1;

	UPROPERTY(Category=rdProxies,EditAnywhere)
	uint8 bPooled:1;

	UPROPERTY(Category=rdProxies,EditAnywhere)
	uint8 bDontRemove:1;

	UPROPERTY(Category=rdProxies,EditAnywhere)
	uint8 bDontHide:1;

	UPROPERTY(Category=rdProxies,EditAnywhere)
	UrdStateDataAsset* savedState=nullptr;
};

// [rdInst v1.35] FrdProxyInstanceItems
USTRUCT(BlueprintType)
struct FrdProxyInstanceItems {
	GENERATED_BODY()
public:
	UPROPERTY(Category=rdProxies,EditAnywhere)
	TMap<int32,FrdProxyItem> proxyInstanceIndexList;
};

// FrdProxyActorItem
USTRUCT(BlueprintType)
struct FrdProxyActorItem {
	GENERATED_BODY()
public:
	UPROPERTY(Category=rdProxies,EditAnywhere)
	AActor*			proxyActor=nullptr;

	FrdProxyItem*	proxyItem=nullptr;
	UPROPERTY(Category=rdProxies,EditAnywhere)
	int32			instanceIndex=-1;
	UPROPERTY(Category=rdProxies,EditAnywhere)
	FTransform		instanceTransform;

	UPROPERTY(Category=rdProxies,EditAnywhere)
	int32			idleCountdown=10;
	UPROPERTY(Category=rdProxies,EditAnywhere)
	uint8			forDestruction:1;
	UPROPERTY(Category=rdProxies,EditAnywhere)
	uint8			forLongDistance:1;
	UPROPERTY(Category=rdProxies,EditAnywhere)
	uint8			bDontRemove:1;
	UPROPERTY(Category=rdProxies,EditAnywhere)
	uint8			bDontHide:1;
};

// [rdInst v1.35] FrdInstanceItems
USTRUCT(BlueprintType)
struct FrdInstanceItems {
	GENERATED_BODY()
public:
	UPROPERTY(Category=rdInstances,EditAnywhere)
	UStaticMesh* mesh=nullptr;

	UPROPERTY(Category=rdInstances,EditAnywhere)
	TArray<int32> instances;
};