coghq: do the same for factory exteriors

This commit is contained in:
John Cote 2020-01-09 14:27:44 -05:00
parent 83cb21d6eb
commit 19080e8754

View file

@ -4,9 +4,11 @@ from direct.fsm import ClassicFSM, State
from direct.fsm import State
from otp.distributed.TelemetryLimiter import RotationLimitToH, TLGatherAllAvs
from toontown.toonbase import ToontownGlobals
from toontown.hood import ZoneUtil
from toontown.building import Elevator
from pandac.PandaModules import *
from libotp import *
from libtoontown import *
class FactoryExterior(BattlePlace.BattlePlace):
notify = DirectNotifyGlobal.directNotify.newCategory('FactoryExterior')
@ -72,6 +74,8 @@ class FactoryExterior(BattlePlace.BattlePlace):
self.tunnelOriginList = base.cr.hoodMgr.addLinkTunnelHooks(self, self.nodeList, self.zoneId)
how = requestStatus['how']
self.fsm.request(how, [requestStatus])
if base.cr.astronSupport and self.zoneId != ToontownGlobals.LawbotOfficeExt:
self.handleInterests()
def exit(self):
self._telemLimiter.destroy()
@ -153,3 +157,27 @@ class FactoryExterior(BattlePlace.BattlePlace):
messenger.send(self.doneEvent)
else:
self.notify.error('Unknown mode: ' + where + ' in handleElevatorDone')
if config.GetBool('astron-support', True):
def handleInterests(self):
# First, we need to load the DNA file for this Cog HQ.
dnaStore = DNAStorage()
dnaFileName = self.genDNAFileName(self.zoneId)
loadDNAFileAI(dnaStore, dnaFileName)
# Next, we need to collect all of the visgroup zone IDs.
self.zoneVisDict = {}
for i in range(dnaStore.getNumDNAVisGroupsAI()):
groupFullName = dnaStore.getDNAVisGroupName(i)
visGroup = dnaStore.getDNAVisGroupAI(i)
visZoneId = int(base.cr.hoodMgr.extractGroupName(groupFullName))
visZoneId = ZoneUtil.getTrueZoneId(visZoneId, self.zoneId)
visibles = []
for i in range(visGroup.getNumVisibles()):
visibles.append(int(visGroup.getVisibleName(i)))
visibles.append(ZoneUtil.getBranchZone(visZoneId))
self.zoneVisDict[visZoneId] = visibles
# Finally, we want interest in all visgroups due to this being a Cog HQ.
base.cr.sendSetZoneMsg(self.zoneId, list(self.zoneVisDict.values())[0])