Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added basic system for collision callback function/scripts - replaced…
… UI option for sensor with object type setting
- Loading branch information
Showing
4 changed files
with
80 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
__author__ = 'chozabu' | ||
|
||
#from http://stackoverflow.com/a/13276237/445831 - Sasha Chedygov | ||
class TwoWayDict(dict): | ||
#def __init__(self,iterable=None, **kwargs): | ||
# super(TwoWayDict,self).__init__(iterable, **kwargs) | ||
|
||
def __setitem__(self, key, value): | ||
# Remove any previous connections with these values | ||
if key in self: | ||
del self[key] | ||
if value in self: | ||
del self[value] | ||
dict.__setitem__(self, key, value) | ||
dict.__setitem__(self, value, key) | ||
|
||
def __delitem__(self, key): | ||
dict.__delitem__(self, self[key]) | ||
dict.__delitem__(self, key) | ||
|
||
def __len__(self): | ||
"""Returns the number of connections""" | ||
# The int() call is for Python 3 | ||
return int(dict.__len__(self) / 2) |