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 "MovieSceneSequencePlaybackSettings.h"
#include "NakedDesireGameInstance.h"
#include "TimeOfDaySubsystem.h"
#include "GameFramework/Character.h"
#include "GameFramework/CharacterMovementComponent.h"
#include "GameFramework/PlayerStart.h"
#include "Kismet/GameplayStatics.h"
#include "NakedDesire/Clothing/ClothingItemInstance.h"
#include "NakedDesire/Interactables/ItemPickup.h"
#include "NakedDesire/Player/NakedDesireCharacter.h"
#include "NakedDesire/Stats/StatsManager.h"
#include "NakedDesire/SaveGame/GlobalSaveGameData.h"
#include "NakedDesire/SaveGame/SaveSubsystem.h"
@@ -58,15 +61,21 @@ void USessionLossResolver::ResolveLoss(ESessionLossCause Cause)
case ESessionLossCause::EmbarrassmentMax:
// Fade to apartment with no extra cost — no time skip, money, or rep hit.
LoseAllWorldClothing();
break;
case ESessionLossCause::EnergyZero:
// Forced sleep cycle: everything left outside the apartment is guaranteed lost.
LoseAllWorldClothing();
if (UTimeOfDaySubsystem* Time = GetWorld()->GetSubsystem<UTimeOfDaySubsystem>())
{
Time->Sleep();
}
ResolveSleepLoss();
break;
case ESessionLossCause::PoliceCapture:
{
LoseAllWorldClothing();
UGlobalSaveGameData* Save = GetSave();
if (Save && Save->Money >= PoliceCaptureMoneyPenalty)
{
@@ -246,6 +255,15 @@ void USessionLossResolver::TeleportPlayerHome()
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
+11
View File
@@ -160,3 +160,14 @@ void UStatsManager::RestoreEnergy()
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 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)
FAttributeUpdateSignature EmbarrassmentUpdate;