fix restarting, add cheat teleport and help, build free and infinite ammo, fix restarting on c1,  fix some gui issues.
This commit is contained in:
Milxnor
2023-04-17 21:05:08 -04:00
parent d308c9ad91
commit 6daab8d5a2
28 changed files with 352 additions and 208 deletions

View File

@@ -33,6 +33,9 @@ void AFortPlayerController::ClientReportDamagedResourceBuilding(ABuildingSMActor
bool AFortPlayerController::DoesBuildFree()
{
if (Globals::bInfiniteMaterials)
return true;
static auto bBuildFreeOffset = GetOffset("bBuildFree");
static auto bBuildFreeFieldMask = GetFieldMask(GetProperty("bBuildFree"));
return ReadBitfieldValue(bBuildFreeOffset, bBuildFreeFieldMask);
@@ -175,11 +178,6 @@ void AFortPlayerController::ApplyCosmeticLoadout()
UFortKismetLibrary::StaticClass()->ProcessEvent(UpdatePlayerCustomCharacterPartsVisualizationFn, &PlayerStateAsFort);
}
void AFortPlayerController::ServerSetInventoryStateValueHook(AFortPlayerController* PlayerController, FGuid a2, __int64 StateValue)
{
LOG_INFO(LogDev, "ServerSetInventoryStateValueHook! Please tell Milxnor if this gets logged.");
}
void AFortPlayerController::ServerLoadingScreenDroppedHook(UObject* Context, FFrame* Stack, void* Ret)
{
auto PlayerController = (AFortPlayerController*)Context;
@@ -709,9 +707,11 @@ void AFortPlayerController::ServerCreateBuildingActorHook(UObject* Context, FFra
auto MatInstance = WorldInventory->FindItemInstance(MatDefinition);
bool bShouldDestroy = MatInstance && MatInstance->GetItemEntry() ? (PlayerController->DoesBuildFree() ? false : MatInstance->GetItemEntry()->GetCount() < 10) : true;
bool bBuildFree = PlayerController->DoesBuildFree();
if (bShouldDestroy)
bool bShouldDestroy = MatInstance && MatInstance->GetItemEntry() ? MatInstance->GetItemEntry()->GetCount() < 10 : true;
if (bShouldDestroy && !bBuildFree)
{
BuildingActor->SilentDie();
return ServerCreateBuildingActorOriginal(Context, Stack, Ret);
@@ -721,7 +721,7 @@ void AFortPlayerController::ServerCreateBuildingActorHook(UObject* Context, FFra
BuildingActor->InitializeBuildingActor(PlayerController, BuildingActor, true);
BuildingActor->SetTeam(PlayerStateAthena->GetTeamIndex()); // required?
if (!PlayerController->DoesBuildFree())
if (!bBuildFree)
{
bool bShouldUpdate = false;
WorldInventory->RemoveItem(MatInstance->GetItemEntry()->GetItemGuid(), &bShouldUpdate, 10);