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

Go to the source code of this file.

Functions

 MUTATOR_HOOKFUNCTION (oknex_charge, GetPressedKeys)
 REGISTER_MUTATOR (oknex_charge, true)
void W_OverkillNex_Attack (Weapon thiswep, entity actor,.entity weaponentity, bool is_secondary)

Variables

float oknex_chargepool_pauseregen_finished
float oknex_lasthit

Function Documentation

◆ MUTATOR_HOOKFUNCTION()

MUTATOR_HOOKFUNCTION ( oknex_charge ,
GetPressedKeys  )

Definition at line 34 of file oknex.qc.

35{
36 entity player = M_ARGV(0, entity);
37
38 // WEAPONTODO
39 if (!WEP_CVAR(WEP_OVERKILL_NEX, charge) || !WEP_CVAR(WEP_OVERKILL_NEX, charge_velocity_rate))
40 return;
41
42 for (int slot = 0; slot < MAX_WEAPONSLOTS; ++slot)
43 {
44 .entity weaponentity = weaponentities[slot];
45
46 if (player.(weaponentity).m_weapon == WEP_OVERKILL_NEX && WEP_CVAR(WEP_OVERKILL_NEX, charge) && WEP_CVAR(WEP_OVERKILL_NEX, charge_velocity_rate) && vdist(vec2(player.velocity), >, WEP_CVAR(WEP_OVERKILL_NEX, charge_minspeed)))
47 {
48 float xyspeed = vlen(vec2(player.velocity));
49 // add a maximum of charge_velocity_rate when going fast (f = 1), gradually increasing from minspeed (f = 0) to maxspeed
50 xyspeed = min(xyspeed, WEP_CVAR(WEP_OVERKILL_NEX, charge_maxspeed));
51 float f = (xyspeed - WEP_CVAR(WEP_OVERKILL_NEX, charge_minspeed)) / (WEP_CVAR(WEP_OVERKILL_NEX, charge_maxspeed) - WEP_CVAR(WEP_OVERKILL_NEX, charge_minspeed));
52 // add the extra charge
53 player.(weaponentity).oknex_charge = min(1, player.(weaponentity).oknex_charge + WEP_CVAR(WEP_OVERKILL_NEX, charge_velocity_rate) * f * PHYS_INPUT_TIMELENGTH);
54 }
55 }
56}
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
#define M_ARGV(x, type)
Definition events.qh:17
#define PHYS_INPUT_TIMELENGTH
Definition player.qh:253
float vlen(vector v)
float min(float f,...)
#define vdist(v, cmp, f)
Vector distance comparison, avoids sqrt()
Definition vector.qh:8
#define vec2(...)
Definition vector.qh:90
#define WEP_CVAR(wep, name)
Definition all.qh:337
const int MAX_WEAPONSLOTS
Definition weapon.qh:16
entity weaponentities[MAX_WEAPONSLOTS]
Definition weapon.qh:17
float oknex_charge
Definition wepent.qh:8

References entity(), GetPressedKeys(), M_ARGV, MAX_WEAPONSLOTS, min(), oknex_charge, PHYS_INPUT_TIMELENGTH, vdist, vec2, vlen(), weaponentities, and WEP_CVAR.

◆ REGISTER_MUTATOR()

REGISTER_MUTATOR ( oknex_charge ,
true  )

References oknex_charge.

◆ W_OverkillNex_Attack()

void W_OverkillNex_Attack ( Weapon thiswep,
entity actor,
.entity weaponentity,
bool is_secondary )

Definition at line 58 of file oknex.qc.

