This repository has been archived on 2026-05-24. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
AgrarianGameArchive/Scripts/verify_mvp_menu_input_and_quit_flow.py
T

92 lines
3.2 KiB
Python

from pathlib import Path
ROOT = Path(__file__).resolve().parents[1]
FILES = {
"AgrarianMvpFrontendWidget.h": ROOT / "Source" / "AgrarianGame" / "AgrarianMvpFrontendWidget.h",
"AgrarianMvpFrontendWidget.cpp": ROOT / "Source" / "AgrarianGame" / "AgrarianMvpFrontendWidget.cpp",
"AgrarianGamePlayerController.h": ROOT / "Source" / "AgrarianGame" / "AgrarianGamePlayerController.h",
"AgrarianGamePlayerController.cpp": ROOT / "Source" / "AgrarianGame" / "AgrarianGamePlayerController.cpp",
}
EXPECTED = {
"AgrarianMvpFrontendWidget.h": [
"ConfirmActiveScreen",
"BackFromActiveScreen",
"SaveAndQuit",
],
"AgrarianMvpFrontendWidget.cpp": [
"UButton::StaticClass()",
"HandleMaleCharacterClicked",
"HandleFemaleCharacterClicked",
"OnClicked.AddDynamic",
"Save & Quit",
"Saving World",
"ConsoleCommand(TEXT(\"AgrarianSaveWorld\"))",
"ConsoleCommand(TEXT(\"quit\"))",
"AAgrarianGamePlayerController* AgrarianPlayerController",
"AgrarianPlayerController->AgrarianSelectCharacter",
"AgrarianPlayerController->AgrarianCompleteFrontend",
"PlayerController->ResetIgnoreMoveInput()",
"PlayerController->ResetIgnoreLookInput()",
],
"AgrarianGamePlayerController.h": [
"ShowMvpPauseMenu",
"HandleMvpEscapeInput",
"RestoreGameplayControlState",
"AgrarianRepairGameplayInput",
],
"AgrarianGamePlayerController.cpp": [
"SetIgnoreMoveInput(true)",
"SetIgnoreLookInput(true)",
"FInputModeUIOnly",
"InputComponent->BindKey(EKeys::Enter",
"InputComponent->BindKey(EKeys::SpaceBar",
"InputComponent->BindKey(EKeys::Escape",
"MvpFrontendWidget->IsInViewport()",
"ShowMvpPauseMenu();",
"ResetIgnoreMoveInput();",
"ResetIgnoreLookInput();",
"ApplyDefaultInputMappingContexts();",
"void AAgrarianGamePlayerController::RestoreGameplayControlState()",
"ControlledPawn->SetActorHiddenInGame(false)",
"ControlledPawn->SetActorEnableCollision(true)",
"MovementComponent->SetMovementMode(MOVE_Walking)",
"void AAgrarianGamePlayerController::AgrarianRepairGameplayInput()",
],
}
FORBIDDEN = {
"AgrarianMvpFrontendWidget.cpp": [
"ConsoleCommand(TEXT(\"AgrarianSelectCharacter",
"ConsoleCommand(TEXT(\"AgrarianCompleteFrontend\"))",
"PlayerController->SetIgnoreMoveInput(false)",
"PlayerController->SetIgnoreLookInput(false)",
],
"AgrarianGamePlayerController.cpp": [
"BindKey(EKeys::LeftMouseButton",
],
}
def main():
failures = []
for label, path in FILES.items():
text = path.read_text(encoding="utf-8")
for snippet in EXPECTED[label]:
if snippet not in text:
failures.append(f"{label} missing {snippet!r}")
for snippet in FORBIDDEN.get(label, []):
if snippet in text:
failures.append(f"{label} should not contain {snippet!r}")
if failures:
raise RuntimeError("MVP menu input and quit flow verification failed: " + "; ".join(failures))
print("Agrarian MVP menu input and quit flow verification complete.")
if __name__ == "__main__":
main()