1/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */
2
3#ifndef GAME_SERVER_ENTITIES_GUN_H
4#define GAME_SERVER_ENTITIES_GUN_H
5
6#include <game/server/entity.h>
7
8/**
9 * Turrets (also referred to as Gun) fire plasma bullets at the nearest player
10 *
11 * A turret fires plasma bullets with a certain firing rate (sv_plasma_per_sec) at the closest player of a team for whom
12 * the following criteria are met:
13 * - The player is within the turret range (sv_plasma_range)
14 * - The player is not a super player
15 * - The turret is activated
16 * - The initial trajectory of the plasma bullet to be generated would not be stopped by any solid block
17 * With the exception of solo players, for whom plasma bullets will always be fired, regardless of the rest of the team,
18 * if the above criteria are met. Solo players do not affect the generation of plasma bullets for the rest of the team.
19 * The shooting rate of sv_plasma_per_sec is independent for each team and solo player and starts with the first tick
20 * when a target player is selected.
21 */
22class CGun : public CEntity
23{
24 vec2 m_Core;
25 bool m_Freeze;
26 bool m_Explosive;
27 int m_EvalTick;
28 int m_aLastFireTeam[MAX_CLIENTS];
29 int m_aLastFireSolo[MAX_CLIENTS];
30
31 void Fire();
32
33public:
34 CGun(CGameWorld *pGameWorld, vec2 Pos, bool Freeze, bool Explosive, int Layer = 0, int Number = 0);
35
36 void Reset() override;
37 void Tick() override;
38 void Snap(int SnappingClient) override;
39};
40
41#endif // GAME_SERVER_ENTITIES_GUN_H
42