Files
realms-in-ruin-dev/Source/REALMSINRUIN/Private/Player/RIRPlayerCharacter.cpp
T
tedwardsandCursor ff5640a020 Establish UE 5.8 known-good baseline with Batch 1 archaeology docs.
Initialize Git with LFS for binary assets and add standard Unreal Engine .gitignore/.gitattributes.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-16 19:40:19 -07:00

52 lines
1.5 KiB
C++

// REALMS IN RUIN. Copyright (c) 2025 Trevor Edwards. All rights reserved.
#include "Player/RIRPlayerCharacter.h"
#include "Player/RIRPlayerState.h"
#include "Abilities/RIRAbilitySystemComponent.h"
#include "Attributes/RIRAttributeSet.h"
#include "AbilitySystemComponent.h"
#include "Player/RIRPlayerController.h"
#include "UI/HUD/RIRHUD.h"
#include "UI/WidgetController/RIRWidgetController.h"
ARIRPlayerCharacter::ARIRPlayerCharacter()
{
// Removed GAS component creation — now handled by PlayerState
}
void ARIRPlayerCharacter::PossessedBy(AController* NewController)
{
Super::PossessedBy(NewController);
// Init ability actor info for the server
InitAbilityActorInfo();
}
void ARIRPlayerCharacter::OnRep_PlayerState()
{
Super::OnRep_PlayerState();
// Init ability actor info for the client
InitAbilityActorInfo();
}
void ARIRPlayerCharacter::InitAbilityActorInfo()
{
ARIRPlayerState* GASPlayerState = GetPlayerState<ARIRPlayerState>();
check(GASPlayerState);
GASPlayerState->GetAbilitySystemComponent()->InitAbilityActorInfo(GASPlayerState, this);
AbilitySystemComponent = GASPlayerState->GetAbilitySystemComponent();
AttributeSet = GASPlayerState->GetAttributeSet();
if (ARIRPlayerController* RIRPlayerController = Cast<ARIRPlayerController>(GetController()))
{
if (ARIRHUD* RIRHUD = Cast<ARIRHUD>(RIRPlayerController->GetHUD()))
{
RIRHUD->InitOverlay(RIRPlayerController, GetPlayerState<ARIRPlayerState>(), AbilitySystemComponent, AttributeSet);
}
}
}