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.4 KiB
C++
49 lines
1.4 KiB
C++
// Copyright ExByte Studios. Item Interaction Ecosystem.
|
|
|
|
#pragma once
|
|
|
|
#include "CoreMinimal.h"
|
|
#include "Components/ActorComponent.h"
|
|
#include "ItemInteractionInterfaces.h"
|
|
#include "FuelTankComponent.generated.h"
|
|
|
|
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnFuelChanged, float, NewFuel);
|
|
|
|
/**
|
|
* A fuel reservoir on a world object (generator, vehicle) that accepts fuel poured
|
|
* from a held canister (section 15, 31.4). Implements IItemUseTarget for the
|
|
* "TransferFuel" result verb.
|
|
*/
|
|
UCLASS(ClassGroup = (Interaction), meta = (BlueprintSpawnableComponent))
|
|
class ITEMWORLD_API UFuelTankComponent : public UActorComponent, public IItemUseTarget
|
|
{
|
|
GENERATED_BODY()
|
|
|
|
public:
|
|
UFuelTankComponent();
|
|
|
|
virtual void GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const override;
|
|
|
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Fuel")
|
|
float MaxFuel = 40.f;
|
|
|
|
/** Max litres poured per single use action. */
|
|
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Fuel")
|
|
float PourAmount = 10.f;
|
|
|
|
UPROPERTY(ReplicatedUsing = OnRep_Fuel, BlueprintReadOnly, Category = "Fuel")
|
|
float CurrentFuel = 0.f;
|
|
|
|
UPROPERTY(BlueprintAssignable, Category = "Fuel")
|
|
FOnFuelChanged OnFuelChanged;
|
|
|
|
//~ IItemUseTarget
|
|
virtual bool ReceiveHeldUse(FName ResultVerb, FItemInstanceData& HeldItem, AActor* Instigator) override;
|
|
|
|
protected:
|
|
UFUNCTION()
|
|
void OnRep_Fuel();
|
|
|
|
bool HasAuthority() const;
|
|
};
|