From 1f63c40772485270054952815732bcda81bc39c9 Mon Sep 17 00:00:00 2001 From: Open Toontown <57279094+opentoontown@users.noreply.github.com> Date: Mon, 17 Jan 2022 17:11:45 -0500 Subject: [PATCH] more estate crash fixes --- otp/avatar/LocalAvatar.py | 12 +++++++++--- toontown/estate/DistributedCloset.py | 18 ++++++++++++++---- toontown/estate/FlowerPhoto.py | 4 ++-- toontown/estate/GardenGlobals.py | 2 +- 4 files changed, 26 insertions(+), 10 deletions(-) diff --git a/otp/avatar/LocalAvatar.py b/otp/avatar/LocalAvatar.py index 4f89053..31cfd45 100644 --- a/otp/avatar/LocalAvatar.py +++ b/otp/avatar/LocalAvatar.py @@ -85,6 +85,7 @@ class LocalAvatar(DistributedAvatar.DistributedAvatar, DistributedSmoothNode.Dis self.nametag2dNormalContents = Nametag.CSpeech self.showNametag2d() self.setPickable(0) + self.posCameraSeq = None return def useSwimControls(self): @@ -137,7 +138,9 @@ class LocalAvatar(DistributedAvatar.DistributedAvatar, DistributedSmoothNode.Dis self.stopJumpLandTask() taskMgr.remove('shadowReach') base.popCTrav() - taskMgr.remove('posCamera') + if self.posCameraSeq: + self.posCameraSeq.finish() + self.posCameraSeq = None self.disableAvatarControls() self.stopTrackAnimToSpeed() self.stopUpdateSmartCamera() @@ -605,8 +608,11 @@ class LocalAvatar(DistributedAvatar.DistributedAvatar, DistributedSmoothNode.Dis r = destHpr[2] camera.setPos(savePos) camera.setHpr(saveHpr) - taskMgr.remove('posCamera') - camera.lerpPosHpr(x, y, z, h, p, r, time, task='posCamera') + if self.posCameraSeq: + self.posCameraSeq.finish() + self.posCameraSeq = None + self.posCameraSeq = camera.posHprInterval(time, Point3(x, y, z), Point3(h, p, r), name='posCamera') + self.posCameraSeq.start() def getClampedAvatarHeight(self): return max(self.getHeight(), 3.0) diff --git a/toontown/estate/DistributedCloset.py b/toontown/estate/DistributedCloset.py index 167139b..21ed2a6 100644 --- a/toontown/estate/DistributedCloset.py +++ b/toontown/estate/DistributedCloset.py @@ -50,6 +50,7 @@ class DistributedCloset(DistributedFurnitureItem.DistributedFurnitureItem): self.topDeleted = 0 self.bottomDeleted = 0 self.closetTrack = None + self.lerpCameraSeq = None self.avMoveTrack = None self.scale = 1.0 self.fsm = ClassicFSM.ClassicFSM('Closet', [State.State('off', self.enterOff, self.exitOff, ['ready', 'open', 'closed']), @@ -105,7 +106,9 @@ class DistributedCloset(DistributedFurnitureItem.DistributedFurnitureItem): self.ignore(self.closetSphereEnterEvent) self.ignoreAll() taskMgr.remove(self.uniqueName('popupChangeClothesGUI')) - taskMgr.remove(self.uniqueName('lerpCamera')) + if self.lerpCameraSeq: + self.lerpCameraSeq.finish() + self.lerpCameraSeq = None taskMgr.remove(self.uniqueName('lerpToon')) if self.closetTrack: self.closetTrack.finish() @@ -154,7 +157,10 @@ class DistributedCloset(DistributedFurnitureItem.DistributedFurnitureItem): self._openDoors() if self.customerId == base.localAvatar.doId: camera.wrtReparentTo(self) - camera.lerpPosHpr(-7.58, -6.02, 6.9, 286.3, 336.8, 0, 1, other=self, blendType='easeOut', task=self.uniqueName('lerpCamera')) + quat = Quat() + quat.setHpr((286.3, 336.8, 0)) + self.lerpCameraSeq = camera.posQuatInterval(1, Point3(-7.58, -6.02, 6.9), quat, other=self, blendType='easeOut', name=self.uniqueName('lerpCamera')) + self.lerpCameraSeq.start() camera.setPosHpr(self, -7.58, -6.02, 6.9, 286.3, 336.8, 0) if self.av: if self.avMoveTrack: @@ -252,7 +258,9 @@ class DistributedCloset(DistributedFurnitureItem.DistributedFurnitureItem): def resetCloset(self): self.ignoreAll() taskMgr.remove(self.uniqueName('popupChangeClothesGUI')) - taskMgr.remove(self.uniqueName('lerpCamera')) + if self.lerpCameraSeq: + self.lerpCameraSeq.finish() + self.lerpCameraSeq = None taskMgr.remove(self.uniqueName('lerpToon')) if self.closetGUI: self.closetGUI.hideButtons() @@ -393,7 +401,9 @@ class DistributedCloset(DistributedFurnitureItem.DistributedFurnitureItem): self.freeAvatar() return elif mode == ClosetGlobals.CLOSET_MOVIE_TIMEOUT: - taskMgr.remove(self.uniqueName('lerpCamera')) + if self.lerpCameraSeq: + self.lerpCameraSeq.finish() + self.lerpCameraSeq = None taskMgr.remove(self.uniqueName('lerpToon')) if self.isLocalToon: self.ignore(self.purchaseDoneEvent) diff --git a/toontown/estate/FlowerPhoto.py b/toontown/estate/FlowerPhoto.py index b8cabae..8ed6803 100644 --- a/toontown/estate/FlowerPhoto.py +++ b/toontown/estate/FlowerPhoto.py @@ -14,7 +14,7 @@ class DirectRegion(NodePath): def destroy(self): self.unload() - self.parent = None + self._parent = None return def setBounds(self, *bounds): @@ -94,7 +94,7 @@ class FlowerPhoto(NodePath): self.fish = None del self.soundTrack del self.track - self.parent = None + self._parent = None return def update(self, species, variety): diff --git a/toontown/estate/GardenGlobals.py b/toontown/estate/GardenGlobals.py index 0fd640f..f813259 100644 --- a/toontown/estate/GardenGlobals.py +++ b/toontown/estate/GardenGlobals.py @@ -503,7 +503,7 @@ def getShovelPower(shovel, shovelSkill): gardenNotify.warning("this shouldn't happen shovelSkill %d >= skill %d" % (shovelSkill, skill)) shovelSkill = skill - 1 skillPtPerBox = skill / curBoxes - numBoxes += 1 + int(shovelSkill) / int(skillPtPerBox) + numBoxes += 1 + int(shovelSkill) // int(skillPtPerBox) else: numBoxes += curBoxes