Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
ammo.qc
Go to the documentation of this file.
1#include "ammo.qh"
2
3#include <lib/counting.qh>
4
5string count_ammo(int num, entity res)
6{
7 switch(res)
8 {
9 case RES_SHELLS: return count_shells(num);
10 case RES_BULLETS: return count_bullets(num);
11 case RES_ROCKETS: return count_rockets(num);
12 case RES_CELLS: return count_cells(num);
13 case RES_FUEL: return sprintf(_("%d fuel"), num);
14 }
15 return "";
16}
17
18#ifdef MENUQC
19
20#include <common/weapons/all.qh>
21
22METHOD(Ammo, describe, string(Ammo this))
23{
24 TC(Ammo, this);
27 PAR(_("The %s ammo type is used by the:"), COLORED_NAME(this));
28 FOREACH(Weapons, it.ammo_type == ammo, {
29 PAGE_TEXT = strcat(PAGE_TEXT, "\n* ", COLORED_NAME(it));
30 });
31 const string nname = this.netname == "bullets" ? "nails" : this.netname;
32 PAR(_("By default, the pickup gives you %s, to a maximum of %s."), strcat("^9", count_ammo(stof(cvar_defstring(strcat("g_pickup_", nname))), ammo), "^7"), cvar_defstring(sprintf("g_pickup_%s_max", nname)));
33 return PAGE_TEXT;
34 // TODO: rename all *nails* cvars to bullets
35}
36
37METHOD(Fuel, describe, string(Fuel this))
38{
39 TC(Fuel, this);
41 PAR(_("The %s ammo type is used by the %s."), COLORED_NAME(this), COLORED_NAME(ITEM_Jetpack));
42 PAR(_("By default, the pickup gives you %s, to a maximum of %s."), strcat("^9", count_ammo(stof(cvar_defstring("g_pickup_fuel")), RES_FUEL), "^7"), cvar_defstring("g_pickup_fuel_max"));
43 return PAGE_TEXT;
44}
45#endif
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
Definition ammo.qh:26
Definition ammo.qh:198
string netname
Definition powerups.qc:20
#define COLORED_NAME(this)
Definition color.qh:189
string count_ammo(int num, entity res)
Definition ammo.qc:5
#define count_bullets(num)
Definition counting.qh:17
#define count_rockets(num)
Definition counting.qh:25
#define count_shells(num)
Definition counting.qh:9
#define count_cells(num)
Definition counting.qh:33
Weapons
Definition guide.qh:113
#define FOREACH(list, cond, body)
Definition iter.qh:19
#define TC(T, sym)
Definition _all.inc:82
float stof(string val,...)
const string cvar_defstring(string name)
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))
#define METHOD(cname, name, prototype)
Definition oo.qh:274
#define PAGE_TEXT
Definition string.qh:652
#define PAR(...)
Adds an individually translatable paragraph to PAGE_TEXT without having to deal with strcat and sprin...
Definition string.qh:658
#define PAGE_TEXT_INIT()
Definition string.qh:651
float ammo
Definition sv_turrets.qh:43
entity GetAmmoResource(Ammo ammotype)
Definition all.qc:203