Harden gameplay input restore after frontend
This commit is contained in:
@@ -154,6 +154,10 @@ void AAgrarianGamePlayerController::AcknowledgePossession(APawn* P)
|
||||
{
|
||||
SetMvpFrontendPresentationActive(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
RestoreGameplayControlState();
|
||||
}
|
||||
}
|
||||
|
||||
void AAgrarianGamePlayerController::SetupInputComponent()
|
||||
@@ -289,9 +293,7 @@ void AAgrarianGamePlayerController::SetMvpFrontendPresentationActive(bool bNewAc
|
||||
}
|
||||
else
|
||||
{
|
||||
ResetIgnoreMoveInput();
|
||||
ResetIgnoreLookInput();
|
||||
ApplyDefaultInputMappingContexts();
|
||||
RestoreGameplayControlState();
|
||||
}
|
||||
|
||||
APawn* ControlledPawn = GetPawn();
|
||||
@@ -334,6 +336,39 @@ void AAgrarianGamePlayerController::SetMvpFrontendPresentationActive(bool bNewAc
|
||||
}
|
||||
}
|
||||
|
||||
void AAgrarianGamePlayerController::RestoreGameplayControlState()
|
||||
{
|
||||
if (!IsLocalPlayerController())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ResetIgnoreMoveInput();
|
||||
ResetIgnoreLookInput();
|
||||
SetInputMode(FInputModeGameOnly());
|
||||
bShowMouseCursor = false;
|
||||
ApplyDefaultInputMappingContexts();
|
||||
|
||||
APawn* ControlledPawn = GetPawn();
|
||||
if (!ControlledPawn)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ControlledPawn->SetActorHiddenInGame(false);
|
||||
ControlledPawn->SetActorEnableCollision(true);
|
||||
|
||||
if (ACharacter* ControlledCharacter = Cast<ACharacter>(ControlledPawn))
|
||||
{
|
||||
if (UCharacterMovementComponent* MovementComponent = ControlledCharacter->GetCharacterMovement())
|
||||
{
|
||||
MovementComponent->SetMovementMode(MOVE_Walking);
|
||||
}
|
||||
}
|
||||
|
||||
SetViewTarget(ControlledPawn);
|
||||
}
|
||||
|
||||
void AAgrarianGamePlayerController::ApplyDefaultInputMappingContexts()
|
||||
{
|
||||
if (!IsLocalPlayerController())
|
||||
@@ -743,9 +778,7 @@ void AAgrarianGamePlayerController::AgrarianCompleteFrontend()
|
||||
{
|
||||
ApplyMvpCharacterProxyToPawn();
|
||||
SetMvpFrontendPresentationActive(false);
|
||||
SetInputMode(FInputModeGameOnly());
|
||||
bShowMouseCursor = false;
|
||||
ApplyDefaultInputMappingContexts();
|
||||
RestoreGameplayControlState();
|
||||
|
||||
if (const APawn* ControlledPawn = GetPawn())
|
||||
{
|
||||
@@ -753,6 +786,13 @@ void AAgrarianGamePlayerController::AgrarianCompleteFrontend()
|
||||
}
|
||||
}
|
||||
|
||||
void AAgrarianGamePlayerController::AgrarianRepairGameplayInput()
|
||||
{
|
||||
bMvpFrontendPresentationActive = false;
|
||||
RestoreGameplayControlState();
|
||||
ClientMessage(TEXT("Agrarian gameplay input repaired."));
|
||||
}
|
||||
|
||||
void AAgrarianGamePlayerController::AgrarianShowMvpScreen(FName ScreenName)
|
||||
{
|
||||
if (!MvpFrontendWidget)
|
||||
|
||||
@@ -70,6 +70,7 @@ protected:
|
||||
void ApplyMvpCharacterProxyToPawn();
|
||||
void SetMvpFrontendPresentationActive(bool bNewActive);
|
||||
void ApplyDefaultInputMappingContexts();
|
||||
void RestoreGameplayControlState();
|
||||
void CreateOrUpdateMvpFrontendCamera();
|
||||
void CacheAndApplyMvpHudSuppression(bool bSuppress);
|
||||
virtual void AcknowledgePossession(APawn* P) override;
|
||||
@@ -151,6 +152,9 @@ public:
|
||||
UFUNCTION(Exec)
|
||||
void AgrarianCompleteFrontend();
|
||||
|
||||
UFUNCTION(Exec)
|
||||
void AgrarianRepairGameplayInput();
|
||||
|
||||
UFUNCTION(Exec)
|
||||
void AgrarianShowMvpScreen(FName ScreenName);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user