7 float autocvar_g_weapon_charge_colormod_red_full;
8 float autocvar_g_weapon_charge_colormod_red_half;
9 float autocvar_g_weapon_charge_colormod_green_full;
10 float autocvar_g_weapon_charge_colormod_blue_full;
11 float autocvar_g_weapon_charge_colormod_blue_half;
12 float autocvar_g_weapon_charge_colormod_green_half;
13 float autocvar_g_weapon_charge_colormod_hdrmultiplier;
17 if (!
WEP_CVAR(vortex, charge))
return '0 0 0';
18 float charge = wepent.vortex_charge;
19 float animlimit =
WEP_CVAR(vortex, charge_animlimit);
20 float f = autocvar_g_weapon_charge_colormod_hdrmultiplier *
min(1, charge / animlimit);
22 g.x = f * autocvar_g_weapon_charge_colormod_red_half;
23 g.y = f * autocvar_g_weapon_charge_colormod_green_half;
24 g.z = f * autocvar_g_weapon_charge_colormod_blue_half;
25 if (charge > animlimit)
27 f = autocvar_g_weapon_charge_colormod_hdrmultiplier * (charge - animlimit) / (1 - animlimit);
28 g.x += f * autocvar_g_weapon_charge_colormod_red_full;
29 g.y += f * autocvar_g_weapon_charge_colormod_green_full;
30 g.z += f * autocvar_g_weapon_charge_colormod_blue_full;
42 void SendCSQCVortexBeamParticle(
float charge) {
51 NET_HANDLE(TE_CSQC_VORTEXBEAMPARTICLE,
bool isNew)
55 vector endpos = ReadVector();
56 charge = ReadByte() / 255.0;
61 charge =
sqrt(charge);
66 if(autocvar_cl_particles_oldvortexbeam)
91 if (player.(weaponentity).m_weapon == WEP_VORTEX &&
WEP_CVAR(vortex, charge) &&
WEP_CVAR(vortex, charge_velocity_rate) &&
vdist(
vec2(player.velocity), >,
WEP_CVAR(vortex, charge_minspeed)))
93 float xyspeed =
vlen(
vec2(player.velocity));
95 xyspeed =
min(xyspeed,
WEP_CVAR(vortex, charge_maxspeed));
96 float f = (xyspeed -
WEP_CVAR(vortex, charge_minspeed)) / (
WEP_CVAR(vortex, charge_maxspeed) -
WEP_CVAR(vortex, charge_minspeed));
98 player.(weaponentity).
vortex_charge =
min(1, player.(weaponentity).vortex_charge +
WEP_CVAR(vortex, charge_velocity_rate) * f * PHYS_INPUT_TIMELENGTH);
103 void W_Vortex_Attack(
Weapon thiswep,
entity actor, .
entity weaponentity,
float issecondary)
105 float mydmg, myforce, mymindist, mymaxdist, myhalflife, myforcehalflife, myammo, charge;
109 mymindist =
WEP_CVAR_BOTH(vortex, !issecondary, damagefalloff_mindist);
110 mymaxdist =
WEP_CVAR_BOTH(vortex, !issecondary, damagefalloff_maxdist);
111 myhalflife =
WEP_CVAR_BOTH(vortex, !issecondary, damagefalloff_halflife);
112 myforcehalflife =
WEP_CVAR_BOTH(vortex, !issecondary, damagefalloff_forcehalflife);
115 float dtype = thiswep.
m_id;
124 charge =
WEP_CVAR(vortex, charge_mindmg) / mydmg + (1 -
WEP_CVAR(vortex, charge_mindmg) / mydmg) * actor.(weaponentity).vortex_charge;
135 if(charge >
WEP_CVAR(vortex, charge_animlimit) &&
WEP_CVAR(vortex, charge_animlimit))
142 FireRailgunBullet(actor, weaponentity,
w_shotorg,
w_shotorg +
w_shotdir * max_shot_distance, mydmg,
false, myforce, mymindist, mymaxdist, myhalflife, myforcehalflife, dtype);
145 Send_Notification(NOTIF_ONE, actor, MSG_ANNCE, ANNCE_ACHIEVEMENT_YODA);
148 Send_Notification(NOTIF_ONE, actor, MSG_ANNCE, ANNCE_ACHIEVEMENT_IMPRESSIVE);
157 SendCSQCVortexBeamParticle(charge);
162 .float vortex_chargepool_pauseregen_finished;
164 void W_Vortex_Charge(
entity actor, .
entity weaponentity,
float dt)
166 if(
WEP_CVAR(vortex, charge) && actor.(weaponentity).vortex_charge <
WEP_CVAR(vortex, charge_limit))
167 actor.(weaponentity).vortex_charge =
min(1, actor.(weaponentity).vortex_charge +
WEP_CVAR(vortex, charge_rate) * dt);
172 if(
bot_aim(actor, weaponentity, 1000000, 0, 1,
false))
182 if(!
WEP_CVAR(vortex, charge_always))
186 if(actor.(weaponentity).vortex_chargepool_ammo < 1)
188 if(actor.vortex_chargepool_pauseregen_finished <
time)
190 actor.pauseregen_finished =
max(actor.pauseregen_finished,
time +
WEP_CVAR_SEC(vortex, chargepool_pause_regen));
194 thiswep.wr_reload(thiswep, actor, weaponentity);
201 W_Vortex_Attack(thiswep, actor, weaponentity, 0);
209 actor.(weaponentity).vortex_charge_rottime =
time +
WEP_CVAR(vortex, charge_rot_pause);
212 if(actor.(weaponentity).vortex_charge < 1)
221 dt =
min(dt, (1 - actor.(weaponentity).vortex_charge) /
WEP_CVAR(vortex, charge_rate));
222 actor.vortex_chargepool_pauseregen_finished =
time +
WEP_CVAR_SEC(vortex, chargepool_pause_regen);
223 dt =
min(dt, actor.(weaponentity).vortex_chargepool_ammo);
234 dt =
min(dt, (1 - actor.(weaponentity).vortex_charge) /
WEP_CVAR(vortex, charge_rate));
235 if(!(actor.items & IT_UNLIMITED_AMMO))
238 if(autocvar_g_balance_vortex_reload_ammo)
264 dt =
min(dt, (1 - actor.(weaponentity).vortex_charge) /
WEP_CVAR(vortex, charge_rate));
269 else if(
WEP_CVAR(vortex, secondary))
273 W_Vortex_Attack(thiswep, actor, weaponentity, 1);
282 actor.vortex_lasthit = 0;
287 ammo_amount += (autocvar_g_balance_vortex_reload_ammo && actor.(weaponentity).(
weapon_load[thiswep.m_id]) >=
WEP_CVAR_PRI(vortex,
ammo));
316 actor.vortex_lasthit = 0;
324 return WEAPON_THINKING_WITH_PORTALS;
328 return WEAPON_VORTEX_MURDER;
341 vector org2 = w_org + w_backoff * 6;
#define WEP_CVAR_PRI(wepname, name)
#define PHYS_INPUT_BUTTON_ATCK2(s)
bool bot_aim(entity this,.entity weaponentity, float shotspeed, float shotspeedupward, float maxshottime, float applygravity)
#define WEP_CVAR_SEC(wepname, name)
float weapon_load[REGISTRY_MAX(Weapons)]
#define REGISTER_MUTATOR(id, dependence)
void w_ready(Weapon thiswep, entity actor,.entity weaponentity, int fire)
#define PHYS_INPUT_BUTTON_ZOOM(s)
#define NET_HANDLE(id, param)
#define WEP_CVAR(wepname, name)
#define METHOD(cname, name, prototype)
vector WarpZone_UnTransformOrigin(entity wz, vector v)
const int HITTYPE_ARMORPIERCE
void SetResource(entity e, Resource res_type, float amount)
Sets the current amount of resource the given entity will have.
const int MAX_WEAPONSLOTS
void GetPressedKeys(entity this)
bool weapon_prepareattack(Weapon thiswep, entity actor,.entity weaponentity, bool secondary, float attacktime)
#define WEP_CVAR_BOTH(wepname, isprimary, name)
#define PHYS_INPUT_BUTTON_ZOOMSCRIPT(s)
#define PHYS_INPUT_BUTTON_ATCK(s)
#define W_SetupShot(ent, wepent, antilag, recoil, snd, chan, maxdamage, deathtype)
bool autocvar_cl_reticle_weapon
bool IsFlying(entity this)
vector(float skel, float bonenum) _skel_get_boneabs_hidden
entity WarpZone_trace_transform
float GetResource(entity e, Resource res_type)
Returns the current amount of resource the given entity has.
#define vdist(v, cmp, f)
Vector distance comparison, avoids sqrt()
entity Notification
always last
void weapon_thinkf(entity actor,.entity weaponentity, WFRAME fr, float t, void(Weapon thiswep, entity actor,.entity weaponentity, int fire) func)
#define MUTATOR_CALLHOOK(id,...)
entity weaponentities[MAX_WEAPONSLOTS]
#define REGISTER_NET_TEMP(id)
#define MUTATOR_HOOKFUNCTION(...)
void W_DecreaseAmmo(Weapon wep, entity actor, float ammo_use,.entity weaponentity)
#define sound(e, c, s, v, a)
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)
fields which are explicitly/manually set are marked with "M", fields set automatically are marked wit...
float vortex_chargepool_ammo
void W_Reload(entity actor,.entity weaponentity, float sent_ammo_min, Sound sent_sound)
#define particleeffectnum(e)