3 #include <common/command/_mod.qh>
8 REGISTRY(Turrets, BITS(5))
9 #define Turrets_from(i) _Turrets_from(i, TUR_Null)
10 #define get_turretinfo(i) Turrets_from(i)
11 REGISTER_REGISTRY(Turrets)
12 REGISTRY_CHECK(Turrets)
14 #define TR_PROPS_COMMON(P, class, prefix) \
15 P(class, prefix, aim_firetolerance_dist, float) \
16 P(class, prefix, aim_maxpitch, float) \
17 P(class, prefix, aim_maxrot, float) \
18 P(class, prefix, aim_speed, float) \
19 P(class, prefix, ammo_max, float) \
20 P(class, prefix, ammo_recharge, float) \
21 P(class, prefix, health, float) \
22 P(class, prefix, respawntime, float) \
23 P(class, prefix, shot_dmg, float) \
24 P(class, prefix, shot_force, float) \
25 P(class, prefix, shot_radius, float) \
26 P(class, prefix, shot_refire, float) \
27 P(class, prefix, shot_speed, float) \
28 P(class, prefix, shot_spread, float) \
29 P(class, prefix, shot_volly, float) \
30 P(class, prefix, shot_volly_refire, float) \
31 P(class, prefix, target_range, float) \
32 P(class, prefix, target_range_min, float) \
33 P(class, prefix, target_range_optimal, float) \
34 P(class, prefix, target_select_anglebias, float) \
35 P(class, prefix, target_select_missilebias, float) \
36 P(class, prefix, target_select_playerbias, float) \
37 P(class, prefix, target_select_rangebias, float) \
38 P(class, prefix, target_select_samebias, float) \
39 P(class, prefix, track_accel_pitch, float) \
40 P(class, prefix, track_accel_rot, float) \
41 P(class, prefix, track_blendrate, float) \
42 P(class, prefix, track_type, float) \
45 #define TR_PROPS(L, class, prefix) \
46 L(TR_CONFIG_BEGIN, TR_CONFIG, TR_CONFIG_END, class, prefix) \
49 #define TR_CONFIG(class, turname, fld, T) _TR_CONFIG(class, fld, T, turname)
50 #define TR_CONFIG_BEGIN(class) METHOD(class, tr_config, void(class this)) {
52 #define _TR_CONFIG(class, fld, T, turname) if (#turname == this.netname) TUR_CONFIG_WRITE_CVARS(turname, fld, T);
54 #define _TR_CONFIG(class, fld, T, turname)
56 #define TR_CONFIG_END() }
58 GENERIC_COMMAND(dumpturrets, "Dump all turrets into turrets_dump.txt")
62 case CMD_REQUEST_COMMAND:
66 tur_config_alsoprint = -1;
67 string filename = argv(1);
71 filename = "turrets_dump.cfg";
72 tur_config_alsoprint = false;
74 else if(filename == "-")
76 filename = "turrets_dump.cfg";
77 tur_config_alsoprint = true;
79 tur_config_file = fopen(filename, FILE_WRITE);
81 if(tur_config_file >= 0)
83 Dump_Turret_Settings();
84 LOG_INFOF("Dumping turrets... File located in ^2data/data/%s^7.", filename);
85 fclose(tur_config_file);
87 tur_config_alsoprint = -1;
91 LOG_INFOF("^1Error: ^7Could not open file '%s'!", filename);
94 LOG_INFO(_("Turrets dump command only works with sv_cmd."));
100 case CMD_REQUEST_USAGE:
102 LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " dumpturrets [filename]");
103 LOG_INFO(" Where 'filename' is the file to write (default is turrets_dump.cfg),");
104 LOG_INFO(" if supplied with '-' output to console as well as default,");
105 LOG_INFO(" if left blank, it will only write to default.");
112 const int TUR_FIRST = 1;
113 #define TUR_LAST (Turrets_COUNT - 1)
115 #define REGISTER_TURRET(id, inst) REGISTER(Turrets, TUR, id, m_id, inst)
117 REGISTER_TURRET(Null, NEW(Turret));
119 #include "turret/_mod.qh"