feat: RP asset functions

This commit is contained in:
2024-10-27 19:49:15 +01:00
parent b4e8796e74
commit 86362e2658
9 changed files with 281 additions and 79 deletions

View File

@@ -17,7 +17,7 @@ public:
/**
* Fuel item that this heater uses
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Turbine", meta=( UIMin = "1", UIMax = "2" ))
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Boiler")
int32 mTier = 1;
/**
@@ -37,4 +37,10 @@ public:
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Boiler")
float mDuration = 6.f;
/**
* Curve for the production to Heat
*/
UPROPERTY( EditDefaultsOnly, BlueprintReadOnly, Category = "Boiler" )
UCurveFloat* mBoilerCurve;
};

View File

@@ -18,7 +18,7 @@ public:
/**
* What type of heater this is
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Heater")
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Cooler")
ERRDACoolerType mType = ERRDACoolerType::Chemical;
/**

View File

@@ -28,24 +28,24 @@ public:
* What Item should be a Dirt?
* @warning - If 2 DirtDataAssets have the same Item, the game will use the last one which was loaded
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "FicsitFarming")
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Dirt")
TSubclassOf<UFGItemDescriptor> mItem;
/**
* Seeds that can be extracted from this dirt every cycle
*/
UPROPERTY( EditAnywhere, BlueprintReadWrite, Category="FicsitFarming" )
UPROPERTY( EditAnywhere, BlueprintReadWrite, Category="Dirt" )
TArray<FItemAmount> mExtractableSeed;
/**
* Production time for the extraction of seeds
*/
UPROPERTY( EditAnywhere, BlueprintReadWrite, Category="FicsitFarming" )
UPROPERTY( EditAnywhere, BlueprintReadWrite, Category="Dirt" )
float mExtractionCycleTime = 6.0f;
/**
* How much dirt should be consumed?
*/
UPROPERTY( EditAnywhere, BlueprintReadWrite, Category="FicsitFarming" )
UPROPERTY( EditAnywhere, BlueprintReadWrite, Category="Dirt" )
int32 mDirtConsume = 2;
};

View File

@@ -17,24 +17,24 @@ public:
/**
* Fuel item that this heater uses
*/
UPROPERTY( EditAnywhere, BlueprintReadWrite, Category = "Turbine", meta=( UIMin = "1", UIMax = "5" ) )
UPROPERTY( EditAnywhere, BlueprintReadWrite, Category = "Generator", meta=( UIMin = "1", UIMax = "5" ) )
int32 mTier = 1;
/**
* Maximum power output of the generator
*/
UPROPERTY( EditAnywhere, BlueprintReadWrite, Category = "Mp Generator" )
UPROPERTY( EditAnywhere, BlueprintReadWrite, Category = "Generator" )
float mMaxPowerOutput;
/**
* Maximum RPM of the generator
*/
UPROPERTY( EditAnywhere, BlueprintReadWrite, Category = "Mp Generator" )
UPROPERTY( EditAnywhere, BlueprintReadWrite, Category = "Generator" )
int mMaxRPM;
/**
* Curve that defines the power output of the generator
*/
UPROPERTY( EditAnywhere, BlueprintReadWrite, Category = "Mp Generator" )
UPROPERTY( EditAnywhere, BlueprintReadWrite, Category = "Generator" )
UCurveFloat* mGeneratorCurve;
};

View File

@@ -39,4 +39,13 @@ public:
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Heater")
float mDuration = 6.f;
UPROPERTY( EditAnywhere, BlueprintReadWrite, Category = "Heater" )
float mHeat = 1;
UPROPERTY( EditAnywhere, BlueprintReadWrite, Category = "Heater" )
float mMaxHeatValue = 500;
UPROPERTY( EditAnywhere, BlueprintReadWrite, Category = "Heater" )
float mMinHeatValue = 20;
};

View File

