Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
platforms.qh File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void plat_center_touch (entity this, entity toucher)
void plat_crush (entity this, entity blocker)
void plat_go_down (entity this)
void plat_go_up (entity this)
void plat_outside_touch (entity this, entity toucher)
void plat_trigger_use (entity this, entity actor, entity trigger)

Variables

float dmg
float dmgtime
float dmgtime2
float phase
const int PLAT_LOW_TRIGGER = BIT(0)

Function Documentation

◆ plat_center_touch()

void plat_center_touch ( entity this,
entity toucher )

Definition at line 90 of file platforms.qc.

91{
92#ifdef SVQC
93 if (!toucher.iscreature)
94 return;
95
96 if (GetResource(toucher, RES_HEALTH) <= 0)
97 return;
98#elif defined(CSQC)
99 if (!IS_PLAYER(toucher))
100 return;
101 if(IS_DEAD(toucher))
102 return;
103#endif
104
105 if (this.enemy.state == STATE_BOTTOM) {
106 plat_go_up(this.enemy);
107 } else if (this.enemy.state == STATE_TOP)
108 this.enemy.nextthink = this.enemy.ltime + 1;
109}
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
#define IS_DEAD(s)
Definition player.qh:245
#define IS_PLAYER(s)
Definition player.qh:243
void plat_go_up(entity this)
Definition platforms.qc:83
entity entity toucher
Definition self.qh:72
entity enemy
Definition sv_ctf.qh:153
#define STATE_TOP
Definition sys-pre.qh:28
#define STATE_BOTTOM
Definition sys-pre.qh:29

References enemy, entity(), GetResource(), IS_DEAD, IS_PLAYER, plat_go_up(), STATE_BOTTOM, STATE_TOP, and toucher.

Referenced by plat_spawn_inside_trigger().

◆ plat_crush()

void plat_crush ( entity this,
entity blocker )

Definition at line 138 of file platforms.qc.

139{
140 if((this.spawnflags & CRUSH) && (blocker.takedamage != DAMAGE_NO))
141 { // KIll Kill Kill!!
142#ifdef SVQC
143 Damage (blocker, this, this, 10000, DEATH_HURTTRIGGER.m_id, DMG_NOWEP, blocker.origin, '0 0 0');
144#endif
145 }
146 else
147 {
148#ifdef SVQC
149 if((this.dmg) && (blocker.takedamage != DAMAGE_NO))
150 { // Shall we bite?
151 Damage (blocker, this, this, this.dmg, DEATH_HURTTRIGGER.m_id, DMG_NOWEP, blocker.origin, '0 0 0');
152 // Gib dead/dying stuff
153 if(IS_DEAD(blocker))
154 Damage (blocker, this, this, 10000, DEATH_HURTTRIGGER.m_id, DMG_NOWEP, blocker.origin, '0 0 0');
155 }
156#endif
157
158 if (this.state == STATE_UP)
159 plat_go_down (this);
160 else if (this.state == STATE_DOWN)
161 plat_go_up (this);
162 // when in other states, then the plat_crush event came delayed after
163 // plat state already had changed
164 // this isn't a bug per se!
165 }
166}
float dmg
Definition breakable.qc:12
int spawnflags
Definition ammo.qh:15
void Damage(entity targ, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
Definition damage.qc:503
#define DMG_NOWEP
Definition damage.qh:104
int state
const int CRUSH
Definition defs.qh:11
void plat_go_down(entity this)
Definition platforms.qc:76
const int DAMAGE_NO
Definition subs.qh:79
#define STATE_UP
Definition sys-pre.qh:30
#define STATE_DOWN
Definition sys-pre.qh:31

References CRUSH, Damage(), DAMAGE_NO, dmg, DMG_NOWEP, entity(), IS_DEAD, plat_go_down(), plat_go_up(), spawnflags, state, STATE_DOWN, and STATE_UP.

Referenced by spawnfunc().

◆ plat_go_down()

void plat_go_down ( entity this)

Definition at line 76 of file platforms.qc.

77{
79 this.state = STATE_DOWN;
81}
float speed
Definition dynlight.qc:9
void plat_hit_bottom(entity this)
Definition platforms.qc:70
const int CH_TRIGGER_SINGLE
Definition sound.qh:13
const float VOL_BASE
Definition sound.qh:36
#define _sound(e, c, s, v, a)
Definition sound.qh:43
const float ATTEN_NORM
Definition sound.qh:30
void SUB_CalcMove(entity this, vector tdest, float tspeedtype, float tspeed, void(entity this) func)
Definition subs.qc:267
string noise
Definition subs.qh:83
vector pos2
Definition subs.qh:50
const int TSPEED_LINEAR
Definition subs.qh:71

References _sound, ATTEN_NORM, CH_TRIGGER_SINGLE, entity(), noise, plat_hit_bottom(), pos2, speed, state, STATE_DOWN, SUB_CalcMove(), TSPEED_LINEAR, and VOL_BASE.

Referenced by plat_crush(), plat_hit_top(), plat_outside_touch(), plat_trigger_use(), and plat_use().

◆ plat_go_up()

void plat_go_up ( entity this)

Definition at line 83 of file platforms.qc.

84{
86 this.state = STATE_UP;
88}
void plat_hit_top(entity this)
Definition platforms.qc:61
vector pos1
Definition subs.qh:50

References _sound, ATTEN_NORM, CH_TRIGGER_SINGLE, entity(), noise, plat_hit_top(), pos1, speed, state, STATE_UP, SUB_CalcMove(), TSPEED_LINEAR, and VOL_BASE.

Referenced by plat_center_touch(), plat_crush(), and plat_target_use().

◆ plat_outside_touch()

void plat_outside_touch ( entity this,
entity toucher )

Definition at line 111 of file platforms.qc.

112{
113#ifdef SVQC
114 if (!toucher.iscreature)
115 return;
116
117 if (GetResource(toucher, RES_HEALTH) <= 0)
118 return;
119#elif defined(CSQC)
120 if (!IS_PLAYER(toucher))
121 return;
122#endif
123
124 if (this.enemy.state == STATE_TOP) {
125 entity e = this.enemy;
126 plat_go_down(e);
127 }
128}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback

References enemy, entity(), GetResource(), IS_PLAYER, plat_go_down(), STATE_TOP, and toucher.

◆ plat_trigger_use()

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

Definition at line 130 of file platforms.qc.

131{
132 if (getthink(this))
133 return; // already activated
134 plat_go_down(this);
135}
#define getthink(e)

References entity(), getthink, and plat_go_down().

Referenced by plat_reset().

Variable Documentation

◆ dmg

float dmg

Definition at line 6 of file platforms.qh.

◆ dmgtime

◆ dmgtime2

float dmgtime2

◆ phase

float phase

Definition at line 10 of file platforms.qh.

Referenced by multivibrator_send().

◆ PLAT_LOW_TRIGGER

const int PLAT_LOW_TRIGGER = BIT(0)

Definition at line 4 of file platforms.qh.

Referenced by plat_spawn_inside_trigger().