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 dir = normalize(end - start);
32 vector force = dir * bforce;
34 // go a little bit into the wall because we need to hit this wall later
37 // trace multiple times until we hit a wall, each obstacle will be made unsolid.
38 // note down which entities were hit so we can damage them later
42 if(CS(this).antilag_debug)
43 WarpZone_tracebox_antilag (this, start, smin, smax, end, false, o, CS(this).antilag_debug);
45 WarpZone_tracebox_antilag (this, start, smin, smax, end, false, o, ANTILAG_LATENCY(this));
46 if(o && WarpZone_trace_firstzone)
52 // if it is NULL we can't hurt it so stop now
53 if (trace_ent == NULL || trace_fraction == 1)
56 // make the entity non-solid so we can hit the next one
57 IL_PUSH(g_railgunhit, trace_ent);
58 trace_ent.railgunhit = true;
59 trace_ent.railgunhitloc = end;
60 trace_ent.railgunhitsolidbackup = trace_ent.solid;
61 trace_ent.railgundistance = vlen(WarpZone_UnTransformOrigin(WarpZone_trace_transform, trace_endpos) - start);
62 trace_ent.railgunforce = WarpZone_TransformVelocity(WarpZone_trace_transform, force);
64 // stop if this is a wall
65 if (trace_ent.solid == SOLID_BSP)
68 // make the entity non-solid
69 trace_ent.solid = SOLID_NOT;
72 vector endpoint = trace_endpos;
73 entity endent = trace_ent;
74 float endq3surfaceflags = trace_dphitq3surfaceflags;
76 // find all the entities the railgun hit and restore their solid state
77 IL_EACH(g_railgunhit, it.railgunhit,
79 it.solid = it.railgunhitsolidbackup;
83 Unlike the railgun, this does NOT check for targets close by
86 // find all the entities the railgun hit and hurt them
87 IL_EACH(g_railgunhit, it.railgunhit,
89 // removal from the list is handled below
90 /* no falloff applied */
95 Damage(it, this, this, f_dmg, deathtype, DMG_NOWEP, it.railgunhitloc, it.railgunforce);
96 // slow down the target
97 it.velocity = it.velocity * f_velfactor;
100 it.railgunhitloc = '0 0 0';
101 it.railgunhitsolidbackup = SOLID_NOT;
102 it.railgunhit = false;
103 it.railgundistance = 0;
106 IL_CLEAR(g_railgunhit);
108 /* no accuracy, as a weapon entity is not attached */
110 trace_endpos = endpoint;
112 trace_dphitq3surfaceflags = endq3surfaceflags;
116 void marker_think(entity this)
121 setthink(this, SUB_Remove);
122 this.nextthink = time;
130 this.nextthink = time;
133 void mark_error(vector where,float lifetime)
135 entity err = new(error_marker);
136 setmodel(err, MDL_MARKER);
137 setorigin(err, where);
138 set_movetype(err, MOVETYPE_NONE);
139 setthink(err, marker_think);
140 err.nextthink = time;
143 err.cnt = lifetime + time;
146 void mark_info(vector where,float lifetime)
148 entity err = new(info_marker);
149 setmodel(err, MDL_MARKER);
150 setorigin(err, where);
151 set_movetype(err, MOVETYPE_NONE);
152 setthink(err, marker_think);
153 err.nextthink = time;
156 err.cnt = lifetime + time;
159 entity mark_misc(vector where,float lifetime)
161 entity err = new(mark_misc);
162 setmodel(err, MDL_MARKER);
163 setorigin(err, where);
164 set_movetype(err, MOVETYPE_NONE);
165 setthink(err, marker_think);
166 err.nextthink = time;
169 err.cnt = lifetime + time;
173 MODEL(TUR_C512, "models/turrets/c512.md3");
176 * Paint a v_color colord circle on target onwho
177 * that fades away over f_time
179 void paint_target(entity onwho, float f_size, vector v_color, float f_time)
182 setmodel(e, MDL_TUR_C512);
183 e.scale = (f_size/512);
184 //setsize(e, '0 0 0', '0 0 0');
185 //setattachment(e,onwho,"");
186 setorigin(e, onwho.origin + '0 0 1');
188 set_movetype(e, MOVETYPE_FLY);
190 e.velocity = (v_color * 32); // + '0 0 1' * 64;
192 e.colormod = v_color;
193 SUB_SetFade(e,time,f_time);
196 void paint_target2(entity onwho, float f_size, vector v_color, float f_time)
199 setmodel(e, MDL_TUR_C512);
200 e.scale = (f_size/512);
201 setsize(e, '0 0 0', '0 0 0');
203 setorigin(e, onwho.origin + '0 0 1');
205 set_movetype(e, MOVETYPE_FLY);
207 e.velocity = (v_color * 32); // + '0 0 1' * 64;
208 e.avelocity_x = -128;
210 e.colormod = v_color;
211 SUB_SetFade(e,time,f_time);
214 void paint_target3(vector where, float f_size, vector v_color, float f_time)
217 setmodel(e, MDL_TUR_C512);
218 e.scale = (f_size/512);
219 setsize(e, '0 0 0', '0 0 0');
220 setorigin(e, where + '0 0 1');
221 set_movetype(e, MOVETYPE_NONE);
222 e.velocity = '0 0 0';
223 e.colormod = v_color;
224 SUB_SetFade(e,time,f_time);