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

Go to the source code of this file.

Functions

void DelayThink (entity this)
 
bool isPushable (entity e)
 
void SUB_DontUseTargets (entity this, entity actor, entity trigger)
 
void SUB_UseTargets (entity this, entity actor, entity trigger)
 
void SUB_UseTargets_Ex (entity this, entity actor, entity trigger, bool preventReuse, int skiptargets)
 
void SUB_UseTargets_PreventReuse (entity this, entity actor, entity trigger)
 
void SUB_UseTargets_SkipTargets (entity this, entity actor, entity trigger, int skiptargets)
 

Function Documentation

◆ DelayThink()

void DelayThink ( entity  this)

Definition at line 39 of file triggers.qc.

References active, ACTIVE_ACTIVE, ACTIVE_NOT, ACTIVE_TOGGLE, angles, BIT, BITSET_ASSIGN, bound(), EF_NODEPTHTEST, effects, enemy, entity(), EXACTTRIGGER_INIT, killtarget, maxs, mins, model, modelindex, movedir, NULL, origin, ReadString, scale, sendflags, setorigin(), setSendEntity, SF_TRIGGER_UPDATE, spawnflags, START_ENABLED, strfree, string_null, strzone(), SUB_UseTargets(), target, target2, target3, target4, targetname, to, warpzone_isboxy, WriteByte(), WriteShort(), and WriteString().

Referenced by SUB_UseTargets_Ex().

40 {
41  SUB_UseTargets (this, this.enemy, NULL);
42  delete(this);
43 }
void SUB_UseTargets(entity this, entity actor, entity trigger)
Definition: triggers.qc:366
entity enemy
Definition: sv_ctf.qh:143
#define NULL
Definition: post.qh:17
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isPushable()

bool isPushable ( entity  e)

Definition at line 3 of file triggers.qc.

References IS_VEHICLE, and Item_IsLoot().

Referenced by conveyor_think(), jumppad_push(), trigger_impulse_touch_accel(), trigger_impulse_touch_directional(), and trigger_impulse_touch_radial().

4 {
5  if(e.pushable)
6  return true;
7 #ifdef SVQC
8  if(IS_VEHICLE(e))
9  return false;
10  if(e.iscreature)
11  return true;
12  if (Item_IsLoot(e))
13  {
14  return true;
15  }
16  switch(e.classname)
17  {
18  case "body":
19  return true;
20  case "bullet": // antilagged bullets can't hit this either
21  return false;
22  }
23  if (e.projectiledeathtype)
24  return true;
25 #endif
26 #ifdef CSQC
27  if(e.flags & FL_PROJECTILE)
28  return true;
29  if(e.isplayermodel)
30  return true;
31 #endif
32  return false;
33 }
#define IS_VEHICLE(v)
Definition: utils.qh:22
bool Item_IsLoot(entity item)
Returns whether the item is loot.
Definition: spawning.qc:121
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SUB_DontUseTargets()

void SUB_DontUseTargets ( entity  this,
entity  actor,
entity  trigger 
)

Definition at line 35 of file triggers.qc.

References entity(), and SUB_UseTargets().

35 { }
+ Here is the call graph for this function:

◆ SUB_UseTargets()

void SUB_UseTargets ( entity  this,
entity  actor,
entity  trigger 
)

Definition at line 366 of file triggers.qc.

References SUB_UseTargets_Ex().

Referenced by assault_objective_decrease_use(), assault_roundstart_use(), CheatCommand(), checkpoint_passed(), DelayThink(), dompoint_captured(), door_go_up(), fragsfilter_use(), Item_Touch(), jumppad_push(), Monster_Damage(), ons_ControlPoint_Icon_BuildThink(), ons_ControlPoint_Icon_Damage(), ons_ControlPoint_Icon_Think(), ons_ControlPoint_Reset(), PutPlayerInServer(), SUB_DontUseTargets(), target_init_use(), Teleport_Touch(), and train_wait().

366 { SUB_UseTargets_Ex(this, actor, trigger, false, 0); }
void SUB_UseTargets_Ex(entity this, entity actor, entity trigger, bool preventReuse, int skiptargets)
Definition: triggers.qc:270
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SUB_UseTargets_Ex()

void SUB_UseTargets_Ex ( entity  this,
entity  actor,
entity  trigger,
bool  preventReuse,
int  skiptargets 
)

Definition at line 270 of file triggers.qc.

References antiwall_flag, BIT, centerprint(), delay, DelayThink(), entity(), find(), IS_PLAYER, IS_REAL_CLIENT, killtarget, message, new_pure, noise, NULL, RandomSelection_AddEnt, RandomSelection_chosen_ent, RandomSelection_Init(), setthink, SND, target, target2, target3, target4, target_random, targetname, and time.

Referenced by SUB_UseTargets(), SUB_UseTargets_PreventReuse(), and SUB_UseTargets_SkipTargets().

