This commit is contained in:
2026-05-17 22:44:49 +03:00
commit 26fedadcd8
9071 changed files with 44364 additions and 0 deletions
@@ -0,0 +1,51 @@
// © 2025 Naked People Team. All Rights Reserved.
#include "LocationRestriction.h"
#include "NakedDesire/Locations/LocationData.h"
#include "NakedDesire/Player/NakedDesireCharacter.h"
#define LOCTEXT_NAMESPACE "Missions.Restrictions.Location"
const FText RestrictionsLocationDescription = LOCTEXT("Description", "Visit {LocationName}");
#undef LOCTEXT_NAMESPACE
void ULocationRestriction::Init(ANakedDesireCharacter* PlayerCharacter)
{
Super::Init(PlayerCharacter);
AreaEnterHandle = PlayerCharacter->OnAreaEnter.AddUObject(this, &ULocationRestriction::OnAreaEnter);
AreaExitHandle = PlayerCharacter->OnAreaExit.AddUObject(this, &ULocationRestriction::OnAreaExit);
}
void ULocationRestriction::Stop()
{
Super::Stop();
Player->OnAreaEnter.Remove(AreaEnterHandle);
Player->OnAreaExit.Remove(AreaExitHandle);
}
FText ULocationRestriction::GetDescription() const
{
return FText::Format(RestrictionsLocationDescription,
FFormatNamedArguments
{
{TEXT("LocationName"), TargetLocation->Name}
});
}
void ULocationRestriction::OnAreaEnter(ULocationData* LocationData)
{
if (!IsSuccess && LocationData->Tag.MatchesTag(TargetLocation->Tag))
{
Complete();
}
}
void ULocationRestriction::OnAreaExit(ULocationData* LocationData)
{
if (IsSuccess && LocationData->Tag.MatchesTag(TargetLocation->Tag))
{
Init(Player);
}
}