Atrinik Server 2.5
Functions
Python map functions

Functions

static PyObject * Atrinik_Map_GetFirstObject (Atrinik_Map *map, PyObject *args)
static PyObject * Atrinik_Map_GetLastObject (Atrinik_Map *map, PyObject *args)
static PyObject * Atrinik_Map_GetLayer (Atrinik_Map *map, PyObject *args)
static PyObject * Atrinik_Map_GetMapFromCoord (Atrinik_Map *map, PyObject *args)
static PyObject * Atrinik_Map_PlaySound (Atrinik_Map *map, PyObject *args, PyObject *keywds)
static PyObject * Atrinik_Map_Message (Atrinik_Map *map, PyObject *args, PyObject *keywds)
static PyObject * Atrinik_Map_CreateObject (Atrinik_Map *map, PyObject *args)
static PyObject * Atrinik_Map_CountPlayers (Atrinik_Map *map, PyObject *args)
static PyObject * Atrinik_Map_GetPlayers (Atrinik_Map *map, PyObject *args)
static PyObject * Atrinik_Map_Insert (Atrinik_Map *map, PyObject *args)
static PyObject * Atrinik_Map_Wall (Atrinik_Map *map, PyObject *args)
static PyObject * Atrinik_Map_Blocked (Atrinik_Map *map, PyObject *args)
static PyObject * Atrinik_Map_FreeSpot (Atrinik_Map *map, PyObject *args)

Detailed Description

Map related functions used in Atrinik Python plugin.


Function Documentation

static PyObject* Atrinik_Map_Blocked ( Atrinik_Map map,
PyObject *  args 
) [static]

map.Blocked(object ob, int x, int y, int terrain)

Check if specified square is blocked for 'ob' using blocked().

If you simply need to check if there's a wall on a square, you should use map.Wall() instead.

Parameters:
obObject we're checking.
xX coordinate.
yY coordinate.
terrainTerrain object is allowed to go to. One (or combination) of Terrain type flags, or ob.terrain_flag
Exceptions:
AtrinikErrorif there was a problem getting the map (as a result of modified x/y to consider tiling, for example).
Returns:
A combination of Map look flags.

Definition at line 410 of file atrinik_map.c.

static PyObject* Atrinik_Map_CountPlayers ( Atrinik_Map map,
PyObject *  args 
) [static]

map.CountPlayers()

Count number of players on map.

Returns:
The number of players on the map.

Definition at line 321 of file atrinik_map.c.

static PyObject* Atrinik_Map_CreateObject ( Atrinik_Map map,
PyObject *  args 
) [static]

map.CreateObject(string archname, int x, int y)

Create an object on map.

Parameters:
archnameArch name of the object to create.
xX position on the map.
yY position on the map.
Exceptions:
AtrinikErrorif 'archname' is not a valid archetype.
Returns:
The created object.

Definition at line 292 of file atrinik_map.c.

static PyObject* Atrinik_Map_FreeSpot ( Atrinik_Map map,
PyObject *  args 
) [static]

map.FreeSpot(object ob, int x, int y, int start, int stop)

Find first free spot around map at x, y.

Parameters:
obInvolved object - will be used to find the spot this object could move onto.
xX coordinate.
yY coordinate.
startStart in the freearr arrays; 0 will also check the tile at xy, 1 will start searching around xy.
stopWhere to stop in the freearr arrays; one of Size of free defines.
Exceptions:
ValueErrorif either start or stop are not in a valid range.
Returns:
-1 on error, ID of the spot in the freearr arrays otherwise.

Definition at line 445 of file atrinik_map.c.

static PyObject* Atrinik_Map_GetFirstObject ( Atrinik_Map map,
PyObject *  args 
) [static]

map.GetFirstObject(int x, int y)

Get the first object on the tile. Use object::below to browse objects.

Parameters:
xX position on the map.
yY position on the map.
Returns:
The object if found.

Definition at line 91 of file atrinik_map.c.

static PyObject* Atrinik_Map_GetLastObject ( Atrinik_Map map,
PyObject *  args 
) [static]

map.GetLastObject(int x, int y)

Get the last object on the tile. Use object::above to browse objects.

Parameters:
xX position on the map.
yY position on the map.
Returns:
The object if found.

Definition at line 118 of file atrinik_map.c.

static PyObject* Atrinik_Map_GetLayer ( Atrinik_Map map,
PyObject *  args 
) [static]

map.GetLayer(int x, int y, int layer)

Construct a list containing objects with the specified layer on the specified square.

Note that there is another way to loop through objects on a square:

for ob in WhoIsActivator().map.GetFirstObject(WhoIsActivator().x, WhoIsActivator().y):
    print(ob)
Parameters:
xX coordinate on map.
yY coordinate on map.
layerLayer we are looking for, should be one of Layer types.
Exceptions:
ValueErrorif 'layer' is invalid.
AtrinikErrorif there was an error trying to get the objects (invalid x/y or not on nearby tiled map, for example).
Returns:
A list containing objects on the square with the specified layer.

Definition at line 157 of file atrinik_map.c.

static PyObject* Atrinik_Map_GetMapFromCoord ( Atrinik_Map map,
PyObject *  args 
) [static]

map.GetMapFromCoord(int x, int y)

Get real coordinates from map, taking tiling into consideration.

Parameters:
xX position on the map.
yY position on the map.
Returns:
A tuple containing new map, new X, and new Y to use. The new map can be None.

Definition at line 210 of file atrinik_map.c.

static PyObject* Atrinik_Map_GetPlayers ( Atrinik_Map map,
PyObject *  args 
) [static]

map.GetPlayers()

Get all the players on a specified map.

Returns:
List containing pointers to player objects on the map.

Definition at line 332 of file atrinik_map.c.

static PyObject* Atrinik_Map_Insert ( Atrinik_Map map,
PyObject *  args 
) [static]

map.Insert(object ob, int x, int y)

Insert the specified object on map, removing it first if necessary.

Parameters:
obObject to insert.
xX coordinate where to insert 'ob'.
yY coordinate where to insert 'ob'.

Definition at line 353 of file atrinik_map.c.

static PyObject* Atrinik_Map_Message ( Atrinik_Map map,
PyObject *  args,
PyObject *  keywds 
) [static]

map.Message(int x, int y, int distance, string message, int [color = COLOR_BLUE], int [flags = 0])

Write a message to all players on a map.

Parameters:
xX position on the map.
yY position on the map.
distanceMaximum distance for players to be away from x, y to hear the message.
messageMessage to write.
colorColor to write the message in. Can be one of Color HTML notations or a HTML color notation.
flagsOptional flags, one of New draw info flags.

Definition at line 267 of file atrinik_map.c.

static PyObject* Atrinik_Map_PlaySound ( Atrinik_Map map,
PyObject *  args,
PyObject *  keywds 
) [static]

map.PlaySound(string filename, int x, int y, int [type = CMD_SOUND_EFFECT], int [loop = 0], int [volume = 0])

Play a sound on map.

Parameters:
filenameSound file to play.
xX position where the sound is playing from.
yY position where the sound is playing from.
typeSound type being played, one of Sound command types.
loopHow many times to loop the sound, -1 for infinite number.
volumeVolume adjustment.

Definition at line 239 of file atrinik_map.c.

static PyObject* Atrinik_Map_Wall ( Atrinik_Map map,
PyObject *  args 
) [static]

map.Wall(int x, int y)

Checks if there's a wall on the specified square.

Parameters:
xX coordinate.
yY coordinate.
Returns:
A combination of Map look flags.

Definition at line 384 of file atrinik_map.c.