Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • nagslang/puzzle.py

    r201 r235  
    11from nagslang.constants import COLLISION_TYPE_PLAYER
     2
     3
     4def 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
    210
    311
     
    3038        raise NotImplementedError()
    3139
     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
    3247
    3348class YesPuzzler(Puzzler):
     
    5873        return False
    5974
     75    @classmethod
     76    def requires(cls):
     77        return [("name", "string"), ("collision_types", "list of ints")]
     78
    6079
    6180class StateProxyPuzzler(Puzzler):
     
    6584    def get_state(self):
    6685        return self.glue.get_state_of(self._state_source)
     86
     87    @classmethod
     88    def requires(cls):
     89        return [("name", "string"), ("sources", "list of names")]
    6790
    6891
     
    7699                return False
    77100        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.