Poodletooth-iLand/toontown/coghq/DistributedCogHQExteriorDoorAI.py

45 lines
2 KiB
Python
Raw Normal View History

2015-05-27 08:07:12 -05:00
from otp.ai.AIBaseGlobal import *
from direct.distributed.ClockDelta import *
from direct.directnotify import DirectNotifyGlobal
from direct.fsm import ClassicFSM
import DistributedCogHQDoorAI
from direct.fsm import State
from toontown.toonbase import ToontownGlobals
import CogDisguiseGlobals
from toontown.building import FADoorCodes
2015-05-27 14:47:33 -05:00
from toontown.building import DoorTypes
2015-05-27 08:07:12 -05:00
class DistributedCogHQExteriorDoorAI(DistributedCogHQDoorAI.DistributedCogHQDoorAI):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedCogHQExteriorDoorAI')
def __init__(self, air, blockNumber, doorType, destinationZone, doorIndex = 0, lockValue = FADoorCodes.SB_DISGUISE_INCOMPLETE, swing = 3):
2015-05-27 14:47:33 -05:00
DistributedCogHQDoorAI.DistributedCogHQDoorAI.__init__(self, air, blockNumber, doorType, destinationZone, doorIndex, lockValue, swing)
2015-05-27 08:07:12 -05:00
def requestEnter(self):
avId = self.air.getAvatarIdFromSender()
dept = ToontownGlobals.cogHQZoneId2deptIndex(self.destinationZone)
av = self.air.doId2do.get(avId)
if av:
if self.doorType == DoorTypes.EXT_COGHQ and self.isLockedDoor():
parts = av.getCogParts()
if CogDisguiseGlobals.isSuitComplete(parts, dept):
allowed = 1
else:
allowed = 0
else:
allowed = 1
if not allowed:
self.sendReject(avId, self.isLockedDoor())
else:
2015-05-29 15:59:26 -05:00
print("********\nRequesting Lobby GUI...\n********")
2015-05-27 08:07:12 -05:00
self.sendUpdate('selectLobby', [avId])
def confirmEntrance(self, avId, status):
if status:
2015-05-29 15:59:26 -05:00
print("********\nAvatar Heading to Lobby...\n********")
2015-05-27 08:07:12 -05:00
self.enqueueAvatarIdEnter(avId)
self.sendUpdateToAvatarId(avId, 'setOtherZoneIdAndDoId', [self.destinationZone, self.otherDoor.getDoId()])
else:
2015-05-29 15:59:26 -05:00
print("********\nAvatar Canceled Entrance.\n********")
2015-05-27 08:07:12 -05:00
self.sendReject(avId, 0)