diff --git a/otp/avatar/LocalAvatar.py b/otp/avatar/LocalAvatar.py index 28781bfe..457f5592 100755 --- a/otp/avatar/LocalAvatar.py +++ b/otp/avatar/LocalAvatar.py @@ -28,7 +28,6 @@ class LocalAvatar(DistributedAvatar.DistributedAvatar, DistributedSmoothNode.Dis wantDevCameraPositions = base.config.GetBool('want-dev-camera-positions', 0) wantMouse = base.config.GetBool('want-mouse', 0) sleepTimeout = base.config.GetInt('sleep-timeout', 120) - swimTimeout = base.config.GetInt('afk-timeout', 600) __enableMarkerPlacement = base.config.GetBool('place-markers', 0) def __init__(self, cr, chatMgr, talkAssistant = None, passMessagesThrough = False): @@ -63,7 +62,6 @@ class LocalAvatar(DistributedAvatar.DistributedAvatar, DistributedSmoothNode.Dis self.sleepFlag = 0 self.isDisguised = 0 self.movingFlag = 0 - self.swimmingFlag = 0 self.lastNeedH = None self.accept('friendOnline', self.__friendOnline) self.accept('friendOffline', self.__friendOffline) @@ -977,42 +975,6 @@ class LocalAvatar(DistributedAvatar.DistributedAvatar, DistributedSmoothNode.Dis self.sleepCallback = None return - def startSleepSwimTest(self): - taskName = self.taskName('sleepSwimTest') - taskMgr.remove(taskName) - task = Task.Task(self.sleepSwimTest) - self.lastMoved = globalClock.getFrameTime() - self.lastState = None - self.lastAction = None - self.sleepSwimTest(task) - taskMgr.add(self.sleepSwimTest, taskName, 35) - return - - def stopSleepSwimTest(self): - taskName = self.taskName('sleepSwimTest') - taskMgr.remove(taskName) - self.stopSound() - - def sleepSwimTest(self, task): - now = globalClock.getFrameTime() - speed, rotSpeed, slideSpeed = self.controlManager.getSpeeds() - if speed != 0.0 or rotSpeed != 0.0 or inputState.isSet('jump'): - if not self.swimmingFlag: - self.swimmingFlag = 1 - elif self.swimmingFlag: - self.swimmingFlag = 0 - if self.swimmingFlag or self.hp <= 0: - self.wakeUp() - elif not self.sleepFlag: - now = globalClock.getFrameTime() - if now - self.lastMoved > self.swimTimeout: - self.swimTimeoutAction() - return Task.done - return Task.cont - - def swimTimeoutAction(self): - pass - def trackAnimToSpeed(self, task): speed, rotSpeed, slideSpeed = self.controlManager.getSpeeds() if speed != 0.0 or rotSpeed != 0.0 or inputState.isSet('jump'): diff --git a/toontown/estate/Estate.py b/toontown/estate/Estate.py index b0de096d..df1cfab4 100755 --- a/toontown/estate/Estate.py +++ b/toontown/estate/Estate.py @@ -316,7 +316,6 @@ class Estate(Place.Place): self.__setUnderwaterFog() base.playSfx(self.loader.underwaterSound, looping=1, volume=0.8) self.cameraSubmerged = 1 - self.walkStateData.setSwimSoundAudible(1) def __emergeCamera(self): if self.cameraSubmerged == 0: @@ -325,7 +324,6 @@ class Estate(Place.Place): self.loader.hood.sky.setFogOff() self.__setFaintFog() self.cameraSubmerged = 0 - self.walkStateData.setSwimSoundAudible(0) def forceUnderWater(self): self.toonSubmerged = 0 diff --git a/toontown/safezone/DDPlayground.py b/toontown/safezone/DDPlayground.py index dbba7711..e271193a 100755 --- a/toontown/safezone/DDPlayground.py +++ b/toontown/safezone/DDPlayground.py @@ -76,7 +76,6 @@ class DDPlayground(Playground.Playground): self.loader.seagullSound.stop() taskMgr.remove('dd-seagulls') self.cameraSubmerged = 1 - self.walkStateData.setSwimSoundAudible(1) def __emergeCamera(self): if self.cameraSubmerged == 0: @@ -86,7 +85,6 @@ class DDPlayground(Playground.Playground): self.nextSeagullTime = random.random() * 8.0 taskMgr.add(self.__seagulls, 'dd-seagulls') self.cameraSubmerged = 0 - self.walkStateData.setSwimSoundAudible(0) def __submergeToon(self): if self.toonSubmerged == 1: diff --git a/toontown/safezone/OZPlayground.py b/toontown/safezone/OZPlayground.py index d9fdf135..2684b2c4 100755 --- a/toontown/safezone/OZPlayground.py +++ b/toontown/safezone/OZPlayground.py @@ -65,7 +65,6 @@ class OZPlayground(Playground.Playground): self.loader.hood.setUnderwaterFog() base.playSfx(self.loader.underwaterSound, looping=1, volume=0.8) self.cameraSubmerged = 1 - self.walkStateData.setSwimSoundAudible(1) def __emergeCamera(self): if self.cameraSubmerged == 0: @@ -73,7 +72,6 @@ class OZPlayground(Playground.Playground): self.loader.hood.setNoFog() self.loader.underwaterSound.stop() self.cameraSubmerged = 0 - self.walkStateData.setSwimSoundAudible(0) def __submergeToon(self): if self.toonSubmerged == 1: diff --git a/toontown/safezone/OZSafeZoneLoader.py b/toontown/safezone/OZSafeZoneLoader.py index a0b3b5ac..e5fc5650 100755 --- a/toontown/safezone/OZSafeZoneLoader.py +++ b/toontown/safezone/OZSafeZoneLoader.py @@ -47,7 +47,6 @@ class OZSafeZoneLoader(SafeZoneLoader): waterfallPlacer = self.geom.find('**/waterfall*') binMgr = CullBinManager.getGlobalPtr() binMgr.addBin('water', CullBinManager.BTFixed, 29) - binMgr = CullBinManager.getGlobalPtr() pool = self.geom.find('**/pPlane5*') pool.setTransparency(1) pool.setColorScale(1.0, 1.0, 1.0, 1.0) diff --git a/toontown/safezone/Walk.py b/toontown/safezone/Walk.py index ca63a2b4..89f4fae1 100755 --- a/toontown/safezone/Walk.py +++ b/toontown/safezone/Walk.py @@ -15,7 +15,6 @@ class Walk(StateData.StateData): State.State('swimming', self.enterSwimming, self.exitSwimming, ['walking', 'slowWalking']), State.State('slowWalking', self.enterSlowWalking, self.exitSlowWalking, ['walking', 'swimming'])], 'off', 'off') self.fsm.enterInitialState() - self.IsSwimSoundAudible = 0 self.swimSoundPlaying = 0 def load(self): @@ -66,36 +65,31 @@ class Walk(StateData.StateData): def exitWalking(self): base.localAvatar.stopTrackAnimToSpeed() - def setSwimSoundAudible(self, IsSwimSoundAudible): - self.IsSwimSoundAudible = IsSwimSoundAudible - if IsSwimSoundAudible == 0 and self.swimSoundPlaying: - self.swimSound.stop() - self.swimSoundPlaying = 0 - def enterSwimming(self, swimSound): base.localAvatar.setWalkSpeedNormal() base.localAvatar.applyBuffs() self.swimSound = swimSound self.swimSoundPlaying = 0 base.localAvatar.b_setAnimState('swim', base.localAvatar.animMultiplier) - base.localAvatar.startSleepSwimTest() - taskMgr.add(self.__swim, 'localToonSwimming') + taskMgr.add(self.__swimSoundTest, 'localToonSwimming') def exitSwimming(self): taskMgr.remove('localToonSwimming') self.swimSound.stop() del self.swimSound self.swimSoundPlaying = 0 - base.localAvatar.stopSleepSwimTest() + + def __swimSoundTest(self, task): + speed, rotSpeed, slideSpeed = base.localAvatar.controlManager.getSpeeds() - def __swim(self, task): - speed = base.mouseInterfaceNode.getSpeed() - if speed == 0 and self.swimSoundPlaying: + if (speed or rotSpeed): + if not self.swimSoundPlaying: + self.swimSoundPlaying = 1 + base.playSfx(self.swimSound, looping=1) + elif self.swimSoundPlaying: self.swimSoundPlaying = 0 self.swimSound.stop() - elif speed > 0 and self.swimSoundPlaying == 0 and self.IsSwimSoundAudible: - self.swimSoundPlaying = 1 - base.playSfx(self.swimSound, looping=1) + return Task.cont def enterSlowWalking(self): diff --git a/toontown/toon/LocalToon.py b/toontown/toon/LocalToon.py index 39e89189..ca003afa 100755 --- a/toontown/toon/LocalToon.py +++ b/toontown/toon/LocalToon.py @@ -1628,13 +1628,6 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar): print 'Local Toon Anim State %s' % animName DistributedToon.DistributedToon.b_setAnimState(self, animName, animMultiplier, callback, extraArgs) - def swimTimeoutAction(self): - self.ignore('wakeup') - self.takeOffSuit() - base.cr.playGame.getPlace().fsm.request('final') - self.b_setAnimState('TeleportOut', 1, self.__handleSwimExitTeleport, [0]) - return Task.done - def __handleSwimExitTeleport(self, requestStatus): self.notify.info('closing shard...') base.cr.gameFSM.request('closeShard', ['afkTimeout'])