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))
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))
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))