mirror of
https://github.com/Milxnor/Project-Reboot-3.0.git
synced 2026-01-13 02:42:22 +01:00
fix ch2+ editing bug
entire reboot cord wanted this
This commit is contained in:
@@ -55,7 +55,7 @@ public:
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
SetNetDormancy((ENetDormancy)(2 - (NewEditingPlayer != 0)));
|
SetNetDormancy((ENetDormancy)(2 - (NewEditingPlayer != 0)));
|
||||||
this->ForceNetUpdate();
|
// they do something here
|
||||||
GetEditingPlayer() = NewEditingPlayer;
|
GetEditingPlayer() = NewEditingPlayer;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,14 +24,5 @@ public:
|
|||||||
|
|
||||||
void OnRep_EditActor();
|
void OnRep_EditActor();
|
||||||
|
|
||||||
void SetEditActor(ABuildingSMActor* EditActor)
|
|
||||||
{
|
|
||||||
// if (HasAuthority())
|
|
||||||
{
|
|
||||||
GetEditActor() = EditActor;
|
|
||||||
originalOnRep_EditActor(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static UClass* StaticClass();
|
static UClass* StaticClass();
|
||||||
};
|
};
|
||||||
@@ -1672,39 +1672,6 @@ void AFortPlayerController::ClientOnPawnDiedHook(AFortPlayerController* PlayerCo
|
|||||||
return ClientOnPawnDiedOriginal(PlayerController, DeathReport);
|
return ClientOnPawnDiedOriginal(PlayerController, DeathReport);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Idk(ABuildingSMActor* BuildingActor)
|
|
||||||
{
|
|
||||||
return true; // bIsPlayerBuildable && EditModeSupport && EditModePatternData && GameState->StructuralSupportSystem && ?? && ??
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IsOkForEditing(ABuildingSMActor* BuildingActor, AFortPlayerController* Controller)
|
|
||||||
{
|
|
||||||
if (BuildingActor->GetEditingPlayer() &&
|
|
||||||
BuildingActor->GetEditingPlayer() != Controller->GetPlayerState())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return !BuildingActor->IsDestroyed() &&
|
|
||||||
// BuildingActor->GetWorld() &&
|
|
||||||
Idk(BuildingActor);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
The editing dilemma:
|
|
||||||
|
|
||||||
15.10:
|
|
||||||
Valid edit pattern:
|
|
||||||
ServerBeginEditingActorblahblah
|
|
||||||
ServerEdit
|
|
||||||
ClientForceStop
|
|
||||||
|
|
||||||
WHERE IS END EDITING?!?!??!
|
|
||||||
Invalid EDitPattern:
|
|
||||||
ServerBeginEditingActorblahblah
|
|
||||||
ServerEnd
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
void AFortPlayerController::ServerBeginEditingBuildingActorHook(AFortPlayerController* PlayerController, ABuildingSMActor* BuildingActorToEdit)
|
void AFortPlayerController::ServerBeginEditingBuildingActorHook(AFortPlayerController* PlayerController, ABuildingSMActor* BuildingActorToEdit)
|
||||||
{
|
{
|
||||||
if (!BuildingActorToEdit || !BuildingActorToEdit->IsPlayerPlaced()) // We need more checks.
|
if (!BuildingActorToEdit || !BuildingActorToEdit->IsPlayerPlaced()) // We need more checks.
|
||||||
@@ -1715,9 +1682,6 @@ void AFortPlayerController::ServerBeginEditingBuildingActorHook(AFortPlayerContr
|
|||||||
if (!Pawn)
|
if (!Pawn)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!IsOkForEditing(BuildingActorToEdit, PlayerController))
|
|
||||||
return;
|
|
||||||
|
|
||||||
auto PlayerState = PlayerController->GetPlayerState();
|
auto PlayerState = PlayerController->GetPlayerState();
|
||||||
|
|
||||||
if (!PlayerState)
|
if (!PlayerState)
|
||||||
@@ -1737,14 +1701,15 @@ void AFortPlayerController::ServerBeginEditingBuildingActorHook(AFortPlayerContr
|
|||||||
if (!EditToolInstance)
|
if (!EditToolInstance)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
AFortWeap_EditingTool* EditTool = nullptr;
|
Pawn->EquipWeaponDefinition(EditToolDef, EditToolInstance->GetItemEntry()->GetItemGuid());
|
||||||
|
|
||||||
EditTool = Cast<AFortWeap_EditingTool>(Pawn->EquipWeaponDefinition(EditToolDef, EditToolInstance->GetItemEntry()->GetItemGuid()));
|
auto EditTool = Cast<AFortWeap_EditingTool>(Pawn->GetCurrentWeapon());
|
||||||
|
|
||||||
if (!EditTool)
|
if (!EditTool)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
EditTool->SetEditActor(BuildingActorToEdit);
|
EditTool->GetEditActor() = BuildingActorToEdit;
|
||||||
|
EditTool->OnRep_EditActor();
|
||||||
}
|
}
|
||||||
|
|
||||||
void AFortPlayerController::ServerEditBuildingActorHook(UObject* Context, FFrame& Stack, void* Ret)
|
void AFortPlayerController::ServerEditBuildingActorHook(UObject* Context, FFrame& Stack, void* Ret)
|
||||||
@@ -1767,7 +1732,7 @@ void AFortPlayerController::ServerEditBuildingActorHook(UObject* Context, FFrame
|
|||||||
|
|
||||||
// LOG_INFO(LogDev, "RotationIterations: {}", RotationIterations);
|
// LOG_INFO(LogDev, "RotationIterations: {}", RotationIterations);
|
||||||
|
|
||||||
if (!BuildingActorToEdit || !NewBuildingClass || BuildingActorToEdit->GetEditingPlayer() != PlayerState || BuildingActorToEdit->IsDestroyed())
|
if (!BuildingActorToEdit || !NewBuildingClass || BuildingActorToEdit->IsDestroyed() || BuildingActorToEdit->GetEditingPlayer() != PlayerState)
|
||||||
{
|
{
|
||||||
// LOG_INFO(LogDev, "Cheater?");
|
// LOG_INFO(LogDev, "Cheater?");
|
||||||
// LOG_INFO(LogDev, "BuildingActorToEdit->GetEditingPlayer(): {} PlayerState: {} NewBuildingClass: {} BuildingActorToEdit: {}", BuildingActorToEdit ? __int64(BuildingActorToEdit->GetEditingPlayer()) : -1, __int64(PlayerState), __int64(NewBuildingClass), __int64(BuildingActorToEdit));
|
// LOG_INFO(LogDev, "BuildingActorToEdit->GetEditingPlayer(): {} PlayerState: {} NewBuildingClass: {} BuildingActorToEdit: {}", BuildingActorToEdit ? __int64(BuildingActorToEdit->GetEditingPlayer()) : -1, __int64(PlayerState), __int64(NewBuildingClass), __int64(BuildingActorToEdit));
|
||||||
@@ -1777,7 +1742,7 @@ void AFortPlayerController::ServerEditBuildingActorHook(UObject* Context, FFrame
|
|||||||
// if (!PlayerState || PlayerState->GetTeamIndex() != BuildingActorToEdit->GetTeamIndex())
|
// if (!PlayerState || PlayerState->GetTeamIndex() != BuildingActorToEdit->GetTeamIndex())
|
||||||
//return ServerEditBuildingActorOriginal(Context, Frame, Ret);
|
//return ServerEditBuildingActorOriginal(Context, Frame, Ret);
|
||||||
|
|
||||||
// BuildingActorToEdit->SetEditingPlayer(nullptr); // uh?
|
BuildingActorToEdit->SetEditingPlayer(nullptr);
|
||||||
|
|
||||||
static ABuildingSMActor* (*BuildingSMActorReplaceBuildingActor)(ABuildingSMActor*, __int64, UClass*, int, int, uint8_t, AFortPlayerController*) =
|
static ABuildingSMActor* (*BuildingSMActorReplaceBuildingActor)(ABuildingSMActor*, __int64, UClass*, int, int, uint8_t, AFortPlayerController*) =
|
||||||
decltype(BuildingSMActorReplaceBuildingActor)(Addresses::ReplaceBuildingActor);
|
decltype(BuildingSMActorReplaceBuildingActor)(Addresses::ReplaceBuildingActor);
|
||||||
@@ -1793,7 +1758,7 @@ void AFortPlayerController::ServerEditBuildingActorHook(UObject* Context, FFrame
|
|||||||
return ServerEditBuildingActorOriginal(Context, Stack, Ret);
|
return ServerEditBuildingActorOriginal(Context, Stack, Ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AFortPlayerController::ServerEndEditingBuildingActorHook(AFortPlayerController* PlayerController, ABuildingSMActor* BuildingActorToStopEditing)
|
void AFortPlayerController::ServerEndEditingBuildingActorHook(AFortPlayerController* PlayerController, ABuildingSMActor* BuildingActorToStopEditing)
|
||||||
{
|
{
|
||||||
auto Pawn = PlayerController->GetMyFortPawn();
|
auto Pawn = PlayerController->GetMyFortPawn();
|
||||||
|
|
||||||
@@ -1816,13 +1781,16 @@ void AFortPlayerController::ServerEndEditingBuildingActorHook(AFortPlayerControl
|
|||||||
if (!EditToolInstance)
|
if (!EditToolInstance)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Pawn->EquipWeaponDefinition(EditToolDef, EditToolInstance->GetItemEntry()->GetItemGuid()); // why do they do this on older builds bru
|
Pawn->EquipWeaponDefinition(EditToolDef, EditToolInstance->GetItemEntry()->GetItemGuid());
|
||||||
|
|
||||||
if (auto EditTool = Cast<AFortWeap_EditingTool>(Pawn->GetCurrentWeapon()))
|
auto EditTool = Cast<AFortWeap_EditingTool>(Pawn->GetCurrentWeapon());
|
||||||
|
|
||||||
|
BuildingActorToStopEditing->GetEditingPlayer() = nullptr;
|
||||||
|
// BuildingActorToStopEditing->OnRep_EditingPlayer();
|
||||||
|
|
||||||
|
if (EditTool)
|
||||||
{
|
{
|
||||||
EditTool->SetEditActor(nullptr);
|
EditTool->GetEditActor() = nullptr;
|
||||||
// PlayerController->ClientForceCancelBuildingTool();
|
EditTool->OnRep_EditActor();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// PlayerController->ClientForceCancelBuildingTool();
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user