Closed thomasleveil closed 12 years ago
Is this the same as the start of the !setmode implementation? (v0.5)
yes !setmode was put there as a placeholder, but that spec changed a lot :)
What do you think of current spec ?
you mean !loadconfig instead of !setmode and configured as in this example above?
Perhaps I would go for a file-based solution. A folder with normal.cfg, hardcore.cfg etc. Would be easier for users to create new configs and overview all server configs...
I'll take this one and start with a file-based approach.
Does the server understand a sequence of rcon commands like this:
MP_001 TeamDeathMatch0 1
MP_003 TeamDeathMatch0 1
MP_007 TeamDeathMatch0 1
MP_011 TeamDeathMatch0 1
MP_012 TeamDeathMatch0 1
is that how a maplist is built?
not exactly, you would need something similar to :
self.console.write(('mapList.clear',)) # clear current in-memory map rotation list
self.console.write(('mapList.add', 'MP_001', 'TeamDeathMatch0', '1'))
self.console.write(('mapList.add', 'MP_003', 'TeamDeathMatch0', '1'))
self.console.write(('mapList.add', 'MP_007', 'TeamDeathMatch0', '1'))
self.console.write(('mapList.add', 'MP_011', 'TeamDeathMatch0', '1'))
self.console.write(('mapList.add', 'MP_012', 'TeamDeathMatch0', '1'))
self.console.write(('mapList.save',)) # write current in-memory map list to server config file so if the server restarts our list is recovered.
Request: mapList.add <map: string> <gamemode: string> <rounds: integer> [index: integer]
Response: OK
Response: InvalidArguments
Response: InvalidMap – incorrect map name
Response: InvalidGameModeOnMap – gamemode does not exist for that map
Response: InvalidRoundsPerMap – number of rounds must be 1 or greater
Response: Full – Map list maximum size has been reached
Response: InvalidMapIndex – Index value is out of range
Effect: Adds the map
The format as below is how the map rotation list is saved to the disk in the map rotation list file.
MP_001 TeamDeathMatch0 1
MP_003 TeamDeathMatch0 1
MP_007 TeamDeathMatch0 1
MP_011 TeamDeathMatch0 1
MP_012 TeamDeathMatch0 1
This format is only understood in this file.
Okay, first basic implementation is done. Pull request is regarding a testing branch that holds this new code. There is no dealing with responses yet, I'd rather know if the basic code is a working starting point.
I tested it and made sure it works. 5ee32be made it to the 0.6 release.
Also changed the way the config folder path can be defined in the plugin config. You can now use a path relative to the plugin config file directory.
Further refinements could be to use regular expressions to recognize lines between :
Description
the
!loadconfig <preset>
command will be used to change server cvars according to predefined settings.Algorithm
preset
will be looked up in the plugin config file to fetch associated cvars and maps.config example for defining presets