33{
45
46 string str;
49 {
51 }
52 else
53 {
54 for(int j = 0; j < n; ++j)
55 {
56
60 else if(
argv(j) ==
"strength") this.
items |= ITEM_Strength.m_itemid;
61 else if(
argv(j) ==
"invincible") this.
items |= ITEM_Shield.m_itemid;
62 else if(
argv(j) ==
"speed") this.
items |= ITEM_Speed.m_itemid;
63 else if(
argv(j) ==
"invisibility") this.
items |= ITEM_Invisibility.m_itemid;
65 else if(
argv(j) ==
"jetpack") this.
items |= ITEM_Jetpack.m_itemid;
66 else if(
argv(j) ==
"fuel_regen") this.
items |= ITEM_FuelRegen.m_itemid;
67 else
68 {
69 FOREACH(StatusEffects, it.instanceOfBuff,
70 {
71 string s = Buff_CompatName(argv(j));
72 if(s == it.netname)
73 {
74 this.buffdef = it;
75 if(!this.buffs_finished)
76 this.buffs_finished = it.m_time(it);
77 break;
78 }
79 });
82 if(s == it.netname || s == it.m_deprecated_netname)
83 {
84 STAT(WEAPONS,
this) |= (it.m_wepset);
86 it.wr_init(it);
87 break;
88 }
89 });
90 }
91 }
92
93 string itemprefix, valueprefix;
94
95
96
98 {
99 itemprefix = "";
100 valueprefix = "";
101 }
103 {
104 itemprefix = "max ";
105 valueprefix = "max ";
106 }
108 {
109 itemprefix = "min ";
110 valueprefix = "min ";
111 }
113 {
114 itemprefix = "minus ";
115 valueprefix = "max ";
116 }
117 else
118 {
119 error(
"invalid spawnflags");
121 }
122
123 str = "";
124 str = sprintf(
"%s %s%d %s", str, itemprefix,
boolean(this.
items &
IT_UNLIMITED_AMMO),
"unlimited_weapon_ammo");
126 str = sprintf(
"%s %s%d %s", str, valueprefix, this.
strength_finished *
boolean(this.
items & ITEM_Strength.m_itemid),
"strength");
127 str = sprintf(
"%s %s%d %s", str, valueprefix, this.
invincible_finished *
boolean(this.
items & ITEM_Shield.m_itemid),
"invincible");
128 str = sprintf(
"%s %s%d %s", str, valueprefix, this.
invisibility_finished *
boolean(this.
items & ITEM_Invisibility.m_itemid),
"invisibility");
129 str = sprintf(
"%s %s%d %s", str, valueprefix, this.
speed_finished *
boolean(this.
items & ITEM_Speed.m_itemid),
"speed");
131 str = sprintf(
"%s %s%d %s", str, itemprefix,
boolean(this.
items & ITEM_Jetpack.m_itemid),
"jetpack");
132 str = sprintf(
"%s %s%d %s", str, itemprefix,
boolean(this.
items & ITEM_FuelRegen.m_itemid),
"fuel_regen");
133 float res;
134 res =
GetResource(
this, RES_SHELLS);
if(res != 0) str = sprintf(
"%s %s%d %s", str, valueprefix,
max(0, res),
"shells");
135 res =
GetResource(
this, RES_BULLETS);
if(res != 0) str = sprintf(
"%s %s%d %s", str, valueprefix,
max(0, res),
"nails");
136 res =
GetResource(
this, RES_ROCKETS);
if(res != 0) str = sprintf(
"%s %s%d %s", str, valueprefix,
max(0, res),
"rockets");
137 res =
GetResource(
this, RES_CELLS);
if(res != 0) str = sprintf(
"%s %s%d %s", str, valueprefix,
max(0, res),
"cells");
138 res =
GetResource(
this, RES_FUEL);
if(res != 0) str = sprintf(
"%s %s%d %s", str, valueprefix,
max(0, res),
"fuel");
139 res =
GetResource(
this, RES_HEALTH);
if(res != 0) str = sprintf(
"%s %s%d %s", str, valueprefix,
max(0, res),
"health");
140 res =
GetResource(
this,
RES_ARMOR);
if(res != 0) str = sprintf(
"%s %s%d %s", str, valueprefix,
max(0, res),
"armor");
141 FOREACH(StatusEffects, it.instanceOfBuff, str = sprintf(
"%s %s%d %s", str, valueprefix, this.
buffs_finished *
boolean(this.
buffdef == it), it.netname));
142 FOREACH(
Weapons, it != WEP_Null, str = sprintf(
"%s %s%d %s", str, itemprefix, !!(
STAT(WEAPONS,
this) & (it.m_wepset)), it.netname));
143 }
145
147 for(int j = 0; j < n; ++j)
148 {
151 it.wr_init(it);
152 break;
153 });
154 }
155}
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
const int IT_UNLIMITED_AMMO
const int IT_UNLIMITED_SUPERWEAPONS
float invincible_finished
void target_items_use(entity this, entity actor, entity trigger)
float invisibility_finished
float autocvar_g_balance_powerup_invisibility_time
#define FOREACH(list, cond, body)
float autocvar_g_balance_powerup_speed_time
float autocvar_g_balance_superweapons_time
float superweapons_finished
float autocvar_g_balance_powerup_invincible_time
float autocvar_g_balance_powerup_strength_time