Added world items to save game

This commit is contained in:
2026-05-28 22:36:29 +03:00
parent 78840dcfb1
commit 8c49583a69
8 changed files with 41 additions and 13 deletions
@@ -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();
}
}