Map manager/Implementation: Difference between revisions
No edit summary |
(Updated) |
||
Line 5: | Line 5: | ||
<syntaxhighlight lang="xml"><info description="A gamemode" type="gamemode" /></syntaxhighlight> | <syntaxhighlight lang="xml"><info description="A gamemode" type="gamemode" /></syntaxhighlight> | ||
'''Map resources''' also need the ''type="map"'' tag, plus a ''gamemodes'' tag listing the gamemode resources they're compatible with in a comma-separated list ''without spaces''. | |||
<syntaxhighlight lang="xml"><info description="A gamemode map" type="map" gamemodes="ctv,koth" /></syntaxhighlight> | <syntaxhighlight lang="xml"><info description="A gamemode map" type="map" gamemodes="ctv,koth" /></syntaxhighlight> | ||
Line 28: | Line 28: | ||
<syntaxhighlight lang="lua">resource getRunningGamemodeMap ( )</syntaxhighlight> | <syntaxhighlight lang="lua">resource getRunningGamemodeMap ( )</syntaxhighlight> | ||
Returns the currently running GM map's resource pointer. | Returns the currently running GM map's resource pointer. | ||
</syntaxhighlight> | <syntaxhighlight lang="lua">table getMapsCompatibleWithGamemode ( resource theGamemode )</syntaxhighlight> | ||
Returns a table of compatible map resource pointers. | |||
==Fired events== | ==Fired events== | ||
<syntaxhighlight lang="lua">onGamemodeStart ( resource startedGamemode )</syntaxhighlight> | <syntaxhighlight lang="lua">onGamemodeStart ( resource startedGamemode )</syntaxhighlight> | ||
Fired before a gamemode starts | Fired before a gamemode starts. | ||
<syntaxhighlight lang="lua">onGamemodeStop ( resource startedGamemode )</syntaxhighlight> | <syntaxhighlight lang="lua">onGamemodeStop ( resource startedGamemode )</syntaxhighlight> | ||
Fired before a gamemode is stopped | Fired before a gamemode is stopped. | ||
<syntaxhighlight lang="lua">onGamemodeMapStart ( resource startedMap )</syntaxhighlight> | <syntaxhighlight lang="lua">onGamemodeMapStart ( resource startedMap )</syntaxhighlight> | ||
Fired before a GM map starts | Fired before a GM map starts. | ||
<syntaxhighlight lang="lua">onGamemodeMapStop ( resource startedMap )</syntaxhighlight> | <syntaxhighlight lang="lua">onGamemodeMapStop ( resource startedMap )</syntaxhighlight> | ||
Fired before a GM map is stopped | Fired before a GM map is stopped. |
Revision as of 22:00, 3 July 2007
The map manager lists maps and manages gamemode and gamemode map loading.
Usage
You have to tag the gamemode resource with the correct type in its info tag:
<info description="A gamemode" type="gamemode" />
Map resources also need the type="map" tag, plus a gamemodes tag listing the gamemode resources they're compatible with in a comma-separated list without spaces.
<info description="A gamemode map" type="map" gamemodes="ctv,koth" />
There can be only one gamemode and one gamemode map loaded at once.
Commands
changemap newmap [newgamemode]
gamemode newgamemode [newmap]
Exported functions
bool changeGamemode ( resource newGamemode, [ resource mapToLoadWith ] )
Changes the gamemode to a new one, optionally specifying an initial map for it (will load without a map by default).
bool changeGamemodeMap ( resource newMap, [ resource gamemodeToChangeTo ] )
Changes the GM map to a new one, optionally specifying a gamemode to change to before loading it (will load with the current gamemode by default).
bool stopGamemode ( )
Stops the current gamemode and its map.
bool stopGamemodeMap ( )
Stop the current GM map.
resource getRunningGamemode ( )
Returns the currently running gamemode's resource pointer.
resource getRunningGamemodeMap ( )
Returns the currently running GM map's resource pointer.
table getMapsCompatibleWithGamemode ( resource theGamemode )
Returns a table of compatible map resource pointers.
Fired events
onGamemodeStart ( resource startedGamemode )
Fired before a gamemode starts.
onGamemodeStop ( resource startedGamemode )
Fired before a gamemode is stopped.
onGamemodeMapStart ( resource startedMap )
Fired before a GM map starts.
onGamemodeMapStop ( resource startedMap )
Fired before a GM map is stopped.