if(IS_DEAD(player) || !IS_PLAYER(player) || STAT(FROZEN, player))
return;
- if(player.ok_lastwep)
- {
- 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;
- }
-
ok_IncreaseCharge(player, PS(player).m_weapon.m_id);
if(PHYS_INPUT_BUTTON_ATCK2(player))
}
else
player.ok_use_ammocharge = 0;
+}
- // if player changed their weapon while dead, don't switch to their death weapon
- if(player.impulse)
+MUTATOR_HOOKFUNCTION(ok, PlayerWeaponSelect)
+{
+ entity player = M_ARGV(0, entity);
+
+ if(player.ok_lastwep)
+ {
+ 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;
+ }
}
void self_spawnfunc_weapon_hmg(entity this) { spawnfunc_weapon_hmg(this); }
this.weaponname = "";
PS(this).m_switchingweapon = WEP_Null;
+ MUTATOR_CALLHOOK(PlayerWeaponSelect, this);
+
if (!warmup_stage && !this.alivetime)
this.alivetime = time;
/**/
MUTATOR_HOOKABLE(PlayerSpawn, EV_PlayerSpawn);
+/** called after a player's weapon is chosen so it can be overriden here */
+#define EV_PlayerWeaponSelect(i, o) \
+ /** player spawning */ i(entity, MUTATOR_ARGV_0_entity) \
+ /**/
+MUTATOR_HOOKABLE(PlayerWeaponSelect, EV_PlayerWeaponSelect);
+
/** called in reset_map */
#define EV_reset_map_global(i, o) \
/**/