def generate(self): if base.cr.catalogManager != None: base.cr.catalogManager.delete() base.cr.catalogManager = self DistributedObject.generate(self) if hasattr(base.localAvatar, 'catalogScheduleNextTime') and base.localAvatar.catalogScheduleNextTime == 0: self.d_startCatalog()
def __init__(self, cr): DistributedObject.__init__(self, cr) self.shardId = 0 self.population = 0 self.popLimits = [ 0, 0]
def disable(self): if self.pendingWorld: self.cr.relatedObjectMgr.abortRequest(self.pendingWorld) self.pendingWorld = None self.ignoreAll() DistributedObject.disable(self)
def announceGenerate(self): DistributedObject.announceGenerate(self) base.transitions.fadeScreen(0.0) self.guide = Toon(base.cr) self.guide.autoClearChat = False self.guide.parseDNAStrand(NPCGlobals.NPC_DNA[self.GUIDE_NAME]) self.guide.setName(self.GUIDE_NAME) self.guide.generateToon() self.guide.startBlink() self.guide.reparentTo(render) base.localAvatar.reparentTo(render) loader.loadDNAFile(self.dnaStore, 'phase_3.5/dna/storage_tutorial.dna') node = loader.loadDNAFile(self.dnaStore, 'phase_3.5/dna/tutorial_street.dna') if node.getNumParents() == 1: self.streetGeom = NodePath(node.getParent(0)) self.streetGeom.reparentTo(hidden) else: self.streetGeom = hidden.attachNewNode(node) self.streetGeom.flattenMedium() gsg = base.win.getGsg() if gsg: self.streetGeom.prepareScene(gsg) self.streetGeom.reparentTo(render) self.streetGeom.setPos(20.5, -20, 0) self.streetGeom.setH(90) self.sky = loader.loadModel('phase_3.5/models/props/TT_sky.bam') self.skyUtil.startSky(self.sky) self.sky.reparentTo(camera) ce = CompassEffect.make(NodePath(), CompassEffect.PRot | CompassEffect.PZ) self.sky.node().setEffect(ce) self.music = base.loadMusic('phase_3.5/audio/bgm/TC_SZ.mid') base.playMusic(self.music, volume=0.8, looping=1) self.battleMusic = base.loadMusic('phase_3.5/audio/bgm/encntr_general_bg.mid') self.fsm.request('newPlayerEmerge') base.localAvatar.inTutorial = True
def delete(self): # When the bank collectable is deleted, and has not been grabbed, do a # poof effect: if not self.grabbed: dustCloud = DustCloud.DustCloud(fBillboard=0) dustCloud.setBillboardAxis(2.0) dustCloud.setZ(4) dustCloud.setScale(0.4) dustCloud.createTrack() dustCloud.reparentTo(render) dustCloud.setPos(self.nodePath.getPos()) Sequence(dustCloud.track, Func(dustCloud.destroy)).start() if self.flyTrack is not None: self.flyTrack.finish() self.flyTrack = None if self.floatTrack is not None: self.floatTrack.finish() self.floatTrack = None if self.rotateTrack is not None: self.rotateTrack.finish() self.rotateTrack = None if self.nodePath is not None: self.nodePath.removeNode() self.nodePath = None DistributedObject.delete(self)
def delete(self): if base.cr.distributedDistrict is self: base.cr.distributedDistrict = None if self.doId in self.cr.activeDistrictMap: del self.cr.activeDistrictMap[self.doId] DistributedObject.delete(self) messenger.send('shardInfoUpdated')
def disable(self): base.taskMgr.remove(self.uniqueName('__pollBoat')) base.cr.parentMgr.unregisterParent(CIGlobals.SPDonaldsBoat) self.ignore('enterdonalds_boat_floor') self.ignore('exitdonalds_boat_floor') self.fsm.requestFinalState() del self.fsm del self.soundFogHorn del self.soundShipBell del self.soundWaterLap del self.soundDockCreak self.fogHorn = None self.shipBell = None self.waterLap = None self.dockCreak = None self.boat = None self.track = None self.pierDownP = None self.pierUpP = None self.eastPier = None self.eastPierPath = None self.westPier = None self.westPierPath = None self.boatPath = None self.westEast = None self.eastWest = None DistributedObject.disable(self) return
def __init__(self, cr): DistributedObject.__init__(self, cr) self.cr.cameraManager = self self.mainCam = 0 self.cameraIds = [] self.cameraViewEnabled = False self.tvOn = True
def __init__(self, cr): DistributedObject.__init__(self, cr) self.parent = None self.fixtures = {} self.cameraId = base.config.GetInt('camera-id',0) pass
def handleChildArrive(self, child, zoneId): DistributedObject.handleChildArrive(self, child, zoneId) if isinstance(child, DistributedOceanGrid): child.setWorld(self) self.setWorldGrid(child) for key in self.islands: self.islands[key].addToOceanSeapatch()
def delete(self): if hasattr(base, 'codeRedemptionMgr'): if base.codeRedemptionMgr is self: del base.codeRedemptionMgr self._context2callback = None self._contextGen = None DistributedObject.delete(self)
def handleChildLeave(self, child, zoneId): if isinstance(child, DistributedOceanGrid): if child == self.worldGrid: self.setWorldGrid(None) DistributedObject.handleChildLeave(self, child, zoneId)
def generate(self): DistributedObject.generate(self) self.loader = self.cr.playGame.hood.loader self.np = NodePath('Pillow') self.np.reparentTo(render) for point in DistributedPillow.polygons: orderedPoints = [] for index in point: orderedPoints.append(DistributedPillow.points[index]) self.floorpolys.append(CollisionPolygon(*orderedPoints)) for n, p in enumerate(self.floorpolys): polyNode = CollisionNode("FloorPoly-%d" % n) polyNode.addSolid(p) polyNode.setFromCollideMask(OTPGlobals.FloorBitmask) polyNodePath = self.np.attachNewNode(polyNode) self.npaths.append(polyNodePath) self.accept("enterFloorPoly-%d" % n, self.gravityHigh) self.accept("enterdonalds_dreamland", self.gravityLow) for wall in DistributedPillow.walls: ab = DistributedPillow.points[wall[0]] bb = DistributedPillow.points[wall[1]] cb = Point3(bb.getX(), bb.getY(), bb.getZ() + 20) db = Point3(ab.getX(), ab.getY(), ab.getZ() + 20) self.wallpolys.append(CollisionPolygon(ab, bb, cb, db)) for n, p in enumerate(self.wallpolys): polyNode = CollisionNode("WallPoly-%d" % n) polyNode.addSolid(p) polyNode.setFromCollideMask(OTPGlobals.FloorBitmask) polyNodePath = self.np.attachNewNode(polyNode) self.npaths.append(polyNodePath)
def __init__(self, cr): DistributedObject.__init__(self, cr) FSM.__init__(self, 'FlippyStandFSM') self.flippyStand = Actor.Actor('phase_4/models/events/election_flippyStand-mod', {'idle': 'phase_4/models/events/election_flippyStand-idle'}) self.flippyStand.reparentTo(render) self.flippyStand.setScale(0.55) self.flippyStand.setHpr(315, 0, 349.7) self.flippyStand.setPos(180, -250, 9.58) self.flippyStand.exposeJoint(None, 'modelRoot', 'LInnerShoulder') flippyTable = self.flippyStand.find('**/LInnerShoulder') self.flippyStand.exposeJoint(None, 'modelRoot', 'Box_Joint') wheelbarrowJoint = self.flippyStand.find('**/Box_Joint').attachNewNode('Pie_Joint') wheelbarrow = self.flippyStand.find('**/Box') wheelbarrow.setPosHprScale(-2.39, 0.0, 1.77, 0.0, 0.0, 6.0, 1.14, 1.54, 0.93) pie = loader.loadModel('phase_3.5/models/props/tart') pieS = pie.copyTo(flippyTable) pieS.setPosHprScale(-2.61, -0.37, -1.99, 355.6, 90.0, 4.09, 1.6, 1.6, 1.6) for pieSettings in ElectionGlobals.FlippyWheelbarrowPies: pieModel = pie.copyTo(wheelbarrowJoint) pieModel.setPosHprScale(*pieSettings) wheelbarrowJoint.setPosHprScale(3.94, 0.0, 1.06, 270.0, 344.74, 0.0, 1.43, 1.12, 1.0) self.restockSfx = loader.loadSfx('phase_9/audio/sfx/CHQ_SOS_pies_restock.ogg') cs = CollisionBox(Point3(7, 0, 0), 12, 5, 18) self.pieCollision = self.flippyStand.attachNewNode(CollisionNode('wheelbarrow_collision')) self.pieCollision.node().addSolid(cs) self.accept('enter' + self.pieCollision.node().getName(), self.handleWheelbarrowCollisionSphereEnter) self.flippyStand.loop('idle')
def announceGenerate(self): DistributedObject.announceGenerate(self) self.interior = loader.loadModel('phase_4/models/modules/ttc_library_interior.bam') self.interior.reparentTo(render) generator = random.Random() generator.seed(self.zoneId) self.replaceRandom(self.interior, generator=generator) doorOrigin = self.interior.find('**/door_origin;+s') doorOrigin.setScale(0.8) doorOrigin.setY(doorOrigin, -0.025) door = self.cr.playGame.dnaStore.findNode('door_double_round_ur') doorNodePath = door.copyTo(doorOrigin) hoodId = ZoneUtil.getCanonicalHoodId(self.zoneId) doorColor = ToonInteriorColors.colors[hoodId]['TI_door'][0] DNADoor.setupDoor( doorNodePath, self.interior, doorOrigin, self.cr.playGame.dnaStore, str(self.block), doorColor) doorFrame = doorNodePath.find('door_double_round_ur_flat') doorFrame.wrtReparentTo(self.interior) doorFrame.setColor(doorColor) for npcToon in self.cr.doFindAllInstances(DistributedNPCToonBase): npcToon.initToonState()
def __init__(self, cr): DistributedObject.__init__(self, cr) #self.model = loader.loadModel('environment') #self.model.setZ(0) #self.builder = Builder(self, "map.txt", "development") plane = CollisionPlane(Plane(Vec3(0, 0, 1), Point3(0, 0, 0))) cnode = CollisionNode('cnode') cnode.setIntoCollideMask(BitMask32.bit(1)) cnode.setFromCollideMask(BitMask32.bit(1)) cnode.addSolid(plane) self.planeNP = self.model.attachNewNode(cnode) self.planeNP.show() # Setup a traverser for the picking collisions self.picker = CollisionTraverser() # Setup mouse ray self.pq = CollisionHandlerQueue() # Create a collision Node pickerNode = CollisionNode('MouseRay') # set the nodes collision bitmask pickerNode.setFromCollideMask(BitMask32.bit(1)) # create a collision ray self.pickerRay = CollisionRay() # add the ray as a solid to the picker node pickerNode.addSolid(self.pickerRay) # create a nodepath with the camera to the picker node self.pickerNP = base.camera.attachNewNode(pickerNode) # add the nodepath to the base traverser self.picker.addCollider(self.pickerNP, self.pq) print "model loaded" #TODO: check how to load multiple levels and set players in specific levels! self.accept("mouse1", self.mouseClick)
def announceGenerate(self): DistributedObject.announceGenerate(self) if self.ship is None and self.pirateTarget is None and self.ship.isEmpty() or self.pirateTarget.isEmpty(): self.sendUpdate('shotDown') return None self.barrelModel = loader.loadModel('models/ammunition/pir_m_gam_can_powderKeg') self.barrelModel.setScale(2.0) base.playSfx(self.launchSound, node = self.barrelModel, cutoff = 2000) self.barrelModel.reparentTo(self.ship) self.barrelModel.setPos(0, 0, 10) self.barrelModel.wrtReparentTo(self.pirateTarget) self.makeCollNode() self.barrelModel.setTag('objType', str(PiratesGlobals.COLL_FLAMING_BARREL)) self.collNode.setPythonTag('barrel', self) self.projectileInterval = Parallel(ProjectileInterval(self.barrelModel, endPos = Point3(0.0, 0.0, 4.5), duration = self.flightDuration, gravityMult = CannonDefenseGlobals.BARREL_GRAVITY), self.barrelModel.hprInterval(self.flightDuration, Vec3(720, 640, 440)), Sequence(Wait(self.flightDuration - 1.2), Func(base.playSfx, self.closeSound, node = self.barrelModel, cutoff = 2000), Wait(1.2), Func(self.hitTarget)), name = self.uniqueName('FlamingBarrelFlying')) self.collNode.reparentTo(self.barrelModel) self.projectileInterval.start() base.cTrav.addCollider(self.collNode, self.collHandler) base.cr.activeWorld.flamingBarrels.append(self) self.trailEffect = FireTrail.getEffect() if self.trailEffect: self.trailEffect.reparentTo(self.barrelModel) self.trailEffect.wantGlow = base.options.getSpecialEffectsSetting() >= base.options.SpecialEffectsMedium self.trailEffect.wantBlur = base.options.getSpecialEffectsSetting() >= base.options.SpecialEffectsHigh self.trailEffect.startLoop()
def __init__(self, cr, name = None, color = None, gameId = None): DistributedObject.__init__(self, cr) # This is true if this avatar represents the "local avatar", # i.e. the player at the keyboard, as opposed to a remote # player. self.localPlayer = False # The doId of the game we've joined. self.gameId = gameId # The doId of the associated avatar. self.avId = 0 # The list of avatars onto which this player has painted. self.paintedAvatars = [] self.name = name self.brushRadius = 1 self.brushes = {} self.setColor(color) self.posterData = ('', 0) self.score = 0 self.wallCount = 0 self.floorCount = 0 self.pixelCount = 0 self.avPixelCount = 0 self.onMePixelCount = 0 self.bonus = 1
def __init__(self, cr): DistributedObject.__init__(self, cr) FSM.__init__(self, 'ToonfestBalloonFSM') self.avId = 0 self.flightPathIndex = 0 self.balloon = loader.loadModel('phase_6/models/events/tf_balloon') self.balloon.reparentTo(base.render) self.balloon.setPos(*ToonfestBalloonGlobals.BalloonBasePosition) self.balloon.setH(250) self.balloon.setScale(ToonfestBalloonGlobals.BalloonScale) self.cr.parentMgr.registerParent(ToontownGlobals.SPToonfestBalloon, self.balloon) cs = CollisionSphere(0, 0, 0, 9) cs.setTangible(False) self.collisionNP = self.balloon.find('**/basket_wall_collision') self.collisionNP.node().addSolid(cs) self.alec = NPCToons.createLocalNPC(91915) self.alec.setPos(0.7, 0.7, 0.4) self.alec.setH(150) self.alec.setScale(1 / ToonfestBalloonGlobals.BalloonScale) self.alec.initializeBodyCollisions('toon') self.alec.setPickable(0) self.alec.addActive() self.alec.startBlink() self.alec.loop('neutral') self.flightPaths = ToonfestBalloonGlobals.generateFlightPaths(self) self.toonFlightPaths = ToonfestBalloonGlobals.generateToonFlightPaths(self) self.speechSequence = ToonfestBalloonGlobals.generateSpeechSequence(self)
def delete(self): self._siegeTeamUpdater.destroy() del self._siegeTeamUpdater self._removeAnnouncerInterest() del self._pvpTeamJoinable del base.cr.distributedDistrict.siegeManager DistributedObject.delete(self)
def __init__(self, cr): DistributedObject.__init__(self, cr) self._scores = {} self._names = {} self._teams = {} self._types = {} self._stats = {}
def __init__(self, cr): DistributedObject.__init__(self, cr) base.cr.partyManager = self self.allowUnreleased = False self.partyPlannerStyle = None self.partyPlannerName = None self.showDoid = False return
def generate(self): DistributedObject.generate(self) self.soundFogHorn = base.loadSfx(self.fogHorn) self.soundShipBell = base.loadSfx(self.shipBell) self.soundWaterLap = base.loadSfx(self.waterLap) self.soundDockCreak = base.loadSfx(self.dockCreak) self.boat = self.cr.playGame.hood.loader.geom.find('**/' + self.boatPath) self.generated()
def delete(self): self.demand('Off') self.ignore('enter' + self.collisionNP.node().getName()) self.cr.parentMgr.unregisterParent(ToontownGlobals.SPToonfestBalloon) self.balloon.removeNode() if self.alec: self.alec.delete() DistributedObject.delete(self)
def delete(self): self._stashElevatorFC.destroy() self._wantStashElevator.destroy() self._toonsInEntranceElev.destroy() self._gotInterior.destroy() self._waitingStartLabel.destroy() self._waitingStartLabel = None DistributedObject.delete(self)
def __init__(self, cr): DistributedObject.__init__(self, cr) self.firstAvatarId = None self.firstAvatarStatus = 0 self.firstAvatarGiving = [] self.secondAvatarId = None self.secondAvatarStatus = 0 self.secondAvatarGiving = []
def __init__(self, cr): DistributedObject.__init__(self, cr) self.collNode = None self.destroyed = False self.smokeVfx = None self.barrelModel = None self.trailEffect = None self._initAudio()
def generate(self): self._announcerInterest = None self._siegeTeam = 0 self._siegeTeamUpdater = FunctionCall(self._setSiegeTeam, localAvatar._siegeTeamSV) self._siegeTeamUpdater.pushCurrentState() DistributedObject.generate(self) self._pvpTeamJoinable = { } base.cr.distributedDistrict.siegeManager = self
def disable(self): base.cogdoGame = None self.cr.cogdoGame = None self.fsm.requestFinalState() self.loadFSM.requestFinalState() self.fsm = None self.loadFSM = None DistributedObject.disable(self)
def disable(self): DistributedObject.disable(self) self.available = 0 if self.cr.myDistrict is self: self.cr.myDistrict = None else: del self.cr.activeDistricts[self.doId] return
def disable(self): self.notify.debug("i'm disabling SecurityMgr right now.") DistributedObject.disable(self)
def delete(self): DistributedObject.delete(self) del self.available
def generate(self): # Called when the client loads self.notify.debug("BASE: generate") DistributedObject.generate(self)
def delete(self): """Delete ourself.""" DistributedObject.delete(self) self.cr.inGameNewsMgr = None
def generate(self): self.notify.debug('BASE: generate') DistributedObject.generate(self) self.accept('deallocateZoneIdFromPlannedParty', self.deallocateZoneIdFromPlannedParty) self.announceGenerateName = self.uniqueName('generate')
def delete(self): DistributedObject.delete(self) self.cr.partyManager = None return
def announceGenerate(self): self.reparentTo(render) DistributedObject.announceGenerate(self) base.worldCreator.loadFileDataRecursive(self.fileName + '.py') base.worldCreator.registerFileObject(self.fileName + '.py') self.stash()
def disable(self): DistributedObject.disable(self) self.detachNode() self.ignoreAll()
def announceGenerate(self): DistributedObject.announceGenerate(self) self._requestInterior() self.loadFSM.request('Loaded') self.notify.info('difficulty: %s, safezoneId: %s' % (self.getDifficulty(), self.getSafezoneId()))
def announceGenerate(self): DistributedObject.announceGenerate(self) self.eventRng = random.Random(self.doId) self.request('WaitForServerStart')
def announceGenerate(self): DistributedObject.announceGenerate(self) messenger.send(PiratesGlobals.TradeIncomingEvent, [self])
def __init__(self, cr): DistributedObject.__init__(self, cr) self.startingBlocks = []
def announceGenerate(self): DistributedObject.announceGenerate(self) self.d_requestEventsList()
def disable(self): self.notify.debug("i'm disabling DistributedPartyManager rightnow.") self.ignore('deallocateZoneIdFromPlannedParty') self.ignoreAll() DistributedObject.disable(self)
def __init__(self, cr): DistributedObject.__init__(self, cr) cr.aprilToonsMgr = self self.events = []
def __init__(self, cr): """Construct ourselves, set up web dispatcher.""" assert self.notify.debugCall() DistributedObject.__init__(self, cr) base.cr.inGameNewsMgr = self
def delete(self): DistributedObject.delete(self) self.cr.whitelistMgr = None
def disable(self): self.notify.debug( "i'm disabling InGameNewsMgr rightnow.") DistributedObject.disable(self)
def disable(self): self.notify.debug("i'm disabling WhitelistMgr right now.") DistributedObject.disable(self)
def announceGenerate(self): DistributedObject.announceGenerate(self) self.cr.activeDistricts[self.doId] = self
def generate(self): self.notify.debug('BASE: generate') DistributedObject.generate(self)
def __init__(self, cr): DistributedObject.__init__(self, cr) base.cr.whitelistMgr = self
def delete(self): self.ignoreAll() base.cr.gameRules = None DistributedObject.delete(self) return
def __init__(self, cr): DistributedObject.__init__(self, cr) self.parent = None self.fixtures = {} self.cameraId = base.config.GetInt('camera-id', 0) return
def __init__(self, cr): DistributedObject.__init__(self, cr)
def announceGenerate(self): DistributedObject.announceGenerate(self)
def announceGenerate(self): DistributedObject.announceGenerate(self) base.codeRedemptionMgr = self self._contextGen = SerialMaskedGen(0xFFFFFFFFL) self._context2callback = {}
def disable(self): DistributedObject.disable(self) messenger.send(PiratesGlobals.TradeFinishedEvent, [self])
def delete(self): del self.startingBlocks DistributedObject.delete(self)