59{
60 float mydmg = WEP_CVAR_BOTH(WEP_OVERKILL_NEX, !is_secondary, damage);
61 float myforce = WEP_CVAR_BOTH(WEP_OVERKILL_NEX, !is_secondary, force);
62
63 float flying = IsFlying(actor); // do this BEFORE to make the trace values from FireRailgunBullet last
64
65 float charge;
66 if (WEP_CVAR(WEP_OVERKILL_NEX, charge))
67 {
68 charge = WEP_CVAR(WEP_OVERKILL_NEX, charge_mindmg) / mydmg + (1 - WEP_CVAR(WEP_OVERKILL_NEX, charge_mindmg) / mydmg) * actor.(weaponentity).oknex_charge;
69 actor.(weaponentity).oknex_charge *= WEP_CVAR(WEP_OVERKILL_NEX, charge_shot_multiplier); // do this AFTER setting mydmg/myforce
70 // O RLY? -- divVerent
71 // YA RLY -- FruitieX
72 }
73 else
74 charge = 1;
75 mydmg *= charge;
76 myforce *= charge;
77
78 W_SetupShot(actor, weaponentity, true, 5, SND_OK_NEX_FIRE, CH_WEAPON_A, mydmg, thiswep.m_id);
79 if (charge > WEP_CVAR(WEP_OVERKILL_NEX, charge_animlimit) && WEP_CVAR(WEP_OVERKILL_NEX, charge_animlimit)) // if the OverkillNex is overcharged, we play an extra sound
80 sound(actor, CH_WEAPON_B, SND_OK_NEX_CHARGE, VOL_BASE * (charge - 0.5 * WEP_CVAR(WEP_OVERKILL_NEX, charge_animlimit)) / (1 - 0.5 * WEP_CVAR(WEP_OVERKILL_NEX, charge_animlimit)), ATTN_NORM);
81
82 yoda = 0;
85 mydmg,
86 true,
87 myforce,
88 WEP_CVAR_BOTH(WEP_OVERKILL_NEX, !is_secondary, damagefalloff_mindist),
89 WEP_CVAR_BOTH(WEP_OVERKILL_NEX, !is_secondary, damagefalloff_maxdist),
90 WEP_CVAR_BOTH(WEP_OVERKILL_NEX, !is_secondary, damagefalloff_halflife),
91 WEP_CVAR_BOTH(WEP_OVERKILL_NEX, !is_secondary, damagefalloff_forcehalflife),
92 thiswep.m_id
93 );
94
95 if (yoda && flying)
96 Send_Notification(NOTIF_ONE, actor, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA);
97 if (impressive_hits && actor.oknex_lasthit)
98 {
99 Send_Notification(NOTIF_ONE, actor, MSG_ANNCE, ANNCE_ACHIEVEMENT_IMPRESSIVE);
100 impressive_hits = 0; // only every second time
101 }
102
103 actor.oknex_lasthit = impressive_hits;
104
105 //beam and muzzle flash done on client
106 SendCSQCVortexBeamParticle(actor, charge);
107
108 W_DecreaseAmmo(thiswep, actor, WEP_CVAR_BOTH(WEP_OVERKILL_NEX, !is_secondary, ammo), weaponentity);
109}
int m_id
Definition weapon.qh:43
bool IsFlying(entity this)
Definition player.qc:843
const float ATTN_NORM
float yoda
Definition damage.qh:48
int impressive_hits
Definition damage.qh:49
void Send_Notification(NOTIF broadcast, entity client, MSG net_type, Notification net_name,...count)
Definition all.qc:1573
const float VOL_BASE
Definition sound.qh:36
const int CH_WEAPON_A
Definition sound.qh:7
#define sound(e, c, s, v, a)
Definition sound.qh:52
const int CH_WEAPON_B
Definition sound.qh:8
float ammo
Definition sv_turrets.qh:43
void FireRailgunBullet(entity this,.entity weaponentity, vector start, vector end, float bdamage, bool headshot_notify, float bforce, float mindist, float maxdist, float halflifedist, float forcehalflifedist, int deathtype)
Definition tracing.qc:231
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 SendCSQCVortexBeamParticle(entity player, float charge)
Definition vortex.qc:37
#define WEP_CVAR_BOTH(wep, isprimary, name)
Definition all.qh:340
int max_shot_distance
Definition weapon.qh:245
void W_DecreaseAmmo(Weapon wep, entity actor, float ammo_use,.entity weaponentity)

References ammo, ATTN_NORM, CH_WEAPON_A, CH_WEAPON_B, entity(), FireRailgunBullet(), impressive_hits, IsFlying(), Weapon::m_id, max_shot_distance, oknex_charge, Send_Notification(), SendCSQCVortexBeamParticle(), sound, VOL_BASE, W_DecreaseAmmo(), W_SetupShot, w_shotdir, w_shotorg, WEP_CVAR, WEP_CVAR_BOTH, and yoda.

Variable Documentation

◆ oknex_chargepool_pauseregen_finished

float oknex_chargepool_pauseregen_finished

Definition at line 111 of file oknex.qc.

◆ oknex_lasthit

float oknex_lasthit

Definition at line 4 of file oknex.qc.