X-Git-Url: https://de.git.xonotic.org/?p=xonotic%2Fxonotic-data.pk3dir.git;a=blobdiff_plain;f=qcsrc%2Fserver%2Fweapons%2Fselection.qc;h=8c6c0eaac6f4283f231ff11fc4438e22f523801f;hp=70284a8f4b421055768b2db0658199ab7d4bd83c;hb=c039d054a46888048d214000273ccfc63e4611b6;hpb=10c0e93c75ef6f408e3357bd5fb46c721e7e0576 diff --git a/qcsrc/server/weapons/selection.qc b/qcsrc/server/weapons/selection.qc index 70284a8f4..8c6c0eaac 100644 --- a/qcsrc/server/weapons/selection.qc +++ b/qcsrc/server/weapons/selection.qc @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include #include @@ -21,7 +21,7 @@ void Send_WeaponComplain(entity e, float wpn, float type) void Weapon_whereis(Weapon this, entity cl) { if (!autocvar_g_showweaponspawns) return; - for (entity it = NULL; (it = findfloat(it, weapon, this.m_id)); ) + FOREACH_ENTITY_FLOAT(weapon, this.m_id, { if (it.classname == "droppedweapon" && autocvar_g_showweaponspawns < 2) continue; @@ -29,7 +29,7 @@ void Weapon_whereis(Weapon this, entity cl) continue; entity wp = WaypointSprite_Spawn( WP_Weapon, - 1, 0, + -2, 0, NULL, it.origin + ('0 0 1' * it.maxs.z) * 1.2, cl, 0, NULL, enemy, @@ -37,7 +37,7 @@ void Weapon_whereis(Weapon this, entity cl) RADARICON_NONE ); wp.wp_extra = this.m_id; - } + }); } bool client_hasweapon(entity this, Weapon wpn, float andammo, bool complain) @@ -75,7 +75,7 @@ bool client_hasweapon(entity this, Weapon wpn, float andammo, bool complain) // always allow selecting the Mine Layer if we placed mines, so that we can detonate them if(wpn == WEP_MINE_LAYER) - FOREACH_ENTITY_CLASS("mine", it.owner == this, + IL_EACH(g_mines, it.owner == this, { f = 1; break; // no need to continue @@ -101,7 +101,15 @@ bool client_hasweapon(entity this, Weapon wpn, float andammo, bool complain) if (weaponsInMap & WepSet_FromWeapon(wpn)) { Send_WeaponComplain(this, wpn.m_id, 1); - Weapon_whereis(wpn, this); + if(autocvar_g_showweaponspawns < 3) + Weapon_whereis(wpn, this); + else + { + FOREACH(Weapons, it.impulse == wpn.impulse, + { + Weapon_whereis(it, this); + }); + } } else { @@ -264,8 +272,11 @@ void W_SwitchWeapon(entity this, Weapon w) } else if(!forbidWeaponUse(this)) { entity actor = this; - .entity weaponentity = weaponentities[0]; // TODO: unhardcode - w.wr_reload(w, actor, weaponentity); + for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + { + .entity weaponentity = weaponentities[slot]; + w.wr_reload(w, actor, weaponentity); + } } }