Package horizons :: Package world :: Package production :: Module production :: Class SettlerProduction
[hide private]
[frames] | no frames]

Class SettlerProduction

source code

util.changelistener.ChangeListener --+        
                                     |        
                            Production --+    
                                         |    
                        ChangingProduction --+
                                             |
                                            SettlerProduction

For settlers, production behaves different: They produce happiness from the goods they get. They get happy immediately when the get the resource (i.e. they produce at production start). It needs to be a changing production since the time can be altered

Instance Methods [hide private]
 
_give_produced_res(self)
Put produces goods to the inventory
source code
 
_remove_res_to_expend(self)
Removes the resources from the inventory, that production takes.
source code
    Inherited from ChangingProduction
 
load(self, db, worldid) source code
 
save(self, db, owner_id)
owner_id: worldid of the owner of the producer object that owns this production
source code
    Inherited from Production
 
__init__(self, inventory, owner_inventory, prod_id, prod_data, start_finished=False, load=False, **kwargs) source code
 
__str__(self) source code
 
_add_listeners(self, check_now=False)
Listen for changes in the inventory from now on.
source code
 
_changed(self)
Calls every listener when an object changed
source code
 
_check_available_res(self)
Checks if all required resources are there.
source code
 
_check_for_space_for_produced_res(self)
Checks if there is enough space in the inventory for the res, we want to produce.
source code
 
_check_inventory(self)
Called when assigned building's inventory changed in some way
source code
 
_clean_state_history(self)
remove the part of the state history that is too old to matter
source code
 
_finished_producing(self, continue_producing=True, **kwargs)
Called when the production finishes.
source code
 
_get_first_relevant_tick(self, ignore_pause)
Returns the first tick that is relevant for production utilization calculation
source code
 
_get_producing_callback(self)
Returns the callback used during the process of producing (state: producing)
source code
 
_produce(self)
Called when there are enough res in the inventory for starting production
source code
 
_remove_listeners(self) source code
 
_start_production(self)
Actually start production.
source code
 
alter_production_time(self, modifier)
@see ProductionLine.alter_production_time
source code
 
changes_animation(self)
Returns whether the production should change the animation
source code
 
finish_production_now(self)
Makes the production finish now
source code
 
get_age(self) source code
 
get_animating_state(self)
Returns the production's current state, but only if it effects the animation, else None
source code
 
get_consumed_resources(self)
Res that are consumed here.
source code
 
get_produced_resources(self)
Res that are produced here.
source code
 
get_produced_units(self)
@return dict of produced units {unit_id: amount}
source code
 
get_production_line_id(self)
Returns id of production line
source code
 
get_production_time(self) source code
 
get_state(self)
Returns the Production's current state
source code
 
get_state_history_times(self, ignore_pause)
Returns the part of time 0 <= x <= 1 the production has been in a state during the last history_length ticks.
source code
 
get_unstorable_produced_res(self)
Returns all produced res for whose there is no space
source code
 
is_paused(self) source code
 
pause(self, pause=True) source code
 
remove(self) source code
 
toggle_pause(self) source code
    Inherited from util.changelistener.ChangeListener
 
add_change_listener(self, listener, call_listener_now=False, no_duplicates=False) source code
 
add_remove_listener(self, listener, no_duplicates=False)
A listener that listens for removal of the object
source code
 
clear_change_listeners(self)
Removes all change listeners
source code
 
discard_change_listener(self, listener)
Remove listener if it's there
source code
 
discard_remove_listener(self, listener) source code
 
end(self) source code
 
has_change_listener(self, listener) source code
 
has_remove_listener(self, listener) source code
 
remove_change_listener(self, listener) source code
 
remove_remove_listener(self, listener) source code
Class Variables [hide private]
    Inherited from Production
  keep_original_prod_line = False
  log = logging.getLogger('world.production')
  uses_gold = False
Method Details [hide private]

_give_produced_res(self)

source code 

Put produces goods to the inventory

Overrides: Production._give_produced_res
(inherited documentation)

_remove_res_to_expend(self)

source code 

Removes the resources from the inventory, that production takes.

Overrides: Production._remove_res_to_expend
(inherited documentation)