Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
mlrs.qc
Go to the documentation of this file.
1#include "mlrs.qh"
2
3#ifdef SVQC
4
5spawnfunc(turret_mlrs)
6{
7 if (!turret_initialize(this, TUR_MLRS))
8 delete(this);
9}
10
11METHOD(MLRSTurret, tr_think, void(MLRSTurret thistur, entity it))
12{
13 // 0 = full, 6 = empty
14 it.tur_head.frame = bound(0, 6 - floor(0.1 + it.ammo / it.shot_dmg), 6);
15 if (it.tur_head.frame < 0)
16 {
17 LOG_TRACE("ammo:", ftos(it.ammo));
18 LOG_TRACE("shot_dmg:", ftos(it.shot_dmg));
19 }
20}
21METHOD(MLRSTurret, tr_setup, void(MLRSTurret this, entity it))
22{
23 it.ammo_flags = TFL_AMMO_ROCKETS | TFL_AMMO_RECHARGE;
25
26 it.damage_flags |= TFL_DMG_HEADSHAKE;
27 it.shoot_flags |= TFL_SHOOT_VOLLYALWAYS;
28 it.volly_counter = it.shot_volly;
29}
30
31#endif // SVQC
32#ifdef MENUQC
34
35METHOD(MLRSTurret, describe, string(MLRSTurret this))
36{
37 TC(MLRSTurret, this);
39 PAR(_("The %s fires a rapid burst of 6 rockets similar to those of the %s towards its targets."), COLORED_NAME(this), COLORED_NAME(WEP_DEVASTATOR));
40 PAR(_("Getting caught in the line of fire of this turret can be very deadly, "
41 "but thankfully it doesn't shoot if you get too close, so as to not damage itself."));
42 return PAGE_TEXT;
43}
44
45#endif // MENUQC
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
#define COLORED_NAME(this)
Definition color.qh:195
#define TC(T, sym)
Definition _all.inc:82
#define LOG_TRACE(...)
Definition log.qh:76
float bound(float min, float value, float max)
string ftos(float f)
float floor(float f)
#define METHOD(cname, name, prototype)
Definition oo.qh:269
#define spawnfunc(id)
Definition spawnfunc.qh:96
#define PAGE_TEXT
Definition string.qh:642
#define PAR(...)
Adds an individually translatable paragraph to PAGE_TEXT without having to deal with strcat and sprin...
Definition string.qh:648
#define PAGE_TEXT_INIT()
Definition string.qh:641
bool turret_initialize(entity this, Turret tur)
const int TFL_DMG_HEADSHAKE
damage shakes head
Definition turret.qh:173
const int TFL_SHOOT_VOLLYALWAYS
always do a full volly, even if target is lost
Definition turret.qh:130
const int TFL_AIM_LEAD
try to predict target movement
Definition turret.qh:100
const int TFL_AMMO_ROCKETS
uses explosives
Definition turret.qh:160
const int TFL_AIM_SHOTTIMECOMPENSATE
compensate for shot traveltime when leading
Definition turret.qh:101
const int TFL_AMMO_RECHARGE
regenerates ammo
Definition turret.qh:161