Harden gameplay input restore after frontend
This commit is contained in:
@@ -33,6 +33,8 @@ EXPECTED = {
|
||||
"AgrarianGamePlayerController.h": [
|
||||
"ShowMvpPauseMenu",
|
||||
"HandleMvpEscapeInput",
|
||||
"RestoreGameplayControlState",
|
||||
"AgrarianRepairGameplayInput",
|
||||
],
|
||||
"AgrarianGamePlayerController.cpp": [
|
||||
"SetIgnoreMoveInput(true)",
|
||||
@@ -46,6 +48,11 @@ EXPECTED = {
|
||||
"ResetIgnoreMoveInput();",
|
||||
"ResetIgnoreLookInput();",
|
||||
"ApplyDefaultInputMappingContexts();",
|
||||
"void AAgrarianGamePlayerController::RestoreGameplayControlState()",
|
||||
"ControlledPawn->SetActorHiddenInGame(false)",
|
||||
"ControlledPawn->SetActorEnableCollision(true)",
|
||||
"MovementComponent->SetMovementMode(MOVE_Walking)",
|
||||
"void AAgrarianGamePlayerController::AgrarianRepairGameplayInput()",
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
@@ -52,8 +52,9 @@ def main() -> None:
|
||||
"SetIgnoreMoveInput(true)",
|
||||
"SetIgnoreLookInput(true)",
|
||||
"SetInputMode(FInputModeGameOnly())",
|
||||
"SetIgnoreMoveInput(false)",
|
||||
"SetIgnoreLookInput(false)",
|
||||
"ResetIgnoreMoveInput()",
|
||||
"ResetIgnoreLookInput()",
|
||||
"RestoreGameplayControlState",
|
||||
"saving",
|
||||
):
|
||||
require(token in controller + frontend, f"missing modal input or debug token: {token}")
|
||||
|
||||
@@ -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