mirror of
https://github.com/Milxnor/Project-Reboot-3.0.git
synced 2026-01-13 02:42:22 +01:00
a bit
fix cheat god, fix 1.7.2, 1.8, 2.4.2, and probably 2.5, add rocket event idk couldnt test, fix some crashes.
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include "GameplayStatics.h"
|
||||
#include "KismetMathLibrary.h"
|
||||
#include <random>
|
||||
#include "AssertionMacros.h"
|
||||
|
||||
FNetworkObjectList& UNetDriver::GetNetworkObjectList()
|
||||
{
|
||||
@@ -322,11 +323,11 @@ static FNetViewer ConstructNetViewer(UNetConnection* NetConnection)
|
||||
static auto ControlRotationOffset = ViewingController->GetOffset("ControlRotation");
|
||||
FRotator ViewRotation = ViewingController->Get<FRotator>(ControlRotationOffset); // hmmmm // ViewingController->GetControlRotation();
|
||||
// AFortPlayerControllerAthena::GetPlayerViewPointHook(Cast<AFortPlayerControllerAthena>(ViewingController, false), newViewer.ViewLocation, ViewRotation);
|
||||
// ViewingController->GetActorEyesViewPoint(&newViewer.ViewLocation, &ViewRotation); // HMMM
|
||||
ViewingController->GetActorEyesViewPoint(&newViewer.ViewLocation, &ViewRotation); // HMMM
|
||||
|
||||
static auto GetActorEyesViewPointOffset = 0x5B0;
|
||||
void (*GetActorEyesViewPointOriginal)(AController*, FVector * a2, FRotator * a3) = decltype(GetActorEyesViewPointOriginal)(ViewingController->VFTable[GetActorEyesViewPointOffset / 8]);
|
||||
GetActorEyesViewPointOriginal(ViewingController, &newViewer.ViewLocation, &ViewRotation);
|
||||
// static auto GetActorEyesViewPointOffset = 0x5B0;
|
||||
// void (*GetActorEyesViewPointOriginal)(AController*, FVector * a2, FRotator * a3) = decltype(GetActorEyesViewPointOriginal)(ViewingController->VFTable[GetActorEyesViewPointOffset / 8]);
|
||||
// GetActorEyesViewPointOriginal(ViewingController, &newViewer.ViewLocation, &ViewRotation);
|
||||
// AFortPlayerControllerAthena::GetPlayerViewPointHook((AFortPlayerControllerAthena*)ViewingController, newViewer.ViewLocation, ViewRotation);
|
||||
newViewer.ViewDir = ViewRotation.Vector();
|
||||
}
|
||||
@@ -342,6 +343,15 @@ static FORCEINLINE bool IsActorDormant(FNetworkObjectInfo* ActorInfo, const TWea
|
||||
|
||||
bool UNetDriver::IsLevelInitializedForActor(const AActor* InActor, const UNetConnection* InConnection) const
|
||||
{
|
||||
if (Fortnite_Version >= 2.42) // idk
|
||||
return true;
|
||||
|
||||
if (!InActor || !InConnection)
|
||||
return false;
|
||||
|
||||
// check(World == InActor->GetWorld());
|
||||
|
||||
// return true; // damn
|
||||
const bool bCorrectWorld = (InConnection->GetClientWorldPackageName() == GetWorldPackage()->NamePrivate && InConnection->ClientHasInitializedLevelFor(InActor));
|
||||
const bool bIsConnectionPC = (InActor == InConnection->GetPlayerController());
|
||||
return bCorrectWorld || bIsConnectionPC;
|
||||
@@ -376,7 +386,6 @@ int32 UNetDriver::ServerReplicateActors()
|
||||
}
|
||||
|
||||
std::vector<FNetworkObjectInfo*> ConsiderList;
|
||||
|
||||
ConsiderList.reserve(GetNetworkObjectList().ActiveNetworkObjects.Num());
|
||||
|
||||
// std::cout << "ConsiderList.size(): " << GetNetworkObjectList(NetDriver).ActiveNetworkObjects.Num() << '\n';
|
||||
@@ -385,6 +394,8 @@ int32 UNetDriver::ServerReplicateActors()
|
||||
|
||||
ServerReplicateActors_BuildConsiderList(ConsiderList, ServerTickTime);
|
||||
|
||||
// LOG_INFO(LogReplication, "Considering {} actors.", ConsiderList.size());
|
||||
|
||||
for (int32 i = 0; i < this->GetClientConnections().Num(); i++)
|
||||
{
|
||||
UNetConnection* Connection = this->GetClientConnections().at(i);
|
||||
@@ -434,9 +445,12 @@ int32 UNetDriver::ServerReplicateActors()
|
||||
std::vector<FNetViewer> ConnectionViewers;
|
||||
ConnectionViewers.push_back(ConstructNetViewer(Connection));
|
||||
|
||||
const bool bLevelInitializedForActor = IsLevelInitializedForActor(Actor, Connection);
|
||||
|
||||
if (!Channel)
|
||||
{
|
||||
if (!IsLevelInitializedForActor(Actor, Connection))
|
||||
// if (!IsLevelInitializedForActor(Actor, Connection))
|
||||
if (!bLevelInitializedForActor)
|
||||
{
|
||||
// If the level this actor belongs to isn't loaded on client, don't bother sending
|
||||
continue;
|
||||
@@ -473,6 +487,8 @@ int32 UNetDriver::ServerReplicateActors()
|
||||
|
||||
if (!IsActorRelevantToConnection(Actor, ConnectionViewers))
|
||||
{
|
||||
// LOG_INFO(LogReplication, "Actor is not relevant!");
|
||||
|
||||
if (Channel)
|
||||
ActorChannelClose(Channel);
|
||||
|
||||
@@ -486,8 +502,6 @@ int32 UNetDriver::ServerReplicateActors()
|
||||
static __int64 (*ReplicateActor)(UActorChannel*) = decltype(ReplicateActor)(Addresses::ReplicateActor);
|
||||
static __int64 (*SetChannelActor)(UActorChannel*, AActor*) = decltype(SetChannelActor)(Addresses::SetChannelActor);
|
||||
|
||||
const bool bLevelInitializedForActor = IsLevelInitializedForActor(Actor, Connection);
|
||||
|
||||
if (!Channel)
|
||||
{
|
||||
if (Actor->IsA(APlayerController::StaticClass()) && Actor != Connection->GetPlayerController()) // isnetrelevantfor should handle this iirc
|
||||
@@ -513,6 +527,7 @@ int32 UNetDriver::ServerReplicateActors()
|
||||
{
|
||||
if (ReplicateActor(Channel))
|
||||
{
|
||||
// LOG_INFO(LogReplication, "Replicated Actor!");
|
||||
auto TimeSeconds = UGameplayStatics::GetTimeSeconds(World);
|
||||
const float MinOptimalDelta = 1.0f / Actor->GetNetUpdateFrequency();
|
||||
const float MaxOptimalDelta = max(1.0f / Actor->GetMinNetUpdateFrequency(), MinOptimalDelta);
|
||||
|
||||
Reference in New Issue
Block a user