diff --git a/Source/Integration/IntegrationGameModeBase.cpp b/Source/Integration/IntegrationGameModeBase.cpp index af56ec8e..29674ce4 100644 --- a/Source/Integration/IntegrationGameModeBase.cpp +++ b/Source/Integration/IntegrationGameModeBase.cpp @@ -43,7 +43,7 @@ AIntegrationGameModeBase::~AIntegrationGameModeBase() uint32 AIntegrationGameModeBase::Run() { FlxLockedWrapper lockedwrap(LockableWrapper); Sockets->Update(lockedwrap); - lockedwrap->play_invoke_event_update(lockedwrap.Get(), EngineSeconds); + lockedwrap->play_update(lockedwrap.Get(), EngineSeconds); Sockets->Update(lockedwrap); return 0; } @@ -156,14 +156,17 @@ void AIntegrationGameModeBase::UpdateTangibles() { // std::string_view datapk = sb.view(); // FlxLockedWrapper w(LockableWrapper); // 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(); FlxLockedWrapper w(LockableWrapper); - int64 player = w.GetActor(); - w->play_invoke_lua_call(w.Get(), player, datapk.size(), datapk.data()); + int64_t place_id = w.GetActor(); + 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) { @@ -180,13 +183,12 @@ void AIntegrationGameModeBase::ExecuteDebuggingCommand(FlxLockedWrapper &w, cons sb.write_fvector(FVector(2,3,4)); std::string_view datapk = sb.view(); 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 { ConsoleOutput.AppendLine(TEXT("Unknown Command")); } } - void AIntegrationGameModeBase::ConsoleSendInput(const FString& fs) { if (fs.IsEmpty()) { diff --git a/Source/Integration/IntegrationGameModeBase.h b/Source/Integration/IntegrationGameModeBase.h index 2f053026..7c16ebbd 100644 --- a/Source/Integration/IntegrationGameModeBase.h +++ b/Source/Integration/IntegrationGameModeBase.h @@ -53,7 +53,7 @@ public: // void LuaCallBegin() { LuaCallBuffer.clear(); } FlxStreamBuffer &LuaCallGetBuffer() { return LuaCallBuffer; } - void LuaCallInvoke(bool background); + void LuaCallInvoke(AActor *place); // Execute a debugging command, typed on the GUI. void ExecuteDebuggingCommand(FlxLockedWrapper &w, const FString &fs); diff --git a/Source/Integration/LuaCall.cpp b/Source/Integration/LuaCall.cpp index f090a69a..05ef2987 100644 --- a/Source/Integration/LuaCall.cpp +++ b/Source/Integration/LuaCall.cpp @@ -2,7 +2,6 @@ #include "LuaCall.h" #include "IntegrationGameModeBase.h" - static void CheckNotEmpty(const FlxStreamBuffer &sb) { if (sb.empty()) { 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); FlxStreamBuffer &sb = mode->LuaCallGetBuffer(); 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_simple_dynamic_tag(SimpleDynamicTag::NUMBER); sb.write_double(facing); - mode->LuaCallInvoke(true); + mode->LuaCallInvoke(nullptr); } diff --git a/Source/Integration/LuaCall.h b/Source/Integration/LuaCall.h index 0b94d9f1..b3560ce0 100644 --- a/Source/Integration/LuaCall.h +++ b/Source/Integration/LuaCall.h @@ -33,7 +33,7 @@ public: static void LuaCallAddBooleanParameter(UObject *context, bool pbool); 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) static void InvokeEngioMove(UObject *context, const FString &action, const FVector &xyz, double facing); diff --git a/Source/Integration/Tangible.cpp b/Source/Integration/Tangible.cpp index d4100f3b..06d22f71 100644 --- a/Source/Integration/Tangible.cpp +++ b/Source/Integration/Tangible.cpp @@ -137,7 +137,7 @@ void UlxTangible::Destroy() { NearAccordingToUnreal = false; } -static UlxTangible *GetActorTangible(AActor *actor) { +UlxTangible *UlxTangible::GetActorTangible(AActor *actor) { UlxTangibleComponent* comp = actor->GetComponentByClass(); check(comp != nullptr); UlxTangible *result = comp->Tangible.Get(); diff --git a/Source/Integration/Tangible.h b/Source/Integration/Tangible.h index f3293b95..597ed572 100644 --- a/Source/Integration/Tangible.h +++ b/Source/Integration/Tangible.h @@ -142,6 +142,10 @@ public: // void MaybeExecuteAnimStateChanged(); + // Convert an actor to a tangible. + // + static UlxTangible *GetActorTangible(AActor *actor); + private: // Set the actor's blueprint, and recreate the actor if necessary. //