1/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
2/* If you are missing that file, acquire a complete release at teeworlds.com. */
3#ifndef GAME_SERVER_ENTITIES_LASER_H
4#define GAME_SERVER_ENTITIES_LASER_H
5
6#include <game/server/entity.h>
7#include <game/server/interactions.h>
8
9class CLaser : public CEntity
10{
11public:
12 CLaser(CGameWorld *pGameWorld, vec2 Pos, vec2 Direction, float StartEnergy, int Owner, int Type);
13
14 void Reset() override;
15 void Tick() override;
16 void TickPaused() override;
17 void Snap(int SnappingClient) override;
18 void SwapClients(int Client1, int Client2) override;
19
20 int GetOwnerId() const override { return m_Owner; }
21
22protected:
23 bool HitCharacter(vec2 From, vec2 To);
24 void DoBounce();
25
26private:
27 vec2 m_From;
28 vec2 m_Dir;
29 vec2 m_TelePos;
30 bool m_WasTele;
31 float m_Energy;
32 int m_Bounces;
33 int m_EvalTick;
34 int m_Owner;
35 bool m_ZeroEnergyBounceInLastTick;
36 CInteractions m_InteractState;
37
38 // DDRace
39
40 vec2 m_PrevPos;
41 int m_Type;
42 int m_TuneZone;
43 bool m_TeleportCancelled;
44 bool m_IsBlueTeleport;
45 bool m_BelongsToPracticeTeam;
46 void SyncInteractState();
47};
48
49#endif
50