def loadDecorations(self): self.decorationsList = [] for decorBase in self.partyInfo.decors: self.decorationsList.append( Decoration( PartyGlobals.DecorationIds.getString(decorBase.decorId), PartyUtils.convertDistanceFromPartyGrid(decorBase.x, 0), PartyUtils.convertDistanceFromPartyGrid(decorBase.y, 1), PartyUtils.convertDegreesFromPartyGrid(decorBase.h)))
def generate(self): DistributedPartyAI.notify.debug("DistParty generate: %s" % self.doId) DistributedObjectAI.generate(self) self.air.writeServerEvent("party_generate", self.partyInfo.partyId, "%d|%d" % (self.doId, self.partyInfo.hostId)) # Log that a GM party has been generated. try: host = simbase.air.doId2do.get(self.partyInfo.hostId) if host.hasGMName(): self.air.writeServerEvent("party_generate_gm", self.partyInfo.partyId, "%s" % self.partyInfo.hostId) assert self.notify.debug("GM-%s's party has started." % self.partyInfo.hostId) except: pass # We want to initialize all the activities that are at this party. # We'll loop through the activityList and see if we can import, create, # and generate the relevant AI class. This code assumes that the # activity classes are named according to the enum # PartyGlobals.ActivityIds # for example: # PartyGlobals.ActivityIds.PartyCatch would load # DistributedPartyCatchActivityAI for activity in self.partyInfo.activityList: # Location and heading in the activityList is in party space, so # we convert them to Panda space before passing them into the # activities #activityName = PartyGlobals.ActivityIds.getString(activity.activityId) x = PartyUtils.convertDistanceFromPartyGrid(activity.x, 0) y = PartyUtils.convertDistanceFromPartyGrid(activity.y, 1) h = PartyUtils.convertDegreesFromPartyGrid(activity.h) # Skip the party clock... if activity.activityId == PartyGlobals.ActivityIds.PartyClock: continue # Special case for cannon, add another cannon instead of creating # a new instance of the cannon activity if activity.activityId == PartyGlobals.ActivityIds.PartyCannon and \ self.getCannonActivity(): self.getCannonActivity().spawnCannonAt(x, y, h) continue actClass = ActivityIdsToClasses[activity.activityId] newAct = actClass(self.air, self.doId, x, y, h) newAct.generateWithRequired(self.zoneId) self.activityObjects.append(newAct)
def setPartyClockInfo(self, x, y, h): x = PartyUtils.convertDistanceFromPartyGrid(x, 0) y = PartyUtils.convertDistanceFromPartyGrid(y, 1) h = PartyUtils.convertDegreesFromPartyGrid(h) self.partyClockInfo = (x, y, h) self.loadPartyCountdownTimer()