From ea43fc767dcbd77efd8099169ab0391152fd0f77 Mon Sep 17 00:00:00 2001 From: praydog Date: Fri, 27 Oct 2023 20:33:39 -0700 Subject: [PATCH] SDK: Add AActor::get_overlapping_actors/components --- shared/sdk/AActor.cpp | 35 +++++++++++++++++++++++++++++++++++ shared/sdk/AActor.hpp | 6 ++++++ 2 files changed, 41 insertions(+) diff --git a/shared/sdk/AActor.cpp b/shared/sdk/AActor.cpp index d7f363a6..d1407c94 100644 --- a/shared/sdk/AActor.cpp +++ b/shared/sdk/AActor.cpp @@ -419,4 +419,39 @@ UWorld* AActor::get_world() { return level->get_property(L"OwningWorld"); } + +TArray AActor::get_overlapping_actors(UClass* uclass) { + static const auto func = AActor::static_class()->find_function(L"GetOverlappingActors"); + + if (func == nullptr) { + return {}; + } + + struct { + TArray out_actors{}; + UClass* actor_class{}; + } params{}; + + params.actor_class = uclass; + + this->process_event(func, ¶ms); + + return std::move(params.out_actors); +} + +TArray AActor::get_overlapping_components() { + static const auto func = AActor::static_class()->find_function(L"GetOverlappingComponents"); + + if (func == nullptr) { + return {}; + } + + struct { + TArray out_components{}; + } params{}; + + this->process_event(func, ¶ms); + + return std::move(params.out_components); +} } \ No newline at end of file diff --git a/shared/sdk/AActor.hpp b/shared/sdk/AActor.hpp index a268bee6..02344c86 100644 --- a/shared/sdk/AActor.hpp +++ b/shared/sdk/AActor.hpp @@ -5,6 +5,7 @@ #include "Math.hpp" #include "UClass.hpp" +#include "TArray.hpp" namespace sdk { class UCameraComponent; @@ -13,6 +14,8 @@ class UActorComponent; class AActor; class UWorld; +class UPrimitiveComponent; + class AActor : public UObject { public: static UClass* static_class(); @@ -43,6 +46,9 @@ class AActor : public UObject { UObject* get_level(); UWorld* get_world(); + TArray get_overlapping_actors(UClass* uclass = nullptr); + TArray get_overlapping_components(); + protected: }; } \ No newline at end of file