// Copyright (c) 2026 Reignance Studios. MIT License, see LICENSE. #pragma once #include "CoreMinimal.h" #include "AbilitySystemInterface.h" #include "GameFramework/Character.h" #include "GameplayTagContainer.h" #include "GKLCharacter.generated.h" class UAbilitySystemComponent; /** * Character whose abilities live on AGKLPlayerState. * * The ASC needs its avatar set on both machines: the server in PossessedBy, the owning * client in OnRep_PlayerState. Missing the client half is the most common reason * predicted abilities never activate on the client. * * Input binding is not included: call ActivateAbilityByTag from your Enhanced Input events. */ UCLASS() class GASKITLITE_API AGKLCharacter : public ACharacter, public IAbilitySystemInterface { GENERATED_BODY() public: AGKLCharacter(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get()); virtual void PossessedBy(AController* NewController) override; virtual void OnRep_PlayerState() override; virtual void GetLifetimeReplicatedProps(TArray& OutLifetimeProps) const override; virtual UAbilitySystemComponent* GetAbilitySystemComponent() const override; /** Activates every granted ability with this tag (e.g. Ability.Heal). Call it on the owning client to predict. */ UFUNCTION(BlueprintCallable, Category = "GASKit Lite") bool ActivateAbilityByTag(FGameplayTag AbilityTag); UFUNCTION(BlueprintPure, Category = "GASKit Lite") bool IsDead() const { return bIsDead; } /** Server only. Called by the Death ability. */ void Die(); protected: /** Runs on the server and on every client. Default: stop movement. */ UFUNCTION(BlueprintNativeEvent, Category = "GASKit Lite") void OnDeath(); virtual void OnDeath_Implementation(); UPROPERTY(ReplicatedUsing = OnRep_IsDead, BlueprintReadOnly, Category = "GASKit Lite") bool bIsDead = false; UFUNCTION() void OnRep_IsDead(); private: void InitAbilitySystem(); };