EPlayerSpawned special logic added to server and client.

This commit is contained in:
stiffly
2016-01-22 17:49:21 +01:00
parent 74c95089ea
commit 389e057611
5 changed files with 49 additions and 6 deletions
+12
View File
@@ -92,6 +92,9 @@ void Client::parseMessageType(Packet& packet)
case MessageType::Kick:
parseKick();
break;
case MessageType::OnPlayerSpawned:
parsePlayersSpawned();
break;
default:
break;
}
@@ -129,6 +132,15 @@ void Client::parseKick()
m_IsConnected = false;
}
void Client::parsePlayersSpawned(Packet& packet)
{
Events::PlayerSpawned e;
e.Player = EntityWrapper(m_World, m_ServerIDToClientID[packet.ReadPrimitive<EntityID>()]);
e.Spawner = EntityWrapper(m_World, m_ServerIDToClientID[packet.ReadPrimitive<EntityID>()]);
e.PlayerID = -1;
m_EventBroker->Publish(e);
}
// Fields with strings will not work right now
void Client::InterpolateFields(Packet& packet, const ComponentInfo& componentInfo, const EntityID& entityID, const std::string& componentType)
{