added test city, added embarrassment loss resolver and sleep for energy loss

This commit is contained in:
2026-06-04 20:11:13 +03:00
parent 034694695a
commit 83c20836ad
21 changed files with 87 additions and 5 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -10,12 +10,15 @@
#include "LossPresentationConfig.h" #include "LossPresentationConfig.h"
#include "MovieSceneSequencePlaybackSettings.h" #include "MovieSceneSequencePlaybackSettings.h"
#include "NakedDesireGameInstance.h" #include "NakedDesireGameInstance.h"
#include "TimeOfDaySubsystem.h"
#include "GameFramework/Character.h" #include "GameFramework/Character.h"
#include "GameFramework/CharacterMovementComponent.h" #include "GameFramework/CharacterMovementComponent.h"
#include "GameFramework/PlayerStart.h" #include "GameFramework/PlayerStart.h"
#include "Kismet/GameplayStatics.h" #include "Kismet/GameplayStatics.h"
#include "NakedDesire/Clothing/ClothingItemInstance.h" #include "NakedDesire/Clothing/ClothingItemInstance.h"
#include "NakedDesire/Interactables/ItemPickup.h" #include "NakedDesire/Interactables/ItemPickup.h"
#include "NakedDesire/Player/NakedDesireCharacter.h"
#include "NakedDesire/Stats/StatsManager.h"
#include "NakedDesire/SaveGame/GlobalSaveGameData.h" #include "NakedDesire/SaveGame/GlobalSaveGameData.h"
#include "NakedDesire/SaveGame/SaveSubsystem.h" #include "NakedDesire/SaveGame/SaveSubsystem.h"
@@ -58,15 +61,21 @@ void USessionLossResolver::ResolveLoss(ESessionLossCause Cause)
case ESessionLossCause::EmbarrassmentMax: case ESessionLossCause::EmbarrassmentMax:
// Fade to apartment with no extra cost — no time skip, money, or rep hit. // Fade to apartment with no extra cost — no time skip, money, or rep hit.
LoseAllWorldClothing();
break; break;
case ESessionLossCause::EnergyZero: case ESessionLossCause::EnergyZero:
// Forced sleep cycle: everything left outside the apartment is guaranteed lost. // Forced sleep cycle: everything left outside the apartment is guaranteed lost.
LoseAllWorldClothing(); if (UTimeOfDaySubsystem* Time = GetWorld()->GetSubsystem<UTimeOfDaySubsystem>())
{
Time->Sleep();
}
ResolveSleepLoss();
break; break;
case ESessionLossCause::PoliceCapture: case ESessionLossCause::PoliceCapture:
{ {
LoseAllWorldClothing();
UGlobalSaveGameData* Save = GetSave(); UGlobalSaveGameData* Save = GetSave();
if (Save && Save->Money >= PoliceCaptureMoneyPenalty) if (Save && Save->Money >= PoliceCaptureMoneyPenalty)
{ {
@@ -246,6 +255,15 @@ void USessionLossResolver::TeleportPlayerHome()
Movement->StopMovementImmediately(); Movement->StopMovementImmediately();
} }
} }
// A new day starts at home: clear embarrassment and refill energy / stamina (§4.4).
if (const ANakedDesireCharacter* Character = Cast<ANakedDesireCharacter>(PlayerPawn))
{
if (UStatsManager* Stats = Character->StatsManager)
{
Stats->ResetStats();
}
}
} }
void USessionLossResolver::Autosave() const void USessionLossResolver::Autosave() const
+11
View File
@@ -160,3 +160,14 @@ void UStatsManager::RestoreEnergy()
EnergyUpdate.Broadcast(Energy, MaxEnergy); EnergyUpdate.Broadcast(Energy, MaxEnergy);
} }
void UStatsManager::ResetStats()
{
Embarrassment = 0.0f;
Energy = MaxEnergy;
Stamina = MaxStamina;
EmbarrassmentUpdate.Broadcast(Embarrassment, MaxEmbarrassment);
StaminaUpdate.Broadcast(Stamina, MaxStamina);
EnergyUpdate.Broadcast(Energy, MaxEnergy);
}
+5
View File
@@ -65,6 +65,11 @@ public:
void DecreaseEnergy(float Amount); void DecreaseEnergy(float Amount);
void RestoreEnergy(); void RestoreEnergy();
// Restore every attribute to its full / baseline value (Embarrassment cleared, Energy and
// Stamina refilled). Called when the player is sent home after a session loss (GDD §4.4).
UFUNCTION(BlueprintCallable)
void ResetStats();
UPROPERTY(BlueprintAssignable) UPROPERTY(BlueprintAssignable)
FAttributeUpdateSignature EmbarrassmentUpdate; FAttributeUpdateSignature EmbarrassmentUpdate;