.vector HookStart;
.vector HookEnd;
.float HookKillTime;
+.vector LGBeamStart;
+.vector LGBeamEnd;
+.float LGBeamKillTime;
+.float LGBeamSound;
+.float LGBeamSilent;
void Draw_CylindricLine(vector from, vector to, float thickness, string texture, float aspect, float shift, vector rgb, float alpha, float drawflag)
{
vector rgb;
float t;
- if(time >= self.HookKillTime)
- return;
- if(self.sv_entnum == player_localentnum - 1)
- a = view_origin + view_forward * hook_shotorigin_x + view_right * hook_shotorigin_y + view_up * hook_shotorigin_z;
- else
- a = self.HookStart;
- b = self.HookEnd;
-
- t = GetPlayerColorForce(self.sv_entnum);
-
- if(t == COLOR_TEAM1)
- {
- tex = "particles/hook_red";
- rgb = '1 .3 .3';
- }
- else if(t == COLOR_TEAM2)
+ if(time < self.HookKillTime)
{
- tex = "particles/hook_blue";
- rgb = '.3 .3 1';
+ if(self.sv_entnum == player_localentnum - 1)
+ a = view_origin + view_forward * hook_shotorigin_x + view_right * hook_shotorigin_y + view_up * hook_shotorigin_z;
+ else
+ a = self.HookStart;
+ b = self.HookEnd;
+
+ t = GetPlayerColorForce(self.sv_entnum);
+
+ if(t == COLOR_TEAM1)
+ {
+ tex = "particles/hook_red";
+ rgb = '1 .3 .3';
+ }
+ else if(t == COLOR_TEAM2)
+ {
+ tex = "particles/hook_blue";
+ rgb = '.3 .3 1';
+ }
+ else if(t == COLOR_TEAM3)
+ {
+ tex = "particles/hook_yellow";
+ rgb = '1 1 .3';
+ }
+ else if(t == COLOR_TEAM4)
+ {
+ tex = "particles/hook_pink";
+ rgb = '1 .3 1';
+ }
+ else
+ {
+ tex = "particles/hook_green";
+ rgb = '.3 1 .3';
+ }
+
+ Draw_GrapplingHook_trace_callback_tex = tex;
+ Draw_GrapplingHook_trace_callback_rnd = random();
+ WarpZone_TraceBox_ThroughZone(a, '0 0 0', '0 0 0', b, MOVE_NOMONSTERS, world, world, Draw_GrapplingHook_trace_callback);
+ Draw_GrapplingHook_trace_callback_tex = string_null;
}
- else if(t == COLOR_TEAM3)
+
+ if(time < self.LGBeamKillTime)
{
- tex = "particles/hook_yellow";
- rgb = '1 1 .3';
+ if(self.sv_entnum == player_localentnum - 1)
+ a = view_origin + view_forward * electro_shotorigin_x + view_right * electro_shotorigin_y + view_up * electro_shotorigin_z;
+ else
+ a = self.LGBeamStart;
+ b = self.LGBeamEnd;
+
+ tex = "particles/lgbeam";
+ rgb = '1 1 1';
+
+ Draw_GrapplingHook_trace_callback_tex = tex;
+ Draw_GrapplingHook_trace_callback_rnd = random();
+ WarpZone_TraceBox_ThroughZone(a, '0 0 0', '0 0 0', b, MOVE_NOMONSTERS, world, world, Draw_GrapplingHook_trace_callback);
+ Draw_GrapplingHook_trace_callback_tex = string_null;
}
- else if(t == COLOR_TEAM4)
+
+ if(time < self.LGBeamKillTime && !self.LGBeamSilent)
{
- tex = "particles/hook_pink";
- rgb = '1 .3 1';
+ if(!self.LGBeamSound)
+ {
+ sound (self, CHAN_PROJECTILE, "weapons/lgbeam_fly.wav", VOL_BASE, ATTN_NORM);
+ self.LGBeamSound = 1;
+ }
}
else
{
- tex = "particles/hook_green";
- rgb = '.3 1 .3';
+ if(self.LGBeamSound)
+ {
+ sound (self, CHAN_PROJECTILE, "misc/null.wav", VOL_BASE, ATTN_NORM);
+ self.LGBeamSound = 0;
+ }
}
-
- Draw_GrapplingHook_trace_callback_tex = tex;
- Draw_GrapplingHook_trace_callback_rnd = random();
- WarpZone_TraceBox_ThroughZone(a, '0 0 0', '0 0 0', b, MOVE_NOMONSTERS, world, world, Draw_GrapplingHook_trace_callback);
- Draw_GrapplingHook_trace_callback_tex = string_null;
}
void Net_GrapplingHook()
{
- float i;
+ float i, t;
vector start, end;
entity p;
- i = ReadShort();
+ i = ReadByte();
+ t = ReadByte();
end_x = ReadCoord();
end_y = ReadCoord();
end_z = ReadCoord();
if(!p)
return;
- p.HookKillTime = time + 0.1;
- p.HookStart = start;
- p.HookEnd = end;
- p.draw = Draw_GrapplingHook;
+ switch(t)
+ {
+ case 0: // hook beam
+ p.HookKillTime = time + 0.1;
+ p.HookStart = start;
+ p.HookEnd = end;
+ p.draw = Draw_GrapplingHook;
+ break;
+ case 1: // electro lgbeam
+ p.LGBeamKillTime = time + 0.1;
+ p.LGBeamStart = start;
+ p.LGBeamEnd = end;
+ p.LGBeamSilent = 0;
+ p.draw = Draw_GrapplingHook;
+ break;
+ case 2: // silent electro lgbeam
+ p.LGBeamKillTime = time + 0.1;
+ p.LGBeamStart = start;
+ p.LGBeamEnd = end;
+ p.LGBeamSilent = 1;
+ p.draw = Draw_GrapplingHook;
+ break;
+ }
}
* g_tuba.md3 - pickup model
*/
-void CL_Weaponentity_Think()
+// writes:
+// self.origin, self.angles
+// self.weaponentity
+// self.movedir, self.view_ofs
+// attachment stuff
+// anim stuff
+// to free:
+// call again with ""
+// remove the ent
+void CL_WeaponEntity_SetModel(string name)
{
- float tb, v_shot_idx;
- self.nextthink = time;
- if (intermission_running)
- self.frame = self.anim_idle_x;
- if (self.owner.weaponentity != self)
- {
- if (self.weaponentity)
- remove(self.weaponentity);
- remove(self);
- return;
- }
- if (self.owner.deadflag != DEAD_NO)
+ string animfilename;
+ float animfile;
+ float v_shot_idx;
+ if (name != "")
{
- self.model = "";
+ // if there is a child entity, hide it until we're sure we use it
if (self.weaponentity)
self.weaponentity.model = "";
- return;
- }
- if (self.cnt != self.owner.weapon || self.dmg != self.owner.modelindex || self.deadflag != self.owner.deadflag)
- {
- self.cnt = self.owner.weapon;
- self.dmg = self.owner.modelindex;
- self.deadflag = self.owner.deadflag;
+ setmodel(self, strcat("models/weapons/v_", name, ".md3")); // precision set below
+ v_shot_idx = gettagindex(self, "shot"); // used later
+ if(!v_shot_idx)
+ v_shot_idx = gettagindex(self, "tag_shot");
- string animfilename;
- float animfile;
- if (self.owner.weaponname != "")
+ if(qcweaponanimation)
{
- // if there is a child entity, hide it until we're sure we use it
- if (self.weaponentity)
- self.weaponentity.model = "";
- setmodel(self, strcat("models/weapons/v_", self.owner.weaponname, ".md3")); // precision set below
- v_shot_idx = gettagindex(self, "shot"); // used later
- if(!v_shot_idx)
- v_shot_idx = gettagindex(self, "tag_shot");
+ self.angles = '0 0 0';
+ makevectors(self.angles_x * '-1 0 0' + self.angles_y * '0 1 0' + self.angles_z * '0 0 1');
+ self.movedir = weapon_offset_x * v_forward - weapon_offset_y * v_right + weapon_offset_z * v_up + weapon_adjust;
+ self.movedir_x += 32;
+ self.spawnorigin = self.movedir;
+ // oldorigin - not calculated here
+ }
+ else
+ {
+ setmodel(self, strcat("models/weapons/h_", name, ".iqm")); // precision set below
+ animfilename = strcat("models/weapons/h_", name, ".iqm.animinfo");
+ animfile = fopen(animfilename, FILE_READ);
+ // preset some defaults that work great for renamed zym files (which don't need an animinfo)
+ self.anim_fire1 = '0 1 0.01';
+ self.anim_fire2 = '1 1 0.01';
+ self.anim_idle = '2 1 0.01';
+ self.anim_reload = '3 1 0.01';
+ if (animfile >= 0)
+ {
+ animparseerror = FALSE;
+ self.anim_fire1 = animparseline(animfile);
+ self.anim_fire2 = animparseline(animfile);
+ self.anim_idle = animparseline(animfile);
+ self.anim_reload = animparseline(animfile);
+ fclose(animfile);
+ if (animparseerror)
+ print("Parse error in ", animfilename, ", some player animations are broken\n");
+ }
- if(qcweaponanimation)
+ // if we have a "weapon" tag, let's attach the v_ model to it ("invisible hand" style model)
+ // if we don't, this is a "real" animated model
+ if(gettagindex(self, "weapon"))
+ {
+ if (!self.weaponentity)
+ self.weaponentity = spawn();
+ setmodel(self.weaponentity, strcat("models/weapons/v_", name, ".md3")); // precision does not matter
+ setattachment(self.weaponentity, self, "weapon");
+ }
+ else if(gettagindex(self, "tag_weapon"))
{
- self.angles = '0 0 0';
- makevectors(self.angles_x * '-1 0 0' + self.angles_y * '0 1 0' + self.angles_z * '0 0 1');
- self.movedir = weapon_offset_x * v_forward - weapon_offset_y * v_right + weapon_offset_z * v_up + weapon_adjust;
- self.movedir_x += 32;
- self.spawnorigin = self.movedir;
- // oldorigin - not calculated here
+ if (!self.weaponentity)
+ self.weaponentity = spawn();
+ setmodel(self.weaponentity, strcat("models/weapons/v_", name, ".md3")); // precision does not matter
+ setattachment(self.weaponentity, self, "tag_weapon");
}
else
{
- setmodel(self, strcat("models/weapons/h_", self.owner.weaponname, ".iqm")); // precision set below
- animfilename = strcat("models/weapons/h_", self.owner.weaponname, ".iqm.animinfo");
- animfile = fopen(animfilename, FILE_READ);
- // preset some defaults that work great for renamed zym files (which don't need an animinfo)
- self.anim_fire1 = '0 1 0.01';
- self.anim_fire2 = '1 1 0.01';
- self.anim_idle = '2 1 0.01';
- self.anim_reload = '3 1 0.01';
- if (animfile >= 0)
- {
- animparseerror = FALSE;
- self.anim_fire1 = animparseline(animfile);
- self.anim_fire2 = animparseline(animfile);
- self.anim_idle = animparseline(animfile);
- self.anim_reload = animparseline(animfile);
- fclose(animfile);
- if (animparseerror)
- print("Parse error in ", animfilename, ", some player animations are broken\n");
- }
-
- // if we have a "weapon" tag, let's attach the v_ model to it ("invisible hand" style model)
- // if we don't, this is a "real" animated model
- if(gettagindex(self, "weapon"))
- {
- if (!self.weaponentity)
- self.weaponentity = spawn();
- setmodel(self.weaponentity, strcat("models/weapons/v_", self.owner.weaponname, ".md3")); // precision does not matter
- setattachment(self.weaponentity, self, "weapon");
- }
- else if(gettagindex(self, "tag_weapon"))
- {
- if (!self.weaponentity)
- self.weaponentity = spawn();
- setmodel(self.weaponentity, strcat("models/weapons/v_", self.owner.weaponname, ".md3")); // precision does not matter
- setattachment(self.weaponentity, self, "tag_weapon");
- }
- else
- {
- if(self.weaponentity)
- remove(self.weaponentity);
- self.weaponentity = world;
- }
+ if(self.weaponentity)
+ remove(self.weaponentity);
+ self.weaponentity = world;
+ }
- setorigin(self,'0 0 0');
- self.angles = '0 0 0';
- self.frame = 0;
- self.viewmodelforclient = world;
+ setorigin(self,'0 0 0');
+ self.angles = '0 0 0';
+ self.frame = 0;
+ self.viewmodelforclient = world;
- float idx;
+ float idx;
- if(v_shot_idx) // v_ model attached to invisible h_ model
+ if(v_shot_idx) // v_ model attached to invisible h_ model
+ {
+ self.movedir = gettaginfo(self.weaponentity, v_shot_idx);
+ }
+ else
+ {
+ idx = gettagindex(self, "shot");
+ if(!idx)
+ idx = gettagindex(self, "tag_shot");
+ if(idx)
+ self.movedir = gettaginfo(self, idx);
+ else
{
- self.movedir = gettaginfo(self.weaponentity, v_shot_idx);
+ print("WARNING: weapon model ", self.model, " does not support the 'shot' tag, will display shots TOTALLY wrong\n");
+ self.movedir = '0 0 0';
}
+ }
+
+ if(self.weaponentity) // v_ model attached to invisible h_ model
+ {
+ idx = gettagindex(self.weaponentity, "shell");
+ if(!idx)
+ idx = gettagindex(self.weaponentity, "tag_shell");
+ if(idx)
+ self.spawnorigin = gettaginfo(self.weaponentity, idx);
+ }
+ else
+ idx = 0;
+ if(!idx)
+ {
+ idx = gettagindex(self, "shell");
+ if(!idx)
+ idx = gettagindex(self, "tag_shell");
+ if(idx)
+ self.spawnorigin = gettaginfo(self, idx);
else
{
- idx = gettagindex(self, "shot");
- if(!idx)
- idx = gettagindex(self, "tag_shot");
- if(idx)
- self.movedir = gettaginfo(self, idx);
- else
- {
- print("WARNING: weapon model ", self.model, " does not support the 'shot' tag, will display shots TOTALLY wrong\n");
- self.movedir = '0 0 0';
- }
+ print("WARNING: weapon model ", self.model, " does not support the 'shell' tag, will display casings wrong\n");
+ self.spawnorigin = self.movedir;
}
+ }
- if(self.weaponentity) // v_ model attached to invisible h_ model
+ if(v_shot_idx)
+ {
+ self.oldorigin = '0 0 0'; // use regular attachment
+ }
+ else
+ {
+ if(self.weaponentity)
{
- idx = gettagindex(self.weaponentity, "shell");
+ idx = gettagindex(self, "weapon");
if(!idx)
- idx = gettagindex(self.weaponentity, "tag_shell");
- if(idx)
- self.spawnorigin = gettaginfo(self.weaponentity, idx);
+ idx = gettagindex(self, "tag_weapon");
}
else
- idx = 0;
- if(!idx)
{
- idx = gettagindex(self, "shell");
+ idx = gettagindex(self, "handle");
if(!idx)
- idx = gettagindex(self, "tag_shell");
- if(idx)
- self.spawnorigin = gettaginfo(self, idx);
- else
- {
- print("WARNING: weapon model ", self.model, " does not support the 'shell' tag, will display casings wrong\n");
- self.spawnorigin = self.movedir;
- }
+ idx = gettagindex(self, "tag_handle");
}
-
- if(v_shot_idx)
+ if(idx)
{
- self.oldorigin = '0 0 0'; // use regular attachment
+ self.oldorigin = self.movedir - gettaginfo(self, idx);
}
else
{
- if(self.weaponentity)
- {
- idx = gettagindex(self, "weapon");
- if(!idx)
- idx = gettagindex(self, "tag_weapon");
- }
- else
- {
- idx = gettagindex(self, "handle");
- if(!idx)
- idx = gettagindex(self, "tag_handle");
- }
- if(idx)
- {
- self.oldorigin = self.movedir - gettaginfo(self, idx);
- }
- else
- {
- print("WARNING: weapon model ", self.model, " does not support the 'handle' tag and neither does the v_ model support the 'shot' tag, will display muzzle flashes TOTALLY wrong\n");
- self.oldorigin = '0 0 0'; // there is no way to recover from this
- }
+ print("WARNING: weapon model ", self.model, " does not support the 'handle' tag and neither does the v_ model support the 'shot' tag, will display muzzle flashes TOTALLY wrong\n");
+ self.oldorigin = '0 0 0'; // there is no way to recover from this
}
-
- self.viewmodelforclient = self.owner;
}
+
+ self.viewmodelforclient = self.owner;
}
- else
- {
- self.model = "";
- if(self.weaponentity)
- remove(self.weaponentity);
- self.weaponentity = world;
- self.movedir = '0 0 0';
- self.spawnorigin = '0 0 0';
- self.oldorigin = '0 0 0';
- self.anim_fire1 = '0 1 0.01';
- self.anim_fire2 = '0 1 0.01';
- self.anim_idle = '0 1 0.01';
- self.anim_reload = '0 1 0.01';
- }
+ }
+ else
+ {
+ self.model = "";
+ if(self.weaponentity)
+ remove(self.weaponentity);
+ self.weaponentity = world;
+ self.movedir = '0 0 0';
+ self.spawnorigin = '0 0 0';
+ self.oldorigin = '0 0 0';
+ self.anim_fire1 = '0 1 0.01';
+ self.anim_fire2 = '0 1 0.01';
+ self.anim_idle = '0 1 0.01';
+ self.anim_reload = '0 1 0.01';
+ }
- self.view_ofs = '0 0 0';
+ self.view_ofs = '0 0 0';
- if(self.movedir_x >= 0)
- {
- vector v0;
- v0 = self.movedir;
- self.movedir = shotorg_adjust(v0, FALSE, FALSE);
- self.view_ofs = shotorg_adjust(v0, FALSE, TRUE) - v0;
- }
- self.owner.stat_shotorg = compressShotOrigin(self.movedir);
- self.movedir = decompressShotOrigin(self.owner.stat_shotorg); // make them match perfectly
+ if(self.movedir_x >= 0)
+ {
+ vector v0;
+ v0 = self.movedir;
+ self.movedir = shotorg_adjust(v0, FALSE, FALSE);
+ self.view_ofs = shotorg_adjust(v0, FALSE, TRUE) - v0;
+ }
+ self.owner.stat_shotorg = compressShotOrigin(self.movedir);
+ self.movedir = decompressShotOrigin(self.owner.stat_shotorg); // make them match perfectly
- self.spawnorigin += self.view_ofs; // offset the casings origin by the same amount
+ self.spawnorigin += self.view_ofs; // offset the casings origin by the same amount
- // check if an instant weapon switch occurred
- if (qcweaponanimation)
+ // check if an instant weapon switch occurred
+ if (qcweaponanimation)
+ {
+ if (self.state == WS_READY)
{
- if (self.state == WS_READY)
- {
- self.angles = '0 0 0';
- makevectors(self.angles_x * '-1 0 0' + self.angles_y * '0 1 0' + self.angles_z * '0 0 1');
- setorigin(self, QCWEAPONANIMATION_ORIGIN(self));
- }
+ self.angles = '0 0 0';
+ makevectors(self.angles_x * '-1 0 0' + self.angles_y * '0 1 0' + self.angles_z * '0 0 1');
+ setorigin(self, QCWEAPONANIMATION_ORIGIN(self));
}
- else
- setorigin(self, self.view_ofs);
- // reset animstate now
- self.wframe = WFRAME_IDLE;
- self.weapon_morph0time = 0;
- self.weapon_morph1time = 0;
- self.weapon_morph2time = 0;
- self.weapon_morph3time = 0;
- self.weapon_morph4time = 0;
- setanim(self, self.anim_idle, TRUE, FALSE, TRUE);
+ }
+ else
+ setorigin(self, self.view_ofs);
+ // reset animstate now
+ self.wframe = WFRAME_IDLE;
+ self.weapon_morph0time = 0;
+ self.weapon_morph1time = 0;
+ self.weapon_morph2time = 0;
+ self.weapon_morph3time = 0;
+ self.weapon_morph4time = 0;
+ setanim(self, self.anim_idle, TRUE, FALSE, TRUE);
+}
+
+vector CL_Weapon_GetShotOrg(float wpn)
+{
+ entity wi, oldself;
+ vector ret;
+ wi = get_weaponinfo(wpn);
+ oldself = self;
+ self = spawn();
+ CL_WeaponEntity_SetModel(wi.mdl);
+ ret = self.movedir;
+ CL_WeaponEntity_SetModel("");
+ remove(self);
+ self = oldself;
+ return ret;
+}
+
+void CL_Weaponentity_Think()
+{
+ float tb;
+ self.nextthink = time;
+ if (intermission_running)
+ self.frame = self.anim_idle_x;
+ if (self.owner.weaponentity != self)
+ {
+ if (self.weaponentity)
+ remove(self.weaponentity);
+ remove(self);
+ return;
+ }
+ if (self.owner.deadflag != DEAD_NO)
+ {
+ self.model = "";
+ if (self.weaponentity)
+ self.weaponentity.model = "";
+ return;
+ }
+ if (self.cnt != self.owner.weapon || self.dmg != self.owner.modelindex || self.deadflag != self.owner.deadflag)
+ {
+ self.cnt = self.owner.weapon;
+ self.dmg = self.owner.modelindex;
+ self.deadflag = self.owner.deadflag;
+
+ CL_WeaponEntity_SetModel(self.owner.weaponname);
}
tb = (self.effects & (EF_TELEPORT_BIT | EF_RESTARTANIM_BIT));
.float nextdamagethink;
void lgbeam_think()
{
- if (self.owner.weaponentity.state != WS_INUSE || (self.owner.ammo_cells <= 0 && !(self.owner.items & IT_UNLIMITED_WEAPON_AMMO)) || self != self.owner.lgbeam || self.owner.BUTTON_ATCK == 0 || self.owner.deadflag != DEAD_NO)
+ if (self.owner.weaponentity.state != WS_INUSE || (self.owner.ammo_cells <= 0 && !(self.owner.items & IT_UNLIMITED_WEAPON_AMMO)) || self != self.owner.lgbeam || self.owner.deadflag != DEAD_NO || !self.owner.BUTTON_ATCK)
{
remove(self);
return;
vector angle;
angle = v_forward;
- vector force;
- force = angle * cvar("g_balance_electro_primary_force");
-
traceline_antilag(self.owner, self.owner.origin + self.owner.view_ofs, self.owner.origin + self.owner.view_ofs + angle * cvar("g_balance_electro_primary_range"), FALSE, self.owner, ANTILAG_LATENCY(self.owner));
- self.scale = vlen(self.owner.origin - trace_endpos) / 256 * (0.75 + 0.75 * random());
-}
+ if not(self.owner.items & IT_UNLIMITED_WEAPON_AMMO)
+ self.owner.ammo_cells = max(0, self.owner.ammo_cells - cvar("g_balance_electro_primary_ammo") * frametime);
-// execute each frame to update the beam visuals, but only apply damage at intervals of "refire" to prevent massive hitsound spam
-void exteriorlgbeam_think()
-{
- if (self.owner.weaponentity.state != WS_INUSE || (self.owner.ammo_cells <= 0 && !(self.owner.items & IT_UNLIMITED_WEAPON_AMMO)) || self != self.owner.exteriorlgbeam || self.owner.BUTTON_ATCK == 0 || self.owner.deadflag != DEAD_NO)
+ // apply the damage
+ if(trace_fraction < 1)
{
- sound (self, CHAN_PROJECTILE, "sound/misc/null.wav", VOL_BASE, ATTN_NORM);
- remove(self);
- return;
+ vector force;
+ force = angle * cvar("g_balance_electro_primary_force") + '0 0 1' * cvar("g_balance_electro_primary_force_up");
+ Damage (trace_ent, self.owner, self.owner, cvar("g_balance_electro_primary_damage") * frametime, WEP_ELECTRO, trace_endpos, force * frametime);
+ W_Plasma_TriggerCombo(trace_endpos, cvar("g_balance_electro_primary_comboradius"), self.owner);
}
- if (time - self.shot_spread + random() * 0.2 > 0)
- {
- self.shot_spread = time + 2;
- sound (self, CHAN_PROJECTILE, "turrets/phaser.wav", VOL_BASE, ATTN_NORM);
- }
-
- self.nextthink = time;
-
- makevectors(self.owner.v_angle);
- vector angle;
- angle = v_forward;
-
- traceline_antilag(self.owner, self.owner.origin + self.owner.view_ofs, self.owner.origin + self.owner.view_ofs + angle * cvar("g_balance_electro_primary_range"), FALSE, self.owner, ANTILAG_LATENCY(self.owner));
-
- if(self.nextdamagethink <= time)
+ // draw effect
+ vector vecs, org;
+ if(self.owner.weaponentity.movedir_x > 0)
{
- if not(self.owner.items & IT_UNLIMITED_WEAPON_AMMO)
- self.owner.ammo_cells = max(0, self.owner.ammo_cells - cvar("g_balance_electro_primary_ammo") * cvar("g_balance_electro_primary_refire"));
-
- // apply the damage
- if(trace_fraction < 1)
- {
- vector force;
- force = angle * cvar("g_balance_electro_primary_force") + '0 0 1' * cvar("g_balance_electro_primary_force_up");
- Damage (trace_ent, self.owner, self.owner, cvar("g_balance_electro_primary_damage") * cvar("g_balance_electro_primary_refire"), WEP_ELECTRO, trace_endpos, force * cvar("g_balance_electro_primary_refire"));
- W_Plasma_TriggerCombo(trace_endpos, cvar("g_balance_electro_primary_comboradius"), self.owner);
- }
- self.nextdamagethink = time + cvar("g_balance_electro_primary_refire");
+ vecs = self.owner.weaponentity.movedir;
+ vecs_y = -vecs_y;
}
-
- self.angles = '0 0 0';
- self.scale = vlen(gettaginfo(self, 0) - trace_endpos) / 256 * (0.75 + 0.75 * random());
-
- // v_forward, v_right, v_up now are the ACTUAL directions
- // express self.angles in terms of them to aim at target!
- self.angles = vectoangles('1 0 0' * (angle * v_forward) + '0 -1 0' * (angle * v_right) + '0 0 1' * (angle * v_up));
+ else
+ vecs = '0 0 0';
+ org = self.owner.origin + self.owner.view_ofs + v_forward * vecs_x + v_right * vecs_y + v_up * vecs_z;
+
+ // TODO turn into a csqc entity
+ WriteByte(MSG_BROADCAST, SVC_TEMPENTITY);
+ WriteByte(MSG_BROADCAST, TE_CSQC_BEAM);
+ WriteByte(MSG_BROADCAST, num_for_edict(self.owner));
+ WriteByte(MSG_BROADCAST, sound_allowed(MSG_BROADCAST, self.owner) ? 1 : 2);
+ WriteCoord(MSG_BROADCAST, org_x);
+ WriteCoord(MSG_BROADCAST, org_y);
+ WriteCoord(MSG_BROADCAST, org_z);
+ WriteCoord(MSG_BROADCAST, trace_endpos_x);
+ WriteCoord(MSG_BROADCAST, trace_endpos_y);
+ WriteCoord(MSG_BROADCAST, trace_endpos_z);
}
// experimental lightning gun
beam.think = lgbeam_think;
beam.owner = self;
beam.movetype = MOVETYPE_NONE;
- if(gettagindex(self.weaponentity, "shot"))
- setattachment(beam, self.weaponentity, "shot");
- else
- setattachment(beam, self.weaponentity, "tag_shot");
-
- oldself = self;
- self = beam;
- self.think();
- self = oldself;
-
- self.exteriorlgbeam = beam = spawn();
- setmodel(beam,"models/turrets/phaser_beam.md3");
- beam.effects = EF_LOWPRECISION;
- beam.solid = SOLID_NOT;
- beam.think = exteriorlgbeam_think;
- beam.owner = self;
- beam.movetype = MOVETYPE_NONE;
- //beam.viewmodelforclient = self;
- if(self.weaponentity.oldorigin_x > 0)
- {
- setattachment(beam, self.exteriorweaponentity, "");
- setorigin(beam, self.weaponentity.oldorigin);
- }
- else
- {
- if(gettagindex(self.exteriorweaponentity, "shot"))
- setattachment(beam, self.exteriorweaponentity, "shot");
- else
- setattachment(beam, self.exteriorweaponentity, "tag_shot");
- }
-
beam.shot_spread = 0;
beam.bot_dodge = TRUE;
beam.bot_dodgerating = cvar("g_balance_electro_primary_damage");
self = oldself;
}
+void ElectroInit()
+{
+ weapon_action(WEP_ELECTRO, WR_PRECACHE);
+ electro_shotorigin = shotorg_adjust(CL_Weapon_GetShotOrg(WEP_ELECTRO), TRUE, FALSE);
+}
+
void spawnfunc_weapon_electro (void)
{
weapon_defaultspawnfunc(WEP_ELECTRO);