2 void info_player_start (void)
4 self.classname = "info_player_deathmatch";
7 void info_player_deathmatch (void)
15 Finds a point to respawn
18 entity SelectSpawnPoint (void)
20 local entity spot, thing;
23 spot = find (world, classname, "testplayerstart");
30 spot = find(spot, classname, "info_player_deathmatch");
33 if (spot == lastspawn)
36 thing = findradius(spot.origin, 70);
39 if (thing.classname == "player")
51 spot = find (world, classname, "info_player_start");
53 error ("PutClientInServer: no info_player_start on level");
63 Called when a client spawns in the server
66 void PutClientInServer (void)
71 spot = SelectSpawnPoint ();
73 self.classname = "player";
74 self.movetype = MOVETYPE_WALK;
75 self.solid = SOLID_SLIDEBOX;
76 self.flags = FL_CLIENT;
77 self.takedamage = DAMAGE_YES;
80 self.damageforcescale = 2;
89 self.pain_finished = 0;
91 self.deadflag = DEAD_NO;
93 self.view_ofs = PL_VIEW_OFS;
94 self.angles = spot.angles;
98 mdlrandom = crandom();
100 setmodel (self, "models/player/insurrectionist.zym");
102 setmodel (self, "models/player/mulder.zym");
104 setmodel (self, "models/player/lurk.zym");
106 setmodel (self, "models/player/grunt.zym");
108 setmodel (self, "models/player/pyria.zym");
110 setmodel (self, "models/player/headhunter.zym");
112 setmodel (self, "models/player/jeandarc.zym");
114 setmodel (self, "models/player/marine.zym");
116 setmodel (self, "models/player/robot.zym");
118 setmodel (self, "models/player/pyria.zym");
120 setmodel (self, "models/player/shock.zym");
122 setmodel (self, "models/player/lycanthrope.zym");
124 setmodel (self, "models/player/specop.zym");
126 setmodel (self, "models/player/visitant.zym");
129 setsize (self, PL_MIN, PL_MAX);
130 setorigin (self, spot.origin + '0 0 1' * (1 - self.mins_z - 24));
131 // don't reset back to last position, even if new position is stuck in solid
132 self.oldorigin = self.origin;
134 // self.items = IT_LASER | IT_UZI| IT_SHOTGUN | IT_GRENADE_LAUNCHER | IT_ELECTRO | IT_CRYLINK | IT_NEX | IT_HAGAR | IT_ROCKET_LAUNCHER;
135 // self.weapon = IT_UZI;
137 if (game & GAME_INSTAGIB)
140 self.weapon = IT_NEX;
141 self.ammo_shells = 0;
143 self.ammo_rockets = 0;
144 self.ammo_cells = 999;
146 else if (game & GAME_ROCKET_ARENA)
148 self.items = IT_ROCKET_LAUNCHER;
149 self.weapon = IT_ROCKET_LAUNCHER;
150 self.ammo_shells = 0;
152 self.ammo_rockets = 999;
157 self.items = IT_LASER | IT_UZI;
158 self.weapon = IT_UZI;
159 self.ammo_shells = 0;
160 self.ammo_nails = 25;
161 self.ammo_rockets = 0;
165 if (game & GAME_FULLBRIGHT_PLAYERS)
166 self.effects = EF_FULLBRIGHT;
168 self.event_damage = PlayerDamage;
170 self.statdraintime = time + 5;
171 self.button0 = self.button1 = self.button2 = self.button3 = 0;
176 //stuffcmd(self, "chase_active 0");
184 void SetNewParms (void)
194 void SetChangeParms (void)
203 Called when a client types 'kill' in the console
206 void ClientKill (void)
215 Called when a client connects to the server
218 void ClientConnect (void)
221 bprint (self.netname);
222 bprint (" connected\n");
229 Called when a client disconnects from the server
232 void ClientDisconnect (void)
234 ClientDisconnected();
235 bprint (self.netname);
236 bprint (" disconnected\n");
243 When you press the jump key
246 void PlayerJump (void)
248 if (!(self.flags & FL_ONGROUND))
250 if (!(self.flags & FL_JUMPRELEASED))
253 self.velocity_z = self.velocity_z + 250;
255 self.flags = self.flags - FL_ONGROUND;
256 self.flags = self.flags - FL_JUMPRELEASED;
269 Called every frame for each client before the physics are run
272 .float attack_finished;
273 void PlayerPreThink (void)
277 if (!self.hasaliases)
280 if (self.deadflag != DEAD_NO)
283 if (self.deadflag == DEAD_DYING)
285 if (time > self.dead_time)
286 self.deadflag = DEAD_DEAD;
288 else if (self.deadflag == DEAD_DEAD)
290 if (!self.button0 && !self.button2 && !self.button3)
291 self.deadflag = DEAD_RESPAWNABLE;
293 else if (self.deadflag == DEAD_RESPAWNABLE)
295 if (self.button0 || self.button2 || self.button3 || self.button4)
303 if (self.weapon == IT_ROCKET_LAUNCHER)
305 if (!(game & GAME_INSANE))
306 if (self.attack_finished < time && !self.button0 && !self.button3)
312 if (self.weapon == IT_GRENADE_LAUNCHER)
313 W_SecondaryAttack ();
314 if (self.weapon == IT_ROCKET_LAUNCHER)
315 W_SecondaryAttack ();
316 if (!(game & GAME_INSANE))
317 if (self.attack_finished < time && !self.button0)
318 W_SecondaryAttack ();
321 if (!(game & GAME_INSANE))
322 if (self.attack_finished < time)
329 self.flags = self.flags | FL_JUMPRELEASED;
333 if (self.weapon == IT_NEX)
334 if (self.viewzoom > 0.4)
335 self.viewzoom = max (0.4, self.viewzoom - frametime * 2);
337 else if (self.viewzoom < 1.0)
338 self.viewzoom = min (1.0, self.viewzoom + frametime);
340 if (self.statdraintime < time)
342 // GAME_REGENERATION does fast health regeneration up to 200. Note that your armour doesn't rot anymore either.
343 // Sajt - go ahead and tweak this, I just guessed some values :)
344 if (game & GAME_REGENERATION)
346 if (self.health < 200)
347 self.health = self.health + 2;
349 self.statdraintime = time + 0.25;
353 if (self.health < 25)
354 self.health = self.health + 3;
355 if (self.health < 50)
356 self.health = self.health + 2;
357 if (self.health < 100)
358 self.health = self.health + 1;
359 if (self.health > 100)
360 self.health = self.health - 1;
361 if (self.health > 150)
362 self.health = self.health - 2;
363 if (self.health > 200)
364 self.health = self.health - 4;
365 if (self.health > 250)
366 self.health = self.health - 6;
367 if (self.armorvalue > 100)
368 self.armorvalue = self.armorvalue - 1;
370 self.statdraintime = time + 1;
376 if (TetrisPreFrame()) return;
377 self.angles_y=self.v_angle_y + 90; // temp
385 Called every frame for each client after the physics are run
388 void PlayerPostThink (void)
395 if (TetrisPostFrame()) return;