Package svs_demogame :: Module terrain :: Class Terrain
[show private | hide private]
[frames | no frames]

Class Terrain


Container class for terrain components.
Method Summary
  __init__(self, dimX, dimY, areasX, areasY)
  containsLocation(self, x, y)
Checks that specified coordinates are within boundaries of terrain.
  createAreas(self, areasX, areasY)
Creates areas for terrain in given dimensions.
Array getAdjacentAreas(self, area, directions, markBoundary)
Returns a list of areas which are adjacent to the specified area.
  getAllAreas(self)
Returns all areas in a flat list.
  getAreaAtIndices(self, x, y)
Returns area at specified index coordinates.
  getAreaAtLocation(self, xPoint, yPoint)
Returns area containing specified terrain coordinates.
  getAreaWithId(self, areaId)
Returns area with specified id number.
  getChanges(self)
Get reported changes in terrain.
  getModel(self)
Returns a model of the terrain in its current state, suitable for serialisation and sending over network.
  reportChange(self, changeData, sourceEntity)
Collects changes in condition of areas and agents.
  setAreaDefaults(self, density, script)
Sets default values for all areas.
  start(self)
Calls startPlay method on areas.
  stop(self)
Calls stopPlay method on areas.
  update(self, timeInterval)
Updates areas within terrain.

Method Details

containsLocation(self, x, y)

Checks that specified coordinates are within boundaries of terrain.

createAreas(self, areasX, areasY)

Creates areas for terrain in given dimensions.

getAdjacentAreas(self, area, directions=(), markBoundary=False)

Returns a list of areas which are adjacent to the specified area.

If the directions are set these can be used to return only the neighbours in the specified directions. The directions are defined by compass names, 'N', 'S', 'E', 'W', 'NE', etc.
Returns:
Array

getAllAreas(self)

Returns all areas in a flat list.

getAreaAtIndices(self, x, y)

Returns area at specified index coordinates. If not found returns None.

getAreaAtLocation(self, xPoint, yPoint)

Returns area containing specified terrain coordinates. If not found returns None.

getAreaWithId(self, areaId)

Returns area with specified id number.

getChanges(self)

Get reported changes in terrain.

getModel(self)

Returns a model of the terrain in its current state, suitable for serialisation and sending over network.

reportChange(self, changeData, sourceEntity)

Collects changes in condition of areas and agents.

setAreaDefaults(self, density=None, script=None)

Sets default values for all areas.

start(self)

Calls startPlay method on areas.

stop(self)

Calls stopPlay method on areas.

update(self, timeInterval)

Updates areas within terrain.

Generated by Epydoc 2.1 on Thu Oct 20 15:30:29 2005 http://epydoc.sf.net