You've already forked UnrealEngineUWP
mirror of
https://github.com/izzy2lost/UnrealEngineUWP.git
synced 2026-03-26 18:15:20 -07:00
Moved SmartObjects out of restricted folder Moved StateTree out of restricted folder Moved ZoneGraph out of restricted folder Moved ZoneGraphAnnotations out of restricted folder #jira UE-115297 #ROBOMERGE-OWNER: mieszko.zielinski #ROBOMERGE-AUTHOR: mieszko.zielinski #ROBOMERGE-SOURCE: CL 17648223 via CL 17648246 via CL 17648261 via CL 17648385 via CL 17648390 via CL 17648742 #ROBOMERGE-BOT: STARSHIP (Release-Engine-Test -> Main) (v875-17642767) [CL 17648750 by mieszko zielinski in ue5-main branch]
84 lines
2.4 KiB
C++
84 lines
2.4 KiB
C++
// Copyright Epic Games, Inc. All Rights Reserved.
|
|
|
|
#include "SmartObjectBlueprintFunctionLibrary.h"
|
|
#include "SmartObjectSubsystem.h"
|
|
#include "Blueprint/AIBlueprintHelperLibrary.h"
|
|
#include "AI/AITask_UseSmartObject.h"
|
|
#include "AbilitySystemInterface.h"
|
|
#include "AbilitySystemComponent.h"
|
|
#include "AbilitySystemBlueprintLibrary.h"
|
|
|
|
namespace
|
|
{
|
|
UAbilitySystemComponent* GetAbilitySystemComponent(AActor* Actor)
|
|
{
|
|
IAbilitySystemInterface* AbilitySysAgent = Cast<IAbilitySystemInterface>(Actor);
|
|
if (AbilitySysAgent)
|
|
{
|
|
return AbilitySysAgent->GetAbilitySystemComponent();
|
|
}
|
|
|
|
return Actor ? Actor->FindComponentByClass<UAbilitySystemComponent>() : nullptr;
|
|
}
|
|
}
|
|
|
|
//----------------------------------------------------------------------//
|
|
// USmartObjectBlueprintFunctionLibrary
|
|
//----------------------------------------------------------------------//
|
|
bool USmartObjectBlueprintFunctionLibrary::K2_UseSmartObject(AActor* Avatar, AActor* SmartObject)
|
|
{
|
|
if (Avatar == nullptr || SmartObject == nullptr)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
AAIController* AIController = UAIBlueprintHelperLibrary::GetAIController(Avatar);
|
|
if (AIController != nullptr)
|
|
{
|
|
UAITask_UseSmartObject* Task = UAITask_UseSmartObject::UseSmartObject(AIController, SmartObject, nullptr);
|
|
if (Task != nullptr)
|
|
{
|
|
Task->ReadyForActivation();
|
|
}
|
|
return Task != nullptr;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|
|
bool USmartObjectBlueprintFunctionLibrary::K2_SetSmartObjectEnabled(AActor* SmartObject, const bool bEnabled)
|
|
{
|
|
if (SmartObject == nullptr)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
UWorld* World = SmartObject->GetWorld();
|
|
if (World == nullptr)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
USmartObjectSubsystem* Subsystem = USmartObjectSubsystem::GetCurrent(World);
|
|
if (Subsystem == nullptr)
|
|
{
|
|
return false;
|
|
}
|
|
|
|
return bEnabled ? Subsystem->RegisterSmartObjectActor(*SmartObject)
|
|
: Subsystem->UnregisterSmartObjectActor(*SmartObject);
|
|
}
|
|
|
|
//----------------------------------------------------------------------//
|
|
// DEPRECATED
|
|
//----------------------------------------------------------------------//
|
|
bool USmartObjectBlueprintFunctionLibrary::K2_AddLooseGameplayTags(AActor* Actor, const FGameplayTagContainer& GameplayTags)
|
|
{
|
|
return UAbilitySystemBlueprintLibrary::AddLooseGameplayTags(Actor, GameplayTags);
|
|
}
|
|
|
|
bool USmartObjectBlueprintFunctionLibrary::K2_RemoveLooseGameplayTags(AActor* Actor, const FGameplayTagContainer& GameplayTags)
|
|
{
|
|
return UAbilitySystemBlueprintLibrary::RemoveLooseGameplayTags(Actor, GameplayTags);
|
|
}
|