Package horizons :: Package command :: Module building :: Class Build
[hide private]
[frames] | no frames]

Class Build

source code

Command --+
          |
         Build

Command class that builds an object.

Instance Methods [hide private]
 
__init__(self, building, x, y, island, rotation=45, ship=None, ownerless=False, settlement=None, tearset=None, data=None, action_set_id=None)
Create the command
source code
 
__call__(self, issuer=None)
Execute the command
source code
    Inherited from Command
 
execute(self, session, local=False)
Execute command.
source code
Class Methods [hide private]
    Inherited from Command
 
allow_network(cls, klass)
NOTE: this is a security related method and may lead to execution of arbritary code if used in a wrong way see documentation inside horizons.network.packets.SafeUnpickler
source code
 
get_all_commands(cls) source code
Static Methods [hide private]
 
check_resources(needed_res, costs, issuer, res_sources)
Check if there are enough resources available to cover the costs
source code
Class Variables [hide private]
    Inherited from Command
  log = logging.getLogger("command")
Method Details [hide private]

__init__(self, building, x, y, island, rotation=45, ship=None, ownerless=False, settlement=None, tearset=None, data=None, action_set_id=None)
(Constructor)

source code 

Create the command

Parameters:
  • building - building class that is to be built or the id of the building class.
  • x, y - int coordinates where the object is to be built.
  • ship - ship instance
  • island - BuildingOwner instance. Might be Island or World.
  • settlement - settlement worldid or None
  • tearset - set of worldids of objs to tear before building
  • data - data required for building construction
  • action_set_id - use this particular action set, don't choose at random

__call__(self, issuer=None)
(Call operator)

source code 

Execute the command

Parameters:
  • issuer - the issuer (player, owner of building) of the command

check_resources(needed_res, costs, issuer, res_sources)
Static Method

source code 

Check if there are enough resources available to cover the costs

Parameters:
  • needed_res - awkward dict from BuildingTool.preview_build, use {} everywhere else
  • costs - building costs (as in buildingclass.costs)
  • issuer - player that builds the building
  • res_sources - list of objects with inventory attribute. None values are discarded. @return tuple(bool, missing_resource), True means buildable