Added world items to save game
This commit is contained in:
@@ -4,10 +4,14 @@
|
||||
#include "ItemPickup.h"
|
||||
#include "Components/BoxComponent.h"
|
||||
#include "Components/WidgetComponent.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
#include "NakedDesire/Clothing/ClothingItem.h"
|
||||
#include "NakedDesire/Clothing/ClothingItemInstance.h"
|
||||
#include "NakedDesire/Clothing/ClothingManager.h"
|
||||
#include "NakedDesire/Player/NakedDesireCharacter.h"
|
||||
#include "NakedDesire/SaveGame/GlobalSaveGameData.h"
|
||||
#include "NakedDesire/SaveGame/ItemSaveRecord.h"
|
||||
#include "NakedDesire/SaveGame/SaveSubsystem.h"
|
||||
|
||||
AItemPickup::AItemPickup()
|
||||
{
|
||||
@@ -27,7 +31,12 @@ void AItemPickup::Interact_Implementation(ANakedDesireCharacter* Player)
|
||||
{
|
||||
if (ClothingItemInstance)
|
||||
{
|
||||
USaveSubsystem* SaveSubsystem = UGameplayStatics::GetGameInstance(GetWorld())->GetSubsystem<USaveSubsystem>();
|
||||
Player->ClothingManager->TakeClothing(ClothingItemInstance);
|
||||
SaveSubsystem->GetCurrentSave()->WorldItems.RemoveAll([this](const FItemSaveRecord& Item)
|
||||
{
|
||||
return ClothingItemInstance->GetInstanceId() == Item.InstanceId;
|
||||
});
|
||||
Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user