2 #include "../dpdefs/csprogsdefs.qh"
3 #include "autocvars.qh"
20 //Draw_CylindricLine(self.fx_start, self.fx_end, self.fx_with, self.fx_texture, 0, time * 3, '1 1 1', 0.7, DRAWFLAG_ADDITIVE, view_origin);
21 Draw_CylindricLine(self.fx_start, self.fx_end, self.fx_with, self.fx_texture, (self.fx_with/256), 0, '1 1 1', 1, DRAWFLAG_ADDITIVE, view_origin);
24 void b_make(vector s,vector e, string t,float l,float z)
33 b.nextthink = time + l;
36 //b.dphitcontentsmask = DPCONTENTS_SOLID | DPCONTENTS_BODY | DPCONTENTS_PLAYERCLIP;
40 void cl_effects_lightningarc(vector from, vector to,float seglength,float drifts,float drifte,float branchfactor,float branchfactor_add)
42 vector direction,dirnew, pos, pos_l;
43 float length, steps, steplength, i,drift;
45 length = vlen(from - to);
49 steps = floor(length / seglength);
52 te_lightning1(world,from,to);
56 steplength = length / steps;
57 direction = normalize(to - from);
59 if(length > seglength)
61 for(i = 1; i < steps; i += 1)
63 drift = drifts * (1 - (i / steps)) + drifte * (i / steps);
64 dirnew = normalize(direction * (1 - drift) + randomvec() * drift);
65 pos = pos_l + dirnew * steplength;
66 te_lightning1(world,pos_l,pos);
67 if(random() < branchfactor)
68 cl_effects_lightningarc(pos, pos + (dirnew * length * 0.25),seglength,drifts,drifte,min(branchfactor + branchfactor_add,1),branchfactor_add);
72 te_lightning1(world,pos_l,to);
76 te_lightning1(world,from,to);
80 void Net_ReadLightningarc()
84 from.x = ReadCoord(); from.y = ReadCoord(); from.z = ReadCoord();
85 to.x = ReadCoord(); to.y = ReadCoord(); to.z = ReadCoord();
87 if(autocvar_cl_effects_lightningarc_simple)
89 te_lightning1(world,from,to);
93 float seglength, drifts, drifte, branchfactor, branchfactor_add;
95 seglength = autocvar_cl_effects_lightningarc_segmentlength;
96 drifts = autocvar_cl_effects_lightningarc_drift_start;
97 drifte = autocvar_cl_effects_lightningarc_drift_end;
98 branchfactor = autocvar_cl_effects_lightningarc_branchfactor_start;
99 branchfactor_add = autocvar_cl_effects_lightningarc_branchfactor_add;
101 cl_effects_lightningarc(from,to,seglength,drifts,drifte,branchfactor,branchfactor_add);
105 void Net_ReadArc() { Net_ReadLightningarc(); }