Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
hk.qc
Go to the documentation of this file.
1#include "hk.qh"
2
3#ifdef SVQC
4
5#ifdef TURRET_DEBUG_HK
6.float atime;
7#endif
8
9spawnfunc(turret_hk)
10{
11 if (!turret_initialize(this, TUR_HK))
12 delete(this);
13}
14
15METHOD(HunterKiller, tr_think, void(HunterKiller thistur, entity it))
16{
17 if (it.tur_head.frame != 0)
18 ++it.tur_head.frame;
19 if (it.tur_head.frame > 5)
20 it.tur_head.frame = 0;
21}
22
23bool turret_hk_addtarget(entity this, entity e_target, entity e_sender);
24METHOD(HunterKiller, tr_setup, void(HunterKiller this, entity it))
25{
26 it.ammo_flags = TFL_AMMO_ROCKETS | TFL_AMMO_RECHARGE;
27 it.aim_flags = TFL_AIM_SIMPLE;
30 it.shoot_flags = TFL_SHOOT_CLEARTARGET;
31 it.target_validate_flags = TFL_TARGETSELECT_VEHICLES | TFL_TARGETSELECT_TEAMCHECK;
32
33 it.turret_addtarget = turret_hk_addtarget;
34}
35
36bool turret_hk_addtarget(entity this, entity e_target, entity e_sender)
37{
38 if (e_target && turret_validate_target(this, e_target, this.target_validate_flags) > 0)
39 {
40 this.enemy = e_target;
41 return true;
42 }
43
44 return false;
45}
46
47#endif // SVQC
48#ifdef MENUQC
50
51METHOD(HunterKiller, describe, string(HunterKiller this))
52{
53 TC(HunterKiller, this);
55 PAR(_("The %s fires a single powerful homing rocket with the ability to evade obstacles to find its target. "
56 "The rocket it fires is similar to that of the %s."), COLORED_NAME(this), COLORED_NAME(WEP_DEVASTATOR));
57 return PAGE_TEXT;
58}
59
60#endif // MENUQC
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
#define COLORED_NAME(this)
Definition color.qh:195
bool turret_hk_addtarget(entity this, entity e_target, entity e_sender)
Definition hk.qc:36
#define TC(T, sym)
Definition _all.inc:82
#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
entity enemy
Definition sv_ctf.qh:153
float turret_validate_target(entity e_turret, entity e_target, float validate_flags)
Evaluate a entity for target valitity based on validate_flags NOTE: the caller must check takedamage ...
bool turret_initialize(entity this, Turret tur)
const int TFL_TARGETSELECT_TEAMCHECK
don't attack teammates
Definition turret.qh:88
int target_validate_flags
Definition turret.qh:80
const int TFL_FIRECHECK_DEAD
don't attack dead targets (zombies?)
Definition turret.qh:113
const int TFL_TARGETSELECT_TRIGGERTARGET
respond to turret_trigger_target events
Definition turret.qh:85
const int TFL_TARGETSELECT_RANGELIMITS
limit target selection range
Definition turret.qh:87
const int TFL_SHOOT_CLEARTARGET
lose target after attack (after volly is done if in volly mode)
Definition turret.qh:132
const int TFL_AMMO_ROCKETS
uses explosives
Definition turret.qh:160
const int TFL_FIRECHECK_REFIRE
check single attack finished delays
Definition turret.qh:123
const int TFL_TARGETSELECT_VEHICLES
target manned vehicles
Definition turret.qh:94
const int TFL_TARGETSELECT_LOS
require line of sight to find targets
Definition turret.qh:82
const int TFL_AMMO_RECHARGE
regenerates ammo
Definition turret.qh:161
const int TFL_FIRECHECK_TEAMCHECK
don't attack teammates
Definition turret.qh:119
const int TFL_AIM_SIMPLE
aim at player's current location
Definition turret.qh:103
const int TFL_FIRECHECK_AFF
try to avoid any friendly fire
Definition turret.qh:120