1/* (c) Shereef Marzouk. See "licence DDRace.txt" and the readme.txt in the root of the distribution for more information. */
2#ifndef GAME_SERVER_ENTITIES_DRAGGER_H
3#define GAME_SERVER_ENTITIES_DRAGGER_H
4
5#include <game/server/entity.h>
6class CDraggerBeam;
7
8/**
9 * Draggers generate dragger beams which pull players towards their center similar to a tractor beam
10 *
11 * A dragger will only generate one dragger beam per team for the closest player for whom the following criteria are met:
12 * - The player is within the dragger range (sv_dragger_range).
13 * - The player is not a super player
14 * - The dragger is activated
15 * - The dragger beam to be generated is not blocked by laser stoppers (or solid blocks if IgnoreWalls is set to false)
16 * With the exception of solo players, for whom a dragger beam is always generated, regardless of the rest of the team,
17 * if the above criteria are met. Solo players have no influence on the generation of the dragger beam for the rest
18 * of the team.
19 * A created dragger beam remains for the selected player until one of the criteria is no longer fulfilled. Only then
20 * can a new dragger beam be created for that team, which may drag another team partner.
21 */
22class CDragger : public CEntity
23{
24 // m_Core is the direction vector by which a dragger is shifted at each movement tick (every 150ms)
25 vec2 m_Core;
26 float m_Strength;
27 bool m_IgnoreWalls;
28 int m_EvalTick;
29
30 int m_aTargetIdInTeam[MAX_CLIENTS];
31 CDraggerBeam *m_apDraggerBeam[MAX_CLIENTS];
32
33 void LookForPlayersToDrag();
34
35public:
36 CDragger(CGameWorld *pGameWorld, vec2 Pos, float Strength, bool IgnoreWalls, int Layer = 0, int Number = 0);
37
38 void RemoveDraggerBeam(int ClientId);
39 bool WillDraggerBeamUseDraggerId(int TargetClientId, int SnappingClientId);
40
41 void Reset() override;
42 void Tick() override;
43 void Snap(int SnappingClient) override;
44 void SwapClients(int Client1, int Client2) override;
45};
46
47#endif // GAME_SERVER_ENTITIES_DRAGGER_H
48