Files
Rainer LeitandClaude Fable 5.1 4f2c55cd2a Step 1: the Salty project, two modules, tests and the gym
Salty.uproject (UE 5.8) from the Third Person template with class redirects, the SaltyCore and Salty modules,
the three build targets, USaltyAssetManager calling InitGlobalData, Config/Tags with the 23 root namespaces,
Scripts/run-tests.sh, build.sh and Authoring/create_gym.py, L_Gym, Git LFS attributes and the placeholder test.
Template variants kept as reference (D-41). The four Fab packs stay out of the repository for now (~10 GB).
The editor serves the engine MCP plugin on 127.0.0.1:8000 through DefaultEditorPerProjectUserSettings.ini.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-09-16 20:10:43 +03:00

55 lines
1.6 KiB
C++

// Copyright Epic Games, Inc. All Rights Reserved.
#include "SideScrollingPickup.h"
#include "GameFramework/Character.h"
#include "SideScrollingGameMode.h"
#include "Components/SphereComponent.h"
#include "Components/SceneComponent.h"
#include "Engine/World.h"
ASideScrollingPickup::ASideScrollingPickup()
{
PrimaryActorTick.bCanEverTick = false;
// create the root comp
RootComponent = CreateDefaultSubobject<USceneComponent>(TEXT("Root"));
// create the bounding sphere
Sphere = CreateDefaultSubobject<USphereComponent>(TEXT("Collision"));
Sphere->SetupAttachment(RootComponent);
Sphere->SetSphereRadius(100.0f);
Sphere->SetCollisionObjectType(ECC_WorldDynamic);
Sphere->SetCollisionEnabled(ECollisionEnabled::QueryOnly);
Sphere->SetCollisionResponseToAllChannels(ECR_Ignore);
Sphere->SetCollisionResponseToChannel(ECC_Pawn, ECR_Overlap);
// add the overlap handler
OnActorBeginOverlap.AddDynamic(this, &ASideScrollingPickup::BeginOverlap);
}
void ASideScrollingPickup::BeginOverlap(AActor* OverlappedActor, AActor* OtherActor)
{
// have we collided against a character?
if (ACharacter* OverlappedCharacter = Cast<ACharacter>(OtherActor))
{
// is this the player character?
if (OverlappedCharacter->IsPlayerControlled())
{
// get the game mode
if (ASideScrollingGameMode* GM = Cast<ASideScrollingGameMode>(GetWorld()->GetAuthGameMode()))
{
// tell the game mode to process a pickup
GM->ProcessPickup();
// disable collision so we don't get picked up again
SetActorEnableCollision(false);
// Call the BP handler. It will be responsible for destroying the pickup
BP_OnPickedUp();
}
}
}
}