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