1 .vector personal_v_angle; // view angles to restore on impulse 77
3 void CopyBody(float keepvelocity);
5 // changes by LordHavoc on 03/30/04
6 // cleaned up dummy code
7 // dummies are now removed eventually after being gibbed (norespawn = TRUE)
8 // dummy impulse now checks sv_cheats to prevent players from overwhelming server with dummies
9 // dummies now use player code where possible
11 void player_anim (void);
14 self.think = DummyThink;
15 self.nextthink = time;
23 void(entity e, vector v) printsurfaceinfo =
25 local float surfnum, numpoints, vnum;
28 surfnum = getsurfacenearpoint(e, v);
31 sprint(self, "texture: ");
32 s = getsurfacetexture(e, surfnum);
34 sprint(self, " normal: ");
35 n = getsurfacenormal(e, surfnum);
36 sprint(self, vtos(n));
38 numpoints = getsurfacenumpoints(e, surfnum);
39 sprint(self, ftos(numpoints));
40 sprint(self, " verts:");
42 while (vnum < numpoints)
45 n = getsurfacepoint(e, surfnum, vnum);
46 sprint(self, vtos(n));
49 sprint(self, " point tested: ");
50 sprint(self, vtos(v));
51 sprint(self, " nearest point on surface: ");
52 n = getsurfaceclippedpoint(e, surfnum, v);
53 sprint(self, vtos(n));
58 void ImpulseCommands (void)
65 if (imp >= 1 && imp <= 12)
67 // weapon switching impulses
68 if(self.deadflag == DEAD_NO)
76 else if (imp == 11) // last weapon
77 W_SwitchWeapon (self.cnt);
80 self.impulse = imp; // retry in next frame
85 if(self.deadflag == DEAD_NO)
87 if (self.weapon != WEP_LASER
88 && !cvar("g_minstagib") && !cvar("g_instagib")
89 && !cvar("g_rocketarena") && !g_lms && cvar("g_pickup_items") && !cvar("g_nixnex"))
90 W_ThrowWeapon(W_CalculateProjectileVelocity(self.velocity, v_forward * 750), '0 0 0', TRUE);
94 else if (imp >= 30 && imp <= 49)
98 WaypointSprite_DeployPersonal("waypoint", self.origin);
99 self.personal_v_angle = self.v_angle;
100 sprint(self, "personal waypoint spawned at location\n");
104 WaypointSprite_DeployPersonal("waypoint", self.cursor_trace_endpos);
105 self.personal_v_angle = self.v_angle;
106 sprint(self, "personal waypoint spawned at crosshair\n");
108 else if(imp == 32 && vlen(self.death_origin))
110 WaypointSprite_DeployPersonal("waypoint", self.death_origin);
111 self.personal_v_angle = self.v_angle;
112 sprint(self, "personal waypoint spawned at death location\n");
114 else if(imp == 33 && self.deadflag == DEAD_NO && teams_matter)
116 WaypointSprite_Attach("helpme", TRUE);
117 sprint(self, "HELP ME attached\n");
121 WaypointSprite_DeployFixed("here", FALSE, self.origin);
122 sprint(self, "HERE spawned at location\n");
126 WaypointSprite_DeployFixed("here", FALSE, self.cursor_trace_endpos);
127 sprint(self, "HERE spawned at crosshair\n");
129 else if(imp == 36 && vlen(self.death_origin))
131 WaypointSprite_DeployFixed("here", FALSE, self.death_origin);
132 sprint(self, "HERE spawned at death location\n");
136 WaypointSprite_DeployFixed("danger", FALSE, self.origin);
137 sprint(self, "DANGER spawned at location\n");
141 WaypointSprite_DeployFixed("danger", FALSE, self.cursor_trace_endpos);
142 sprint(self, "DANGER spawned at crosshair\n");
144 else if(imp == 39 && vlen(self.death_origin))
146 WaypointSprite_DeployFixed("danger", FALSE, self.death_origin);
147 sprint(self, "DANGER spawned at death location\n");
151 WaypointSprite_ClearPersonal();
152 sprint(self, "personal waypoint cleared\n");
156 WaypointSprite_ClearOwned();
157 sprint(self, "all waypoints cleared\n");
161 self.cvar_cl_hidewaypoints = !(self.cvar_cl_hidewaypoints);
162 sprint(self, "fixed waypoints now ");
163 if(self.cvar_cl_hidewaypoints)
164 sprint(self, "OFF\n");
166 sprint(self, "ON\n");
175 makevectors(self.v_angle);
176 traceline(self.origin + self.view_ofs, self.origin + self.view_ofs + v_forward * MAX_SHOT_DISTANCE, FALSE, self);
177 if (trace_fraction < 1)
178 printsurfaceinfo(trace_ent, trace_endpos);
182 makevectors(self.v_angle);
183 traceline(self.origin + self.view_ofs, self.origin + self.view_ofs + v_forward * 65536, FALSE, self);
184 sprint(self, strcat("distance: ", ftos(fabs(vlen(trace_endpos - (self.origin + self.view_ofs)))), "\n"));
186 else if(self.deadflag == DEAD_NO)
190 if(self.waypointsprite_deployed_personal)
192 tracebox(self.waypointsprite_deployed_personal.origin, self.mins, self.maxs, self.waypointsprite_deployed_personal.origin, MOVE_WORLDONLY, self);
195 sprint(self, "Cannot move there, cheater - only waypoints set using g_waypointsprite_personal work\n");
199 // Abort speedrun, teleport back
200 setorigin(self, self.waypointsprite_deployed_personal.origin);
201 self.velocity = '0 0 0';
202 self.angles = self.personal_v_angle;
203 self.fixangle = TRUE;
206 bprint("The ", self.flagcarried.netname, " was returned to base by its carrier\n");
207 ReturnFlag(self.flagcarried);
212 sprint(self, "No waypoint set, cheater (use g_waypointsprite_personal to set one)\n");
216 self.items |= (IT_LASER | IT_UZI | IT_SHOTGUN | IT_GRENADE_LAUNCHER | IT_ELECTRO | IT_CRYLINK | IT_NEX | IT_HAGAR | IT_ROCKET_LAUNCHER);
217 self.ammo_shells = cvar("g_pickup_shells_max");
218 self.ammo_nails = cvar("g_pickup_nails_max");
219 self.ammo_rockets = cvar("g_pickup_rockets_max");
220 self.ammo_cells = cvar("g_pickup_cells_max");
221 self.health = cvar("g_pickup_healthshard_max");
222 self.armorvalue = cvar("g_pickup_armorshard_max");
223 self.pauserotarmor_finished = time + cvar("g_balance_pause_armor_rot_spawn");
224 self.pauserothealth_finished = time + cvar("g_balance_pause_health_rot_spawn");
225 self.pauseregen_finished = time + cvar("g_balance_pause_health_regen_spawn");
226 // precache weapon models/sounds
229 while (wep <= WEP_LAST)
231 weapon_action(wep, WR_PRECACHE);
237 makevectors (self.v_angle);
238 self.velocity = self.velocity + v_forward * 300;
240 self.velocity = self.velocity - v_forward * 300;
248 if (cvar("g_waypointeditor"))
251 if (imp == 103) waypoint_schedulerelink(waypoint_spawn(self.origin, self.origin, 0));
252 else if (imp == 104) {e = navigation_findnearestwaypoint(self, FALSE);if (e) waypoint_remove(e);}
253 else if (imp == 105) waypoint_schedulerelinkall();
254 else if (imp == 106) waypoint_saveall();