Add item drop command
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
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 ExtractItem(FName ItemId, int32 Quantity, FAgrarianItemStack& OutStack);",
|
||||
],
|
||||
"AgrarianInventoryComponent.cpp": [
|
||||
"return ExtractItem(ItemId, Quantity, RemovedStack);",
|
||||
"bool UAgrarianInventoryComponent::ExtractItem",
|
||||
"OutStack.ItemId == NAME_None",
|
||||
"OutStack.Quantity += Removed;",
|
||||
"BroadcastInventoryChanged();",
|
||||
],
|
||||
"AgrarianGamePlayerController.h": [
|
||||
"void AgrarianDropItem(FName ItemId, int32 Quantity);",
|
||||
"void ServerAgrarianDropItem(FName ItemId, int32 Quantity);",
|
||||
],
|
||||
"AgrarianGamePlayerController.cpp": [
|
||||
"#include \"AgrarianItemPickup.h\"",
|
||||
"void AAgrarianGamePlayerController::AgrarianDropItem(FName ItemId, int32 Quantity)",
|
||||
"ServerAgrarianDropItem(ItemId, Quantity);",
|
||||
"void AAgrarianGamePlayerController::ServerAgrarianDropItem_Implementation",
|
||||
"InventoryComponent->ExtractItem(ItemId, Quantity, DroppedStack)",
|
||||
"SpawnActor<AAgrarianItemPickup>",
|
||||
"AdjustIfPossibleButAlwaysSpawn",
|
||||
"Pickup->PickupStack = DroppedStack;",
|
||||
"InventoryComponent->AddItem(DroppedStack);",
|
||||
"item restored",
|
||||
],
|
||||
"TechnicalDesignDocument.md": [
|
||||
"`AgrarianDropItem ItemId Quantity`",
|
||||
"extracts stack data before spawning",
|
||||
"restores the removed stack if pickup spawning fails",
|
||||
],
|
||||
"InventoryDataModel.md": [
|
||||
"Drop:",
|
||||
"server removes a stack quantity and spawns a world item or bundle near",
|
||||
],
|
||||
"AGRARIAN_DEVELOPMENT_ROADMAP.md": [
|
||||
"[x] Add item drop.",
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
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("Item drop verification failed: " + "; ".join(missing))
|
||||
|
||||
print("Agrarian item drop verification complete.")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user