6 * Update this.tur_shotorg by getting up2date bone info
7 * NOTICE this func overwrites the global v_forward, v_right and v_up vectors.
9 float turret_tag_fire_update(entity this)
13 LOG_DEBUG("Call to turret_tag_fire_update with this.tur_head missing!");
14 this.tur_shotorg = '0 0 0';
18 this.tur_shotorg = gettaginfo(this.tur_head, gettagindex(this.tur_head, "tag_fire"));
19 v_forward = normalize(v_forward);
25 * Railgun-like beam, but has thickness and suppots slowing of target
27 void FireImoBeam(entity this, vector start, vector end, vector smin, vector smax,
28 float bforce, float f_dmg, float f_velfactor, int deathtype)
31 vector hitloc, force, endpoint, dir;
34 dir = normalize(end - start);
37 // go a little bit into the wall because we need to hit this wall later
40 // trace multiple times until we hit a wall, each obstacle will be made unsolid.
41 // note down which entities were hit so we can damage them later
44 tracebox(start, smin, smax, end, false, this);
46 // if it is NULL we can't hurt it so stop now
47 if (trace_ent == NULL || trace_fraction == 1)
50 if (trace_ent.solid == SOLID_BSP)
53 // make the entity non-solid so we can hit the next one
54 trace_ent.railgunhit = true;
55 trace_ent.railgunhitloc = end;
56 trace_ent.railgunhitsolidbackup = trace_ent.solid;
58 // stop if this is a wall
60 // make the entity non-solid
61 trace_ent.solid = SOLID_NOT;
64 endpoint = trace_endpos;
66 // find all the entities the railgun hit and restore their solid state
67 ent = findfloat(NULL, railgunhit, true);
70 // restore their solid type
71 ent.solid = ent.railgunhitsolidbackup;
72 ent = findfloat(ent, railgunhit, true);
75 // find all the entities the railgun hit and hurt them
76 ent = findfloat(NULL, railgunhit, true);
79 // get the details we need to call the damage function
80 hitloc = ent.railgunhitloc;
81 ent.railgunhitloc = '0 0 0';
82 ent.railgunhitsolidbackup = SOLID_NOT;
83 ent.railgunhit = false;
88 Damage (ent, this, this, f_dmg, deathtype, DMG_NOWEP, hitloc, force);
89 ent.velocity = ent.velocity * f_velfactor;
90 //ent.alpha = 0.25 + random() * 0.75;
93 // advance to the next entity
94 ent = findfloat(ent, railgunhit, true);
96 trace_endpos = endpoint;
100 void marker_think(entity this)
105 setthink(this, SUB_Remove);
106 this.nextthink = time;
114 this.nextthink = time;
117 void mark_error(vector where,float lifetime)
119 entity err = new(error_marker);
120 setmodel(err, MDL_MARKER);
121 setorigin(err, where);
122 set_movetype(err, MOVETYPE_NONE);
123 setthink(err, marker_think);
124 err.nextthink = time;
127 err.cnt = lifetime + time;
130 void mark_info(vector where,float lifetime)
132 entity err = new(info_marker);
133 setmodel(err, MDL_MARKER);
134 setorigin(err, where);
135 set_movetype(err, MOVETYPE_NONE);
136 setthink(err, marker_think);
137 err.nextthink = time;
140 err.cnt = lifetime + time;
143 entity mark_misc(vector where,float lifetime)
145 entity err = new(mark_misc);
146 setmodel(err, MDL_MARKER);
147 setorigin(err, where);
148 set_movetype(err, MOVETYPE_NONE);
149 setthink(err, marker_think);
150 err.nextthink = time;
153 err.cnt = lifetime + time;
157 MODEL(TUR_C512, "models/turrets/c512.md3");
160 * Paint a v_color colord circle on target onwho
161 * that fades away over f_time
163 void paint_target(entity onwho, float f_size, vector v_color, float f_time)
168 setmodel(e, MDL_TUR_C512); // precision set above
169 e.scale = (f_size/512);
170 //setsize(e, '0 0 0', '0 0 0');
171 //setattachment(e,onwho,"");
172 setorigin(e, onwho.origin + '0 0 1');
174 set_movetype(e, MOVETYPE_FLY);
176 e.velocity = (v_color * 32); // + '0 0 1' * 64;
178 e.colormod = v_color;
179 SUB_SetFade(e,time,f_time);
182 void paint_target2(entity onwho, float f_size, vector v_color, float f_time)
187 setmodel(e, MDL_TUR_C512); // precision set above
188 e.scale = (f_size/512);
189 setsize(e, '0 0 0', '0 0 0');
191 setorigin(e, onwho.origin + '0 0 1');
193 set_movetype(e, MOVETYPE_FLY);
195 e.velocity = (v_color * 32); // + '0 0 1' * 64;
196 e.avelocity_x = -128;
198 e.colormod = v_color;
199 SUB_SetFade(e,time,f_time);
202 void paint_target3(vector where, float f_size, vector v_color, float f_time)
206 setmodel(e, MDL_TUR_C512); // precision set above
207 e.scale = (f_size/512);
208 setsize(e, '0 0 0', '0 0 0');
209 setorigin(e, where + '0 0 1');
210 set_movetype(e, MOVETYPE_NONE);
211 e.velocity = '0 0 0';
212 e.colormod = v_color;
213 SUB_SetFade(e,time,f_time);