Update based on feedback. Adding event to MPSystemComponent for receiving a server acceptance packet. The editor system component subscribes to this event and tells the server we're ready for entity updates

Signed-off-by: Gene Walters <genewalt@amazon.com>
This commit is contained in:
Gene Walters
2021-10-06 15:44:43 -07:00
parent cfba31f6a0
commit 26079f7350
5 changed files with 37 additions and 20 deletions
@@ -489,23 +489,13 @@ namespace Multiplayer
{
m_didHandshake = true;
// If this is an Editor then we're now accepting the connection to the EditorServer.
// In normal game clients SendReadyForEntityUpdates will be enabled once the appropriate level's root spawnable is loaded,
// but since we're in Editor, we're already in the level.
AZ::ApplicationTypeQuery applicationType;
AZ::ComponentApplicationBus::Broadcast(&AZ::ComponentApplicationRequests::QueryApplicationType, applicationType);
if (applicationType.IsEditor())
{
SendReadyForEntityUpdates(true);
}
else
{
AZ::CVarFixedString commandString = "sv_map " + packet.GetMap();
AZ::Interface<AZ::IConsole>::Get()->PerformCommand(commandString.c_str());
AZ::CVarFixedString commandString = "sv_map " + packet.GetMap();
AZ::Interface<AZ::IConsole>::Get()->PerformCommand(commandString.c_str());
AZ::CVarFixedString loadLevelString = "LoadLevel " + packet.GetMap();
AZ::Interface<AZ::IConsole>::Get()->PerformCommand(loadLevelString.c_str());
}
AZ::CVarFixedString loadLevelString = "LoadLevel " + packet.GetMap();
AZ::Interface<AZ::IConsole>::Get()->PerformCommand(loadLevelString.c_str());
m_serverAcceptanceReceivedEvent.Signal();
return true;
}
@@ -800,6 +790,11 @@ namespace Multiplayer
handler.Connect(m_connAcquiredEvent);
}
void MultiplayerSystemComponent::AddServerAcceptanceReceivedHandler(ServerAcceptanceReceivedEvent::Handler& handler)
{
handler.Connect(m_serverAcceptanceReceivedEvent);
}
void MultiplayerSystemComponent::AddSessionInitHandler(SessionInitEvent::Handler& handler)
{
handler.Connect(m_initEvent);