3 float arena_roundbased;
5 .entity spawnqueue_next;
6 .entity spawnqueue_prev;
8 entity spawnqueue_first;
9 entity spawnqueue_last;
13 void PutObserverInServer();
14 void PutClientInServer();
15 void(entity e) DropFlag;
16 void(entity e) ReturnFlag;
17 void(entity e) removedecor;
21 if(cvar("g_arena_warmup"))
22 warmup = time + cvar("g_arena_warmup");
24 self = nextent(world);
27 if(self.classname == "droppedweapon" // cleanup
28 || self.classname == "gib"
29 || self.classname == "body")
33 else if(self.flags & FL_ITEM) // reset items
35 self.model = self.mdl;
36 self.solid = SOLID_TRIGGER;
37 setorigin (self, self.origin);
38 self.think = SUB_Null;
40 self.effects = self.effects - (self.effects & EF_STARDUST);
42 else if(self.flags & FL_PROJECTILE) // remove any projectiles left
44 sound(self, CHAN_BODY, "misc/null.wav", 1, ATTN_NORM);
51 else if(self.flags & FL_CLIENT) // reset all players
56 PutObserverInServer();
66 void Spawnqueue_Insert(entity e)
70 dprint(strcat("Into queue: ", e.netname, "\n"));
71 e.spawnqueue_in = TRUE;
72 e.spawnqueue_prev = spawnqueue_last;
73 e.spawnqueue_next = world;
75 spawnqueue_last.spawnqueue_next = e;
81 void Spawnqueue_Remove(entity e)
85 dprint(strcat("Out of queue: ", e.netname, "\n"));
86 e.spawnqueue_in = FALSE;
87 if(e == spawnqueue_first)
88 spawnqueue_first = e.spawnqueue_next;
89 if(e == spawnqueue_last)
90 spawnqueue_last = e.spawnqueue_prev;
92 e.spawnqueue_prev.spawnqueue_next = e.spawnqueue_next;
94 e.spawnqueue_next.spawnqueue_prev = e.spawnqueue_prev;
95 e.spawnqueue_next = world;
96 e.spawnqueue_prev = world;
99 void Spawnqueue_Unmark(entity e)
104 numspawned = numspawned - 1;
107 void Spawnqueue_Mark(entity e)
112 numspawned = numspawned + 1;
120 if(!arena_roundbased)
123 f = rint(warmup - time);
126 if(time < warmup && self.spawned)
129 centermsg_set(CENTERMSG_ARENACHAMP, strcat("The Champion is ", champion.netname));
132 centermsg_set(CENTERMSG_ARENATIMER, strcat("Round will start in ", ftos(f)));
136 centermsg_set(CENTERMSG_ARENATIMER, "^1Fight!");
140 self.movetype = MOVETYPE_NONE;
142 self.velocity = '0 0 0';
143 self.avelocity = '0 0 0';
144 self.movement = '0 0 0';
145 //self.fixangle = TRUE;
147 else if(self.movetype == MOVETYPE_NONE)
149 self.movetype = MOVETYPE_WALK;
156 void Spawnqueue_Check()
158 if(time < warmup + 1)
163 next_round = time + 3;
165 if(!arena_roundbased || (next_round && next_round < time && player_count > 1))
171 champion = find(world, classname, "player");
172 while(champion && champion.deadflag)
173 champion = find(champion, classname, "player");
177 while(numspawned < maxspawned && spawnqueue_first)
179 self = spawnqueue_first;
181 bprint (strcat("^4", self.netname, "^4 is the next challenger\n"));
183 Spawnqueue_Remove(self);
184 Spawnqueue_Mark(self);
186 self.classname = "player";