Files
Hippolyzer/docs/general.txt
2008-08-01 21:52:19 +00:00

33 lines
1.2 KiB
Plaintext

General Concepts
================
Calling a function on an Agent Domain, Region Domain or Region
--------------------------------------------------------------
The pattern for calling a certain functionality on one of the mentioned services is usually always the same.
For placing an avatar on a region for instance this looks like this::
from pyogp.lib.base.interfaces import IPlaceAvatar
f = IPlaceAvatar(agentdomain)
avatar = f.(region)
In this case we take an AgentDomain object and ask for the IPlaceAvatar adapter for it. This
will automatically try to get the needed capabilities from the seedcap (which is stored in the
agentdomain object). You will get back the adapter which implements the IPlaceAvatar interface
which states::
class IPlaceAvatar(Interface):
"""adapts an agents to a method which can place an avatar on a region"""
def __call__(region):
"""takes a region objects and tries to place the agent there as an avatar
return an IAvatar"""
So this means we can simply call this adapter with a region as we do above. It will return an object
which implements the IAvatar interface which can be found as well in ``interfaces.py``.