Skip to content

Commit

Permalink
Grammar+formatting of Kyrium PR
Browse files Browse the repository at this point in the history
  • Loading branch information
budak7273 committed Apr 5, 2024
1 parent 210a320 commit 9a25a10
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions modules/ROOT/pages/Development/Satisfactory/AbstractInstance.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,15 @@ You may also find the following properties useful:
[id="Examples"]
== Examples for Custom Implementations

`TArray< struct FInstanceHandle* > mInstanceHandles` All instance handlers (provided from `AFGBuildable` If you create a new actor, you should define something like that).
You may find the below examples useful
if you're planning to implement Abstract Instances on things that don't inherit from `AFGBuildable`.

=== Resolve Hit on Abstract Instances
=== Storing Instance Handles

Custom implementations should define a field to hold instance handles.
Consider `TArray< struct FInstanceHandle* > mInstanceHandles` used by `AFGBuildable`.

=== Resolve Hits on Abstract Instances

[NOTE]
====
Expand All @@ -61,13 +67,13 @@ To resolve the hit, we have two options:
- Overlap Result `bool ResolveOverlap( const FOverlapResult& Result, FInstanceHandle& OutHandle )`

```cpp
ASMLActor::ResolveHitResult(const FHitResult& Hit) {
AMyModActor::ResolveHitResult(const FHitResult& Hit) {
AAbstractInstanceManager* Manager = AAbstractInstanceManager::Get(GetWorld());
fgcheck(Manager);

FInstanceHandle OutHandle;
if(Manager->ResolveHit(Hit, OutHandle)) {
// We hit a abstract instance to we can get informations like the owner from that
// We hit a abstract instance, so we can get information, like the owner, from that handle
OutHandle.GetOwner() // AActor* who owns the Instance
}
// We don't hit a abstract instance so we can continue with the Hit
Expand All @@ -79,7 +85,7 @@ ASMLActor::ResolveHitResult(const FHitResult& Hit) {
```cpp
static void SetInstanceFromDataStatic( AActor* OwnerActor, const FTransform& ActorTransform, const FInstanceData& InstanceData, FInstanceHandle* &OutHandle, bool bInitializeHidden = false );

ASMLActor::CreateInstanceFromMesh(UStaticMesh* Mesh) {
AMyModActor::CreateInstanceFromMesh(UStaticMesh* Mesh) {
// Prepare the InstanceData with a given Mesh at the relative Transform 0.
FInstanceData InstanceData;
InstanceData.StaticMesh = Mesh;
Expand All @@ -95,13 +101,13 @@ ASMLActor::CreateInstanceFromMesh(UStaticMesh* Mesh) {
}
```

=== Destory Abstract Instances at runtime
=== Destory Abstract Instances at Runtime

```cpp
static void RemoveInstances( UObject* WorldContext, TArray<FInstanceHandle*>& Handles, bool bEmptyHandleArray = true );

ASMLActor::ClearInstances(UStaticMesh* Mesh) {
AMyModActor::ClearInstances(UStaticMesh* Mesh) {
// Will remove/destroy all instances and empty mInstanceHandles.
AAbstractInstanceManager::RemoveInstances( GetWorld( ), mInstanceHandles );
}
```
```

0 comments on commit 9a25a10

Please sign in to comment.