// Copyright Epic Games, Inc. All Rights Reserved. #include "LyraGameplayAbility_FromEquipment.h" #include "LyraEquipmentInstance.h" #include "Inventory/LyraInventoryItemInstance.h" ULyraGameplayAbility_FromEquipment::ULyraGameplayAbility_FromEquipment(const FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer) { } ULyraEquipmentInstance* ULyraGameplayAbility_FromEquipment::GetAssociatedEquipment() const { if (FGameplayAbilitySpec* Spec = UGameplayAbility::GetCurrentAbilitySpec()) { return Cast(Spec->SourceObject); } return nullptr; } ULyraInventoryItemInstance* ULyraGameplayAbility_FromEquipment::GetAssociatedItem() const { if (ULyraEquipmentInstance* Equipment = GetAssociatedEquipment()) { return Cast(Equipment->GetInstigator()); } return nullptr; } #if WITH_EDITOR EDataValidationResult ULyraGameplayAbility_FromEquipment::IsDataValid(TArray& ValidationErrors) { EDataValidationResult Result = Super::IsDataValid(ValidationErrors); if (InstancingPolicy == EGameplayAbilityInstancingPolicy::NonInstanced) { ValidationErrors.Add(NSLOCTEXT("Lyra", "EquipmentAbilityMustBeInstanced", "Equipment ability must be instanced")); Result = EDataValidationResult::Invalid; } return Result; } #endif