-
Notifications
You must be signed in to change notification settings - Fork 101
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Map Rotation #19
Comments
I added a new command map2 to change the map clearing players state. The map command was no good on it's own because it shuts down the server so client's are of course disconnected, I didn't want to modify a core command. Server Host.js Host.Map2_f = function()
{
if (Cmd.argv.length !== 2)
{
Con.Print('map2 <map> : switches to a new map wiping players state\n');
return;
}
if (Cmd.client === true)
return;
SV.svs.serverflags = 0;
SV.SpawnServer(Cmd.argv[1]);
}; Also in the Host.InitCommands add the command. Cmd.AddCommand('map2', Host.Map2_f); This can be called by rcon. So next up would be to read a map rotation file of some kind, and configure it to run that command to the next map after some kind of time or frag limit criteria. |
You can put the commands in Host.js by the way. Adding another command for map rotation. Host.MapRotation_f = function() {
// TODO: figure out how to read a file.
// TODO: figure out how to perodically check the frag count or play time as a condition to change map?
// TODO: switch to next map in rotation (or perhaps random or voted map?)
var mapList = ['DM1', 'DM2', 'DM3', 'DM4', 'DM5', 'DM6', 'END', 'E1M1'];
var mapIndex = 0;
function changeToNextMap() {
mapIndex = (mapIndex + 1) % mapList.length;
var map = mapList[mapIndex];
Sys.Print("Map rotating to "+map+"\n");
Cmd.ExecuteString('map2 '+map); // TODO: Maybe there is a way to call command directly?
}
// Change map every 5 minutes.
clearInterval(Host._mapRotateInterval);
Host._mapRotateInterval = setInterval(changeToNextMap, 5 * 60000);
// Change map right now.
changeToNextMap();
}; Cmd.AddCommand('maprotation', Host.MapRotation_f); |
I know this is a long shot, but is there any way you could implement map rotation? I am aware that this feature is not available in vanilla Quake, only in QuakeWorld via localinfo, but maybe you have an idea how it could be done?
Thanks a lot for this port, i got it running on my server to frag a bit whenever i feel like ;-)
The text was updated successfully, but these errors were encountered: