SERVER: Fix usage of Co-Op spawnpoints

This commit is contained in:
Steam Deck User 2023-01-13 11:42:27 -05:00
parent db767b5af8
commit 29f3ca4849

View file

@ -511,11 +511,9 @@ void() PollPlayerPoints =
void() PlayerSpawn = void() PlayerSpawn =
{ {
local entity spawnpoint; entity spawnpoint;
local_client = self; local_client = self;
spawnpoint = find(world, classname, "info_player_start");
self.isspec = FALSE; self.isspec = FALSE;
self.classname = "player"; self.classname = "player";
self.solid = SOLID_BBOX; self.solid = SOLID_BBOX;
@ -534,22 +532,39 @@ void() PlayerSpawn =
} }
} }
switch(player_count) { if (!self.playernum) {
default: spawnpoint = find(world, classname, "info_player_start"); if (!spawnpoint) {spawnpoint = find(world, classname, "info_player_start");} break; self.playernum = player_count + 1;
case 1: spawnpoint = find(world, classname, "info_player_nikolai"); if (!spawnpoint) {spawnpoint = find(world, classname, "info_player_start");} break; if (self.playernum == 1)
case 2: spawnpoint = find(world, classname, "info_player_takeo"); if (!spawnpoint) {spawnpoint = find(world, classname, "info_player_start");} break; pl1 = self;
case 3: spawnpoint = find(world, classname, "info_player_doctor"); if (!spawnpoint) {spawnpoint = find(world, classname, "info_player_start");} break;
} }
if (self.playernum) { // Solo Play, pick any Spot.
if (player_count == 0) {
float number = random();
if (number < 0.25)
spawnpoint = find(world, classname, "info_player_tank");
else if (number < 0.50)
spawnpoint = find(world, classname, "info_player_nikolai");
else if (number < 0.75)
spawnpoint = find(world, classname, "info_player_takeo");
else
spawnpoint = find(world, classname, "info_player_doctor");
} else {
switch(self.playernum) { switch(self.playernum) {
default: spawnpoint = find(world, classname, "info_player_start"); if (!spawnpoint) {spawnpoint = find(world, classname, "info_player_start");} break; case 1: spawnpoint = find(world, classname, "info_player_tank"); break;
case 1: spawnpoint = find(world, classname, "info_player_nikolai"); if (!spawnpoint) {spawnpoint = find(world, classname, "info_player_start");} break; case 2: spawnpoint = find(world, classname, "info_player_nikolai"); break;
case 2: spawnpoint = find(world, classname, "info_player_takeo"); if (!spawnpoint) {spawnpoint = find(world, classname, "info_player_start");} break; case 3: spawnpoint = find(world, classname, "info_player_takeo"); break;
case 3: spawnpoint = find(world, classname, "info_player_doctor"); if (!spawnpoint) {spawnpoint = find(world, classname, "info_player_start");} break; case 4: spawnpoint = find(world, classname, "info_player_doctor"); break;
} default: break;
}
} }
// Mapper doesn't have our co-op spawn set up..
if (!spawnpoint)
spawnpoint = find(world, classname, "info_player_start");
self.origin = spawnpoint.origin + [0,0,1]; self.origin = spawnpoint.origin + [0,0,1];
self.angles = spawnpoint.angles; self.angles = spawnpoint.angles;
self.fixangle = TRUE; self.fixangle = TRUE;
@ -588,12 +603,6 @@ void() PlayerSpawn =
//self.zoom = 1; // This is to fix an aimin bug for the kar scope //self.zoom = 1; // This is to fix an aimin bug for the kar scope
if (!self.playernum) {
self.playernum = player_count + 1;
if (self.playernum == 1)
pl1 = self;
}
if (rounds < 1 && player_count == 0) { if (rounds < 1 && player_count == 0) {
sound(self, CHAN_AUTO, "sounds/rounds/splash.wav", 1, ATTN_NONE); sound(self, CHAN_AUTO, "sounds/rounds/splash.wav", 1, ATTN_NONE);
} }