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

Go to the source code of this file.

Functions

 MUTATOR_HOOKFUNCTION (okhmg_nadesupport, Nade_Damage)
 REGISTER_MUTATOR (okhmg_nadesupport, true)
void W_OverkillHeavyMachineGun_Attack_Auto (Weapon thiswep, entity actor,.entity weaponentity, int fire)

Function Documentation

◆ MUTATOR_HOOKFUNCTION()

MUTATOR_HOOKFUNCTION ( okhmg_nadesupport ,
Nade_Damage  )

Definition at line 6 of file okhmg.qc.

7{
8 if (M_ARGV(1, entity) != WEP_OVERKILL_HMG) return;
9 return = true;
10 M_ARGV(3, float) /* damage */ = (M_ARGV(0, entity)).max_health * 0.1;
11}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
float max_health
#define M_ARGV(x, type)
Definition events.qh:17

References entity(), M_ARGV, and max_health.

◆ REGISTER_MUTATOR()

REGISTER_MUTATOR ( okhmg_nadesupport ,
true  )

◆ W_OverkillHeavyMachineGun_Attack_Auto()

void W_OverkillHeavyMachineGun_Attack_Auto ( Weapon thiswep,
entity actor,
.entity weaponentity,
int fire )

Definition at line 13 of file okhmg.qc.

14{
15 if (!PHYS_INPUT_BUTTON_ATCK(actor))
16 {
17 w_ready(thiswep, actor, weaponentity, fire);
18 return;
19 }
20
21 if((!thiswep.wr_checkammo1(thiswep, actor, weaponentity) && !(actor.items & IT_UNLIMITED_AMMO)) || (!StatusEffects_active(STATUSEFFECT_Superweapon, actor) && !(actor.items & IT_UNLIMITED_SUPERWEAPONS)))
22 {
23 W_SwitchWeapon_Force(actor, w_getbestweapon(actor, weaponentity), weaponentity);
24 w_ready(thiswep, actor, weaponentity, fire);
25 return;
26 }
27
28 W_DecreaseAmmo(WEP_OVERKILL_HMG, actor, WEP_CVAR_PRI(WEP_OVERKILL_HMG, ammo), weaponentity);
29
30 W_SetupShot(actor, weaponentity, true, 0, SND_HMG_FIRE, CH_WEAPON_A, WEP_CVAR_PRI(WEP_OVERKILL_HMG, damage), WEP_OVERKILL_HMG.m_id);
31
33 {
34 actor.punchangle_x = random () - 0.5;
35 actor.punchangle_y = random () - 0.5;
36 }
37
38 float okhmg_spread = bound(WEP_CVAR_PRI(WEP_OVERKILL_HMG, spread_min), WEP_CVAR_PRI(WEP_OVERKILL_HMG, spread_min) + (WEP_CVAR_PRI(WEP_OVERKILL_HMG, spread_add) * actor.(weaponentity).misc_bulletcounter), WEP_CVAR_PRI(WEP_OVERKILL_HMG, spread_max));
39 fireBullet(actor, weaponentity, w_shotorg, w_shotdir, okhmg_spread, WEP_CVAR_PRI(WEP_OVERKILL_HMG, solidpenetration), WEP_CVAR_PRI(WEP_OVERKILL_HMG, damage), 0, WEP_CVAR_PRI(WEP_OVERKILL_HMG, force), WEP_OVERKILL_HMG.m_id, EFFECT_RIFLE);
40
41 actor.(weaponentity).misc_bulletcounter = actor.(weaponentity).misc_bulletcounter + 1;
42
43 W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir);
44
45 if (autocvar_g_casings >= 2) // casing code
46 {
47 makevectors(actor.v_angle); // for some reason, this is lost
48 SpawnCasing(((random () * 50 + 50) * v_right) - (v_forward * (random () * 25 + 25)) - ((random () * 5 - 70) * v_up), vectoangles(v_forward), 3, actor, weaponentity);
49 }
50
51 ATTACK_FINISHED(actor, weaponentity) = time + WEP_CVAR_PRI(WEP_OVERKILL_HMG, refire) * W_WeaponRateFactor(actor);
52 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_OVERKILL_HMG, refire), W_OverkillHeavyMachineGun_Attack_Auto);
53}
void SpawnCasing(vector vel, vector ang, int casingtype, entity casingowner,.entity weaponentity)
Definition casings.qc:17
int autocvar_g_casings
Definition casings.qh:17
virtual void wr_checkammo1()
(SERVER) checks ammo for weapon primary
Definition weapon.qh:92
const int IT_UNLIMITED_AMMO
Definition item.qh:23
const int IT_UNLIMITED_SUPERWEAPONS
Definition item.qh:24
#define PHYS_INPUT_BUTTON_ATCK(s)
Definition player.qh:150
float W_WeaponRateFactor(entity this)
vector v_up
float time
vector v_right
vector v_forward
void W_SwitchWeapon_Force(Player this, Weapon w,.entity weaponentity)
Definition selection.qc:246
float bound(float min, float value, float max)
float random(void)
vector vectoangles(vector v)
void W_OverkillHeavyMachineGun_Attack_Auto(Weapon thiswep, entity actor,.entity weaponentity, int fire)
Definition okhmg.qc:13
#define makevectors
Definition post.qh:21
#define w_getbestweapon(ent, wepent)
Definition selection.qh:23
float misc_bulletcounter
Definition common.qh:19
const int CH_WEAPON_A
Definition sound.qh:7
bool StatusEffects_active(StatusEffect this, entity actor)
float ammo
Definition sv_turrets.qh:43
void fireBullet(entity this,.entity weaponentity, vector start, vector dir, float spread, float max_solid_penetration, float damage, float headshot_multiplier, float force, float dtype, entity tracer_effect)
Definition tracing.qc:544
bool autocvar_g_norecoil
Definition tracing.qh:16
vector w_shotdir
Definition tracing.qh:20
vector w_shotorg
Definition tracing.qh:19
#define W_SetupShot(ent, wepent, antilag, recoil, snd, chan, maxdamage, deathtype)
Definition tracing.qh:34
void W_MuzzleFlash(Weapon thiswep, entity actor,.entity weaponentity, vector shotorg, vector shotdir)
Definition all.qc:728
#define WEP_CVAR_PRI(wep, name)
Definition all.qh:322
void W_DecreaseAmmo(Weapon wep, entity actor, float ammo_use,.entity weaponentity)
void weapon_thinkf(entity actor,.entity weaponentity, WFRAME fr, float t, void(Weapon thiswep, entity actor,.entity weaponentity, int fire) func)
void w_ready(Weapon thiswep, entity actor,.entity weaponentity, int fire)
#define ATTACK_FINISHED(ent, w)

References ammo, ATTACK_FINISHED, autocvar_g_casings, autocvar_g_norecoil, bound(), CH_WEAPON_A, entity(), fireBullet(), IT_UNLIMITED_AMMO, IT_UNLIMITED_SUPERWEAPONS, makevectors, misc_bulletcounter, PHYS_INPUT_BUTTON_ATCK, random(), SpawnCasing(), StatusEffects_active(), time, v_forward, v_right, v_up, vectoangles(), W_DecreaseAmmo(), w_getbestweapon, W_MuzzleFlash(), W_OverkillHeavyMachineGun_Attack_Auto(), w_ready(), W_SetupShot, w_shotdir, w_shotorg, W_SwitchWeapon_Force(), W_WeaponRateFactor(), weapon_thinkf(), WEP_CVAR_PRI, and Weapon::wr_checkammo1().

Referenced by W_OverkillHeavyMachineGun_Attack_Auto().