2023-06-08 17:10:14 -04:00
|
|
|
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "CoreMinimal.h"
|
|
|
|
|
#include "GameFramework/GameModeBase.h"
|
2023-09-04 03:27:31 -04:00
|
|
|
#include "LuprexSockets.h"
|
2026-02-14 01:25:04 -05:00
|
|
|
#include "BreakToDebugger.h"
|
2025-03-17 18:04:55 -04:00
|
|
|
#include "LuprexGameModeBase.generated.h"
|
2023-06-08 17:10:14 -04:00
|
|
|
|
|
|
|
|
/**
|
2026-02-25 14:48:14 -05:00
|
|
|
*
|
2023-06-08 17:10:14 -04:00
|
|
|
*/
|
2025-04-07 16:48:27 -04:00
|
|
|
UCLASS(BlueprintType)
|
2026-02-27 17:49:29 -05:00
|
|
|
class INTEGRATION_API ALuprexGameModeBase : public AGameModeBase
|
2023-06-08 17:10:14 -04:00
|
|
|
{
|
|
|
|
|
GENERATED_BODY()
|
|
|
|
|
|
|
|
|
|
public:
|
2025-03-17 18:04:55 -04:00
|
|
|
ALuprexGameModeBase();
|
|
|
|
|
~ALuprexGameModeBase();
|
2023-06-08 17:10:14 -04:00
|
|
|
virtual void BeginPlay() override;
|
2023-06-09 16:47:46 -04:00
|
|
|
virtual void EndPlay(const EEndPlayReason::Type EndPlayReason);
|
2023-06-08 17:10:14 -04:00
|
|
|
|
2023-06-23 16:27:23 -04:00
|
|
|
// Delete all the state created in BeginPlay. That
|
|
|
|
|
// includes: the Luprex engine, the thread, and the socket state.
|
|
|
|
|
void ResetToInitialState();
|
2023-06-22 15:17:49 -04:00
|
|
|
|
2025-03-28 23:31:44 -04:00
|
|
|
// Initialize the Luprex DLL, and do other global initialization.
|
|
|
|
|
void InitializeGlobalState();
|
|
|
|
|
|
2026-02-09 13:54:00 -05:00
|
|
|
// Send prints into Unreal, for display on the virtual console.
|
2024-09-24 18:58:13 -04:00
|
|
|
UFUNCTION(BlueprintImplementableEvent, Category = "Luprex|Miscellaneous")
|
2025-12-09 02:42:13 -05:00
|
|
|
void ConsoleAddOutput(const FString& text);
|
2023-06-08 17:10:14 -04:00
|
|
|
|
2024-09-24 18:58:13 -04:00
|
|
|
UFUNCTION(BlueprintCallable, Category = "Luprex|Miscellaneous")
|
2024-02-02 15:48:27 -05:00
|
|
|
int64 GetPlayerId();
|
|
|
|
|
|
2023-06-23 12:45:23 -04:00
|
|
|
// Transfer console output from the Luprex engine to unreal.
|
2023-09-05 03:20:11 -04:00
|
|
|
void UpdateConsoleOutput();
|
|
|
|
|
|
2023-09-06 23:25:37 -04:00
|
|
|
// Update the tangibles according to what Luprex tells us.
|
2024-09-11 16:07:47 -04:00
|
|
|
// This also includes calling 'AnimationQueueChanged' on all
|
|
|
|
|
// tangibles that have been changed.
|
2023-09-06 23:25:37 -04:00
|
|
|
void UpdateTangibles();
|
|
|
|
|
|
2025-09-22 16:17:21 -04:00
|
|
|
// Look for a tangible whose ID is equal to the current actor ID.
|
|
|
|
|
// Tell the player controller to possess that tangible.
|
2024-09-11 16:07:47 -04:00
|
|
|
void UpdatePossessedTangible();
|
|
|
|
|
|
2026-02-27 17:49:29 -05:00
|
|
|
// If the engine wants a new copy of the lua source code,
|
|
|
|
|
// provide it.
|
|
|
|
|
void UpdateLuaSourceCode();
|
|
|
|
|
|
|
|
|
|
// Update Sockets and Lua. Feeds socket data into the luprex engine,
|
|
|
|
|
// and also calls play_update, the main Lua update function that causes
|
|
|
|
|
// Luprex to execute the majority of all the Lua code that needs processing.
|
|
|
|
|
void UpdateSocketsAndLua();
|
2023-06-23 12:45:23 -04:00
|
|
|
|
2026-02-27 17:49:29 -05:00
|
|
|
// Post-tick function.
|
|
|
|
|
void OnWorldPostActorTick(UWorld* InWorld, ELevelTick InLevelTick, float InDeltaSeconds);
|
2023-09-04 23:19:10 -04:00
|
|
|
|
2025-04-02 23:22:16 -04:00
|
|
|
// Get the current Luprex Game Mode Base, given a Context object.
|
|
|
|
|
static ALuprexGameModeBase *FromContext(const UObject *Context);
|
2025-03-17 18:04:55 -04:00
|
|
|
|
2024-11-22 23:01:05 -05:00
|
|
|
// The sensitivity level at which a log message triggers a debugger breakpoint.
|
|
|
|
|
UPROPERTY(EditAnywhere, Category="Debugging Tools")
|
2026-02-14 01:25:04 -05:00
|
|
|
ElxBreakToDebuggerThreshold BreakToDebuggerLogVerbosity;
|
2024-11-22 23:01:05 -05:00
|
|
|
|
2026-02-27 17:49:29 -05:00
|
|
|
// Luprex socket system.
|
2023-09-15 13:28:18 -04:00
|
|
|
TUniquePtr<FlxSockets> Sockets;
|
2023-06-23 16:27:23 -04:00
|
|
|
|
2023-09-06 23:25:37 -04:00
|
|
|
// True if 'BeginPlay' has been successfully completed.
|
2026-02-27 17:00:46 -05:00
|
|
|
bool Playing = false;
|
2023-09-06 23:25:37 -04:00
|
|
|
|
2025-08-27 20:57:12 -04:00
|
|
|
// This is always true unless you use the debugger to set it to false.
|
2026-02-27 17:00:46 -05:00
|
|
|
bool TickEnabled = true;
|
2025-08-27 20:57:12 -04:00
|
|
|
|
2024-02-02 15:48:27 -05:00
|
|
|
// Current Player ID
|
2026-02-27 17:00:46 -05:00
|
|
|
int64 PlayerId = 0;
|
2024-02-02 15:48:27 -05:00
|
|
|
|
2023-09-12 15:11:47 -04:00
|
|
|
// Amount of elapsed time since BeginPlay.
|
2026-02-27 17:00:46 -05:00
|
|
|
float EngineSeconds = 0.0f;
|
2023-06-23 12:45:23 -04:00
|
|
|
|
2026-02-27 17:49:29 -05:00
|
|
|
// This allows us to post-tick.
|
2024-02-13 16:49:58 -05:00
|
|
|
FDelegateHandle OnWorldPostActorTickHandle;
|
2024-11-22 23:01:05 -05:00
|
|
|
|
|
|
|
|
// The device that implements BreakToDebuggerLogVerbosity, above.
|
2026-02-14 01:25:04 -05:00
|
|
|
TUniquePtr<FlxBreakToDebuggerOutputDevice> BreakToDebuggerLogVerbosityDevice;
|
2023-06-08 17:10:14 -04:00
|
|
|
};
|