This repository has been archived on 2026-05-24. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files

70 lines
2.2 KiB
C++

// Copyright Pacificao. All Rights Reserved.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "AgrarianFoliagePatch.generated.h"
class UHierarchicalInstancedStaticMeshComponent;
class USceneComponent;
UCLASS(Blueprintable)
class AGRARIANGAME_API AAgrarianFoliagePatch : public AActor
{
GENERATED_BODY()
public:
AAgrarianFoliagePatch();
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Agrarian|Foliage")
TObjectPtr<USceneComponent> SceneRoot;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Agrarian|Foliage")
TObjectPtr<UHierarchicalInstancedStaticMeshComponent> TreeInstances;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Agrarian|Foliage")
TObjectPtr<UHierarchicalInstancedStaticMeshComponent> ShrubInstances;
UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = "Agrarian|Foliage")
TObjectPtr<UHierarchicalInstancedStaticMeshComponent> GrassInstances;
UFUNCTION(BlueprintCallable, Category = "Agrarian|Foliage")
void ClearFoliage();
UFUNCTION(BlueprintCallable, Category = "Agrarian|Foliage")
int32 AddTreeInstance(const FTransform& InstanceTransform);
UFUNCTION(BlueprintCallable, Category = "Agrarian|Foliage")
int32 AddShrubInstance(const FTransform& InstanceTransform);
UFUNCTION(BlueprintCallable, Category = "Agrarian|Foliage")
int32 AddGrassInstance(const FTransform& InstanceTransform);
UFUNCTION(BlueprintPure, Category = "Agrarian|Foliage")
int32 GetTreeInstanceCount() const;
UFUNCTION(BlueprintPure, Category = "Agrarian|Foliage")
int32 GetShrubInstanceCount() const;
UFUNCTION(BlueprintPure, Category = "Agrarian|Foliage")
int32 GetGrassInstanceCount() const;
UFUNCTION(BlueprintCallable, Category = "Agrarian|Foliage|Fire")
void GetFuelCountsNearLocation(
const FVector& WorldLocation,
float Radius,
int32& OutGrassCount,
int32& OutShrubCount,
int32& OutTreeCount) const;
UFUNCTION(BlueprintPure, Category = "Agrarian|Foliage|Fire")
float GetDryVegetationFuelScoreNearLocation(const FVector& WorldLocation, float Radius) const;
protected:
int32 CountInstancesNearLocation(
const UHierarchicalInstancedStaticMeshComponent* Component,
const FVector& WorldLocation,
float Radius) const;
};