~divmod-dev/divmod.org/empty-host-header-2936

« back to all changes in this revision

Viewing changes to Imaginary/imaginary/world.py

  • Committer: glyph
  • Date: 2009-06-29 04:03:17 UTC
  • Revision ID: svn-v4:866e43f7-fbfc-0310-8f2a-ec88d1da2979:trunk:17590
Remove all usage of `installOn()` from Imaginary.

This change replaces the undocumented `ThingMixin`, and the unfortunately-named, poorly-considered idiom of using `installOn` with its subclasses, with a new, thoroughly documented and better-named mixin, `imaginary.enhancement.Enhancement`.

Furthermore, this updates `createCreator` to use `Enhancement`s rather than arbitrary powerups.

The tests and included systems now also provide a good example of how Imaginary application / game code should idiomatically fit into the framework.

Author: glyph

Reviewer: exarkun

Fixes #2558

Show diffs side-by-side

added added

removed removed

Lines of Context:
6
6
 
7
7
from axiom.item import Item
8
8
from axiom.attributes import inmemory, reference
9
 
from axiom.dependency import installOn
10
9
 
11
10
from imaginary.iimaginary import IContainer
12
11
from imaginary.objects import Thing, Container, Actor
44
43
        """
45
44
        if self.origin is None:
46
45
            self.origin = Thing(store=self.store, name=u"The Place")
47
 
            installOn(Container(store=self.store, capacity=1000), self.origin)
 
46
            Container.createFor(self.origin, capacity=1000)
48
47
 
49
48
        character = Thing(store=self.store, weight=100,
50
49
                          name=name, proper=True, **kw)
51
 
        installOn(Container(store=self.store, capacity=10), character)
52
 
        installOn(Actor(store=self.store), character)
 
50
        Container.createFor(character, capacity=10)
 
51
        Actor.createFor(character)
53
52
 
54
53
        # Unfortunately, world -> garments -> creation -> action ->
55
54
        # world. See #2906. -exarkun
56
55
        from imaginary.garments import Wearer
57
 
        installOn(Wearer(store=self.store), character)
 
56
        Wearer.createFor(character)
58
57
 
59
58
        IContainer(self.origin).add(character)
60
59
        return character