X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fcommon%2Fturrets%2Fall.qh;h=e63a931a67361df15b0d7b15f71fbc16e484c862;hp=04bb10f6a548e67da5fba28ed487c71a1300f52c;hb=e87123e5fba23f7a8907e6fbab241c5eec5be168;hpb=867ce0406b74601b6d74a4ac412ac30063490d88 diff --git a/qcsrc/common/turrets/all.qh b/qcsrc/common/turrets/all.qh index 04bb10f6a..e63a931a6 100644 --- a/qcsrc/common/turrets/all.qh +++ b/qcsrc/common/turrets/all.qh @@ -1,12 +1,76 @@ -#include "unit/ewheel.qc" -#include "unit/flac.qc" -#include "unit/fusionreactor.qc" -#include "unit/hellion.qc" -#include "unit/hk.qc" -#include "unit/machinegun.qc" -#include "unit/mlrs.qc" -#include "unit/phaser.qc" -#include "unit/plasma.qc" -#include "unit/plasma_dual.qc" -#include "unit/tesla.qc" -#include "unit/walker.qc" +#pragma once + +#include +#include "config.qh" + +#include "turret.qh" + +REGISTRY(Turrets, BITS(5)) +#define Turrets_from(i) _Turrets_from(i, TUR_Null) +#define get_turretinfo(i) Turrets_from(i) +REGISTER_REGISTRY(Turrets) +REGISTRY_CHECK(Turrets) + + +GENERIC_COMMAND(dumpturrets, "Dump all turrets into turrets_dump.txt") +{ + switch(request) + { + case CMD_REQUEST_COMMAND: + { + #ifdef SVQC + tur_config_file = -1; + tur_config_alsoprint = -1; + string filename = argv(1); + + if(filename == "") + { + filename = "turrets_dump.cfg"; + tur_config_alsoprint = false; + } + else if(filename == "-") + { + filename = "turrets_dump.cfg"; + tur_config_alsoprint = true; + } + tur_config_file = fopen(filename, FILE_WRITE); + + if(tur_config_file >= 0) + { + Dump_Turret_Settings(); + LOG_INFOF("Dumping turrets... File located in ^2data/data/%s^7.", filename); + fclose(tur_config_file); + tur_config_file = -1; + tur_config_alsoprint = -1; + } + else + { + LOG_INFOF("^1Error: ^7Could not open file '%s'!", filename); + } + #else + LOG_INFO(_("Turrets dump command only works with sv_cmd.")); + #endif + return; + } + + default: + case CMD_REQUEST_USAGE: + { + LOG_INFO("Usage:^3 ", GetProgramCommandPrefix(), " dumpturrets [filename]"); + LOG_INFO(" Where 'filename' is the file to write (default is turrets_dump.cfg),"); + LOG_INFO(" if supplied with '-' output to console as well as default,"); + LOG_INFO(" if left blank, it will only write to default."); + return; + } + } +} + + +const int TUR_FIRST = 1; +#define TUR_LAST (Turrets_COUNT - 1) + +#define REGISTER_TURRET(id, inst) REGISTER(Turrets, TUR, id, m_id, inst) + +REGISTER_TURRET(Null, NEW(Turret)); + +#include "turret/_mod.qh"