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)
64 if(self.exteriorweaponentity)
65 setmodel(self.exteriorweaponentity, "");
67 setmodel(self.weaponentity, "");
76 void Spawnqueue_Insert(entity e)
80 dprint(strcat("Into queue: ", e.netname, "\n"));
81 e.spawnqueue_in = TRUE;
82 e.spawnqueue_prev = spawnqueue_last;
83 e.spawnqueue_next = world;
85 spawnqueue_last.spawnqueue_next = e;
91 void Spawnqueue_Remove(entity e)
95 dprint(strcat("Out of queue: ", e.netname, "\n"));
96 e.spawnqueue_in = FALSE;
97 if(e == spawnqueue_first)
98 spawnqueue_first = e.spawnqueue_next;
99 if(e == spawnqueue_last)
100 spawnqueue_last = e.spawnqueue_prev;
101 if(e.spawnqueue_prev)
102 e.spawnqueue_prev.spawnqueue_next = e.spawnqueue_next;
103 if(e.spawnqueue_next)
104 e.spawnqueue_next.spawnqueue_prev = e.spawnqueue_prev;
105 e.spawnqueue_next = world;
106 e.spawnqueue_prev = world;
109 void Spawnqueue_Unmark(entity e)
114 numspawned = numspawned - 1;
117 void Spawnqueue_Mark(entity e)
122 numspawned = numspawned + 1;
129 if(!arena_roundbased)
133 if(time < self.arena_warmup_end)
136 f = rint(self.arena_warmup_end - time);
139 msg = strcat(msg, "The Champion is ", champion.netname, "^7\n\n\n");
142 msg = strcat(msg, "Round will start in ", ftos(rint(self.arena_warmup_end - time)));
146 msg = strcat(msg, "^1Fight!");
149 centerprint(self, msg);
152 self.movetype = MOVETYPE_NONE;
154 else if(self.movetype == MOVETYPE_NONE)
156 self.movetype = MOVETYPE_WALK;
157 centerprint(self, "\n");
163 void Spawnqueue_Check()
167 next_round = time + 3;
169 if(!arena_roundbased || (next_round && next_round < time && player_count > 1))
175 champion = find(world, classname, "player");
176 while(champion && champion.deadflag)
177 champion = find(champion, classname, "player");
180 while(numspawned < maxspawned && spawnqueue_first)
182 self = spawnqueue_first;
184 bprint (strcat("^4", self.netname, "^4 is the next challenger\n"));
186 Spawnqueue_Remove(self);
187 Spawnqueue_Mark(self);
189 self.classname = "player";