OLS/Source/ols/Public/AbilitySystem/OLSGameplayEffectContext.h

63 lines
2.0 KiB
C
Raw Normal View History

// © 2024 Long Ly. All rights reserved. Any unauthorized use, reproduction, or distribution of this trademark is strictly prohibited and may result in legal action.
#pragma once
#include "GameplayEffectTypes.h"
#include "OLSGameplayEffectContext.generated.h"
USTRUCT()
struct FOLSGameplayEffectContext : public FGameplayEffectContext
{
GENERATED_BODY()
FOLSGameplayEffectContext()
: FGameplayEffectContext()
{
}
FOLSGameplayEffectContext(AActor* InInstigator, AActor* InEffectCauser)
: FGameplayEffectContext(InInstigator, InEffectCauser)
{
}
/** Returns the wrapped FLyraGameplayEffectContext from the handle, or nullptr if it doesn't exist or is the wrong type */
static OLS_API FOLSGameplayEffectContext* ExtractEffectContext(struct FGameplayEffectContextHandle handle);
/** Sets the object used as the ability source */
void SetAbilitySource(const class IOLSAbilitySourceInterface* object, float sourceLevel);
/** Returns the ability source interface associated with the source object. Only valid on the authority. */
const IOLSAbilitySourceInterface* GetAbilitySource() const;
virtual FGameplayEffectContext* Duplicate() const override;
virtual UScriptStruct* GetScriptStruct() const override;
/** Overridden to serialize new fields */
virtual bool NetSerialize(FArchive& Ar, class UPackageMap* Map, bool& bOutSuccess) override;
/** Returns the physical material from the hit result if there is one */
const UPhysicalMaterial* GetPhysicalMaterial() const;
public:
/** ID to allow the identification of multiple bullets that were part of the same cartridge */
UPROPERTY()
int32 CartridgeID = -1;
protected:
/** Ability Source object (should implement ILyraAbilitySourceInterface). NOT replicated currently */
UPROPERTY()
TWeakObjectPtr<const UObject> AbilitySourceObject;
};
template<>
struct TStructOpsTypeTraits<FOLSGameplayEffectContext> : public TStructOpsTypeTraitsBase2<FOLSGameplayEffectContext>
{
enum
{
WithNetSerializer = true,
WithCopy = true
};
};