2010-07-29 05:21:18 +00:00
|
|
|
/* copyright (c) 2007 magnus auvinen, see licence.txt for more info */
|
|
|
|
|
2018-07-06 14:11:38 +00:00
|
|
|
#ifndef GAME_SERVER_ENTITIES_GUN_H
|
|
|
|
#define GAME_SERVER_ENTITIES_GUN_H
|
2010-07-29 05:21:18 +00:00
|
|
|
|
2020-09-26 19:41:58 +00:00
|
|
|
#include <game/server/entity.h>
|
2010-07-29 05:21:18 +00:00
|
|
|
|
2022-05-09 11:56:06 +00:00
|
|
|
/**
|
|
|
|
* Turrets (also referred to as Gun) fire plasma bullets at the nearest player
|
|
|
|
*
|
2022-05-09 12:03:00 +00:00
|
|
|
* A turret fires plasma bullets with a certain firing rate (sv_plasma_per_sec) at the closest player of a team for whom
|
2022-05-09 11:56:06 +00:00
|
|
|
* the following criteria are met:
|
2022-05-09 12:03:00 +00:00
|
|
|
* - The player is within the turret range (sv_plasma_range)
|
2022-05-09 11:56:06 +00:00
|
|
|
* - The player is not a super player
|
|
|
|
* - The turret is activated
|
|
|
|
* - The initial trajectory of the plasma bullet to be generated would not be stopped by any solid block
|
|
|
|
* With the exception of solo players, for whom plasma bullets will always be fired, regardless of the rest of the team,
|
|
|
|
* if the above criteria are met. Solo players do not affect the generation of plasma bullets for the rest of the team.
|
2022-05-09 12:03:00 +00:00
|
|
|
* The shooting rate of sv_plasma_per_sec is independent for each team and solo player and starts with the first tick
|
2022-05-09 11:56:06 +00:00
|
|
|
* when a target player is selected.
|
|
|
|
*/
|
2010-07-29 05:21:18 +00:00
|
|
|
class CGun : public CEntity
|
|
|
|
{
|
2010-08-28 20:32:16 +00:00
|
|
|
vec2 m_Core;
|
2011-04-20 13:47:55 +00:00
|
|
|
bool m_Freeze;
|
|
|
|
bool m_Explosive;
|
2022-05-09 11:56:06 +00:00
|
|
|
int m_EvalTick;
|
|
|
|
int m_LastFireTeam[MAX_CLIENTS];
|
|
|
|
int m_LastFireSolo[MAX_CLIENTS];
|
2010-07-29 05:21:18 +00:00
|
|
|
|
2010-08-28 20:32:16 +00:00
|
|
|
void Fire();
|
2015-07-09 00:08:14 +00:00
|
|
|
|
2010-07-29 05:21:18 +00:00
|
|
|
public:
|
2010-11-13 13:22:19 +00:00
|
|
|
CGun(CGameWorld *pGameWorld, vec2 Pos, bool Freeze, bool Explosive, int Layer = 0, int Number = 0);
|
2010-07-29 05:21:18 +00:00
|
|
|
|
2022-05-17 20:13:44 +00:00
|
|
|
void Reset() override;
|
|
|
|
void Tick() override;
|
|
|
|
void Snap(int SnappingClient) override;
|
2010-07-29 05:21:18 +00:00
|
|
|
};
|
|
|
|
|
2018-07-06 14:11:38 +00:00
|
|
|
#endif // GAME_SERVER_ENTITIES_GUN_H
|