def __init__(self, cr): DistributedNode.__init__(self, cr) NodePath.__init__(self, 'winter_coach') self.cr = cr self.coach = None self.wheelBarrow = None self.coachNP = None
def announceGenerate(self): DistributedNode.announceGenerate(self) self.capturePoint = loader.loadModel('phase_4/models/props/capture_point.bam') self.capturePoint.setScale(2.5) self.capturePoint.reparentTo(self) self.captureCircle = loader.loadModel('phase_4/models/minigames/ice_game_score_circle.bam') self.captureCircle.setAlphaScale(0.5) self.captureCircle.setTransparency(TransparencyAttrib.MAlpha) self.captureCircle.reparentTo(self) self.captureCircle.setPos(self.capturePoint.getPos(render)) self.captureCircle.setX(self.captureCircle.getX() - 0.03) self.captureCircle.setY(self.captureCircle.getY() - 0.1) self.captureCircle.setZ(self.captureCircle.getZ() + 2.4) self.captureCircle.hide() self.captureCircle.setTextureOff(1) self.aoogahSfx = loader.loadSfx('phase_5/audio/sfx/AA_sound_aoogah.ogg') sphere = CollisionSphere(0, 0, 0, 4) sphere.setTangible(0) self.pointCollNode = CollisionNode(self.uniqueName('coll_node')) self.pointCollNode.addSolid(sphere) self.pointCollNode.setCollideMask(GGG.HILL_BITMASK) self.collNP = self.capturePoint.attachNewNode(self.pointCollNode) self.neutralCapTexture = 'phase_4/maps/neutral_capture_point.mat' self.redCapTexture = 'phase_4/maps/red_capture_point.mat' self.blueCapTexture = 'phase_4/maps/blue_capture_point.mat' self.defCapTexture = 'phase_4/maps/captured_capture_point.mat' self.reparentTo(render)
def __init__(self, cr): # you have to initialize NodePath.__init__() here because it is # not called in DistributedNode.__init__() DistributedNode.__init__(self, cr) NodePath.__init__(self, 'player') self.player = Player(os.getenv('COMPUTERNAME'))
def handleChildArrive(self, childObj, zoneId): DistributedNode.handleChildArrive(self, childObj, zoneId) if childObj.isLocal(): base.loadingScreen.endStep('enterArea') base.enableZoneLODs(self) childObj.refreshActiveQuestStep() localAvatar.guiMgr.setMinimap(self.minimap) localAvatar.setAreaFootstep(self.footstepSound) localAvatar.guiMgr.radarGui.showLocation(self.uniqueId) envName = base.worldCreator.environmentTable.get(self.uniqueId) if envName: environmentID = TODGlobals.ENVIRONMENT_NAMES_TO_ID.get(envName, TODGlobals.ENV_DEFAULT) envData = { } envSettings = base.worldCreator.uidEnvSettings.get(self.uniqueId) if envSettings != None: envData = envSettings base.cr.timeOfDayManager.setEnvironment(environmentID, envData) else: envData = None envSettings = base.worldCreator.uidEnvSettings.get(self.uniqueId) if envSettings != None: envData = envSettings base.cr.timeOfDayManager.setEnvironment(TODGlobals.ENV_INTERIOR, envData) self.builder.arrived() self.accept('transferMinimapObjects', self.transferMinimapObject) if self.minimap and hasattr(childObj, 'getMinimapObject'): if childObj.getMinimapObject(): self.laMinimapObj = childObj.getMinimapObject() self.minimap.addObject(childObj.getMinimapObject())
def __init__(self, cr): DistributedNode.__init__(self, cr) NodePath.__init__(self, 'GameArea') MappableArea.__init__(self) StagedObject.__init__(self, StagedObject.OFF) self.uniqueId = '' self.geom = None self.funnelDisplayName = None self.previousDisplayName = None self.gameFSM = None self.links = [] self.pendingSetupConnector = { } self.connectors = { } self.connectorInterests = set() self.envEffects = None self.spawnTriggers = [] self.blockerColls = [] self.islandWaterParameters = None self.swamp_water = None self.entryTime = [ None, 0] self.timeCheck = 0 self.minimap = None self.footprintNode = None self.popupDialog = None self.minimapArea = 0 self.laMinimapObj = None self.footstepSound = None self.environment = None self.connectorsHereCallback = None
def announceGenerate(self): DistributedNode.announceGenerate(self) self.kart = loader.loadModel('phase_6/models/karting/Kart3_Final.bam') self.kart.find('**/decals').removeNode() self.kart.reparentTo(self) self.pod = loader.loadModel('phase_4/models/minigames/pods_truck.egg') self.pod.reparentTo(self) self.pod.setScale(0.2) self.pod.setY(8.5) self.pod.setH(180) self.rope = Rope() self.rope.ropeNode.setUseVertexColor(1) self.rope.setup(3, ({'node': self.kart, 'point': (0, 1.5, 0.7), 'color': (0, 0, 0, 1), 'thickness': 1000}, {'node': self.kart, 'point': (0, 1.5, 0.7), 'color': (0, 0, 0, 1), 'thickness': 1000}, {'node': self.pod, 'point': (0, 31, 5), 'color': (0, 0, 0, 1), 'thickness': 1000}), []) self.rope.setH(180) self.rope.reparentTo(self) sphere = CollisionSphere(0, 0, 0, 2) sphere.setTangible(0) node = CollisionNode(self.uniqueName('truck_trigger')) node.addSolid(sphere) node.setCollideMask(CIGlobals.WallBitmask) self.triggerNP = self.attachNewNode(node) self.triggerNP.setPos(0, 8.0, 2.0) self.setScale(2.0) self.accept('enter' + self.triggerNP.node().getName(), self.__handleTruckTrigger)
def disable(self): DistributedNode.disable(self) self.ignoreAll() if self.animTrack: self.animTrack.pause() self.animTrack = None return
def delete(self): if base.zoneLODTarget == self: base.disableZoneLODs() for trigger in self.spawnTriggers: trigger.removeNode() del self.spawnTriggers del self.connectors del self.links if self.envEffects: self.envEffects.delete() self.envEffects = None DistributedNode.delete(self) if self.islandWaterParameters: del self.islandWaterParameters if self.swamp_water: self.swamp_water.delete() del self.swamp_water if self.popupDialog: self.popupDialog.destroy() del self.popupDialog self.connectorsHereCallback = None
def __init__(self, cr): DistributedNode.__init__(self, cr) NodePath.__init__(self, 'DistributedTunnel') StagedObject.__init__(self, StagedObject.OFF) self.uniqueId = '' self.fakeZoneId = PiratesGlobals.FakeZoneId self.GridLOD = { } self.visNodes = { } self.geom = None self.envEffects = None self._links = { } self.areaWorldZone = [ None, None] self.areaNode = [ None, None] self._DistributedTunnel__loadedArea = None self.areaIndexLoading = None self.pendingAreaUnload = False self.pendingArea = None self.minimapObj = None self.builder = GridAreaBuilder.GridAreaBuilder(self) self.connectorNodes = [ 'portal_connector_1', 'portal_connector_2'] self.connectorNodePosHpr = [] self.ambientNames = [ None, None] self.avatarZoneContext = None self.floorIndex = -1 self._inTransition = False self.ownHandles = []
def announceGenerate(self): DistributedNode.announceGenerate(self) if self.cr.activeWorld == None or self.cr.activeWorld.getType() != PiratesGlobals.INSTANCE_PVP: self.setupCollisions() self.geom.hide(OTPRender.MainCameraBitmask) self.geom.showThrough(OTPRender.EnviroCameraBitmask)
def announceGenerate(self): DistributedNode.announceGenerate(self) if self.cr.activeWorld == None or self.cr.activeWorld.getType() != PiratesGlobals.INSTANCE_PVP: self.setupCollisions() self.geom.hide(OTPRender.MainCameraBitmask) self.geom.showThrough(OTPRender.EnviroCameraBitmask) return
def delete(self): if self.siteData: self.siteData = None if self.identifierIcon: self.identifierIcon.destroy() self.identifierIcon = None if self.distanceTask: self.distanceTask = None if self.interactCollSphereNP: self.interactCollSphereNP.removeNode() self.interactCollSphereNP = None self.interactCollSphere = None if self.floorMarker: self.floorMarker.removeNode() self.floorMarker = None if self.text: self.text.hide() self.text.destroy() self.text = None del self.siteData del self.identifierIcon del self.distanceTask del self.interactCollSphereNP del self.interactCollSphere del self.floorMarker del self.text DistributedNode.delete(self)
def __init__(self, cr): DistributedNode.__init__(self, cr) NodePath.__init__(self, 'DistributedTunnel') StagedObject.__init__(self, StagedObject.OFF) self.uniqueId = '' self.fakeZoneId = PiratesGlobals.FakeZoneId self.GridLOD = {} self.visNodes = {} self.geom = None self.envEffects = None self._links = {} self.areaWorldZone = [ None, None] self.areaNode = [None, None] self.__loadedArea = None self.areaIndexLoading = None self.pendingAreaUnload = False self.pendingArea = None self.minimapObj = None self.builder = GridAreaBuilder.GridAreaBuilder(self) self.connectorNodes = [ 'portal_connector_1', 'portal_connector_2'] self.connectorNodePosHpr = [] self.ambientNames = [None, None] self.avatarZoneContext = None self.floorIndex = -1 self._inTransition = False self.ownHandles = [] return
def announceGenerate(self): base.loadingScreen.tick() DistributedNode.announceGenerate(self) base.worldCreator.registerSpecialNodes(self, self.uniqueId) self.areaType = base.worldCreator.getFieldFromUid(self.uniqueId, 'Visibility') self.envSettings = base.worldCreator.getEnvSettingsByUid(self.uniqueId) self.builder = base.worldCreator.getBuilder(self, self.areaType)
def delete(self): self.ignoreAll() if self.collNP: self.collNP.removeNode() if self.capturePoint: self.capturePoint.removeNode() if self.captureCircle: self.captureCircle.removeNode() if self.aoogahSfx: self.aoogahSfx.stop() if self.circleTrack: self.circleTrack.pause() del self.collNP del self.pointCollNode del self.capturePoint del self.captureCircle del self.aoogahSfx del self.circleTrack del self.circleTrackPlayRate del self.circleTrackDirection del self.team del self.neutralCapTexture del self.redCapTexture del self.blueCapTexture del self.defCapTexture self.removeNode() DistributedNode.delete(self)
def disable(self): """ This method is called when the object is removed from the scene, for instance because it left the zone. It is balanced against generate(): for each generate(), there will be a corresponding disable(). Everything that was done in generate() or announceGenerate() should be undone in disable(). After a disable(), the object might be cached in memory in case it will eventually reappear. The DistributedObject should be prepared to receive another generate() for an object that has already received disable(). Note that the above is only strictly true for *cacheable* objects. Most objects are, by default, non-cacheable; you have to call obj.setCacheable(True) (usually in the constructor) to make it cacheable. Until you do this, your non-cacheable object will always receive a delete() whenever it receives a disable(), and it will never be stored in a cache. """ # Take it out of the scene graph. self.detachNode() DistributedNode.disable(self)
def __init__(self, cr): DistributedNode.__init__(self, cr) NodePath.__init__(self, 'dggflag') self.flagMdl = None self.team = None self.collNP = None self.flagCollNP = None self.pulseIval = None
def __init__(self, cr): DistributedNode.__init__(self, cr) NodePath.__init__(self, 'shop') self.cr = cr self.items = {} self.inShop = False self.clerk = None self.shopNP = None
def __init__(self, cr): DistributedNode.__init__(self, cr) self.barrel = loader.loadModel('phase_4/models/cogHQ/gagTank.bam') self.barrel.setScale(self.barrelscale) self.barrel.setH(180) self.barrel.reparentTo(self) self.truckId = 0 self.barrelPosIndex = 0
def announceGenerate(self): DistributedNode.announceGenerate(self) self.makeCannon() if not base.minigame: taskMgr.add(self.__pollMG, self.uniqueName("pollMG")) else: base.minigame.cannons.append(self) messenger.send('ToonCannon::ready')
def disable(self): if self.avatarInTurret: self.avatarInTurret.getPart('legs').show() self.avatarInTurret.getPart('torso').show() self.avatarInTurret.getPart('head').show() self.avatarInTurret = None self.removeCannon() DistributedNode.disable(self)
def handleChildArriveZone(self, child, zoneId): DistributedNode.handleChildArrive(self, child, zoneId) if (zoneId >= self.startingZone): if not child.gridParent: child.gridParent = GridParent(child) child.gridParent.setGridParent(self, zoneId) elif child.gridParent: child.gridParent.delete() child.gridParent = None
def __init__(self, cr): DistributedNode.__init__(self, cr) # Let the derived classes instantiate the NodePath self.visAvatar = None self.gridVisContext = None # Do we have grid lines visualized? self._onOffState = False if __debug__: self.haveGridLines = 0
def disable(self): if self.flagMdl: self.flagMdl.removeNode() self.flagMdl = None if self.collNP: self.collNP.removeNode() self.collNP = None self.team = None DistributedNode.disable(self)
def announceGenerate(self): DistributedNode.announceGenerate(self) self.reparentTo(render) self.loadBarrel() self.loadIcon() self.loadCollisions() self.accept(self.uniqueName('enterBarrelSphere'), self.__handleEnterSphere)
def __init__(self, cr): DistributedNode.__init__(self, cr) self.kart = None self.rope = None self.pod = None self.barrels = [] self.numBarrels = 0 self.triggerNP = None self.mg = None
def __init__(self, cr): DistributedNode.__init__(self, cr) InteractiveBase.__init__(self) DistributedLocatableObject.__init__(self, cr) GridChild.__init__(self) self.interactGUI = None self.hideHpMeterFlag = 0 self.userId = 0 self.uniqueId = None
def generate(self): """ This method is called when the object is generated: when it manifests for the first time on a particular client, or when it is pulled out of the cache after a previous manifestation. At the time of this call, the object has been created, but its required fields have not yet been filled in. """ # Always call up to parent class DistributedNode.generate(self)
def disable(self): if self.avatarInTurret: self.avatarInTurret.getPart('legs').show() self.avatarInTurret.getPart('torso').show() self.avatarInTurret.getPart('head').show() self.avatarInTurret = None self.removeCannon() DistributedNode.disable(self) return
def __init__(self, cr): DistributedNode.__init__(self, cr) NodePath.__init__(self, 'shop') self.cr = cr self.items = {} self.destroyEvent = 'destroyShop-' + str(random.randint(0, 1000)) self.inShop = False self.clerk = None self.shopNP = None return
def announceGenerate(self): """ This method is called after generate(), after all of the required fields have been filled in. At the time of this call, the distributed object is ready for use. """ DistributedNode.announceGenerate(self) # Now that the object has been fully manifested, we can parent # it into the scene. self.reparentTo(render)
def __init__(self, cr): DistributedNode.__init__(self, cr) self.kart = None self.rope = None self.pod = None self.barrels = [] self.numBarrels = 0 self.triggerNP = None self.mg = None return
def __init__(self, cr): ExperimentBarrelBase.__init__(self) DistributedNode.__init__(self, cr) self.barrel = None self.icon = None self.collSphere = None self.collNode = None self.collNodePath = None self.animTrack = None
def disable(self): self.ignore(self.collName) if self.ival: self.ival.finish() self.ival = None # Take it out of the scene graph. self.detachNode() DistributedNode.disable(self)
def disable(self): taskMgr.remove(self.uniqueName("pollMG")) if base.minigame: base.minigame.cannons.remove(self) if self.avatarInTurret: self.avatarInTurret.getPart('legs').show() self.avatarInTurret.getPart('torso').show() self.avatarInTurret.getPart('head').show() self.avatarInTurret = None self.removeCannon() DistributedNode.disable(self)
def __init__(self, cr): self.cr = cr DistributedNode.__init__(self, cr) NodePath.__init__(self, 'trolley') self.destination = '' self.filledSpots = 0 self.leaving = False self.gone = False self.destination_lbl = None self.movingSfx = loader.loadSfx('phase_4/audio/sfx/SZ_trolley_away.ogg') self.bellSfx = loader.loadSfx('phase_4/audio/sfx/SZ_trolley_bell.ogg') return
def generate(self): self.assign(render.attachNewNode('DistributedElectionCamera')) DistributedNode.generate(self) self.camera = loader.loadModel('phase_4/models/events/election_tvCamera') self.camera.reparentTo(render) self.camera.setScale(0.25) propJoint = self.camera.find('**/hat') self.camBody = self.camera.find('**/camera_body') prop = BattleProps.globalPropPool.getProp('propeller') prop.reparentTo(propJoint) prop.setZ(1) prop.loop('propeller', fromFrame=0, toFrame=8) self.idleInterval = None
def disable(self): taskMgr.remove('showEnterMessage') DistributedNode.disable(self) if self.geom: self.geom.removeNode() self.unloadConnectors() for request in self.pendingSetupConnector.itervalues(): self.cr.relatedObjectMgr.abortRequest(request) self.pendingSetupConnector = { } self.builder.delete() self.builder = None
def announceGenerate(self): DistributedNode.announceGenerate(self) self.build() self.collSphere = CollisionSphere(0, 0, 0, self.sphereRadius) self.collSphere.setTangible(0) self.collNode = CollisionNode(self.uniqueName('barrelSphere')) self.collNode.setIntoCollideMask(CIGlobals.WallBitmask) self.collNode.addSolid(self.collSphere) self.collNodePath = self.attachNewNode(self.collNode) self.collNodePath.hide() self.accept('enter' + self.collNodePath.getName(), self.__handleCollision) self.setParent(CIGlobals.SPRender)
def __init__(self, cr): try: self.DistributedShop_initialized return except: self.DistributedShop_initialized = 1 DistributedNode.__init__(self, cr) NodePath.__init__(self, "shop") self.inShop = False self.snp = None self.clerk = None return
def disable(self): taskMgr.remove('showEnterMessage') DistributedNode.disable(self) if self.geom: self.geom.removeNode() self.unloadConnectors() for request in self.pendingSetupConnector.itervalues(): self.cr.relatedObjectMgr.abortRequest(request) self.pendingSetupConnector = {} self.builder.delete() self.builder = None return
def __init__(self, cr): DistributedNode.__init__(self, cr) NodePath.__init__(self, 'ShipDeployer') self.minRadius = 0 self.spacing = 0 self.maxRadius = 0 self.heading = 0 self.minSphere = None self.maxSphereSoft = None self.maxSphereHard = None self.deploySpheres = [] self.lockedMessage = 0 self.outerBarrierState = True
def handleChildLeave(self, childObj, zoneId): if childObj.isLocal(): base.disableZoneLODs() localAvatar.guiMgr.clearMinimap(self.minimap) self.builder.localAvLeaving() self.builder.left() self.ignore('transferMinimapObjects') self.laMinimapObj = None if self.minimap and hasattr(childObj, 'getMinimapObject'): if childObj.getMinimapObject(): self.minimap.removeObject(childObj.getMinimapObject()) DistributedNode.handleChildLeave(self, childObj, zoneId) return
def delete(self): if self.barrel: self.barrel.removeNode() if self.icon: self.icon.removeNode() if self.animTrack: self.animTrack.finish() self.animTrack = None self.ignore(self.uniqueName('enterBarrelSphere')) DistributedNode.delete(self)
def announceGenerate(self): DistributedNode.announceGenerate(self) self.reparentTo(self.getParentObj()) self.createSpheres() self.enableDeploySpheres(False) self.accept(self.uniqueName('enterShipDeploySphere'), self.handleShipCollideEnter) self.accept(self.uniqueName('exitShipDeploySphere'), self.handleShipCollideExit) self.accept(self.uniqueName('enterShipDeploy-MaxSphereSoft'), self.handleShipEnterSoftBarrier) self.accept(self.uniqueName('exitShipDeploy-MaxSphereSoft'), self.handleShipExitSoftBarrier) self.accept(self.uniqueName('enterShipDeploy-MaxSphereHard'), self.handleShipEnterHardBarrier) self.accept(self.uniqueName('exitShipDeploy-MaxSphereHard'), self.handleShipExitHardBarrier) self.accept(self.uniqueName('enterShipDeploy-MinSphere'), self.handleShipEnterMinSphere) self.accept(self.uniqueName('exitShipDeploy-MinSphere'), self.handleShipExitMinSphere) self.accept('settingLocalShip', self.unlockMessages)
def delete(self): """ This method is called after disable() when the object is to be completely removed, for instance because the other user logged off. We will not expect to see this object again; it will not be cached. This is stronger than disable(), and the object may remove any structures it needs to in order to allow it to be completely deleted from memory. This balances against __init__(): every DistributedObject that is created will eventually get delete() called for it exactly once. """ # Clean out self.model, so we don't have a circular reference. #self.model = None DistributedNode.delete(self)
def handleChildLeave(self, childObj, zoneId): if childObj.isLocal(): base.disableZoneLODs() localAvatar.guiMgr.clearMinimap(self.minimap) self.builder.localAvLeaving() self.builder.left() self.ignore('transferMinimapObjects') self.laMinimapObj = None if self.minimap and hasattr(childObj, 'getMinimapObject'): if childObj.getMinimapObject(): self.minimap.removeObject(childObj.getMinimapObject()) DistributedNode.handleChildLeave(self, childObj, zoneId)
def disable(self): self.ignore('enter' + self.triggerNP.node().getName()) self.__removeAllBarrels() self.barrels = None self.numBarrels = None if self.rope: self.rope.removeNode() self.rope = None if self.pod: self.pod.removeNode() self.pod = None if self.kart: self.kart.removeNode() self.kart = None self.mg = None DistributedNode.disable(self) return
def disable(self): self.ignore(self.uniqueName('enterShipDeploySphere')) self.ignore(self.uniqueName('exitShipDeploySphere')) self.ignore(self.uniqueName('enterShipDeploy-MaxSphereSoft')) self.ignore(self.uniqueName('exitShipDeploy-MaxSphereSoft')) self.ignore(self.uniqueName('enterShipDeploy-MaxSphereHard')) self.ignore(self.uniqueName('exitShipDeploy-MaxSphereHard')) self.ignore(self.uniqueName('enterShipDeploy-MinSphere')) self.ignore(self.uniqueName('exitShipDeploy-MinSphere')) self.ignore('settingLocalShip') self.unlockMessages() self.removeChildren() self.minSphere = None self.maxSphereSoft = None self.maxSphereHard = None self.deploySpheres = [] DistributedNode.disable(self)
def disable(self): self.fsm.requestFinalState() if self.moPath: self.moPath.stop() self.moPath = None self.moPaths = None self.honkSfxPath = None self.cartModelPath = None self.soundEngineLoop = None self.soundDriveBy = None if self.suitInCar: self.suitInCar.disable() self.suitInCar.delete() self.suitInCar = None if self.cart: self.cart.removeNode() self.cart = None del self.fsm DistributedNode.disable(self) return
def delete(self): self.goOffStage() self.fadeoutAllAmbient() self.destroyMinimapObject() self.cr.relatedObjectMgr.abortRequest(self.pendingArea) self.pendingArea = None self.setLoadedArea(None) for node in self.visNodes.values(): node.detachNode() self.visNodes = { } if self.fakeZoneId != None: for node in self.GridLOD.values(): node.cleanup() del self.GridLOD del self.fakeZoneId self.removeNode() self.ignoreAll() self.builder.delete() DistributedNode.delete(self)