MAbilitySystemComponent
- Module
- Game
- Header
#include "Game/MAbilitySystemComponent.h"- Namespace
Mowo- Reflection
- Reflected by MowoHeaderTool
Properties
| Type | Name | Description |
|---|---|---|
static constexpr uint32_t | kStatusDead | Dead bit in AbilitySystemStateComponent::statusFlags. Default 1u << 0. |
bool | initDefaultAttributes | Default true. |
float | defaultMaxHealth | Default 100.0f. |
float | defaultMaxMana | Default 100.0f. |
float | defaultMaxStamina | Default 100.0f. |
Constructors
| Signature | Name | Description |
|---|---|---|
MAbilitySystemComponent() | MAbilitySystemComponent | |
~MAbilitySystemComponent() override | ~MAbilitySystemComponent | |
MAbilitySystemComponent(const MAbilitySystemComponent&) = delete | MAbilitySystemComponent |
Public functions
| Returns | Name | Description |
|---|---|---|
MAbilitySystemComponent& | operator= | |
void | BeginPlay | |
void | TickComponent | |
void | EndPlay | |
std::vector<FReplicatedActiveEffect> | GetReplicatedActiveEffects | Every attribute (not just the six the mirror component names) and every active effect replicate as fast arrays bound to the owner's entity: the server publishes from its ASC, a ghost adopts the attributes into its ASC and keeps the effect list for UI. |
int32_t | GetActiveEffectCount | |
float | GetActiveEffectRemaining | |
int32_t | GetActiveEffectStacks | |
void | InitDefaultAttributes | Seed Health/MaxHealth/Mana/MaxMana/Stamina/MaxStamina/MoveSpeed and the clamp rules. |
void | PushAttributesToNetState | Server → wire: copy the ASC's current attributes + dead flag into the replicated component (call each server tick before replication). |
void | PullAttributesFromNetState | Wire → client: read decoded attributes back into the ASC (current values). |
uint16_t | PredictActivation | Client-side prediction On the owning client: predict the activation on the local ASC now (cost/cooldown/cue land this frame) and stamp the request the client will send the server with the returned prediction key. |
uint16_t | RequestAbilityActivation | The one-call client entry point: predict locally, then route the request — over the wire when this process is a connected client, straight into the authority mailbox otherwise (offline / listen local player). |
uint32_t | AbilityWireId | Stable cross-process wire id for an ability tag — FNV-1a32 of the tag PATH. |
FGameplayTag | ResolveAbilityWireId | Granted ability whose wire id matches, or an invalid tag. |
void | ExecuteGameplayCue | Fire a cosmetic cue EVERYWHERE. |
void | ExecuteLocalGameplayCue | |
void | ConfirmPredictedActivation | Reconcile the server's verdict for a prediction key. |
void | RollbackPredictedActivation | |
bool | HasPendingPrediction | |
void | InitAttribute | Delegating GAS API (full surface available via Abilities()). |
float | GetAttribute | |
uint32_t | ApplyEffect | |
void | GrantAbility | |
bool | TryActivateAbility | |
bool | HasTag | |
AbilitySystemComponent& | Abilities | |
float | GetAttributeValue | The reflected face: tags and attributes by their string path, since a graph pin carries neither an FName nor an FGameplayTag. |
void | SetAttributeBase | |
bool | ActivateAbilityByTag | |
bool | RequestAbilityByTag | |
bool | HasGameplayTag | |
bool | IsDead |
Function details
MAbilitySystemComponent
MAbilitySystemComponent()~MAbilitySystemComponent
~MAbilitySystemComponent() overrideMAbilitySystemComponent
MAbilitySystemComponent(const MAbilitySystemComponent&) = deleteoperator=
MAbilitySystemComponent& operator=(const MAbilitySystemComponent&) = deleteBeginPlay
void BeginPlay() overrideTickComponent
void TickComponent(float deltaSeconds) overrideEndPlay
void EndPlay() overrideGetReplicatedActiveEffects
std::vector<FReplicatedActiveEffect> GetReplicatedActiveEffects() constEvery attribute (not just the six the mirror component names) and every active effect replicate as fast arrays bound to the owner's entity: the server publishes from its ASC, a ghost adopts the attributes into its ASC and keeps the effect list for UI. This is the list a client reads.
GetActiveEffectCount
int32_t GetActiveEffectCount() constGetActiveEffectRemaining
float GetActiveEffectRemaining(const std::string& effectId) constGetActiveEffectStacks
int32_t GetActiveEffectStacks(const std::string& effectId) constInitDefaultAttributes
void InitDefaultAttributes()Seed Health/MaxHealth/Mana/MaxMana/Stamina/MaxStamina/MoveSpeed and the clamp rules. Idempotent — safe to call again. Called from BeginPlay when initDefaultAttributes is set.
PushAttributesToNetState
void PushAttributesToNetState(AbilitySystemStateComponent& net) constServer → wire: copy the ASC's current attributes + dead flag into the replicated component (call each server tick before replication).
PullAttributesFromNetState
void PullAttributesFromNetState(const AbilitySystemStateComponent& net)Wire → client: read decoded attributes back into the ASC (current values).
PredictActivation
uint16_t PredictActivation(FGameplayTag abilityTag)Client-side prediction On the owning client: predict the activation on the local ASC now (cost/cooldown/cue land this frame) and stamp the request the client will send the server with the returned prediction key. Returns 0 when the local CanActivate check failed — nothing predicted, no request to send. Fill net.lastRequestedAbility / net.lastRequestedPredictionKey from the return and route ServerActivateAbility with them.
RequestAbilityActivation
uint16_t RequestAbilityActivation(FGameplayTag abilityTag)The one-call client entry point: predict locally, then route the request — over the wire when this process is a connected client, straight into the authority mailbox otherwise (offline / listen local player). Returns the prediction key (0 = CanActivate failed, nothing predicted, nothing sent).
AbilityWireId
static uint32_t AbilityWireId(FGameplayTag tag)Stable cross-process wire id for an ability tag — FNV-1a32 of the tag PATH. FName indices are per-process and must never cross the wire.
ResolveAbilityWireId
FGameplayTag ResolveAbilityWireId(uint32_t wireId) constGranted ability whose wire id matches, or an invalid tag.
ExecuteGameplayCue
void ExecuteGameplayCue(FGameplayTag cueTag, EGameplayCueEvent event, float magnitude = 0.0f, const Vec3& location = Vec3(0.0f, 0.0f, 0.0f), MObject* instigator = nullptr)Fire a cosmetic cue EVERYWHERE. On the authority it plays locally and fans out to every ghost through MulticastGameplayCue; off the authority it does nothing at all, because the server's multicast is what will play it — firing here too would double it on the client that asked. For a cue a client should play IMMEDIATELY as part of a prediction (the muzzle flash on the ability it just predicted), use ExecuteLocalGameplayCue: local only, never replicated, so the incoming multicast is the ghosts' copy and not a second one for the predictor.
ExecuteLocalGameplayCue
void ExecuteLocalGameplayCue(FGameplayTag cueTag, EGameplayCueEvent event, float magnitude = 0.0f, MObject* instigator = nullptr)ConfirmPredictedActivation
void ConfirmPredictedActivation(uint16_t predictionKey)Reconcile the server's verdict for a prediction key. Confirm keeps the local result; reject rolls the ASC back to the captured baseline. The authoritative attributes then converge through PullAttributesFromNetState.
RollbackPredictedActivation
void RollbackPredictedActivation(uint16_t predictionKey)HasPendingPrediction
bool HasPendingPrediction(uint16_t predictionKey) constInitAttribute
void InitAttribute(FName attr, float base)Delegating GAS API (full surface available via Abilities()).
GetAttribute
float GetAttribute(FName attr) constApplyEffect
uint32_t ApplyEffect(const GameplayEffectSpec& spec)GrantAbility
void GrantAbility(const GameplayAbilitySpec& a)TryActivateAbility
bool TryActivateAbility(FGameplayTag tag)HasTag
bool HasTag(FGameplayTag tag) constAbilities
AbilitySystemComponent& Abilities()GetAttributeValue
float GetAttributeValue(const std::string& attribute) constThe reflected face: tags and attributes by their string path, since a graph pin carries neither an FName nor an FGameplayTag.
SetAttributeBase
void SetAttributeBase(const std::string& attribute, float value)ActivateAbilityByTag
bool ActivateAbilityByTag(const std::string& tagPath)RequestAbilityByTag
bool RequestAbilityByTag(const std::string& tagPath)HasGameplayTag
bool HasGameplayTag(const std::string& tagPath) constIsDead
bool IsDead() const