Resource:Mapmanager: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
m (Extended description)
(Updated)
Line 22: Line 22:
'''changemap newmap [newgamemode]''' (changes the gamemode map to a new one, optionally changing the gamemode as well)
'''changemap newmap [newgamemode]''' (changes the gamemode map to a new one, optionally changing the gamemode as well)


'''gamemode newgamemode [newmap]''' (changes to a new gamemode, optionally starting a map with it)
'''changemode newgamemode [newmap]''' (changes to a new gamemode, optionally starting a map with it)
 
'''gamemode newgamemode [newmap]''' (same as previous one)


'''maps [gamemode]''' (lists all maps in the server, optionally all maps compatible with a gamemode)
'''maps [gamemode]''' (lists all maps in the server, optionally all maps compatible with a gamemode)
Line 47: Line 49:
<syntaxhighlight lang="lua">table getMaps ( )</syntaxhighlight>
<syntaxhighlight lang="lua">table getMaps ( )</syntaxhighlight>
Returns a table of all map resource pointers.
Returns a table of all map resource pointers.
<syntaxhighlight lang="lua">bool isGamemode ( resource theGamemode )</syntaxhighlight>
Determines if a resource is a gamemode or not.
<syntaxhighlight lang="lua">bool isMap ( resource theMap )</syntaxhighlight>
Determines if a resource is a map or not.
<syntaxhighlight lang="lua">bool isMapCompatibleWithGamemode ( resource theMap, resource theGamemode )</syntaxhighlight>
Determines if a map is compatible with a gamemode or not.


==Fired events==
==Fired events==

Revision as of 01:51, 9 September 2007

The map manager lists maps and manages gamemode and gamemode map loading. It sets ASE game type and map name rule values as well.

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.

Optional resource attributes

These attributes all go in the corresponding resource's info tag.

name: A friendly name for your gamemode or map, to be displayed in the start messages or map listings instead of the filename.

minPlayers: Map attribute only. The minimum number of players required to start the map.

maxPlayers: Map attribute only. The maximum number of players possible to start the map.

Commands

changemap newmap [newgamemode] (changes the gamemode map to a new one, optionally changing the gamemode as well)

changemode newgamemode [newmap] (changes to a new gamemode, optionally starting a map with it)

gamemode newgamemode [newmap] (same as previous one)

maps [gamemode] (lists all maps in the server, optionally all maps compatible with a gamemode)

gamemodes (lists all gamemodes)

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. If the gamemode is left blank, it returns all maps which aren't compatible with any gamemode.

table getGamemodes ( )

Returns a table of all gamemode resource pointers.

table getMaps ( )

Returns a table of all map resource pointers.

bool isGamemode ( resource theGamemode )

Determines if a resource is a gamemode or not.

bool isMap ( resource theMap )

Determines if a resource is a map or not.

bool isMapCompatibleWithGamemode ( resource theMap, resource theGamemode )

Determines if a map is compatible with a gamemode or not.


Fired events

(For all these events, "source" is the resource's root element.)

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.