Xonotic
sv_breakablehook.qc File Reference
+ Include dependency graph for sv_breakablehook.qc:

Go to the source code of this file.

Functions

 MUTATOR_HOOKFUNCTION (breakablehook, Damage_Calculate)
 
 REGISTER_MUTATOR (breakablehook, cvar("g_breakablehook"))
 

Variables

bool autocvar_g_breakablehook
 
bool autocvar_g_breakablehook_owner
 

Function Documentation

◆ MUTATOR_HOOKFUNCTION()

MUTATOR_HOOKFUNCTION ( breakablehook  ,
Damage_Calculate   
)

Definition at line 11 of file sv_breakablehook.qc.

References Damage(), DIFF_TEAM, DMG_NOWEP, entity(), HITTYPE_SPLASH, M_ARGV, and RemoveHook().

12 {
13  entity frag_attacker = M_ARGV(1, entity);
14  entity frag_target = M_ARGV(2, entity);
15 
16  if(frag_target.classname == "grapplinghook")
17  {
19  || (!autocvar_g_breakablehook_owner && frag_attacker == frag_target.realowner)
20  ) { M_ARGV(4, float) = 0; }
21 
22  // hurt the owner of the hook
23  if(DIFF_TEAM(frag_attacker, frag_target.realowner))
24  {
25  Damage (frag_target.realowner, frag_attacker, frag_attacker, 5, WEP_HOOK.m_id | HITTYPE_SPLASH, DMG_NOWEP, frag_target.realowner.origin, '0 0 0'); // TODO: should get weapon entity from mutator hook
26  RemoveHook(frag_target);
27  return; // dead
28  }
29  }
30 }
const int HITTYPE_SPLASH
automatically set by RadiusDamage
Definition: all.qh:27
entity() spawn
#define DIFF_TEAM(a, b)
Definition: teams.qh:240
bool autocvar_g_breakablehook
#define DMG_NOWEP
Definition: damage.qh:126
void Damage(entity targ, entity inflictor, entity attacker, float damage, int deathtype,.entity weaponentity, vector hitloc, vector force)
Definition: damage.qc:583
#define M_ARGV(x, type)
Definition: events.qh:17
bool autocvar_g_breakablehook_owner
void RemoveHook(entity this)
Definition: hook.qc:96
+ Here is the call graph for this function:

◆ REGISTER_MUTATOR()

REGISTER_MUTATOR ( breakablehook  ,
cvar("g_breakablehook")   
)

Variable Documentation

◆ autocvar_g_breakablehook

bool autocvar_g_breakablehook

Definition at line 8 of file sv_breakablehook.qc.

◆ autocvar_g_breakablehook_owner

bool autocvar_g_breakablehook_owner

Definition at line 9 of file sv_breakablehook.qc.