float autocvar_g_touchexplode_damage;
float autocvar_g_touchexplode_edgedamage;
float autocvar_g_touchexplode_force;
+#define autocvar_g_bloodloss cvar("g_bloodloss")
float do_crouch = self.BUTTON_CROUCH;
if(self.hook.state)
do_crouch = 0;
- if(self.health <= g_bloodloss)
- do_crouch = 1;
if(self.vehicle)
do_crouch = 0;
if(self.freezetag_frozen)
}
}
- if(self.health <= g_bloodloss && self.deadflag == DEAD_NO)
- {
- if(self.bloodloss_timer < time)
- {
- self.event_damage(self, self, 1, DEATH_ROT, self.origin, '0 0 0');
- self.bloodloss_timer = time + 0.5 + random() * 0.5;
- }
- }
-
FixPlayermodel();
GrapplingHookFrame();
*/
void PlayerJump (void)
{
- if(self.freezetag_frozen)
- return; // no jumping in freezetag when frozen
+ if(MUTATOR_CALLHOOK(PlayerJump))
+ return;
float mjumpheight;
float doublejump;
if (!(self.flags & FL_JUMPRELEASED))
return;
- if(self.health <= g_bloodloss)
- return;
-
// sv_jumpspeedcap_min/sv_jumpspeedcap_max act as baseline
// velocity bounds. Final velocity is bound between (jumpheight *
// min + jumpheight) and (jumpheight * max + jumpheight);
// Globals
-float g_cloaked, g_footsteps, g_jump_grunt, g_grappling_hook, g_minstagib, g_norecoil, g_bloodloss;
+float g_cloaked, g_footsteps, g_jump_grunt, g_grappling_hook, g_minstagib, g_norecoil;
float g_warmup_limit;
float g_warmup_allguns;
float g_warmup_allow_timeout;
.float spectatee_status;
.float zoomstate;
-.float bloodloss_timer;
.float restriction;
.entity clientdata;
CHECK_MUTATOR_ADD("g_superspectate", mutator_superspec, 1);
CHECK_MUTATOR_ADD("g_pinata", mutator_pinata, !cvar("g_minstagib"));
CHECK_MUTATOR_ADD("g_midair", mutator_midair, 1);
+ CHECK_MUTATOR_ADD("g_bloodloss", mutator_bloodloss, !cvar("g_minstagib"));
CHECK_MUTATOR_ADD("g_sandbox", sandbox, 1);
#undef CHECK_MUTATOR_ADD
g_grappling_hook = cvar("g_grappling_hook");
g_jetpack = cvar("g_jetpack");
g_norecoil = cvar("g_norecoil");
- g_bloodloss = cvar("g_bloodloss");
sv_maxidle = cvar("sv_maxidle");
sv_maxidle_spectatorsareidle = cvar("sv_maxidle_spectatorsareidle");
sv_autotaunt = cvar("sv_autotaunt");
entity frag_attacker;
entity frag_target; // same as self
float frag_deathtype;
+
+MUTATOR_HOOKABLE(PlayerJump);
+ // called when a player presses the jump key
MUTATOR_HOOKABLE(GiveFragsForKill);
// called when someone was fragged by "self", and is expected to change frag_score to adjust scoring for the kill
return 1;
}
+MUTATOR_HOOKFUNCTION(freezetag_PlayerJump)
+{
+ if(self.freezetag_frozen)
+ return TRUE; // no jumping in freezetag when frozen
+
+ return FALSE;
+}
+
MUTATOR_HOOKFUNCTION(freezetag_ForbidThrowCurrentWeapon)
{
if (self.freezetag_frozen)
MUTATOR_HOOK(PlayerPreThink, freezetag_PlayerPreThink, CBC_ORDER_FIRST);
MUTATOR_HOOK(PlayerPhysics, freezetag_PlayerPhysics, CBC_ORDER_FIRST);
MUTATOR_HOOK(PlayerDamage_Calculate, freezetag_PlayerDamage_Calculate, CBC_ORDER_ANY);
+ MUTATOR_HOOK(PlayerJump, freezetag_PlayerJump, CBC_ORDER_ANY);
MUTATOR_HOOK(ForbidThrowCurrentWeapon, freezetag_ForbidThrowCurrentWeapon, CBC_ORDER_ANY);
MUTATOR_HOOK(ItemTouch, freezetag_ItemTouch, CBC_ORDER_ANY);
MUTATOR_HOOK(HavocBot_ChooseRule, freezetag_BotRoles, CBC_ORDER_ANY);
--- /dev/null
+.float bloodloss_timer;
+
+MUTATOR_HOOKFUNCTION(bloodloss_PlayerThink)
+{
+ if(IS_PLAYER(self))
+ if(self.health <= autocvar_g_bloodloss && self.deadflag == DEAD_NO)
+ {
+ self.BUTTON_CROUCH = TRUE;
+
+ if(time >= self.bloodloss_timer)
+ {
+ self.event_damage(self, self, 1, DEATH_ROT, self.origin, '0 0 0');
+ self.bloodloss_timer = time + 0.5 + random() * 0.5;
+ }
+ }
+
+ return FALSE;
+}
+
+MUTATOR_HOOKFUNCTION(bloodloss_PlayerJump)
+{
+ if(self.health <= autocvar_g_bloodloss)
+ return TRUE;
+
+ return FALSE;
+}
+
+MUTATOR_HOOKFUNCTION(bloodloss_BuildMutatorsString)
+{
+ ret_string = strcat(ret_string, ":bloodloss");
+ return FALSE;
+}
+
+MUTATOR_HOOKFUNCTION(bloodloss_BuildMutatorsPrettyString)
+{
+ ret_string = strcat(ret_string, ", Blood loss");
+ return FALSE;
+}
+
+MUTATOR_DEFINITION(mutator_bloodloss)
+{
+ MUTATOR_HOOK(PlayerPreThink, bloodloss_PlayerThink, CBC_ORDER_ANY);
+ MUTATOR_HOOK(PlayerJump, bloodloss_PlayerJump, CBC_ORDER_ANY);
+ MUTATOR_HOOK(BuildMutatorsString, bloodloss_BuildMutatorsString, CBC_ORDER_ANY);
+ MUTATOR_HOOK(BuildMutatorsPrettyString, bloodloss_BuildMutatorsPrettyString, CBC_ORDER_ANY);
+
+ return FALSE;
+}
MUTATOR_DECLARATION(mutator_touchexplode);
MUTATOR_DECLARATION(mutator_pinata);
MUTATOR_DECLARATION(mutator_midair);
+MUTATOR_DECLARATION(mutator_bloodloss);
MUTATOR_DECLARATION(sandbox);
mutators/mutator_touchexplode.qc
mutators/mutator_pinata.qc
mutators/mutator_midair.qc
+mutators/mutator_bloodloss.qc
../warpzonelib/anglestransform.qc
../warpzonelib/mathlib.qc
modifications = strcat(modifications, ", Hook");
if(g_weapon_stay && !g_cts)
modifications = strcat(modifications, ", Weapons stay");
- if(g_bloodloss > 0)
- modifications = strcat(modifications, ", Blood loss");
if(g_jetpack)
modifications = strcat(modifications, ", Jet pack");
if(autocvar_g_powerups == 0)