From 64a87dff1bcb0ce0db9e43d09e769eeda9c5a4e7 Mon Sep 17 00:00:00 2001 From: Loudrob Date: Sat, 22 Aug 2015 18:33:08 -0400 Subject: [PATCH] A few fixes. --- otp/ai/AIBase.py | 7 ++++ toontown/ai/ServiceStart.py | 3 +- toontown/battle/RewardPanel.py | 38 +++++++++---------- .../building/DistributedKnockKnockDoorAI.py | 3 ++ toontown/toontowngui/ToontownLoadingScreen.py | 2 +- 5 files changed, 32 insertions(+), 21 deletions(-) diff --git a/otp/ai/AIBase.py b/otp/ai/AIBase.py index 1f8b82b8..009ea062 100755 --- a/otp/ai/AIBase.py +++ b/otp/ai/AIBase.py @@ -115,9 +115,16 @@ class AIBase: self.taskMgr.add(self.__resetPrevTransform, 'resetPrevTransform', priority=-51) self.taskMgr.add(self.__ivalLoop, 'ivalLoop', priority=20) self.taskMgr.add(self.__igLoop, 'igLoop', priority=50) + if self.config.GetBool('garbage-collect-states', 1): + self.taskMgr.add(self.__garbageCollectStates, 'garbageCollectStates', priority=46) if self.AISleep >= 0 and (not self.AIRunningNetYield or self.AIForceSleep): self.taskMgr.add(self.__sleepCycleTask, 'aiSleep', priority=55) self.eventMgr.restart() + + def __garbageCollectStates(self, state): + TransformState.garbageCollect() + RenderState.garbageCollect() + return Task.cont def getRepository(self): return self.air diff --git a/toontown/ai/ServiceStart.py b/toontown/ai/ServiceStart.py index 9c68431a..4899cc4c 100755 --- a/toontown/ai/ServiceStart.py +++ b/toontown/ai/ServiceStart.py @@ -62,9 +62,10 @@ if ':' in host: port = int(port) simbase.air.connect(host, port) +gc.enable() + try: run() - gc.enable() except SystemExit: raise except Exception: diff --git a/toontown/battle/RewardPanel.py b/toontown/battle/RewardPanel.py index 625cd61e..3acc9dd7 100755 --- a/toontown/battle/RewardPanel.py +++ b/toontown/battle/RewardPanel.py @@ -434,10 +434,10 @@ class RewardPanel(DirectFrame): def getTrackIntervalList(self, toon, track, origSkill, earnedSkill, hasUber): if hasUber < 0: print (toon.doId, 'Reward Panel received an invalid hasUber from an uberList') - tickDelay = 1.0 / 60 + tickDelay = 0.1 intervalList = [] intervalList.append(Func(self.showTrackIncLabel, track, earnedSkill)) - barTime = 0.5 + barTime = math.log(earnedSkill + 0.5) numTicks = int(math.ceil(barTime / tickDelay)) for i in xrange(numTicks): t = (i + 1) / float(numTicks) @@ -463,9 +463,9 @@ class RewardPanel(DirectFrame): uberSkill = ToontownBattleGlobals.UberSkill + ToontownBattleGlobals.Levels[track][ToontownBattleGlobals.LAST_REGULAR_GAG_LEVEL + 1] if currentSkill >= uberSkill and not hasUber > 0: intervalList += self.getUberGagIntervalList(toon, track, ToontownBattleGlobals.LAST_REGULAR_GAG_LEVEL + 1) - intervalList.append(Wait(0.1)) + intervalList.append(Wait(0.3)) skillDiff = currentSkill - ToontownBattleGlobals.Levels[track][ToontownBattleGlobals.LAST_REGULAR_GAG_LEVEL + 1] - barTime = math.log(skillDiff + 1) + barTime = math.log(skillDiff + 0.5) numTicks = int(math.ceil(barTime / tickDelay)) displayedSkillDiff = skillDiff if displayedSkillDiff > ToontownBattleGlobals.UberSkill: @@ -477,18 +477,18 @@ class RewardPanel(DirectFrame): intervalList.append(Func(self.incrementExp, track, newValue, toon)) intervalList.append(Wait(tickDelay * 0.5)) - intervalList.append(Wait(0.1)) + intervalList.append(Wait(0.3)) return intervalList def getMeritIntervalList(self, toon, dept, origMerits, earnedMerits): - tickDelay = 1.0 / 60 + tickDelay = 0.08 intervalList = [] totalMerits = CogDisguiseGlobals.getTotalMerits(toon, dept) neededMerits = 0 if totalMerits and origMerits != totalMerits: neededMerits = totalMerits - origMerits intervalList.append(Func(self.showMeritIncLabel, dept, min(neededMerits, earnedMerits))) - barTime = 0.5 + barTime = math.log(earnedMerits + 1) numTicks = int(math.ceil(barTime / tickDelay)) for i in xrange(numTicks): t = (i + 1) / float(numTicks) @@ -497,10 +497,10 @@ class RewardPanel(DirectFrame): intervalList.append(Wait(tickDelay)) intervalList.append(Func(self.resetMeritBarColor, dept)) - intervalList.append(Wait(0.1)) + intervalList.append(Wait(0.3)) if toon.cogLevels[dept] < ToontownGlobals.MaxCogSuitLevel: if neededMerits and toon.readyForPromotion(dept): - intervalList.append(Wait(0.4)) + intervalList.append(Wait(0.3)) intervalList += self.getPromotionIntervalList(toon, dept) return intervalList @@ -621,7 +621,7 @@ class RewardPanel(DirectFrame): if earned > 0: earned = min(earned, quest.getNumQuestItems() - questDesc[4]) if earned > 0 or base.localAvatar.tutorialAck == 0 and num == 1: - barTime = 0.5 + barTime = math.log(earned + 1) numTicks = int(math.ceil(barTime / tickDelay)) for i in xrange(numTicks): t = (i + 1) / float(numTicks) @@ -683,19 +683,19 @@ class RewardPanel(DirectFrame): if meritList[dept]: track += self.getMeritIntervalList(toon, dept, origMeritList[dept], meritList[dept]) - track.append(Wait(0.75)) + track.append(Wait(1.0)) itemInterval = self.getItemIntervalList(toon, itemList) if itemInterval: track.append(Func(self.initItemFrame, toon)) - track.append(Wait(0.25)) + track.append(Wait(1.0)) track += itemInterval - track.append(Wait(0.5)) + track.append(Wait(1.0)) missedItemInterval = self.getMissedItemIntervalList(toon, missedItemList) if missedItemInterval: track.append(Func(self.initMissedItemFrame, toon)) - track.append(Wait(0.25)) + track.append(Wait(1.0)) track += missedItemInterval - track.append(Wait(0.5)) + track.append(Wait(1.0)) self.notify.debug('partList = %s' % partList) newPart = 0 for part in partList: @@ -707,9 +707,9 @@ class RewardPanel(DirectFrame): partList = self.getCogPartIntervalList(toon, partList) if partList: track.append(Func(self.initCogPartFrame, toon)) - track.append(Wait(0.25)) + track.append(Wait(1.0)) track += partList - track.append(Wait(0.5)) + track.append(Wait(1.0)) questList = self.getQuestIntervalList(toon, deathList, toonList, origQuestsList, itemList, helpfulToonsList) if questList: avQuests = [] @@ -717,9 +717,9 @@ class RewardPanel(DirectFrame): avQuests.append(origQuestsList[i:i + 5]) track.append(Func(self.initQuestFrame, toon, copy.deepcopy(avQuests))) - track.append(Wait(0.25)) + track.append(Wait(1.0)) track += questList - track.append(Wait(0.5)) + track.append(Wait(2.0)) track.append(Wait(0.25)) if trackEnded: track.append(Func(self.vanishFrames)) diff --git a/toontown/building/DistributedKnockKnockDoorAI.py b/toontown/building/DistributedKnockKnockDoorAI.py index cc4ee465..67c6983e 100755 --- a/toontown/building/DistributedKnockKnockDoorAI.py +++ b/toontown/building/DistributedKnockKnockDoorAI.py @@ -10,6 +10,9 @@ class DistributedKnockKnockDoorAI(DistributedAnimatedPropAI.DistributedAnimatedP self.fsm.setName('DistributedKnockKnockDoor') self.propId = propId self.doLaterTask = None + + def delete(self): + DistributedAnimatedPropAI.DistributedAnimatedPropAI.delete(self) def enterOff(self): DistributedAnimatedPropAI.DistributedAnimatedPropAI.enterOff(self) diff --git a/toontown/toontowngui/ToontownLoadingScreen.py b/toontown/toontowngui/ToontownLoadingScreen.py index 8b8cfea3..00671845 100755 --- a/toontown/toontowngui/ToontownLoadingScreen.py +++ b/toontown/toontowngui/ToontownLoadingScreen.py @@ -11,7 +11,7 @@ class ToontownLoadingScreen: def __init__(self): self.__expectedCount = 0 self.__count = 0 - self.textures = [(loader.loadTexture('phase_3.5/maps/loading/toon.jpg'), ToontownGlobals.getInterfaceFont(), (0.2, 0.6, 0.9, 1)), + self.textures = [(loader.loadTexture('phase_3.5/maps/loading/toon.jpg'), ToontownGlobals.getInterfaceFont(), (0, 0, 0.5, 1)), (loader.loadTexture('phase_3.5/maps/loading/cog.jpg'), ToontownGlobals.getSuitFont(), (1.0, 1.0, 1.0, 1)), (loader.loadTexture('phase_3.5/maps/loading/default.jpg'), ToontownGlobals.getInterfaceFont(), (0, 0, 0.5, 1)) ]