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

Go to the source code of this file.

Functions

 NET_HANDLE (ENT_CLIENT_TURRET, bool isNew)
void turret_changeteam (entity this)
void turret_construct (entity this, bool isNew)
void turret_die (entity this)
void turret_draw (entity this)
void turret_draw2d (entity this)
void turret_gib_draw (entity this)
void turret_gibboom (entity this)
entity turret_gibtoss (string _model, vector _from, vector _to, vector _cmod, float _explode)
void turret_head_draw (entity this)
void turret_remove (entity this)

Variables

vector glowmod

Function Documentation

◆ NET_HANDLE()

NET_HANDLE ( ENT_CLIENT_TURRET ,
bool isNew )

Definition at line 356 of file cl_turrets.qc.

357{
358 int sf = ReadByte();
359
360 if (sf & TNSF_SETUP)
361 {
362 this.m_id = ReadRegistered(Turrets).m_id;
363
364 setorigin(this, ReadVector());
365
366 this.angles = ReadAngleVector2D();
367
368 turret_construct(this, isNew);
369 this.colormap = 1024;
370 this.glowmod = '0 1 1';
371 this.tur_head.colormap = this.colormap;
372 this.tur_head.glowmod = this.glowmod;
373 }
374
375 if (sf & TNSF_ANG)
376 {
377 if (this.tur_head == NULL) // apparently this can happpen before TNSF_SETUP. great.
378 this.tur_head = spawn();
379
380 this.tur_head.angles.x = ReadShort();
381 this.tur_head.angles.y = ReadShort();
382 //this.tur_head.angles = this.angles + this.tur_head.angles;
383 }
384
385 if (sf & TNSF_AVEL)
386 {
387 if (this.tur_head == NULL) // apparently this can happpen before TNSF_SETUP. great.
388 this.tur_head = spawn();
389
390 this.tur_head.avelocity.x = ReadShort();
391 this.tur_head.avelocity.y = ReadShort();
392 }
393
394 if (sf & TNSF_MOVE)
395 {
396 this.origin = ReadVector();
397 setorigin(this, this.origin);
398
399 this.velocity = ReadVector();
400 this.angles.y = ReadShort();
401
402 this.move_time = time;
403 }
404
405 if (sf & TNSF_ANIM)
406 {
407 this.frame1time = ReadCoord();
408 this.frame = ReadByte();
409 }
410
411 if (sf & TNSF_STATUS)
412 {
413 int _tmp = ReadByte();
414 if (_tmp != this.team)
415 {
416 this.team = _tmp;
417 turret_changeteam(this);
418 }
419
420 _tmp = ReadByte();
421 float myhp = GetResource(this, RES_HEALTH);
422 if (_tmp == 0 && myhp != 0)
423 turret_die(this);
424 else if (myhp && myhp > _tmp)
425 this.helpme = servertime + 10;
426 else if (myhp && myhp < _tmp)
427 this.helpme = 0; // we're being healed, don't spam help me waypoints
428
429 SetResourceExplicit(this, RES_HEALTH, _tmp);
430 }
431 return true;
432}
float frame1time
start time of framegroup animation
Definition anim.qh:22
float frame
primary framegroup animation (strength = 1 - lerpfrac - lerpfrac3 - lerpfrac4)
Definition anim.qh:6
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
void turret_changeteam(entity this)
Definition cl_turrets.qc:11
void turret_die(entity this)
void turret_construct(entity this, bool isNew)
int team
Definition main.qh:188
vector velocity
float time
float colormap
vector origin
#define spawn
vector glowmod
int m_id
Definition effect.qh:19
ent angles
Definition ent_cs.qc:146
SetResourceExplicit(ent, RES_ARMOR, ReadByte() *DEC_FACTOR)) ENTCS_PROP(NAME
float servertime
Definition net.qh:329
#define ReadVector()
Definition net.qh:349
#define ReadRegistered(r)
Definition net.qh:290
#define ReadAngleVector2D()
Definition net.qh:352
int ReadByte()
float move_time
Definition movetypes.qh:81
#define NULL
Definition post.qh:14
entity tur_head
Definition sv_turrets.qh:28
const int TNSF_ANG
Definition turret.qh:191
const int TNSF_AVEL
Definition turret.qh:192
const int TNSF_SETUP
Definition turret.qh:190
const int TNSF_MOVE
Definition turret.qh:193
const int TNSF_ANIM
Definition turret.qh:195
const int TNSF_STATUS
Definition turret.qh:189

References angles, colormap, frame, frame1time, GetResource(), glowmod, m_id, move_time, NULL, origin, ReadAngleVector2D, ReadByte(), ReadRegistered, ReadVector, servertime, SetResourceExplicit(), spawn, team, time, TNSF_ANG, TNSF_ANIM, TNSF_AVEL, TNSF_MOVE, TNSF_SETUP, TNSF_STATUS, tur_head, turret_changeteam(), turret_construct(), turret_die(), and velocity.

◆ turret_changeteam()

void turret_changeteam ( entity this)

Definition at line 11 of file cl_turrets.qc.

12{
13 this.glowmod = Team_ColorRGB(this.team - 1);
14 this.teamradar_color = Team_ColorRGB(this.team - 1);
15
16 if (this.team)
17 this.colormap = 1024 + (this.team - 1) * 17;
18
19 this.tur_head.colormap = this.colormap;
20 this.tur_head.glowmod = this.glowmod;
21
22}
vector Team_ColorRGB(int teamid)
Definition teams.qh:76

References colormap, entity(), glowmod, team, Team_ColorRGB(), and tur_head.

Referenced by NET_HANDLE().

◆ turret_construct()

void turret_construct ( entity this,
bool isNew )

Definition at line 200 of file cl_turrets.qc.

201{
202 entity tur = get_turretinfo(this.m_id);
203
204 if (this.tur_head == NULL)
205 this.tur_head = spawn();
206
207 this.netname = tur.m_name;
208
209 setorigin(this, this.origin);
210 _setmodel(this, tur.model);
211 _setmodel(this.tur_head, tur.head_model);
212 this.solid = SOLID_BBOX; // before setsize so it will be linked to the area grid
213 this.tur_head.solid = SOLID_NOT;
214 setsize(this, tur.m_mins, tur.m_maxs);
215 setsize(this.tur_head, '0 0 0', '0 0 0');
216
217 if (this.m_id == TUR_EWHEEL.m_id)
218 setattachment(this.tur_head, this, "");
219 else
220 setattachment(this.tur_head, this, "tag_head");
221
222 this.tur_head.classname = "turret_head";
223 this.tur_head.owner = this;
226 this.tur_head.angles = this.angles;
227 SetResourceExplicit(this, RES_HEALTH, 255);
230 this.draw = turret_draw;
231 this.entremove = turret_remove;
232 this.drawmask = MASK_NORMAL;
233 this.tur_head.drawmask = MASK_NORMAL;
234 this.anim_start_time = 0;
235 this.draw2d = turret_draw2d;
237 this.alpha = 1;
238
239 if (isNew)
240 {
241 // set default teamradar_color here because TNSF_SETUP (respawn) can override it
242 // if received right after TNSF_STATUS (team change)
243 this.teamradar_color = '1 0.6 0.1';
244 IL_PUSH(g_drawables, this);
245 IL_PUSH(g_drawables_2d, this);
246 }
247
248 tur.tr_setup(tur, this);
249}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
void turret_remove(entity this)
Definition cl_turrets.qc:3
void turret_draw(entity this)
Definition cl_turrets.qc:30
void turret_draw2d(entity this)
Definition cl_turrets.qc:57
string netname
Definition powerups.qc:20
float anim_start_time
Definition items.qc:15
float alpha
Definition items.qc:13
IntrusiveList g_drawables
Definition main.qh:91
IntrusiveList g_drawables_2d
Definition main.qh:92
float drawmask
const float MASK_NORMAL
const float SOLID_BBOX
const float SOLID_NOT
float solid
ERASEABLE entity IL_PUSH(IntrusiveList this, entity it)
Push to tail.
void set_movetype(entity this, int mt)
Definition movetypes.qc:4
const int MOVETYPE_NOCLIP
Definition movetypes.qh:141
#define get_turretinfo(i)
Definition all.qh:9
float autocvar_g_waypointsprite_turrets_maxdist

References alpha, angles, anim_start_time, autocvar_g_waypointsprite_turrets_maxdist, drawmask, entity(), g_drawables, g_drawables_2d, get_turretinfo, IL_PUSH(), m_id, MASK_NORMAL, MOVETYPE_NOCLIP, netname, NULL, origin, set_movetype(), SetResourceExplicit(), solid, SOLID_BBOX, SOLID_NOT, spawn, tur_head, turret_draw(), turret_draw2d(), and turret_remove().

Referenced by NET_HANDLE().

◆ turret_die()

void turret_die ( entity this)

Definition at line 317 of file cl_turrets.qc.

318{
319 sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
320 pointparticles(EFFECT_ROCKET_EXPLODE, this.origin, '0 0 0', 1);
322 {
323 // Base
324 if (this.m_id == TUR_EWHEEL.m_id)
325 turret_gibtoss((get_turretinfo(this.m_id)).model, this.origin + '0 0 18', this.velocity + '0 0 400' + '0.1 0.1 1' * (random() * 400), '-1 -1 -1', true);
326 else if (this.m_id == TUR_WALKER.m_id)
327 turret_gibtoss((get_turretinfo(this.m_id)).model, this.origin + '0 0 18', this.velocity + '0 0 300' + '0.1 0.1 1' * (random() * 200), '-1 -1 -1', true);
328 else if (this.m_id == TUR_TESLA.m_id)
329 turret_gibtoss((get_turretinfo(this.m_id)).model, this.origin + '0 0 18', '0 0 200', '-1 -1 -1', false);
330 else
331 {
332 if (random() > 0.5)
333 {
334 turret_gibtoss("models/turrets/base-gib2.md3", this.origin + '0 0 8', '0 0 50' + randomvec() * 150, '0 0 0', false);
335 turret_gibtoss("models/turrets/base-gib3.md3", this.origin + '0 0 8', '0 0 50' + randomvec() * 150, '0 0 0', false);
336 turret_gibtoss("models/turrets/base-gib4.md3", this.origin + '0 0 8', '0 0 50' + randomvec() * 150, '0 0 0', false);
337 }
338 else
339 turret_gibtoss("models/turrets/base-gib1.md3", this.origin + '0 0 8', '0 0 0', '0 0 0', true);
340
341 entity headgib = turret_gibtoss((get_turretinfo(this.m_id)).head_model, this.origin + '0 0 32', '0 0 200' + randomvec() * 200, '-1 -1 -1', true);
342 if (headgib)
343 {
344 headgib.angles = this.tur_head.angles;
345 headgib.avelocity = this.tur_head.avelocity + randomvec() * 45;
346 headgib.avelocity.y *= 5;
347 headgib.gravity = 0.5;
348 }
349 }
350 }
351
352 setmodel(this, MDL_Null);
353 setmodel(this.tur_head, MDL_Null);
354}
entity turret_gibtoss(string _model, vector _from, vector _to, vector _cmod, float _explode)
#define setmodel(this, m)
Definition model.qh:26
#define pointparticles(effect, org, vel, howmany)
Definition effect.qh:7
model
Definition ent_cs.qc:164
bool autocvar_cl_nogibs
Definition gibs.qh:18
float random(void)
vector randomvec(void)
const float VOL_BASE
Definition sound.qh:36
const int CH_SHOTS
Definition sound.qh:14
const float ATTEN_NORM
Definition sound.qh:30
#define sound(e, c, s, v, a)
Definition sound.qh:52

References ATTEN_NORM, autocvar_cl_nogibs, CH_SHOTS, entity(), get_turretinfo, m_id, model, origin, pointparticles, random(), randomvec(), setmodel, sound, tur_head, turret_gibtoss(), velocity, and VOL_BASE.

Referenced by NET_HANDLE(), and turret_damage().

◆ turret_draw()

void turret_draw ( entity this)

Definition at line 30 of file cl_turrets.qc.

31{
32 float dt = time - this.move_time;
33 this.move_time = time;
34 if (dt <= 0)
35 return;
36
37 this.tur_head.angles += dt * this.tur_head.avelocity;
38
39 if (GetResource(this, RES_HEALTH) < 127)
40 {
41 dt = random();
42
43 if (dt < 0.03)
44 te_spark(this.origin + '0 0 40', randomvec() * 256 + '0 0 256', 16);
45 }
46
47 if (GetResource(this, RES_HEALTH) < 85
48 && dt < 0.01)
49 pointparticles(EFFECT_SMOKE_LARGE, (this.origin + (randomvec() * 80)), '0 0 0', 1);
50
51 if (GetResource(this, RES_HEALTH) < 32
52 && dt < 0.015)
53 pointparticles(EFFECT_SMOKE_SMALL, (this.origin + (randomvec() * 80)), '0 0 0', 1);
54
55}

References entity(), GetResource(), move_time, origin, pointparticles, random(), randomvec(), time, and tur_head.

Referenced by turret_construct().

◆ turret_draw2d()

void turret_draw2d ( entity this)

Definition at line 57 of file cl_turrets.qc.

58{
59 if (this.netname == "")
60 return;
62 return;
63
64 float dist = vlen(this.origin - view_origin);
65 float t = entcs_GetTeam(player_localnum) + 1;
66
67 vector o;
68 string txt;
69
71 && dist < 10240 && t != this.team)
72 {
73 // TODO: Vehicle tactical hud
74 o = project_3d_to_2d(this.origin + '0 0 32');
75 if (o.z < 0
80 return; // Dont draw wp's for turrets out of view
81 o.z = 0;
82 if (hud != HUD_NORMAL)
83 {
84 txt = ((get_turretinfo(this.m_id)).spawnflags & TUR_FLAG_MOVE)
85 ? "gfx/vehicles/turret_moving"
86 : "gfx/vehicles/turret_stationary";
87
89 drawpic(o - pz * 0.5, txt, pz, '1 1 1', 0.7, DRAWFLAG_NORMAL);
90 }
91 }
92
93 if (dist > this.maxdistance)
94 return;
95
96 string spriteimage = this.netname;
97 float a = this.alpha * autocvar_hud_panel_fg_alpha;
98 vector rgb = spritelookupcolor(this, spriteimage, this.teamradar_color);
99
100 if (this.maxdistance > waypointsprite_normdistance)
101 a *= (bound(0, (this.maxdistance - dist) / (this.maxdistance - waypointsprite_normdistance), 1) ** waypointsprite_distancealphaexponent);
102 else if (this.maxdistance > 0)
104
105 if (rgb == '0 0 0')
106 {
107 this.teamradar_color = '1 0 1';
108 LOG_INFOF("WARNING: sprite of name %s has no color, using pink so you notice it", spriteimage);
109 }
110
111 txt = spritelookuptext(this, spriteimage);
112
113 if (time - floor(time) > 0.5 && t == this.team)
114 {
115 if (this.helpme && time < this.helpme)
116 {
118 txt = sprintf(_("%s under attack!"), txt);
119 }
120 else
121 a *= spritelookupblinkvalue(this, spriteimage);
122 }
123
125 txt = strtoupper(txt);
126
127 if (a > 1)
128 {
129 rgb *= a;
130 a = 1;
131 }
132 else if (a <= 0)
133 return;
134
135 rgb = fixrgbexcess(rgb);
136
137 o = project_3d_to_2d(this.origin + '0 0 64');
138 if (o.z < 0
143 return; // Dont draw wp's for turrets out of view
144
145 o.z = 0;
146
147 float edgedistance_min = min(
152 );
153
154 float crosshairdistance = sqrt((o.x - vid_conwidth * 0.5) ** 2 + (o.y - vid_conheight * 0.5) ** 2);
155
158
159 {
162 }
163 if (edgedistance_min < waypointsprite_edgefadedistance)
164 {
165 a *= 1 - (1 - waypointsprite_edgefadealpha) * (1 - bound(0, edgedistance_min / waypointsprite_edgefadedistance, 1));
166 t *= 1 - (1 - waypointsprite_edgefadescale) * (1 - bound(0, edgedistance_min / waypointsprite_edgefadedistance, 1));
167 }
168 if (crosshairdistance < waypointsprite_crosshairfadedistance)
169 {
170 a *= 1 - (1 - waypointsprite_crosshairfadealpha) * (1 - bound(0, crosshairdistance / waypointsprite_crosshairfadedistance, 1));
171 t *= 1 - (1 - waypointsprite_crosshairfadescale) * (1 - bound(0, crosshairdistance / waypointsprite_crosshairfadedistance, 1));
172 }
173
174 bool draw_healthbar = ((this.helpme && time < this.helpme) || !autocvar_g_waypointsprite_turrets_onlyhurt || hud != HUD_NORMAL);
175
176 if (draw_healthbar || autocvar_g_waypointsprite_turrets_text) // make sure it's actually being drawn
177 o = drawspritearrow(o, M_PI, rgb, a, SPRITE_ARROW_SCALE * t);
180 if (draw_healthbar)
182 o,
183 0,
184 GetResource(this, RES_HEALTH) / 255,
185 '0 0 0',
186 '0 0 0',
187 0.5 * t * SPRITE_HEALTHBAR_WIDTH,
188 0.5 * t * SPRITE_HEALTHBAR_HEIGHT,
191 0,
192 rgb,
194 rgb,
197 );
198}
float autocvar_cl_vehicles_crosshair_size
Definition cl_vehicles.qh:7
bool autocvar_cl_vehicles_hud_tactical
Definition cl_vehicles.qh:4
#define drawpic(position, pic, size, rgb, alpha, flag)
Definition draw.qh:21
vector view_origin
Definition main.qh:109
int hud
Definition main.qh:173
const int HUD_NORMAL
Definition constants.qh:47
const float DRAWFLAG_NORMAL
float player_localnum
vector drawgetimagesize(string pic)
int entcs_GetTeam(int i)
Definition ent_cs.qh:132
float autocvar_hud_panel_fg_alpha
Definition hud.qh:202
noref float vid_conwidth
Definition draw.qh:7
noref float vid_conheight
Definition draw.qh:8
#define LOG_INFOF(...)
Definition log.qh:63
#define M_PI
pi
Definition mathlib.qh:112
float bound(float min, float value, float max)
float vlen(vector v)
float sqrt(float f)
float min(float f,...)
float floor(float f)
vector
Definition self.qh:96
const int TUR_FLAG_MOVE
can move
Definition turret.qh:154
vector project_3d_to_2d(vector vec)
Definition view.qc:373
vector drawsprite_TextOrIcon(bool is_text, vector o, float ang, float minwidth, vector rgb, float a, vector sz, string str)
void drawhealthbar(vector org, float rot, float h, vector sz, vector hotspot, float width, float theheight, float margin, float border, float align, vector rgb, float a, vector hrgb, float ha, float f)
vector drawspritearrow(vector o, float ang, vector rgb, float a, float t)
string spritelookuptext(entity this, string s)
vector spritelookupcolor(entity this, string s, vector def)
vector fixrgbexcess(vector rgb)
float spritelookupblinkvalue(entity this, string s)
const float SPRITE_HEALTHBAR_HEIGHT
float waypointsprite_alpha
bool autocvar_g_waypointsprite_uppercase
bool autocvar_g_waypointsprite_turrets_text
float waypointsprite_edgeoffset_left
float waypointsprite_scale
float waypointsprite_distancefadedistance
float waypointsprite_edgeoffset_top
float waypointsprite_distancealphaexponent
float waypointsprite_crosshairfadescale
const float SPRITE_HELPME_BLINK
float waypointsprite_normdistance
float waypointsprite_edgefadescale
float waypointsprite_edgeoffset_right
float waypointsprite_crosshairfadealpha
float waypointsprite_fadedistance
float waypointsprite_edgefadedistance
const float SPRITE_ARROW_SCALE
float waypointsprite_crosshairfadedistance
bool autocvar_cl_hidewaypoints
bool autocvar_g_waypointsprite_turrets_onlyhurt
const float SPRITE_HEALTHBAR_HEALTHALPHA
const float SPRITE_HEALTHBAR_BORDERALPHA
float waypointsprite_edgefadealpha
const float SPRITE_HEALTHBAR_WIDTH
const float SPRITE_HEALTHBAR_BORDER
float waypointsprite_distancefadealpha
bool autocvar_g_waypointsprite_turrets
float waypointsprite_distancefadescale
const float SPRITE_HEALTHBAR_MARGIN
float waypointsprite_fontsize
float waypointsprite_minalpha
float waypointsprite_edgeoffset_bottom

References alpha, autocvar_cl_hidewaypoints, autocvar_cl_vehicles_crosshair_size, autocvar_cl_vehicles_hud_tactical, autocvar_g_waypointsprite_turrets, autocvar_g_waypointsprite_turrets_onlyhurt, autocvar_g_waypointsprite_turrets_text, autocvar_g_waypointsprite_uppercase, autocvar_hud_panel_fg_alpha, bound(), DRAWFLAG_NORMAL, drawgetimagesize(), drawhealthbar(), drawpic, drawsprite_TextOrIcon(), drawspritearrow(), entcs_GetTeam(), entity(), fixrgbexcess(), floor(), get_turretinfo, GetResource(), hud, HUD_NORMAL, LOG_INFOF, m_id, M_PI, min(), netname, origin, player_localnum, project_3d_to_2d(), SPRITE_ARROW_SCALE, SPRITE_HEALTHBAR_BORDER, SPRITE_HEALTHBAR_BORDERALPHA, SPRITE_HEALTHBAR_HEALTHALPHA, SPRITE_HEALTHBAR_HEIGHT, SPRITE_HEALTHBAR_MARGIN, SPRITE_HEALTHBAR_WIDTH, SPRITE_HELPME_BLINK, spritelookupblinkvalue(), spritelookupcolor(), spritelookuptext(), sqrt(), team, time, TUR_FLAG_MOVE, vector, vid_conheight, vid_conwidth, view_origin, vlen(), waypointsprite_alpha, waypointsprite_crosshairfadealpha, waypointsprite_crosshairfadedistance, waypointsprite_crosshairfadescale, waypointsprite_distancealphaexponent, waypointsprite_distancefadealpha, waypointsprite_distancefadedistance, waypointsprite_distancefadescale, waypointsprite_edgefadealpha, waypointsprite_edgefadedistance, waypointsprite_edgefadescale, waypointsprite_edgeoffset_bottom, waypointsprite_edgeoffset_left, waypointsprite_edgeoffset_right, waypointsprite_edgeoffset_top, waypointsprite_fadedistance, waypointsprite_fontsize, waypointsprite_minalpha, waypointsprite_normdistance, and waypointsprite_scale.

Referenced by turret_construct().

◆ turret_gib_draw()

void turret_gib_draw ( entity this)

Definition at line 253 of file cl_turrets.qc.

254{
256
257 this.drawmask = MASK_NORMAL;
258
259 if (this.cnt)
260 {
261 if (time >= this.nextthink)
262 {
263 turret_gibboom(this);
264 delete(this);
265 }
266 }
267 else
268 {
269 this.alpha = bound(0, this.nextthink - time, 1);
270 if (this.alpha < ALPHA_MIN_VISIBLE)
271 delete(this);
272 }
273}
void turret_gibboom(entity this)
float cnt
Definition powerups.qc:24
const float ALPHA_MIN_VISIBLE
Definition main.qh:158
float nextthink
float autocvar_cl_gibs_ticrate
Definition gibs.qh:13
bool autocvar_cl_gibs_sloppy
Definition gibs.qh:12
void Movetype_Physics_MatchTicrate(entity this, float tr, bool sloppy)
Definition movetypes.qc:835

References alpha, ALPHA_MIN_VISIBLE, autocvar_cl_gibs_sloppy, autocvar_cl_gibs_ticrate, bound(), cnt, drawmask, entity(), MASK_NORMAL, Movetype_Physics_MatchTicrate(), nextthink, time, and turret_gibboom().

Referenced by turret_gibtoss().

◆ turret_gibboom()

void turret_gibboom ( entity this)

Definition at line 275 of file cl_turrets.qc.

276{
277 sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
278 pointparticles(EFFECT_ROCKET_EXPLODE, this.origin, '0 0 0', 1);
279
280 for (int j = 1; j < 5; ++j)
281 turret_gibtoss(strcat("models/turrets/head-gib", ftos(j), ".md3"), this.origin + '0 0 2', this.velocity + randomvec() * 700, '0 0 0', false);
282}
string ftos(float f)
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))

