imaginary
imaginary copied to clipboard
Replace Thing.portable with an IMovementRestriction
Ability to restrict the movement of a Thing is implemented within the Thing class itself, in the moveTo method, where the portable attribute is checked.
However, there's a system for powerups to interfere with the movement of things which is already general enough to implement the equivalent of Thing.portable == False. Thus, Thing.portable could be removed and the functionality replaced with a powerup like (just sketching):
@implementer(IMovementRestriction)
class Immoveable(Enhancement):
powerupInterfaces = [IMovementRestriction]
def movementImminent(self, movee, destination):
raise CannotMove(movee, destination)