// © 2025 Naked People Team. All Rights Reserved. #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/SaveSubsystem.h" AItemPickup::AItemPickup() { Mesh = CreateDefaultSubobject(TEXT("Mesh")); SetRootComponent(Mesh); Mesh->SetCollisionEnabled(ECollisionEnabled::NoCollision); Collider = CreateDefaultSubobject(TEXT("Collider")); Collider->SetupAttachment(RootComponent); Collider->SetCollisionEnabled(ECollisionEnabled::QueryOnly); InteractionHint = CreateDefaultSubobject(TEXT("Interaction Hint")); InteractionHint->SetupAttachment(RootComponent); } void AItemPickup::Interact_Implementation(ANakedDesireCharacter* Player) { if (ClothingItemInstance) { USaveSubsystem* SaveSubsystem = UGameplayStatics::GetGameInstance(GetWorld())->GetSubsystem(); Player->ClothingManager->TakeClothing(ClothingItemInstance); SaveSubsystem->GetCurrentSave()->RemoveWorldItem(ClothingItemInstance); Destroy(); } } bool AItemPickup::CanInteract_Implementation(ANakedDesireCharacter* Player) const { return ClothingItemInstance != nullptr; } void AItemPickup::HideInteractionHint_Implementation() { ApplyOutline(Mesh, false, 0); InteractionHint->SetVisibility(false); } void AItemPickup::ShowInteractionFocusHint_Implementation() { ApplyOutline(Mesh, true, 2); InteractionHint->SetVisibility(true); } void AItemPickup::ShowInteractionProximityHint_Implementation() { ApplyOutline(Mesh, true, 1); InteractionHint->SetVisibility(false); } void AItemPickup::BeginPlay() { Super::BeginPlay(); InteractionHint->SetVisibility(false); } void AItemPickup::SetItem(UClothingItemInstance* InItem) { ClothingItemInstance = InItem; Mesh->SetStaticMesh(InItem->GetClothingItem()->StaticMesh); } void AItemPickup::ApplyOutline(UStaticMeshComponent* InMesh, bool bEnabled, int32 StencilValue) { InMesh->SetRenderCustomDepth(bEnabled); InMesh->SetCustomDepthStencilValue(StencilValue); }