1 float turret_tag_setup(float linked)
\r
10 f = gettagindex(self,"tag_head");
\r
11 v = gettaginfo(self,f);
\r
12 v = v + self.origin;
\r
13 setorigin(self.tur_head,v);
\r
15 f = gettagindex(self.tur_head,"tag_fire");
\r
16 v = gettaginfo(self.tur_head,f) + (self.tur_head.origin - self.origin);
\r
18 self.tur_shotorg = v;
\r
20 f = gettagindex(self.tur_head,"tag_aim");
\r
21 v = gettaginfo(self.tur_head,f) + (self.tur_head.origin - self.origin);
\r
22 self.tur_aimorg = v;
\r
27 float turret_tag_fire_update()
\r
32 f = gettagindex(self.tur_head,"tag_fire");
\r
33 v = gettaginfo(self.tur_head,f) + (self.tur_head.origin - self.origin);
\r
35 self.tur_shotorg = v;
\r
37 f = gettagindex(self.tur_head,"tag_aim");
\r
38 v = gettaginfo(self.tur_head,f) + (self.tur_head.origin - self.origin);
\r
39 self.tur_aimorg = v;
\r
44 void FireImoBeam (vector start,vector end,vector smin,vector smax,
\r
45 float bforce,float f_dmg,float f_velfactor, float deathtype)
\r
48 local vector hitloc, force, endpoint, dir;
\r
51 dir = normalize(end - start);
\r
52 force = dir * bforce;
\r
54 // go a little bit into the wall because we need to hit this wall later
\r
57 // trace multiple times until we hit a wall, each obstacle will be made unsolid.
\r
58 // note down which entities were hit so we can damage them later
\r
61 tracebox(start, smin, smax, end, FALSE, self);
\r
63 // if it is world we can't hurt it so stop now
\r
64 if (trace_ent == world || trace_fraction == 1)
\r
67 if (trace_ent.solid == SOLID_BSP)
\r
70 // make the entity non-solid so we can hit the next one
\r
71 trace_ent.railgunhit = TRUE;
\r
72 trace_ent.railgunhitloc = end;
\r
73 trace_ent.railgunhitsolidbackup = trace_ent.solid;
\r
75 // stop if this is a wall
\r
78 // make the entity non-solid
\r
79 trace_ent.solid = SOLID_NOT;
\r
82 endpoint = trace_endpos;
\r
84 // find all the entities the railgun hit and restore their solid state
\r
85 ent = findfloat(world, railgunhit, TRUE);
\r
88 // restore their solid type
\r
89 ent.solid = ent.railgunhitsolidbackup;
\r
90 ent = findfloat(ent, railgunhit, TRUE);
\r
93 // find all the entities the railgun hit and hurt them
\r
94 ent = findfloat(world, railgunhit, TRUE);
\r
97 // get the details we need to call the damage function
\r
98 hitloc = ent.railgunhitloc;
\r
99 ent.railgunhitloc = '0 0 0';
\r
100 ent.railgunhitsolidbackup = SOLID_NOT;
\r
101 ent.railgunhit = FALSE;
\r
103 // apply the damage
\r
104 if (ent.takedamage)
\r
106 Damage (ent, self, self, f_dmg, deathtype, hitloc, force);
\r
107 ent.velocity = ent.velocity * f_velfactor;
\r
108 //ent.alpha = 0.25 + random() * 0.75;
\r
111 // advance to the next entity
\r
112 ent = findfloat(ent, railgunhit, TRUE);
\r
114 trace_endpos = endpoint;
\r