Package horizons :: Package world :: Package units :: Module animal :: Class WildAnimal
[hide private]
[frames] | no frames]

Class WildAnimal

source code

resourcehandler.ResourceTransferHandler --+            
            resourcehandler.ResourceHandler --+        
                                         Animal --+    
                                    CollectorAnimal --+
                               collectors.Collector --+

Animals, that live in the nature and feed on natural resources. These animals can be hunted.

They produce wild animal meat and feed on wild animal food x, which is produced by e.g. a tree.

It is assumed, that they need all resources, that they use, for reproduction. If they have gathered all resources, and their inventory is full, they reproduce.

Instance Methods [hide private]
__init__(self, owner, start_hidden=False, can_reproduce=True, **kwargs) source code
__init(self, island, can_reproduce, health=None) source code
save(self, db) source code
load(self, db, worldid) source code
get_collectable_res(self) source code
apply_state(self, state, remaining_ticks=None) source code
Just walk to a random location nearby and search there for food, when we arrive
source code
get_job(self) source code
check_possible_job_target(self, provider) source code
end_job(self) source code
Create another animal of our type on the place where we stand
source code
Returns, whether the next child will be able to reproduce himself.
source code
Makes animal die, e.g.
source code
cancel(self, continue_action=None) source code
__str__(self) source code
    Inherited from CollectorAnimal
finish_working(self) source code
get_home_inventory(self) source code
Whether this unit is just now or about to be collected
source code
Let the animal continue as usual after the job.
source code
Search for a job, only called if the collector does not have a job.
source code
stop_after_job(self, collector)
Tells the unit to stop after the current job and call the collector to pick it up
source code
    Inherited from resourcehandler.ResourceHandler
Returns the inventory of the owner to be able to retrieve special resources such as gold.
source code
Returns a iterable obj containing all resources this building provides.
source code
add_incoming_collector(self, collector) source code
get_available_pickup_amount(self, res, collector)
Returns how much of res a collector may pick up.
source code
get_consumed_resources(self, include_inactive=False)
Returns the needed resources that are used by the productions currently active.
source code
Returns a list of resources, that are currently consumed in a production.
source code
Needed, but not currently consumed resources.
source code
Returns list of resources, where free space in the inventory exists.
source code
Returns the resources, that are produced by productions, that are currently active
source code
Returns provided resources, where at least 1 ton is available
source code
initialize(self) source code
pickup_resources(self, res, amount, collector)
Try to get amount number of resources of id res_id that are in stock and removes them from the stock.
source code
remove(self) source code
remove_incoming_collector(self, collector) source code
    Inherited from resourcehandler.ResourceTransferHandler
transfer_to_storageholder(self, amount, res_id, transfer_to, signal_errors=False)
Transfers amount of res_id to transfer_to.
source code
Class Variables [hide private]
  walking_range = 6
  work_duration = 96
  pather_class = SoldierPather
    Inherited from Animal
  log = logging.getLogger('world.units.animal')
    Inherited from resourcehandler.ResourceHandler
  tabs = ProductionOverviewTab, InventoryTab
Method Details [hide private]

__init__(self, owner, start_hidden=False, can_reproduce=True, **kwargs)

source code 
Overrides: resourcehandler.ResourceHandler.__init__

__init(self, island, can_reproduce, health=None)

source code 
  • island - Hard reference to island
  • can_reproduce - bool
  • health - int or None

save(self, db)

source code 

load(self, db, worldid)

source code 
Overrides: resourcehandler.ResourceHandler.load


source code 
Overrides: CollectorAnimal.get_collectable_res

apply_state(self, state, remaining_ticks=None)

source code 
Overrides: CollectorAnimal.apply_state


source code 

Returns, whether the next child will be able to reproduce himself. Some animal can't reproduce, which makes population growth easier to control.



source code 

Makes animal die, e.g. because of starvation or getting killed by herder