oldschool-toontown/otp/level/VisibilityBlocker.py
2019-12-30 01:00:16 -05:00

29 lines
847 B
Python

from . import Entity
class VisibilityBlocker:
def __init__(self):
self.__nextSetZoneDoneEvent = None
return
def destroy(self):
self.cancelUnblockVis()
def requestUnblockVis(self):
if self.__nextSetZoneDoneEvent is None:
self.__nextSetZoneDoneEvent = self.level.cr.getNextSetZoneDoneEvent()
self.acceptOnce(self.__nextSetZoneDoneEvent, self.okToUnblockVis)
self.level.forceSetZoneThisFrame()
return
def cancelUnblockVis(self):
if self.__nextSetZoneDoneEvent is not None:
self.ignore(self.__nextSetZoneDoneEvent)
self.__nextSetZoneDoneEvent = None
return
def isWaitingForUnblockVis(self):
return self.__nextSetZoneDoneEvent is not None
def okToUnblockVis(self):
self.cancelUnblockVis()