75 lines
3.0 KiB
Python
75 lines
3.0 KiB
Python
from pathlib import Path
|
|
|
|
|
|
ROOT = Path(__file__).resolve().parents[1]
|
|
FILES = {
|
|
"AgrarianInventoryComponent.h": ROOT / "Source" / "AgrarianGame" / "AgrarianInventoryComponent.h",
|
|
"AgrarianInventoryComponent.cpp": ROOT / "Source" / "AgrarianGame" / "AgrarianInventoryComponent.cpp",
|
|
"AgrarianGamePlayerController.h": ROOT / "Source" / "AgrarianGame" / "AgrarianGamePlayerController.h",
|
|
"AgrarianGamePlayerController.cpp": ROOT / "Source" / "AgrarianGame" / "AgrarianGamePlayerController.cpp",
|
|
"TechnicalDesignDocument.md": ROOT / "Docs" / "TechnicalDesignDocument.md",
|
|
"InventoryDataModel.md": ROOT / "Docs" / "InventoryDataModel.md",
|
|
"AGRARIAN_DEVELOPMENT_ROADMAP.md": ROOT / "AGRARIAN_DEVELOPMENT_ROADMAP.md",
|
|
}
|
|
|
|
EXPECTED = {
|
|
"AgrarianInventoryComponent.h": [
|
|
"bool SplitStackByIndex(int32 StackIndex, int32 SplitQuantity);",
|
|
"void ServerSplitStackByIndex(int32 StackIndex, int32 SplitQuantity);",
|
|
],
|
|
"AgrarianInventoryComponent.cpp": [
|
|
"bool UAgrarianInventoryComponent::SplitStackByIndex",
|
|
"Items.IsValidIndex(StackIndex)",
|
|
"Items.Num() >= MaxSlots",
|
|
"SplitQuantity >= SourceStack.Quantity",
|
|
"FAgrarianItemStack SplitStack = SourceStack;",
|
|
"SplitStack.Quantity = SplitQuantity;",
|
|
"SourceStack.Quantity -= SplitQuantity;",
|
|
"Items.Add(SplitStack);",
|
|
"BroadcastInventoryChanged();",
|
|
"void UAgrarianInventoryComponent::ServerSplitStackByIndex_Implementation",
|
|
],
|
|
"AgrarianGamePlayerController.h": [
|
|
"void AgrarianSplitStack(int32 StackIndex, int32 SplitQuantity);",
|
|
"void ServerAgrarianSplitStack(int32 StackIndex, int32 SplitQuantity);",
|
|
],
|
|
"AgrarianGamePlayerController.cpp": [
|
|
"void AAgrarianGamePlayerController::AgrarianSplitStack(int32 StackIndex, int32 SplitQuantity)",
|
|
"Usage: AgrarianSplitStack <StackIndex> <SplitQuantity>",
|
|
"ServerAgrarianSplitStack(StackIndex, SplitQuantity);",
|
|
"void AAgrarianGamePlayerController::ServerAgrarianSplitStack_Implementation",
|
|
"InventoryComponent->SplitStackByIndex(StackIndex, SplitQuantity)",
|
|
"Split %d items from stack %d.",
|
|
],
|
|
"TechnicalDesignDocument.md": [
|
|
"`AgrarianSplitStack StackIndex SplitQuantity`",
|
|
"creates a separate inventory slot",
|
|
"does not re-merge",
|
|
],
|
|
"InventoryDataModel.md": [
|
|
"Stack splitting:",
|
|
"server moves a requested quantity into a new stack when slots",
|
|
],
|
|
"AGRARIAN_DEVELOPMENT_ROADMAP.md": [
|
|
"[x] Add stack splitting.",
|
|
],
|
|
}
|
|
|
|
|
|
def main():
|
|
missing = []
|
|
for label, path in FILES.items():
|
|
text = path.read_text(encoding="utf-8")
|
|
for snippet in EXPECTED[label]:
|
|
if snippet not in text:
|
|
missing.append(f"{label}: {snippet}")
|
|
|
|
if missing:
|
|
raise RuntimeError("Stack splitting verification failed: " + "; ".join(missing))
|
|
|
|
print("Agrarian stack splitting verification complete.")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|