Files
inventory-system-plugin/Source/ItemDatabase/Public/ItemDefinitionRow.h
Bonchellon 7f7e043a88 Initial commit: Item Interaction Ecosystem plugin (UE5.7)
Server-authoritative, data-driven item/inventory/interaction/carry/equipment/
world-slot/placement/crafting framework. 8 modules, compiles against UE 5.7.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-22 20:49:56 +03:00

113 lines
3.7 KiB
C++

// Copyright ExByte Studios. Item Interaction Ecosystem.
#pragma once
#include "CoreMinimal.h"
#include "Engine/DataTable.h"
#include "GameplayTagContainer.h"
#include "ItemPlacementRules.h"
#include "ItemDefinitionRow.generated.h"
class UTexture2D;
class UStaticMesh;
/**
* Static, design-time data for an item type (section 4.2 / 6.1 DT_Items).
*
* One row per ItemId. Assets are soft references so the database never force-loads
* meshes/icons just to answer a flag query (section 33). Never replicated; never
* saved - only the ItemId travels in FItemInstanceData.
*/
USTRUCT(BlueprintType)
struct ITEMDATABASE_API FItemDefinitionRow : public FTableRowBase
{
GENERATED_BODY()
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Identity")
FName ItemId;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Identity")
FText DisplayName;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Identity", meta = (MultiLine = true))
FText Description;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Identity")
FGameplayTag ItemType;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Identity")
FGameplayTagContainer ItemTags;
// --- Visuals (soft refs, section 33) ---
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Visual")
TSoftObjectPtr<UTexture2D> Icon;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Visual")
TSoftObjectPtr<UStaticMesh> WorldMesh;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Visual")
TSoftClassPtr<AActor> PickupActorClass;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Visual")
TSoftClassPtr<AActor> EquippedActorClass;
// --- Stacking / weight / grid ---
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Stack", meta = (ClampMin = "1"))
int32 MaxStack = 1;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Stack", meta = (ClampMin = "0"))
float Weight = 0.f;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Stack")
FIntPoint GridSize = FIntPoint(1, 1);
// --- Capability flags (section 4.2) ---
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Capabilities")
bool bCanStoreInInventory = true;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Capabilities")
bool bCanInstantPickup = true;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Capabilities")
bool bCanWorldCarry = false;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Capabilities")
bool bCanEquip = false;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Capabilities")
bool bCanPlace = false;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Capabilities")
bool bCanInstallIntoWorldSlot = false;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Capabilities")
bool bCanDrop = true;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Capabilities")
bool bIsQuestCritical = false;
// --- Interaction defaults ---
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Interaction")
FGameplayTag DefaultInteraction;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Interaction")
FGameplayTag AlternativeInteraction;
// --- Slot compatibility ---
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Slots")
FGameplayTagContainer AllowedEquipmentSlots;
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Slots")
FGameplayTagContainer CompatibleWorldSlots;
// --- Features ---
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Features")
FGameplayTagContainer ItemFeatures;
// --- Placement (section 13.3); only meaningful when bCanPlace ---
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Placement", meta = (EditCondition = "bCanPlace"))
FItemPlacementRules PlacementRules;
bool HasFeature(const FGameplayTag& Feature) const { return ItemFeatures.HasTag(Feature); }
};