historical/toontown-classic.git/otp/distributed/TelemetryLimited.py

26 lines
569 B
Python
Raw Normal View History

2024-01-16 17:20:27 +00:00
class TelemetryLimited:
Sng = SerialNumGen()
def __init__(self):
self._telemetryLimiterId = self.Sng.next()
self._limits = set()
def getTelemetryLimiterId(self):
return self._telemetryLimiterId
def addTelemetryLimit(self, limit):
self._limits.add(limit)
def removeTelemetryLimit(self, limit):
if limit in self._limits:
self._limits.remove(limit)
def enforceTelemetryLimits(self):
if self.isEmpty():
return
for limit in self._limits:
limit(self)