[Twisted-Python] weird problem with subclassing library.door.Door
Ok, I made a subclass of Door called SecretDoor. The point of this door is that it's opened with a remote button and is not visible unless it is open. I tried implementing this by overriding _close() in my class. class SecretDoor(door.Door): def verb_open(self, sentence): sentence.subject.hears("This door is opened elsewhere.") def _close(self, actor): self._undescribe() Unfortunately, this did not work. The _undescribe call was apparently being cancelled out by something that was resetting the description in the current room. I looked for calls to _redescribe(), but couldn't find any that were being called after my _undescribe(). Eventually I just decided to hack it out and added: def _redescribe(self): if not self.isOpen: self._undescribe() else: door.Door._redescribe(self) This is very bad, but I could not figure out any other way to do it. I still have it this way, and I just wanted to notify glyph and anyone else who's interested. Is there a better way to do this? Where is the description being added back into the room? Ahh well, thanks a bunch. -- Chris Armstrong carmstro@twistedmatrix.com http://twistedmatrix.com/~carmstro carmstro@dynup.net
participants (1)
-
Chris Armstrong