added remove()

This commit is contained in:
Dave Schuyler 2005-05-05 21:49:52 +00:00
parent 1ae8c64d9b
commit e204ad6cc6

View File

@ -108,6 +108,25 @@ class ControlManager:
controls.setCollisionsActive(0)
self.controls[name] = controls
def remove(self, name):
"""
name is any key that was used to refer to the
the controls when they were added (e.g.
using the add(<controls>, <name>) call).
Remove a control instance from the list of available control systems.
See also: add().
"""
assert self.notify.debugCall(id(self))
oldControls = self.controls.get(name)
if oldControls is not None:
print "Removing controls:", name
oldControls.disableAvatarControls()
oldControls.setCollisionsActive(0)
oldControls.delete()
del self.controls[name]
def use(self, name, avatar):
"""
name is a key (string) that was previously passed to add().