Added commissions system

This commit is contained in:
2026-06-01 00:27:56 +03:00
parent fd040d6a01
commit db7067fc68
81 changed files with 2418 additions and 1065 deletions
@@ -0,0 +1,46 @@
// © 2025 Naked People Team. All Rights Reserved.
#include "DayPhaseConstraint.h"
#include "NakedDesire/Player/NakedDesireCharacter.h"
#define LOCTEXT_NAMESPACE "Commissions.Constraints.DayPhase"
void UDayPhaseConstraint::OnActivate()
{
if (UTimeOfDaySubsystem* Time = GetTime())
Time->OnPhaseChanged.AddUniqueDynamic(this, &UDayPhaseConstraint::HandlePhaseChanged);
}
void UDayPhaseConstraint::OnDeactivate()
{
if (UTimeOfDaySubsystem* Time = GetTime())
Time->OnPhaseChanged.RemoveDynamic(this, &UDayPhaseConstraint::HandlePhaseChanged);
}
bool UDayPhaseConstraint::IsMet() const
{
const UTimeOfDaySubsystem* Time = GetTime();
return Time && Time->GetPhase() == RequiredPhase;
}
void UDayPhaseConstraint::HandlePhaseChanged(EDayPhase NewPhase)
{
NotifyChanged();
}
UTimeOfDaySubsystem* UDayPhaseConstraint::GetTime() const
{
UWorld* World = Player ? Player->GetWorld() : nullptr;
return World ? World->GetSubsystem<UTimeOfDaySubsystem>() : nullptr;
}
FText UDayPhaseConstraint::GetDescription() const
{
return (RequiredPhase == EDayPhase::Night)
? LOCTEXT("Night", "at night")
: LOCTEXT("Day", "during the day");
}
#undef LOCTEXT_NAMESPACE