Implemented OLSCollisionChannels. Implemented OLSGameplayEffectContext. Implemented OLSPhysicalMaterialWithTags.
67 lines
2.0 KiB
C++
67 lines
2.0 KiB
C++
// © 2024 Long Ly. All rights reserved. Any unauthorized use, reproduction, or distribution of this trademark is strictly prohibited and may result in legal action.
|
|
|
|
|
|
#include "AbilitySystem/OLSGameplayEffectContext.h"
|
|
|
|
#if UE_WITH_IRIS
|
|
#include "Iris/ReplicationState/PropertyNetSerializerInfoRegistry.h"
|
|
#include "Serialization/GameplayEffectContextNetSerializer.h"
|
|
#endif
|
|
|
|
#include "AbilitySystem/Interfaces/OLSAbilitySourceInterface.h"
|
|
|
|
#include UE_INLINE_GENERATED_CPP_BY_NAME(OLSGameplayEffectContext)
|
|
|
|
FOLSGameplayEffectContext* FOLSGameplayEffectContext::ExtractEffectContext(FGameplayEffectContextHandle handle)
|
|
{
|
|
FGameplayEffectContext* baseEffectContext = handle.Get();
|
|
if ((baseEffectContext != nullptr) && baseEffectContext->GetScriptStruct()->IsChildOf(StaticStruct()))
|
|
{
|
|
return static_cast<FOLSGameplayEffectContext*>(baseEffectContext);
|
|
}
|
|
|
|
return nullptr;
|
|
}
|
|
|
|
void FOLSGameplayEffectContext::SetAbilitySource(const IOLSAbilitySourceInterface* object, float sourceLevel)
|
|
{
|
|
AbilitySourceObject = MakeWeakObjectPtr(Cast<const UObject>(object));
|
|
//SourceLevel = sourceLevel;
|
|
}
|
|
|
|
const IOLSAbilitySourceInterface* FOLSGameplayEffectContext::GetAbilitySource() const
|
|
{
|
|
return Cast<IOLSAbilitySourceInterface>(AbilitySourceObject.Get());
|
|
}
|
|
|
|
FGameplayEffectContext* FOLSGameplayEffectContext::Duplicate() const
|
|
{
|
|
FOLSGameplayEffectContext* newContext = new FOLSGameplayEffectContext();
|
|
*newContext = *this;
|
|
if (GetHitResult())
|
|
{
|
|
// Does a deep copy of the hit result
|
|
newContext->AddHitResult(*GetHitResult(), true);
|
|
}
|
|
return newContext;
|
|
}
|
|
|
|
UScriptStruct* FOLSGameplayEffectContext::GetScriptStruct() const
|
|
{
|
|
return FOLSGameplayEffectContext::StaticStruct();
|
|
}
|
|
|
|
bool FOLSGameplayEffectContext::NetSerialize(FArchive& Ar, UPackageMap* Map, bool& bOutSuccess)
|
|
{
|
|
return FGameplayEffectContext::NetSerialize(Ar, Map, bOutSuccess);
|
|
}
|
|
|
|
const UPhysicalMaterial* FOLSGameplayEffectContext::GetPhysicalMaterial() const
|
|
{
|
|
if (const FHitResult* hitResultPtr = GetHitResult())
|
|
{
|
|
return hitResultPtr->PhysMaterial.Get();
|
|
}
|
|
return nullptr;
|
|
}
|