coghq: move visgroup stuff from CogHood to CogHQExterior
This commit is contained in:
parent
34d829d4cb
commit
c1b72ce645
4 changed files with 14 additions and 14 deletions
|
@ -6,9 +6,12 @@ from toontown.toonbase import ToontownGlobals
|
|||
from pandac.PandaModules import *
|
||||
from otp.distributed.TelemetryLimiter import RotationLimitToH, TLGatherAllAvs
|
||||
from otp.nametag import NametagGlobals
|
||||
from pandac.PandaModules import *
|
||||
from toontown.dna import DNAUtil
|
||||
|
||||
class CogHQExterior(BattlePlace.BattlePlace):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('CogHQExterior')
|
||||
dnaFile = None
|
||||
|
||||
def __init__(self, loader, parentFSM, doneEvent):
|
||||
BattlePlace.BattlePlace.__init__(self, loader, doneEvent)
|
||||
|
@ -50,6 +53,7 @@ class CogHQExterior(BattlePlace.BattlePlace):
|
|||
State.State('tunnelIn', self.enterTunnelIn, self.exitTunnelIn, ['walk', 'WaitForBattle', 'battle']),
|
||||
State.State('tunnelOut', self.enterTunnelOut, self.exitTunnelOut, ['final']),
|
||||
State.State('final', self.enterFinal, self.exitFinal, ['start'])], 'start', 'final')
|
||||
self.visInterest = None
|
||||
|
||||
def load(self):
|
||||
self.parentFSM.getStateNamed('cogHQExterior').addChild(self.fsm)
|
||||
|
@ -61,6 +65,14 @@ class CogHQExterior(BattlePlace.BattlePlace):
|
|||
BattlePlace.BattlePlace.unload(self)
|
||||
|
||||
def enter(self, requestStatus):
|
||||
if not self.dnaFile is None:
|
||||
dna = loader.loadDNA(self.dnaFile)
|
||||
visgroups = DNAUtil.getVisGroups(dna)
|
||||
visZones = []
|
||||
for vg in visgroups:
|
||||
if vg.getZone() == dna.zone:
|
||||
visZones = vg.vis
|
||||
self.visInterest = base.cr.addInterest(base.localAvatar.defaultShard, visZones, 'cogHQVis')
|
||||
self.zoneId = requestStatus['zoneId']
|
||||
BattlePlace.BattlePlace.enter(self)
|
||||
self.fsm.enterInitialState()
|
||||
|
@ -76,6 +88,7 @@ class CogHQExterior(BattlePlace.BattlePlace):
|
|||
self.fsm.request(how, [requestStatus])
|
||||
|
||||
def exit(self):
|
||||
base.cr.removeInterest(self.visInterest)
|
||||
self.fsm.requestFinalState()
|
||||
self._telemLimiter.destroy()
|
||||
del self._telemLimiter
|
||||
|
|
|
@ -3,6 +3,7 @@ from toontown.coghq import CogHQExterior
|
|||
|
||||
class SellbotHQExterior(CogHQExterior.CogHQExterior):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('SellbotHQExterior')
|
||||
dnaFile = 'phase_9/dna/cog_hq_sellbot_sz.xml'
|
||||
|
||||
def enter(self, requestStatus):
|
||||
CogHQExterior.CogHQExterior.enter(self, requestStatus)
|
||||
|
|
|
@ -2,12 +2,9 @@ from direct.directnotify import DirectNotifyGlobal
|
|||
from direct.fsm import ClassicFSM, State
|
||||
from direct.fsm import State
|
||||
import Hood
|
||||
from pandac.PandaModules import *
|
||||
from toontown.dna import DNAUtil
|
||||
|
||||
class CogHood(Hood.Hood):
|
||||
notify = DirectNotifyGlobal.directNotify.newCategory('CogHood')
|
||||
dnaFile = None
|
||||
|
||||
def __init__(self, parentFSM, doneEvent, dnaStore, hoodId):
|
||||
Hood.Hood.__init__(self, parentFSM, doneEvent, dnaStore, hoodId)
|
||||
|
@ -31,20 +28,10 @@ class CogHood(Hood.Hood):
|
|||
if not skyInner.isEmpty():
|
||||
skyInner.setDepthWrite(0)
|
||||
skyInner.setBin('background', 20)
|
||||
if not self.dnaFile is None:
|
||||
dna = loader.loadDNA(self.dnaFile)
|
||||
visgroups = DNAUtil.getVisGroups(dna)
|
||||
visZones = []
|
||||
for vg in visgroups:
|
||||
if vg.getZone() == dna.zone:
|
||||
visZones = vg.vis
|
||||
print 'adding interest on zones', visZones
|
||||
self.visInterest = base.cr.addInterest(base.localAvatar.defaultShard, visZones, 'cogHQVis')
|
||||
|
||||
|
||||
def unload(self):
|
||||
Hood.Hood.unload(self)
|
||||
base.cr.removeInterest(self.visInterest)
|
||||
|
||||
def loadLoader(self, requestStatus):
|
||||
loaderName = requestStatus['loader']
|
||||
|
|
|
@ -3,7 +3,6 @@ from toontown.toonbase import ToontownGlobals
|
|||
from toontown.coghq import SellbotCogHQLoader
|
||||
|
||||
class SellbotHQ(CogHood.CogHood):
|
||||
dnaFile = 'phase_9/dna/cog_hq_sellbot_sz.xml'
|
||||
|
||||
def __init__(self, parentFSM, doneEvent, dnaStore, hoodId):
|
||||
CogHood.CogHood.__init__(self, parentFSM, doneEvent, dnaStore, hoodId)
|
||||
|
|
Loading…
Reference in a new issue