Map manager/Implementation

From Multi Theft Auto: Wiki
Revision as of 21:47, 2 June 2007 by Jbeta (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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" />

Maps 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. </syntaxhighlight>

Fired events

onGamemodeStart ( resource startedGamemode )

Fired before a gamemode starts. Can be cancelled to prevent it from starting.

onGamemodeStop ( resource startedGamemode )

Fired before a gamemode is stopped. Can be cancelled to prevent it from stopping (unless it wasn't stopped through the manager).

onGamemodeMapStart ( resource startedMap )

Fired before a GM map starts. Can be cancelled to prevent it from starting.

onGamemodeMapStop ( resource startedMap )

Fired before a GM map is stopped. Can be cancelled to prevent it from stopping (unless it wasn't stopped through the manager).