Comments (2)
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.
The changelevel command keeps the players state so that's no good for deathmatch.
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.
from webquake.
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);
from webquake.
Related Issues (20)
- No mouse control in Chrome Canary 64bit v46.0.2486 HOT 2
- Forked WebQuake supports Async IO HOT 8
- How do I use this on a Chromebook? HOT 3
- Mouse not working HOT 3
- Any way to add the full game files? HOT 5
- cant run mod files HOT 2
- What each file is for? HOT 1
- Performance issues with WebQuake build 54 (1.09) HOT 5
- Async IO #2 HOT 1
- Issue connecting from WinQuake HOT 4
- W.LoadWadFile: couldn't load gfx.wad HOT 3
- Audio buzz/click HOT 1
- Mouse jump glitchy problem with Chrome Win10 360 spin keep moving mouse to right. HOT 3
- Can someone tell me if I have this correct in the server? HOT 2
- No official online demo HOT 2
- Error compiling shader: null
- auto-connect to multiplayer server at launch HOT 2
- can i host this on github pages? HOT 1
- add quake .pak files to the chromeos version of webquake HOT 1
- Game not loading, stuck on "Starting Quake..." HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from webquake.