Ready / Map reset

Developer discussion of experimental fixes, changes, and improvements.

Moderators: Nexuiz Moderators, Moderators

Ready / Map reset

Postby nifrek » Fri Dec 07, 2007 10:59 pm

Looking at the qc source, it occurred to me that it "could" be simple to use the code from reset_map in arena mode and use it for ReadyCount. I have no idea what I'm doing, I just figured it could work since there is nothing in that code that seems specific to arena.

So here's what I did, used some arena code pasted over parts of ReadyCount:

Code: Select all
void ReadyCount()
{
   local entity e;
   local float r, p;
   FOR_EACH_REALPLAYER(e)
   {
      p += 1;
      if(e.ready)
         r += 1;
   }
   if(p && r == p)
   {
   self = nextent(world);
   while(self)
   {
      if(self.classname == "droppedweapon"      // cleanup
            || self.classname == "gib"
            || self.classname == "body")
      {
         remove(self);
      }
      else if(self.flags & FL_ITEM)         // reset items
      {
         self.model = self.mdl;
         self.solid = SOLID_TRIGGER;
         setorigin (self, self.origin);
         self.think = SUB_Null;
         self.nextthink = 0;
         self.effects = self.effects - (self.effects & EF_STARDUST);
      }
      else if(self.flags & FL_PROJECTILE)      // remove any projectiles left
      {
         sound(self, CHAN_BODY, "misc/null.wav", 1, ATTN_NORM);
         remove(self);
      }
      else if(self.isdecor)
      {
         removedecor(self);
      }
      else if(self.flags & FL_CLIENT)         // reset all players
      {
         if(self.spawned)
            PutClientInServer();
         else
            PutObserverInServer();
      }
      
      self = nextent(self);
   }
}


Would it work?

Basically, what would happen is that when players type "Ready", map would reset like in arena mode instead of restarting the map, and hopefully players would stay in the team slot they were (no need to reselect a team). I am not sure about the teams part, as arena doesn't use teams. If not, maybe force suicide to all players so they respawn all fresh?

If this does work, then all that needs to be added is a countdown before the actual map reset (it would wait for countdown to be finished before reseting), and something that sets current game time back to 0 (or add 15 minutes to timelimit if not possible, tho that would be a bit messy I guess) and fragcount for all players back to 0.
nifrek
Alien
 
Posts: 208
Joined: Fri Sep 22, 2006 6:43 am

Postby KadaverJack » Sat Dec 08, 2007 12:17 am

Yes, it probably does work (however it would be better to modify reset_map() a bit and use that instead of copying the code). btw: the code already does respawn all players (self.spawned can only be true in arena so everyone would become spectator).

The reason i didn't do that myself yet is, that there's no way to reset time and currently the map time is only displayed in the scores screen, so it'll be hard to tell when the timelimit is over.
However the new HUD in 2.4 might solve this issue, since it displays the remaining time...
KadaverJack
Site admin and forum addon
 
Posts: 1102
Joined: Tue Feb 28, 2006 9:42 pm

Postby nifrek » Sat Dec 08, 2007 12:30 am

Fast response, thanks!

As a temporary solution for timelimit problem, is there a way to find out what is the current game time and at add 15 minutes to current timelimit?
nifrek
Alien
 
Posts: 208
Joined: Fri Sep 22, 2006 6:43 am

Postby KadaverJack » Sat Dec 08, 2007 12:41 am

nifrek wrote:As a temporary solution for timelimit problem, is there a way to find out what is the current game time and at add 15 minutes to current timelimit?

Yes: cvar_set("timelimit", ftos(cvar("timelimit")+(time/60)))
KadaverJack
Site admin and forum addon
 
Posts: 1102
Joined: Tue Feb 28, 2006 9:42 pm

Postby nifrek » Sat Dec 08, 2007 1:00 am

Awesome, thank you KadaverJack.

I just need someone to help me a bit, I'm new to this, I know how to compile but that's about it. Right now it won't compile and I have no clue what needs to be fixed. If anyone feels like helping, I'm pretty much on #nexuiz all the time.
nifrek
Alien
 
Posts: 208
Joined: Fri Sep 22, 2006 6:43 am

Postby KadaverJack » Sat Dec 08, 2007 1:25 am

nifrek wrote:Right now it won't compile and I have no clue what needs to be fixed. If anyone feels like helping, I'm pretty much on #nexuiz all the time.

I'll do & commit the changes tomorrow. It's not much work, but it's 2am here and i don't wanna code any more tonight...
KadaverJack
Site admin and forum addon
 
Posts: 1102
Joined: Tue Feb 28, 2006 9:42 pm

Postby nifrek » Sat Dec 08, 2007 1:35 am

Thank you again, it is hugely and immensely appreciated. You are my new hero.
nifrek
Alien
 
Posts: 208
Joined: Fri Sep 22, 2006 6:43 am

Postby GreEn`mArine » Sat Dec 08, 2007 2:52 pm

you might have a look at http://wiki.quakesrc.org/
IRC quote:
[kojn] I've been coming a bit more recently
[kojn] she took it the dirty way
GreEn`mArine
Forum addon
 
Posts: 1509
Joined: Tue Feb 28, 2006 9:33 pm
Location: Germany

Postby KadaverJack » Wed Dec 12, 2007 6:51 pm

Took me a bit longer than planned (mainly due to lack of time), but here it is: http://svn.icculus.org/nexuiz?view=rev&rev=3020
KadaverJack
Site admin and forum addon
 
Posts: 1102
Joined: Tue Feb 28, 2006 9:42 pm

Postby GreEn`mArine » Wed Dec 12, 2007 8:27 pm

is there a delay built into it? I cannot test it right now, that's why I am asking. It would be a bit brutal if it restarted instantly after everyone was ready
IRC quote:
[kojn] I've been coming a bit more recently
[kojn] she took it the dirty way
GreEn`mArine
Forum addon
 
Posts: 1509
Joined: Tue Feb 28, 2006 9:33 pm
Location: Germany

Next

Return to Nexuiz - Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron