Changeset 235:831e4f6b3d18 for nagslang/puzzle.py
- Timestamp:
- Sep 4, 2013, 7:16:09 PM (7 years ago)
- Branch:
- default
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
nagslang/puzzle.py
r201 r235 1 1 from nagslang.constants import COLLISION_TYPE_PLAYER 2 3 4 def get_editable_puzzlers(): 5 classes = [] 6 for cls_name, cls in globals().iteritems(): 7 if isinstance(cls, type) and hasattr(cls, 'requires'): 8 classes.append((cls_name, cls)) 9 return classes 2 10 3 11 … … 30 38 raise NotImplementedError() 31 39 40 @classmethod 41 def requires(cls): 42 """Tell the level editor the arguments we require 43 44 Format is a list of name: type hint tuples""" 45 return [("name", "string")] 46 32 47 33 48 class YesPuzzler(Puzzler): … … 58 73 return False 59 74 75 @classmethod 76 def requires(cls): 77 return [("name", "string"), ("collision_types", "list of ints")] 78 60 79 61 80 class StateProxyPuzzler(Puzzler): … … 65 84 def get_state(self): 66 85 return self.glue.get_state_of(self._state_source) 86 87 @classmethod 88 def requires(cls): 89 return [("name", "string"), ("sources", "list of names")] 67 90 68 91 … … 76 99 return False 77 100 return True 101 102 @classmethod 103 def requires(cls): 104 return [("name", "string"), ("sources", "list of names")]
Note: See TracChangeset
for help on using the changeset viewer.