2 // increments sprite frame, loops when end is hit.. simple
5 void (vector vec) WriteVec =
7 WriteCoord (MSG_BROADCAST, vec_x);
8 WriteCoord (MSG_BROADCAST, vec_y);
9 WriteCoord (MSG_BROADCAST, vec_z);
11 void (vector org, vector dir, float counts) W_Smoke =
13 WriteByte (MSG_BROADCAST, SVC_TEMPENTITY);
14 WriteByte (MSG_BROADCAST, TE_SMOKE);
17 WriteByte (MSG_BROADCAST, counts);
20 // increments sprite frame, loops when end is hit.. simple
21 void animate_sprite (float startframe, float frame_count)
23 if ((self.frame - startframe) >= (frame_count - 1 ))
24 self.frame = startframe;
26 self.frame = self.frame + 1;
29 void W_GiveWeapon (entity e, float wep, string name)
36 e.items = e.items | wep;
41 if (other.classname == "player")
43 sprint (other, "You got the ^2");
52 void FireRailgunBullet (vector start, vector end, float bdamage, float deathtype)
54 local vector hitloc, force, endpoint, dir;
56 //local entity explosion;
58 dir = normalize(end - start);
59 force = dir * 800; //(bdamage * 10);
61 // go a little bit into the wall because we need to hit this wall later
64 // trace multiple times until we hit a wall, each obstacle will be made
65 // non-solid so we can hit the next, while doing this we spawn effects and
66 // note down which entities were hit so we can damage them later
69 traceline_hitcorpse (self, start, end, FALSE, self);
71 //if (trace_ent.solid == SOLID_BSP && !(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT))
72 //if (!(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT))
73 // te_plasmaburn (trace_endpos - dir * 6);
75 // if it is world we can't hurt it so stop now
76 if (trace_ent == world || trace_fraction == 1)
79 // make the entity non-solid so we can hit the next one
80 trace_ent.railgunhit = TRUE;
81 trace_ent.railgunhitloc = end;
82 trace_ent.railgunhitsolidbackup = trace_ent.solid;
84 // stop if this is a wall
85 if (trace_ent.solid == SOLID_BSP)
88 // make the entity non-solid
89 trace_ent.solid = SOLID_NOT;
92 endpoint = trace_endpos;
94 // find all the entities the railgun hit and restore their solid state
95 ent = findfloat(world, railgunhit, TRUE);
98 // restore their solid type
99 ent.solid = ent.railgunhitsolidbackup;
100 ent = findfloat(ent, railgunhit, TRUE);
103 // spawn a temporary explosion entity for RadiusDamage calls
104 //explosion = spawn();
106 // find all the entities the railgun hit and hurt them
107 ent = findfloat(world, railgunhit, TRUE);
110 // get the details we need to call the damage function
111 hitloc = ent.railgunhitloc;
112 ent.railgunhitloc = '0 0 0';
113 ent.railgunhitsolidbackup = SOLID_NOT;
114 ent.railgunhit = FALSE;
117 if (ent.takedamage || ent.classname == "case")
118 Damage (ent, self, self, bdamage, deathtype, hitloc, force);
120 // create a small explosion to throw gibs around (if applicable)
121 //setorigin (explosion, hitloc);
122 //RadiusDamage (explosion, self, 10, 0, 50, world, 300, deathtype);
124 // advance to the next entity
125 ent = findfloat(ent, railgunhit, TRUE);
128 // we're done with the explosion entity, remove it
131 trace_endpos = endpoint;
134 void fireBullet (vector start, vector dir, float spread, float damage, float dtype, float tracer)
140 // use traceline_hitcorpse to make sure it can hit gibs and corpses too
141 dir = dir + randomvec() * spread;
142 end = start + dir * MAX_SHOT_DISTANCE;
143 traceline_hitcorpse (self, start, end, FALSE, self);
149 e.movetype = MOVETYPE_FLY;
151 e.think = SUB_Remove;
152 e.nextthink = time + vlen(trace_endpos - start) / 6000;
153 e.velocity = dir * 6000;
154 e.angles = vectoangles(e.velocity);
155 setmodel (e, "models/tracer.mdl");
156 setsize (e, '0 0 0', '0 0 0');
157 setorigin (e, start);
158 e.effects = e.effects | EF_ADDITIVE | EF_FULLBRIGHT | EF_NOSHADOW;
159 e.flags = FL_PROJECTILE;
162 if ((trace_fraction != 1.0) && (pointcontents (trace_endpos) != CONTENT_SKY))
164 if (trace_ent.solid == SOLID_BSP && !(trace_dphitq3surfaceflags & Q3SURFACEFLAG_NOIMPACT))
166 if (dtype == IT_SHOTGUN)
167 te_gunshot (trace_endpos);
169 te_spike (trace_endpos);
172 PointSound (trace_endpos, "weapons/ric1.ogg", 1, ATTN_NORM);
174 PointSound (trace_endpos, "weapons/ric2.ogg", 1, ATTN_NORM);
176 PointSound (trace_endpos, "weapons/ric3.ogg", 1, ATTN_NORM);
178 //else if (trace_ent.classname == "player" || trace_ent.classname == "corpse" || trace_ent.classname == "gib")
179 //stuffcmd(self, "play2 misc/hit.wav\n");
180 //sound (self, CHAN_BODY, "misc/hit.wav", 1, ATTN_NORM);
181 Damage (trace_ent, self, self, damage, dtype, trace_endpos, dir * damage * 5);