2011-12-25 13:33:05 +00:00
|
|
|
/* (c) Shereef Marzouk. See "licence DDRace.txt" and the readme.txt in the root of the distribution for more information. */
|
2018-07-06 14:11:38 +00:00
|
|
|
#ifndef GAME_SERVER_ENTITIES_DRAGGER_H
|
|
|
|
#define GAME_SERVER_ENTITIES_DRAGGER_H
|
2010-07-29 05:21:18 +00:00
|
|
|
|
|
|
|
#include <game/server/entity.h>
|
2022-05-02 18:31:17 +00:00
|
|
|
class CDraggerBeam;
|
2010-07-29 05:21:18 +00:00
|
|
|
|
2022-05-09 11:56:06 +00:00
|
|
|
/**
|
|
|
|
* Draggers generate dragger beams which pull players towards their center similar to a tractor beam
|
|
|
|
*
|
|
|
|
* A dragger will only generate one dragger beam per team for the closest player for whom the following criteria are met:
|
2022-05-09 12:03:00 +00:00
|
|
|
* - The player is within the dragger range (sv_dragger_range).
|
2022-05-09 11:56:06 +00:00
|
|
|
* - The player is not a super player
|
|
|
|
* - The dragger is activated
|
|
|
|
* - The dragger beam to be generated is not blocked by laser stoppers (or solid blocks if IgnoreWalls is set to false)
|
|
|
|
* With the exception of solo players, for whom a dragger beam is always generated, regardless of the rest of the team,
|
|
|
|
* if the above criteria are met. Solo players have no influence on the generation of the dragger beam for the rest
|
|
|
|
* of the team.
|
|
|
|
* A created dragger beam remains for the selected player until one of the criteria is no longer fulfilled. Only then
|
|
|
|
* can a new dragger beam be created for that team, which may drag another team partner.
|
|
|
|
*/
|
2020-09-26 19:41:58 +00:00
|
|
|
class CDragger : public CEntity
|
2010-07-29 05:21:18 +00:00
|
|
|
{
|
2022-05-02 18:31:17 +00:00
|
|
|
// m_Core is the direction vector by which a dragger is shifted at each movement tick (every 150ms)
|
2010-08-30 23:45:42 +00:00
|
|
|
vec2 m_Core;
|
|
|
|
float m_Strength;
|
2022-05-02 18:31:17 +00:00
|
|
|
bool m_IgnoreWalls;
|
2022-05-09 11:56:06 +00:00
|
|
|
int m_EvalTick;
|
2014-05-07 22:53:21 +00:00
|
|
|
|
2022-05-09 11:56:06 +00:00
|
|
|
int m_TargetIdInTeam[MAX_CLIENTS];
|
2022-05-02 18:31:17 +00:00
|
|
|
CDraggerBeam *m_apDraggerBeam[MAX_CLIENTS];
|
2010-07-29 05:21:18 +00:00
|
|
|
|
2022-05-09 11:56:06 +00:00
|
|
|
void LookForPlayersToDrag();
|
|
|
|
|
2020-09-26 19:41:58 +00:00
|
|
|
public:
|
2022-05-02 18:31:17 +00:00
|
|
|
CDragger(CGameWorld *pGameWorld, vec2 Pos, float Strength, bool IgnoreWalls, int Layer = 0, int Number = 0);
|
|
|
|
|
|
|
|
void RemoveDraggerBeam(int ClientID);
|
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_DRAGGER_H
|