mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-10-10 01:18:07 +00:00
feat: spectate command
This commit is contained in:
@@ -929,6 +929,15 @@ void SlashCommandHandler::Startup() {
|
||||
};
|
||||
RegisterCommand(FindPlayerCommand);
|
||||
|
||||
Command SpectateCommand{
|
||||
.help = "Spectate a player",
|
||||
.info = "Specify a player name to spectate. They must be in the same world as you",
|
||||
.aliases = { "spectate", "follow" },
|
||||
.handle = GMGreaterThanZeroCommands::Spectate,
|
||||
.requiredLevel = eGameMasterLevel::JUNIOR_MODERATOR
|
||||
};
|
||||
RegisterCommand(SpectateCommand);
|
||||
|
||||
// Register GM Zero Commands
|
||||
|
||||
Command HelpCommand{
|
||||
|
@@ -322,4 +322,12 @@ namespace GMGreaterThanZeroCommands {
|
||||
request.Serialize(bitStream);
|
||||
Game::chatServer->Send(&bitStream, SYSTEM_PRIORITY, RELIABLE, 0, Game::chatSysAddr, false);
|
||||
}
|
||||
|
||||
void Spectate(Entity* entity, const SystemAddress& sysAddr, const std::string args) {
|
||||
if (args.length() <= 0) GameMessages::SendSlashCommandFeedbackText(entity, u"No player Given");
|
||||
auto player = PlayerManager::GetPlayer(args);
|
||||
if (!player) GameMessages::SendSlashCommandFeedbackText(entity, u"Player not found");
|
||||
GameMessages::SendSlashCommandFeedbackText(entity, u"Spectating Player");
|
||||
GameMessages::SendForceCameraTargetCycle(entity, false, eCameraTargetCyclingMode::DISALLOW_CYCLING, player->GetObjectID());
|
||||
}
|
||||
}
|
||||
|
@@ -15,6 +15,7 @@ namespace GMGreaterThanZeroCommands {
|
||||
void Title(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||
void ShowAll(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||
void FindPlayer(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||
void Spectate(Entity* entity, const SystemAddress& sysAddr, const std::string args);
|
||||
}
|
||||
|
||||
#endif //!GMGREATERTHANZEROCOMMANDS_H
|
||||
|
Reference in New Issue
Block a user