]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/mapobjects/teleporters.qh
Purge autocvars.qh from the codebase, cvars are defined in the headers of the feature...
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / mapobjects / teleporters.qh
1 #pragma once
2 #include "defs.qh"
3
4 #ifdef SVQC
5 bool autocvar_g_telefrags;
6 bool autocvar_g_telefrags_avoid;
7 bool autocvar_g_telefrags_teamplay;
8 #endif
9
10 IntrusiveList g_teleporters;
11 STATIC_INIT(g_teleporters) { g_teleporters = IL_NEW(); }
12
13 .entity pusher;
14
15 const int TELEPORT_FLAG_SOUND = BIT(0);
16 const int TELEPORT_FLAG_PARTICLES = BIT(1);
17 const int TELEPORT_FLAG_TDEATH = BIT(2);
18 const int TELEPORT_FLAG_FORCE_TDEATH = BIT(3);
19
20 #define TELEPORT_FLAGS_WARPZONE   0
21 #define TELEPORT_FLAGS_PORTAL     (TELEPORT_FLAG_SOUND | TELEPORT_FLAG_PARTICLES | TELEPORT_FLAG_TDEATH | TELEPORT_FLAG_FORCE_TDEATH)
22 #define TELEPORT_FLAGS_TELEPORTER (TELEPORT_FLAG_SOUND | TELEPORT_FLAG_PARTICLES | TELEPORT_FLAG_TDEATH)
23
24 .float teleportable;
25 // types for .teleportable entity setting
26 const int TELEPORT_NORMAL = 1; // play sounds/effects etc
27 const int TELEPORT_SIMPLE = 2; // only do teleport, nothing special
28
29 entity Simple_TeleportPlayer(entity teleporter, entity player);
30
31 void Teleport_Touch(entity this, entity toucher);
32
33 void teleport_findtarget(entity this);
34
35 entity Teleport_Find(vector mi, vector ma);
36
37 void TeleportPlayer(entity teleporter, entity player, vector to, vector to_angles, vector to_velocity, vector telefragmin, vector telefragmax, float tflags);
38
39 #ifdef SVQC
40
41 void trigger_teleport_use(entity this, entity actor, entity trigger);
42
43 #define TDEATHLOOP(o) \
44         vector deathmin = (o) + player.mins; \
45         vector deathmax = (o) + player.maxs; \
46         if(telefragmin != telefragmax) \
47         { \
48                 if(deathmin.x > telefragmin.x) deathmin.x = telefragmin.x; \
49                 if(deathmin.y > telefragmin.y) deathmin.y = telefragmin.y; \
50                 if(deathmin.z > telefragmin.z) deathmin.z = telefragmin.z; \
51                 if(deathmax.x < telefragmax.x) deathmax.x = telefragmax.x; \
52                 if(deathmax.y < telefragmax.y) deathmax.y = telefragmax.y; \
53                 if(deathmax.z < telefragmax.z) deathmax.z = telefragmax.z; \
54         } \
55         float deathradius = max(vlen(deathmin), vlen(deathmax)); \
56         for (entity head = findradius(o, deathradius); head; head = head.chain) \
57                 if (head != player && head.takedamage && boxesoverlap(deathmin, deathmax, head.absmin, head.absmax))
58
59 float check_tdeath(entity player, vector org, vector telefragmin, vector telefragmax);
60 float tdeath_hit;
61 void tdeath(entity player, entity teleporter, entity telefragger, vector telefragmin, vector telefragmax);
62
63 void spawn_tdeath(vector v0, entity e, vector v);
64
65 void Reset_ArcBeam(entity player, vector forward);
66
67 #endif
68
69 void WarpZone_PostTeleportPlayer_Callback(entity pl);
70
71 #ifdef CSQC
72 .entity realowner;
73 #endif