r5249 - in trunk/data: . qcsrc/server
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Wed Dec 17 08:34:06 EST 2008
Author: div0
Date: 2008-12-17 08:34:06 -0500 (Wed, 17 Dec 2008)
New Revision: 5249
Modified:
trunk/data/defaultNexuiz.cfg
trunk/data/qcsrc/server/cl_weapons.qc
trunk/data/qcsrc/server/cl_weaponsystem.qc
Log:
- only complain about ONE missing weapon;
- g_showweaponspawns (feature you know from the OTLD servers)
Modified: trunk/data/defaultNexuiz.cfg
===================================================================
--- trunk/data/defaultNexuiz.cfg 2008-12-17 13:29:45 UTC (rev 5248)
+++ trunk/data/defaultNexuiz.cfg 2008-12-17 13:34:06 UTC (rev 5249)
@@ -1241,4 +1241,6 @@
set g_ban_sync_timeout 45 // time out in seconds for the ban sync requests
set g_ban_sync_trusted_servers_verify 0 // when set to 1, additional bans sent by the servers are ignored, and only bans for the requested IP are used
+set g_showweaponspawns 0 // 1: display sprites for weapon spawns found on the map when a weapon key is pressed and the weapon is not available
+
alias records "cmd records"
Modified: trunk/data/qcsrc/server/cl_weapons.qc
===================================================================
--- trunk/data/qcsrc/server/cl_weapons.qc 2008-12-17 13:29:45 UTC (rev 5248)
+++ trunk/data/qcsrc/server/cl_weapons.qc 2008-12-17 13:34:06 UTC (rev 5249)
@@ -6,9 +6,10 @@
W_SwitchWeapon_Force(self, imp);
};
+.float weaponcomplainindex;
float W_GetCycleWeapon(entity pl, string weaponorder, float dir, float imp, float complain)
{
- float n, i, weaponwant, first_valid, prev_valid, switchtonext, switchtolast;
+ float n, i, weaponwant, first_valid, prev_valid, switchtonext, switchtolast, c;
n = tokenize_sane(weaponorder);
switchtonext = switchtolast = 0;
first_valid = prev_valid = 0;
@@ -16,14 +17,17 @@
if(dir == 0)
switchtonext = 1;
+ c = 0;
+
for(i = 0; i < n; ++i)
{
weaponwant = stof(argv(i));
-
if(imp >= 0)
if((get_weaponinfo(weaponwant)).impulse != imp)
continue;
+ ++c;
+
if(client_hasweapon(pl, weaponwant, TRUE, FALSE))
{
if(switchtonext)
@@ -49,16 +53,24 @@
else
return first_valid;
}
- // complain
+ // complain (but only for one weapon on the button that has been pressed)
if(complain)
{
+ self.weaponcomplainindex += 1;
+ c = mod(self.weaponcomplainindex, c) + 1;
for(i = 0; i < n; ++i)
{
weaponwant = stof(argv(i));
if(imp >= 0)
if((get_weaponinfo(weaponwant)).impulse != imp)
continue;
- client_hasweapon(pl, weaponwant, TRUE, TRUE);
+
+ --c;
+ if(c == 0)
+ {
+ client_hasweapon(pl, weaponwant, TRUE, TRUE);
+ break;
+ }
}
}
return 0;
Modified: trunk/data/qcsrc/server/cl_weaponsystem.qc
===================================================================
--- trunk/data/qcsrc/server/cl_weaponsystem.qc 2008-12-17 13:29:45 UTC (rev 5248)
+++ trunk/data/qcsrc/server/cl_weaponsystem.qc 2008-12-17 13:34:06 UTC (rev 5249)
@@ -415,7 +415,33 @@
// DRESK - 3/16/07
// Report Proper Weapon Status / Modified Weapon Ownership Message
if(weaponsInMap & weaponbit)
+ {
sprint(cl, strcat("You do not have the ^2", W_Name(wpn), "\n") );
+
+ entity e;
+ string s;
+
+ if(cvar("g_showweaponspawns"))
+ {
+ e = get_weaponinfo(wpn);
+ s = strcat("wpn-", e.mdl);
+ for(e = world; (e = findfloat(e, weapons, weaponbit)); )
+ {
+ if(e.classname == "droppedweapon")
+ continue;
+ if not(e.flags & FL_ITEM)
+ continue;
+ WaypointSprite_Spawn(
+ s,
+ 1, 0,
+ world, e.origin,
+ self, 0,
+ world, enemy,
+ 0
+ );
+ }
+ }
+ }
else
sprint(cl, strcat("The ^2", W_Name(wpn), "^7 is ^1NOT AVAILABLE^7 in this map\n") );
}
More information about the nexuiz-commits
mailing list