# Path: omnitool/loadbar.py
# class Bar():
#     def __init__(self, size = (500,20), caption = "Loading:", bg = pygame.Color("black"), fg = pygame.Color("grey"),
#                  abortable = True):
# 
#         pygame.display.init()#
#         self.abortable = abortable
#         self.size = size
#         pygame.display.set_caption(caption)
#         self.basecaption = caption
#         self.surface = pygame.display.set_mode(size)
#         self.rect = pygame.Rect((0,0), (0, self.size[1]))
#         self.fg = fg
#         self.bg = bg
#         self.scale = self.size[0]/100
#         self.set_progress(0)
# 
#     def set_progress(self, percent, caption = ""):
#         for event in pygame.event.get():
#             if event.type == 12 and self.abortable:
#                 pygame.quit()
#                 import sys
#                 sys.exit()
#         if caption:
#             pygame.display.set_caption(caption)
#         self.progress = percent
#         self.surface.fill(self.bg)
#         self.rect.width = self.progress*self.scale
#         pygame.gfxdraw.box(self.surface, self.rect, self.fg)
#         pygame.display.update(self.rect)
# 
# Path: omnitool/database.py
# def get_custom_db(txt):
# def parse():
# 
# Path: plugins/planetoids_lib/terragui.py
# def run(main=None):


import sys
    import os
import pygame
            import os
                import time
from math import cos, sin, pi
from collections import defaultdict
from random import *
from omnitool.loadbar import Bar
from omnitool.database import itemlist, names, tiles, ntiles
from omnitool.tinterface import *
from .planetoids_lib import terragui
from .planetoids_lib.tree import make_tree
from .planetoids_lib.terradata import *
            pygame.draw.polygon(sur, (233, 233, 233), points)
            steps = 70
            pygame.draw.circle(sur, (23, 23, 23), points[-1], 8)
            pygame.draw.circle(sur, (23, 23, 23), points[3], 8)
            orb = randint(steps // 2, steps)
            for x in range(steps + 1):

                x = float(x)
                cpos = (int(points[0][0] * x / steps + points[-1][0] * (steps - x) / steps),
                        int(points[0][1] * x / steps + points[-1][1] * (steps - x) / steps))
                ra = randint(4, 8)  #
                #pygame.draw.circle(sur, (32,32,32), cpos, ra, 4) #vines
                pygame.draw.circle(sur, (23, 23, 23), cpos, ra, 2)  #grass
                pygame.draw.circle(sur, (25, 25, 25), cpos, ra)  #ebonstone

                cpos2 = (int(points[2][0] * x / steps + points[3][0] * (steps - x) / steps),
                         int(points[2][1] * x / steps + points[3][1] * (steps - x) / steps))
                ra = randint(4, 8)
                #pygame.draw.circle(sur, (32,32,32), cpos2, ra, 4) #vines
                pygame.draw.circle(sur, (23, 23, 23), cpos2, ra, 2)  #grass
                pygame.draw.circle(sur, (25, 25, 25), cpos2, ra)  #ebonstone

                if x == orb:
                    cpos = (cpos[0] + cpos2[0]) // 2, (cpos[1] + cpos2[1]) // 2
                    pygame.draw.circle(sur, (25, 25, 25), cpos, 3)  #ebonstone
                    sur.blit(multis["shadoworb"], (cpos[0] - 1, cpos[1] - 1))

            return sur



# Path: omnitool/loadbar.py
# class Bar():
#     def __init__(self, size = (500,20), caption = "Loading:", bg = pygame.Color("black"), fg = pygame.Color("grey"),
#                  abortable = True):
# 
#         pygame.display.init()#
#         self.abortable = abortable
#         self.size = size
#         pygame.display.set_caption(caption)
#         self.basecaption = caption
#         self.surface = pygame.display.set_mode(size)
#         self.rect = pygame.Rect((0,0), (0, self.size[1]))
#         self.fg = fg
#         self.bg = bg
#         self.scale = self.size[0]/100
#         self.set_progress(0)
# 
#     def set_progress(self, percent, caption = ""):
#         for event in pygame.event.get():
#             if event.type == 12 and self.abortable:
#                 pygame.quit()
#                 import sys
#                 sys.exit()
#         if caption:
#             pygame.display.set_caption(caption)
#         self.progress = percent
#         self.surface.fill(self.bg)
#         self.rect.width = self.progress*self.scale
#         pygame.gfxdraw.box(self.surface, self.rect, self.fg)
#         pygame.display.update(self.rect)
# 
# Path: omnitool/database.py
# def get_custom_db(txt):
# def parse():
# 
# Path: plugins/planetoids_lib/terragui.py
# def run(main=None):


# Path: plugins/planetoids.py
import sys
    import os
import pygame
            import os
                import time
from math import cos, sin, pi
from collections import defaultdict
from random import *
from omnitool.loadbar import Bar
from omnitool.database import itemlist, names, tiles, ntiles
from omnitool.tinterface import *
from .planetoids_lib import terragui
from .planetoids_lib.tree import make_tree
from .planetoids_lib.terradata import *

            pygame.draw.polygon(sur, (233, 233, 233), points)
            steps = 70
            pygame.draw.circle(sur, (23, 23, 23), points[-1], 8)
            pygame.draw.circle(sur, (23, 23, 23), points[3], 8)
            orb = randint(steps // 2, steps)
            for x in range(steps + 1):

                x = float(x)
                cpos = (int(points[0][0] * x / steps + points[-1][0] * (steps - x) / steps),
                        int(points[0][1] * x / steps + points[-1][1] * (steps - x) / steps))
                ra = randint(4, 8)  #
                #pygame.draw.circle(sur, (32,32,32), cpos, ra, 4) #vines
                pygame.draw.circle(sur, (23, 23, 23), cpos, ra, 2)  #grass
                pygame.draw.circle(sur, (25, 25, 25), cpos, ra)  #ebonstone

                cpos2 = (int(points[2][0] * x / steps + points[3][0] * (steps - x) / steps),
                         int(points[2][1] * x / steps + points[3][1] * (steps - x) / steps))
                ra = randint(4, 8)
                #pygame.draw.circle(sur, (32,32,32), cpos2, ra, 4) #vines
                pygame.draw.circle(sur, (23, 23, 23), cpos2, ra, 2)  #grass
                pygame.draw.circle(sur, (25, 25, 25), cpos2, ra)  #ebonstone

                if x == orb:
                    cpos = (cpos[0] + cpos2[0]) // 2, (cpos[1] + cpos2[1]) // 2
                    pygame.draw.circle(sur, (25, 25, 25), cpos, 3)  #ebonstone
                    sur.blit(multis["shadoworb"], (cpos[0] - 1, cpos[1] - 1))

            return sur



        d = terragui.run(None)