Package horizons :: Package world :: Module concreteobject :: Class ConcreteObject
[hide private]
[frames] | no frames]

Class ConcreteObject

source code

util.changelistener.ChangeListener --+    
                                     |    
          util.worldobject.WorldObject --+
                                         |
                                        ConcreteObject

Class for concrete objects like Units or Buildings. "Concrete" here means "you can touch it", e.g. a Warehouse is a ConcreteObject, a Settlement isn't. All such objects have positions, so Islands are no ConcreteObjects for technical reasons.

Assumes that object has a member _instance.

Instance Methods [hide private]
 
__init__(self, session, action_set_id=None, **kwargs) source code
 
__init(self, action_set_id=None) source code
 
fife_instance(self) source code
 
save(self, db) source code
 
load(self, db, worldid) source code
 
act(self, action, facing_loc=None, repeating=False, force_restart=True) source code
 
has_action(self, action)
Checks if this unit has a certain action.
source code
 
remove(self) source code
 
name(self) source code
    Inherited from util.worldobject.WorldObject
 
__lt__(self, other) source code
    Inherited from util.changelistener.ChangeListener
 
_changed(self)
Calls every listener when an object changed
source code
 
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 Methods [hide private]
 
weighted_choice(cls, weighted_dict)
http://eli.thegreenplace.net/2010/01/22/weighted-random-generation-in-python/
source code
 
get_random_action_set(cls, level=0, exact_level=False)
Returns an action set for an object of type object_id in a level <= the specified level.
source code
    Inherited from util.worldobject.WorldObject
 
get_object_by_id(cls, id)
Returns the worldobject with id id Throws WorldObjectNotFound with the worldid as arg.
source code
 
get_objs(cls) source code
 
reset(cls) source code
Class Variables [hide private]
  movable = False
  is_unit = False
  is_building = False
    Inherited from util.worldobject.WorldObject
  log = logging.getLogger("util.worldobject")
Method Details [hide private]

__init__(self, session, action_set_id=None, **kwargs)
(Constructor)

source code 
Parameters:
  • session - Session instance this obj belongs to
Overrides: util.changelistener.ChangeListener.__init__

fife_instance(self)

source code 
Decorators:
  • @property

save(self, db)

source code 
Overrides: util.worldobject.WorldObject.save

load(self, db, worldid)

source code 
Overrides: util.changelistener.ChangeListener.load

act(self, action, facing_loc=None, repeating=False, force_restart=True)

source code 
Parameters:
  • repeating - maps to fife instance method actRepeat or actOnce
  • force_restart - whether to always restart, even if action is already displayed

has_action(self, action)

source code 

Checks if this unit has a certain action.

Parameters:
  • action - animation id as string

remove(self)

source code 
Overrides: util.changelistener.ChangeListener.remove

get_random_action_set(cls, level=0, exact_level=False)
Class Method

source code 

Returns an action set for an object of type object_id in a level <= the specified level. The highest level number is preferred.

Parameters:
  • level - level to prefer. a lower level might be chosen
  • exact_level - choose only action sets from this level. return val might be None here.
Returns:
action_set_id or None

name(self)

source code 
Decorators:
  • @property