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

Go to the source code of this file.

Functions

 MUTATOR_HOOKFUNCTION (vh, GrappleHookThink)
 REGISTER_MUTATOR (vh, expr_evaluate(autocvar_g_vampirehook))

Variables

string autocvar_g_vampirehook
float autocvar_g_vampirehook_damage
float autocvar_g_vampirehook_damagerate
float autocvar_g_vampirehook_health_steal
bool autocvar_g_vampirehook_teamheal
float last_dmg

Function Documentation

◆ MUTATOR_HOOKFUNCTION()

MUTATOR_HOOKFUNCTION ( vh ,
GrappleHookThink  )

Definition at line 13 of file sv_vampirehook.qc.

14{
15 entity thehook = M_ARGV(0, entity);
16
17 if (!autocvar_g_vampirehook_damage || thehook.last_dmg > time || time < game_starttime)
18 return;
19
20 entity hook_owner = thehook.realowner;
21 entity hook_aiment = thehook.aiment;
22
23 if (hook_owner != hook_aiment && IS_PLAYER(hook_aiment) && !STAT(FROZEN, hook_aiment)
24 && (DIFF_TEAM(hook_owner, hook_aiment) || autocvar_g_vampirehook_teamheal)
25 && GetResource(hook_aiment, RES_HEALTH) > 0)
26 {
27 thehook.last_dmg = time + autocvar_g_vampirehook_damagerate;
28 hook_owner.hitsound_damage_dealt += autocvar_g_vampirehook_damage;
29 entity dmgent = ((SAME_TEAM(hook_owner, hook_aiment) && autocvar_g_vampirehook_teamheal) ? hook_owner : hook_aiment);
30 Damage(dmgent, thehook, hook_owner, autocvar_g_vampirehook_damage, WEP_HOOK.m_id, DMG_NOWEP, thehook.origin, '0 0 0');
31 entity targ = ((SAME_TEAM(hook_owner, hook_aiment)) ? hook_aiment : hook_owner);
33
34 if(dmgent == hook_owner)
35 TakeResource(dmgent, RES_HEALTH, autocvar_g_vampirehook_damage); // FIXME: friendly fire?!
36 }
37}
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.
void TakeResource(entity receiver, Resource res_type, float amount)
Takes an entity some resource.
#define M_ARGV(x, type)
Definition events.qh:17
#define IS_PLAYER(s)
Definition player.qh:243
float game_starttime
Definition stats.qh:82
float time
void Damage(entity targ, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
Definition damage.qc:503
bool Heal(entity targ, entity inflictor, float amount, float limit)
Definition damage.qc:987
#define DMG_NOWEP
Definition damage.qh:104
int autocvar_g_pickup_healthsmall_max
Definition health.qh:24
#define STAT(...)
Definition stats.qh:82
float autocvar_g_vampirehook_health_steal
bool autocvar_g_vampirehook_teamheal
float autocvar_g_vampirehook_damagerate
float autocvar_g_vampirehook_damage
#define SAME_TEAM(a, b)
Definition teams.qh:241
#define DIFF_TEAM(a, b)
Definition teams.qh:242

References autocvar_g_pickup_healthsmall_max, autocvar_g_vampirehook_damage, autocvar_g_vampirehook_damagerate, autocvar_g_vampirehook_health_steal, autocvar_g_vampirehook_teamheal, Damage(), DIFF_TEAM, DMG_NOWEP, entity(), game_starttime, GetResource(), Heal(), IS_PLAYER, M_ARGV, SAME_TEAM, STAT, TakeResource(), and time.

◆ REGISTER_MUTATOR()

REGISTER_MUTATOR ( vh ,
expr_evaluate(autocvar_g_vampirehook)  )

Variable Documentation

◆ autocvar_g_vampirehook

string autocvar_g_vampirehook

Definition at line 3 of file sv_vampirehook.qc.

Referenced by REGISTER_MUTATOR().

◆ autocvar_g_vampirehook_damage

float autocvar_g_vampirehook_damage

Definition at line 7 of file sv_vampirehook.qc.

Referenced by MUTATOR_HOOKFUNCTION().

◆ autocvar_g_vampirehook_damagerate

float autocvar_g_vampirehook_damagerate

Definition at line 8 of file sv_vampirehook.qc.

Referenced by MUTATOR_HOOKFUNCTION().

◆ autocvar_g_vampirehook_health_steal

float autocvar_g_vampirehook_health_steal

Definition at line 9 of file sv_vampirehook.qc.

Referenced by MUTATOR_HOOKFUNCTION().

◆ autocvar_g_vampirehook_teamheal

bool autocvar_g_vampirehook_teamheal

Definition at line 6 of file sv_vampirehook.qc.

Referenced by MUTATOR_HOOKFUNCTION().

◆ last_dmg

float last_dmg

Definition at line 11 of file sv_vampirehook.qc.