Added commissions system
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include "NakedDesireGameInstance.generated.h"
|
||||
|
||||
class UStartingSaveData;
|
||||
class UCommissionBoardConfig;
|
||||
|
||||
UCLASS()
|
||||
class NAKEDDESIRE_API UNakedDesireGameInstance : public UGameInstance
|
||||
@@ -15,4 +16,8 @@ class NAKEDDESIRE_API UNakedDesireGameInstance : public UGameInstance
|
||||
public:
|
||||
UPROPERTY(EditDefaultsOnly, Category = "Save")
|
||||
TObjectPtr<UStartingSaveData> StartingSaveData;
|
||||
|
||||
// Hand-authored commission pool the UMissionSubsystem offers (§13).
|
||||
UPROPERTY(EditDefaultsOnly, Category = "Commissions")
|
||||
TObjectPtr<UCommissionBoardConfig> CommissionBoard;
|
||||
};
|
||||
@@ -0,0 +1,6 @@
|
||||
// © 2025 Naked People Team. All Rights Reserved.
|
||||
|
||||
|
||||
#include "NakedDesireGameplayTags.h"
|
||||
|
||||
UE_DEFINE_GAMEPLAY_TAG(TAG_Location_Apartment, "Location.Apartment");
|
||||
@@ -0,0 +1,10 @@
|
||||
// © 2025 Naked People Team. All Rights Reserved.
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "NativeGameplayTags.h"
|
||||
|
||||
// Native gameplay tags shared across systems. The apartment is identified by its ULocationData tag
|
||||
// matching (or nesting under) Location.Apartment — that is how the session boundary is detected now,
|
||||
// replacing the old per-trigger bIsApartment flag.
|
||||
UE_DECLARE_GAMEPLAY_TAG_EXTERN(TAG_Location_Apartment);
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "SessionManagerSubsystem.generated.h"
|
||||
|
||||
class UStatsManager;
|
||||
class ULocationData;
|
||||
|
||||
/**
|
||||
* Why a session ended (GDD §4.4). SafeReturn is a non-loss end (player walked
|
||||
@@ -33,6 +34,10 @@ DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnSessionEndSignature, ESessionLoss
|
||||
* ALocationTrigger drives start / end; embarrassment-max and energy-zero are
|
||||
* detected by subscribing to UStatsManager. This replaces the EndGameEmbarrassed
|
||||
* Blueprint event on ANakedDesireGameMode.
|
||||
*
|
||||
* The apartment threshold is detected via ULocationSubsystem: a session starts when the player leaves
|
||||
* a location tagged Location.Apartment and ends (SafeReturn) when they re-enter one. There is no
|
||||
* per-trigger apartment flag — the apartment is just a tagged location.
|
||||
*/
|
||||
UCLASS()
|
||||
class NAKEDDESIRE_API USessionManagerSubsystem : public UWorldSubsystem
|
||||
@@ -42,10 +47,6 @@ class NAKEDDESIRE_API USessionManagerSubsystem : public UWorldSubsystem
|
||||
public:
|
||||
virtual void OnWorldBeginPlay(UWorld& InWorld) override;
|
||||
|
||||
// Called by the apartment ALocationTrigger as the player crosses the threshold.
|
||||
void NotifyEnteredApartment();
|
||||
void NotifyLeftApartment();
|
||||
|
||||
UFUNCTION(BlueprintPure, Category = "Session")
|
||||
bool IsSessionActive() const { return bSessionActive; }
|
||||
|
||||
@@ -69,6 +70,12 @@ private:
|
||||
|
||||
void BindToPlayerStats();
|
||||
|
||||
UFUNCTION()
|
||||
void HandleLocationEntered(ULocationData* Location);
|
||||
|
||||
UFUNCTION()
|
||||
void HandleLocationExited(ULocationData* Location);
|
||||
|
||||
UFUNCTION()
|
||||
void HandleEmbarrassmentUpdate(float CurrentValue, float MaxValue);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user