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>
49 lines
1.6 KiB
C++
49 lines
1.6 KiB
C++
// Copyright ExByte Studios. Item Interaction Ecosystem.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "Components/ActorComponent.h"
|
|
#include "GameplayTagContainer.h"
|
|
#include "InteractableComponent.generated.h"
|
|
|
|
class UInteractionAction;
|
|
|
|
/**
|
|
* Marks an actor as interactable and lists the actions it offers (section 8.1).
|
|
* Attach to pickups, chests, vehicles, generators, doors, workbenches, corpses,
|
|
* placed items, quest objects, etc.
|
|
*/
|
|
UCLASS(ClassGroup = (Interaction), meta = (BlueprintSpawnableComponent))
|
|
class ITEMINTERACTION_API UInteractableComponent : public UActorComponent
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
UInteractableComponent();
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Interaction")
|
|
FGameplayTag InteractableType;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Interaction")
|
|
FText DisplayName;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Interaction")
|
|
float InteractionDistance = 250.f;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Interaction")
|
|
bool bRequiresLineOfSight = true;
|
|
|
|
/** Free-form world tags exposed to the interaction context (e.g. Vehicle, Generator). */
|
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Interaction")
|
|
FGameplayTagContainer InteractionTags;
|
|
|
|
/** Explicit action classes this object offers (in addition to data-driven item rows). */
|
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Instanced, Category = "Interaction")
|
|
TArray<TObjectPtr<UInteractionAction>> AvailableActions;
|
|
|
|
/** Server-side soft claim so two players don't interact with the same object at once. */
|
|
UPROPERTY(BlueprintReadOnly, Category = "Interaction")
|
|
bool bIsBusy = false;
|
|
};
|