2014-12-07 19:09:38 -05:00
// Copyright 1998-2015 Epic Games, Inc. All Rights Reserved.
2014-06-10 13:56:35 -04:00
# include "GameplayDebuggerPrivate.h"
2014-09-10 05:48:38 -04:00
# include "Misc/CoreMisc.h"
2014-06-10 13:56:35 -04:00
# include "GameplayDebuggingComponent.h"
# include "GameplayDebuggingHUDComponent.h"
# include "GameplayDebuggingReplicator.h"
2014-09-10 05:48:38 -04:00
# include "GameplayDebuggingControllerComponent.h"
# include "AISystem.h"
2014-11-27 08:16:04 -05:00
# include "GameplayDebuggerSettings.h"
2014-10-01 11:49:06 -04:00
# if WITH_EDITOR
# include "Editor/EditorEngine.h"
2014-11-27 08:16:04 -05:00
# include "ISettingsModule.h"
# include "LevelEditor.h"
2014-10-01 11:49:06 -04:00
# endif // WITH_EDITOR
2014-06-10 13:56:35 -04:00
2014-11-27 08:16:04 -05:00
# define ADD_LEVEL_EDITOR_EXTENSIONS 0
2014-06-10 13:56:35 -04:00
2014-11-27 08:16:04 -05:00
# define LOCTEXT_NAMESPACE "FGameplayDebugger"
2014-06-25 09:28:40 -04:00
FGameplayDebuggerSettings GameplayDebuggerSettings ( class AGameplayDebuggingReplicator * Replicator )
{
2014-11-27 08:16:04 -05:00
uint32 Settings = UGameplayDebuggerSettings : : StaticClass ( ) - > GetDefaultObject < UGameplayDebuggerSettings > ( ) - > GetSettings ( ) ;
2014-06-25 09:28:40 -04:00
return FGameplayDebuggerSettings ( Replicator = = NULL ? Settings : Replicator - > DebuggerShowFlags ) ;
}
2014-09-10 05:48:38 -04:00
class FGameplayDebugger : public FSelfRegisteringExec , public IGameplayDebugger
2014-06-10 13:56:35 -04:00
{
public :
// Begin IModuleInterface
virtual void StartupModule ( ) override ;
virtual void ShutdownModule ( ) override ;
// End IModuleInterface
void WorldAdded ( UWorld * InWorld ) ;
void WorldDestroyed ( UWorld * InWorld ) ;
2014-07-09 13:07:54 -04:00
# if WITH_EDITOR
2014-06-10 13:56:35 -04:00
void OnLevelActorAdded ( AActor * InActor ) ;
void OnLevelActorDeleted ( AActor * InActor ) ;
2014-11-27 08:16:04 -05:00
TSharedRef < FExtender > OnExtendLevelEditorViewMenu ( const TSharedRef < FUICommandList > CommandList ) ;
void CreateSnappingOptionsMenu ( FMenuBuilder & Builder ) ;
void CreateSettingSubMenu ( FMenuBuilder & Builder ) ;
2014-11-28 09:26:40 -05:00
void HandleExperimentalSettingChanged ( FName PropertyName ) ;
2014-07-09 13:07:54 -04:00
# endif
2014-07-22 16:23:09 -04:00
2014-08-07 17:34:29 -04:00
TArray < TWeakObjectPtr < AGameplayDebuggingReplicator > > & GetAllReplicators ( UWorld * InWorld ) ;
void AddReplicator ( UWorld * InWorld , AGameplayDebuggingReplicator * InReplicator ) ;
void RemoveReplicator ( UWorld * InWorld , AGameplayDebuggingReplicator * InReplicator ) ;
2014-07-22 16:23:09 -04:00
2014-09-10 05:48:38 -04:00
// Begin FExec Interface
virtual bool Exec ( UWorld * Inworld , const TCHAR * Cmd , FOutputDevice & Ar ) override ;
// End FExec Interface
2014-08-07 17:34:29 -04:00
private :
virtual bool CreateGameplayDebuggerForPlayerController ( APlayerController * PlayerController ) override ;
bool DoesGameplayDebuggingReplicatorExistForPlayerController ( APlayerController * PlayerController ) ;
TMap < TWeakObjectPtr < UWorld > , TArray < TWeakObjectPtr < AGameplayDebuggingReplicator > > > AllReplilcatorsPerWorlds ;
2014-11-27 08:16:04 -05:00
# if WITH_EDITOR
FLevelEditorModule : : FLevelEditorMenuExtender ViewMenuExtender ;
# endif
2014-06-10 13:56:35 -04:00
} ;
IMPLEMENT_MODULE ( FGameplayDebugger , GameplayDebugger )
// This code will execute after your module is loaded into memory (but after global variables are initialized, of course.)
void FGameplayDebugger : : StartupModule ( )
{
# if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
if ( GEngine )
{
GEngine - > OnWorldAdded ( ) . AddRaw ( this , & FGameplayDebugger : : WorldAdded ) ;
GEngine - > OnWorldDestroyed ( ) . AddRaw ( this , & FGameplayDebugger : : WorldDestroyed ) ;
2014-07-09 13:07:54 -04:00
# if WITH_EDITOR
2014-06-10 13:56:35 -04:00
GEngine - > OnLevelActorAdded ( ) . AddRaw ( this , & FGameplayDebugger : : OnLevelActorAdded ) ;
GEngine - > OnLevelActorDeleted ( ) . AddRaw ( this , & FGameplayDebugger : : OnLevelActorDeleted ) ;
2014-11-27 08:16:04 -05:00
2014-11-28 09:26:40 -05:00
UEditorExperimentalSettings : : StaticClass ( ) - > GetDefaultObject < UEditorExperimentalSettings > ( ) - > OnSettingChanged ( ) . AddRaw ( this , & FGameplayDebugger : : HandleExperimentalSettingChanged ) ;
2014-11-27 08:16:04 -05:00
ISettingsModule * SettingsModule = FModuleManager : : GetModulePtr < ISettingsModule > ( " Settings " ) ;
if ( SettingsModule ! = nullptr )
{
2014-11-28 09:26:40 -05:00
SettingsModule - > RegisterSettings ( " Editor " , " General " , " GameplayDebugger " ,
LOCTEXT ( " AIToolsSettingsName " , " Gameplay Debugger " ) ,
2014-11-27 08:16:04 -05:00
LOCTEXT ( " AIToolsSettingsDescription " , " General settings for UE4 AI Tools. " ) ,
UGameplayDebuggerSettings : : StaticClass ( ) - > GetDefaultObject ( )
) ;
}
# if ADD_LEVEL_EDITOR_EXTENSIONS
if ( ! IsRunningCommandlet ( ) )
{
// Register the extension with the level editor
{
ViewMenuExtender = FLevelEditorModule : : FLevelEditorMenuExtender : : CreateRaw ( this , & FGameplayDebugger : : OnExtendLevelEditorViewMenu ) ;
FLevelEditorModule * LevelEditor = FModuleManager : : LoadModulePtr < FLevelEditorModule > ( TEXT ( " LevelEditor " ) ) ;
if ( LevelEditor )
{
LevelEditor - > GetAllLevelViewportOptionsMenuExtenders ( ) . Add ( ViewMenuExtender ) ;
}
}
}
# endif //ADD_LEVEL_EDITOR_EXTENSIONS
2014-07-09 13:07:54 -04:00
# endif
2014-06-10 13:56:35 -04:00
}
# endif
}
// This function may be called during shutdown to clean up your module. For modules that support dynamic reloading,
// we call this function before unloading the module.
void FGameplayDebugger : : ShutdownModule ( )
{
# if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
if ( GEngine )
{
GEngine - > OnWorldAdded ( ) . RemoveAll ( this ) ;
GEngine - > OnWorldDestroyed ( ) . RemoveAll ( this ) ;
2014-07-09 13:07:54 -04:00
# if WITH_EDITOR
2014-06-10 13:56:35 -04:00
GEngine - > OnLevelActorAdded ( ) . RemoveAll ( this ) ;
GEngine - > OnLevelActorDeleted ( ) . RemoveAll ( this ) ;
2014-11-27 08:16:04 -05:00
2014-11-28 09:26:40 -05:00
UEditorExperimentalSettings : : StaticClass ( ) - > GetDefaultObject < UEditorExperimentalSettings > ( ) - > OnSettingChanged ( ) . RemoveAll ( this ) ;
2014-11-27 08:16:04 -05:00
ISettingsModule * SettingsModule = FModuleManager : : GetModulePtr < ISettingsModule > ( " Settings " ) ;
if ( SettingsModule ! = nullptr )
{
2014-11-28 09:26:40 -05:00
SettingsModule - > UnregisterSettings ( " Editor " , " General " , " GameplayDebugger " ) ;
2014-11-27 08:16:04 -05:00
}
# if ADD_LEVEL_EDITOR_EXTENSIONS
if ( UObjectInitialized ( ) & & ! IsRunningCommandlet ( ) )
{
// Unregister the level editor extensions
{
FLevelEditorModule * LevelEditor = FModuleManager : : LoadModulePtr < FLevelEditorModule > ( TEXT ( " LevelEditor " ) ) ;
if ( LevelEditor )
{
LevelEditor - > GetAllLevelViewportOptionsMenuExtenders ( ) . Remove ( ViewMenuExtender ) ;
}
}
}
# endif //ADD_LEVEL_EDITOR_EXTENSIONS
2014-07-09 13:07:54 -04:00
# endif
2014-06-10 13:56:35 -04:00
}
# endif
}
2014-11-27 08:16:04 -05:00
# if WITH_EDITOR
2014-11-28 09:26:40 -05:00
void FGameplayDebugger : : HandleExperimentalSettingChanged ( FName PropertyName )
{
if ( PropertyName = = TEXT ( " bGameplayDebugger " ) )
{
if ( UEditorExperimentalSettings : : StaticClass ( ) - > GetDefaultObject < UEditorExperimentalSettings > ( ) - > bGameplayDebugger = = false )
{
ISettingsModule * SettingsModule = FModuleManager : : GetModulePtr < ISettingsModule > ( " Settings " ) ;
if ( SettingsModule ! = nullptr )
{
SettingsModule - > UnregisterSettings ( " Editor " , " General " , " GameplayDebugger " ) ;
}
}
else
{
ISettingsModule * SettingsModule = FModuleManager : : GetModulePtr < ISettingsModule > ( " Settings " ) ;
if ( SettingsModule ! = nullptr )
{
SettingsModule - > RegisterSettings ( " Editor " , " General " , " GameplayDebugger " ,
LOCTEXT ( " AIToolsSettingsName " , " Gameplay Debugger " ) ,
LOCTEXT ( " AIToolsSettingsDescription " , " General settings for UE4 AI Tools. " ) ,
UGameplayDebuggerSettings : : StaticClass ( ) - > GetDefaultObject ( )
) ;
}
}
}
//FLevelEditorModule& LevelEditorModule = FModuleManager::GetModuleChecked<FLevelEditorModule>("LevelEditor");
//TSharedPtr<FTabManager> LevelEditorTabManager = LevelEditorModule.GetLevelEditorTabManager();
//LevelEditorTabManager->UpdateMainMenu(true);
}
2014-11-27 08:16:04 -05:00
void FGameplayDebugger : : CreateSettingSubMenu ( FMenuBuilder & Builder )
{
# if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
Builder . AddMenuEntry (
LOCTEXT ( " Test_GameplayDebugger_Menu " , " Test Gameplay Debugger Option " ) ,
LOCTEXT ( " Test_GameplayDebugger_Menu_Tooltip " , " If Enabled, actors will snap to the nearest location on the constraint plane (NOTE: Only works correctly in perspective views right now!) " ) ,
FSlateIcon ( ) ,
FUIAction (
FExecuteAction ( ) /*FExecuteAction::CreateRaw(PlanarPolicy.Get(), &FPlanarConstraintSnapPolicy::ToggleEnabled)*/ ,
FCanExecuteAction ( ) ,
FIsActionChecked ( ) /*FIsActionChecked::CreateRaw(PlanarPolicy.Get(), &FPlanarConstraintSnapPolicy::IsEnabled)*/
) ,
NAME_None ,
EUserInterfaceActionType : : Button ,
NAME_None ) ;
# endif
}
void FGameplayDebugger : : CreateSnappingOptionsMenu ( FMenuBuilder & Builder )
{
# if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
2014-11-28 09:26:40 -05:00
if ( GCurrentLevelEditingViewportClient & & GCurrentLevelEditingViewportClient - > EngineShowFlags . DebugAI & & GCurrentLevelEditingViewportClient - > IsSimulateInEditorViewport ( ) )
{
Builder . AddMenuSeparator ( ) ;
Builder . AddSubMenu (
LOCTEXT ( " Test_GameplayDebugger_Menu " , " Gameplay Debugger " ) ,
LOCTEXT ( " Test_GameplayDebugger_Menu_Tooltip " , " Quick setting for Gameplay Debugger tool in selected view " ) ,
FNewMenuDelegate : : CreateRaw ( this , & FGameplayDebugger : : CreateSettingSubMenu )
) ;
}
2014-11-27 08:16:04 -05:00
# endif
}
TSharedRef < FExtender > FGameplayDebugger : : OnExtendLevelEditorViewMenu ( const TSharedRef < FUICommandList > CommandList )
{
# if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
TSharedRef < FExtender > Extender ( new FExtender ( ) ) ;
Extender - > AddMenuExtension (
" LevelViewportLayouts " ,
EExtensionHook : : After ,
NULL ,
FMenuExtensionDelegate : : CreateRaw ( this , & FGameplayDebugger : : CreateSnappingOptionsMenu ) ) ;
return Extender ;
# endif
}
# endif
2014-08-07 17:34:29 -04:00
bool FGameplayDebugger : : DoesGameplayDebuggingReplicatorExistForPlayerController ( APlayerController * PlayerController )
2014-07-22 16:23:09 -04:00
{
# if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
if ( PlayerController = = NULL )
{
return false ;
}
UWorld * World = PlayerController - > GetWorld ( ) ;
if ( World = = NULL )
{
return false ;
}
2014-08-07 17:34:29 -04:00
for ( auto It = GetAllReplicators ( World ) . CreateConstIterator ( ) ; It ; + + It )
2014-07-22 16:23:09 -04:00
{
2014-08-07 17:34:29 -04:00
TWeakObjectPtr < AGameplayDebuggingReplicator > Replicator = * It ;
if ( Replicator . IsValid ( ) )
2014-07-22 16:23:09 -04:00
{
if ( Replicator - > GetLocalPlayerOwner ( ) = = PlayerController )
{
return true ;
}
}
}
# endif
return false ;
}
2014-08-07 17:34:29 -04:00
bool FGameplayDebugger : : CreateGameplayDebuggerForPlayerController ( APlayerController * PlayerController )
2014-07-22 16:23:09 -04:00
{
# if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
if ( PlayerController = = NULL )
{
return false ;
}
bool bIsServer = PlayerController - > GetNetMode ( ) < ENetMode : : NM_Client ; // (Only create on some sort of server)
if ( ! bIsServer )
{
return false ;
}
UWorld * World = PlayerController - > GetWorld ( ) ;
if ( World = = NULL )
{
return false ;
}
if ( DoesGameplayDebuggingReplicatorExistForPlayerController ( PlayerController ) )
{
// No need to create one if we already have one.
return false ;
}
FActorSpawnParameters SpawnInfo ;
SpawnInfo . bNoCollisionFail = true ;
SpawnInfo . Name = * FString : : Printf ( TEXT ( " GameplayDebuggingReplicator_%s " ) , * PlayerController - > GetName ( ) ) ;
AGameplayDebuggingReplicator * DestActor = World - > SpawnActor < AGameplayDebuggingReplicator > ( SpawnInfo ) ;
if ( DestActor ! = NULL )
{
DestActor - > SetLocalPlayerOwner ( PlayerController ) ;
DestActor - > SetReplicates ( true ) ;
2014-08-07 17:34:29 -04:00
DestActor - > SetAsGlobalInWorld ( false ) ;
2014-10-01 11:49:06 -04:00
# if WITH_EDITOR
2014-10-01 08:53:33 -04:00
UEditorEngine * EEngine = Cast < UEditorEngine > ( GEngine ) ;
if ( EEngine & & EEngine - > bIsSimulatingInEditor )
{
DestActor - > CreateTool ( ) ;
DestActor - > EnableTool ( ) ;
}
2014-10-01 11:49:06 -04:00
# endif
2014-08-07 17:34:29 -04:00
AddReplicator ( World , DestActor ) ;
2014-07-22 16:23:09 -04:00
return true ;
}
# endif
return false ;
2014-06-10 13:56:35 -04:00
}
2014-08-07 17:34:29 -04:00
TArray < TWeakObjectPtr < AGameplayDebuggingReplicator > > & FGameplayDebugger : : GetAllReplicators ( UWorld * InWorld )
{
return AllReplilcatorsPerWorlds . FindOrAdd ( InWorld ) ;
}
void FGameplayDebugger : : AddReplicator ( UWorld * InWorld , AGameplayDebuggingReplicator * InReplicator )
{
GetAllReplicators ( InWorld ) . Add ( InReplicator ) ;
}
void FGameplayDebugger : : RemoveReplicator ( UWorld * InWorld , AGameplayDebuggingReplicator * InReplicator )
{
GetAllReplicators ( InWorld ) . RemoveSwap ( InReplicator ) ;
}
void FGameplayDebugger : : WorldAdded ( UWorld * InWorld )
{
bool bIsServer = InWorld & & InWorld - > GetNetMode ( ) < ENetMode : : NM_Client ; // (Only server code)
if ( ! bIsServer )
{
return ;
}
2014-11-20 10:16:18 -05:00
if ( InWorld = = NULL | | InWorld - > IsPendingKill ( ) | | InWorld - > IsGameWorld ( ) = = false )
{
return ;
}
2014-08-07 17:34:29 -04:00
for ( auto It = GetAllReplicators ( InWorld ) . CreateConstIterator ( ) ; It ; + + It )
{
TWeakObjectPtr < AGameplayDebuggingReplicator > Replicator = * It ;
if ( Replicator . IsValid ( ) & & Replicator - > IsGlobalInWorld ( ) )
{
// Ok, we have global replicator on level
return ;
}
}
// create global replicator on level
FActorSpawnParameters SpawnInfo ;
SpawnInfo . bNoCollisionFail = true ;
SpawnInfo . Name = * FString : : Printf ( TEXT ( " GameplayDebuggingReplicator_Global " ) ) ;
AGameplayDebuggingReplicator * DestActor = InWorld - > SpawnActor < AGameplayDebuggingReplicator > ( SpawnInfo ) ;
if ( DestActor ! = NULL )
{
DestActor - > SetLocalPlayerOwner ( NULL ) ;
DestActor - > SetReplicates ( false ) ;
DestActor - > SetActorTickEnabled ( true ) ;
DestActor - > SetAsGlobalInWorld ( true ) ;
AddReplicator ( InWorld , DestActor ) ;
}
}
2014-06-10 13:56:35 -04:00
void FGameplayDebugger : : WorldDestroyed ( UWorld * InWorld )
{
2014-08-07 17:34:29 -04:00
bool bIsServer = InWorld & & InWorld - > GetNetMode ( ) < ENetMode : : NM_Client ; // (Only work on server)
if ( ! bIsServer )
{
return ;
}
2014-06-10 13:56:35 -04:00
2014-08-07 17:34:29 -04:00
// remove global replicator from level
AllReplilcatorsPerWorlds . Remove ( InWorld ) ;
2014-06-10 13:56:35 -04:00
}
2014-07-09 13:07:54 -04:00
# if WITH_EDITOR
2014-06-10 13:56:35 -04:00
void FGameplayDebugger : : OnLevelActorAdded ( AActor * InActor )
{
2014-07-22 16:23:09 -04:00
// This function doesn't help much, because it's only called in EDITOR!
// We need a function that is called in the game! So instead of creating it automatically, I'm leaving it
// to be created explicitly by any player controller that needs to create it.
2014-08-07 17:34:29 -04:00
# if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
APlayerController * PC = Cast < APlayerController > ( InActor ) ;
if ( PC & & PC - > GetNetMode ( ) < ENetMode : : NM_Client )
{
CreateGameplayDebuggerForPlayerController ( PC ) ;
}
# endif
2014-06-10 13:56:35 -04:00
}
void FGameplayDebugger : : OnLevelActorDeleted ( AActor * InActor )
{
2014-08-07 17:34:29 -04:00
# if !(UE_BUILD_SHIPPING || UE_BUILD_TEST)
APlayerController * PC = Cast < APlayerController > ( InActor ) ;
if ( ! PC )
{
return ;
}
2014-06-10 13:56:35 -04:00
2014-08-07 17:34:29 -04:00
UWorld * World = PC - > GetWorld ( ) ;
if ( ! World )
{
return ;
}
for ( auto It = GetAllReplicators ( World ) . CreateConstIterator ( ) ; It ; + + It )
{
TWeakObjectPtr < AGameplayDebuggingReplicator > Replicator = * It ;
if ( Replicator ! = NULL )
{
if ( Replicator - > GetLocalPlayerOwner ( ) = = PC )
{
RemoveReplicator ( World , Replicator . Get ( ) ) ;
World - > DestroyActor ( Replicator . Get ( ) ) ;
}
}
}
# endif
2014-06-10 13:56:35 -04:00
}
2014-09-10 05:48:38 -04:00
# endif //WITH_EDITOR
bool FGameplayDebugger : : Exec ( UWorld * Inworld , const TCHAR * Cmd , FOutputDevice & Ar )
{
bool bHandled = false ;
APlayerController * PC = Inworld ? Inworld - > GetFirstPlayerController ( ) : NULL ;
if ( ! Inworld | | ! PC )
{
return bHandled ;
}
if ( FParse : : Command ( & Cmd , TEXT ( " EnableGDT " ) ) )
{
AGameplayDebuggingReplicator * Replicator = NULL ;
for ( TActorIterator < AGameplayDebuggingReplicator > It ( Inworld ) ; It ; + + It )
{
Replicator = * It ;
if ( Replicator & & ! Replicator - > IsPendingKill ( ) )
{
APlayerController * LocalPC = Replicator - > GetLocalPlayerOwner ( ) ;
if ( LocalPC = = PC )
{
break ;
}
}
Replicator = NULL ;
}
if ( Inworld - > GetNetMode ( ) = = NM_Client )
{
if ( ! Replicator )
{
PC - > ConsoleCommand ( " cheat EnableGDT " ) ;
2014-10-01 08:53:33 -04:00
bHandled = true ;
2014-09-10 05:48:38 -04:00
}
else if ( ! Replicator - > IsToolCreated ( ) )
{
Replicator - > CreateTool ( ) ;
Replicator - > EnableTool ( ) ;
bHandled = true ;
}
}
else if ( Inworld - > GetNetMode ( ) < NM_Client )
{
if ( ! Replicator )
{
CreateGameplayDebuggerForPlayerController ( PC ) ;
for ( TActorIterator < AGameplayDebuggingReplicator > It ( Inworld ) ; It ; + + It )
{
Replicator = * It ;
if ( Replicator & & ! Replicator - > IsPendingKill ( ) )
{
APlayerController * LocalPC = Replicator - > GetLocalPlayerOwner ( ) ;
if ( LocalPC = = PC )
{
break ;
}
}
Replicator = NULL ;
}
}
if ( Inworld - > GetNetMode ( ) ! = NM_DedicatedServer )
{
if ( Replicator & & ! Replicator - > IsToolCreated ( ) )
{
Replicator - > CreateTool ( ) ;
Replicator - > EnableTool ( ) ;
bHandled = true ;
}
2014-10-01 08:53:33 -04:00
}
else
{
if ( Replicator )
{
Replicator - > bAutoActivate = true ; ;
bHandled = true ;
}
2014-09-10 05:48:38 -04:00
}
}
}
else if ( FParse : : Command ( & Cmd , TEXT ( " RunEQS " ) ) )
{
bHandled = true ;
APlayerController * MyPC = Inworld - > GetFirstPlayerController ( ) ;
2014-11-03 15:47:28 -05:00
UAISystem * AISys = UAISystem : : GetCurrent ( * Inworld ) ;
2014-09-10 05:48:38 -04:00
UEnvQueryManager * EQS = AISys ? AISys - > GetEnvironmentQueryManager ( ) : NULL ;
if ( MyPC & & EQS )
{
AGameplayDebuggingReplicator * DebuggingReplicator = NULL ;
2014-09-16 16:22:01 -04:00
for ( TActorIterator < AGameplayDebuggingReplicator > It ( Inworld ) ; It ; + + It )
2014-09-10 05:48:38 -04:00
{
2014-09-16 16:22:01 -04:00
AGameplayDebuggingReplicator * A = * It ;
if ( ! A - > IsPendingKill ( ) )
2014-09-10 05:48:38 -04:00
{
2014-09-16 16:22:01 -04:00
DebuggingReplicator = A ;
if ( ! DebuggingReplicator - > IsGlobalInWorld ( ) & & DebuggingReplicator - > GetLocalPlayerOwner ( ) = = MyPC )
2014-09-10 05:48:38 -04:00
{
break ;
}
}
}
UObject * Target = DebuggingReplicator ! = NULL ? DebuggingReplicator - > GetSelectedActorToDebug ( ) : NULL ;
FString QueryName = FParse : : Token ( Cmd , 0 ) ;
if ( Target )
{
AISys - > RunEQS ( QueryName , Target ) ;
}
else
{
MyPC - > ClientMessage ( TEXT ( " No debugging target to run EQS " ) ) ;
}
}
}
return bHandled ;
}
2014-11-27 08:16:04 -05:00
# undef LOCTEXT_NAMESPACE