}
void br_Start(){
- br_started = true;
-
// battle royale does not need those, besides, the timelimit won't be visible anymore after the game started
cvar_set("timelimit", "0");
cvar_set("fraglimit", "0");
reset_map(true, false);
ring = ring_initialize();
-
dropship = dropship_initialize();
- if(!dropship)
+ if(!ring || !dropship)
{
- delete(ring);
- ring = NULL;
+ if(!ring)
+ LOG_WARN("Failed to determine ring starting point");
+ if(!dropship)
+ LOG_WARN("Failed to determine dropship route");
+
+ LOG_WARN("Prerequisites not met. Cannot start battle royale, aborting...");
+
+ if(ring)
+ {
+ delete(ring);
+ ring = NULL;
+ }
+
+ if(dropship)
+ {
+ delete(dropship);
+ dropship = NULL;
+ }
- FOREACH_CLIENT(IS_PLAYER(it), {
- TRANSMUTE(Observer, it);
- PutClientInServer(it);
- });
- LOG_SEVERE("Failed to determine dropship route, aborting...");
+ NextLevel();
+ return;
}
+ br_started = true;
int num_players = 0;
FOREACH_CLIENT(IS_PLAYER(it), {
for(int i = 0; i < 100; ++i) // try to find a dropship path multiple times
{
- if(!MoveToRandomLocationWithinBounds(this, world.mins, world.maxs, this.dphitcontentsmask, DPCONTENTS_SLIME | DPCONTENTS_LAVA | DPCONTENTS_SKY | DPCONTENTS_DONOTENTER, Q3SURFACEFLAG_SKY, 100, 8192, 1024, false))
+ if(!MoveToRandomLocationWithinBounds(this, world.mins, world.maxs, this.dphitcontentsmask, DPCONTENTS_SLIME | DPCONTENTS_LAVA | DPCONTENTS_SKY | DPCONTENTS_DONOTENTER, Q3SURFACEFLAG_SKY, 100, 65536, 0, false))
continue;
vector mult;
dropship_path_length = trace_fraction * vlen(endorigin - startorigin);
if(dropship_path_length < (vlen(vec2(world.maxs - world.mins)) / 4)) // if the dropship path isn't atleast one quarter of the diagonal length of the map, retry, we're probably in a building
continue;
+ if(!(trace_dphitq3surfaceflags & (Q3SURFACEFLAG_SKY | Q3SURFACEFLAG_NOIMPACT | Q3SURFACEFLAG_NOMARKS))) // dropship did not reach the sky
+ continue;
endorigin = trace_endpos;
dropship_path_direction = normalize(endorigin - startorigin);
ring_parseStrength(this, has_invalid_timings);
this.strength = this.br_ring_stage_strength[0];
- MoveToRandomLocationWithinBounds(this, world.mins, world.maxs, DPCONTENTS_SOLID, DPCONTENTS_SLIME | DPCONTENTS_LAVA | DPCONTENTS_SKY | DPCONTENTS_DONOTENTER, Q3SURFACEFLAG_SKY, 2500, 0, 0, false);
+ if(!MoveToRandomLocationWithinBounds(this, world.mins, world.maxs, DPCONTENTS_SOLID, DPCONTENTS_SLIME | DPCONTENTS_LAVA | DPCONTENTS_SKY | DPCONTENTS_DONOTENTER, Q3SURFACEFLAG_SKY, 1000, 0, 0, false))
+ {
+ delete(this);
+ return NULL;
+ }
ring_alignPosition(this);
ring_link(this);