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

Go to the source code of this file.

Functions

void func_ladder_think (entity this)
 

Function Documentation

◆ func_ladder_think()

void func_ladder_think ( entity  this)

Definition at line 4 of file ladder.qc.

References absmax, absmin, bot_pickup, boxesoverlap(), classname, DPCONTENTS_BODY, DPCONTENTS_BOTCLIP, DPCONTENTS_PLAYERCLIP, DPCONTENTS_SOLID, drawmask, entity(), g_drawables, g_ladderents, IL_EACH, IL_PUSH(), IS_CSQC, IS_DEAD, IS_PLAYER, jumpstepheightvec, MASK_NORMAL, min(), MOVE_NOMONSTERS, move_time, MOVETYPE_NOCLIP, NET_HANDLE, nextthink, ReadString, setthink, skin, solid, SOLID_BSP, SOLID_TRIGGER, spawn(), spawnfunc(), speed, stepheightvec, strfree, strzone(), time, to, trace_endpos, trace_startsolid, vector(), vlen(), WarpZoneLib_BoxTouchesBrush(), waypoint_getlinearcost(), waypoint_spawnforteleporter_boxes(), WAYPOINTFLAG_LADDER, WriteByte(), WriteCoord(), and WriteString().

5 {
6 #ifdef CSQC
7  // TODO: check if this is what is causing the glitchiness when switching between them
8  float dt = time - this.move_time;
9  this.move_time = time;
10  if(dt <= 0) { return; }
11 #endif
12 
13  // set myself as current ladders where possible
14  IL_EACH(g_ladderents, it.ladder_entity == this,
15  {
16  it.ladder_entity = NULL;
17  IL_REMOVE(g_ladderents, it);
18  });
19 
20  FOREACH_ENTITY_RADIUS((this.absmin + this.absmax) * 0.5, vlen(this.absmax - this.absmin) * 0.5 + 1, !it.ladder_entity && IS_PLAYER(it) && it.move_movetype != MOVETYPE_NOCLIP && !IS_DEAD(it),
21  {
22  vector emin = it.absmin;
23  vector emax = it.absmax;
24  if(this.solid == SOLID_BSP || (IS_CSQC && this.solid == SOLID_TRIGGER)) // CSQC doesn't expand properly
25  {
26  emin -= '1 1 1';
27  emax += '1 1 1';
28  }
29  if(boxesoverlap(emin, emax, this.absmin, this.absmax)) // quick
30  {
31  if(WarpZoneLib_BoxTouchesBrush(emin, emax, this, it)) // accurate
32  {
33  if(!it.ladder_entity)
34  IL_PUSH(g_ladderents, it);
35  it.ladder_entity = this;
36  }
37  }
38  });
39 
40 #ifdef SVQC
41  this.nextthink = time;
42 #endif
43 }
#define IL_EACH(this, cond, body)
#define IS_CSQC
Definition: _all.inc:8
vector absmax
Definition: csprogsdefs.qc:92
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
ERASEABLE float boxesoverlap(vector m1, vector m2, vector m3, vector m4)
requires that m2>m1 in all coordinates, and that m4>m3
Definition: vector.qh:73
float WarpZoneLib_BoxTouchesBrush(vector mi, vector ma, entity e, entity ig)
Definition: common.qc:138
#define IS_DEAD(s)
Definition: utils.qh:26
float nextthink
Definition: csprogsdefs.qc:121
vector(float skel, float bonenum) _skel_get_boneabs_hidden
float MOVETYPE_NOCLIP
Definition: progsdefs.qc:254
const float SOLID_BSP
Definition: csprogsdefs.qc:248
float move_time
Definition: movetypes.qh:77
const float SOLID_TRIGGER
Definition: csprogsdefs.qc:245
IntrusiveList g_ladderents
Definition: ladder.qh:3
vector absmin
Definition: csprogsdefs.qc:92
float time
Definition: csprogsdefs.qc:16
#define IS_PLAYER(v)
Definition: utils.qh:9
float solid
Definition: csprogsdefs.qc:99
+ Here is the call graph for this function: