Added commissions system

This commit is contained in:
2026-06-01 00:27:56 +03:00
parent dd7ed121fc
commit 9a5a0003b1
81 changed files with 2418 additions and 1065 deletions
@@ -5,6 +5,9 @@
#include "Kismet/GameplayStatics.h"
#include "NakedDesire/Global/Constants.h"
#include "NakedDesire/Global/NakedDesireGameplayTags.h"
#include "NakedDesire/Locations/LocationData.h"
#include "NakedDesire/Locations/LocationSubsystem.h"
#include "NakedDesire/Player/NakedDesireCharacter.h"
#include "NakedDesire/Stats/StatsManager.h"
@@ -12,6 +15,13 @@ void USessionManagerSubsystem::OnWorldBeginPlay(UWorld& InWorld)
{
Super::OnWorldBeginPlay(InWorld);
// The apartment threshold is now a location event (Location.Apartment), not a per-trigger flag.
if (ULocationSubsystem* Locations = InWorld.GetSubsystem<ULocationSubsystem>())
{
Locations->OnLocationEntered.AddDynamic(this, &USessionManagerSubsystem::HandleLocationEntered);
Locations->OnLocationExited.AddDynamic(this, &USessionManagerSubsystem::HandleLocationExited);
}
// The player pawn and its UStatsManager may not have finished BeginPlay when
// the world begins play, so defer binding by one tick.
InWorld.GetTimerManager().SetTimerForNextTick(this, &USessionManagerSubsystem::BindToPlayerStats);
@@ -30,19 +40,19 @@ void USessionManagerSubsystem::BindToPlayerStats()
Player->StatsManager->EnergyUpdate.AddDynamic(this, &USessionManagerSubsystem::HandleEnergyUpdate);
}
void USessionManagerSubsystem::NotifyEnteredApartment()
void USessionManagerSubsystem::HandleLocationEntered(ULocationData* Location)
{
// Returning home is the safe end of a session (§4.3).
if (bSessionActive)
// Returning to the apartment is the safe end of a session (§4.3).
if (Location && Location->Tag.MatchesTag(TAG_Location_Apartment) && bSessionActive)
{
EndSession(ESessionLossCause::SafeReturn);
}
}
void USessionManagerSubsystem::NotifyLeftApartment()
void USessionManagerSubsystem::HandleLocationExited(ULocationData* Location)
{
// Leaving the apartment is the only way to start a session (§4.1).
if (!bSessionActive)
if (Location && Location->Tag.MatchesTag(TAG_Location_Apartment) && !bSessionActive)
{
StartSession();
}