Package horizons :: Package world :: Package building :: Module buildable :: Class Buildable
[hide private]
[frames] | no frames]

Class Buildable

source code

Interface for every kind of buildable objects. Contains methods to determine whether a building can be placed on a coordinate, regarding island, settlement, ground requirements etc. Does not care about building costs.

Class Methods [hide private]
 
check_build(cls, session, point, rotation=45, check_settlement=True, ship=None, issuer=None)
Check if a building is buildable here.
source code
 
check_build_line(cls, session, point1, point2, rotation=45, ship=None)
Checks out a line on the map for build possibilities.
source code
 
is_tile_buildable(cls, session, tile, ship, island=None, check_settlement=True)
Checks a tile for buildability.
source code
 
check_build_fuzzy(cls, session, point, *args, **kwargs)
Same as check_build, but consider point to be a vague suggestions and search nearby area for buildable position.
source code
 
_check_island(cls, session, position, island=None)
Check if there is an island and enough tiles.
source code
 
_check_rotation(cls, session, position, rotation)
Returns a possible rotation for this building.
source code
 
_check_settlement(cls, session, position, ship=None, issuer=None)
Check that there is a settlement that belongs to the player.
source code
 
_check_buildings(cls, session, position, island=None)
Check if there are buildings blocking the build.
source code
 
_check_units(cls, session, position) source code
Class Variables [hide private]
  irregular_conditions = False
  terrain_type = 1
  CHECK_NEARBY_LOCATIONS_UP_TO_DISTANCE = 3
Method Details [hide private]

check_build(cls, session, point, rotation=45, check_settlement=True, ship=None, issuer=None)
Class Method

source code 

Check if a building is buildable here. All tiles, that the building occupies are checked.

Parameters:
  • point - Point instance, coords
  • rotation - preferred rotation of building
  • check_settlement - whether to check for a settlement (for settlementless buildings)
  • ship - ship instance if building from ship @return instance of _BuildPosition

check_build_line(cls, session, point1, point2, rotation=45, ship=None)
Class Method

source code 

Checks out a line on the map for build possibilities. The line usually is a draw of the mouse.

Parameters:
  • point1, point2 - Point instance, start and end of the line
  • rotation - prefered rotation
  • ship - ship instance if building from ship @return list of _BuildPositions

is_tile_buildable(cls, session, tile, ship, island=None, check_settlement=True)
Class Method

source code 

Checks a tile for buildability.

Parameters:
  • tile - Ground object
  • ship - Ship instance if building from ship
  • island - Island instance, if already known. If None, it will be calculated
  • check_settlement - bool, whether to check for settlement @return bool, True for "is buildable"

check_build_fuzzy(cls, session, point, *args, **kwargs)
Class Method

source code 

Same as check_build, but consider point to be a vague suggestions and search nearby area for buildable position. Returns one of the closest viable positions or the original position as not buildable if none can be found

_check_island(cls, session, position, island=None)
Class Method

source code 

Check if there is an island and enough tiles. @throws _NotBuildableError if building can't be built.

Parameters:
  • position - coord Point to build at
  • island - Island instance if known before

_check_rotation(cls, session, position, rotation)
Class Method

source code 

Returns a possible rotation for this building.

Parameters:
  • position - Rect or Point instance, position and size
  • rotation - The preferred rotation
Returns:
integer, an available rotation in degrees

_check_buildings(cls, session, position, island=None)
Class Method

source code 

Check if there are buildings blocking the build. @return Iterable of worldids of buildings that need to be teared in order to build here