case ENT_CLIENT_HOOK:
vs = hook_shotorigin[s];
break;
- case ENT_CLIENT_ELECTRO_BEAM:
- vs = electro_shotorigin[s];
- break;
case ENT_CLIENT_ARC_BEAM:
vs = lightning_shotorigin[s];
break;
a = view_origin + view_forward * vs_x + view_right * -vs_y + view_up * vs_z;
b = self.origin;
break;
- case ENT_CLIENT_ELECTRO_BEAM:
case ENT_CLIENT_ARC_BEAM:
if(self.HookRange)
b = view_origin + view_forward * self.HookRange;
a = self.velocity;
b = self.origin;
break;
- case ENT_CLIENT_ELECTRO_BEAM:
case ENT_CLIENT_ARC_BEAM:
a = self.origin;
b = self.velocity;
rgb = '.3 1 .3';
}
break;
- case ENT_CLIENT_ELECTRO_BEAM:
- intensity = bound(0.2, 1 + Noise_Pink(self, frametime) * 1 + Noise_Burst(self, frametime, 0.03) * 0.3, 2);
- offset = Noise_Brown(self, frametime) * 10;
- tex = "particles/lgbeam";
- rgb = '1 1 1';
- break;
case ENT_CLIENT_ARC_BEAM: // todo
intensity = bound(0.2, 1 + Noise_Pink(self, frametime) * 1 + Noise_Burst(self, frametime, 0.03) * 0.3, 2);
offset = Noise_Brown(self, frametime) * 10;
self.drawmask = 0;
}
break;
- case ENT_CLIENT_ELECTRO_BEAM:
case ENT_CLIENT_ARC_BEAM:
setorigin(self, a); // beam origin!
break;
default:
case ENT_CLIENT_HOOK:
break;
- case ENT_CLIENT_ELECTRO_BEAM:
- pointparticles(particleeffectnum("electro_lightning"), trace_endpos, normalize(atrans - trace_endpos), frametime * intensity); // todo: new effect
- break;
case ENT_CLIENT_ARC_BEAM:
pointparticles(particleeffectnum("electro_lightning"), trace_endpos, normalize(atrans - trace_endpos), frametime * intensity); // todo: new effect
break;
case ENT_CLIENT_HOOK:
self.HookRange = 0;
break;
- case ENT_CLIENT_ELECTRO_BEAM:
case ENT_CLIENT_ARC_BEAM:
self.HookRange = ReadCoord();
break;
setmodel(self, "models/hook.md3");
self.drawmask = MASK_NORMAL;
break;
- case ENT_CLIENT_ELECTRO_BEAM:
- sound (self, CH_SHOTS_SINGLE, "weapons/lgbeam_fly.wav", VOL_BASE, ATTEN_NORM);
- break;
case ENT_CLIENT_ARC_BEAM:
sound (self, CH_SHOTS_SINGLE, "weapons/lgbeam_fly.wav", VOL_BASE, ATTEN_NORM);
break;
);
#ifdef SVQC
-void ElectroInit();
-vector electro_shotorigin[4];
var float autocvar_g_balance_electro_combo_comboradius_thruwall = 200;
#endif
#else
self.takedamage = DAMAGE_NO;
if (self.movetype == MOVETYPE_BOUNCE)
{
- RadiusDamage (self, self.realowner, autocvar_g_balance_electro_secondary_damage, autocvar_g_balance_electro_secondary_edgedamage, autocvar_g_balance_electro_secondary_radius, world, world, autocvar_g_balance_electro_secondary_force, self.projectiledeathtype, other);
+ RadiusDamage(self, self.realowner, autocvar_g_balance_electro_secondary_damage, autocvar_g_balance_electro_secondary_edgedamage, autocvar_g_balance_electro_secondary_radius, world, world, autocvar_g_balance_electro_secondary_force, self.projectiledeathtype, other);
}
else
{
other = proj; MUTATOR_CALLHOOK(EditProjectile);
}
-.vector hook_start, hook_end;
-float lgbeam_send(entity to, float sf)
-{
- WriteByte(MSG_ENTITY, ENT_CLIENT_ELECTRO_BEAM);
- sf = sf & 0x7F;
- if(sound_allowed(MSG_BROADCAST, self.realowner))
- sf |= 0x80;
- WriteByte(MSG_ENTITY, sf);
- if(sf & 1)
- {
- WriteByte(MSG_ENTITY, num_for_edict(self.realowner));
- WriteCoord(MSG_ENTITY, autocvar_g_balance_electro_primary_range);
- }
- if(sf & 2)
- {
- WriteCoord(MSG_ENTITY, self.hook_start_x);
- WriteCoord(MSG_ENTITY, self.hook_start_y);
- WriteCoord(MSG_ENTITY, self.hook_start_z);
- }
- if(sf & 4)
- {
- WriteCoord(MSG_ENTITY, self.hook_end_x);
- WriteCoord(MSG_ENTITY, self.hook_end_y);
- WriteCoord(MSG_ENTITY, self.hook_end_z);
- }
- return TRUE;
-}
-.entity lgbeam;
-.float prevlgfire;
-float lgbeam_checkammo()
-{
- if(self.realowner.items & IT_UNLIMITED_WEAPON_AMMO)
- return TRUE;
- else if(autocvar_g_balance_electro_reload_ammo)
- return self.realowner.clip_load > 0;
- else
- return self.realowner.ammo_cells > 0;
-}
-
-entity lgbeam_owner_ent;
-void lgbeam_think()
-{
- entity owner_player;
- owner_player = self.realowner;
-
- owner_player.prevlgfire = time;
- if (self != owner_player.lgbeam)
- {
- remove(self);
- return;
- }
-
- if (owner_player.weaponentity.state != WS_INUSE || !lgbeam_checkammo() || owner_player.deadflag != DEAD_NO || !owner_player.BUTTON_ATCK || owner_player.freezetag_frozen)
- {
- if(self == owner_player.lgbeam)
- owner_player.lgbeam = world;
- remove(self);
- return;
- }
-
- self.nextthink = time;
-
- makevectors(owner_player.v_angle);
-
- float dt, f;
- dt = frametime;
-
- // if this weapon is reloadable, decrease its load. Else decrease the player's ammo
- if (!(owner_player.items & IT_UNLIMITED_WEAPON_AMMO))
- {
- if(autocvar_g_balance_electro_primary_ammo)
- {
- if(autocvar_g_balance_electro_reload_ammo)
- {
- dt = min(dt, owner_player.clip_load / autocvar_g_balance_electro_primary_ammo);
- owner_player.clip_load = max(0, owner_player.clip_load - autocvar_g_balance_electro_primary_ammo * frametime);
- owner_player.(weapon_load[WEP_ELECTRO]) = owner_player.clip_load;
- }
- else
- {
- dt = min(dt, owner_player.ammo_cells / autocvar_g_balance_electro_primary_ammo);
- owner_player.ammo_cells = max(0, owner_player.ammo_cells - autocvar_g_balance_electro_primary_ammo * frametime);
- }
- }
- }
-
- W_SetupShot_Range(owner_player, TRUE, 0, "", 0, autocvar_g_balance_electro_primary_damage * dt, autocvar_g_balance_electro_primary_range);
- if(!lgbeam_owner_ent)
- {
- lgbeam_owner_ent = spawn();
- lgbeam_owner_ent.classname = "lgbeam_owner_ent";
- }
- WarpZone_traceline_antilag(lgbeam_owner_ent, w_shotorg, w_shotend, MOVE_NORMAL, lgbeam_owner_ent, ANTILAG_LATENCY(owner_player));
-
- // apply the damage
- if(trace_ent)
- {
- vector force;
- force = w_shotdir * autocvar_g_balance_electro_primary_force + '0 0 1' * autocvar_g_balance_electro_primary_force_up;
-
- f = ExponentialFalloff(autocvar_g_balance_electro_primary_falloff_mindist, autocvar_g_balance_electro_primary_falloff_maxdist, autocvar_g_balance_electro_primary_falloff_halflifedist, vlen(WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos) - w_shotorg));
-
- if(accuracy_isgooddamage(owner_player, trace_ent))
- accuracy_add(owner_player, WEP_ELECTRO, 0, autocvar_g_balance_electro_primary_damage * dt * f);
- Damage (trace_ent, owner_player, owner_player, autocvar_g_balance_electro_primary_damage * dt * f, WEP_ELECTRO, trace_endpos, force * dt);
- }
- W_Plasma_TriggerCombo(trace_endpos, autocvar_g_balance_electro_primary_comboradius, owner_player);
-
- // draw effect
- if(w_shotorg != self.hook_start)
- {
- self.SendFlags |= 2;
- self.hook_start = w_shotorg;
- }
- if(w_shotend != self.hook_end)
- {
- self.SendFlags |= 4;
- self.hook_end = w_shotend;
- }
-}
-
-// experimental lightning gun
-void W_Electro_Attack3 (void)
-{
- // only play fire sound if 0.5 sec has passed since player let go the fire button
- if(time - self.prevlgfire > 0.5)
- sound (self, CH_WEAPON_A, "weapons/lgbeam_fire.wav", VOL_BASE, ATTEN_NORM);
-
- entity beam, oldself;
-
- self.lgbeam = beam = spawn();
- beam.classname = "lgbeam";
- beam.solid = SOLID_NOT;
- beam.think = lgbeam_think;
- beam.owner = beam.realowner = self;
- beam.movetype = MOVETYPE_NONE;
- beam.shot_spread = 0;
- beam.bot_dodge = TRUE;
- beam.bot_dodgerating = autocvar_g_balance_electro_primary_damage;
- Net_LinkEntity(beam, FALSE, 0, lgbeam_send);
-
- oldself = self;
- self = beam;
- self.think();
- self = oldself;
-}
-
-void ElectroInit()
-{
- WEP_ACTION(WEP_ELECTRO, WR_INIT);
- electro_shotorigin[0] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ELECTRO), FALSE, FALSE, 1);
- electro_shotorigin[1] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ELECTRO), FALSE, FALSE, 2);
- electro_shotorigin[2] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ELECTRO), FALSE, FALSE, 3);
- electro_shotorigin[3] = shotorg_adjust_values(CL_Weapon_GetShotOrg(WEP_ELECTRO), FALSE, FALSE, 4);
-}
-
void w_electro_checkattack()
{
if(self.electro_count > 1)
}
.float bot_secondary_electromooth;
-.float BUTTON_ATCK_prev;
float w_electro(float req)
{
float ammo_amount;
if(autocvar_g_balance_electro_reload_ammo) // forced reload
{
ammo_amount = 0;
- if(autocvar_g_balance_electro_lightning)
- {
- if(self.clip_load > 0)
- ammo_amount = 1;
- }
- else if(self.clip_load >= autocvar_g_balance_electro_primary_ammo)
+ if(self.clip_load >= autocvar_g_balance_electro_primary_ammo)
ammo_amount = 1;
if(self.clip_load >= autocvar_g_balance_electro_secondary_ammo)
ammo_amount += 1;
}
if (self.BUTTON_ATCK)
{
- if(autocvar_g_balance_electro_lightning)
- if(self.BUTTON_ATCK_prev)
- weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_electro_primary_animtime, w_ready);
-
- if (weapon_prepareattack(0, (autocvar_g_balance_electro_lightning ? 0 : autocvar_g_balance_electro_primary_refire)))
+ if(weapon_prepareattack(0, autocvar_g_balance_electro_primary_refire))
{
- if(autocvar_g_balance_electro_lightning)
- {
- if ((!self.lgbeam) || wasfreed(self.lgbeam))
- {
- W_Electro_Attack3();
- }
- if(!self.BUTTON_ATCK_prev)
- {
- weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_electro_primary_animtime, w_ready);
- self.BUTTON_ATCK_prev = 1;
- }
- }
- else
- {
W_Electro_Attack();
weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_electro_primary_animtime, w_ready);
- }
- }
- } else {
- if(autocvar_g_balance_electro_lightning)
- {
- if (self.BUTTON_ATCK_prev != 0)
- {
- weapon_thinkf(WFRAME_FIRE1, autocvar_g_balance_electro_primary_animtime, w_ready);
- ATTACK_FINISHED(self) = time + autocvar_g_balance_electro_primary_refire * W_WeaponRateFactor();
- }
- self.BUTTON_ATCK_prev = 0;
}
-
- if (self.BUTTON_ATCK2)
+ }
+ else if(self.BUTTON_ATCK2)
+ {
+ if (time >= self.electro_secondarytime)
+ if (weapon_prepareattack(1, autocvar_g_balance_electro_secondary_refire))
{
- if (time >= self.electro_secondarytime)
- if (weapon_prepareattack(1, autocvar_g_balance_electro_secondary_refire))
- {
- W_Electro_Attack2();
- self.electro_count = autocvar_g_balance_electro_secondary_count;
- weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_electro_secondary_animtime, w_electro_checkattack);
- self.electro_secondarytime = time + autocvar_g_balance_electro_secondary_refire2 * W_WeaponRateFactor();
- }
+ W_Electro_Attack2();
+ self.electro_count = autocvar_g_balance_electro_secondary_count;
+ weapon_thinkf(WFRAME_FIRE2, autocvar_g_balance_electro_secondary_animtime, w_electro_checkattack);
+ self.electro_secondarytime = time + autocvar_g_balance_electro_secondary_refire2 * W_WeaponRateFactor();
}
}
-
+
return TRUE;
}
case WR_INIT:
precache_sound ("weapons/electro_fire2.wav");
precache_sound ("weapons/electro_impact.wav");
precache_sound ("weapons/electro_impact_combo.wav");
-
- if(autocvar_g_balance_electro_lightning)
- precache_sound ("weapons/lgbeam_fire.wav");
-
return TRUE;
}
case WR_SETUP:
}
case WR_CHECKAMMO1:
{
- if(autocvar_g_balance_electro_lightning)
- {
- if(!autocvar_g_balance_electro_primary_ammo)
- ammo_amount = 1;
- else
- ammo_amount = self.ammo_cells > 0;
- ammo_amount += self.(weapon_load[WEP_ELECTRO]) > 0;
- }
- else
- {
- ammo_amount = self.ammo_cells >= autocvar_g_balance_electro_primary_ammo;
- ammo_amount += self.(weapon_load[WEP_ELECTRO]) >= autocvar_g_balance_electro_primary_ammo;
- }
+ ammo_amount = self.ammo_cells >= autocvar_g_balance_electro_primary_ammo;
+ ammo_amount += self.(weapon_load[WEP_ELECTRO]) >= autocvar_g_balance_electro_primary_ammo;
return ammo_amount;
}
case WR_CHECKAMMO2: