Nelaric Unreal Gameplay
Gameplay framework API
Loading...
Searching...
No Matches
UPawnInitStateComponent Class Reference

Optional pawn base implementing the initialization contract. More...

#include <PawnInitStateComponent.h>

Inheritance diagram for UPawnInitStateComponent:
UNelaricPawnComponent IInitStateParticipantInterface

Public Member Functions

virtual GAMEPLAYRUNTIME_API bool IsInitApplicable () const override
 Participates by default; override for conditional applicability.
virtual GAMEPLAYRUNTIME_API bool TryChangeInitState () final override
 Commits at most one adjacent preparation step when the derived gate passes.
virtual GAMEPLAYRUNTIME_API bool CanEnterReady () final override
 Runs DataInitialized preparation until it succeeds in this generation.
virtual GAMEPLAYRUNTIME_API bool CommitReadyWithoutNotification () override
 Writes Ready without callbacks after the coordinator checks the group.
virtual GAMEPLAYRUNTIME_API void NotifyReadyCommitted (const Nelaric::FInitStateSnapshot &Previous) override
 Announces a committed Ready transition after the group commits.
GAMEPLAYRUNTIME_API void RequestInitRefresh ()
 Requests another local coordinator pass after context changes.
virtual GAMEPLAYRUNTIME_API Nelaric::EInitState GetInitState () const override
 Returns the state owned by this component.
virtual GAMEPLAYRUNTIME_API Nelaric::FInitGeneration GetInitGeneration () const override
 Returns the current attempt identity owned by this component.
virtual GAMEPLAYRUNTIME_API bool HasTerminalInitFailure () const override
 Returns whether this attempt has failed permanently.
GAMEPLAYRUNTIME_API bool CanApplyInitResult (const UWorld *ExpectedWorld, Nelaric::FInitGeneration ExpectedGeneration) const
 Checks whether an asynchronous result may update this attempt.
virtual GAMEPLAYRUNTIME_API void InvalidateInitGeneration () override
 Invalidates old work, resets state, and announces the new attempt.
virtual GAMEPLAYRUNTIME_API void MarkTerminalInitFailure () override
 Records terminal failure and announces it to the world.
Public Member Functions inherited from UNelaricPawnComponent
GAMEPLAYRUNTIME_API APawn * GetPawn () const
 Gets the pawn that directly owns this component.
template<typename T>
T * GetPawn () const
 Gets the owning pawn as a specific pawn type.
GAMEPLAYRUNTIME_API AController * GetController () const
 Gets the pawn's current controller on this machine.
template<typename T>
T * GetController () const
 Gets the current controller as a specific controller type.
GAMEPLAYRUNTIME_API APlayerController * GetPlayerController () const
 Gets the current controller when it is a player controller.
template<typename T>
T * GetPlayerController () const
 Gets the player controller as a specific player controller.
GAMEPLAYRUNTIME_API APlayerState * GetPlayerState () const
 Gets player state directly from the owning pawn.
template<typename T>
T * GetPlayerState () const
 Gets the pawn's player state as a specific player state type.
GAMEPLAYRUNTIME_API bool IsLocallyControlled () const
 Queries the pawn's native local-control semantics.
GAMEPLAYRUNTIME_API bool IsPlayerControlled () const
 Queries the pawn's native player-control semantics.

Static Public Member Functions

static GAMEPLAYRUNTIME_API UPawnInitStateComponent * ResolveInitResult (const TWeakObjectPtr< UPawnInitStateComponent > &WeakComponent, const UWorld *ExpectedWorld, Nelaric::FInitGeneration ExpectedGeneration)
 Resolves a game-thread asynchronous completion for a live attempt.

Protected Member Functions

virtual GAMEPLAYRUNTIME_API bool CanEntryDataAvailable ()
 Acquires this component's data while Registered.
virtual GAMEPLAYRUNTIME_API bool CanEntryDataInitialized ()
 Initializes this component's available data.
virtual GAMEPLAYRUNTIME_API bool CanEntryReady ()
 Performs final local preparation before the Ready check.
virtual GAMEPLAYRUNTIME_API void OnInitReady ()
 Starts gameplay after the entire readiness group entered Ready.
virtual GAMEPLAYRUNTIME_API void OnInitGenerationInvalidated (const Nelaric::FInitStateSnapshot &Previous)
 Stops work and gameplay belonging to an invalidated attempt.
