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