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