Package horizons :: Package command :: Module unit :: Class CreateUnit
[hide private]
[frames] | no frames]

Class CreateUnit

source code

Command --+
          |
         CreateUnit

Command class that creates a unit. TODO: remove this command and put the code in a method in e.g. world. Commands are there for user interactions, and there is no user interaction, that creates a unit You always only add a production that creates then units, but that is simulated on every machine

Instance Methods [hide private]
 
__init__(self, owner_id, unit_id, x, y, **kwargs) source code
 
__call__(self, issuer)
__call__() gets called by the manager.
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
Class Variables [hide private]
    Inherited from Command
  log = logging.getLogger("command")
Method Details [hide private]

__init__(self, owner_id, unit_id, x, y, **kwargs)
(Constructor)

source code 
Parameters:
  • session - Session instance
  • id - Unit id that is to be created.
  • x, y - Unit's initial position
  • kwargs - Additional parameters for unit creation

__call__(self, issuer)
(Call operator)

source code 

__call__() gets called by the manager.

Parameters:
  • issuer - the issuer of the command