/**/ o(string, MUTATOR_ARGV_1_string) \
/**/
MUTATOR_HOOKABLE(WeaponModel, EV_WeaponModel);
+
+/** decides whether a player can crouch or not */
+#define EV_PlayerCanCrouch(i, o) \
+ /** player */ i(entity, MUTATOR_ARGV_0_entity) \
+ /** do_crouch */ i(bool, MUTATOR_ARGV_1_bool) \
+ /**/ o(bool, MUTATOR_ARGV_1_bool) \
+ /**/
+MUTATOR_HOOKABLE(PlayerCanCrouch, EV_PlayerCanCrouch);
return; // during intermission, the player's health changes to strange values for the engine, let's not cause damage during this phase!
if(IS_PLAYER(player))
- if(GetResource(player, RES_HEALTH) <= autocvar_g_bloodloss && !IS_DEAD(player))
+ if(GetResource(player, RES_HEALTH) <= autocvar_g_bloodloss && !IS_DEAD(player) && time >= player.bloodloss_timer)
{
- PHYS_INPUT_BUTTON_CROUCH(player) = true;
-
- if(time >= player.bloodloss_timer)
- {
- if(player.vehicle)
- vehicles_exit(player.vehicle, VHEF_RELEASE); // TODO: boots player out of their vehicle each health rot tick!
- if(player.event_damage)
- player.event_damage(player, player, player, 1, DEATH_ROT.m_id, DMG_NOWEP, player.origin, '0 0 0');
- player.bloodloss_timer = time + 0.5 + random() * 0.5;
- }
+ if(player.vehicle)
+ vehicles_exit(player.vehicle, VHEF_RELEASE); // TODO: boots player out of their vehicle each health rot tick!
+ if(player.event_damage)
+ player.event_damage(player, player, player, 1, DEATH_ROT.m_id, DMG_NOWEP, player.origin, '0 0 0');
+ player.bloodloss_timer = time + 0.5 + random() * 0.5;
}
}
+MUTATOR_HOOKFUNCTION(bloodloss, PlayerCanCrouch)
+{
+ entity player = M_ARGV(0, entity);
+ if(GetResource(player, RES_HEALTH) <= autocvar_g_bloodloss)
+ M_ARGV(1, bool) = true; // do_crouch
+}
+
MUTATOR_HOOKFUNCTION(bloodloss, PlayerJump)
{
entity player = M_ARGV(0, entity);
#endif
#ifdef CSQC
+MUTATOR_HOOKFUNCTION(bloodloss, PlayerCanCrouch)
+{
+ if(STAT(HEALTH) <= STAT(BLOODLOSS))
+ M_ARGV(1, bool) = true; // do_crouch
+}
MUTATOR_HOOKFUNCTION(bloodloss, PlayerJump)
{
if(STAT(HEALTH) <= STAT(BLOODLOSS))