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()) )
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;
+ }
}
}
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;