Xonotic
bumblebee.qc
Go to the documentation of this file.
1 #include "bumblebee.qh"
2 
3 #ifdef GAMEQC
4 
5 #ifdef SVQC
7 #endif
8 
9 const float BRG_SETUP = 2;
10 const float BRG_START = 4;
11 const float BRG_END = 8;
12 
13 #ifdef SVQC
14 float autocvar_g_vehicle_bumblebee_respawntime = 60;
15 
16 float autocvar_g_vehicle_bumblebee_speed_forward = 350;
17 float autocvar_g_vehicle_bumblebee_speed_strafe = 350;
18 float autocvar_g_vehicle_bumblebee_speed_up = 350;
19 float autocvar_g_vehicle_bumblebee_speed_down = 350;
20 float autocvar_g_vehicle_bumblebee_turnspeed = 120;
21 float autocvar_g_vehicle_bumblebee_pitchspeed = 60;
22 float autocvar_g_vehicle_bumblebee_pitchlimit = 60;
23 float autocvar_g_vehicle_bumblebee_friction = 0.5;
24 bool autocvar_g_vehicle_bumblebee_swim = true;
25 
26 float autocvar_g_vehicle_bumblebee_energy = 500;
27 float autocvar_g_vehicle_bumblebee_energy_regen = 50;
28 float autocvar_g_vehicle_bumblebee_energy_regen_pause = 1;
29 
30 float autocvar_g_vehicle_bumblebee_health = 1000;
31 float autocvar_g_vehicle_bumblebee_health_regen = 65;
32 float autocvar_g_vehicle_bumblebee_health_regen_pause = 10;
33 
34 float autocvar_g_vehicle_bumblebee_shield = 400;
35 float autocvar_g_vehicle_bumblebee_shield_regen = 150;
36 float autocvar_g_vehicle_bumblebee_shield_regen_pause = 0.75;
37 
38 float autocvar_g_vehicle_bumblebee_cannon_ammo = 100;
39 float autocvar_g_vehicle_bumblebee_cannon_ammo_regen = 100;
40 float autocvar_g_vehicle_bumblebee_cannon_ammo_regen_pause = 1;
41 
42 float autocvar_g_vehicle_bumblebee_cannon_lock = 1;
43 
44 float autocvar_g_vehicle_bumblebee_cannon_turnspeed = 260;
45 float autocvar_g_vehicle_bumblebee_cannon_pitchlimit_down = 60;
46 float autocvar_g_vehicle_bumblebee_cannon_pitchlimit_up = 60;
47 float autocvar_g_vehicle_bumblebee_cannon_turnlimit_in = 20;
48 float autocvar_g_vehicle_bumblebee_cannon_turnlimit_out = 80;
49 
50 
51 float autocvar_g_vehicle_bumblebee_raygun_turnspeed = 180;
52 float autocvar_g_vehicle_bumblebee_raygun_pitchlimit_down = 20;
53 float autocvar_g_vehicle_bumblebee_raygun_pitchlimit_up = 5;
54 float autocvar_g_vehicle_bumblebee_raygun_turnlimit_sides = 35;
55 
56 bool autocvar_g_vehicle_bumblebee_raygun = false;
57 float autocvar_g_vehicle_bumblebee_raygun_range = 2048;
58 float autocvar_g_vehicle_bumblebee_raygun_dps = 250;
59 float autocvar_g_vehicle_bumblebee_raygun_aps = 100;
60 float autocvar_g_vehicle_bumblebee_raygun_fps = 100;
61 
62 float autocvar_g_vehicle_bumblebee_healgun_hps = 150;
63 float autocvar_g_vehicle_bumblebee_healgun_hmax = 100;
64 float autocvar_g_vehicle_bumblebee_healgun_aps = 75;
65 float autocvar_g_vehicle_bumblebee_healgun_amax = 100;
66 float autocvar_g_vehicle_bumblebee_healgun_sps = 100;
67 float autocvar_g_vehicle_bumblebee_healgun_locktime = 2.5;
68 
69 float autocvar_g_vehicle_bumblebee_blowup_radius = 500;
70 float autocvar_g_vehicle_bumblebee_blowup_coredamage = 500;
71 float autocvar_g_vehicle_bumblebee_blowup_edgedamage = 100;
72 float autocvar_g_vehicle_bumblebee_blowup_forceintensity = 600;
73 vector autocvar_g_vehicle_bumblebee_bouncepain = '1 100 200';
74 
75 bool autocvar_g_vehicle_bumblebee = true;
76 
77 bool bumblebee_gunner_frame(entity this, float dt)
78 {
79  entity vehic = this.vehicle.owner;
80  entity gun = this.vehicle;
81  return = true;
82 
83  // this isn't technically a vehicle (yet), let's not do frame functions on it (yet)
84  //vehicles_frame(gun, player);
85 
86  vehic.solid = SOLID_NOT;
87  //setorigin(this, vehic.origin);
88  this.velocity = vehic.velocity;
89 
90  float _in, _out;
91  vehic.angles_x *= -1;
92  makevectors(vehic.angles);
93  vehic.angles_x *= -1;
94  if(gun == vehic.gun1)
95  {
96  _in = autocvar_g_vehicle_bumblebee_cannon_turnlimit_in;
97  _out = autocvar_g_vehicle_bumblebee_cannon_turnlimit_out;
98  setorigin(this, vehic.origin + v_up * -16 + v_forward * -16 + v_right * 128);
99  }
100  else
101  {
102  _in = autocvar_g_vehicle_bumblebee_cannon_turnlimit_out;
103  _out = autocvar_g_vehicle_bumblebee_cannon_turnlimit_in;
104  setorigin(this, vehic.origin + v_up * -16 + v_forward * -16 + v_right * -128);
105  }
106  this.oldorigin = this.origin; // negate fall damage
107 
108  crosshair_trace(this);
109  vector _ct = trace_endpos;
110  vector ad;
111 
112  if(autocvar_g_vehicle_bumblebee_cannon_lock)
113  {
114  if(gun.lock_time < time || IS_DEAD(gun.enemy) || STAT(FROZEN, gun.enemy))
115  gun.enemy = NULL;
116 
117  if(trace_ent)
118  if(trace_ent.move_movetype)
119  if(trace_ent.takedamage)
120  if(!IS_DEAD(trace_ent) && !STAT(FROZEN, trace_ent))
121  {
122  if(teamplay)
123  {
124  if(DIFF_TEAM(trace_ent, this))
125  {
126  gun.enemy = trace_ent;
127  gun.lock_time = time + 2.5;
128  }
129  }
130  else
131  {
132  gun.enemy = trace_ent;
133  gun.lock_time = time + 0.5;
134  }
135  }
136  }
137 
138  if(gun.enemy)
139  {
140  float distance, impact_time;
141 
142  vector vf = real_origin(gun.enemy);
143  vector _vel = gun.enemy.velocity;
144  if(gun.enemy.move_movetype == MOVETYPE_WALK)
145  _vel.z *= 0.1;
146 
147 
148  ad = vf;
149  distance = vlen(ad - this.origin);
150  impact_time = distance / autocvar_g_vehicle_bumblebee_cannon_speed;
151  ad = vf + _vel * impact_time;
152  trace_endpos = ad;
153 
154 
155  UpdateAuxiliaryXhair(this, ad, '1 0 1', 1);
156  vehicle_aimturret(vehic, trace_endpos, gun, "fire",
157  autocvar_g_vehicle_bumblebee_cannon_pitchlimit_down * -1, autocvar_g_vehicle_bumblebee_cannon_pitchlimit_up,
158  _out * -1, _in, autocvar_g_vehicle_bumblebee_cannon_turnspeed, dt);
159 
160  }
161  else
162  vehicle_aimturret(vehic, _ct, gun, "fire",
163  autocvar_g_vehicle_bumblebee_cannon_pitchlimit_down * -1, autocvar_g_vehicle_bumblebee_cannon_pitchlimit_up,
164  _out * -1, _in, autocvar_g_vehicle_bumblebee_cannon_turnspeed, dt);
165 
166  if(!weaponLocked(this) && !weaponUseForbidden(this))
167  if(PHYS_INPUT_BUTTON_ATCK(this))
168  if(time > gun.attack_finished_single[0])
169  if(gun.vehicle_energy >= autocvar_g_vehicle_bumblebee_cannon_cost)
170  {
171  gun.vehicle_energy -= autocvar_g_vehicle_bumblebee_cannon_cost;
172  bumblebee_fire_cannon(vehic, gun, "fire", this);
173  gun.delay = time;
174  gun.attack_finished_single[0] = time + autocvar_g_vehicle_bumblebee_cannon_refire;
175  }
176 
177  VEHICLE_UPDATE_PLAYER_RESOURCE(this, vehic, health, bumblebee, RES_HEALTH);
178 
179  if(vehic.vehicle_flags & VHF_HASSHIELD)
180  VEHICLE_UPDATE_PLAYER(this, vehic, shield, bumblebee);
181 
182  ad = gettaginfo(gun, gettagindex(gun, "fire"));
183  traceline(ad, ad + v_forward * max_shot_distance, MOVE_NORMAL, gun);
184 
185  UpdateAuxiliaryXhair(this, trace_endpos, ('1 0 0' * this.vehicle_reload1) + ('0 1 0' *(1 - this.vehicle_reload1)), 0);
186 
187  if(vehic.owner)
188  UpdateAuxiliaryXhair(vehic.owner, trace_endpos, ('1 0 0' * this.vehicle_reload1) + ('0 1 0' *(1 - this.vehicle_reload1)), ((this == vehic.gunner1) ? 1 : 2));
189 
190  vehic.solid = SOLID_BBOX;
192  this.vehicle_energy = (gun.vehicle_energy / autocvar_g_vehicle_bumblebee_cannon_ammo) * 100;
193 }
194 
195 vector bumblebee_gunner_findgoodexit(vector prefer_spot, entity gunner, entity player)
196 {
197  //vector exitspot;
198  float mysize;
199 
200  tracebox(gunner.origin + '0 0 32', STAT(PL_MIN, player), STAT(PL_MAX, player), prefer_spot, MOVE_NORMAL, player);
202  return prefer_spot;
203 
204  mysize = 1.5 * vlen(STAT(PL_MAX, player) - STAT(PL_MIN, player)); // can't use gunner's size, as they don't have a size
205  float i;
206  vector v, v2;
207  v2 = 0.5 * (gunner.absmin + gunner.absmax);
208  for(i = 0; i < 100; ++i)
209  {
210  v = randomvec();
211  v_z = 0;
212  v = v2 + normalize(v) * mysize;
213  tracebox(v2, STAT(PL_MIN, player), STAT(PL_MAX, player), v, MOVE_NORMAL, player);
215  return v;
216  }
217 
218  return prefer_spot; // this should be considered a fallback?!
219 }
220 
221 void bumblebee_gunner_exit(entity this, int _exitflag)
222 {
223  entity player = ((this.owner.gun1 == this) ? this.owner.gunner1 : this.owner.gunner2);
224  entity gunner = this;
225  entity vehic = gunner.owner;
226 
227  if(IS_REAL_CLIENT(player))
228  {
229  msg_entity = player;
230  WriteByte(MSG_ONE, SVC_SETVIEWPORT);
231  WriteEntity(MSG_ONE, player);
232 
233  // NOTE: engine networked
234  WriteByte(MSG_ONE, SVC_SETVIEWANGLES);
235  WriteAngle(MSG_ONE, 0);
236  WriteAngle(MSG_ONE, vehic.angles.y);
237  WriteAngle(MSG_ONE, 0);
238  }
239 
240  CSQCVehicleSetup(player, HUD_NORMAL);
241  setsize(player, STAT(PL_MIN, player), STAT(PL_MAX, player));
242 
243  player.takedamage = DAMAGE_AIM;
244  player.solid = SOLID_SLIDEBOX;
245  set_movetype(player, MOVETYPE_WALK);
246  player.effects &= ~EF_NODRAW;
247  player.alpha = 1;
248  player.PlayerPhysplug = func_null;
249  player.view_ofs = STAT(PL_VIEW_OFS, player);
250  player.event_damage = PlayerDamage;
251  STAT(HUD, player) = HUD_NORMAL;
252  player.teleportable = TELEPORT_NORMAL;
253  for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
254  {
255  .entity weaponentity = weaponentities[slot];
256  player.(weaponentity).m_switchweapon = gunner.(weaponentity).m_switchweapon;
257  delete(gunner.(weaponentity));
258  }
259  player.vehicle_enter_delay = time + 2;
260 
261  fixedmakevectors(vehic.angles);
262 
263  if(player == vehic.gunner1) { vehic.gunner1 = NULL; }
264  if(player == vehic.gunner2) { vehic.gunner2 = NULL; v_right *= -1; }
265 
266  vector spot = real_origin(gunner);
267  spot = spot + v_up * 128 + v_forward * 300 + v_right * 150;
268  spot = bumblebee_gunner_findgoodexit(spot, gunner, player);
269 
270  // TODO: figure a way to move player out of the gunner
271 
272  player.velocity = 0.75 * vehic.velocity + normalize(spot - vehic.origin) * 200;
273  player.velocity_z += 10;
274 
275  gunner.phase = time + 5;
276  gunner.vehicle_hudmodel.viewmodelforclient = gunner;
277 
278  MUTATOR_CALLHOOK(VehicleExit, player, gunner);
279 
280  player.vehicle = NULL;
281 }
282 
283 bool bumblebee_gunner_enter(entity this, entity player)
284 {
285  entity vehic = this;
286  entity gunner = NULL;
287 
288  if(!vehic.gunner1 && !vehic.gunner2 && ((time >= vehic.gun1.phase) + (time >= vehic.gun2.phase)) == 2)
289  {
290  // we can have some fun
291  vector v1 = gettaginfo(vehic, gettagindex(vehic, "cannon_right"));
292  vector v2 = gettaginfo(vehic, gettagindex(vehic, "cannon_left"));
293  if(vlen2(player.origin - v1) < vlen2(player.origin - v2))
294  {
295  gunner = vehic.gun1;
296  vehic.gunner1 = player;
297  }
298  else
299  {
300  gunner = vehic.gun2;
301  vehic.gunner2 = player;
302  }
303  }
304  else if(!vehic.gunner1 && time >= vehic.gun1.phase) { gunner = vehic.gun1; vehic.gunner1 = player; }
305  else if(!vehic.gunner2 && time >= vehic.gun2.phase) { gunner = vehic.gun2; vehic.gunner2 = player; }
306  else { LOG_TRACE("Vehicle is full, fail"); return false; }
307 
308  player.vehicle = gunner;
309  player.angles = vehic.angles;
310  player.takedamage = DAMAGE_NO;
311  player.solid = SOLID_NOT;
312  player.alpha = -1;
313  set_movetype(player, MOVETYPE_NOCLIP);
314  player.event_damage = func_null;
315  player.view_ofs = '0 0 0';
316  STAT(HUD, player) = STAT(HUD, gunner);
317  player.teleportable = false;
318  player.PlayerPhysplug = gunner.PlayerPhysplug;
319  player.vehicle_ammo1 = vehic.vehicle_ammo1;
320  player.vehicle_ammo2 = vehic.vehicle_ammo2;
321  player.vehicle_reload1 = vehic.vehicle_reload1;
322  player.vehicle_reload2 = vehic.vehicle_reload2;
323  player.vehicle_energy = vehic.vehicle_energy;
324  UNSET_ONGROUND(player);
325 
326  RemoveGrapplingHooks(player);
327 
328  for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
329  {
330  .entity weaponentity = weaponentities[slot];
331 
332  gunner.(weaponentity) = new(temp_wepent);
333  gunner.(weaponentity).m_switchweapon = player.(weaponentity).m_switchweapon;
334  }
335  gunner.vehicle_exit = bumblebee_gunner_exit;
336  gunner.vehicle_hudmodel.viewmodelforclient = player;
337 
338  if(IS_REAL_CLIENT(player))
339  {
340  msg_entity = player;
341  WriteByte(MSG_ONE, SVC_SETVIEWPORT);
342  WriteEntity(MSG_ONE, gunner.vehicle_viewport);
343 
344  // NOTE: engine networked
345  WriteByte(MSG_ONE, SVC_SETVIEWANGLES);
346  WriteAngle(MSG_ONE, gunner.angles_x + vehic.angles_x); // tilt
347  WriteAngle(MSG_ONE, gunner.angles_y + vehic.angles_y); // yaw
348  WriteAngle(MSG_ONE, 0); // roll
349  }
350 
351  CSQCVehicleSetup(player, STAT(HUD, player));
352 
353  MUTATOR_CALLHOOK(VehicleEnter, player, gunner);
354 
355  return true;
356 }
357 
358 bool vehicles_valid_pilot(entity this, entity toucher)
359 {
360  if(IS_BOT_CLIENT(toucher) && !autocvar_g_vehicles_allow_bots)
361  return false;
362 
363  if((!IS_PLAYER(toucher))
364  || (IS_DEAD(toucher))
365  || (toucher.vehicle)
366  || (DIFF_TEAM(toucher, this))
367  ) { return false; }
368 
369  return true;
370 }
371 
372 void bumblebee_touch(entity this, entity toucher)
373 {
374  if(autocvar_g_vehicles_enter) { return; }
375 
376  if(this.gunner1 != NULL && this.gunner2 != NULL)
377  {
378  vehicles_touch(this, toucher);
379  return;
380  }
381 
382  if(vehicles_valid_pilot(this, toucher))
383  {
384  float phase_time = (time >= this.gun1.phase) + (time >= this.gun2.phase);
385 
386  if(time >= toucher.vehicle_enter_delay && phase_time)
387  if(bumblebee_gunner_enter(this, toucher))
388  return;
389  }
390 
391  vehicles_touch(this, toucher);
392 }
393 
394 void bumblebee_regen(entity this, float dt)
395 {
396  if(this.gun1.delay + autocvar_g_vehicle_bumblebee_cannon_ammo_regen_pause < time)
397  this.gun1.vehicle_energy = min(autocvar_g_vehicle_bumblebee_cannon_ammo,
398  this.gun1.vehicle_energy + autocvar_g_vehicle_bumblebee_cannon_ammo_regen * dt);
399 
400  if(this.gun2.delay + autocvar_g_vehicle_bumblebee_cannon_ammo_regen_pause < time)
401  this.gun2.vehicle_energy = min(autocvar_g_vehicle_bumblebee_cannon_ammo,
402  this.gun2.vehicle_energy + autocvar_g_vehicle_bumblebee_cannon_ammo_regen * dt);
403 
404  if(this.vehicle_flags & VHF_SHIELDREGEN)
405  vehicles_regen(this, this.dmg_time, vehicle_shield, autocvar_g_vehicle_bumblebee_shield, autocvar_g_vehicle_bumblebee_shield_regen_pause, autocvar_g_vehicle_bumblebee_shield_regen, dt, true);
406 
407  if(this.vehicle_flags & VHF_HEALTHREGEN)
408  vehicles_regen_resource(this, this.dmg_time, vehicle_health, autocvar_g_vehicle_bumblebee_health, autocvar_g_vehicle_bumblebee_health_regen_pause, autocvar_g_vehicle_bumblebee_health_regen, dt, false, RES_HEALTH);
409 
410  if(this.vehicle_flags & VHF_ENERGYREGEN)
411  vehicles_regen(this, this.wait, vehicle_energy, autocvar_g_vehicle_bumblebee_energy, autocvar_g_vehicle_bumblebee_energy_regen_pause, autocvar_g_vehicle_bumblebee_energy_regen, dt, false);
412 
413 }
414 
415 bool bumblebee_pilot_frame(entity this, float dt)
416 {
417  entity vehic = this.vehicle;
418  return = true;
419 
420  if(game_stopped)
421  {
422  vehic.solid = SOLID_NOT;
423  vehic.takedamage = DAMAGE_NO;
424  set_movetype(vehic, MOVETYPE_NONE);
425  return;
426  }
427 
428  vehicles_frame(vehic, this);
429 
430  if(IS_DEAD(vehic))
431  {
432  PHYS_INPUT_BUTTON_ATCK(this) = PHYS_INPUT_BUTTON_ATCK2(this) = false;
433  return;
434  }
435 
436  bumblebee_regen(vehic, dt);
437 
438  crosshair_trace(this);
439 
440  vector vang = vehic.angles;
441  vector newvel = vectoangles(normalize(trace_endpos - vehic.origin + '0 0 32'));
442  vang.x *= -1;
443  newvel.x *= -1;
444  if(newvel.x > 180) newvel.x -= 360;
445  if(newvel.x < -180) newvel.x += 360;
446  if(newvel.y > 180) newvel.y -= 360;
447  if(newvel.y < -180) newvel.y += 360;
448 
449  float ftmp = shortangle_f(this.v_angle.y - vang.y, vang.y);
450  if(ftmp > 180) ftmp -= 360;
451  if(ftmp < -180) ftmp += 360;
452  vehic.avelocity_y = bound(-autocvar_g_vehicle_bumblebee_turnspeed, ftmp + vehic.avelocity.y * 0.9, autocvar_g_vehicle_bumblebee_turnspeed);
453 
454  // Pitch
455  ftmp = 0;
456  if(CS(this).movement.x > 0 && vang.x < autocvar_g_vehicle_bumblebee_pitchlimit)
457  ftmp = 4;
458  else if(CS(this).movement.x < 0 && vang.x > -autocvar_g_vehicle_bumblebee_pitchlimit)
459  ftmp = -8;
460 
461  newvel.x = bound(-autocvar_g_vehicle_bumblebee_pitchlimit, newvel.x , autocvar_g_vehicle_bumblebee_pitchlimit);
462  ftmp = vang.x - bound(-autocvar_g_vehicle_bumblebee_pitchlimit, newvel.x + ftmp, autocvar_g_vehicle_bumblebee_pitchlimit);
463  vehic.avelocity_x = bound(-autocvar_g_vehicle_bumblebee_pitchspeed, ftmp + vehic.avelocity.x * 0.9, autocvar_g_vehicle_bumblebee_pitchspeed);
464 
465  vehic.angles_x = anglemods(vehic.angles.x);
466  vehic.angles_y = anglemods(vehic.angles.y);
467  vehic.angles_z = anglemods(vehic.angles.z);
468 
469  makevectors('0 1 0' * vehic.angles.y);
470  newvel = vehic.velocity * -autocvar_g_vehicle_bumblebee_friction;
471 
472  if(CS(this).movement.x != 0)
473  {
474  if(CS(this).movement.x > 0)
475  newvel += v_forward * autocvar_g_vehicle_bumblebee_speed_forward;
476  else if(CS(this).movement.x < 0)
477  newvel -= v_forward * autocvar_g_vehicle_bumblebee_speed_forward;
478  }
479 
480  if(CS(this).movement.y != 0)
481  {
482  if(CS(this).movement.y < 0)
483  newvel -= v_right * autocvar_g_vehicle_bumblebee_speed_strafe;
484  else if(CS(this).movement.y > 0)
485  newvel += v_right * autocvar_g_vehicle_bumblebee_speed_strafe;
486  ftmp = newvel * v_right;
487  ftmp *= dt * 0.1;
488  vehic.angles_z = bound(-15, vehic.angles.z + ftmp, 15);
489  }
490  else
491  {
492  vehic.angles_z *= 0.95;
493  if(vehic.angles.z >= -1 && vehic.angles.z <= -1)
494  vehic.angles_z = 0;
495  }
496 
497  if(PHYS_INPUT_BUTTON_CROUCH(this))
498  newvel -= v_up * autocvar_g_vehicle_bumblebee_speed_down;
499  else if(PHYS_INPUT_BUTTON_JUMP(this))
500  newvel += v_up * autocvar_g_vehicle_bumblebee_speed_up;
501 
502  vehic.velocity += newvel * dt;
503  this.velocity = CS(this).movement = vehic.velocity;
504 
505 
506  if(autocvar_g_vehicle_bumblebee_healgun_locktime)
507  {
508  if(vehic.tur_head.lock_time < time || IS_DEAD(vehic.tur_head.enemy) || STAT(FROZEN, vehic.tur_head.enemy))
509  vehic.tur_head.enemy = NULL;
510 
511  if(trace_ent)
512  if(trace_ent.move_movetype)
513  if(trace_ent.takedamage)
514  if(!IS_DEAD(trace_ent) && !STAT(FROZEN, trace_ent))
515  {
516  if(teamplay)
517  {
518  if(trace_ent.team == this.team)
519  {
520  vehic.tur_head.enemy = trace_ent;
521  vehic.tur_head.lock_time = time + autocvar_g_vehicle_bumblebee_healgun_locktime;
522  }
523  }
524  else
525  {
526  vehic.tur_head.enemy = trace_ent;
527  vehic.tur_head.lock_time = time + autocvar_g_vehicle_bumblebee_healgun_locktime;
528  }
529  }
530 
531  if(vehic.tur_head.enemy)
532  {
533  trace_endpos = real_origin(vehic.tur_head.enemy);
534  UpdateAuxiliaryXhair(this, trace_endpos, '0 0.75 0', 0);
535  }
536  }
537 
538  vang = vehicle_aimturret(vehic, trace_endpos, vehic.gun3, "fire",
539  autocvar_g_vehicle_bumblebee_raygun_pitchlimit_down * -1, autocvar_g_vehicle_bumblebee_raygun_pitchlimit_up,
540  autocvar_g_vehicle_bumblebee_raygun_turnlimit_sides * -1, autocvar_g_vehicle_bumblebee_raygun_turnlimit_sides, autocvar_g_vehicle_bumblebee_raygun_turnspeed, dt);
541 
542  if(!weaponLocked(this) && !weaponUseForbidden(this))
543  if((PHYS_INPUT_BUTTON_ATCK(this) || PHYS_INPUT_BUTTON_ATCK2(this)) && (vehic.vehicle_energy > autocvar_g_vehicle_bumblebee_raygun_dps * PHYS_INPUT_FRAMETIME || autocvar_g_vehicle_bumblebee_raygun == 0))
544  {
545  vehic.gun3.enemy.realowner = this;
546  vehic.gun3.enemy.effects &= ~EF_NODRAW;
547 
548  vehic.gun3.enemy.hook_start = gettaginfo(vehic.gun3, gettagindex(vehic.gun3, "fire"));
549  vehic.gun3.enemy.SendFlags |= BRG_START;
550 
551  traceline(vehic.gun3.enemy.hook_start, vehic.gun3.enemy.hook_start + v_forward * autocvar_g_vehicle_bumblebee_raygun_range, MOVE_NORMAL, vehic);
552 
553  if(trace_ent)
554  {
555  if(autocvar_g_vehicle_bumblebee_raygun)
556  {
557  Damage(trace_ent, vehic, this, autocvar_g_vehicle_bumblebee_raygun_dps * PHYS_INPUT_FRAMETIME, DEATH_GENERIC.m_id, DMG_NOWEP, trace_endpos, v_forward * autocvar_g_vehicle_bumblebee_raygun_fps * PHYS_INPUT_FRAMETIME);
558  vehic.vehicle_energy -= autocvar_g_vehicle_bumblebee_raygun_aps * PHYS_INPUT_FRAMETIME;
559  }
560  else
561  {
562  if(!IS_DEAD(trace_ent))
563  {
564  if((teamplay && trace_ent.team == this.team) || !teamplay)
565  {
566  if(autocvar_g_vehicle_bumblebee_healgun_hps)
567  {
568  float hplimit = ((IS_PLAYER(trace_ent)) ? autocvar_g_vehicle_bumblebee_healgun_hmax : RES_LIMIT_NONE);
569  Heal(trace_ent, this, autocvar_g_vehicle_bumblebee_healgun_hps * dt, hplimit);
570  }
571 
572  if(IS_VEHICLE(trace_ent))
573  {
574  if(autocvar_g_vehicle_bumblebee_healgun_sps && GetResource(trace_ent, RES_HEALTH) <= trace_ent.max_health)
575  trace_ent.vehicle_shield = min(trace_ent.vehicle_shield + autocvar_g_vehicle_bumblebee_healgun_sps * dt, trace_ent.tur_head.max_health);
576  }
577  else if(IS_CLIENT(trace_ent))
578  {
579  float maxarmor = ((MUTATOR_IS_ENABLED(mutator_instagib)) ? autocvar_g_instagib_extralives : autocvar_g_vehicle_bumblebee_healgun_amax);
580  if(GetResource(trace_ent, RES_ARMOR) <= maxarmor && autocvar_g_vehicle_bumblebee_healgun_aps)
581  GiveResourceWithLimit(trace_ent, RES_ARMOR, autocvar_g_vehicle_bumblebee_healgun_aps * dt, maxarmor);
582  }
583  }
584  }
585  }
586  }
587 
588  vehic.gun3.enemy.hook_end = trace_endpos;
589  setorigin(vehic.gun3.enemy, trace_endpos);
590  vehic.gun3.enemy.SendFlags |= BRG_END;
591 
592  vehic.wait = time + 1;
593  }
594  else
595  vehic.gun3.enemy.effects |= EF_NODRAW;
596  /*{
597  if(vehic.gun3.enemy)
598  remove(vehic.gun3.enemy);
599 
600  vehic.gun3.enemy = NULL;
601  }
602  */
603 
604  VEHICLE_UPDATE_PLAYER_RESOURCE(this, vehic, health, bumblebee, RES_HEALTH);
605  VEHICLE_UPDATE_PLAYER(this, vehic, energy, bumblebee);
606 
607  this.vehicle_ammo1 = (vehic.gun1.vehicle_energy / autocvar_g_vehicle_bumblebee_cannon_ammo) * 100;
608  this.vehicle_ammo2 = (vehic.gun2.vehicle_energy / autocvar_g_vehicle_bumblebee_cannon_ammo) * 100;
609 
610  if(vehic.vehicle_flags & VHF_HASSHIELD)
611  VEHICLE_UPDATE_PLAYER(this, vehic, shield, bumblebee);
612 
613  vehic.angles_x *= -1;
614  makevectors(vehic.angles);
615  vehic.angles_x *= -1;
616  setorigin(this, vehic.origin + v_up * 48 + v_forward * 160);
617  this.oldorigin = this.origin; // negate fall damage
618 
620 }
621 
622 void bumblebee_land(entity this)
623 {
624  float hgt;
625 
626  hgt = vehicle_altitude(this, 512);
627  this.velocity = (this.velocity * 0.9) + ('0 0 -1800' * (hgt / 256) * PHYS_INPUT_FRAMETIME);
628  this.angles_x *= 0.95;
629  this.angles_z *= 0.95;
630 
631  if(hgt < 16)
632  setthink(this, vehicles_think);
633 
634  this.nextthink = time;
635 
636  CSQCMODEL_AUTOUPDATE(this);
637 }
638 
639 void bumblebee_exit(entity this, int eject)
640 {
641  if(this.owner.vehicleid == VEH_BUMBLEBEE.vehicleid)
642  {
643  bumblebee_gunner_exit(this, eject);
644  return;
645  }
646 
647  settouch(this, vehicles_touch);
648 
649  if(!IS_DEAD(this))
650  {
651  setthink(this, bumblebee_land);
652  this.nextthink = time;
653  }
654 
656 
657  if(!this.owner)
658  return;
659 
660  fixedmakevectors(this.angles);
661  vector spot;
662  if(vdist(this.velocity, >, autocvar_g_vehicle_bumblebee_speed_forward * 0.5))
663  spot = this.origin + v_up * 128 + v_forward * 300;
664  else
665  spot = this.origin + v_up * 128 - v_forward * 300;
666 
667  spot = vehicles_findgoodexit(this, this.owner, spot);
668 
669  // Hide beam
670  if(this.gun3.enemy || !wasfreed(this.gun3.enemy))
671  this.gun3.enemy.effects |= EF_NODRAW;
672 
673  this.owner.velocity = 0.75 * this.vehicle.velocity + normalize(spot - this.vehicle.origin) * 200;
674  this.owner.velocity_z += 10;
675  setorigin(this.owner, spot);
676 
677  antilag_clear(this.owner, CS(this.owner));
678  this.owner = NULL;
679 }
680 
681 void bumblebee_blowup(entity this)
682 {
683  RadiusDamage(this, this.enemy, autocvar_g_vehicle_bumblebee_blowup_coredamage,
684  autocvar_g_vehicle_bumblebee_blowup_edgedamage,
685  autocvar_g_vehicle_bumblebee_blowup_radius, this, NULL,
686  autocvar_g_vehicle_bumblebee_blowup_forceintensity,
687  DEATH_VH_BUMB_DEATH.m_id, DMG_NOWEP, NULL);
688 
689  sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
690  Send_Effect(EFFECT_EXPLOSION_BIG, (this.origin + '0 0 100') + (randomvec() * 80), '0 0 0', 1);
691 
692  if(this.owner.deadflag == DEAD_DYING)
693  this.owner.deadflag = DEAD_DEAD;
694 
695  delete(this);
696 }
697 
698 void bumblebee_dead_touch(entity this, entity toucher)
699 {
700  bumblebee_blowup(this);
701 }
702 
703 void bumblebee_diethink(entity this)
704 {
705  if(time >= this.wait)
706  setthink(this, bumblebee_blowup);
707 
708  if(random() < 0.1)
709  {
710  sound(this, CH_SHOTS, SND_ROCKET_IMPACT, VOL_BASE, ATTEN_NORM);
711  Send_Effect(EFFECT_EXPLOSION_SMALL, randomvec() * 80 + (this.origin + '0 0 100'), '0 0 0', 1);
712  }
713 
714  this.nextthink = time + 0.1;
715 }
716 
717 spawnfunc(vehicle_bumblebee)
718 {
719  if(!autocvar_g_vehicle_bumblebee) { delete(this); return; }
720  if(!vehicle_initialize(this, VEH_BUMBLEBEE, false)) { delete(this); return; }
721 }
722 
723 METHOD(Bumblebee, vr_impact, void(Bumblebee thisveh, entity instance))
724 {
725  if(autocvar_g_vehicle_bumblebee_bouncepain)
726  vehicles_impact(instance, autocvar_g_vehicle_bumblebee_bouncepain_x, autocvar_g_vehicle_bumblebee_bouncepain_y, autocvar_g_vehicle_bumblebee_bouncepain_z);
727 }
728 METHOD(Bumblebee, vr_enter, void(Bumblebee thisveh, entity instance))
729 {
730  settouch(instance, bumblebee_touch);
731  instance.nextthink = 0;
733 }
734 METHOD(Bumblebee, vr_gunner_enter, void(Bumblebee thisveh, entity instance, entity actor))
735 {
736  if(!instance.gunner1)
737  if(time >= instance.gun1.phase)
738  if(instance.gun1.vehicle_enter)
739  if(instance.gun1.vehicle_enter(instance, actor))
740  return;
741 
742  if(!instance.gunner2)
743  if(time >= instance.gun2.phase)
744  if(instance.gun2.vehicle_enter)
745  if(instance.gun2.vehicle_enter(instance, actor))
746  return;
747 }
748 METHOD(Bumblebee, vr_think, void(Bumblebee thisveh, entity instance))
749 {
750  instance.angles_z *= 0.8;
751  instance.angles_x *= 0.8;
752 
753  instance.nextthink = time;
754 
755  if(!instance.owner)
756  {
757  if(instance.gunner1)
758  {
759  entity e = instance.gunner1;
760  instance.gun1.vehicle_exit(instance.gun1, VHEF_EJECT);
761  instance.phase = 0;
762  gettouch(instance)(instance, e);
763  return;
764  }
765 
766  if(instance.gunner2)
767  {
768  entity e = instance.gunner2;
769  instance.gun2.vehicle_exit(instance.gun2, VHEF_EJECT);
770  instance.phase = 0;
771  gettouch(instance)(instance, e);
772  return;
773  }
774  }
775 }
776 METHOD(Bumblebee, vr_death, void(Bumblebee thisveh, entity instance))
777 {
778  CSQCModel_UnlinkEntity(instance);
779 
780  // hide beam
781  if(instance.gun3.enemy || !wasfreed(instance.gun3.enemy))
782  instance.gun3.enemy.effects |= EF_NODRAW;
783 
784  if(instance.gunner1)
785  instance.gun1.vehicle_exit(instance.gun1, VHEF_EJECT);
786 
787  if(instance.gunner2)
788  instance.gun2.vehicle_exit(instance.gun2, VHEF_EJECT);
789 
790  instance.vehicle_exit(instance, VHEF_EJECT);
791 
792  fixedmakevectors(instance.angles);
793  vehicle_tossgib(instance, instance.gun1, instance.velocity + v_right * 300 + v_up * 100 + randomvec() * 200, "cannon_right", rint(random()), rint(random()), 6, randomvec() * 200);
794  vehicle_tossgib(instance, instance.gun2, instance.velocity + v_right * -300 + v_up * 100 + randomvec() * 200, "cannon_left", rint(random()), rint(random()), 6, randomvec() * 200);
795  vehicle_tossgib(instance, instance.gun3, instance.velocity + v_forward * 300 + v_up * -100 + randomvec() * 200, "raygun", rint(random()), rint(random()), 6, randomvec() * 300);
796 
797  entity _body = vehicle_tossgib(instance, instance, instance.velocity + randomvec() * 200, "", rint(random()), rint(random()), 6, randomvec() * 100);
798 
799  if(random() > 0.5)
800  settouch(_body, bumblebee_dead_touch);
801  else
802  settouch(_body, func_null);
803 
804  setthink(_body, bumblebee_diethink);
805  _body.nextthink = time;
806  _body.wait = time + 2 + (random() * 8);
807  _body.owner = instance;
808  _body.enemy = instance.enemy;
809  _body.scale = 1.5;
810  _body.angles = instance.angles;
811 
812  Send_Effect(EFFECT_EXPLOSION_MEDIUM, findbetterlocation(instance.origin, 16), '0 0 0', 1);
813 
814  SetResourceExplicit(instance, RES_HEALTH, 0);
815  instance.event_damage = func_null;
816  instance.solid = SOLID_NOT;
817  instance.takedamage = DAMAGE_NO;
818  instance.deadflag = DEAD_DYING;
819  set_movetype(instance, MOVETYPE_NONE);
820  instance.effects = EF_NODRAW;
821  instance.colormod = '0 0 0';
822  instance.avelocity = '0 0 0';
823  instance.velocity = '0 0 0';
824  settouch(instance, func_null);
825  instance.nextthink = 0;
826 
827  setorigin(instance, instance.pos1);
828 }
829 METHOD(Bumblebee, vr_spawn, void(Bumblebee thisveh, entity instance))
830 {
831  if(!instance.gun1)
832  {
833  // for some reason, autosizing of the shield entity refuses to work for this one so set it up in advance.
834  instance.vehicle_shieldent = new(vehicle_shieldent);
835  instance.vehicle_shieldent.effects = EF_LOWPRECISION;
836  setmodel(instance.vehicle_shieldent, MDL_VEH_BUMBLEBEE_SHIELD);
837  setattachment(instance.vehicle_shieldent, instance, "");
838  setorigin(instance.vehicle_shieldent, real_origin(instance) - instance.origin);
839  instance.vehicle_shieldent.scale = 512 / vlen(instance.maxs - instance.mins);
840  setthink(instance.vehicle_shieldent, shieldhit_think);
841  instance.vehicle_shieldent.alpha = -1;
842  instance.vehicle_shieldent.effects = EF_LOWPRECISION | EF_NODRAW;
843 
844  instance.gun1 = new(vehicle_playerslot);
845  instance.gun2 = new(vehicle_playerslot);
846  instance.gun3 = new(bumblebee_raygun);
847 
848  instance.vehicle_flags |= VHF_MULTISLOT;
849 
850  instance.gun1.owner = instance;
851  instance.gun2.owner = instance;
852  instance.gun3.owner = instance;
853 
854  setmodel(instance.gun1, MDL_VEH_BUMBLEBEE_CANNON_RIGHT);
855  setmodel(instance.gun2, MDL_VEH_BUMBLEBEE_CANNON_LEFT);
856  setmodel(instance.gun3, MDL_VEH_BUMBLEBEE_CANNON_CENTER);
857 
858  setattachment(instance.gun1, instance, "cannon_right");
859  setattachment(instance.gun2, instance, "cannon_left");
860 
861  // Angled bones are no fun, messes up gun-aim; so work arround it.
862  instance.gun3.pos1 = instance.angles;
863  instance.angles = '0 0 0';
864  vector ofs = gettaginfo(instance, gettagindex(instance, "raygun"));
865  ofs -= instance.origin;
866  setattachment(instance.gun3, instance, "");
867  setorigin(instance.gun3, ofs);
868  instance.angles = instance.gun3.pos1;
869 
870  vehicle_addplayerslot(instance, instance.gun1, HUD_BUMBLEBEE_GUN, MDL_VEH_BUMBLEBEE_GUNCOCKPIT, bumblebee_gunner_frame, bumblebee_gunner_exit, bumblebee_gunner_enter);
871  vehicle_addplayerslot(instance, instance.gun2, HUD_BUMBLEBEE_GUN, MDL_VEH_BUMBLEBEE_GUNCOCKPIT, bumblebee_gunner_frame, bumblebee_gunner_exit, bumblebee_gunner_enter);
872 
873  setorigin(instance.vehicle_hudmodel, '50 0 -5'); // Move cockpit forward - down.
874  setorigin(instance.vehicle_viewport, '5 0 2'); // Move camera forward up
875 
876  //fixme-model-bones
877  setorigin(instance.gun1.vehicle_hudmodel, '90 -27 -23');
878  setorigin(instance.gun1.vehicle_viewport, '-85 0 50');
879  //fixme-model-bones
880  setorigin(instance.gun2.vehicle_hudmodel, '90 27 -23');
881  setorigin(instance.gun2.vehicle_viewport, '-85 0 50');
882 
883  instance.scale = 1.5;
884 
885  // Raygun beam
886  if(instance.gun3.enemy == NULL)
887  {
888  instance.gun3.enemy = new(bumble_raygun);
889  Net_LinkEntity(instance.gun3.enemy, true, 0, bumble_raygun_send);
890  instance.gun3.enemy.SendFlags = BRG_SETUP;
891  instance.gun3.enemy.cnt = autocvar_g_vehicle_bumblebee_raygun;
892  instance.gun3.enemy.effects = EF_NODRAW | EF_LOWPRECISION;
893  }
894  }
895 
896  if(!autocvar_g_vehicle_bumblebee_swim)
897  instance.dphitcontentsmask |= DPCONTENTS_LIQUIDSMASK;
898 
899  SetResourceExplicit(instance, RES_HEALTH, autocvar_g_vehicle_bumblebee_health);
900  instance.vehicle_shield = autocvar_g_vehicle_bumblebee_shield;
901  instance.solid = SOLID_BBOX;
902  set_movetype(instance, MOVETYPE_TOSS);
903  instance.damageforcescale = 0.025;
904 
905  instance.PlayerPhysplug = bumblebee_pilot_frame;
906 
907  setorigin(instance, instance.origin + '0 0 25');
908 }
909 METHOD(Bumblebee, vr_setup, void(Bumblebee thisveh, entity instance))
910 {
911  if(autocvar_g_vehicle_bumblebee_energy)
912  if(autocvar_g_vehicle_bumblebee_energy_regen)
913  instance.vehicle_flags |= VHF_ENERGYREGEN;
914 
915  if(autocvar_g_vehicle_bumblebee_shield)
916  instance.vehicle_flags |= VHF_HASSHIELD;
917 
918  if(autocvar_g_vehicle_bumblebee_shield_regen)
919  instance.vehicle_flags |= VHF_SHIELDREGEN;
920 
921  if(autocvar_g_vehicle_bumblebee_health_regen)
922  instance.vehicle_flags |= VHF_HEALTHREGEN;
923 
924  instance.vehicle_exit = bumblebee_exit;
925  instance.respawntime = autocvar_g_vehicle_bumblebee_respawntime;
926  SetResourceExplicit(instance, RES_HEALTH, autocvar_g_vehicle_bumblebee_health);
927  instance.max_health = GetResource(instance, RES_HEALTH);
928  instance.vehicle_shield = autocvar_g_vehicle_bumblebee_shield;
929 }
930 
931 #endif // SVQC
932 #ifdef CSQC
933 
934 void CSQC_BUMBLE_GUN_HUD()
935 {
936  Vehicles_drawHUD("vehicle_gunner", "vehicle_gunner_weapon1", string_null,
937  "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
938  string_null, '0 0 0');
939 }
940 
941 METHOD(Bumblebee, vr_hud, void(Bumblebee thisveh))
942 {
943  Vehicles_drawHUD(VEH_BUMBLEBEE.m_icon, "vehicle_bumble_weapon1", "vehicle_bumble_weapon2",
944  "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color,
945  "vehicle_icon_ammo1", autocvar_hud_progressbar_vehicles_ammo1_color);
946 
947  float hudAlpha = autocvar_hud_panel_fg_alpha;
948  float blinkValue = 0.55 + sin(time * 7) * 0.45;
949  vector tmpPos = '0 0 0';
950  vector tmpSize = hud_fontsize;
951  tmpPos.x = vehicleHud_Pos.x + vehicleHud_Size.x * (520/768);
952 
953  if(!AuxiliaryXhair[1].draw2d)
954  {
955  tmpPos.y = vehicleHud_Pos.y + vehicleHud_Size.y * (96/256) - tmpSize.y;
956  drawstring(tmpPos, _("No right gunner!"), tmpSize, '1 1 1', hudAlpha * blinkValue, DRAWFLAG_NORMAL);
957  }
958 
959  if(!AuxiliaryXhair[2].draw2d)
960  {
961  tmpPos.y = vehicleHud_Pos.y + vehicleHud_Size.y * (160/256);
962  drawstring(tmpPos, _("No left gunner!"), tmpSize, '1 1 1', hudAlpha * blinkValue, DRAWFLAG_NORMAL);
963  }
964 }
965 METHOD(Bumblebee, vr_crosshair, void(Bumblebee thisveh, entity player))
966 {
968 }
969 METHOD(Bumblebee, vr_setup, void(Bumblebee thisveh, entity instance))
970 {
971  AuxiliaryXhair[0].axh_image = vCROSS_LOCK; // Raygun-locked
972  AuxiliaryXhair[1].axh_image = vCROSS_BURST; // Gunner1
973  AuxiliaryXhair[2].axh_image = vCROSS_BURST; // Gunner2
974 }
975 
976 #endif
977 
978 #endif
const float SOLID_NOT
Definition: csprogsdefs.qc:244
#define PHYS_INPUT_BUTTON_ATCK2(s)
Definition: player.qh:148
float DEAD_DYING
Definition: progsdefs.qc:275
const string vCROSS_BURST
Definition: cl_vehicles.qh:13
#define PHYS_INPUT_BUTTON_JUMP(s)
Definition: player.qh:147
float MOVETYPE_NONE
Definition: progsdefs.qc:246
#define PHYS_INPUT_BUTTON_CROUCH(s)
Definition: player.qh:150
const float SOLID_SLIDEBOX
Definition: csprogsdefs.qc:247
float MOVETYPE_WALK
Definition: progsdefs.qc:249
const int VHF_HASSHIELD
Indicates vehicle.
Definition: vehicle.qh:64
string string_null
Definition: nil.qh:9
void vehicles_regen_resource(entity this, float timer,.float regen_field, float field_max, float rpause, float regen, float delta_time, float _healthscale, Resource resource)
Definition: sv_vehicles.qc:572
void shieldhit_think(entity this)
Definition: sv_vehicles.qc:589
ERASEABLE float anglemods(float v)
Definition: angle.qc:13
bool SetResourceExplicit(entity e, Resource res_type, float amount)
Sets the resource amount of an entity without calling any hooks.
Definition: cl_resources.qc:15
void Vehicles_drawCrosshair(string crosshair)
Definition: cl_vehicles.qc:299
bool weaponUseForbidden(entity player)
#define IS_CLIENT(v)
Definition: utils.qh:13
const int TELEPORT_NORMAL
Definition: teleporters.qh:26
float autocvar_hud_panel_fg_alpha
Definition: hud.qh:199
float MOVETYPE_TOSS
Definition: progsdefs.qc:252
vector oldorigin
Definition: csprogsdefs.qc:102
entity() spawn
float DAMAGE_AIM
Definition: progsdefs.qc:284
void PlayerDamage(entity this, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
Definition: player.qc:229
const float MOVE_NORMAL
Definition: csprogsdefs.qc:252
ClientState CS(Client this)
Definition: state.qh:47
float MOVETYPE_BOUNCEMISSILE
Definition: progsdefs.qc:257
void Vehicles_drawHUD(string vehicle, string vehicleWeapon1, string vehicleWeapon2, string iconAmmo1, vector colorAmmo1, string iconAmmo2, vector colorAmmo2)
Definition: cl_vehicles.qc:123
vector v_angle
Definition: progsdefs.qc:161
void vehicles_regen(entity this, float timer,.float regen_field, float field_max, float rpause, float regen, float delta_time, float _healthscale)
Definition: sv_vehicles.qc:557
spawnfunc(info_player_attacker)
Definition: sv_assault.qc:283
origin
Definition: ent_cs.qc:114
void antilag_clear(entity e, entity store)
Definition: antilag.qc:114
#define gettaginfo
Definition: post.qh:32
#define METHOD(cname, name, prototype)
Definition: oo.qh:257
#define DIFF_TEAM(a, b)
Definition: teams.qh:240
#define UNSET_ONGROUND(s)
Definition: movetypes.qh:18
#define DMG_NOWEP
Definition: damage.qh:126
entity owner
Definition: main.qh:73
entity vehicle_tossgib(entity this, entity _template, vector _vel, string _tag, bool _burn, bool _explode, float _maxtime, vector _rot)
Definition: sv_vehicles.qc:298
#define gettagindex
Definition: dpextensions.qh:16
float DEAD_DEAD
Definition: progsdefs.qc:276
void crosshair_trace(entity pl)
Definition: tracing.qc:508
#define IS_REAL_CLIENT(v)
Definition: utils.qh:17
entity trace_ent
Definition: csprogsdefs.qc:40
#define setmodel(this, m)
Definition: model.qh:26
void vehicles_impact(entity this, float _minspeed, float _speedfac, float _maxpain)
Definition: sv_vehicles.qc:746
#define MUTATOR_IS_ENABLED(this)
Definition: base.qh:176
RES_HEALTH
Definition: ent_cs.qc:126
const float EF_NODRAW
Definition: csprogsdefs.qc:305
bool weaponLocked(entity player)
entity enemy
Definition: sv_ctf.qh:143
entity msg_entity
Definition: progsdefs.qc:63
#define vlen2(v)
Definition: vector.qh:4
const int VHF_SHIELDREGEN
Vehicle has shileding.
Definition: vehicle.qh:65
entity AuxiliaryXhair[MAX_AXH]
Definition: cl_vehicles.qh:24
void GiveResourceWithLimit(entity receiver, Resource res_type, float amount, float limit)
Gives an entity some resource but not more than a limit.
bool vehicle_addplayerslot(entity _owner, entity _slot, int _hud, Model _hud_model, bool(entity, float) _framefunc, void(entity, bool) _exitfunc, float(entity, entity) _enterfunc)
Definition: sv_vehicles.qc:330
vector v_up
Definition: csprogsdefs.qc:31
const int MAX_WEAPONSLOTS
Definition: weapon.qh:13
const int RES_LIMIT_NONE
Definition: resources.qh:46
void CSQCVehicleSetup(entity own, int vehicle_id)
Definition: sv_vehicles.qc:80
float wait
Definition: subs.qh:39
vector vehicle_aimturret(entity _vehic, vector _target, entity _turrret, string _tagname, float _pichlimit_min, float _pichlimit_max, float _rotlimit_min, float _rotlimit_max, float _aimspeed, float dt)
Definition: sv_vehicles.qc:359
#define NULL
Definition: post.qh:17
void vehicles_think(entity this)
const float DRAWFLAG_NORMAL
Definition: csprogsdefs.qc:317
ERASEABLE float shortangle_f(float ang1, float ang2)
Definition: angle.qc:29
const float VOL_BASE
Definition: sound.qh:36
const string vCROSS_LOCK
Definition: cl_vehicles.qh:18
vector trace_endpos
Definition: csprogsdefs.qc:37
#define PHYS_INPUT_BUTTON_ATCK(s)
Definition: player.qh:146
vector vehicleHud_Size
Definition: cl_vehicles.qh:33
void Damage(entity targ, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
Definition: damage.qc:583
bool Heal(entity targ, entity inflictor, float amount, float limit)
Definition: damage.qc:1063
float teamplay
Definition: progsdefs.qc:31
void vehicles_frame(entity this, entity actor)
Definition: sv_vehicles.qc:628
#define IS_DEAD(s)
Definition: utils.qh:26
const float ATTEN_NORM
Definition: sound.qh:30
vector autocvar_hud_progressbar_vehicles_ammo1_color
Definition: cl_vehicles.qh:10
float nextthink
Definition: csprogsdefs.qc:121
const int CH_SHOTS
Definition: sound.qh:14
void RemoveGrapplingHooks(entity pl)
Definition: hook.qc:78
vector movement
vector(float skel, float bonenum) _skel_get_boneabs_hidden
#define IS_VEHICLE(v)
Definition: utils.qh:22
vector vehicleHud_Pos
Definition: cl_vehicles.qh:34
float MOVETYPE_NOCLIP
Definition: progsdefs.qc:254
vector v
Definition: ent_cs.qc:116
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
Definition: cl_resources.qc:10
const int VHF_MULTISLOT
Add random head angles each frame if health < 50%.
Definition: vehicle.qh:75
const int VHF_HEALTHREGEN
Vehicles shield regenerates.
Definition: vehicle.qh:66
#define vdist(v, cmp, f)
Vector distance comparison, avoids sqrt()
Definition: vector.qh:8
#define LOG_TRACE(...)
Definition: log.qh:81
const int VHF_ENERGYREGEN
Vehicles health regenerates.
Definition: vehicle.qh:67
int autocvar_g_instagib_extralives
Definition: sv_instagib.qh:28
float health
Definition: progsdefs.qc:137
float RadiusDamage(entity inflictor, entity attacker, float coredamage, float edgedamage, float rad, entity cantbe, entity mustbe, float forceintensity, int deathtype,.entity weaponentity, entity directhitentity)
Definition: damage.qc:1057
vector v_right
Definition: csprogsdefs.qc:31
void CSQCModel_UnlinkEntity(entity e)
Definition: sv_model.qc:129
#define MUTATOR_CALLHOOK(id,...)
Definition: base.qh:140
const float SOLID_BBOX
Definition: csprogsdefs.qc:246
#define IS_BOT_CLIENT(v)
want: (IS_CLIENT(v) && !IS_REAL_CLIENT(v))
Definition: utils.qh:15
entity weaponentities[MAX_WEAPONSLOTS]
Definition: weapon.qh:14
setorigin(ent, v)
vector hud_fontsize
Definition: main.qh:63
#define setthink(e, f)
void UpdateAuxiliaryXhair(entity own, vector loc, vector clr, int axh_id)
Definition: sv_vehicles.qc:47
vector angles
Definition: csprogsdefs.qc:104
float DPCONTENTS_LIQUIDSMASK
float trace_startsolid
Definition: csprogsdefs.qc:35
#define sound(e, c, s, v, a)
Definition: sound.qh:52
entity vehicle
Definition: impulse.qc:21
float trace_allsolid
Definition: csprogsdefs.qc:34
float time
Definition: csprogsdefs.qc:16
vector velocity
Definition: csprogsdefs.qc:103
const string vCROSS_HEAL
Definition: cl_vehicles.qh:16
#define makevectors
Definition: post.qh:21
float trace_fraction
Definition: csprogsdefs.qc:36
float DAMAGE_NO
Definition: progsdefs.qc:282
#define fixedmakevectors
bool vehicle_initialize(entity this, Vehicle info, bool nodrop)
void set_movetype(entity this, int mt)
#define IS_PLAYER(v)
Definition: utils.qh:9
float EF_LOWPRECISION
var void func_null()
vector vehicles_findgoodexit(entity this, entity player, vector prefer_spot)
Definition: sv_vehicles.qc:764
void vehicles_touch(entity this, entity toucher)
Definition: sv_vehicles.qc:888
vector v_forward
Definition: csprogsdefs.qc:31