Further fixes for interact system

This commit is contained in:
2026-09-05 00:15:50 +02:00
parent 30a93d2e0d
commit 7176fb6d24
7 changed files with 21 additions and 24 deletions

View File

@@ -59,5 +59,7 @@ NetIndexFirstBitSegment=16
+GameplayTagList=(Tag="Skins.Eleri.Default",DevComment="")
+GameplayTagList=(Tag="Skins.Eleri.DefaultNoHat",DevComment="")
+GameplayTagList=(Tag="Upgrade.Bazaar",DevComment="")
+GameplayTagList=(Tag="Upgrade.Bazaar.BetterEmotions",DevComment="")
+GameplayTagList=(Tag="Upgrade.Bazaar.Capacity",DevComment="")
+GameplayTagList=(Tag="Upgrade.Bazaar.MoreCustomers",DevComment="")

Binary file not shown.

View File

@@ -20,6 +20,8 @@
#include "UI/TradeWidget.h"
#include "ProjectEleri/Public/UI/SelectionManager.h"
#include "ProjectEleri/DialogueSystem/DialogueWidget.h"
#include "Subsystem/InteractionSubsystem.h"
#include "Interface/InteractableActorInterface.h"
AEleriPlayerController::AEleriPlayerController(const FObjectInitializer &ObjectInitializer)
: Super(ObjectInitializer)
@@ -741,10 +743,10 @@ void AEleriPlayerController::ToggleInteractionMenu(bool bActive)
}
if (UEnhancedInputLocalPlayerSubsystem *Subsystem = ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(GetLocalPlayer()))
{
if (bActive)
Subsystem->AddMappingContext(InteractionMenuContext, 15);
else
Subsystem->RemoveMappingContext(InteractionMenuContext);
// if (bActive)
// Subsystem->AddMappingContext(InteractionMenuContext, 15);
// else
// Subsystem->RemoveMappingContext(InteractionMenuContext);
}
}
}
@@ -1151,6 +1153,13 @@ void AEleriPlayerController::OnInteract(const FInputActionValue &Value)
if (PlayerCharacter->GetIsPlanting())
PlayerCharacter->PlantSeed();
// Ask the InteractionSystem plugin's subsystem for the closest valid interactable
// and fire the interaction on it if we have one.
if (AActor *ClosestInteractable = UInteractionSubsystem::GetClosestInteractable(this))
{
IInteractableActorInterface::Execute_Interact(ClosestInteractable, PlayerCharacter);
}
PlayerCharacter->OnInteract.Broadcast();
}

View File

@@ -34,12 +34,6 @@ AMyCharacter::AMyCharacter()
// Set this character to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
InteractableOverlapMesh = CreateDefaultSubobject<UBoxComponent>(FName("Box Collision"));
InteractableOverlapMesh->SetupAttachment(RootComponent);
InteractableOverlapMesh->SetRelativeLocation(FVector(0.0f, 0.0f, 33.33f));
InteractableOverlapMesh->SetRelativeScale3D(FVector(2.0f, 2.0f, 4.0f));
InteractableOverlapMesh->SetGenerateOverlapEvents(true);
StatForgeComponent = CreateDefaultSubobject<UStatForgeComponent>(TEXT("StatForgeComponent"));
}
@@ -64,11 +58,6 @@ void AMyCharacter::BeginPlay()
PlayerController = Cast<AEleriPlayerController>(UGameplayStatics::GetPlayerController(GetWorld(), 0));
}
if (IsValid(InteractableOverlapMesh)) {
InteractableOverlapMesh->OnComponentBeginOverlap.AddDynamic(this, &AMyCharacter::OnEnteredInteractableObject);
InteractableOverlapMesh->OnComponentEndOverlap.AddDynamic(this, &AMyCharacter::OnLeftInteractableObject);
}
CameraRef = GetComponentByClass<UCameraComponent>();
SpringArmRef = GetComponentByClass<USpringArmComponent>();
PlayerController->SetViewTarget(this);

View File

@@ -43,9 +43,6 @@ protected:
UPROPERTY()
ABookActor* BookActor;
UPROPERTY(EditAnywhere)
UBoxComponent* InteractableOverlapMesh;
UPROPERTY()
AEleriPlayerController* PlayerController;
UPROPERTY()