Rework interaction system

This commit is contained in:
koritsa
2026-05-28 21:53:34 +03:00
committed by koritsa
parent 372516c535
commit 97936ae495
26 changed files with 496 additions and 216 deletions
@@ -6,6 +6,7 @@
#include "ClothingItemInstance.h"
#include "GameFramework/Character.h"
#include "Kismet/GameplayStatics.h"
#include "NakedDesire/Interactables/ItemPickup.h"
#include "NakedDesire/Player/NakedDesireCharacter.h"
#include "NakedDesire/SaveGame/GlobalSaveGameData.h"
#include "NakedDesire/SaveGame/ItemSaveRecord.h"
@@ -108,6 +109,24 @@ USkeletalMeshComponent* UClothingManager::GetMeshComponent(const EClothingSlotTy
}
}
void UClothingManager::SpawnClothingPickup(UClothingItemInstance* ItemInstance)
{
if (!ItemPickupActor)
{
UE_LOG(LogTemp, Warning, TEXT("UClothingManager::SpawnClothingPickup ItemPickupActor is not set"));
return;
}
AItemPickup* NewItemPickup = GetWorld()->SpawnActor<AItemPickup>(ItemPickupActor, GetOwner()->GetActorTransform());
if (!NewItemPickup)
{
UE_LOG(LogTemp, Warning, TEXT("UClothingManager::SpawnClothingPickup NewItemPickup == nullptr"));
return;
}
NewItemPickup->SetItem(ItemInstance);
}
void UClothingManager::PutOnClothing(UClothingItemInstance* ClothingItemInstance)
{
if (!ClothingItemInstance)
@@ -220,6 +239,8 @@ void UClothingManager::DropClothing(const EClothingSlotType ClothingType)
FItemSaveRecord ItemSaveRecord;
ItemSaveRecord.Init(ClothingItemInstance);
SaveSubsystem->GetCurrentSave()->DroppedItems.Push(ItemSaveRecord);
SpawnClothingPickup(ClothingItemInstance);
OnClothingDropped.Broadcast(ClothingItemInstance);
}