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)
9 return;
10 return = true;
11 M_ARGV(3, float) /* damage */ = (M_ARGV(0, entity)).max_health * 0.1;
12}
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 14 of file okhmg.qc.

15{
16 if (!PHYS_INPUT_BUTTON_ATCK(actor))
17 {
18 w_ready(thiswep, actor, weaponentity, fire);
19 return;
20 }
21
22 if ((!thiswep.wr_checkammo1(thiswep, actor, weaponentity) && !(actor.items & IT_UNLIMITED_AMMO))
23 || (!StatusEffects_active(STATUSEFFECT_Superweapon, actor) && !(actor.items & IT_UNLIMITED_SUPERWEAPONS)))
24 {
25 W_SwitchWeapon_Force(actor, w_getbestweapon(actor, weaponentity), weaponentity);
26 w_ready(thiswep, actor, weaponentity, fire);
27 return;
28 }
29
30 W_DecreaseAmmo(WEP_OVERKILL_HMG, actor, WEP_CVAR_PRI(WEP_OVERKILL_HMG, ammo), weaponentity);
31
32 W_SetupShot(actor, weaponentity, true, 0, SND_HMG_FIRE, CH_WEAPON_A, WEP_CVAR_PRI(WEP_OVERKILL_HMG, damage), WEP_OVERKILL_HMG.m_id);
33
35 {
36 actor.punchangle_x = random () - 0.5;
37 actor.punchangle_y = random () - 0.5;
38 }
39
40 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));
41 fireBullet(actor, weaponentity, w_shotorg, w_shotdir,
42 okhmg_spread,
43 WEP_CVAR_PRI(WEP_OVERKILL_HMG, solidpenetration),
44 WEP_CVAR_PRI(WEP_OVERKILL_HMG, damage),
45 0,
46 WEP_CVAR_PRI(WEP_OVERKILL_HMG, force),
47 WEP_OVERKILL_HMG.m_id,
48 EFFECT_RIFLE
49 );
50
51 ++actor.(weaponentity).misc_bulletcounter;
52
53 W_MuzzleFlash(thiswep, actor, weaponentity, w_shotorg, w_shotdir);
54
55 if (autocvar_g_casings >= 2) // casing code
56 {
57 makevectors(actor.v_angle); // for some reason, this is lost
58 SpawnCasing(((random () * 50 + 50) * v_right) - (v_forward * (random () * 25 + 25)) - ((random () * 5 - 70) * v_up), vectoangles(v_forward), 3, actor, weaponentity);
59 }
60
61 ATTACK_FINISHED(actor, weaponentity) = time + WEP_CVAR_PRI(WEP_OVERKILL_HMG, refire) * W_WeaponRateFactor(actor);
62 weapon_thinkf(actor, weaponentity, WFRAME_FIRE1, WEP_CVAR_PRI(WEP_OVERKILL_HMG, refire), W_OverkillHeavyMachineGun_Attack_Auto);
63}
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:100
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:152
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:237
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:14
#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:537
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:715
#define WEP_CVAR_PRI(wep, name)
Definition all.qh:338
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().