Xonotic QuakeC
The free, fast arena FPS with crisp movement and a wide array of weapons
bloodloss.qc File Reference
#include "bloodloss.qh"
Include dependency graph for bloodloss.qc:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

 MUTATOR_HOOKFUNCTION (bloodloss, BuildMutatorsPrettyString)
 MUTATOR_HOOKFUNCTION (bloodloss, BuildMutatorsString)
 MUTATOR_HOOKFUNCTION (bloodloss, PlayerCanCrouch)
 MUTATOR_HOOKFUNCTION (bloodloss, PlayerJump)
 MUTATOR_HOOKFUNCTION (bloodloss, PlayerPreThink)
 REGISTER_MUTATOR (bloodloss, autocvar_g_bloodloss)

Variables

float bloodloss_timer

Function Documentation

◆ MUTATOR_HOOKFUNCTION() [1/5]

MUTATOR_HOOKFUNCTION ( bloodloss ,
BuildMutatorsPrettyString  )

Definition at line 51 of file bloodloss.qc.

52{
53 M_ARGV(0, string) = strcat(M_ARGV(0, string), ", Blood loss");
54}
#define M_ARGV(x, type)
Definition events.qh:17
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))

References M_ARGV, and strcat().

◆ MUTATOR_HOOKFUNCTION() [2/5]

MUTATOR_HOOKFUNCTION ( bloodloss ,
BuildMutatorsString  )

Definition at line 46 of file bloodloss.qc.

47{
48 M_ARGV(0, string) = strcat(M_ARGV(0, string), ":bloodloss");
49}

References M_ARGV, and strcat().

◆ MUTATOR_HOOKFUNCTION() [3/5]

MUTATOR_HOOKFUNCTION ( bloodloss ,
PlayerCanCrouch  )

Definition at line 31 of file bloodloss.qc.

32{
33 entity player = M_ARGV(0, entity);
34 if(GetResource(player, RES_HEALTH) <= autocvar_g_bloodloss)
35 M_ARGV(1, bool) = true; // do_crouch
36}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
float autocvar_g_bloodloss
Definition stats.qh:328

References autocvar_g_bloodloss, entity(), GetResource(), and M_ARGV.

◆ MUTATOR_HOOKFUNCTION() [4/5]

MUTATOR_HOOKFUNCTION ( bloodloss ,
PlayerJump  )

Definition at line 38 of file bloodloss.qc.

39{
40 entity player = M_ARGV(0, entity);
41
42 if(GetResource(player, RES_HEALTH) <= autocvar_g_bloodloss)
43 return true;
44}

References autocvar_g_bloodloss, entity(), GetResource(), M_ARGV, and PlayerJump().

◆ MUTATOR_HOOKFUNCTION() [5/5]

MUTATOR_HOOKFUNCTION ( bloodloss ,
PlayerPreThink  )

Definition at line 13 of file bloodloss.qc.

14{
15 entity player = M_ARGV(0, entity);
16
17 if(game_stopped)
18 return; // during intermission, the player's health changes to strange values for the engine, let's not cause damage during this phase!
19
20 if(IS_PLAYER(player))
21 if(GetResource(player, RES_HEALTH) <= autocvar_g_bloodloss && !IS_DEAD(player) && time >= player.bloodloss_timer)
22 {
23 if(player.vehicle)
24 vehicles_exit(player.vehicle, VHEF_RELEASE); // TODO: boots player out of their vehicle each health rot tick!
25 if(player.event_damage)
26 player.event_damage(player, player, player, 1, DEATH_ROT.m_id, DMG_NOWEP, player.origin, '0 0 0');
27 player.bloodloss_timer = time + 0.5 + random() * 0.5;
28 }
29}
#define IS_DEAD(s)
Definition player.qh:245
#define IS_PLAYER(s)
Definition player.qh:243
float game_stopped
Definition stats.qh:81
float time
#define DMG_NOWEP
Definition damage.qh:104
float random(void)
void vehicles_exit(entity vehic, bool eject)
const int VHEF_RELEASE
User pressed exit key 3 times fast (not implemented) or vehicle is dying.

References autocvar_g_bloodloss, DMG_NOWEP, entity(), game_stopped, GetResource(), IS_DEAD, IS_PLAYER, M_ARGV, PlayerPreThink, random(), time, vehicles_exit(), and VHEF_RELEASE.

◆ REGISTER_MUTATOR()

REGISTER_MUTATOR ( bloodloss ,
autocvar_g_bloodloss  )

References autocvar_g_bloodloss.

Variable Documentation

◆ bloodloss_timer

float bloodloss_timer

Definition at line 11 of file bloodloss.qc.