Clothing system refactor

This commit is contained in:
olehhapuk
2026-05-29 22:13:09 +03:00
parent b6b81caf4e
commit 1c8ee03083
59 changed files with 417 additions and 227 deletions
@@ -1,27 +1,24 @@
#include "ClothingItemInstance.h"
#include "ClothingItem.h"
#include "NakedDesire/SaveGame/ItemSaveRecord.h"
#include "ClothingItemDefinition.h"
#include "StructUtils/InstancedStruct.h"
void UClothingItemInstance::Init(UClothingItem* InClothingItem)
void UClothingItemInstance::Init(UClothingItemDefinition* InClothingItem)
{
ClothingItem = InClothingItem;
ItemDefinition = InClothingItem;
}
void UClothingItemInstance::Setup(UClothingItem* InClothingItem, const TArray<UItemInstance*>& InStoredItems,
const float InCondition, const FGuid InInstanceId)
void UClothingItemInstance::CaptureState(FInstancedStruct& OutState) const
{
this->ClothingItem = InClothingItem;
this->StoredItems = InStoredItems;
this->Condition = InCondition;
this->InstanceId = InInstanceId;
FClothingInstanceState ClothingState;
ClothingState.Condition = Condition;
OutState.InitializeAs<FClothingInstanceState>(ClothingState);
}
UClothingItemInstance* UClothingItemInstance::CreateFromSave(UObject* Outer, const FItemSaveRecord& ItemSaveRecord)
void UClothingItemInstance::ApplyState(const FInstancedStruct& InState)
{
UClothingItemInstance* NewItemInstance = NewObject<UClothingItemInstance>(Outer);
NewItemInstance->Setup(ItemSaveRecord.Definition.Get(), {}, ItemSaveRecord.Condition, ItemSaveRecord.InstanceId);
return NewItemInstance;
}
if (const FClothingInstanceState* ClothingState = InState.GetPtr<FClothingInstanceState>())
{
Condition = ClothingState->Condition;
}
}