Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
sv_turrets.qh
Go to the documentation of this file.
1#pragma once
2
3#include "all.qh"
4
11
12entity turret_projectile(entity actor, Sound _snd, float _size, float _health, float _death, float _proj_type, float _cull, float _cli_anim);
14float turret_validate_target(entity e_turret, entity e_target, float validate_flags);
15bool turret_firecheck(entity this);
17
18// turret fields
19
20#define X(class, prefix, fld, type) .type fld;
22#undef X
23/*
24.float shot_volly; // smaller than 1 = shoot # times at target
25.float shot_volly_refire; // refire after completed volly
26*/
27
28.entity tur_head; // top part of the turret
29.entity tur_defend; // defend this entity
30.vector tur_shotorg; // shot origin
31.vector tur_aimpos; // aiming location
32.float tur_impacttime; // predicted projectile impact time
33.entity tur_impactent; // entity the projectile hit
34.float tur_dist_enemy; // distance to enemy
35.float tur_dist_aimpos; // distance to aim location
36.float tur_dist_impact_to_aimpos; // distance impact<->aim
37.float volly_counter; // decrement counter from .shot_volly to 0
38
39.float target_select_time; // last time turret had a valid target
40.float target_validate_time; // throttle re-validation of current target
41
42
43.float ammo; // current ammo
44.vector idle_aim;
45
60
61// tracking type
62const float TFL_TRACKTYPE_STEPMOTOR = 1; // hard angle increments, ugly for fast turning with best accuracy
63const float TFL_TRACKTYPE_FLUIDPRECISE = 2; // smooth absolute movement, looks OK with fair accuracy
64const float TFL_TRACKTYPE_FLUIDINERTIA = 3; // simulated inertia ("wobbly" mode), worst accuracy, depends on below flags
65
66void turret_respawn(entity this);
67
69void turret_do_updates(entity e_turret);
71
72.float(entity this) turret_firecheckfunc; // TODO: deprecate!
73
74void turrets_setframe(entity this, float _frame, float client_only);
75
76bool turret_initialize(entity this, Turret tur);
77
78// returns true when box overlaps with a given location
79bool turret_closetotarget(entity this, vector targ, float range);
80
82.float(entity _turret, entity _target) turret_score_target;
83
84.bool(entity this, entity e_target,entity e_sender) turret_addtarget;
85
87
88.entity pathgoal;
89
91
92// debugging
93// Uncomment below to enable various debug output.
94//#define TURRET_DEBUG
95//#define TURRET_DEBUG_TARGETVALIDATE
96//#define TURRET_DEBUG_TARGETSELECT
97#ifdef TURRET_DEBUG
98.float tur_debug_dmg_t_h; // total damage that hit something (can be more than tur_debug_dmg_t_f since it should count radius damage)
99.float tur_debug_dmg_t_f; // total damage
100.float tur_debug_start; // turret initialization time
101.float tur_debug_tmr1; // random timer
102.float tur_debug_tmr2; // random timer
103.float tur_debug_tmr3; // random timer
104.vector tur_debug_rvec; // random vector
105#endif
106
107// aiming
108vector tvt_thadv; // turret head angle diff vector, updated by a successful call to turret_validate_target
109vector tvt_tadv; // turret angle diff vector, updated by a successful call to turret_validate_target
110float tvt_thadf; // turret head angle diff float, updated by a successful call to turret_validate_target
111float tvt_dist; // turret distance, updated by a successful call to turret_validate_target
112
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
limitations: NULL cannot be present elements can only be present once a maximum of IL_MAX lists can e...
#define X()
#define IL_NEW()
vector
Definition self.qh:92
#define STATIC_INIT(func)
during worldspawn
Definition static.qh:32
vector idle_aim
Definition sv_turrets.qh:44
float turret_scale_ammo
Map time control ammo held and recharged.
Definition sv_turrets.qh:53
float target_validate_time
Definition sv_turrets.qh:40
void turret_respawn(entity this)
entity tur_defend
Definition sv_turrets.qh:29
float turret_scale_respawn
Map time control respawn time.
Definition sv_turrets.qh:59
float turret_scale_health
Map time control health.
Definition sv_turrets.qh:57
float volly_counter
Definition sv_turrets.qh:37
bool turret_firecheck(entity this)
Preforms pre-fire checks based on the uints firecheck_flags.
vector tvt_thadv
float autocvar_g_turrets_targetscan_maxdelay
Definition sv_turrets.qh:9
entity turret_projectile(entity actor, Sound _snd, float _size, float _health, float _death, float _proj_type, float _cull, float _cli_anim)
bool autocvar_g_turrets
Definition sv_turrets.qh:5
float turret_count
Definition sv_turrets.qh:90
entity turret_select_target(entity this)
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 ...
entity tur_impactent
Definition sv_turrets.qh:33
float turret_scale_range
Map time control targetting range.
Definition sv_turrets.qh:49
vector tur_shotorg
Definition sv_turrets.qh:30
bool autocvar_g_turrets_nofire
Definition sv_turrets.qh:7
entity pathcurrent
Definition sv_turrets.qh:86
vector tur_shotdir_updated
Definition sv_turrets.qh:70
bool turret_closetotarget(entity this, vector targ, float range)
float autocvar_g_turrets_targetscan_mindelay
Definition sv_turrets.qh:10
float tur_dist_aimpos
Definition sv_turrets.qh:35
IntrusiveList g_turrets
entity pathgoal
Definition sv_turrets.qh:88
float tvt_thadf
vector tvt_tadv
const float TFL_TRACKTYPE_FLUIDINERTIA
Definition sv_turrets.qh:64
bool autocvar_g_turrets_reloadcvars
Definition sv_turrets.qh:8
float ammo
Definition sv_turrets.qh:43
float turret_scale_refire
Map time control refire.
Definition sv_turrets.qh:51
float tvt_dist
const float TFL_TRACKTYPE_FLUIDPRECISE
Definition sv_turrets.qh:63
const float TFL_TRACKTYPE_STEPMOTOR
Definition sv_turrets.qh:62
float turret_scale_aim
Map time control aim speed.
Definition sv_turrets.qh:55
float target_select_time
Definition sv_turrets.qh:39
entity tur_head
Definition sv_turrets.qh:28
float tur_dist_enemy
Definition sv_turrets.qh:34
vector tur_aimpos
Definition sv_turrets.qh:31
bool turret_initialize(entity this, Turret tur)
void turret_projectile_explode(entity this)
float autocvar_g_turrets_aimidle_delay
Definition sv_turrets.qh:6
void turrets_setframe(entity this, float _frame, float client_only)
void turret_do_updates(entity e_turret)
updates aim org, shot org, shot dir and enemy org for selected turret
float tur_dist_impact_to_aimpos
Definition sv_turrets.qh:36
float tur_impacttime
Definition sv_turrets.qh:32
float turret_scale_damage
Map time control over pain inflicted.
Definition sv_turrets.qh:47
#define TR_PROPS_COMMON(P, class, prefix)
Definition all.qh:13