feat: spectate command

This commit is contained in:
Aaron Kimbre
2024-06-03 21:50:12 -05:00
parent a54600b41e
commit b56d077892
5 changed files with 38 additions and 0 deletions

View File

@@ -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());
}
}

View File

@@ -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