virtual GAMEPLAYRUNTIME_API void CancelInitGenerationWork ()
 Cancels work and removes listeners for an invalidated attempt.

Detailed Description

Optional pawn base implementing the initialization contract.

Use CanEntry for preparation and OnInitReady for gameplay. The first three return true when their work is complete. Pending stages retry after RequestInitRefresh. Calls use the game thread.

Member Function Documentation

◆ CanApplyInitResult()

GAMEPLAYRUNTIME_API bool UPawnInitStateComponent::CanApplyInitResult ( const UWorld * ExpectedWorld,
Nelaric::FInitGeneration ExpectedGeneration ) const

Checks whether an asynchronous result may update this attempt.

After dispatching a callback to the game thread, resolve its weak component reference and call this with the captured world and generation. Cancellation may not stop work already in flight.

Parameters
ExpectedWorldWorld captured when work began.
ExpectedGenerationGeneration captured when work began.
Returns
Whether the component is still in that live attempt.

◆ CancelInitGenerationWork()

virtual GAMEPLAYRUNTIME_API void UPawnInitStateComponent::CancelInitGenerationWork ( )
protectedvirtual

Cancels work and removes listeners for an invalidated attempt.

Called after the generation changes and before state resets.

◆ CanEntryDataAvailable()

virtual GAMEPLAYRUNTIME_API bool UPawnInitStateComponent::CanEntryDataAvailable ( )
protectedvirtual

Acquires this component's data while Registered.

Retry-safe work may run again after a refresh. Defaults to true.

Returns
True to enter DataAvailable; false to keep waiting.

◆ CanEntryDataInitialized()

virtual GAMEPLAYRUNTIME_API bool UPawnInitStateComponent::CanEntryDataInitialized ( )
protectedvirtual

Initializes this component's available data.

Retry-safe work may run again after a refresh. Defaults to true.

Returns
True to enter DataInitialized; false to keep waiting.

◆ CanEntryReady()

virtual GAMEPLAYRUNTIME_API bool UPawnInitStateComponent::CanEntryReady ( )
protectedvirtual

Performs final local preparation before the Ready check.

Retry-safe work may run again until true, then remains complete for this generation. Defaults to true. Gameplay requires Ready.

Returns
Whether local preparation for Ready is complete.

◆ NotifyReadyCommitted()

virtual GAMEPLAYRUNTIME_API void UPawnInitStateComponent::NotifyReadyCommitted ( const Nelaric::FInitStateSnapshot & Previous)
overridevirtual

Announces a committed Ready transition after the group commits.

Parameters
PreviousSnapshot captured before the Ready commit.

Implements IInitStateParticipantInterface.

◆ OnInitGenerationInvalidated()

virtual GAMEPLAYRUNTIME_API void UPawnInitStateComponent::OnInitGenerationInvalidated ( const Nelaric::FInitStateSnapshot & Previous)
protectedvirtual

Stops work and gameplay belonging to an invalidated attempt.

The generation has changed. The old state remains readable. Preparation resumes through the coordinator after the reset.

Parameters
PreviousSnapshot before invalidation.

◆ OnInitReady()

virtual GAMEPLAYRUNTIME_API void UPawnInitStateComponent::OnInitReady ( )
protectedvirtual

Starts gameplay after the entire readiness group entered Ready.

Called once per Ready entry, after every group member commits.

◆ RequestInitRefresh()

GAMEPLAYRUNTIME_API void UPawnInitStateComponent::RequestInitRefresh ( )

Requests another local coordinator pass after context changes.

Call from a replicated gameplay-data arrival event, such as OnRep, after updating local data used by readiness checks.

◆ ResolveInitResult()

GAMEPLAYRUNTIME_API UPawnInitStateComponent * UPawnInitStateComponent::ResolveInitResult ( const TWeakObjectPtr< UPawnInitStateComponent > & WeakComponent,
const UWorld * ExpectedWorld,
Nelaric::FInitGeneration ExpectedGeneration )
static

Resolves a game-thread asynchronous completion for a live attempt.

Parameters
WeakComponentComponent captured weakly when work began.
ExpectedWorldWorld captured when work began.
ExpectedGenerationGeneration captured when work began.
Returns
Live component, or null after removal, travel, or invalidation.

The documentation for this class was generated from the following file: