Package horizons :: Package ai :: Package aiplayer :: Module basicbuilder :: Class BasicBuilder
[hide private]
[frames] | no frames]

Class BasicBuilder

source code

An object of this class represents a non-checked plan to build a building at a specific place.

Instance Methods [hide private]
 
__init__(self, building_id, coords, orientation) source code
 
_get_rotation(self, session, build_position_rotation)
Return the rotation of the new building (randomize it if allowed).
source code
 
get_loading_area(self)
Return the position of the loading area.
source code
 
execute(self, land_manager, ship=None)
Build the building.
source code
 
have_resources(self, land_manager, ship=None, extra_resources=None)
Return a boolean showing whether we have the resources to build the building right now.
source code
 
__str__(self) source code
Class Methods [hide private]
 
clear_cache(cls) source code
 
create(cls, building_id, coords, orientation)
Create or get a cached version of the BasicBuilder.
source code
Class Variables [hide private]
  rotations = [45, 135, 225, 315]
  non_rotatable_buildings = [BUILDINGS.WAREHOUSE, BUILDINGS.FISH...
  __cache = {}
Method Details [hide private]

create(cls, building_id, coords, orientation)
Class Method

source code 

Create or get a cached version of the BasicBuilder.

This is supposed to speed up the process in case identical BasicBuilder instances would be created. The constructor should be used directly otherwise.


Class Variable Details [hide private]

non_rotatable_buildings

Value:
[BUILDINGS.WAREHOUSE, BUILDINGS.FISHER, BUILDINGS.BOAT_BUILDER, BUILDI\
NGS.MINE, BUILDINGS.SALT_PONDS]