Added phone item

This commit is contained in:
2026-05-31 21:54:33 +03:00
parent 80be766e2c
commit e5657c3c3e
13 changed files with 229 additions and 32 deletions
@@ -9,8 +9,10 @@
class UItemInstance;
class UClothingManager;
class UGlobalSaveGameData;
class UPhoneItemInstance;
DECLARE_DYNAMIC_MULTICAST_DELEGATE(FOnWardrobeChangedSignature);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnPhoneChangedSignature, UPhoneItemInstance*, Phone);
/**
* Runtime owner of the off-body item store (the apartment wardrobe, GDD §6.5 / §10.4).
@@ -31,9 +33,16 @@ public:
UPROPERTY(BlueprintAssignable)
FOnWardrobeChangedSignature OnWardrobeChanged;
// Fires when the phone slot changes; broadcasts the newly-equipped phone, or nullptr when emptied.
UPROPERTY(BlueprintAssignable)
FOnPhoneChangedSignature OnPhoneChanged;
/** Live wardrobe instances (off-body, mirrored from the save). */
const TArray<TObjectPtr<UItemInstance>>& GetWardrobeItems();
/** The phone occupying the dedicated phone slot (§6.5 / §9.9), or nullptr if none is equipped. */
UPhoneItemInstance* GetEquippedPhone();
/** Bring an item into the wardrobe (purchase, world-return). */
void AddToWardrobe(UItemInstance* Item);
@@ -51,12 +60,18 @@ private:
void StoreItem(UItemInstance* Item); // live list + save bucket, no broadcast
void UnstoreItem(UItemInstance* Item); // live list + save bucket, no broadcast
void EquipPhone(UPhoneItemInstance* Phone); // hot-swaps the previous phone back to the wardrobe
void UnequipPhone(UPhoneItemInstance* Phone); // stores the phone back in the wardrobe
UClothingManager* GetPlayerClothingManager() const;
UGlobalSaveGameData* GetSave() const;
UPROPERTY()
TArray<TObjectPtr<UItemInstance>> WardrobeItems;
UPROPERTY()
TObjectPtr<UPhoneItemInstance> EquippedPhone;
// The save the live list was built from; re-hydrate when this changes (e.g. load game).
TWeakObjectPtr<UGlobalSaveGameData> HydratedSave;
};