From: Mario Date: Tue, 3 Jan 2017 12:37:45 +0000 (+1000) Subject: Merge branch 'master' into Mario/wepent_experimental X-Git-Tag: xonotic-v0.8.2~326^2~1 X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=50d8efb863874f811bdcc118d7e873836902e453;p=xonotic%2Fxonotic-data.pk3dir.git Merge branch 'master' into Mario/wepent_experimental # Conflicts: # qcsrc/common/mutators/mutator/overkill/sv_overkill.qc --- 50d8efb863874f811bdcc118d7e873836902e453 diff --cc qcsrc/common/mutators/mutator/overkill/sv_overkill.qc index ba2d98f49,589765337..98233d2e9 --- a/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc +++ b/qcsrc/common/mutators/mutator/overkill/sv_overkill.qc @@@ -118,23 -171,8 +118,6 @@@ MUTATOR_HOOKFUNCTION(ok, PlayerPreThink if(IS_DEAD(player) || !IS_PLAYER(player) || STAT(FROZEN, player)) return; - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) - { - .entity weaponentity = weaponentities[slot]; - entity thiswep = player.(weaponentity); - - if(player.ok_lastwep[slot] && player.ok_lastwep[slot] != WEP_Null) - { - Weapon newwep = player.ok_lastwep[slot]; - if(player.ok_lastwep[slot] == WEP_HMG) - newwep = WEP_MACHINEGUN; - if(player.ok_lastwep[slot] == WEP_RPC) - newwep = WEP_VORTEX; - thiswep.m_switchweapon = newwep; - player.ok_lastwep[slot] = WEP_Null; - } - } - ok_IncreaseCharge(player, PS(player).m_weapon.m_id); -- if(PHYS_INPUT_BUTTON_ATCK2(player)) if( !forbidWeaponUse(player) || player.weapon_blocked // allow if weapon is blocked || (round_handler_IsActive() && !round_handler_IsRoundStarted()) ) @@@ -173,17 -224,34 +156,25 @@@ PHYS_INPUT_BUTTON_ATCK2(player) = false; } --MUTATOR_HOOKFUNCTION(ok, PlayerSpawn) -{ - entity player = M_ARGV(0, entity); - - if(autocvar_g_overkill_ammo_charge) - { - FOREACH(Weapons, it != WEP_Null, LAMBDA(player.ammo_charge[it.m_id] = autocvar_g_overkill_ammo_charge_limit)); - - player.ok_use_ammocharge = 1; - player.ok_notice_time = time; - } - else - player.ok_use_ammocharge = 0; -} - + MUTATOR_HOOKFUNCTION(ok, PlayerWeaponSelect) { entity player = M_ARGV(0, entity); - // if player changed their weapon while dead, don't switch to their death weapon - if(player.impulse) - if(player.ok_lastwep) ++ for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) { - for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) - Weapon newwep = Weapons_from(player.ok_lastwep); - if(player.ok_lastwep == WEP_HMG.m_id) - newwep = WEP_MACHINEGUN; - if(player.ok_lastwep == WEP_RPC.m_id) - newwep = WEP_VORTEX; - PS(player).m_switchweapon = newwep; - player.ok_lastwep = 0; ++ .entity weaponentity = weaponentities[slot]; ++ entity thiswep = player.(weaponentity); ++ ++ if(player.ok_lastwep[slot] && player.ok_lastwep[slot] != WEP_Null) + { ++ Weapon newwep = player.ok_lastwep[slot]; ++ if(player.ok_lastwep[slot] == WEP_HMG) ++ newwep = WEP_MACHINEGUN; ++ if(player.ok_lastwep[slot] == WEP_RPC) ++ newwep = WEP_VORTEX; ++ thiswep.m_switchweapon = newwep; + player.ok_lastwep[slot] = WEP_Null; + } } } diff --cc qcsrc/server/client.qc index 3b0da8234,c1cce0c0a..47064506f --- a/qcsrc/server/client.qc +++ b/qcsrc/server/client.qc @@@ -694,19 -700,14 +694,21 @@@ void PutClientInServer(entity this delete(spot); // usefull for checking if there are spawnpoints, that let drop through the floor } - PS(this).m_switchweapon = w_getbestweapon(this); - this.cnt = -1; // W_LastWeapon will not complain - PS(this).m_weapon = WEP_Null; - this.weaponname = ""; - PS(this).m_switchingweapon = WEP_Null; + for(int slot = 0; slot < MAX_WEAPONSLOTS; ++slot) + { + .entity weaponentity = weaponentities[slot]; + if(slot == 0) + this.(weaponentity).m_switchweapon = w_getbestweapon(this, weaponentity); + else + this.(weaponentity).m_switchweapon = WEP_Null; + this.(weaponentity).m_weapon = WEP_Null; + this.(weaponentity).weaponname = ""; + this.(weaponentity).m_switchingweapon = WEP_Null; + this.(weaponentity).cnt = -1; + } + MUTATOR_CALLHOOK(PlayerWeaponSelect, this); + if (!warmup_stage && !this.alivetime) this.alivetime = time;