References ATTEN_NORM, CH_SHOTS, entity(), ftos(), origin, pointparticles, randomvec(), sound, strcat(), turret_gibtoss(), velocity, and VOL_BASE.

Referenced by turret_gib_draw().

◆ turret_gibtoss()

entity turret_gibtoss ( string _model,
vector _from,
vector _to,
vector _cmod,
float _explode )

Definition at line 284 of file cl_turrets.qc.

285{
286 traceline(_from, _to, MOVE_NOMONSTERS, NULL);
288 return NULL;
289
290 entity gib = new(turret_gib);
291 setorigin(gib, _from);
292 _setmodel(gib, _model);
293 gib.colormod = _cmod;
294 gib.solid = SOLID_CORPSE;
295 gib.draw = turret_gib_draw;
296 gib.cnt = _explode;
297 setsize(gib, '-1 -1 -1', '1 1 1');
298 if (_explode)
299 {
300 gib.nextthink = time + 0.2 * (autocvar_cl_gibs_lifetime * (1 + prandom() * 0.15));
301 gib.effects = EF_FLAME;
302 }
303 else
304 gib.nextthink = time + autocvar_cl_gibs_lifetime * (1 + prandom() * 0.15);
305
306 gib.gravity = 1;
308 setorigin(gib, _from);
309 gib.velocity = _to;
310 gib.avelocity = prandomvec() * 32;
311 gib.move_time = time;
312 gib.damageforcescale = 1;
313
314 return gib;
315}
void turret_gib_draw(entity this)
const float MOVE_NOMONSTERS
const float SOLID_CORPSE
float trace_startsolid
const float EF_FLAME
float autocvar_cl_gibs_lifetime
Definition gibs.qh:10
const int MOVETYPE_BOUNCE
Definition movetypes.qh:143
float prandom()
Predictable random number generator (not seeded yet).
Definition random.qc:108
vector prandomvec()
Definition random.qc:120

References autocvar_cl_gibs_lifetime, EF_FLAME, entity(), MOVE_NOMONSTERS, MOVETYPE_BOUNCE, NULL, prandom(), prandomvec(), set_movetype(), SOLID_CORPSE, time, trace_startsolid, turret_gib_draw(), and vector.

Referenced by turret_die(), and turret_gibboom().

◆ turret_head_draw()

void turret_head_draw ( entity this)

Definition at line 25 of file cl_turrets.qc.

26{
27 this.drawmask = MASK_NORMAL;
28}

References drawmask, entity(), and MASK_NORMAL.

◆ turret_remove()

void turret_remove ( entity this)

Definition at line 3 of file cl_turrets.qc.

4{
5 delete(this.tur_head);
6 //remove(this.enemy);
7 this.tur_head = NULL;
8}

References entity(), NULL, and tur_head.

Referenced by turret_construct().

Variable Documentation

◆ glowmod

vector glowmod

Definition at line 10 of file cl_turrets.qc.