feat(gas): GameMode aponta pra BPs (Pawn/PlayerState) + cleanup ZeusCharacter
ZeusGameMode.cpp: - DefaultPawnClass: usa FClassFinder pra /Game/ZMMO/Core/Player/BP_ZeusPlayerCharacter (fallback AZeusCharacter). Sem isso, engine instancia C++ direto e perde toda customizacao BP (EnhancedInputAction events, AnimBP wire, componentes BP-added). - PlayerStateClass: usa FClassFinder pra /Game/ZMMO/Core/Player/BP_PlayerState (fallback AZeusPlayerState). Mesmo motivo -- BP filho tem componentes (ex: UZeusGASComponent via ComponentClasses no DefaultGame.ini) e overrides do designer que classes C++ puras nao tem. - TODO: renomear BP_PlayerState -> BP_ZeusPlayerState (alinhar com convencao BP_ZeusPlayerCharacter); path do FClassFinder ja preparado pra renomear. ZeusCharacter.cpp/h cleanup: - Removida gambiarra anterior (PossessedBy + OnRep_PlayerState overrides + RefreshGASAvatar com FTimerHandle retry). Substituida pelo pattern event-driven em UZeusGASComponent::HandlePawnSet (commit server anterior). - Includes desnecessarios (AbilitySystemComponent.h + ZeusAbilitySystemComponent.h) removidos. ZMMO.uproject: - GameplayAbilities adicionado em Plugins (UE 5.7 exige que modulo do jogo declare explicitamente plugins que ele consome -- antes vinha transitivamente do plugin ZeusGAS, gerava warning de build). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -173,6 +173,12 @@ void AZeusCharacter::Tick(const float DeltaSeconds)
|
|||||||
|
|
||||||
void AZeusCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
|
void AZeusCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
|
||||||
{
|
{
|
||||||
|
// IMPORTANTE: chamar Super:: pra que BPs filhos consigam auto-bindar
|
||||||
|
// nodes EnhancedInputAction no Event Graph (ex: GA_Kick / IA_Kick no
|
||||||
|
// BP_ThirdPersonCharacter). Sem isso, bindings em BP ficam orfaos --
|
||||||
|
// so' bindings C++ (Move/Look/Jump/Dash abaixo) recebem input.
|
||||||
|
Super::SetupPlayerInputComponent(PlayerInputComponent);
|
||||||
|
|
||||||
if (UEnhancedInputComponent* EnhancedInputComponent = Cast<UEnhancedInputComponent>(PlayerInputComponent))
|
if (UEnhancedInputComponent* EnhancedInputComponent = Cast<UEnhancedInputComponent>(PlayerInputComponent))
|
||||||
{
|
{
|
||||||
EnhancedInputComponent->BindAction(JumpAction, ETriggerEvent::Started, this, &AZeusCharacter::OnJumpPressed);
|
EnhancedInputComponent->BindAction(JumpAction, ETriggerEvent::Started, this, &AZeusCharacter::OnJumpPressed);
|
||||||
|
|||||||
@@ -5,10 +5,47 @@
|
|||||||
#include "ZeusPlayerController.h"
|
#include "ZeusPlayerController.h"
|
||||||
#include "ZeusPlayerState.h"
|
#include "ZeusPlayerState.h"
|
||||||
|
|
||||||
|
#include "UObject/ConstructorHelpers.h"
|
||||||
|
|
||||||
AZeusGameMode::AZeusGameMode()
|
AZeusGameMode::AZeusGameMode()
|
||||||
|
{
|
||||||
|
// DefaultPawnClass: usar o BP filho (BP_ThirdPersonCharacter) em vez do
|
||||||
|
// C++ puro. BPs filhos so' sao instanciados se o pawn possessed for da
|
||||||
|
// classe BP -- caso contrario o engine cria a classe C++ direta e perde
|
||||||
|
// TUDO que o designer fez no BP (EnhancedInputAction events, AnimBP wire,
|
||||||
|
// hooks de ability, componentes adicionados via editor).
|
||||||
|
//
|
||||||
|
// Fallback pra AZeusCharacter pura se o asset BP nao existir (asset
|
||||||
|
// renomeado/deletado por engano -- nao deve acontecer em prod).
|
||||||
|
static ConstructorHelpers::FClassFinder<APawn> DefaultPawnBP(
|
||||||
|
TEXT("/Game/ZMMO/Core/Player/BP_ZeusPlayerCharacter"));
|
||||||
|
if (DefaultPawnBP.Succeeded())
|
||||||
|
{
|
||||||
|
DefaultPawnClass = DefaultPawnBP.Class;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
DefaultPawnClass = AZeusCharacter::StaticClass();
|
DefaultPawnClass = AZeusCharacter::StaticClass();
|
||||||
|
}
|
||||||
|
|
||||||
PlayerControllerClass = AZeusPlayerController::StaticClass();
|
PlayerControllerClass = AZeusPlayerController::StaticClass();
|
||||||
|
|
||||||
|
// PlayerStateClass: usar BP filho pelo mesmo motivo do DefaultPawnClass --
|
||||||
|
// componentes BP-added (ex: UZeusGASComponent listado em DefaultGame.ini
|
||||||
|
// ComponentClasses), eventos no Event Graph e overrides do designer so'
|
||||||
|
// existem na classe BP. C++ direto (AZeusPlayerState) perde tudo isso.
|
||||||
|
// TODO: renomear o asset pra BP_ZeusPlayerState pra alinhar com a convencao
|
||||||
|
// (BP_ZeusPlayerCharacter) -- quando renomear, atualizar o path aqui.
|
||||||
|
static ConstructorHelpers::FClassFinder<APlayerState> PlayerStateBP(
|
||||||
|
TEXT("/Game/ZMMO/Core/Player/BP_PlayerState"));
|
||||||
|
if (PlayerStateBP.Succeeded())
|
||||||
|
{
|
||||||
|
PlayerStateClass = PlayerStateBP.Class;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
PlayerStateClass = AZeusPlayerState::StaticClass();
|
PlayerStateClass = AZeusPlayerState::StaticClass();
|
||||||
|
}
|
||||||
|
|
||||||
HUDClass = AZeusHUD::StaticClass();
|
HUDClass = AZeusHUD::StaticClass();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,6 +76,10 @@
|
|||||||
{
|
{
|
||||||
"Name": "CommonUI",
|
"Name": "CommonUI",
|
||||||
"Enabled": true
|
"Enabled": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Name": "GameplayAbilities",
|
||||||
|
"Enabled": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"AdditionalPluginDirectories": [
|
"AdditionalPluginDirectories": [
|
||||||
|
|||||||
Reference in New Issue
Block a user