Пример #1
0
    def choices(self):
        bot_block = self.blackboard.bot_standing_on_block(self.blackboard.bot_object)
        s = " "

        print "\n\n\n NOW printing CHUNK \n\n\n"
        chunk_x = bot_block.coords.x >> 4
        chunk_z = bot_block.coords.z >> 4
        block_types = self.blackboard.grid_get_chunk((chunk_x, chunk_z)).block_types
        print "block types:\n"

        #print block_types
        #print base64.b64encode(block_types)

        block_types_json = [ [ 0 for i in range(8) ] for j in range(16) ]

        for i in range(0,16):
            for j in range (0, 8):
                if block_types[i] != None:
                    block_types_json[i][j] = json.dumps(list(block_types[i][j*512:j*512+512]))
                else:
                    block_types_json[i][j] = list(0 for k in range(0,512))
        print len(block_types_json)
        print [bot_block.coords.x,bot_block.coords.y,bot_block.coords.z]
        print "\n\n\n FINISHED printing CHUNK \n\n\n"

        weblog = logbot.getWebLogger()
        weblog.sendLine("%s\r\n\r" % json.dumps([bot_block.coords.x,bot_block.coords.y,bot_block.coords.z]))
        for i in range(0,16):
            for j in range (0,8):
                weblog.sendLine("%s\r\n\r" % block_types_json[i][j])
        yield self.make_behavior(TravelTo, coords=bot_block.coords, shorten_path_by=1)
Пример #2
0
 def choices(self):
     bot_block = self.blackboard.bot_standing_on_block(self.blackboard.bot_object)
     weblog = logbot.getWebLogger()
     weblog.sendLine("%s\r\n\r" % bot_block)
     print "The block below me is ", bot_block
     yield self.make_behavior(TravelTo, coords=bot_block.coords, shorten_path_by=1)