The server will now parse a death event and pass it forward with a KillDeath event to the score system.

This commit is contained in:
stiffly
2016-03-03 22:48:42 +01:00
parent c467d54d44
commit 8466a282b7
5 changed files with 65 additions and 19 deletions
+3 -2
View File
@@ -10,8 +10,9 @@ namespace Events
struct PlayerDeath : Event
{
//KilledBy,KilledByWhat is optional for now. It might be used later in the playerlog-system
EntityWrapper Player;
std::string KilledByWhat;
EntityWrapper Player = EntityWrapper::Invalid;
EntityWrapper Killer = EntityWrapper::Invalid;
std::string KilledByWhat = "";
};
}
+19
View File
@@ -0,0 +1,19 @@
#ifndef Events_KillDeath_h__
#define Events_KillDeath_h__
#include "Core/EventBroker.h"
typedef unsigned int PlayerID;
namespace Events
{
struct KillDeath : public Event
{
PlayerID Casualty = -1;
PlayerID Killer = -1;
};
}
#endif
+6 -1
View File
@@ -21,6 +21,8 @@
#include "Core/EEntityDeleted.h"
#include "Core/EComponentDeleted.h"
#include "Core/EAmmoPickup.h"
#include "Core/EPlayerDeath.h"
#include "Network/EKillDeath.h"
class Server : public Network
{
@@ -77,7 +79,8 @@ private:
void parseOnPlayerDamage(Packet& packet);
void identifyPacketLoss();
void kick(PlayerID player);
PlayerID GetPlayerIDFromEndpoint();
PlayerID getPlayerIDFromEndpoint();
PlayerID getPlayerIDFromEntityID();
void parsePlayerTransform(Packet& packet);
void parseOnInputCommand(Packet& packet);
void parseClientPing();
@@ -103,6 +106,8 @@ private:
bool OnPlayerDamage(const Events::PlayerDamage& e);
EventRelay<Server, Events::AmmoPickup> m_EAmmoPickup;
bool OnAmmoPickup(const Events::AmmoPickup& e);
EventRelay<Server, Events::PlayerDeath> m_EPlayerDeath;
bool OnPlayerDeath(const Events::PlayerDeath& e);
};
#endif