Rename IntegrationGameModeBase to LuprexGameModeBase, and other small refactors

This commit is contained in:
2025-03-17 18:04:55 -04:00
parent 6b8c86a03c
commit cc4441cb31
13 changed files with 78 additions and 78 deletions

View File

@@ -1,6 +1,6 @@
#include "LuaCall.h"
#include "IntegrationGameModeBase.h"
#include "LuprexGameModeBase.h"
#include "EdGraphSchema_K2.h"
static void FatalBlueprintError(const TCHAR *message) {
@@ -204,7 +204,7 @@ FString UlxLuaCallLibrary::AllFunctionsWithPrefix(const TCHAR *Prefix)
/////////////////////////////////////////////////////////////////
void UlxLuaCallLibrary::LuaCallBegin(UObject *context, const FString &cname, const FString &fname) {
AIntegrationGameModeBase *mode = AIntegrationGameModeBase::GetLuprexGameMode(context);
ALuprexGameModeBase *mode = ALuprexGameModeBase::FromContext(context);
FlxStreamBuffer &sb = mode->LuaCallGetBuffer();
mode->LuaCallBegin();
sb.write_string(cname);
@@ -213,7 +213,7 @@ void UlxLuaCallLibrary::LuaCallBegin(UObject *context, const FString &cname, con
void UlxLuaCallLibrary::LuaCallInvoke(UObject *context, AActor *place) {
AIntegrationGameModeBase *mode = AIntegrationGameModeBase::GetLuprexGameMode(context);
ALuprexGameModeBase *mode = ALuprexGameModeBase::FromContext(context);
FlxStreamBuffer &sb = mode->LuaCallGetBuffer();
CheckNotEmpty(sb);
mode->LuaCallEnd(InvocationKind::LUA_INVOKE, place);
@@ -221,7 +221,7 @@ void UlxLuaCallLibrary::LuaCallInvoke(UObject *context, AActor *place) {
void UlxLuaCallLibrary::LuaCallProbe(UObject *context, AActor *place) {
AIntegrationGameModeBase *mode = AIntegrationGameModeBase::GetLuprexGameMode(context);
ALuprexGameModeBase *mode = ALuprexGameModeBase::FromContext(context);
FlxStreamBuffer &sb = mode->LuaCallGetBuffer();
CheckNotEmpty(sb);
mode->LuaCallEnd(InvocationKind::LUA_PROBE, place);
@@ -229,7 +229,7 @@ void UlxLuaCallLibrary::LuaCallProbe(UObject *context, AActor *place) {
void UlxLuaCallLibrary::InvokeEngioMove(UObject *context, const FString &action, const FVector &xyz, double facing) {
AIntegrationGameModeBase *mode = AIntegrationGameModeBase::GetLuprexGameMode(context);
ALuprexGameModeBase *mode = ALuprexGameModeBase::FromContext(context);
FlxStreamBuffer &sb = mode->LuaCallBegin();
sb.write_string("engio");
sb.write_string("move");
@@ -244,7 +244,7 @@ void UlxLuaCallLibrary::InvokeEngioMove(UObject *context, const FString &action,
ELpxSimpleDynamicTag UlxLuaCallLibrary::LuaCallNextResultType(UObject *context) {
AIntegrationGameModeBase *mode = AIntegrationGameModeBase::GetLuprexGameMode(context);
ALuprexGameModeBase *mode = ALuprexGameModeBase::FromContext(context);
FlxStreamBuffer &sb = mode->LuaCallGetResult();
if (sb.empty()) return ELpxSimpleDynamicTag::None;
int64_t total_reads = sb.total_reads();
@@ -267,7 +267,7 @@ ELpxSimpleDynamicTag UlxLuaCallLibrary::LuaCallNextResultType(UObject *context)
/////////////////////////////////////////////////////////////////
void UlxLuaCallLibrary::LuaCallArgument_string(UObject *context, const FString &pstring) {
AIntegrationGameModeBase *mode = AIntegrationGameModeBase::GetLuprexGameMode(context);
ALuprexGameModeBase *mode = ALuprexGameModeBase::FromContext(context);
FlxStreamBuffer &sb = mode->LuaCallGetBuffer();
CheckNotEmpty(sb);
sb.write_simple_dynamic_tag(SimpleDynamicTag::STRING);
@@ -281,7 +281,7 @@ void UlxLuaCallLibrary::LuaCallArgument_name(UObject *context, const FName &pnam
if ((tokvalue == 0) && !namestr.empty()) {
FatalBlueprintError(TEXT("Names passed to lua must be short, and must contain only lowercase and digits"));
}
AIntegrationGameModeBase *mode = AIntegrationGameModeBase::GetLuprexGameMode(context);
ALuprexGameModeBase *mode = ALuprexGameModeBase::FromContext(context);
FlxStreamBuffer &sb = mode->LuaCallGetBuffer();
CheckNotEmpty(sb);
sb.write_simple_dynamic_tag(SimpleDynamicTag::TOKEN);
@@ -289,7 +289,7 @@ void UlxLuaCallLibrary::LuaCallArgument_name(UObject *context, const FName &pnam
}
void UlxLuaCallLibrary::LuaCallArgument_float(UObject *context, double pfloat) {
AIntegrationGameModeBase *mode = AIntegrationGameModeBase::GetLuprexGameMode(context);
ALuprexGameModeBase *mode = ALuprexGameModeBase::FromContext(context);
FlxStreamBuffer &sb = mode->LuaCallGetBuffer();
CheckNotEmpty(sb);
sb.write_simple_dynamic_tag(SimpleDynamicTag::NUMBER);
@@ -297,7 +297,7 @@ void UlxLuaCallLibrary::LuaCallArgument_float(UObject *context, double pfloat) {
}
void UlxLuaCallLibrary::LuaCallArgument_int(UObject *context, int value) {
AIntegrationGameModeBase *mode = AIntegrationGameModeBase::GetLuprexGameMode(context);
ALuprexGameModeBase *mode = ALuprexGameModeBase::FromContext(context);
FlxStreamBuffer &sb = mode->LuaCallGetBuffer();
CheckNotEmpty(sb);
sb.write_simple_dynamic_tag(SimpleDynamicTag::NUMBER);
@@ -305,7 +305,7 @@ void UlxLuaCallLibrary::LuaCallArgument_int(UObject *context, int value) {
}
void UlxLuaCallLibrary::LuaCallArgument_vector(UObject *context, const FVector &pvector) {
AIntegrationGameModeBase *mode = AIntegrationGameModeBase::GetLuprexGameMode(context);
ALuprexGameModeBase *mode = ALuprexGameModeBase::FromContext(context);
FlxStreamBuffer &sb = mode->LuaCallGetBuffer();
CheckNotEmpty(sb);
sb.write_simple_dynamic_tag(SimpleDynamicTag::VECTOR);
@@ -313,7 +313,7 @@ void UlxLuaCallLibrary::LuaCallArgument_vector(UObject *context, const FVector &
}
void UlxLuaCallLibrary::LuaCallArgument_vector2d(UObject *context, const FVector2D &pvector) {
AIntegrationGameModeBase *mode = AIntegrationGameModeBase::GetLuprexGameMode(context);
ALuprexGameModeBase *mode = ALuprexGameModeBase::FromContext(context);
FlxStreamBuffer &sb = mode->LuaCallGetBuffer();
CheckNotEmpty(sb);
sb.write_simple_dynamic_tag(SimpleDynamicTag::VECTOR);
@@ -323,7 +323,7 @@ void UlxLuaCallLibrary::LuaCallArgument_vector2d(UObject *context, const FVector
}
void UlxLuaCallLibrary::LuaCallArgument_boolean(UObject *context, bool pbool) {
AIntegrationGameModeBase *mode = AIntegrationGameModeBase::GetLuprexGameMode(context);
ALuprexGameModeBase *mode = ALuprexGameModeBase::FromContext(context);
FlxStreamBuffer &sb = mode->LuaCallGetBuffer();
CheckNotEmpty(sb);
sb.write_simple_dynamic_tag(SimpleDynamicTag::BOOLEAN);
@@ -339,7 +339,7 @@ void UlxLuaCallLibrary::LuaCallArgument_boolean(UObject *context, bool pbool) {
FString UlxLuaCallLibrary::LuaCallReturnValue_string(UObject *context) {
AIntegrationGameModeBase *mode = AIntegrationGameModeBase::GetLuprexGameMode(context);
ALuprexGameModeBase *mode = ALuprexGameModeBase::FromContext(context);
FlxStreamBuffer &sb = mode->LuaCallGetResult();
SimpleDynamicTag tag = sb.read_simple_dynamic_tag();
if (tag != SimpleDynamicTag::STRING) FatalBlueprintError(TEXT("expected lua to return a string"));
@@ -347,7 +347,7 @@ FString UlxLuaCallLibrary::LuaCallReturnValue_string(UObject *context) {
}
FName UlxLuaCallLibrary::LuaCallReturnValue_name(UObject *context) {
AIntegrationGameModeBase *mode = AIntegrationGameModeBase::GetLuprexGameMode(context);
ALuprexGameModeBase *mode = ALuprexGameModeBase::FromContext(context);
FlxStreamBuffer &sb = mode->LuaCallGetResult();
SimpleDynamicTag tag = sb.read_simple_dynamic_tag();
if (tag != SimpleDynamicTag::TOKEN) FatalBlueprintError(TEXT("expected lua to return a name"));
@@ -355,7 +355,7 @@ FName UlxLuaCallLibrary::LuaCallReturnValue_name(UObject *context) {
}
double UlxLuaCallLibrary::LuaCallReturnValue_float(UObject *context) {
AIntegrationGameModeBase *mode = AIntegrationGameModeBase::GetLuprexGameMode(context);
ALuprexGameModeBase *mode = ALuprexGameModeBase::FromContext(context);
FlxStreamBuffer &sb = mode->LuaCallGetResult();
SimpleDynamicTag tag = sb.read_simple_dynamic_tag();
if (tag != SimpleDynamicTag::NUMBER) FatalBlueprintError(TEXT("expected lua to return a float"));
@@ -363,7 +363,7 @@ double UlxLuaCallLibrary::LuaCallReturnValue_float(UObject *context) {
}
int UlxLuaCallLibrary::LuaCallReturnValue_int(UObject *context) {
AIntegrationGameModeBase *mode = AIntegrationGameModeBase::GetLuprexGameMode(context);
ALuprexGameModeBase *mode = ALuprexGameModeBase::FromContext(context);
FlxStreamBuffer &sb = mode->LuaCallGetResult();
SimpleDynamicTag tag = sb.read_simple_dynamic_tag();
if (tag != SimpleDynamicTag::NUMBER) FatalBlueprintError(TEXT("expected lua to return a number"));
@@ -371,7 +371,7 @@ int UlxLuaCallLibrary::LuaCallReturnValue_int(UObject *context) {
}
FVector UlxLuaCallLibrary::LuaCallReturnValue_vector(UObject *context) {
AIntegrationGameModeBase *mode = AIntegrationGameModeBase::GetLuprexGameMode(context);
ALuprexGameModeBase *mode = ALuprexGameModeBase::FromContext(context);
FlxStreamBuffer &sb = mode->LuaCallGetResult();
SimpleDynamicTag tag = sb.read_simple_dynamic_tag();
if (tag != SimpleDynamicTag::VECTOR) FatalBlueprintError(TEXT("expected lua to return a vector"));
@@ -379,7 +379,7 @@ FVector UlxLuaCallLibrary::LuaCallReturnValue_vector(UObject *context) {
}
FVector2D UlxLuaCallLibrary::LuaCallReturnValue_vector2d(UObject *context) {
AIntegrationGameModeBase *mode = AIntegrationGameModeBase::GetLuprexGameMode(context);
ALuprexGameModeBase *mode = ALuprexGameModeBase::FromContext(context);
FlxStreamBuffer &sb = mode->LuaCallGetResult();
SimpleDynamicTag tag = sb.read_simple_dynamic_tag();
if (tag != SimpleDynamicTag::VECTOR) FatalBlueprintError(TEXT("expected lua to return a vector"));
@@ -388,7 +388,7 @@ FVector2D UlxLuaCallLibrary::LuaCallReturnValue_vector2d(UObject *context) {
}
bool UlxLuaCallLibrary::LuaCallReturnValue_boolean(UObject *context) {
AIntegrationGameModeBase *mode = AIntegrationGameModeBase::GetLuprexGameMode(context);
ALuprexGameModeBase *mode = ALuprexGameModeBase::FromContext(context);
FlxStreamBuffer &sb = mode->LuaCallGetResult();
SimpleDynamicTag tag = sb.read_simple_dynamic_tag();
if (tag != SimpleDynamicTag::BOOLEAN) FatalBlueprintError(TEXT("expected lua to return a boolean"));

View File

@@ -100,7 +100,7 @@ public:
// * Use LuaCallReturnValueXXX to fetch return values from the return buffer.
//
// The two buffers are basically global variables, they are part of the
// IntegrationGameModeBase. This is okay because blueprint is single-threaded.
// LuprexGameModeBase. This is okay because blueprint is single-threaded.
//
// The following three libraries contain all the low-level functions.
//

View File

@@ -1,6 +1,6 @@
// Copyright Epic Games, Inc. All Rights Reserved.
#include "IntegrationGameModeBase.h"
#include "LuprexGameModeBase.h"
#include "lpx-drvutil.hpp"
#include "lpx-paths.hpp"
#include "DebugPrint.h"
@@ -14,7 +14,7 @@
using namespace DebugPrint;
using namespace CommonTypes;
AIntegrationGameModeBase::AIntegrationGameModeBase()
ALuprexGameModeBase::ALuprexGameModeBase()
{
TangibleManager = NewObject<UlxTangibleManager>();
PlayerId = 0;
@@ -26,11 +26,11 @@ AIntegrationGameModeBase::AIntegrationGameModeBase()
SetActorTickInterval(0.0f);
DebugPrintControl::EnableCollection();
ResetToInitialState();
OnWorldPreActorTickHandle = FWorldDelegates::OnWorldPreActorTick.AddUObject(this, &AIntegrationGameModeBase::OnWorldPreActorTick);
OnWorldPostActorTickHandle = FWorldDelegates::OnWorldPostActorTick.AddUObject(this, &AIntegrationGameModeBase::OnWorldPostActorTick);
OnWorldPreActorTickHandle = FWorldDelegates::OnWorldPreActorTick.AddUObject(this, &ALuprexGameModeBase::OnWorldPreActorTick);
OnWorldPostActorTickHandle = FWorldDelegates::OnWorldPostActorTick.AddUObject(this, &ALuprexGameModeBase::OnWorldPostActorTick);
}
AIntegrationGameModeBase::~AIntegrationGameModeBase()
ALuprexGameModeBase::~ALuprexGameModeBase()
{
ResetToInitialState();
FWorldDelegates::OnWorldPreActorTick.Remove(OnWorldPreActorTickHandle);
@@ -40,7 +40,7 @@ AIntegrationGameModeBase::~AIntegrationGameModeBase()
// This method runs in the background thread,
// at the moment we trigger it.
//
uint32 AIntegrationGameModeBase::Run() {
uint32 ALuprexGameModeBase::Run() {
FlxLockedWrapper lockedwrap(LockableWrapper);
Sockets->Update(lockedwrap);
lockedwrap->play_update(lockedwrap.Get(), EngineSeconds);
@@ -48,7 +48,7 @@ uint32 AIntegrationGameModeBase::Run() {
return 0;
}
void AIntegrationGameModeBase::ResetToInitialState()
void ALuprexGameModeBase::ResetToInitialState()
{
Playing = false;
@@ -96,7 +96,7 @@ void AIntegrationGameModeBase::ResetToInitialState()
}
void AIntegrationGameModeBase::UpdateConsoleOutput() {
void ALuprexGameModeBase::UpdateConsoleOutput() {
// Copy Luprex Stdout into the console.
FlxLockedWrapper lockedwrap(LockableWrapper);
if (Playing) {
@@ -117,7 +117,7 @@ void AIntegrationGameModeBase::UpdateConsoleOutput() {
}
#pragma optimize("", off)
void AIntegrationGameModeBase::UpdateTangibles() {
void ALuprexGameModeBase::UpdateTangibles() {
double radius = 1000.0; // Hardwired for now.
using TanArray = UlxTangibleManager::TanArray;
if (!Playing) return;
@@ -145,7 +145,7 @@ void AIntegrationGameModeBase::UpdateTangibles() {
TangibleManager->DeleteFarawayTangibles();
}
void AIntegrationGameModeBase::UpdatePossessedTangible() {
void ALuprexGameModeBase::UpdatePossessedTangible() {
UlxTangible *ptan = TangibleManager->GetPossessedTangible();
UlxTangible *tan = TangibleManager->GetTangible(PlayerId);
APlayerController *ctrl = GetWorld()->GetFirstPlayerController();
@@ -164,7 +164,7 @@ void AIntegrationGameModeBase::UpdatePossessedTangible() {
}
}
void AIntegrationGameModeBase::LuaCallEnd(InvocationKind kind, int64 place_id) {
void ALuprexGameModeBase::LuaCallEnd(InvocationKind kind, int64 place_id) {
std::string_view datapk = LuaCallBuffer.view();
FlxLockedWrapper w(LockableWrapper);
if (place_id == 0) place_id = w.GetActor();
@@ -174,11 +174,11 @@ void AIntegrationGameModeBase::LuaCallEnd(InvocationKind kind, int64 place_id) {
LuaCallResult.open(std::string_view(retpk, retpklen));
}
void AIntegrationGameModeBase::LuaCallEnd(InvocationKind kind) {
void ALuprexGameModeBase::LuaCallEnd(InvocationKind kind) {
LuaCallEnd(kind, int64(0));
}
void AIntegrationGameModeBase::LuaCallEnd(InvocationKind kind, AActor *place) {
void ALuprexGameModeBase::LuaCallEnd(InvocationKind kind, AActor *place) {
if (place == nullptr) {
LuaCallEnd(kind, int64(0));
} else {
@@ -191,7 +191,7 @@ void AIntegrationGameModeBase::LuaCallEnd(InvocationKind kind, AActor *place) {
}
}
void AIntegrationGameModeBase::ExecuteDebuggingCommand(FlxLockedWrapper &w, const FString &fs) {
void ALuprexGameModeBase::ExecuteDebuggingCommand(FlxLockedWrapper &w, const FString &fs) {
if (fs == "\\invokeplayer") {
DPrint(TEXT("Trying to invoke 'myfunction' in lua"));
FlxStreamBuffer &sb = LuaCallBegin();
@@ -209,7 +209,7 @@ void AIntegrationGameModeBase::ExecuteDebuggingCommand(FlxLockedWrapper &w, cons
}
}
void AIntegrationGameModeBase::ConsoleSendInput(const FString& fs)
void ALuprexGameModeBase::ConsoleSendInput(const FString& fs)
{
if (fs.IsEmpty()) {
return;
@@ -233,7 +233,7 @@ void AIntegrationGameModeBase::ConsoleSendInput(const FString& fs)
}
}
void AIntegrationGameModeBase::OnWorldPreActorTick(UWorld* InWorld, ELevelTick InLevelTick, float deltaseconds)
void ALuprexGameModeBase::OnWorldPreActorTick(UWorld* InWorld, ELevelTick InLevelTick, float deltaseconds)
{
if(Playing && (GetWorld() == InWorld) && (InLevelTick == LEVELTICK_All))
{
@@ -246,7 +246,7 @@ void AIntegrationGameModeBase::OnWorldPreActorTick(UWorld* InWorld, ELevelTick I
}
}
void AIntegrationGameModeBase::OnWorldPostActorTick(UWorld* InWorld, ELevelTick InLevelTick, float deltaseconds)
void ALuprexGameModeBase::OnWorldPostActorTick(UWorld* InWorld, ELevelTick InLevelTick, float deltaseconds)
{
if(Playing && (GetWorld() == InWorld) && (InLevelTick == LEVELTICK_All))
{
@@ -255,12 +255,12 @@ void AIntegrationGameModeBase::OnWorldPostActorTick(UWorld* InWorld, ELevelTick
}
void AIntegrationGameModeBase::Tick(float deltaseconds)
void ALuprexGameModeBase::Tick(float deltaseconds)
{
Super::Tick(deltaseconds);
}
void AIntegrationGameModeBase::BeginPlay()
void ALuprexGameModeBase::BeginPlay()
{
Super::BeginPlay();
@@ -330,29 +330,29 @@ void AIntegrationGameModeBase::BeginPlay()
new FlxDebugBlueprintErrorsOutputDevice(BreakToDebuggerLogVerbosity));
}
void AIntegrationGameModeBase::EndPlay(const EEndPlayReason::Type EndPlayReason)
void ALuprexGameModeBase::EndPlay(const EEndPlayReason::Type EndPlayReason)
{
ResetToInitialState();
}
int64 AIntegrationGameModeBase::GetPlayerId() {
int64 ALuprexGameModeBase::GetPlayerId() {
return PlayerId;
}
AIntegrationGameModeBase *AIntegrationGameModeBase::GetLuprexGameMode(UObject *context) {
AIntegrationGameModeBase *result = context->GetWorld()->GetAuthGameMode<AIntegrationGameModeBase>();
ALuprexGameModeBase *ALuprexGameModeBase::FromContext(UObject *context) {
ALuprexGameModeBase *result = context->GetWorld()->GetAuthGameMode<ALuprexGameModeBase>();
if (result == nullptr) {
UE_LOG(LogBlueprint, Fatal, TEXT("Not currently using a Luprex Game Mode."));
}
return result;
}
bool AIntegrationGameModeBase::IsLookAtChanged(UObject *context) {
AIntegrationGameModeBase *mode = GetLuprexGameMode(context);
bool ALuprexGameModeBase::IsLookAtChanged(UObject *context) {
ALuprexGameModeBase *mode = FromContext(context);
return mode->CurrentLookAt.HitObjectHandle != mode->PreviousLookAt.HitObjectHandle;
}
void AIntegrationGameModeBase::UpdateLookAt() {
void ALuprexGameModeBase::UpdateLookAt() {
// Rotate the variables.
PreviousLookAt = CurrentLookAt;
CurrentLookAt.Init();

View File

@@ -11,7 +11,7 @@
#include "LuprexSockets.h"
#include "TriggeredTask.h"
#include "BlueprintErrors.h"
#include "IntegrationGameModeBase.generated.h"
#include "LuprexGameModeBase.generated.h"
class LookAtDetector;
@@ -20,13 +20,13 @@ class LookAtDetector;
*
*/
UCLASS()
class INTEGRATION_API AIntegrationGameModeBase : public AGameModeBase, public FRunnable
class INTEGRATION_API ALuprexGameModeBase : public AGameModeBase, public FRunnable
{
GENERATED_BODY()
public:
AIntegrationGameModeBase();
~AIntegrationGameModeBase();
ALuprexGameModeBase();
~ALuprexGameModeBase();
virtual void BeginPlay() override;
virtual void Tick(float) override;
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason);
@@ -46,23 +46,20 @@ public:
UFUNCTION(BlueprintCallable, Category = "Luprex|Miscellaneous")
int64 GetPlayerId();
UFUNCTION(BlueprintPure, meta = (CompactNodeTitle="LxGameMode", WorldContext = "context"), Category = "Luprex|Miscellaneous")
static AIntegrationGameModeBase *GetLuprexGameMode(UObject *context);
UFUNCTION(BlueprintCallable, meta = (WorldContext = "context"),Category = "Luprex|Look-At Detection")
static void SetLookAt(UObject *context, const FHitResult &hit) { GetLuprexGameMode(context)->CurrentLookAt = hit; }
static void SetLookAt(UObject *context, const FHitResult &hit) { FromContext(context)->CurrentLookAt = hit; }
UFUNCTION(BlueprintPure, meta = (WorldContext = "context"),Category = "Luprex|Look-At Detection")
static const FHitResult &GetLookAt(UObject *context) { return GetLuprexGameMode(context)->CurrentLookAt; }
static const FHitResult &GetLookAt(UObject *context) { return FromContext(context)->CurrentLookAt; }
UFUNCTION(BlueprintPure, meta = (WorldContext = "context"),Category = "Luprex|Look-At Detection")
static const AActor *GetLookAtActor(UObject *context) { return GetLuprexGameMode(context)->CurrentLookAt.GetActor(); }
static const AActor *GetLookAtActor(UObject *context) { return FromContext(context)->CurrentLookAt.GetActor(); }
UFUNCTION(BlueprintPure, meta = (WorldContext = "context"),Category = "Luprex|Look-At Detection")
static const FHitResult &GetPreviousLookAt(UObject *context) { return GetLuprexGameMode(context)->PreviousLookAt; }
static const FHitResult &GetPreviousLookAt(UObject *context) { return FromContext(context)->PreviousLookAt; }
UFUNCTION(BlueprintPure, meta = (WorldContext = "context"),Category = "Luprex|Look-At Detection")
static const AActor *GetPreviousLookAtActor(UObject *context) { return GetLuprexGameMode(context)->PreviousLookAt.GetActor(); }
static const AActor *GetPreviousLookAtActor(UObject *context) { return FromContext(context)->PreviousLookAt.GetActor(); }
UFUNCTION(BlueprintPure, meta = (WorldContext = "context"),Category = "Luprex|Look-At Detection")
static bool IsLookAtChanged(UObject *context);
@@ -118,6 +115,10 @@ public:
// to update luprex sockets and update luprex itself.
virtual uint32 Run() override;
// Get the current Luprex Game Mode Base, given a context object.
static ALuprexGameModeBase *FromContext(UObject *context);
UPROPERTY()
UlxTangibleManager *TangibleManager;

View File

@@ -3,7 +3,7 @@
#include "Tangible.h"
#include "TangibleManager.h"
#include "IntegrationGameModeBase.h"
#include "LuprexGameModeBase.h"
#define DEFAULT_BLUEPRINT (TEXT("TangibleStaticMesh"))
#define LOCTEXT_NAMESPACE "Luprex Tangible"
@@ -193,7 +193,7 @@ void UlxTangible::SetTangiblePlane(AActor* target, const FString& plane) {
bool UlxTangible::IsCurrentPlayer(AActor* target) {
UlxTangible *tan = GetActorTangibleQuiet(target);
if (tan == nullptr) return false;
AIntegrationGameModeBase *gamemode = tan->Manager->GetGameMode();
ALuprexGameModeBase *gamemode = tan->Manager->GetGameMode();
return (tan->TangibleId == gamemode->PlayerId);
}

View File

@@ -4,7 +4,7 @@
#include "TangibleManager.h"
#include "Tangible.h"
#include "DebugPrint.h"
#include "IntegrationGameModeBase.h"
#include "LuprexGameModeBase.h"
using namespace DebugPrint;
using TanArray = UlxTangibleManager::TanArray;
@@ -53,7 +53,7 @@ UlxTangibleManager::UlxTangibleManager() {
PossessedTangible = nullptr;
}
void UlxTangibleManager::Init(UWorld* world, AIntegrationGameModeBase *gamemode) {
void UlxTangibleManager::Init(UWorld* world, ALuprexGameModeBase *gamemode) {
World = world;
GameMode = gamemode;
}

View File

@@ -8,7 +8,7 @@
#include "Tangible.h"
#include "TangibleManager.generated.h"
class AIntegrationGameModeBase;
class ALuprexGameModeBase;
UCLASS()
class INTEGRATION_API UlxTangibleManager : public UObject
@@ -27,7 +27,7 @@ public:
// A pointer to our game mode.
UPROPERTY()
TWeakObjectPtr<AIntegrationGameModeBase> GameMode;
TWeakObjectPtr<ALuprexGameModeBase> GameMode;
// Given a tangible ID, look up the TangibleComponent of that actor.
UPROPERTY()
@@ -41,14 +41,14 @@ public:
// Initialize the tangible manager.
//
void Init(UWorld *world, AIntegrationGameModeBase *gamemode);
void Init(UWorld *world, ALuprexGameModeBase *gamemode);
// Get a pointer to our world.
//
UWorld* GetWorld() const override { return World.Get(); }
// Get a pointer to our game mode.
AIntegrationGameModeBase *GetGameMode() { return GameMode.Get(); }
ALuprexGameModeBase *GetGameMode() { return GameMode.Get(); }
// Get the tangible if it exists, otherwise return NULL
//