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;
18 void dom_controlpoint_setup();
23 if(cvar("g_arena_warmup"))
24 warmup = time + cvar("g_arena_warmup");
26 lms_lowest_lives = 999;
27 lms_next_place = player_count;
29 self = nextent(world);
32 if(self.flags & FL_CLIENT) // reset all players
34 if(time < restart_countdown)
36 self.frags = (g_lms)?LMS_NewPlayerLives():0;
39 self.classname = "player";
47 PutObserverInServer();
50 else if(self.classname == STR_ITEM_KH_KEY)
52 kh_Key_AssignTo(self, world);
54 // kh_Key_DropAll(self.owner, TRUE);
57 else if(self.classname == "droppedweapon" // cleanup
58 || self.classname == "gib"
59 || self.classname == "body")
63 else if(self.items & (IT_KEY1 | IT_KEY2))
68 else if(self.classname == "rune")
71 if(self.owner.classname != "runematch_spawn_point")
72 DropAllRunes(self.owner);
75 else if(self.classname == "sprite_waypoint")
77 if(self.health | g_keyhunt)
78 WaypointSprite_Kill(self);
80 else if(self.classname == "dom_controlpoint")
82 dom_controlpoint_setup();
84 else if(self.classname == "info_player_deathmatch")
86 self.team = self.team_saved; // reset spawns to their original state too!
88 else if(self.flags & FL_ITEM) // reset items
90 self.model = self.mdl;
91 self.solid = SOLID_TRIGGER;
92 setorigin (self, self.origin);
93 self.think = SUB_Null;
96 else if(self.flags & FL_PROJECTILE) // remove any projectiles left
98 sound(self, CHAN_BODY, "misc/null.wav", 1, ATTN_NORM);
101 else if(self.isdecor)
105 // TODO properly reset Onslaught
106 // TODO properly reset Assault
107 self = nextent(self);
111 kh_Controller_SetThink(cvar("g_balance_keyhunt_delay_round")+RESTART_COUNTDOWN, "", kh_StartRound);
115 UpdateFrags(champion, +1);
118 void Spawnqueue_Insert(entity e)
122 dprint(strcat("Into queue: ", e.netname, "\n"));
123 e.spawnqueue_in = TRUE;
124 e.spawnqueue_prev = spawnqueue_last;
125 e.spawnqueue_next = world;
127 spawnqueue_last.spawnqueue_next = e;
129 if(!spawnqueue_first)
130 spawnqueue_first = e;
133 void Spawnqueue_Remove(entity e)
137 dprint(strcat("Out of queue: ", e.netname, "\n"));
138 e.spawnqueue_in = FALSE;
139 if(e == spawnqueue_first)
140 spawnqueue_first = e.spawnqueue_next;
141 if(e == spawnqueue_last)
142 spawnqueue_last = e.spawnqueue_prev;
143 if(e.spawnqueue_prev)
144 e.spawnqueue_prev.spawnqueue_next = e.spawnqueue_next;
145 if(e.spawnqueue_next)
146 e.spawnqueue_next.spawnqueue_prev = e.spawnqueue_prev;
147 e.spawnqueue_next = world;
148 e.spawnqueue_prev = world;
151 void Spawnqueue_Unmark(entity e)
156 numspawned = numspawned - 1;
159 void Spawnqueue_Mark(entity e)
164 numspawned = numspawned + 1;
172 if(!g_arena || !arena_roundbased || (time < restart_countdown))
175 f = rint(warmup - time);
178 if(time < warmup && self.spawned)
181 msg = strcat(msg, "The Champion is ", champion.netname, "^7\n\n\n");
184 msg = strcat(msg, "Round will start in ", ftos(f));
188 msg = strcat(msg, "^1Fight!");
191 centerprint(self, msg);
194 self.movetype = MOVETYPE_NONE;
196 self.velocity = '0 0 0';
197 self.avelocity = '0 0 0';
198 self.movement = '0 0 0';
199 //self.fixangle = TRUE;
201 else if(self.movetype == MOVETYPE_NONE)
203 self.movetype = MOVETYPE_WALK;
204 centerprint(self, "\n");
210 void Spawnqueue_Check()
212 if(time < warmup + 1)
217 next_round = time + 3;
219 if(!arena_roundbased || (next_round && next_round < time && player_count > 1))
225 champion = find(world, classname, "player");
226 while(champion && champion.deadflag)
227 champion = find(champion, classname, "player");
231 while(numspawned < maxspawned && spawnqueue_first)
233 self = spawnqueue_first;
235 bprint ("^4", self.netname, "^4 is the next challenger\n");
237 Spawnqueue_Remove(self);
238 Spawnqueue_Mark(self);
240 self.classname = "player";