LifePlay-Revival/Source/LifePlay/LPPersonPropGuardSubsystem.h

39 lines
1.3 KiB
C
Raw Normal View History

// Garde props d'animation (verre, carnet, etc.) : GI::destroyDummy masque le Person et
// ResetVars / mesh vide sans appeler Person::clearProps. Les StaticMeshComponent ajoutes
// par spawnProp restent alors visibles ("seul le verre reste apparent").
// Ce sous-systeme appelle clearProps (et force le masquage des enfants SMC) quand le corps
// est cache ou sans SkeletalMesh, et detruit les props orphelines (socket invalide).
#pragma once
#include "CoreMinimal.h"
#include "Containers/Ticker.h"
#include "Subsystems/GameInstanceSubsystem.h"
#include "LPPersonPropGuardSubsystem.generated.h"
class AActor;
class USkeletalMeshComponent;
class UStaticMeshComponent;
UCLASS()
class LIFEPLAY_API ULPPersonPropGuardSubsystem : public UGameInstanceSubsystem
{
GENERATED_BODY()
public:
virtual void Initialize(FSubsystemCollectionBase& Collection) override;
virtual void Deinitialize() override;
private:
bool Tick(float DeltaTime);
void GuardPerson(AActor* Person);
void ClearOrphanProps(AActor* Person, USkeletalMeshComponent* Mesh);
static USkeletalMeshComponent* GetPersonMesh(AActor* Person);
static void CallClearProps(AActor* Person);
static void ForceHidePropComponents(USkeletalMeshComponent* Mesh);
FTSTicker::FDelegateHandle TickHandle;
TSet<TWeakObjectPtr<AActor>> ClearedWhileInvalid;
bool bLoggedOnce = false;
};