Skip to content
This repository has been archived by the owner on Oct 11, 2024. It is now read-only.

Commit

Permalink
Add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
lucoiso committed Nov 13, 2022
1 parent 98d5923 commit 7eb7e65
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
12 changes: 10 additions & 2 deletions Source/ElementusInventory/Public/ElementusInventoryComponent.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,23 @@ class ELEMENTUSINVENTORY_API UElementusInventoryComponent : public UActorCompone
UFUNCTION(BlueprintPure, Category = "Elementus Inventory")
int32 GetCurrentNumItems() const;

/* Called on every inventory update */
UPROPERTY(BlueprintAssignable, Category = "Elementus Inventory")
FElementusInventoryUpdate OnInventoryUpdate;

/* Called when the inventory is empty */
UPROPERTY(BlueprintAssignable, Category = "Elementus Inventory")
FElementusInventoryEmpty OnInventoryEmpty;

/* Get the items that this inventory have */
UFUNCTION(BlueprintPure, Category = "Elementus Inventory")
TArray<FElementusItemInfo> GetItemsArray() const;

/* Get a reference of the item at given index */
UFUNCTION(BlueprintPure, Category = "Elementus Inventory")
FElementusItemInfo& GetItemReferenceAt(const int32 Index);

/* Get a copy of the item at given index */
UFUNCTION(BlueprintPure, Category = "Elementus Inventory")
FElementusItemInfo GetItemCopyAt(const int32 Index) const;

Expand All @@ -93,8 +97,7 @@ class ELEMENTUSINVENTORY_API UElementusInventoryComponent : public UActorCompone
/* Find the first elementus item that matches the specified id */
UFUNCTION(BlueprintPure, Category = "Elementus Inventory")
bool FindFirstItemIndexWithId(const FPrimaryElementusItemId InId, int32& OutIndex, const FGameplayTagContainer IgnoreTags = FGameplayTagContainer(), const int32 Offset = 0) const;



/* Find the first elementus item that matches the specified info */
UFUNCTION(BlueprintPure, Category = "Elementus Inventory")
bool FindAllItemIndexesWithInfo(const FElementusItemInfo InItemInfo, TArray<int32>& OutIndexes, const FGameplayTagContainer IgnoreTags = FGameplayTagContainer()) const;
Expand All @@ -115,18 +118,23 @@ class ELEMENTUSINVENTORY_API UElementusInventoryComponent : public UActorCompone
UFUNCTION(BlueprintCallable, Category = "Elementus Inventory")
virtual void DebugInventory();

/* Remove all items from this inventory */
UFUNCTION(NetMulticast, Reliable, BlueprintCallable, Category = "Elementus Inventory")
void ClearInventory();

/* Update the current weight of this inventory */
UFUNCTION(Client, Unreliable, BlueprintCallable, Category = "Elementus Inventory")
void UpdateWeight();

/* Get items from another inventory */
UFUNCTION(Server, Reliable, BlueprintCallable, Category = "Elementus Inventory")
void GetItemsFrom(UElementusInventoryComponent* OtherInventory, const TArray<int32>& ItemIndexes);

/* Give items to another inventory */
UFUNCTION(Server, Reliable, BlueprintCallable, Category = "Elementus Inventory")
void GiveItemsTo(UElementusInventoryComponent* OtherInventory, const TArray<int32>& ItemIndexes);

/* Discard items from this inventory */
UFUNCTION(Server, Reliable, BlueprintCallable, Category = "Elementus Inventory")
void DiscardItems(const TArray<int32>& ItemIndexes);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,15 @@ class ELEMENTUSINVENTORY_API UElementusInventoryFunctions final : public UBluepr
UFUNCTION(BlueprintCallable, Category = "Elementus Inventory")
static void TradeElementusItem(TArray<FElementusItemInfo> ItemsToTrade, UElementusInventoryComponent* FromInventory, UElementusInventoryComponent* ToInventory);

/* Check if the given item info have a valid id */
UFUNCTION(BlueprintPure, Category = "Elementus Inventory")
static bool IsItemValid(const FElementusItemInfo InItemInfo);

/* Check if the given item info represents a stackable item */
UFUNCTION(BlueprintPure, Category = "Elementus Inventory")
static bool IsItemStackable(const FElementusItemInfo InItemInfo);

/* Get item tags providing a parent tag */
UFUNCTION(BlueprintPure, Category = "Elementus Inventory")
static FGameplayTagContainer GetItemTagsWithParentTag(const FElementusItemInfo InItemInfo, const FGameplayTag FromParentTag);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class ELEMENTUSINVENTORY_API AElementusInventoryPackage : public AActor
virtual void BeginPlay() override;
virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;

/* Will this package auto destroy when empty? */
/* Should this package auto destroy when empty? */
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Elementus Inventory", meta = (Getter = "GetDestroyOnEmpty", Setter = "SetDestroyOnEmpty"))
bool bDestroyWhenInventoryIsEmpty;

Expand Down

0 comments on commit 7eb7e65

Please sign in to comment.