Exemplo n.º 1
0
 def __init__(self, name):
     self.name = name
     self.map = {}
     if os.path.exists("./maps/%s.json" % name):
         self.map = self.parse_map(json.load(open("./maps/%s.json" % name)))
         if settings.get("debug"):
             print("Created new map from ./maps/%s.json" % (name))
Exemplo n.º 2
0
 def sub(self, amount):
     if amount > 0:
         if (self.current - amount) > self.min:
             self.current -= amount
         else:
             self.current = self.min
     else:
         if settings.get("debug"):
             self.log.warn("pool.py (add): converting value to positive number")
         self.sub(abs(amount))
Exemplo n.º 3
0
 def add(self, amount):
     if amount > 0:
         if (self.current + amount) < self.max:
             self.current += amount
         else:
             self.current = self.max
     else:
         if settings.get("debug"):
             self.log.warn("pool.py (add): converting value to positive number")
         self.add(abs(amount))