3 float arena_roundbased;
5 .entity spawnqueue_next;
6 .entity spawnqueue_prev;
8 entity spawnqueue_first;
9 entity spawnqueue_last;
11 .float arena_warmup_end;
13 void PutObserverInServer();
14 void PutClientInServer();
15 void(entity e) DropFlag;
16 void(entity e) ReturnFlag;
17 void(entity e) removedecor;
23 self = nextent(world);
25 warmup = cvar("g_arena_warmup");
29 if(self.classname == "droppedweapon" // cleanup
30 || self.classname == "gib"
31 || self.classname == "body")
35 else if(self.flags & FL_ITEM) // reset items
37 self.model = self.mdl;
38 self.solid = SOLID_TRIGGER;
39 setorigin (self, self.origin);
40 self.think = SUB_Null;
42 self.effects = self.effects - (self.effects & EF_STARDUST);
44 else if(self.flags & FL_PROJECTILE) // remove any projectiles left
46 sound(self, CHAN_BODY, "misc/null.wav", 1, ATTN_NORM);
53 else if(self.flags & FL_CLIENT) // reset all players
58 self.arena_warmup_end = time + warmup;
61 else if(self.deadflag)
71 void Spawnqueue_Insert(entity e)
75 dprint(strcat("Into queue: ", e.netname, "\n"));
76 e.spawnqueue_in = TRUE;
77 e.spawnqueue_prev = spawnqueue_last;
78 e.spawnqueue_next = world;
80 spawnqueue_last.spawnqueue_next = e;
86 void Spawnqueue_Remove(entity e)
90 dprint(strcat("Out of queue: ", e.netname, "\n"));
91 e.spawnqueue_in = FALSE;
92 if(e == spawnqueue_first)
93 spawnqueue_first = e.spawnqueue_next;
94 if(e == spawnqueue_last)
95 spawnqueue_last = e.spawnqueue_prev;
97 e.spawnqueue_prev.spawnqueue_next = e.spawnqueue_next;
99 e.spawnqueue_next.spawnqueue_prev = e.spawnqueue_prev;
100 e.spawnqueue_next = world;
101 e.spawnqueue_prev = world;
104 void Spawnqueue_Unmark(entity e)
109 numspawned = numspawned - 1;
112 void Spawnqueue_Mark(entity e)
117 numspawned = numspawned + 1;
124 if(!arena_roundbased)
128 if(time < self.arena_warmup_end)
131 f = rint(self.arena_warmup_end - time);
134 msg = strcat(msg, "The Champion is ", champion.netname, "^7\n\n\n");
137 msg = strcat(msg, "Round will start in ", ftos(rint(self.arena_warmup_end - time)));
141 msg = strcat(msg, "^1Fight!");
144 centerprint(self, msg);
147 self.movetype = MOVETYPE_NONE;
149 else if(self.movetype == MOVETYPE_NONE)
151 self.movetype = MOVETYPE_WALK;
152 centerprint(self, "\n");
158 void Spawnqueue_Check()
162 next_round = time + 3;
164 if(!arena_roundbased || (next_round && next_round < time && player_count > 1))
170 champion = find(world, classname, "player");
171 while(champion && champion.deadflag)
172 champion = find(champion, classname, "player");
175 while(numspawned < maxspawned && spawnqueue_first)
177 self = spawnqueue_first;
179 bprint (strcat("^4", self.netname, "^4 is the next challenger\n"));
181 Spawnqueue_Remove(self);
182 Spawnqueue_Mark(self);
184 self.classname = "player";