Added LuaCall.h

This commit is contained in:
2024-08-31 16:42:07 -04:00
parent a61a74a7b0
commit f7b381a5f6
5 changed files with 185 additions and 15 deletions

View File

@@ -6,6 +6,7 @@
#include "GameFramework/GameModeBase.h"
#include "lpx-enginewrapper.hpp"
#include "DebugPrint.h"
#include "StringDecoder.h"
#include "TangibleManager.h"
#include "LuprexSockets.h"
#include "TriggeredTask.h"
@@ -42,8 +43,17 @@ public:
UFUNCTION(BlueprintCallable, Category = "Luprex")
int64 GetPlayerId();
UFUNCTION(BlueprintCallable, Category = "Luprex")
void InvokeEngioMove(const FString &action, const FVector &xyz, double facing);
// Assemble a lua call. To call into lua:
//
// * Use LuaCallBegin
// * Get the lua call buffer.
// * Add a class name and a function name to the buffer.
// * Add parameters to the buffer.
// * Use LuaCallInvoke.
//
void LuaCallBegin() { LuaCallBuffer.clear(); }
FlxStreamBuffer &LuaCallGetBuffer() { return LuaCallBuffer; }
void LuaCallInvoke(bool background);
// Execute a debugging command, typed on the GUI.
void ExecuteDebuggingCommand(FlxLockedWrapper &w, const FString &fs);
@@ -62,6 +72,11 @@ public:
// to update luprex sockets and update luprex itself.
virtual uint32 Run() override;
// Get the AIntegrationGameModeBase given any UObject
// If there is no AIntegrationGameModeBase in that world context, fatal error
static AIntegrationGameModeBase *GetFromWorld(UWorld *world);
static AIntegrationGameModeBase *GetFromContext(UObject *context);
UPROPERTY()
UlxTangibleManager *TangibleManager;
@@ -72,6 +87,9 @@ public:
// To access it, construct a FlxLockedWrapper.
FlxLockableWrapper LockableWrapper;
// The Lua Call assembly buffer.
FlxStreamBuffer LuaCallBuffer;
// This utility runs the luprex update and socket update in a thread.
FTriggeredTask LuprexUpdateTask;