Xonotic
teleport.qc File Reference
#include "teleport.qh"
+ Include dependency graph for teleport.qc:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

bool Teleport_Active (entity this, entity player)
 
void Teleport_Touch (entity this, entity toucher)
 

Function Documentation

◆ Teleport_Active()

bool Teleport_Active ( entity  this,
entity  player 
)

Definition at line 15 of file teleport.qc.

References active, ACTIVE_ACTIVE, DIFF_TEAM, INVERT_TEAMS, IS_DEAD, IS_PLAYER, IS_TURRET, spawnflags, and team.

Referenced by Teleport_Touch().

16 {
17  if (this.active != ACTIVE_ACTIVE)
18  return false;
19 
20 #ifdef SVQC
21  if (!player.teleportable)
22  return false;
23 
24  if(player.vehicle)
25  if(!player.vehicle.teleportable)
26  return false;
27 
28  if(IS_TURRET(player))
29  return false;
30 #elif defined(CSQC)
31  if(!IS_PLAYER(player))
32  return false;
33 #endif
34 
35  if(IS_DEAD(player))
36  return false;
37 
38  if(this.team)
39  if(((this.spawnflags & INVERT_TEAMS) == 0) == (DIFF_TEAM(this, player)))
40  return false;
41 
42  return true;
43 }
const int INVERT_TEAMS
Definition: defs.qh:10
int team
Definition: main.qh:157
#define DIFF_TEAM(a, b)
Definition: teams.qh:240
float spawnflags
Definition: progsdefs.qc:191
#define IS_TURRET(v)
Definition: utils.qh:23
const int ACTIVE_ACTIVE
Definition: defs.qh:37
#define IS_DEAD(s)
Definition: utils.qh:26
int active
Definition: defs.qh:34
#define IS_PLAYER(v)
Definition: utils.qh:9
+ Here is the caller graph for this function:

◆ Teleport_Touch()

void Teleport_Touch ( entity  this,
entity  toucher 
)

Definition at line 45 of file teleport.qc.

References active, ACTIVE_ACTIVE, angles, classname, enemy, entity(), EXACTTRIGGER_INIT, EXACTTRIGGER_TOUCH, FOREACH_ENTITY_STRING, FOREACH_WORD, g_teleporters, IL_PUSH(), InitializeEntity(), IS_PLAYER, mangle, move_time, NET_HANDLE, noise, objerror(), precache_sound(), RemoveGrapplingHooks(), Simple_TeleportPlayer(), solid, SOLID_TRIGGER, spawnflags, spawnfunc(), speed, string_null, SUB_UseTargets(), target, targetname, team, Teleport_Active(), teleport_findtarget(), time, to, use, WriteByte(), and WriteCoord().

Referenced by teleport_findtarget().

46 {
47  entity player = toucher;
48 
49  if(!Teleport_Active(this, player))
50  return;
51 
52  EXACTTRIGGER_TOUCH(this, player);
53 
54 #ifdef SVQC
55  if(IS_PLAYER(player))
56  RemoveGrapplingHooks(player);
57 #endif
58 
59  entity e;
60  e = Simple_TeleportPlayer(this, player);
61 
62 #ifdef SVQC
63  string s = this.target; this.target = string_null;
64  SUB_UseTargets(this, player, player); // TODO: should we be using toucher for trigger too?
65  if (!this.target) this.target = s;
66 
67  SUB_UseTargets(e, player, player);
68 #endif
69 }
string string_null
Definition: nil.qh:9
#define EXACTTRIGGER_TOUCH(e, t)
Definition: common.qh:116
entity() spawn
void SUB_UseTargets(entity this, entity actor, entity trigger)
Definition: triggers.qc:366
entity Simple_TeleportPlayer(entity teleporter, entity player)
Definition: teleporters.qc:180
void RemoveGrapplingHooks(entity pl)
Definition: hook.qc:78
bool Teleport_Active(entity this, entity player)
Definition: teleport.qc:15
string target
Definition: progsdefs.qc:193
#define IS_PLAYER(v)
Definition: utils.qh:9
+ Here is the call graph for this function:
+ Here is the caller graph for this function: