|
|
| Line 1: |
Line 1: |
| == Things that keep me awake at night ==
| |
| * [[User:Ccw:Gamemodes|Gamemodes which depend on being started with the mapmanager.]]
| |
|
| |
|
| Gamemodes which depend on being started with the mapmanager.
| |
| -----------------------------------------------------------
| |
|
| |
| That is, gamemodes which either use the mapmanger events onGamemodeStop/Start onGamemodeMapStop/Start or depend on the 'one gamemode at a time' system enforced by the mapmanager:
| |
|
| |
| assault *
| |
| battlefield69 *
| |
| cdm *
| |
| ctf *
| |
| cto *
| |
| ctv *
| |
| fallout
| |
| hay
| |
| interstate69 *
| |
| race *
| |
| stealth *
| |
| tdma *
| |
| teamwars *
| |
| freeroam
| |
|
| |
| Noob admins who don't use the mapmanger and type 'start gamemode' will have gamemodes that misfunction with little obvious reason why.
| |
|
| |
| Also, stuff like the web thingy and the admin panel, all start resources with startResource(), which will not work correctly with the gamemodes listed above.
| |
|
| |
| Solution
| |
| --------
| |
|
| |
| First of all, the mapmanager has to be running before a gamemode can be successfuly started.
| |
|
| |
| Secondly, either:
| |
| A) Ensure that when ever using something like this:
| |
| startResource( getResourceFromName('gamemode') )
| |
| for a gamemode, use this instead:
| |
| exports.mapmanager:changeGamemode( getResourceFromName('gamemode') )
| |
|
| |
| Or, prehaps more betterer,:
| |
| B) Insert this bit of code into each gamemode:
| |
|
| |
| <syntaxhighlight lang="lua">
| |
| ----------------------------------------------------
| |
| -- Divert to mapmanager if 'start' command used
| |
| ----------------------------------------------------
| |
| addEventHandler('onResourceStart', g_ResRoot,
| |
| function()
| |
| setTimer(
| |
| function()
| |
| if not g_bCalledOnGamemodeStart then
| |
| outputConsole( "Trying to restart '" .. getResourceName(getThisResource()) .. "' with mapmanager..." )
| |
| exports.mapmanager:changeGamemode( getThisResource() )
| |
| end
| |
| end
| |
| ,900,1)
| |
| end
| |
| )
| |
|
| |
| addEventHandler('onGamemodeStart', g_ResRoot,
| |
| function()
| |
| g_bCalledOnGamemodeStart = true
| |
| end
| |
| )
| |
| </syntaxhighlight>
| |