Files
Naked-Desire/Source/NakedDesire/Clothing/DroppedClothingSubsystem.h
T
2026-06-03 15:17:02 +03:00

40 lines
1.5 KiB
C++

// © 2025 Naked People Team. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "Subsystems/WorldSubsystem.h"
#include "DroppedClothingSubsystem.generated.h"
class AItemPickup;
/**
* Single source of truth for which clothing is currently lying in the world (GDD §6.3.4 / §13.4).
* Every AItemPickup self-registers on BeginPlay and unregisters on EndPlay (pickup destroys the actor),
* so the tracked set always matches what is on the ground without per-query actor iteration.
*
* Backs the "move away from your clothing" objective family — distance is measured to the nearest tracked
* pickup. World-scoped and transient; the pickups themselves are persisted via the save's world items.
*/
UCLASS()
class NAKEDDESIRE_API UDroppedClothingSubsystem : public UWorldSubsystem
{
GENERATED_BODY()
public:
// Called by AItemPickup as it spawns / is destroyed.
void RegisterPickup(AItemPickup* Pickup);
void UnregisterPickup(AItemPickup* Pickup);
// True while at least one clothing pickup exists in the world.
UFUNCTION(BlueprintPure, Category = "Clothing")
bool HasDroppedClothing() const;
// Distance in cm from From to the nearest tracked pickup. Returns false (and leaves OutDistance
// untouched) when nothing is on the ground — callers decide what "no clothing to move from" means.
bool GetDistanceToNearestDroppedClothing(const FVector& From, float& OutDistance) const;
private:
UPROPERTY()
TArray<TObjectPtr<AItemPickup>> Pickups;
};