This commit is contained in:
Jocke
2016-03-12 14:31:15 +01:00
parent 7759af2c5a
commit 0c1a2d3160
8 changed files with 60 additions and 15 deletions
+13
View File
@@ -17,6 +17,7 @@ Server::Server(World* world, EventBroker* eventBroker, int port)
EVENT_SUBSCRIBE_MEMBER(m_EPlayerDamage, &Server::OnPlayerDamage);
EVENT_SUBSCRIBE_MEMBER(m_EAmmoPickup, &Server::OnAmmoPickup);
EVENT_SUBSCRIBE_MEMBER(m_EPlayerDeath, &Server::OnPlayerDeath);
EVENT_SUBSCRIBE_MEMBER(m_EWin, &Server::OnWin);
// BindWW
if (port == 0) {
port = config->Get<float>("Networking.Port", 27666);
@@ -542,6 +543,18 @@ bool Server::OnPlayerDeath(const Events::PlayerDeath& e)
return false;
}
bool Server::OnWin(const Events::Win & e)
{
Packet removeMap(MessageType::RemoveWorld);
reliableBroadcast(removeMap);
removeWorld();
auto entityFile = ResourceManager::Load<EntityFile>("Schema/Entities/CP_Rocky2.xml");
entityFile->MergeInto(m_World);
Packet newWorld(MessageType::Snapshot);
reliableBroadcast(newWorld);
return true;
}
void Server::parseClientPing()
{
LOG_INFO("%i: Parsing ping", m_PacketID);