mirror of
https://github.com/Milxnor/Project-Reboot-3.0.git
synced 2026-01-13 02:42:22 +01:00
2.4.2 & zone times proper
This commit is contained in:
@@ -5,6 +5,9 @@
|
||||
#include "SoftObjectPath.h"
|
||||
#include "KismetStringLibrary.h"
|
||||
#include "GameplayStatics.h"
|
||||
#include "FortPlayerPawn.h"
|
||||
#include "FortPlayerController.h"
|
||||
#include "FortPlayerControllerAthena.h"
|
||||
|
||||
using UNavigationSystemV1 = UObject;
|
||||
using UNavigationSystemConfig = UObject;
|
||||
@@ -60,7 +63,7 @@ static void SetNavigationSystem(AAthenaNavSystemConfigOverride* NavSystemOverrid
|
||||
if (!NewNavSystemClass)
|
||||
return;
|
||||
|
||||
LOG_INFO(LogAI, "Setup navigation system.\n");
|
||||
LOG_INFO(LogAI, "Setup navigation system.");
|
||||
|
||||
AddNavigationSystemToWorldOriginal(*GetWorld(), EFNavigationSystemRunMode::GameMode, NavSystemOverride->Get("NavigationSystemConfig"), true, false);
|
||||
}
|
||||
@@ -82,10 +85,69 @@ static void SetupNavConfig()
|
||||
AthenaNavConfig->Get<bool>("bAutoSpawnMissingNavData") = true; // BITFIELD
|
||||
AthenaNavConfig->Get<bool>("bSpawnNavDataInNavBoundsLevel") = true; // BITFIELD
|
||||
AthenaNavConfig->Get<bool>("bUseNavigationInvokers") = false;
|
||||
AthenaNavConfig->Get<FName>("DefaultAgentName") = UKismetStringLibrary::Conv_StringToName(L"MANG");
|
||||
AthenaNavConfig->Get<FName>("DefaultAgentName") = UKismetStringLibrary::Conv_StringToName(L"Galileo");
|
||||
|
||||
// NavSystemOverride->Get<ENavSystemOverridePolicy>("OverridePolicy") = ENavSystemOverridePolicy::Append;
|
||||
NavSystemOverride->Get("NavigationSystemConfig") = AthenaNavConfig;
|
||||
|
||||
SetNavigationSystem(NavSystemOverride);
|
||||
}
|
||||
|
||||
static AFortPlayerPawn* SpawnAIFromCustomizationData(const FVector& Location, UObject* CustomizationData)
|
||||
{
|
||||
static auto PawnClassOffset = CustomizationData->GetOffset("PawnClass");
|
||||
auto PawnClass = CustomizationData->Get<UClass*>(PawnClassOffset);
|
||||
|
||||
if (!PawnClass)
|
||||
{
|
||||
LOG_INFO(LogAI, "Invalid PawnClass for AI!");
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto Pawn = GetWorld()->SpawnActor<AFortPlayerPawn>(PawnClass, Location);
|
||||
|
||||
static auto CharacterCustomizationOffset = CustomizationData->GetOffset("CharacterCustomization");
|
||||
auto CharacterCustomization = CustomizationData->Get(CharacterCustomizationOffset);
|
||||
auto CharacterCustomizationLoadoutOffset = CharacterCustomization->GetOffset("CustomizationLoadout");
|
||||
auto CharacterCustomizationLoadout = CharacterCustomization->GetPtr<FFortAthenaLoadout>(CharacterCustomizationLoadoutOffset);
|
||||
|
||||
ApplyCID(Pawn, CharacterCustomizationLoadout->GetCharacter());
|
||||
|
||||
struct FItemAndCount
|
||||
{
|
||||
int Count; // 0x0000(0x0004) (Edit, BlueprintVisible, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
|
||||
unsigned char UnknownData00[0x4]; // 0x0004(0x0004) MISSED OFFSET
|
||||
UFortItemDefinition* Item; // 0x0008(0x0008) (Edit, BlueprintVisible, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash, NativeAccessSpecifierPublic)
|
||||
};
|
||||
|
||||
static auto StartupInventoryOffset = CustomizationData->GetOffset("StartupInventory");
|
||||
auto StartupInventory = CustomizationData->Get(StartupInventoryOffset);
|
||||
static auto StartupInventoryItemsOffset = StartupInventory->GetOffset("Items");
|
||||
auto& StartupInventoryItems = StartupInventory->Get<TArray<FItemAndCount>>(StartupInventoryItemsOffset);
|
||||
|
||||
auto Controller = Pawn->GetController();
|
||||
LOG_INFO(LogDev, "Controller: {} StartupInventoryItems.Num: {}", Controller ? Controller->GetFullName() : "InvalidObject", StartupInventoryItems.Num());
|
||||
|
||||
if (Controller)
|
||||
{
|
||||
/* static auto InventoryOffset = Controller->GetOffset("Inventory");
|
||||
auto Inventory = Controller->Get<AFortInventory*>(InventoryOffset);
|
||||
|
||||
for (int i = 0; i < StartupInventoryItems.Num(); i++)
|
||||
{
|
||||
auto pair = Inventory->AddItem(StartupInventoryItems.at(i).Item, nullptr, StartupInventoryItems.at(i).Count);
|
||||
|
||||
LOG_INFO(LogDev, "pair.first.size(): {}", pair.first.size());
|
||||
|
||||
if (pair.first.size() > 0)
|
||||
{
|
||||
if (auto weaponDef = Cast<UFortWeaponItemDefinition>(StartupInventoryItems.at(i).Item))
|
||||
Pawn->EquipWeaponDefinition(weaponDef, pair.first.at(0)->GetItemEntry()->GetItemGuid());
|
||||
}
|
||||
} */
|
||||
|
||||
// Inventory->Update(); // crashes idk why
|
||||
}
|
||||
|
||||
return Pawn;
|
||||
}
|
||||
Reference in New Issue
Block a user