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

« back to all changes in this revision

Viewing changes to Imaginary/imaginary/test/test_create.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:
7
7
 
8
8
from axiom import store, item, attributes
9
9
 
10
 
from imaginary.test import commandutils
11
10
from imaginary import iimaginary, plugins, creation
12
11
from imaginary.creation import createCreator
13
12
from imaginary.plugins import imaginary_basic
 
13
from imaginary.enhancement import Enhancement
 
14
 
 
15
from imaginary.test import commandutils
14
16
 
15
17
 
16
18
 
49
51
 
50
52
 
51
53
 
52
 
class Fruit(item.Item):
 
54
class Fruit(item.Item, Enhancement):
53
55
    implements(IFruit)
54
56
    powerupInterfaces = (IFruit,)
55
57
 
56
58
    fresh = attributes.boolean(default=False)
 
59
    thing = attributes.reference(allowNone=False)
57
60
 
58
61
 
59
62