This commit is contained in:
Milxnor
2023-04-01 19:30:06 -04:00
parent 701d3ad0d0
commit e73e2b73be
8 changed files with 32 additions and 16 deletions

View File

@@ -463,9 +463,13 @@ void AFortPlayerController::ServerCreateBuildingActorHook(UObject* Context, FFra
auto MatDefinition = UFortKismetLibrary::K2_GetResourceItemDefinition(BuildingActor->GetResourceType());
auto WorldInventory = PlayerController->GetWorldInventory();
if (!WorldInventory)
return ServerCreateBuildingActorOriginal(Context, Stack, Ret);
auto MatInstance = WorldInventory->FindItemInstance(MatDefinition);
bool bShouldDestroy = MatInstance ? PlayerController->DoesBuildFree() ? false : MatInstance->GetItemEntry()->GetCount() < 10 : true;
bool bShouldDestroy = MatInstance ? (PlayerController->DoesBuildFree() ? false : MatInstance->GetItemEntry()->GetCount() < 10) : true;
if (bShouldDestroy)
{