]> de.git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blob - qcsrc/common/turrets/sv_turrets.qh
Merge branch 'master' into terencehill/tooltips_cleanup
[xonotic/xonotic-data.pk3dir.git] / qcsrc / common / turrets / sv_turrets.qh
1 #ifndef SV_TURRETS_H
2 #define SV_TURRETS_H
3
4 #include "all.qh"
5
6 // turret fields
7 .float ticrate; // interal ai think rate
8 .vector aim_idle; // where to aim while idle
9 .entity tur_head; // top part of the turret
10 .entity tur_defend; // defend this entity
11 .vector tur_shotorg; // shot origin
12 .vector tur_aimpos; // aiming location
13 .float tur_impacttime; // predicted projectile impact time
14 .entity tur_impactent; // entity the projectile hit
15 .float tur_dist_enemy; // distance to enemy
16 .float tur_dist_aimpos; // distance to aim location
17 .float tur_dist_impact_to_aimpos; // distance impact<->aim
18 .float volly_counter; // decrement counter from .shot_volly to 0
19
20 .float shot_refire; // attack refire
21 .float shot_speed; // projectile speed
22 .float shot_spread; // inaccuracy
23 .float shot_dmg; // core damage of projectile
24 .float shot_radius; // projectile damage radius
25 .float shot_force; // projectile damage force
26 .float shot_volly; // smaller than 1 = shoot # times at target
27 .float shot_volly_refire; // refire after completed volly
28
29 .float target_range;
30 .float target_range_min;
31 .float target_range_optimal;
32
33 .float target_select_rangebias;
34 .float target_select_samebias;
35 .float target_select_anglebias;
36 .float target_select_missilebias;
37 .float target_select_playerbias;
38 .float target_select_time; // last time turret had a valid target
39 .float target_validate_time; // throttle re-validation of current target
40
41 .float aim_firetolerance_dist;
42 .float aim_speed;
43 .float aim_maxpitch;
44 .float aim_maxrotate;
45
46 .float ammo; // current ammo
47 .float ammo_recharge; // recharge rate
48 .float ammo_max; // maximum ammo
49
50 .vector idle_aim;
51
52 /// Map time control over pain inflicted
53 .float turret_scale_damage;
54 /// Map time control targetting range
55 .float turret_scale_range;
56 /// Map time control refire
57 .float turret_scale_refire;
58 /// Map time control ammo held and recharged
59 .float turret_scale_ammo;
60 /// Map time control aim speed
61 .float turret_scale_aim;
62 /// Map time control health
63 .float turret_scale_health;
64 /// Map time control respawn time
65 .float turret_scale_respawn;
66
67 // tracking type
68 .float track_type;
69 const float TFL_TRACKTYPE_STEPMOTOR = 1; // hard angle increments, ugly for fast turning with best accuracy
70 const float TFL_TRACKTYPE_FLUIDPRECISE = 2; // smooth absolute movement, looks OK with fair accuracy
71 const float TFL_TRACKTYPE_FLUIDINERTIA = 3; // simulated inertia ("wobbly" mode), worst accuracy, depends on below flags
72 .float track_accel_pitch;
73 .float track_accel_rotate;
74 .float track_blendrate;
75
76 void() turret_respawn;
77
78 /// updates aim org, shot org, shot dir and enemy org for selected turret
79 void turret_do_updates(entity e_turret);
80 .vector tur_shotdir_updated;
81
82 .float() turret_firecheckfunc; // TODO: deprecate!
83
84 void turrets_setframe(float _frame, float client_only);
85
86 float turret_initialize(float tur_id);
87
88 /// Function to use for target evaluation. usualy turret_targetscore_generic
89 .float(entity _turret, entity _target) turret_score_target;
90
91 .float(entity e_target,entity e_sender) turret_addtarget;
92
93 .entity pathcurrent;
94
95 float turret_count;
96
97 // debugging
98 // Uncomment below to enable various debug output.
99 //#define TURRET_DEBUG
100 //#define TURRET_DEBUG_TARGETVALIDATE
101 //#define TURRET_DEBUG_TARGETSELECT
102 #ifdef TURRET_DEBUG
103 .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)
104 .float tur_debug_dmg_t_f; // total damage
105 .float tur_debug_start; // turret initialization time
106 .float tur_debug_tmr1; // random timer
107 .float tur_debug_tmr2; // random timer
108 .float tur_debug_tmr3; // random timer
109 .vector tur_debug_rvec; // random vector
110 #endif
111
112 // aiming
113 vector tvt_thadv; // turret head angle diff vector, updated by a successful call to turret_validate_target
114 vector tvt_tadv; // turret angle diff vector, updated by a successful call to turret_validate_target
115 float tvt_thadf; // turret head angle diff float, updated by a successful call to turret_validate_target
116 float tvt_tadf; // turret angle diff float, updated by a successful call to turret_validate_target
117 float tvt_dist; // turret distance, updated by a successful call to turret_validate_target
118
119 #endif