Пример #1
0
    def str(self, obj, x, y):
        """Returns __str__ of obj on current map"""

        message = Message.placeholder()
        sub_obj = self.allowed_objs.get(obj)[y][x]
        message.text = str(sub_obj)
        self.message_slot = [message]
Пример #2
0
    def name(self, obj, x, y):
        """Returns obj.name"""

        message = Message.placeholder()
        sub_obj = self.allowed_objs.get(obj)[y][x]
        if sub_obj is None:
            message.text = 'OBJECT NOT FOUND'
        else:
            message.text = sub_obj.name
        self.message_slot = [message]
Пример #3
0
 def bool_map(self, obj):
     """Returns current map as ASCII made of 1's and 0's based on existence of obj"""
     mes = []
     tiles = self.owner.world.current_map.tiles
     obj_dict = {
         'transition':
         [[tile.floor.transition for tile in row] for row in tiles],
     }
     vals = obj_dict.get(obj)
     for row in vals:
         message = Message.placeholder()
         text = ''
         for val in row:
             if val is not None:
                 text += '1 '
             else:
                 text += '0 '
         message.text = text
         mes.append(message)
     self.message_slot = mes