Added world items to save game
This commit is contained in:
@@ -123,6 +123,12 @@ void UClothingManager::SpawnClothingPickup(UClothingItemInstance* ItemInstance)
|
||||
UE_LOG(LogTemp, Warning, TEXT("UClothingManager::SpawnClothingPickup NewItemPickup == nullptr"));
|
||||
return;
|
||||
}
|
||||
|
||||
USaveSubsystem* SaveSubsystem = UGameplayStatics::GetGameInstance(GetWorld())->GetSubsystem<USaveSubsystem>();
|
||||
FItemSaveRecord ItemSaveRecord;
|
||||
ItemSaveRecord.Init(ItemInstance);
|
||||
ItemSaveRecord.WorldTransform = NewItemPickup->GetActorTransform();
|
||||
SaveSubsystem->GetCurrentSave()->WorldItems.Push(ItemSaveRecord);
|
||||
|
||||
NewItemPickup->SetItem(ItemInstance);
|
||||
}
|
||||
@@ -184,10 +190,6 @@ void UClothingManager::TakeClothing(UClothingItemInstance* ClothingItemInstance)
|
||||
ItemSaveRecord.Init(ClothingItemInstance);
|
||||
|
||||
SaveSubsystem->GetCurrentSave()->EquippedItems.Push(ItemSaveRecord);
|
||||
SaveSubsystem->GetCurrentSave()->DroppedItems.RemoveAll([ClothingItemInstance](const FItemSaveRecord& Item)
|
||||
{
|
||||
return Item.InstanceId == ClothingItemInstance->GetInstanceId();
|
||||
});
|
||||
|
||||
PutOnClothing(ClothingItemInstance);
|
||||
}
|
||||
@@ -235,11 +237,6 @@ void UClothingManager::DropClothing(const EClothingSlotType ClothingType)
|
||||
if (!ClothingItemInstance)
|
||||
return;
|
||||
|
||||
USaveSubsystem* SaveSubsystem = UGameplayStatics::GetGameInstance(GetWorld())->GetSubsystem<USaveSubsystem>();
|
||||
FItemSaveRecord ItemSaveRecord;
|
||||
ItemSaveRecord.Init(ClothingItemInstance);
|
||||
SaveSubsystem->GetCurrentSave()->DroppedItems.Push(ItemSaveRecord);
|
||||
|
||||
SpawnClothingPickup(ClothingItemInstance);
|
||||
|
||||
OnClothingDropped.Broadcast(ClothingItemInstance);
|
||||
|
||||
Reference in New Issue
Block a user