X-Git-Url: http://de.git.xonotic.org/?a=blobdiff_plain;f=qcsrc%2Fserver%2Fweapons%2Fweaponsystem.qc;h=0410c2f9ec45129c606efd30d0d7806fbbcc824d;hb=bac31b218e747443d2e4c1f8d6b26b2bb71dddb8;hp=6e74738c738eaf5a1bbabcf155bef94c74416ad2;hpb=4e89b0f36a79a964d87b4bfc449667466e00641d;p=xonotic%2Fxonotic-data.pk3dir.git diff --git a/qcsrc/server/weapons/weaponsystem.qc b/qcsrc/server/weapons/weaponsystem.qc index 6e74738c7..0410c2f9e 100644 --- a/qcsrc/server/weapons/weaponsystem.qc +++ b/qcsrc/server/weapons/weaponsystem.qc @@ -445,6 +445,28 @@ bool weaponLocked(entity player) return false; } +void W_ResetGunAlign(entity player, int preferred_alignment) +{ + if(W_DualWielding(player)) + preferred_alignment = 3; // right align, the second gun will default to left + + // clear current weapon slots' alignments so we can redo the calculations! + for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + { + .entity weaponentity = weaponentities[slot]; + if (player.(weaponentity)) + player.(weaponentity).m_gunalign = 0; + } + + // now set the new values + for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + { + .entity weaponentity = weaponentities[slot]; + if (player.(weaponentity)) + player.(weaponentity).m_gunalign = W_GunAlign(player.(weaponentity), preferred_alignment); + } +} + .bool hook_switchweapon; void W_WeaponFrame(Player actor, .entity weaponentity) @@ -783,6 +805,8 @@ void W_Reload(entity actor, .entity weaponentity, float sent_ammo_min, Sound sen { if (!(actor.items & IT_UNLIMITED_AMMO)) { + if (autocvar_g_weaponswitch_debug == 2 && weaponslot(weaponentity) > 0) + return; // in this case the primary weapon will do the switching when it runs out of ammo (TODO: do this same check but for other slots) if (IS_REAL_CLIENT(actor) && actor.reload_complain < time) { play2(actor, SND(UNAVAILABLE));