feat: RP asset functions
This commit is contained in:
parent
b4e8796e74
commit
86362e2658
@ -4,8 +4,17 @@
|
||||
|
||||
bool URRDATurbineDataAsset::IsEnabled_Internal(UObject* WorldContextObject) const
|
||||
{
|
||||
fgcheck(mTier > 0);
|
||||
fgcheck(mRPMDrag > 0);
|
||||
fgcheck(mMaxRPM > 0);
|
||||
// If this Asset is not disabled we want to check that all the values are valid
|
||||
if(!mIsDisabled)
|
||||
{
|
||||
fgcheckf(mTier > 0, TEXT("%s: mTier must be larger then 0"), *GetName());
|
||||
fgcheckf(mRPMDrag > 0, TEXT("%s: mRPMDrag must be larger then 0"), *GetName());
|
||||
fgcheckf(mMaxRPM > 0, TEXT("%s: mMaxRPM must be larger then 0"), *GetName());
|
||||
fgcheckf(mRPMMultiplier > 0.f, TEXT("%s: mMaxRPM must be larger then 0"), *GetName());
|
||||
fgcheckf(mRPHandleTime > 0.f, TEXT("%s: mRPHandleTime must be larger then 0"), *GetName());
|
||||
fgcheckf(mDuration > 0.f, TEXT("%s: mDuration must be larger then 0"), *GetName());
|
||||
fgcheckf(mItem.Amount > 0, TEXT("%s: mItem.Amount must be larger then 0"), *GetName());
|
||||
fgcheckf(mItem.ItemClass, TEXT("%s: mItem.ItemClass must be valid"), *GetName());
|
||||
}
|
||||
return Super::IsEnabled_Internal(WorldContextObject);
|
||||
}
|
@ -55,13 +55,13 @@ void URRDADataAssetSubsystem::Deinitialize()
|
||||
mBoilerAssets.Empty();
|
||||
mCoolerAssets.Empty();
|
||||
mHeaterAssets.Empty();
|
||||
mGeneratorAssets.Empty();
|
||||
}
|
||||
|
||||
void URRDADataAssetSubsystem::StartScanForDataAssets()
|
||||
{
|
||||
UAssetManager& Manager = UAssetManager::Get();
|
||||
Manager.LoadPrimaryAssetsWithType(FPrimaryAssetType("RRDADataAsset"));
|
||||
|
||||
// UAssetManager& Manager = UAssetManager::Get();
|
||||
// Manager.LoadPrimaryAssetsWithType(FPrimaryAssetType("RRDADataAsset"));
|
||||
mDisabledDataAssets.Empty();
|
||||
mEnabledDataAssets.Empty();
|
||||
|
||||
@ -91,98 +91,94 @@ void URRDADataAssetSubsystem::ReCacheTurbineDataAssets()
|
||||
{
|
||||
mTurbineAssets.Empty();
|
||||
TSet<URRDATurbineDataAsset*> DataAssets;
|
||||
int32 Added = 0;
|
||||
if(FindAllDataAssetsOfClass(DataAssets))
|
||||
{
|
||||
for (URRDATurbineDataAsset* DataAsset : DataAssets)
|
||||
{
|
||||
if(!mTurbineAssets.Contains(DataAsset->mTier)) {
|
||||
mTurbineAssets.Add(DataAsset->mTier, TMap<TSubclassOf<UFGItemDescriptor>, URRDATurbineDataAsset*>());
|
||||
mTurbineAssets.Add(DataAsset->mTier, FRRDADataHolderTurbineData());
|
||||
}
|
||||
|
||||
if(!DataAsset->mItem.ItemClass) {
|
||||
UE_LOG(LogRRDApi, Fatal, TEXT("TurbineDataAsset %s has no ItemClass"), *DataAsset->GetPathName());
|
||||
continue;
|
||||
}
|
||||
fgcheckf(DataAsset->mItem.ItemClass, TEXT("TurbineDataAsset %s has no ItemClass"), *DataAsset->GetPathName());
|
||||
|
||||
mTurbineAssets[DataAsset->mTier].Add(DataAsset->mItem.ItemClass, DataAsset);
|
||||
mTurbineAssets[DataAsset->mTier].Data.Add(DataAsset->mItem.ItemClass, DataAsset);
|
||||
Added++;
|
||||
}
|
||||
}
|
||||
|
||||
UE_LOG(LogRRDApi, Log, TEXT("ReCacheTurbineDataAssets: %d"), mTurbineAssets.Num());
|
||||
UE_LOG(LogRRDApi, Log, TEXT("ReCacheTurbineDataAssets: %d"), Added);
|
||||
}
|
||||
|
||||
void URRDADataAssetSubsystem::ReCacheBoilerDataAssets() {
|
||||
mBoilerAssets.Empty();
|
||||
TSet<URRDABoilerDataAsset*> DataAssets;
|
||||
int32 Added = 0;
|
||||
if(FindAllDataAssetsOfClass(DataAssets))
|
||||
{
|
||||
for (URRDABoilerDataAsset* DataAsset : DataAssets)
|
||||
{
|
||||
if(!mBoilerAssets.Contains(DataAsset->mTier)) {
|
||||
mBoilerAssets.Add(DataAsset->mTier, TMap<TSubclassOf<UFGItemDescriptor>, URRDABoilerDataAsset*>());
|
||||
mBoilerAssets.Add(DataAsset->mTier, FRRDADataHolderBoilerData());
|
||||
}
|
||||
|
||||
if(!DataAsset->mInput.ItemClass) {
|
||||
UE_LOG(LogRRDApi, Fatal, TEXT("BoilerDataAsset %s has no ItemClass"), *DataAsset->GetPathName());
|
||||
continue;
|
||||
}
|
||||
fgcheckf(DataAsset->mInput.ItemClass, TEXT("BoilerDataAsset %s has no ItemClass"), *DataAsset->GetPathName());
|
||||
|
||||
mBoilerAssets[DataAsset->mTier].Add(DataAsset->mInput.ItemClass, DataAsset);
|
||||
mBoilerAssets[DataAsset->mTier].Data.Add(DataAsset->mInput.ItemClass, DataAsset);
|
||||
Added++;
|
||||
}
|
||||
}
|
||||
|
||||
UE_LOG(LogRRDApi, Log, TEXT("ReCacheBoilerDataAssets: %d"), mTurbineAssets.Num());
|
||||
UE_LOG(LogRRDApi, Log, TEXT("ReCacheBoilerDataAssets: %d"), Added);
|
||||
}
|
||||
|
||||
void URRDADataAssetSubsystem::ReCacheCoolerDataAssets() {
|
||||
mCoolerAssets.Empty();
|
||||
TSet<URRDACoolerDataAsset*> DataAssets;
|
||||
int32 Added = 0;
|
||||
if(FindAllDataAssetsOfClass(DataAssets))
|
||||
{
|
||||
for (URRDACoolerDataAsset* DataAsset : DataAssets)
|
||||
{
|
||||
if(!mCoolerAssets.Contains(DataAsset->mType)) {
|
||||
mCoolerAssets.Add(DataAsset->mType, TMap<TSubclassOf<UFGItemDescriptor>, URRDACoolerDataAsset*>());
|
||||
mCoolerAssets.Add(DataAsset->mType, FRRDADataHolderCoolerData());
|
||||
}
|
||||
|
||||
if(!DataAsset->mItem) {
|
||||
UE_LOG(LogRRDApi, Fatal, TEXT("CoolerDataAsset %s has no ItemClass"), *DataAsset->GetPathName());
|
||||
continue;
|
||||
}
|
||||
fgcheckf(DataAsset->mItem, TEXT("CoolerDataAsset %s has no ItemClass"), *DataAsset->GetPathName());
|
||||
|
||||
mCoolerAssets[DataAsset->mType].Add(DataAsset->mItem, DataAsset);
|
||||
mCoolerAssets[DataAsset->mType].Data.Add(DataAsset->mItem, DataAsset);
|
||||
Added++;
|
||||
}
|
||||
}
|
||||
|
||||
UE_LOG(LogRRDApi, Log, TEXT("ReCacheCoolerDataAssets: %d"), mTurbineAssets.Num());
|
||||
UE_LOG(LogRRDApi, Log, TEXT("ReCacheCoolerDataAssets: %d"), Added);
|
||||
}
|
||||
|
||||
void URRDADataAssetSubsystem::ReCacheHeaterDataAssets() {
|
||||
mHeaterAssets.Empty();
|
||||
TSet<URRDAHeaterDataAsset*> DataAssets;
|
||||
int32 Added = 0;
|
||||
if(FindAllDataAssetsOfClass(DataAssets))
|
||||
{
|
||||
for (URRDAHeaterDataAsset* DataAsset : DataAssets)
|
||||
{
|
||||
if(!mHeaterAssets.Contains(DataAsset->mType)) {
|
||||
mHeaterAssets.Add(DataAsset->mType, TMap<TSubclassOf<UFGItemDescriptor>, URRDAHeaterDataAsset*>());
|
||||
mHeaterAssets.Add(DataAsset->mType, FRRDADataHolderHeaterData());
|
||||
}
|
||||
|
||||
fgcheckf(DataAsset->mInput.ItemClass, TEXT("HeaterDataAsset %s has no ItemClass"), *DataAsset->GetPathName());
|
||||
|
||||
if(!DataAsset->mInput.ItemClass) {
|
||||
UE_LOG(LogRRDApi, Fatal, TEXT("HeaterDataAsset %s has no ItemClass"), *DataAsset->GetPathName());
|
||||
continue;
|
||||
}
|
||||
|
||||
mHeaterAssets[DataAsset->mType].Add(DataAsset->mInput.ItemClass, DataAsset);
|
||||
mHeaterAssets[DataAsset->mType].Data.Add(DataAsset->mInput.ItemClass, DataAsset);
|
||||
Added++;
|
||||
}
|
||||
}
|
||||
|
||||
UE_LOG(LogRRDApi, Log, TEXT("ReCacheHeaterDataAssets: %d"), mTurbineAssets.Num());
|
||||
UE_LOG(LogRRDApi, Log, TEXT("ReCacheHeaterDataAssets: %d"), Added);
|
||||
}
|
||||
|
||||
void URRDADataAssetSubsystem::ReCacheGeneratorDataAssets()
|
||||
{
|
||||
mHeaterAssets.Empty();
|
||||
mGeneratorAssets.Empty();
|
||||
TSet<URRDAGeneratorDataAsset*> DataAssets;
|
||||
if(FindAllDataAssetsOfClass(DataAssets))
|
||||
{
|
||||
@ -192,11 +188,15 @@ void URRDADataAssetSubsystem::ReCacheGeneratorDataAssets()
|
||||
}
|
||||
}
|
||||
|
||||
UE_LOG(LogRRDApi, Log, TEXT("ReCacheHeaterDataAssets: %d"), mTurbineAssets.Num());
|
||||
UE_LOG(LogRRDApi, Log, TEXT("ReCacheGeneratorDataAssets: %d"), mGeneratorAssets.Num());
|
||||
}
|
||||
|
||||
int32 URRDADataAssetSubsystem::GetAllDirtItems(TArray<TSubclassOf<UFGItemDescriptor>>& Items) const
|
||||
{
|
||||
if(!mDirtAssets.Num())
|
||||
{
|
||||
UE_LOG(LogRRDApi, Error, TEXT("No Dirts found!"));
|
||||
}
|
||||
return mDirtAssets.GetKeys(Items);
|
||||
}
|
||||
|
||||
@ -221,40 +221,36 @@ bool URRDADataAssetSubsystem::GetAllTurbineItems(TArray<TSubclassOf<UFGItemDescr
|
||||
}
|
||||
|
||||
Items.Empty();
|
||||
mTurbineAssets[Tier].GetKeys(Items);
|
||||
mTurbineAssets[Tier].Data.GetKeys(Items);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool URRDADataAssetSubsystem::GetAllTurbineRelevantItems(TArray<TSubclassOf<UFGItemDescriptor>>& Items, int32 Tier) const {
|
||||
if(!mTurbineAssets.Contains(Tier)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Items.Empty();
|
||||
for (TTuple<TSubclassOf<UFGItemDescriptor>, URRDATurbineDataAsset*> TurbineAsset : mTurbineAssets[Tier])
|
||||
for (URRDATurbineDataAsset* Asset : GetAllTurbineAssets(Tier))
|
||||
{
|
||||
Items.AddUnique(TurbineAsset.Key);
|
||||
if(TurbineAsset.Value->mWasteItem.ItemClass) {
|
||||
Items.AddUnique(TurbineAsset.Value->mWasteItem.ItemClass);
|
||||
Items.AddUnique(Asset->mItem.ItemClass);
|
||||
if(Asset->mWasteItem.ItemClass) {
|
||||
Items.AddUnique(Asset->mWasteItem.ItemClass);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
return Items.Num() > 0;
|
||||
}
|
||||
|
||||
TArray<URRDATurbineDataAsset*> URRDADataAssetSubsystem::GetAllTurbineAssets(int32 Tier) const {
|
||||
if(!mTurbineAssets.Contains(Tier)) {
|
||||
UE_LOG(LogRRDApi, Error, TEXT("No TurbineAssets found for Type: %d"), Tier);
|
||||
return TArray<URRDATurbineDataAsset*>();
|
||||
}
|
||||
|
||||
TArray<URRDATurbineDataAsset*> Assets;
|
||||
mTurbineAssets[Tier].GenerateValueArray(Assets);
|
||||
mTurbineAssets[Tier].Data.GenerateValueArray(Assets);
|
||||
return Assets;
|
||||
}
|
||||
|
||||
URRDATurbineDataAsset* URRDADataAssetSubsystem::GetDefaultTurbineAsset(int32 Tier) const {
|
||||
return GetAllTurbineAssets(Tier)[0];
|
||||
return GetAllTurbineAssets(Tier).Top();
|
||||
}
|
||||
|
||||
URRDATurbineDataAsset* URRDADataAssetSubsystem::GetTurbineItemData(TSubclassOf<UFGItemDescriptor> Item, int32 Tier) const
|
||||
@ -263,7 +259,7 @@ URRDATurbineDataAsset* URRDADataAssetSubsystem::GetTurbineItemData(TSubclassOf<U
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return mTurbineAssets[Tier].FindRef(Item);
|
||||
return mTurbineAssets[Tier].Data.FindRef(Item);
|
||||
}
|
||||
|
||||
|
||||
@ -272,28 +268,132 @@ bool URRDADataAssetSubsystem::GetAllCoolerItems(TArray<TSubclassOf<UFGItemDescri
|
||||
if(!mCoolerAssets.Contains(Type)) return false;
|
||||
|
||||
Items.Empty();
|
||||
mCoolerAssets[Type].GetKeys(Items);
|
||||
mCoolerAssets[Type].Data.GetKeys(Items);
|
||||
|
||||
return true;
|
||||
return Items.Num() > 0;
|
||||
}
|
||||
|
||||
URRDACoolerDataAsset* URRDADataAssetSubsystem::GetCoolerItemData(TSubclassOf<UFGItemDescriptor> Item, ERRDACoolerType Type) const
|
||||
{
|
||||
if(!mCoolerAssets.Contains(Type)) return nullptr;
|
||||
return mCoolerAssets[Type].FindRef(Item);
|
||||
return mCoolerAssets[Type].Data.FindRef(Item);
|
||||
}
|
||||
|
||||
URRDACoolerDataAsset* URRDADataAssetSubsystem::GetDefaultCoolerAsset(ERRDACoolerType Type) const
|
||||
{
|
||||
return GetAllCoolerAssets(Type)[0];
|
||||
return GetAllCoolerAssets(Type).Top();
|
||||
}
|
||||
|
||||
TArray<URRDACoolerDataAsset*> URRDADataAssetSubsystem::GetAllCoolerAssets(ERRDACoolerType Type) const
|
||||
{
|
||||
if(!mCoolerAssets.Contains(Type)) return TArray<URRDACoolerDataAsset*>();
|
||||
if(!mCoolerAssets.Contains(Type))
|
||||
{
|
||||
UE_LOG(LogRRDApi, Error, TEXT("No CoolerAssets found for Type: %d"), Type);
|
||||
return TArray<URRDACoolerDataAsset*>();
|
||||
}
|
||||
|
||||
TArray<URRDACoolerDataAsset*> Assets;
|
||||
mCoolerAssets[Type].GenerateValueArray(Assets);
|
||||
mCoolerAssets[Type].Data.GenerateValueArray(Assets);
|
||||
|
||||
return Assets;
|
||||
}
|
||||
|
||||
URRDAGeneratorDataAsset* URRDADataAssetSubsystem::GetGeneratorItemData(int32 Tier) const {
|
||||
UE_LOG(LogRRDApi, Log, TEXT("GetGeneratorItemData: %d"), Tier);
|
||||
if(!mGeneratorAssets.Contains(Tier)) return nullptr;
|
||||
return mGeneratorAssets.FindRef(Tier);
|
||||
}
|
||||
|
||||
bool URRDADataAssetSubsystem::GetAllBoilerItems(TArray<TSubclassOf<UFGItemDescriptor>>& Items, int32 Tier) const
|
||||
{
|
||||
if(!mBoilerAssets.Contains(Tier)) return false;
|
||||
|
||||
mBoilerAssets[Tier].Data.GetKeys(Items);
|
||||
|
||||
return Items.Num() > 0;
|
||||
}
|
||||
|
||||
URRDABoilerDataAsset* URRDADataAssetSubsystem::GetBoilerItemData(TSubclassOf<UFGItemDescriptor> Item, int32 Tier) const
|
||||
{
|
||||
if(!mBoilerAssets.Contains(Tier)) return nullptr;
|
||||
return mBoilerAssets[Tier].Data.FindRef(Item);
|
||||
}
|
||||
|
||||
bool URRDADataAssetSubsystem::GetAllBoilerRelevantItems(TArray<TSubclassOf<UFGItemDescriptor>>& Items, int32 Tier) const
|
||||
{
|
||||
Items.Empty();
|
||||
for (URRDABoilerDataAsset* Asset : GetAllBoilerAssets(Tier))
|
||||
{
|
||||
Items.AddUnique(Asset->mInput.ItemClass);
|
||||
if(Asset->mOutput.ItemClass) {
|
||||
Items.AddUnique(Asset->mOutput.ItemClass);
|
||||
}
|
||||
}
|
||||
return Items.Num() > 0;
|
||||
}
|
||||
|
||||
URRDABoilerDataAsset* URRDADataAssetSubsystem::GetDefaultBoilerAsset(int32 Tier) const
|
||||
{
|
||||
return GetAllBoilerAssets(Tier).Top();
|
||||
}
|
||||
|
||||
TArray<URRDABoilerDataAsset*> URRDADataAssetSubsystem::GetAllBoilerAssets(int32 Tier) const
|
||||
{
|
||||
if(!mBoilerAssets.Contains(Tier))
|
||||
{
|
||||
UE_LOG(LogRRDApi, Error, TEXT("No BoilerAssets found for Type: %d"), Tier);
|
||||
return TArray<URRDABoilerDataAsset*>();
|
||||
}
|
||||
|
||||
TArray<URRDABoilerDataAsset*> Assets;
|
||||
mBoilerAssets[Tier].Data.GenerateValueArray(Assets);
|
||||
|
||||
return Assets;
|
||||
}
|
||||
|
||||
bool URRDADataAssetSubsystem::GetAllHeaterItems(TArray<TSubclassOf<UFGItemDescriptor>>& Items, ERRDAHeaterType Type) const {
|
||||
if(!mHeaterAssets.Contains(Type)) return false;
|
||||
|
||||
mHeaterAssets[Type].Data.GetKeys(Items);
|
||||
|
||||
return Items.Num() > 0;
|
||||
}
|
||||
|
||||
URRDAHeaterDataAsset* URRDADataAssetSubsystem::GetHeaterItemData(TSubclassOf<UFGItemDescriptor> Item, ERRDAHeaterType Type) const
|
||||
{
|
||||
if(!mHeaterAssets.Contains(Type)) return nullptr;
|
||||
|
||||
return mHeaterAssets[Type].Data.FindRef(Item);
|
||||
}
|
||||
|
||||
bool URRDADataAssetSubsystem::GetAllHeaterRelevantItems(TArray<TSubclassOf<UFGItemDescriptor>>& Items, ERRDAHeaterType Type) const
|
||||
{
|
||||
Items.Empty();
|
||||
for (URRDAHeaterDataAsset* HeaterAsset : GetAllHeaterAssets(Type))
|
||||
{
|
||||
Items.AddUnique(HeaterAsset->mInput.ItemClass);
|
||||
if(HeaterAsset->mOutput.ItemClass) {
|
||||
Items.AddUnique(HeaterAsset->mOutput.ItemClass);
|
||||
}
|
||||
}
|
||||
return Items.Num() > 0;
|
||||
}
|
||||
|
||||
URRDAHeaterDataAsset* URRDADataAssetSubsystem::GetDefaultHeaterAsset(ERRDAHeaterType Type) const
|
||||
{
|
||||
return GetAllHeaterAssets(Type).Top();
|
||||
}
|
||||
|
||||
TArray<URRDAHeaterDataAsset*> URRDADataAssetSubsystem::GetAllHeaterAssets(ERRDAHeaterType Type) const
|
||||
{
|
||||
if(!mHeaterAssets.Contains(Type))
|
||||
{
|
||||
UE_LOG(LogRRDApi, Error, TEXT("No HeaterAssets found for Type: %d"), Type);
|
||||
return TArray<URRDAHeaterDataAsset*>();
|
||||
}
|
||||
|
||||
TArray<URRDAHeaterDataAsset*> Assets;
|
||||
mHeaterAssets[Type].Data.GenerateValueArray(Assets);
|
||||
|
||||
return Assets;
|
||||
}
|
||||
|
@ -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;
|
||||
};
|
@ -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;
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
};
|
@ -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;
|
||||
};
|
@ -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;
|
||||
};
|
@ -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;
|
||||
|
||||
/**
|
||||
|
@ -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;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user