add waypoint commands

alot of ppl wanted these, so here you go
This commit is contained in:
ralz
2025-06-14 09:48:25 -04:00
committed by GitHub
parent 4f17a0e37c
commit 179e86d40c

View File

@@ -2,6 +2,11 @@
#include "FortAthenaAIBotSpawnerData.h"
#include <map>
#include <string>
std::map<std::string, FVector> Waypoints;
void ServerCheatHook(AFortPlayerControllerAthena* PlayerController, FString Msg)
{
bool isMsgEmpty = !Msg.Data.Data || Msg.Data.Num() <= 0;
@@ -851,6 +856,57 @@ void ServerCheatHook(AFortPlayerControllerAthena* PlayerController, FString Msg)
CheatManager = nullptr;
SendMessageToConsole(PlayerController, L"Teleported!");
}
else if (Command == "savewaypoint")
{
if (NumArgs < 1)
{
SendMessageToConsole(PlayerController, L"Please provide a phrase to save the waypoint.");
return;
}
auto Pawn = ReceivingController->GetMyFortPawn();
if (!Pawn)
{
SendMessageToConsole(PlayerController, L"No pawn to get location from!");
return;
}
auto PawnLocation = Pawn->GetActorLocation();
Waypoints[Arguments[1]] = PawnLocation;
SendMessageToConsole(PlayerController, L"Waypoint saved! Use « cheat waypoint (phrase) » to teleport to that location!");
}
else if (Command == "waypoint")
{
if (NumArgs < 1)
{
SendMessageToConsole(PlayerController, L"Please provide a waypoint phrase to teleport to.");
return;
}
std::string Phrase = Arguments[1];
if (Waypoints.find(Phrase) == Waypoints.end())
{
SendMessageToConsole(PlayerController, L"A saved waypoint with this phrase was not found!");
return;
}
FVector Destination = Waypoints[Phrase];
auto Pawn = ReceivingController->GetMyFortPawn();
if (Pawn)
{
Pawn->TeleportTo(Destination, Pawn->GetActorRotation());
SendMessageToConsole(PlayerController, L"Teleported to waypoint!");
}
else
{
SendMessageToConsole(PlayerController, L"No pawn to teleport!");
}
}
else if (Command == "startaircraft")
{
GameMode->StartAircraftPhase();
@@ -1017,4 +1073,4 @@ If you want to execute a command on a certain player, surround their name (case
SendMessageToConsole(PlayerController, HelpMessage);
}
}
}