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)
51 #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);
53 #define TR_CONFIG_END() }
55 #define TR_CONFIG_BEGIN(class)
56 #define _TR_CONFIG(class, fld, T, turname)
57 #define TR_CONFIG_END()
60 GENERIC_COMMAND(dumpturrets, "Dump all turrets into turrets_dump.txt")
64 case CMD_REQUEST_COMMAND:
68 tur_config_alsoprint = -1;
69 string filename = argv(1);
73 filename = "turrets_dump.cfg";
74 tur_config_alsoprint = false;
76 else if(filename == "-")
78 filename = "turrets_dump.cfg";
79 tur_config_alsoprint = true;
81 tur_config_file = fopen(filename, FILE_WRITE);
83 if(tur_config_file >= 0)
85 Dump_Turret_Settings();
86 LOG_INFOF("Dumping turrets... File located in ^2data/data/%s^7.", filename);
87 fclose(tur_config_file);
89 tur_config_alsoprint = -1;
93 LOG_INFOF("^1Error: ^7Could not open file '%s'!", filename);
96 LOG_INFO(_("Turrets dump command only works with sv_cmd."));
102 case CMD_REQUEST_USAGE:
104 LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " dumpturrets [filename]");
105 LOG_INFO(" Where 'filename' is the file to write (default is turrets_dump.cfg),");
106 LOG_INFO(" if supplied with '-' output to console as well as default,");
107 LOG_INFO(" if left blank, it will only write to default.");
114 const int TUR_FIRST = 1;
115 #define TUR_LAST (Turrets_COUNT - 1)
117 #define REGISTER_TURRET(id, inst) REGISTER(Turrets, TUR, id, m_id, inst)
119 REGISTER_TURRET(Null, NEW(Turret));
121 #include "turret/_mod.qh"