271 {
272 //
273 // check for a delay
274 //
275  if (this.delay)
276  {
277  // create a temp object to fire at a later time
278  entity t = new_pure(DelayedUse);
279  t.nextthink = time + this.delay;
280  setthink(t, DelayThink);
281  t.enemy = actor;
282  t.message = this.message;
283  t.killtarget = this.killtarget;
284  if(!(skiptargets & BIT(1))) t.target = this.target;
285  if(!(skiptargets & BIT(2))) t.target2 = this.target2;
286  if(!(skiptargets & BIT(3))) t.target3 = this.target3;
287  if(!(skiptargets & BIT(4))) t.target4 = this.target4;
288  t.antiwall_flag = this.antiwall_flag;
289  return;
290  }
291 
292  string s;
293 
294 //
295 // print the message
296 //
297 #ifdef SVQC
298  if(this)
299  if(IS_PLAYER(actor) && this.message != "")
300  if(IS_REAL_CLIENT(actor))
301  {
302  centerprint(actor, this.message);
303  if (this.noise == "")
304  play2(actor, SND(TALK));
305  }
306 
307 //
308 // kill the killtagets
309 //
310  s = this.killtarget;
311  if (s != "")
312  {
313  for(entity t = NULL; (t = find(t, targetname, s)); )
314  delete(t);
315  }
316 #endif
317 
318 //
319 // fire targets
320 //
321 
322  if(this.target_random)
324 
325  for(int i = 0; i < 4; ++i)
326  {
327  if(skiptargets & BIT(i + 1))
328  continue;
329  switch(i)
330  {
331  default:
332  case 0: s = this.target; break;
333  case 1: s = this.target2; break;
334  case 2: s = this.target3; break;
335  case 3: s = this.target4; break;
336  }
337  if (s != "")
338  {
339  for(entity t = NULL; (t = find(t, targetname, s)); )
340  {
341  if(t != this && t.use && (t.sub_target_used != time || !preventReuse))
342  {
343  if(this.target_random)
344  {
345  RandomSelection_AddEnt(t, 1, 0);
346  }
347  else
348  {
349  t.use(t, actor, this);
350  if(preventReuse)
351  t.sub_target_used = time;
352  }
353  }
354  }
355  }
356  }
357 
359  {
361  if(preventReuse)
362  RandomSelection_chosen_ent.sub_target_used = time;
363  }
364 }
float target_random
Definition: subs.qh:57
void DelayThink(entity this)
Definition: triggers.qc:39
#define SND(id)
Definition: all.qh:35
string killtarget
Definition: subs.qh:48
string noise
Definition: progsdefs.qc:209
string target3
Definition: subs.qh:54
ERASEABLE void RandomSelection_Init()
Definition: random.qc:4
entity() spawn
#define IS_REAL_CLIENT(v)
Definition: utils.qh:17
#define RandomSelection_AddEnt(e, weight, priority)
Definition: random.qh:14
#define BIT(n)
Only ever assign into the first 24 bits in QC (so max is BIT(23)).
Definition: bits.qh:8
entity RandomSelection_chosen_ent
Definition: random.qh:5
float delay
Definition: subs.qh:38
string message
Definition: powerups.qc:19
#define NULL
Definition: post.qh:17
string target2
Definition: sv_onslaught.qh:45
string targetname
Definition: progsdefs.qc:194
#define new_pure(class)
purely logical entities (.origin doesn&#39;t work)
Definition: oo.qh:62
#define setthink(e, f)
float antiwall_flag
Definition: triggers.qh:6
string target
Definition: progsdefs.qc:193
float time
Definition: csprogsdefs.qc:16
#define IS_PLAYER(v)
Definition: utils.qh:9
string target4
Definition: subs.qh:55
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SUB_UseTargets_PreventReuse()

void SUB_UseTargets_PreventReuse ( entity  this,
entity  actor,
entity  trigger 
)

Definition at line 367 of file triggers.qc.

References SUB_UseTargets_Ex().

367 { SUB_UseTargets_Ex(this, actor, trigger, true, 0); }
void SUB_UseTargets_Ex(entity this, entity actor, entity trigger, bool preventReuse, int skiptargets)
Definition: triggers.qc:270
+ Here is the call graph for this function:

◆ SUB_UseTargets_SkipTargets()

void SUB_UseTargets_SkipTargets ( entity  this,
entity  actor,
entity  trigger,
int  skiptargets 
)

Definition at line 368 of file triggers.qc.

References SUB_UseTargets_Ex().

Referenced by WarpZone_Touch().

368 { SUB_UseTargets_Ex(this, actor, trigger, false, skiptargets); }
void SUB_UseTargets_Ex(entity this, entity actor, entity trigger, bool preventReuse, int skiptargets)
Definition: triggers.qc:270
+ Here is the call graph for this function:
+ Here is the caller graph for this function: