// 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(); check(GASPlayerState); GASPlayerState->GetAbilitySystemComponent()->InitAbilityActorInfo(GASPlayerState, this); AbilitySystemComponent = GASPlayerState->GetAbilitySystemComponent(); AttributeSet = GASPlayerState->GetAttributeSet(); if (ARIRPlayerController* RIRPlayerController = Cast(GetController())) { if (ARIRHUD* RIRHUD = Cast(RIRPlayerController->GetHUD())) { RIRHUD->InitOverlay(RIRPlayerController, GetPlayerState(), AbilitySystemComponent, AttributeSet); } } }