Commit eb2d04ea authored by Kyrium's avatar Kyrium
Browse files

Merge branch 'dev' into 'main'

1.2.0

See merge request !9
parents 696340f2 c1ba55e2
[AccessTransformers]
Accessor=(Class="AFGFactoryBuildingHologram", Property="mMaxZoopAmount")
Accessor=(Class="UFGRecipe", Property="mDisplayNameOverride")
Accessor=(Class="UFGRecipe", Property="mDisplayName")
Accessor=(Class="UFGRecipe", Property="mIngredients")
Accessor=(Class="UFGRecipe", Property="mProduct")
Accessor=(Class="UFGRecipe", Property="mOverriddenCategory")
Accessor=(Class="UFGRecipe", Property="mManufacturingMenuPriority")
Accessor=(Class="UFGRecipe", Property="mManufactoringDuration")
Accessor=(Class="UFGRecipe", Property="mManualManufacturingMultiplier")
Accessor=(Class="UFGRecipe", Property="mProducedIn")
Accessor=(Class="UFGRecipe", Property="mRelevantEvents")
Accessor=(Class="UFGRecipe", Property="mVariablePowerConsumptionConstant")
Accessor=(Class="UFGRecipe", Property="mVariablePowerConsumptionFactor")
Accessor=(Class="UFGItemDescriptor", Property="mUseDisplayNameAndDescription")
Accessor=(Class="UFGItemDescriptor", Property="mDisplayName")
Accessor=(Class="UFGItemDescriptor", Property="mDescription")
Accessor=(Class="UFGItemDescriptor", Property="mAbbreviatedDisplayName")
Accessor=(Class="UFGItemDescriptor", Property="mStackSize")
Accessor=(Class="UFGItemDescriptor", Property="mCanBeDiscarded")
Accessor=(Class="UFGItemDescriptor", Property="mRememberPickUp")
Accessor=(Class="UFGItemDescriptor", Property="mEnergyValue")
Accessor=(Class="UFGItemDescriptor", Property="mRadioactiveDecay")
Accessor=(Class="UFGItemDescriptor", Property="mForm")
Accessor=(Class="UFGItemDescriptor", Property="mSmallIcon")
Accessor=(Class="UFGItemDescriptor", Property="mPersistentBigIcon")
Accessor=(Class="UFGItemDescriptor", Property="mConveyorMesh")
Accessor=(Class="UFGItemDescriptor", Property="mPreviewView")
Accessor=(Class="UFGItemDescriptor", Property="mItemCategory")
Accessor=(Class="UFGItemDescriptor", Property="mFluidColor")
Accessor=(Class="UFGItemDescriptor", Property="mGasColor")
Accessor=(Class="UFGBuildingDescriptor", Property="mOverrideDisplayNameAndDescription")
Accessor=(Class="UFGBuildingDescriptor", Property="mBuildableClass")
Accessor=(Class="UFGBuildDescriptor", Property="mBuildCategory")
Accessor=(Class="UFGBuildDescriptor", Property="mSubCategories")
Accessor=(Class="UFGBuildDescriptor", Property="mBuildMenuPriority")
Accessor=(Class="UFGItemDescriptorNuclearFuel", Property="mSpentFuelClass")
Accessor=(Class="UFGItemDescriptorNuclearFuel", Property="mAmountOfWaste")
Accessor=(Class="AFGResourceNode", Property="mPurity")
Accessor=(Class="AFGResourceNode", Property="mAmount")
Accessor=(Class="AFGResourceNode", Property="mResourcesLeft")
Accessor=(Class="AFGResourceNodeBase", Property="mResourceClass")
Accessor=(Class="AFGResourceNodeFrackingCore", Property="mSatellites")
Accessor=(Class="AFGResourceNodeFrackingCore", Property="mActivator")
Accessor=(Class="AFGBuildable", Property="mHologramClass")
Accessor=(Class="AFGBuildable", Property="mDisplayName")
Accessor=(Class="AFGBuildable", Property="mDescription")
Accessor=(Class="AFGBuildable", Property="MaxRenderDistance")
Accessor=(Class="AFGBuildable", Property="mPoolHandles")
Accessor=(Class="AFGBuildable", Property="mInteractWidgetClass")
Accessor=(Class="AFGBuildable", Property="mNumFactoryConnections")
Accessor=(Class="AFGBuildable", Property="mNumPowerConnections")
Accessor=(Class="AFGBuildable", Property="mInteractingPlayers")
Accessor=(Class="AFGBuildable", Property="mShouldModifyWorldGrid")
Accessor=(Class="AFGBuildableFactory", Property="mPowerConsumption")
Accessor=(Class="AFGBuildableFactory", Property="mPowerConsumptionExponent")
Accessor=(Class="AFGBuildableFactory", Property="mEffectUpdateInterval")
Accessor=(Class="AFGBuildableFactory", Property="mEffectUpdateAccumulator")
Accessor=(Class="AFGBuildableFactory", Property="mCachedFluidStackSize")
Accessor=(Class="AFGBuildableFactory", Property="mCachedProductionStatus")
Accessor=(Class="AFGBuildableFactory", Property="mCachedSkeletalMeshes")
Accessor=(Class="AFGBuildableLightSource", Property="mIsEnabled")
Accessor=(Class="AFGBuildableLightSource", Property="mCurrentLightColor")
Accessor=(Class="AFGBuildableLightSource", Property="mPowerConsumption")
Accessor=(Class="AFGBuildableLightSource", Property="mHasPower")
Accessor=(Class="AFGBuildableLightSource", Property="mIsDay")
Accessor=(Class="UFGFactoryCustomizationCollection", Property="mCustomizationClass")
Accessor=(Class="UFGFactoryCustomizationCollection", Property="mCustomizationClass")
BlueprintReadWrite=(Class="UFGFactoryCustomizationCollection", Property="mCustomizations")
BlueprintReadWrite=(Class="AFGFactoryBuildingHologram", Property="mMaxZoopAmount")
BlueprintReadWrite=(Class="UFGFactoryCustomizationCollection", Property="mCustomizations")
Accessor=(Class="AFGBuildableSubsystem", Property="mCustomizationCollectionClasses")
BlueprintReadWrite=(Class="AFGBuildableSubsystem", Property="mCustomizationCollectionClasses")
BlueprintReadWrite=(Class="FGResearchTree", Property="mNodes")
Accessor=(Class="AFGGameState", Property="mSwatchGroupDatum")
BlueprintReadWrite=(Class="AFGGameState", Property="mSwatchGroupDatum")
BlueprintReadWrite=(Class="FGBuildableGeneratorFuel", Property="mAvailableFuelClasses")
......
No preview for this file type
{
"FileVersion": 3,
"Version": 1,
"VersionName": "1.11.0",
"SemVersion": "1.11.0",
"VersionName": "1.12.0",
"SemVersion": "1.12.0",
"FriendlyName": "KBFL",
"Description": "Lib for Kyris Mods",
"Category": "Modding",
......
#include "BFL/KBFL_ConfigTools.h"
#include "Configuration/Properties/ConfigPropertyClass.h"
DECLARE_LOG_CATEGORY_EXTERN(KBFLConfigToolLog, Log, All)
DEFINE_LOG_CATEGORY(KBFLConfigToolLog)
bool UKBFL_ConfigTools::GetBoolFromConfig(TSubclassOf<UModConfiguration> Config, FString Key)
{
return URuntimeBlueprintFunctionLibrary::Conv_ConfigPropertyToBool(GetConfigPropertyByKey(Config, Key));
}
void UKBFL_ConfigTools::SetBoolInConfig(TSubclassOf<UModConfiguration> Config, FString Key, bool Value)
{
if(UConfigPropertyBool* Property = GetPropertyByKey<UConfigPropertyBool>(Config, Key))
{
Property->Value = Value;
SaveProperty(Config, Key);
}
}
float UKBFL_ConfigTools::GetFloatFromConfig(TSubclassOf<UModConfiguration> Config, FString Key)
{
return URuntimeBlueprintFunctionLibrary::Conv_ConfigPropertyToFloat(GetConfigPropertyByKey(Config, Key));
}
void UKBFL_ConfigTools::SetFloatInConfig(TSubclassOf<UModConfiguration> Config, FString Key, float Value)
{
if(UConfigPropertyFloat* Property = GetPropertyByKey<UConfigPropertyFloat>(Config, Key))
{
Property->Value = Value;
SaveProperty(Config, Key);
}
}
UClass* UKBFL_ConfigTools::GetClassFromConfig(TSubclassOf<UModConfiguration> Config, FString Key)
{
if(UConfigPropertyClass* Property = GetPropertyByKey<UConfigPropertyClass>(Config, Key))
return Property->BaseClass;
return nullptr;
}
void UKBFL_ConfigTools::SetClassInConfig(TSubclassOf<UModConfiguration> Config, FString Key, UClass* Value)
{
if(UConfigPropertyClass* Property = GetPropertyByKey<UConfigPropertyClass>(Config, Key))
{
Property->Value = Value;
SaveProperty(Config, Key);
}
}
int UKBFL_ConfigTools::GetIntFromConfig(TSubclassOf<UModConfiguration> Config, FString Key)
{
return URuntimeBlueprintFunctionLibrary::Conv_ConfigPropertyToInteger(GetConfigPropertyByKey(Config, Key));
}
void UKBFL_ConfigTools::SetIntInConfig(TSubclassOf<UModConfiguration> Config, FString Key, int Value)
{
if(UConfigPropertyInteger* Property = GetPropertyByKey<UConfigPropertyInteger>(Config, Key))
{
Property->Value = Value;
SaveProperty(Config, Key);
}
}
FName UKBFL_ConfigTools::GetNameFromConfig(TSubclassOf<UModConfiguration> Config, FString Key)
{
return URuntimeBlueprintFunctionLibrary::Conv_ConfigPropertyToName(GetConfigPropertyByKey(Config, Key));
}
void UKBFL_ConfigTools::SetNameInConfig(TSubclassOf<UModConfiguration> Config, FString Key, FName Value)
{
if(UConfigPropertyString* Property = GetPropertyByKey<UConfigPropertyString>(Config, Key))
{
Property->Value = Value.ToString();
SaveProperty(Config, Key);
}
}
FString UKBFL_ConfigTools::GetStringFromConfig(TSubclassOf<UModConfiguration> Config, FString Key)
{
return URuntimeBlueprintFunctionLibrary::Conv_ConfigPropertyToString(GetConfigPropertyByKey(Config, Key));
}
void UKBFL_ConfigTools::SetStringInConfig(TSubclassOf<UModConfiguration> Config, FString Key, FString Value)
{
if(UConfigPropertyString* Property = GetPropertyByKey<UConfigPropertyString>(Config, Key))
{
Property->Value = Value;
SaveProperty(Config, Key);
}
}
FText UKBFL_ConfigTools::GetTextFromConfig(TSubclassOf<UModConfiguration> Config, FString Key)
{
return URuntimeBlueprintFunctionLibrary::Conv_ConfigPropertyToText(GetConfigPropertyByKey(Config, Key));
}
void UKBFL_ConfigTools::SetTextInConfig(TSubclassOf<UModConfiguration> Config, FString Key, FText Value)
{
if(UConfigPropertyString* Property = GetPropertyByKey<UConfigPropertyString>(Config, Key))
{
Property->Value = Value.ToString();
SaveProperty(Config, Key);
}
}
......@@ -5,15 +5,11 @@
FString UKBFL_Player::GetPlayerId(AFGPlayerState* PlayerState)
{
FString ReturnString = "Invalid";
if (PlayerState)
if(!PlayerState->IsInactive())
{
if(PlayerState->GetOwningController())
{
UFGLocalPlayer* LocalPlayer = Cast<UFGLocalPlayer>(PlayerState->GetOwningController()->GetLocalPlayer());
if (LocalPlayer)
if (UFGLocalPlayer* LocalPlayer = Cast<UFGLocalPlayer>(PlayerState->GetOwningController()->GetLocalPlayer()))
{
TSharedPtr<const FUniqueNetId> EpicID = LocalPlayer->GetPlayerId();
TSharedPtr<const FUniqueNetId> SteamID = LocalPlayer->GetPlayerIdSteam();
......@@ -22,14 +18,16 @@ FString UKBFL_Player::GetPlayerId(AFGPlayerState* PlayerState)
{
const TSharedPtr<const FUniqueNetId> ID = (EpicID) ? EpicID : SteamID;
return ID->ToString();
if(ID->ToString() != "UnknownId")
return ID->ToString();
}
}
}
return ReturnString = PlayerState->GetUserID();
if(PlayerState->GetUserID() != "UnknownId")
return PlayerState->GetUserID();
return PlayerState->GetPlayerName();
}
return ReturnString;
return FString("Invalid");
}
AFGBuildGun* UKBFL_Player::GetBuildingGun(UObject* WorldContext)
......
......@@ -3,6 +3,7 @@
#include "Registry/ModContentRegistry.h"
#include "FGItemCategory.h"
#include "BFL/KBFL_Util.h"
#include "Subsystems/KBFLAssetDataSubsystem.h"
TArray<TSubclassOf<UFGRecipe>> UKBFL_Recipes::GetAllRegisteredRecipes(UObject* WorldContext)
{
......@@ -101,8 +102,7 @@ TArray<TSubclassOf<UFGRecipe>> UKBFL_Recipes::GetAllRecipesFromBuilding(UObject*
TArray<TSubclassOf<UFGRecipe>> UKBFL_Recipes::GetAllModRecipes(UObject* WorldContext, FName ModName)
{
// is Subsystem loaded use Map from there (and don't foreach loops)
auto Subsystem = UKBFL_Util::GetDataSubsystem(WorldContext);
if(Subsystem)
if(auto Subsystem = UKBFL_Util::GetDataSubsystem(WorldContext))
{
if(Subsystem->mLoadingDone)
{
......@@ -186,30 +186,62 @@ TArray<FKBFLRecipeInfo> UKBFL_Recipes::GetAllModsRecipesWithInfo(UObject* WorldC
void UKBFL_Recipes::CDO_MoveRecipesFromBuilding(UObject* WorldContext, TSoftClassPtr<UObject> From, TSoftClassPtr<UObject> To, TArray<TSubclassOf<UFGItemCategory>> IgnoreCategory, TArray<TSubclassOf<UFGRecipe>> IgnoreRecipe)
{
const auto ModContent = AModContentRegistry::Get(WorldContext->GetWorld());
auto Recipes = ModContent->GetRegisteredRecipes();
TSubclassOf<UObject> SubFrom = nullptr;
TSubclassOf<UObject> SubTo = nullptr;
if(From.IsPending() || To.IsValid())
{
SubFrom = From.LoadSynchronous();
}
for (auto Recipe : Recipes)
if(To.IsPending() || To.IsValid())
{
if(!IgnoreRecipe.Contains(Recipe.RegisteredObject))
SubTo = To.LoadSynchronous();
}
if(!SubFrom)
UE_LOG(LogTemp, Error, TEXT("CDO_MoveRecipesFromBuilding -> Cannot load From"));
if(!SubTo)
UE_LOG(LogTemp, Error, TEXT("CDO_MoveRecipesFromBuilding -> Cannot load To"));
if(!WorldContext)
UE_LOG(LogTemp, Error, TEXT("CDO_MoveRecipesFromBuilding -> Invalid WorldContext"))
else if(!WorldContext->GetWorld())
UE_LOG(LogTemp, Error, TEXT("CDO_MoveRecipesFromBuilding -> Invalid World"));
if(WorldContext && SubTo && SubFrom)
if(WorldContext->GetWorld())
{
auto Default = Cast<UFGRecipe>(Recipe.RegisteredObject->GetDefaultObject());
check(Default);
if(Default)
UKBFLAssetDataSubsystem* AssetDataSubsystem = WorldContext->GetWorld()->GetSubsystem<UKBFLAssetDataSubsystem>();
TArray<TSubclassOf<UFGRecipe>> Recipes;
AssetDataSubsystem->GetRecipesOfProducer({SubFrom}, Recipes);
for (auto Recipe : Recipes)
{
if(!IgnoreCategory.Contains(Default->mOverriddenCategory))
if(!IgnoreRecipe.Contains(Recipe))
{
if(Default->mProducedIn.Contains(From))
auto Default = Cast<UFGRecipe>(Recipe->GetDefaultObject());
check(Default);
if(Default)
{
Default->mProducedIn.Remove(From);
Default->mProducedIn.Add(To);
if(!IgnoreCategory.Contains(Default->mOverriddenCategory))
{
if(Default->mProducedIn.Contains(From))
{
Default->mProducedIn.Remove(From);
Default->mProducedIn.Add(To);
UE_LOG(LogTemp, Error, TEXT("CDO_MoveRecipesFromBuilding -> Move Recipe %s : %s -> %s"), *Default->GetName(), *From->GetName(), *To->GetName());
}
Recipe->MarkPackageDirty();
Default->MarkPackageDirty();
}
}
Recipe.RegisteredObject->MarkPackageDirty();
Default->MarkPackageDirty();
}
}
}
}
}
bool UKBFL_Recipes::HasRecipeForm(TSubclassOf<UFGRecipe> Recipe, KBFLInOut Side, EResourceForm Form)
......
......@@ -4,7 +4,9 @@
#include "FGPlayerController.h"
#include "Unlocks/FGUnlockScannableResource.h"
#include "FGUnlockSubsystem.h"
#include "BFL/KBFL_Player.h"
#include "Blueprint/UserWidget.h"
#include "Kismet/KismetMathLibrary.h"
#include "Patching/BlueprintHookHelper.h"
#include "Subsystem/SubsystemActorManager.h"
#include "Util/RuntimeBlueprintFunctionLibrary.h"
......@@ -145,7 +147,42 @@ void UKBFL_Util::RemoveNodeNOTResourcesClassFromWorld(UObject* WorldContext,
}
}
/** CPP Helper for instand Clast */
bool UKBFL_Util::DoPlayerViewLineTrace(UObject* WorldContext, FHitResult& Hit, float Distance, TArray<AActor*> ActorsToIgnore, ETraceTypeQuery TraceChannel, bool TraceComplex)
{
if(AFGCharacterPlayer* Char = UKBFL_Player::GetFGCharacter(WorldContext))
{
FVector Start;
FRotator EyeRotate;
Char->GetActorEyesViewPoint(Start, EyeRotate);
FVector End = Start + Distance * UKismetMathLibrary::GetForwardVector(EyeRotate);
// Add Player self that he dont trace!
ActorsToIgnore.AddUnique(Char);
UKismetSystemLibrary::LineTraceSingle(WorldContext, Start, End, TraceChannel, TraceComplex, ActorsToIgnore, EDrawDebugTrace::None, Hit, true);
return Hit.IsValidBlockingHit();
}
return false;
}
bool UKBFL_Util::DoPlayerViewLineTraceSphere(UObject* WorldContext, TArray<AActor*> OutActors, float Distance,
TArray<AActor*> ActorsToIgnore, ETraceTypeQuery TraceChannel, TArray<TEnumAsByte<EObjectTypeQuery>> ObjTypes,
TSubclassOf<AActor> ActorClass, float SphereSize, bool TraceComplex)
{
if(AFGCharacterPlayer* Char = UKBFL_Player::GetFGCharacter(WorldContext))
{
FHitResult LineHit;
if(DoPlayerViewLineTrace(WorldContext, LineHit, Distance, ActorsToIgnore, TraceChannel, TraceComplex))
{
ActorsToIgnore.AddUnique(Char);
return UKismetSystemLibrary::SphereOverlapActors(WorldContext, LineHit.ImpactPoint, SphereSize, ObjTypes, ActorClass, ActorsToIgnore, OutActors);
}
}
return false;
}
AModSubsystem* UKBFL_Util::GetSubsystemFromChild(UObject* WorldContext, TSubclassOf<AModSubsystem> SubsystemClass)
{
if(WorldContext)
......@@ -160,3 +197,18 @@ AModSubsystem* UKBFL_Util::GetSubsystemFromChild(UObject* WorldContext, TSubclas
}
return nullptr;
}
void UKBFL_Util::GetAllSubsystemsFromChild(UObject* WorldContext, TSubclassOf<AModSubsystem> SubsystemClass,
TArray<AModSubsystem*>& Subsystems)
{
if(WorldContext)
{
const UWorld* WorldObject = GEngine->GetWorldFromContextObjectChecked(WorldContext);
USubsystemActorManager* SubsystemActorManager = WorldObject->GetSubsystem<USubsystemActorManager>();
check(SubsystemActorManager);
for (auto Subsystem : SubsystemActorManager->SubsystemActors)
if(Subsystem.Key->IsChildOf(SubsystemClass))
Subsystems.AddUnique(Subsystem.Value);
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment