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