Skip to content

Commit

Permalink
Spectators need health too. #SpectatorLivesMatter
Browse files Browse the repository at this point in the history
  • Loading branch information
DolceTriade committed Dec 23, 2015
1 parent da60ff5 commit b0f14e1
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 28 deletions.
4 changes: 2 additions & 2 deletions src/sgame/components/SpectatorComponent.cpp
@@ -1,7 +1,7 @@
#include "SpectatorComponent.h"

SpectatorComponent::SpectatorComponent(Entity& entity, ClientComponent& r_ClientComponent)
: SpectatorComponentBase(entity, r_ClientComponent)
SpectatorComponent::SpectatorComponent(Entity& entity, ClientComponent& r_ClientComponent, HealthComponent& r_HealthComponent)
: SpectatorComponentBase(entity, r_ClientComponent, r_HealthComponent)
{}

void SpectatorComponent::HandlePrepareNetCode() {
Expand Down
45 changes: 23 additions & 22 deletions src/sgame/components/SpectatorComponent.h
Expand Up @@ -5,28 +5,29 @@
#include "../backend/CBSEComponents.h"

class SpectatorComponent: public SpectatorComponentBase {
public:
// ///////////////////// //
// Autogenerated Members //
// ///////////////////// //

/**
* @brief Default constructor of the SpectatorComponent.
* @param entity The entity that owns the component instance.
* @param r_ClientComponent A ClientComponent instance that this component depends on.
* @note This method is an interface for autogenerated code, do not modify its signature.
*/
SpectatorComponent(Entity& entity, ClientComponent& r_ClientComponent);

/**
* @brief Handle the PrepareNetCode message.
* @note This method is an interface for autogenerated code, do not modify its signature.
*/
void HandlePrepareNetCode();

// ///////////////////// //

private:
public:
// ///////////////////// //
// Autogenerated Members //
// ///////////////////// //

/**
* @brief Default constructor of the SpectatorComponent.
* @param entity The entity that owns the component instance.
* @param r_ClientComponent A ClientComponent instance that this component depends on.
* @param r_HealthComponent A HealthComponent instance that this component depends on.
* @note This method is an interface for autogenerated code, do not modify its signature.
*/
SpectatorComponent(Entity& entity, ClientComponent& r_ClientComponent, HealthComponent& r_HealthComponent);

/**
* @brief Handle the PrepareNetCode message.
* @note This method is an interface for autogenerated code, do not modify its signature.
*/
void HandlePrepareNetCode();

// ///////////////////// //

private:

};

Expand Down
1 change: 1 addition & 0 deletions src/sgame/entities.yaml
Expand Up @@ -118,6 +118,7 @@ components:
- PrepareNetCode
requires:
- Client
- Health

AlienClass:
requires:
Expand Down
5 changes: 1 addition & 4 deletions src/sgame/sg_client.cpp
Expand Up @@ -1501,10 +1501,7 @@ static void ClientSpawnCBSE(gentity_t *ent, bool evolving) {
// - Call assignment operators on the new components to transfer state from old entity.

case PCL_NONE:
SpectatorEntity::Params params;
params.oldEnt = ent;
params.Client_clientData = client;
ent->entity = new SpectatorEntity(params);
CLIENT_ENTITY_CREATE(SpectatorEntity);
break;

case PCL_ALIEN_BUILDER0: {
Expand Down

0 comments on commit b0f14e1

Please sign in to comment.