]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/triggers/teleporters.qh
#pragma once
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / triggers / teleporters.qh
1 #pragma once
2
3 .entity pusher;
4 const float TELEPORT_FLAG_SOUND = 1;
5 const float TELEPORT_FLAG_PARTICLES = 2;
6 const float TELEPORT_FLAG_TDEATH = 4;
7 const float TELEPORT_FLAG_FORCE_TDEATH = 8;
8
9 #define TELEPORT_FLAGS_WARPZONE   0
10 #define TELEPORT_FLAGS_PORTAL     (TELEPORT_FLAG_SOUND | TELEPORT_FLAG_PARTICLES | TELEPORT_FLAG_TDEATH | TELEPORT_FLAG_FORCE_TDEATH)
11 #define TELEPORT_FLAGS_TELEPORTER (TELEPORT_FLAG_SOUND | TELEPORT_FLAG_PARTICLES | TELEPORT_FLAG_TDEATH)
12
13 // types for .teleportable entity setting
14 const float TELEPORT_NORMAL = 1; // play sounds/effects etc
15 const float TELEPORT_SIMPLE = 2; // only do teleport, nothing special
16
17 entity Simple_TeleportPlayer(entity teleporter, entity player);
18
19 void Teleport_Touch(entity this, entity toucher);
20
21 void teleport_findtarget(entity this);
22
23 entity Teleport_Find(vector mi, vector ma);
24
25 void TeleportPlayer(entity teleporter, entity player, vector to, vector to_angles, vector to_velocity, vector telefragmin, vector telefragmax, float tflags);
26
27 entity teleport_first;
28 .entity teleport_next;
29
30 #ifdef SVQC
31
32 void trigger_teleport_use(entity this, entity actor, entity trigger);
33
34 #define TDEATHLOOP(o) \
35         entity head; \
36         vector deathmin; \
37         vector deathmax; \
38         float deathradius; \
39         deathmin = (o) + player.mins; \
40         deathmax = (o) + player.maxs; \
41         if(telefragmin != telefragmax) \
42         { \
43                 if(deathmin.x > telefragmin.x) deathmin.x = telefragmin.x; \
44                 if(deathmin.y > telefragmin.y) deathmin.y = telefragmin.y; \
45                 if(deathmin.z > telefragmin.z) deathmin.z = telefragmin.z; \
46                 if(deathmax.x < telefragmax.x) deathmax.x = telefragmax.x; \
47                 if(deathmax.y < telefragmax.y) deathmax.y = telefragmax.y; \
48                 if(deathmax.z < telefragmax.z) deathmax.z = telefragmax.z; \
49         } \
50         deathradius = max(vlen(deathmin), vlen(deathmax)); \
51         for(head = findradius(o, deathradius); head; head = head.chain) \
52                 if(head != player) \
53                         if(head.takedamage) \
54                                 if(boxesoverlap(deathmin, deathmax, head.absmin, head.absmax))
55
56 float check_tdeath(entity player, vector org, vector telefragmin, vector telefragmax);
57 float tdeath_hit;
58 void tdeath(entity player, entity teleporter, entity telefragger, vector telefragmin, vector telefragmax);
59
60 void spawn_tdeath(vector v0, entity e, vector v);
61
62 void Reset_ArcBeam(entity player, vector forward);
63
64 #endif
65
66 void WarpZone_PostTeleportPlayer_Callback(entity pl);
67
68 #ifdef CSQC
69 .entity realowner;
70 .float lastteleporttime;
71
72 #define TDEATHLOOP(o) \
73         entity head; \
74         vector deathmin; \
75         vector deathmax; \
76         float deathradius; \
77         deathmin = (o) + player.mins; \
78         deathmax = (o) + player.maxs; \
79         if(telefragmin != telefragmax) \
80         { \
81                 if(deathmin.x > telefragmin.x) deathmin.x = telefragmin.x; \
82                 if(deathmin.y > telefragmin.y) deathmin.y = telefragmin.y; \
83                 if(deathmin.z > telefragmin.z) deathmin.z = telefragmin.z; \
84                 if(deathmax.x < telefragmax.x) deathmax.x = telefragmax.x; \
85                 if(deathmax.y < telefragmax.y) deathmax.y = telefragmax.y; \
86                 if(deathmax.z < telefragmax.z) deathmax.z = telefragmax.z; \
87         } \
88         deathradius = max(vlen(deathmin), vlen(deathmax)); \
89         for(head = findradius(o, deathradius); head; head = head.chain) \
90                 if(head != player) \
91                         if(head.isplayermodel) \
92                                 if(boxesoverlap(deathmin, deathmax, head.absmin, head.absmax))
93 #endif