@@ -19,7 +19,7 @@ public:
/**
* Fuel item that this heater uses
*/
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Turbine", meta=( UIMin = "1", UIMax = "2" ))
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Turbine")
int32 mTier = 1;
/**

View File

@@ -17,7 +17,42 @@
#include "RRDADataAssetSubsystem.generated.h"
class IAssetRegistry;
// We need this otherwise some of the cache will GC'd
USTRUCT(BlueprintType)
struct FRRDADataHolderTurbineData
{
GENERATED_BODY()
UPROPERTY(BlueprintReadOnly)
TMap<TSubclassOf<UFGItemDescriptor>, URRDATurbineDataAsset*> Data;
};
USTRUCT(BlueprintType)
struct FRRDADataHolderBoilerData
{
GENERATED_BODY()
UPROPERTY(BlueprintReadOnly)
TMap<TSubclassOf<UFGItemDescriptor>, URRDABoilerDataAsset*> Data;
};
USTRUCT(BlueprintType)
struct FRRDADataHolderCoolerData
{
GENERATED_BODY()
UPROPERTY(BlueprintReadOnly)
TMap<TSubclassOf<UFGItemDescriptor>, URRDACoolerDataAsset*> Data;
};
USTRUCT(BlueprintType)
struct FRRDADataHolderHeaterData
{
GENERATED_BODY()
UPROPERTY(BlueprintReadOnly)
TMap<TSubclassOf<UFGItemDescriptor>, URRDAHeaterDataAsset*> Data;
};
UCLASS()
class REFINEDRDAPI_API URRDADataAssetSubsystem : public UGameInstanceSubsystem
@@ -88,6 +123,42 @@ public:
UFUNCTION(BlueprintPure, Category = "RRDA|DataAsset|RP|MP")
TArray<URRDACoolerDataAsset*> GetAllCoolerAssets(ERRDACoolerType Type) const;
// Generator Functions
UFUNCTION(BlueprintPure, Category = "RRDA|DataAsset|RP|MP")
URRDAGeneratorDataAsset* GetGeneratorItemData(int32 Tier) const;
// Boiler Functions
UFUNCTION(BlueprintPure, Category = "RRDA|DataAsset|RP|MP")
bool GetAllBoilerItems(TArray<TSubclassOf<UFGItemDescriptor>>& Items, int32 Tier) const;
UFUNCTION(BlueprintPure, Category = "RRDA|DataAsset|RP|MP")
URRDABoilerDataAsset* GetBoilerItemData(TSubclassOf<UFGItemDescriptor>Item, int32 Tier) const;
UFUNCTION(BlueprintPure, Category = "RRDA|DataAsset|RP|MP")
bool GetAllBoilerRelevantItems(TArray<TSubclassOf<UFGItemDescriptor>>& Items, int32 Tier) const;
UFUNCTION(BlueprintPure, Category = "RRDA|DataAsset|RP|MP")
URRDABoilerDataAsset* GetDefaultBoilerAsset(int32 Tier) const;
UFUNCTION(BlueprintPure, Category = "RRDA|DataAsset|RP|MP")
TArray<URRDABoilerDataAsset*> GetAllBoilerAssets(int32 Tier) const;
// Heater Functions
UFUNCTION(BlueprintPure, Category = "RRDA|DataAsset|RP|MP")
bool GetAllHeaterItems(TArray<TSubclassOf<UFGItemDescriptor>>& Items, ERRDAHeaterType Type) const;
UFUNCTION(BlueprintPure, Category = "RRDA|DataAsset|RP|MP")
URRDAHeaterDataAsset* GetHeaterItemData(TSubclassOf<UFGItemDescriptor>Item, ERRDAHeaterType Type) const;
UFUNCTION(BlueprintPure, Category = "RRDA|DataAsset|RP|MP")
bool GetAllHeaterRelevantItems(TArray<TSubclassOf<UFGItemDescriptor>>& Items, ERRDAHeaterType Type) const;
UFUNCTION(BlueprintPure, Category = "RRDA|DataAsset|RP|MP")
URRDAHeaterDataAsset* GetDefaultHeaterAsset(ERRDAHeaterType Type) const;
UFUNCTION(BlueprintPure, Category = "RRDA|DataAsset|RP|MP")
TArray<URRDAHeaterDataAsset*> GetAllHeaterAssets(ERRDAHeaterType Type) const;
public:
/**
* Find all data assets of a specific class
@@ -97,23 +168,29 @@ public:
template<class T>
bool FindAllDataAssetsOfClass(TSet<T*>& OutDataAssets);
private:
UPROPERTY()
public:
UPROPERTY(BlueprintReadOnly, Category = "RRDA|DataAsset")
TMap<TSubclassOf<UFGItemDescriptor>, URRDADirtDataAsset*> mDirtAssets;
UPROPERTY()
UPROPERTY(BlueprintReadOnly, Category = "RRDA|DataAsset")
TMap<int32, URRDAGeneratorDataAsset*> mGeneratorAssets;
TMap<int32, TMap<TSubclassOf<UFGItemDescriptor>, URRDATurbineDataAsset*>> mTurbineAssets;
TMap<int32, TMap<TSubclassOf<UFGItemDescriptor>, URRDABoilerDataAsset*>> mBoilerAssets;
TMap<ERRDACoolerType, TMap<TSubclassOf<UFGItemDescriptor>, URRDACoolerDataAsset*>> mCoolerAssets;
TMap<ERRDAHeaterType, TMap<TSubclassOf<UFGItemDescriptor>, URRDAHeaterDataAsset*>> mHeaterAssets;
UPROPERTY(BlueprintReadOnly, Category = "RRDA|DataAsset")
TMap<int32, FRRDADataHolderTurbineData> mTurbineAssets;
UPROPERTY(BlueprintReadOnly, Category = "RRDA|DataAsset")
TMap<int32, FRRDADataHolderBoilerData> mBoilerAssets;
UPROPERTY(BlueprintReadOnly, Category = "RRDA|DataAsset")
TMap<ERRDACoolerType, FRRDADataHolderCoolerData> mCoolerAssets;
UPROPERTY(BlueprintReadOnly, Category = "RRDA|DataAsset")
TMap<ERRDAHeaterType, FRRDADataHolderHeaterData> mHeaterAssets;
public:
UPROPERTY(BlueprintReadOnly, Transient, Category = "RRDA|DataAsset")
UPROPERTY(BlueprintReadOnly, Category = "RRDA|DataAsset")
TSet<URRDADataAssetBase*> mDisabledDataAssets;
UPROPERTY(BlueprintReadOnly, Transient, Category = "RRDA|DataAsset")
UPROPERTY(BlueprintReadOnly, Category = "RRDA|DataAsset")
TSet<URRDADataAssetBase*> mEnabledDataAssets;
};
@@ -155,5 +232,6 @@ bool URRDADataAssetSubsystem::FindAllDataAssetsOfClass(TSet<T*>& OutDataAssets)
}
}
UE_LOG(LogRRDApi, Warning, TEXT("Found %d of: %s"), OutDataAssets.Num(), *T::StaticClass()->GetPathName());
return OutDataAssets.Num() > 0;
}