oldschool-toontown/otp/distributed/TelemetryLimited.py

26 lines
584 B
Python
Raw Normal View History

2019-11-02 17:27:54 -05:00
class TelemetryLimited:
Sng = SerialNumGen()
def __init__(self):
2019-12-30 18:17:24 -06:00
self._telemetryLimiterId = self.Sng.next()
2019-11-02 17:27:54 -05:00
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 __astron__ and self.isEmpty():
return
2019-11-02 17:27:54 -05:00
for limit in self._limits:
limit(self)