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();
63 UpdateFrags(champion, +1);
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 msg = strcat(msg, "The Champion is ", champion.netname, "^7\n\n\n");
132 msg = strcat(msg, "Round will start in ", ftos(f));
136 msg = strcat(msg, "^1Fight!");
139 centerprint(self, msg);
142 self.movetype = MOVETYPE_NONE;
144 self.velocity = '0 0 0';
145 self.avelocity = '0 0 0';
146 self.movement = '0 0 0';
147 //self.fixangle = TRUE;
149 else if(self.movetype == MOVETYPE_NONE)
151 self.movetype = MOVETYPE_WALK;
152 centerprint(self, "\n");
158 void Spawnqueue_Check()
160 if(time < warmup + 1)
165 next_round = time + 3;
167 if(!arena_roundbased || (next_round && next_round < time && player_count > 1))
173 champion = find(world, classname, "player");
174 while(champion && champion.deadflag)
175 champion = find(champion, classname, "player");
179 while(numspawned < maxspawned && spawnqueue_first)
181 self = spawnqueue_first;
183 bprint (strcat("^4", self.netname, "^4 is the next challenger\n"));
185 Spawnqueue_Remove(self);
186 Spawnqueue_Mark(self);
188 self.classname = "player";