MSG_INFO_NOTIF(ITEM_BUFF_GOT, N_CONSOLE, 0, 1, "item_buffname", "", "", _("^BGYou got the %s^BG buff!"), "")
MSG_INFO_NOTIF(ITEM_WEAPON_DONTHAVE, N_DISABLE, 0, 1, "item_wepname", "", "", _("^BGYou do not have the ^F1%s"), "")
- MSG_INFO_NOTIF(ITEM_WEAPON_DROP, N_DISABLE, 1, 1, "item_wepname item_wepammo", "", "", _("^BGYou dropped the ^F1%s^BG%s"), "")
+ MSG_INFO_NOTIF(ITEM_WEAPON_DROP, N_DISABLE, 0, 2, "item_wepname item_wepammo", "", "", _("^BGYou dropped the ^F1%s^BG%s"), "")
MSG_INFO_NOTIF(ITEM_WEAPON_GOT, N_DISABLE, 0, 1, "item_wepname", "", "", _("^BGYou got the ^F1%s"), "")
MSG_INFO_NOTIF(ITEM_WEAPON_NOAMMO, N_DISABLE, 0, 1, "item_wepname", "", "", _("^BGYou don't have enough ammo for the ^F1%s"), "")
MSG_INFO_NOTIF(ITEM_WEAPON_PRIMORSEC, N_DISABLE, 0, 3, "item_wepname f2primsec f3primsec", "", "", _("^F1%s %s^BG is unable to fire, but its ^F1%s^BG can"), "")
MSG_CENTER_NOTIF(ITEM_FUELREGEN_GOT, N_ENABLE, 0, 0, "", CPID_ITEM, "item_centime 0", _("^BGYou got the ^F1Fuel regenerator"), "")
MSG_CENTER_NOTIF(ITEM_JETPACK_GOT, N_ENABLE, 0, 0, "", CPID_ITEM, "item_centime 0", _("^BGYou got the ^F1Jetpack"), "")
MSG_CENTER_NOTIF(ITEM_WEAPON_DONTHAVE, N_ENABLE, 0, 1, "item_wepname", CPID_ITEM, "item_centime 0", _("^BGYou do not have the ^F1%s"), "")
- MSG_CENTER_NOTIF(ITEM_WEAPON_DROP, N_ENABLE, 1, 1, "item_wepname item_wepammo", CPID_ITEM, "item_centime 0", _("^BGYou dropped the ^F1%s^BG%s"), "")
+ MSG_CENTER_NOTIF(ITEM_WEAPON_DROP, N_ENABLE, 0, 2, "item_wepname item_wepammo", CPID_ITEM, "item_centime 0", _("^BGYou dropped the ^F1%s^BG%s"), "")
MSG_CENTER_NOTIF(ITEM_WEAPON_GOT, N_ENABLE, 0, 1, "item_wepname", CPID_ITEM, "item_centime 0", _("^BGYou got the ^F1%s"), "")
MSG_CENTER_NOTIF(ITEM_WEAPON_NOAMMO, N_ENABLE, 0, 1, "item_wepname", CPID_ITEM, "item_centime 0", _("^BGYou don't have enough ammo for the ^F1%s"), "")
MSG_CENTER_NOTIF(ITEM_WEAPON_PRIMORSEC, N_ENABLE, 0, 3, "item_wepname f2primsec f3primsec", CPID_ITEM, "item_centime 0", _("^F1%s %s^BG is unable to fire, but its ^F1%s^BG can"), "")
spree_end: placed at the end of murder messages to show ending of sprees
spree_lost: placed at the end of suicide messages to show losing of sprees
item_wepname: return full name of a weapon from weaponid
- item_wepammo: ammo display for weapon from string
+ item_wepammo: ammo display for weapon from f1
item_centime: amount of time to display weapon message in centerprint
item_buffname: return full name of a buff from buffid
death_team: show the full name of the team a player is switching from
ARG_CASE(ARG_CS_SV, "item_wepname", Weapons_from(f1).m_name) \
ARG_CASE(ARG_CS_SV, "item_buffname", BUFF_NAME(f1)) \
ARG_CASE(ARG_CS_SV, "f3buffname", BUFF_NAME(f3)) \
- ARG_CASE(ARG_CS_SV, "item_wepammo", (s1 != "" ? sprintf(_(" with %s"), s1) : "")) \
+ ARG_CASE(ARG_CS_SV, "item_wepammo", (f2 > 0 ? notif_arg_item_wepammo(f1, f2) : "")) \
ARG_CASE(ARG_DC, "item_centime", ftos(autocvar_notification_item_centerprinttime)) \
ARG_CASE(ARG_SV, "death_team", Team_ColoredFullName(f1)) \
ARG_CASE(ARG_CS, "death_team", Team_ColoredFullName(f1 - 1)) \
return "";
}
+string notif_arg_item_wepammo(float f1, float f2)
+{
+ if(f2 <= 0)
+ return "";
+ string ammoitems = "";
+ Weapon wep = Weapons_from(f1);
+ switch (wep.ammo_type)
+ {
+ case RESOURCE_SHELLS: ammoitems = ITEM_Shells.m_name; break;
+ case RESOURCE_BULLETS: ammoitems = ITEM_Bullets.m_name; break;
+ case RESOURCE_ROCKETS: ammoitems = ITEM_Rockets.m_name; break;
+ case RESOURCE_CELLS: ammoitems = ITEM_Cells.m_name; break;
+ case RESOURCE_PLASMA: ammoitems = ITEM_Plasma.m_name; break;
+ case RESOURCE_FUEL: ammoitems = ITEM_JetpackFuel.m_name; break;
+ default: return ""; // doesn't use ammo
+ }
+ return sprintf(_(" with %d %s"), f2, ammoitems);
+}
+
// ====================================
// Initialization/Create Declarations
string NearestLocation(vector p);
+string AmmoNameFromWeaponentity(Weapon wep);
+
void play2(entity e, string filename);
string playername(entity p, bool team_colorize);
SUB_VanishOrRemove(this);
}
-// returns amount of ammo used as string, or -1 for failure, or 0 for no ammo count
-string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vector velo, .entity weaponentity)
+// returns amount of ammo used, or -1 for failure, or 0 for no ammo count
+float W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vector velo, .entity weaponentity)
{
- float thisammo;
- string s;
Weapon info = Weapons_from(wpn);
int ammotype = info.ammo_type;
weapon_defaultspawnfunc(wep, info);
if(startitem_failed)
- return string_null;
+ return -1;
setthink(wep, thrown_wep_think);
wep.savenextthink = wep.nextthink;
wep.nextthink = min(wep.nextthink, time + 0.5);
//wa = W_AmmoItemCode(wpn);
if(ammotype == RESOURCE_NONE)
{
- return "";
+ return 0;
}
else
{
- s = "";
-
if(doreduce && g_weapon_stay == 2)
{
// if our weapon is loaded, give its load back to the player
}
float ownderammo = GetResourceAmount(own, ammotype);
- thisammo = min(ownderammo, GetResourceAmount(wep, ammotype));
+ float thisammo = min(ownderammo, GetResourceAmount(wep, ammotype));
SetResourceAmount(wep, ammotype, thisammo);
SetResourceAmount(own, ammotype, ownderammo - thisammo);
- switch (ammotype)
- {
- case RESOURCE_SHELLS: s = sprintf("%s and %d shells", s, thisammo); break;
- case RESOURCE_BULLETS: s = sprintf("%s and %d nails", s, thisammo); break;
- case RESOURCE_ROCKETS: s = sprintf("%s and %d rockets", s, thisammo); break;
- case RESOURCE_CELLS: s = sprintf("%s and %d cells", s, thisammo); break;
- case RESOURCE_PLASMA: s = sprintf("%s and %d plasma", s, thisammo); break;
- case RESOURCE_FUEL: s = sprintf("%s and %d fuel", s, thisammo); break;
- }
-
- s = substring(s, 5, -1);
+ return thisammo;
}
- return s;
+ return 0;
}
}
STAT(WEAPONS, this) &= ~set;
W_SwitchWeapon_Force(this, w_getbestweapon(this, weaponentity), weaponentity);
- string a = W_ThrowNewWeapon(this, w.m_id, doreduce, this.origin + delta, velo, weaponentity);
+ float a = W_ThrowNewWeapon(this, w.m_id, doreduce, this.origin + delta, velo, weaponentity);
- if(!a) return;
- Send_Notification(NOTIF_ONE, this, MSG_MULTI, ITEM_WEAPON_DROP, a, w.m_id);
+ if(a < 0) return;
+ Send_Notification(NOTIF_ONE, this, MSG_MULTI, ITEM_WEAPON_DROP, w.m_id, a);
}
void SpawnThrownWeapon(entity this, vector org, Weapon wep, .entity weaponentity)
.float savenextthink;
void thrown_wep_think(entity this);
-// returns amount of ammo used as string, or -1 for failure, or 0 for no ammo count
-string W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vector velo, .entity weaponentity);
+// returns amount of ammo used, or -1 for failure, or 0 for no ammo count
+float W_ThrowNewWeapon(entity own, float wpn, float doreduce, vector org, vector velo, .entity weaponentity);
bool W_IsWeaponThrowable(entity this, int w);