AmmoPickups and HealthPickups will only spawn on the server. When a ammo pickup is taken the Server will send an Event to that

Client and it will update its ammo.
This commit is contained in:
Jocke
2016-03-01 17:55:00 +01:00
parent 6d68486c05
commit aadfdfdd90
8 changed files with 124 additions and 57 deletions
+3 -1
View File
@@ -26,6 +26,7 @@
#include "Network/EInterpolate.h"
#include "Network/SnapshotFilter.h"
#include "Core/EPlayerSpawned.h"
#include "Core/EAmmoPickup.h"
#include "Network/ESearchForServers.h"
struct ServerInfo
@@ -106,7 +107,8 @@ private:
void parsePlayerDamage(Packet& packet);
void parseComponentDeletion(Packet& packet);
void parseDoubleJump(Packet& packet);
void InterpolateFields(Packet & packet, const ComponentInfo & componentInfo, const EntityID & entityID, const std::string & componentType);
void parseAmmoPickup(Packet& packet);
void InterpolateFields(Packet& packet, const ComponentInfo & componentInfo, const EntityID & entityID, const std::string & componentType);
void parseSnapshot(Packet& packet);
void identifyPacketLoss();
void hasServerTimedOut();
+1
View File
@@ -21,6 +21,7 @@ enum class MessageType
PlayerTransform,
OnDoubleJump,
ServerlistRequest,
AmmoPickup,
Invalid
};
+4 -1
View File
@@ -20,6 +20,7 @@
#include "../Game/Events/EDoubleJump.h"
#include "Core/EEntityDeleted.h"
#include "Core/EComponentDeleted.h"
#include "Core/EAmmoPickup.h"
class Server : public Network
{
@@ -88,7 +89,7 @@ private:
void parseServerlistRequest(boost::asio::ip::udp::endpoint endpoint);
bool shouldSendToClient(EntityWrapper childEntity);
// Debug event
// Events
EventRelay<Server, Events::InputCommand> m_EInputCommand;
bool OnInputCommand(const Events::InputCommand& e);
EventRelay<Server, Events::PlayerSpawned> m_EPlayerSpawned;
@@ -99,6 +100,8 @@ private:
bool OnComponentDeleted(const Events::ComponentDeleted& e);
EventRelay<Server, Events::PlayerDamage> m_EPlayerDamage;
bool OnPlayerDamage(const Events::PlayerDamage& e);
EventRelay<Server, Events::AmmoPickup> m_EAmmoPickup;
bool OnAmmoPickup(const Events::AmmoPickup& e);
};
#endif