Difference between revisions of "Resource:Mapmanager"

From Multi Theft Auto: Wiki
Jump to: navigation, search
(Updated)
(Added getGamemodesCompatibleWithMap, isGamemodeCompatibleWithMap; sorted functions alphabetically)
Line 31: Line 31:
 
<syntaxhighlight lang="lua">bool changeGamemodeMap ( resource newMap, [ resource gamemodeToChangeTo ] )</syntaxhighlight>
 
<syntaxhighlight lang="lua">bool changeGamemodeMap ( resource newMap, [ resource gamemodeToChangeTo ] )</syntaxhighlight>
 
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).
 
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).
<syntaxhighlight lang="lua">bool stopGamemode ( )</syntaxhighlight>
+
<syntaxhighlight lang="lua">table getGamemodes ( )</syntaxhighlight>
Stops the current gamemode and its map.
+
Returns a table of all gamemode resource pointers.
<syntaxhighlight lang="lua">bool stopGamemodeMap ( )</syntaxhighlight>
+
<syntaxhighlight lang="lua">table getGamemodesCompatibleWithMap ( resource theMap )</syntaxhighlight>
Stop the current GM map.
+
Returns a table of compatible gamemode resource pointers.
 +
<syntaxhighlight lang="lua">table getMaps ( )</syntaxhighlight>
 +
Returns a table of all map resource pointers.
 +
<syntaxhighlight lang="lua">table getMapsCompatibleWithGamemode ( [ resource theGamemode ] )</syntaxhighlight>
 +
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.
 
<syntaxhighlight lang="lua">resource getRunningGamemode ( )</syntaxhighlight>
 
<syntaxhighlight lang="lua">resource getRunningGamemode ( )</syntaxhighlight>
 
Returns the currently running gamemode's resource pointer.
 
Returns the currently running gamemode's resource pointer.
 
<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 lang="lua">table getMapsCompatibleWithGamemode ( [ resource theGamemode ] )</syntaxhighlight>
 
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.
 
<syntaxhighlight lang="lua">table getGamemodes ( )</syntaxhighlight>
 
Returns a table of all gamemode resource pointers.
 
<syntaxhighlight lang="lua">table getMaps ( )</syntaxhighlight>
 
Returns a table of all map resource pointers.
 
 
<syntaxhighlight lang="lua">bool isGamemode ( resource theGamemode )</syntaxhighlight>
 
<syntaxhighlight lang="lua">bool isGamemode ( resource theGamemode )</syntaxhighlight>
 
Determines if a resource is a gamemode or not.
 
Determines if a resource is a gamemode or not.
 +
<syntaxhighlight lang="lua">bool isGamemodeCompatibleWithMap ( resource theGamemode, resource theMap )</syntaxhighlight>
 +
Determines if a gamemode is compatible with a map or not.
 
<syntaxhighlight lang="lua">bool isMap ( resource theMap )</syntaxhighlight>
 
<syntaxhighlight lang="lua">bool isMap ( resource theMap )</syntaxhighlight>
 
Determines if a resource is a map or not.
 
Determines if a resource is a map or not.
 
<syntaxhighlight lang="lua">bool isMapCompatibleWithGamemode ( resource theMap, resource theGamemode )</syntaxhighlight>
 
<syntaxhighlight lang="lua">bool isMapCompatibleWithGamemode ( resource theMap, resource theGamemode )</syntaxhighlight>
 +
Determines if a map is compatible with a gamemode or not.
 +
<syntaxhighlight lang="lua">bool stopGamemode ( )</syntaxhighlight>
 +
Stops the current gamemode and its map.
 +
<syntaxhighlight lang="lua">bool stopGamemodeMap ( )</syntaxhighlight>
 +
Stop the current GM map.
 
Determines if a map is compatible with a gamemode or not.
 
Determines if a map is compatible with a gamemode or not.
  

Revision as of 00:44, 21 November 2007

The map manager lists gamemodes/maps and manages gamemode/map loading. It applies certain map settings affecting the game world and sets ASE game type and map name rule values as well. It includes a web listing which autoupdates and highglights the current mode/map combination.

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.

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).

table getGamemodes ( )

Returns a table of all gamemode resource pointers.

table getGamemodesCompatibleWithMap ( resource theMap )

Returns a table of compatible gamemode resource pointers.

table getMaps ( )

Returns a table of all map resource pointers.

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.

resource getRunningGamemode ( )

Returns the currently running gamemode's resource pointer.

resource getRunningGamemodeMap ( )

Returns the currently running GM map's resource pointer.

bool isGamemode ( resource theGamemode )

Determines if a resource is a gamemode or not.

bool isGamemodeCompatibleWithMap ( resource theGamemode, resource theMap )

Determines if a gamemode is compatible with a map 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.

bool stopGamemode ( )

Stops the current gamemode and its map.

bool stopGamemodeMap ( )

Stop the current GM map. 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.

Supported map settings

The following settings from the registry are applied by the map manager when a map is started:
gamespeed [number]: The map's game speed.
gravity [number]: The map's gravity.
time [string of the form hh:mm]: The map's time.
weather [number]: The map's weather ID.
waveheight [number]: The map's wave height.
minplayers [number]: The required minimum number of players to start the map.
maxplayers [number]: The allowed maximum number of players to start the map.

TODO

  • The manager still doesn't apply map settings, waiting for the settings registry system to be added.