Changing drv_invoke to drv_call_function

This commit is contained in:
2024-09-03 21:57:40 -04:00
parent 328451c0a4
commit 9f0f96556f
6 changed files with 19 additions and 14 deletions

View File

@@ -43,7 +43,7 @@ AIntegrationGameModeBase::~AIntegrationGameModeBase()
uint32 AIntegrationGameModeBase::Run() { uint32 AIntegrationGameModeBase::Run() {
FlxLockedWrapper lockedwrap(LockableWrapper); FlxLockedWrapper lockedwrap(LockableWrapper);
Sockets->Update(lockedwrap); Sockets->Update(lockedwrap);
lockedwrap->play_invoke_event_update(lockedwrap.Get(), EngineSeconds); lockedwrap->play_update(lockedwrap.Get(), EngineSeconds);
Sockets->Update(lockedwrap); Sockets->Update(lockedwrap);
return 0; return 0;
} }
@@ -156,14 +156,17 @@ void AIntegrationGameModeBase::UpdateTangibles() {
// std::string_view datapk = sb.view(); // std::string_view datapk = sb.view();
// FlxLockedWrapper w(LockableWrapper); // FlxLockedWrapper w(LockableWrapper);
// int64 player = w.GetActor(); // int64 player = w.GetActor();
// w->play_invoke_lua_call(w.Get(), player, datapk.size(), datapk.data()); // w->play_call_function_lua_call(w.Get(), player, datapk.size(), datapk.data());
// } // }
void AIntegrationGameModeBase::LuaCallInvoke(bool background) { void AIntegrationGameModeBase::LuaCallInvoke(AActor *place) {
std::string_view datapk = LuaCallBuffer.view(); std::string_view datapk = LuaCallBuffer.view();
FlxLockedWrapper w(LockableWrapper); FlxLockedWrapper w(LockableWrapper);
int64 player = w.GetActor(); int64_t place_id = w.GetActor();
w->play_invoke_lua_call(w.Get(), player, datapk.size(), datapk.data()); if (place != nullptr) {
place_id = UlxTangible::GetActorTangible(place)->TangibleId;
}
w->play_call_function(w.Get(), InvocationKind::LUA_CALL, place_id, datapk.size(), datapk.data());
} }
void AIntegrationGameModeBase::ExecuteDebuggingCommand(FlxLockedWrapper &w, const FString &fs) { void AIntegrationGameModeBase::ExecuteDebuggingCommand(FlxLockedWrapper &w, const FString &fs) {
@@ -180,13 +183,12 @@ void AIntegrationGameModeBase::ExecuteDebuggingCommand(FlxLockedWrapper &w, cons
sb.write_fvector(FVector(2,3,4)); sb.write_fvector(FVector(2,3,4));
std::string_view datapk = sb.view(); std::string_view datapk = sb.view();
int64 player = w.GetActor(); int64 player = w.GetActor();
w->play_invoke_lua_call(w.Get(), player, datapk.size(), datapk.data()); w->play_call_function(w.Get(), InvocationKind::LUA_CALL, player, datapk.size(), datapk.data());
} else { } else {
ConsoleOutput.AppendLine(TEXT("Unknown Command")); ConsoleOutput.AppendLine(TEXT("Unknown Command"));
} }
} }
void AIntegrationGameModeBase::ConsoleSendInput(const FString& fs) void AIntegrationGameModeBase::ConsoleSendInput(const FString& fs)
{ {
if (fs.IsEmpty()) { if (fs.IsEmpty()) {

View File

@@ -53,7 +53,7 @@ public:
// //
void LuaCallBegin() { LuaCallBuffer.clear(); } void LuaCallBegin() { LuaCallBuffer.clear(); }
FlxStreamBuffer &LuaCallGetBuffer() { return LuaCallBuffer; } FlxStreamBuffer &LuaCallGetBuffer() { return LuaCallBuffer; }
void LuaCallInvoke(bool background); void LuaCallInvoke(AActor *place);
// Execute a debugging command, typed on the GUI. // Execute a debugging command, typed on the GUI.
void ExecuteDebuggingCommand(FlxLockedWrapper &w, const FString &fs); void ExecuteDebuggingCommand(FlxLockedWrapper &w, const FString &fs);

View File

@@ -2,7 +2,6 @@
#include "LuaCall.h" #include "LuaCall.h"
#include "IntegrationGameModeBase.h" #include "IntegrationGameModeBase.h"
static void CheckNotEmpty(const FlxStreamBuffer &sb) { static void CheckNotEmpty(const FlxStreamBuffer &sb) {
if (sb.empty()) { if (sb.empty()) {
UE_LOG(LogBlueprint, Fatal, TEXT("Must use LuaCallBegin before other LuaCall steps")); UE_LOG(LogBlueprint, Fatal, TEXT("Must use LuaCallBegin before other LuaCall steps"));
@@ -54,11 +53,11 @@ void UlxLuaCallLibrary::LuaCallAddBooleanParameter(UObject *context, bool pbool)
} }
void UlxLuaCallLibrary::LuaCallInvoke(UObject *context, bool background) { void UlxLuaCallLibrary::LuaCallInvoke(UObject *context, AActor *place) {
AIntegrationGameModeBase *mode = AIntegrationGameModeBase::GetFromContext(context); AIntegrationGameModeBase *mode = AIntegrationGameModeBase::GetFromContext(context);
FlxStreamBuffer &sb = mode->LuaCallGetBuffer(); FlxStreamBuffer &sb = mode->LuaCallGetBuffer();
CheckNotEmpty(sb); CheckNotEmpty(sb);
mode->LuaCallInvoke(true); mode->LuaCallInvoke(place);
} }
@@ -74,5 +73,5 @@ void UlxLuaCallLibrary::InvokeEngioMove(UObject *context, const FString &action,
sb.write_fvector(xyz); sb.write_fvector(xyz);
sb.write_simple_dynamic_tag(SimpleDynamicTag::NUMBER); sb.write_simple_dynamic_tag(SimpleDynamicTag::NUMBER);
sb.write_double(facing); sb.write_double(facing);
mode->LuaCallInvoke(true); mode->LuaCallInvoke(nullptr);
} }

View File

@@ -33,7 +33,7 @@ public:
static void LuaCallAddBooleanParameter(UObject *context, bool pbool); static void LuaCallAddBooleanParameter(UObject *context, bool pbool);
UFUNCTION(BlueprintCallable, meta = (WorldContext = "context"), Category = Luprex) UFUNCTION(BlueprintCallable, meta = (WorldContext = "context"), Category = Luprex)
static void LuaCallInvoke(UObject *context, bool background); static void LuaCallInvoke(UObject *context, AActor *place);
UFUNCTION(BlueprintCallable, meta = (WorldContext = "context"), Category = Luprex) UFUNCTION(BlueprintCallable, meta = (WorldContext = "context"), Category = Luprex)
static void InvokeEngioMove(UObject *context, const FString &action, const FVector &xyz, double facing); static void InvokeEngioMove(UObject *context, const FString &action, const FVector &xyz, double facing);

View File

@@ -137,7 +137,7 @@ void UlxTangible::Destroy() {
NearAccordingToUnreal = false; NearAccordingToUnreal = false;
} }
static UlxTangible *GetActorTangible(AActor *actor) { UlxTangible *UlxTangible::GetActorTangible(AActor *actor) {
UlxTangibleComponent* comp = actor->GetComponentByClass<UlxTangibleComponent>(); UlxTangibleComponent* comp = actor->GetComponentByClass<UlxTangibleComponent>();
check(comp != nullptr); check(comp != nullptr);
UlxTangible *result = comp->Tangible.Get(); UlxTangible *result = comp->Tangible.Get();

View File

@@ -142,6 +142,10 @@ public:
// //
void MaybeExecuteAnimStateChanged(); void MaybeExecuteAnimStateChanged();
// Convert an actor to a tangible.
//
static UlxTangible *GetActorTangible(AActor *actor);
private: private:
// Set the actor's blueprint, and recreate the actor if necessary. // Set the actor's blueprint, and recreate the actor if necessary.
// //