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