mirror of
https://github.com/Sneed-Group/Poodletooth-iLand
synced 2024-12-25 04:32:33 -06:00
Swim Sound implemented
This commit is contained in:
parent
812164a696
commit
ab10d5f05f
7 changed files with 10 additions and 68 deletions
|
@ -28,7 +28,6 @@ class LocalAvatar(DistributedAvatar.DistributedAvatar, DistributedSmoothNode.Dis
|
||||||
wantDevCameraPositions = base.config.GetBool('want-dev-camera-positions', 0)
|
wantDevCameraPositions = base.config.GetBool('want-dev-camera-positions', 0)
|
||||||
wantMouse = base.config.GetBool('want-mouse', 0)
|
wantMouse = base.config.GetBool('want-mouse', 0)
|
||||||
sleepTimeout = base.config.GetInt('sleep-timeout', 120)
|
sleepTimeout = base.config.GetInt('sleep-timeout', 120)
|
||||||
swimTimeout = base.config.GetInt('afk-timeout', 600)
|
|
||||||
__enableMarkerPlacement = base.config.GetBool('place-markers', 0)
|
__enableMarkerPlacement = base.config.GetBool('place-markers', 0)
|
||||||
|
|
||||||
def __init__(self, cr, chatMgr, talkAssistant = None, passMessagesThrough = False):
|
def __init__(self, cr, chatMgr, talkAssistant = None, passMessagesThrough = False):
|
||||||
|
@ -63,7 +62,6 @@ class LocalAvatar(DistributedAvatar.DistributedAvatar, DistributedSmoothNode.Dis
|
||||||
self.sleepFlag = 0
|
self.sleepFlag = 0
|
||||||
self.isDisguised = 0
|
self.isDisguised = 0
|
||||||
self.movingFlag = 0
|
self.movingFlag = 0
|
||||||
self.swimmingFlag = 0
|
|
||||||
self.lastNeedH = None
|
self.lastNeedH = None
|
||||||
self.accept('friendOnline', self.__friendOnline)
|
self.accept('friendOnline', self.__friendOnline)
|
||||||
self.accept('friendOffline', self.__friendOffline)
|
self.accept('friendOffline', self.__friendOffline)
|
||||||
|
@ -977,42 +975,6 @@ class LocalAvatar(DistributedAvatar.DistributedAvatar, DistributedSmoothNode.Dis
|
||||||
self.sleepCallback = None
|
self.sleepCallback = None
|
||||||
return
|
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):
|
def trackAnimToSpeed(self, task):
|
||||||
speed, rotSpeed, slideSpeed = self.controlManager.getSpeeds()
|
speed, rotSpeed, slideSpeed = self.controlManager.getSpeeds()
|
||||||
if speed != 0.0 or rotSpeed != 0.0 or inputState.isSet('jump'):
|
if speed != 0.0 or rotSpeed != 0.0 or inputState.isSet('jump'):
|
||||||
|
|
|
@ -316,7 +316,6 @@ class Estate(Place.Place):
|
||||||
self.__setUnderwaterFog()
|
self.__setUnderwaterFog()
|
||||||
base.playSfx(self.loader.underwaterSound, looping=1, volume=0.8)
|
base.playSfx(self.loader.underwaterSound, looping=1, volume=0.8)
|
||||||
self.cameraSubmerged = 1
|
self.cameraSubmerged = 1
|
||||||
self.walkStateData.setSwimSoundAudible(1)
|
|
||||||
|
|
||||||
def __emergeCamera(self):
|
def __emergeCamera(self):
|
||||||
if self.cameraSubmerged == 0:
|
if self.cameraSubmerged == 0:
|
||||||
|
@ -325,7 +324,6 @@ class Estate(Place.Place):
|
||||||
self.loader.hood.sky.setFogOff()
|
self.loader.hood.sky.setFogOff()
|
||||||
self.__setFaintFog()
|
self.__setFaintFog()
|
||||||
self.cameraSubmerged = 0
|
self.cameraSubmerged = 0
|
||||||
self.walkStateData.setSwimSoundAudible(0)
|
|
||||||
|
|
||||||
def forceUnderWater(self):
|
def forceUnderWater(self):
|
||||||
self.toonSubmerged = 0
|
self.toonSubmerged = 0
|
||||||
|
|
|
@ -76,7 +76,6 @@ class DDPlayground(Playground.Playground):
|
||||||
self.loader.seagullSound.stop()
|
self.loader.seagullSound.stop()
|
||||||
taskMgr.remove('dd-seagulls')
|
taskMgr.remove('dd-seagulls')
|
||||||
self.cameraSubmerged = 1
|
self.cameraSubmerged = 1
|
||||||
self.walkStateData.setSwimSoundAudible(1)
|
|
||||||
|
|
||||||
def __emergeCamera(self):
|
def __emergeCamera(self):
|
||||||
if self.cameraSubmerged == 0:
|
if self.cameraSubmerged == 0:
|
||||||
|
@ -86,7 +85,6 @@ class DDPlayground(Playground.Playground):
|
||||||
self.nextSeagullTime = random.random() * 8.0
|
self.nextSeagullTime = random.random() * 8.0
|
||||||
taskMgr.add(self.__seagulls, 'dd-seagulls')
|
taskMgr.add(self.__seagulls, 'dd-seagulls')
|
||||||
self.cameraSubmerged = 0
|
self.cameraSubmerged = 0
|
||||||
self.walkStateData.setSwimSoundAudible(0)
|
|
||||||
|
|
||||||
def __submergeToon(self):
|
def __submergeToon(self):
|
||||||
if self.toonSubmerged == 1:
|
if self.toonSubmerged == 1:
|
||||||
|
|
|
@ -65,7 +65,6 @@ class OZPlayground(Playground.Playground):
|
||||||
self.loader.hood.setUnderwaterFog()
|
self.loader.hood.setUnderwaterFog()
|
||||||
base.playSfx(self.loader.underwaterSound, looping=1, volume=0.8)
|
base.playSfx(self.loader.underwaterSound, looping=1, volume=0.8)
|
||||||
self.cameraSubmerged = 1
|
self.cameraSubmerged = 1
|
||||||
self.walkStateData.setSwimSoundAudible(1)
|
|
||||||
|
|
||||||
def __emergeCamera(self):
|
def __emergeCamera(self):
|
||||||
if self.cameraSubmerged == 0:
|
if self.cameraSubmerged == 0:
|
||||||
|
@ -73,7 +72,6 @@ class OZPlayground(Playground.Playground):
|
||||||
self.loader.hood.setNoFog()
|
self.loader.hood.setNoFog()
|
||||||
self.loader.underwaterSound.stop()
|
self.loader.underwaterSound.stop()
|
||||||
self.cameraSubmerged = 0
|
self.cameraSubmerged = 0
|
||||||
self.walkStateData.setSwimSoundAudible(0)
|
|
||||||
|
|
||||||
def __submergeToon(self):
|
def __submergeToon(self):
|
||||||
if self.toonSubmerged == 1:
|
if self.toonSubmerged == 1:
|
||||||
|
|
|
@ -47,7 +47,6 @@ class OZSafeZoneLoader(SafeZoneLoader):
|
||||||
waterfallPlacer = self.geom.find('**/waterfall*')
|
waterfallPlacer = self.geom.find('**/waterfall*')
|
||||||
binMgr = CullBinManager.getGlobalPtr()
|
binMgr = CullBinManager.getGlobalPtr()
|
||||||
binMgr.addBin('water', CullBinManager.BTFixed, 29)
|
binMgr.addBin('water', CullBinManager.BTFixed, 29)
|
||||||
binMgr = CullBinManager.getGlobalPtr()
|
|
||||||
pool = self.geom.find('**/pPlane5*')
|
pool = self.geom.find('**/pPlane5*')
|
||||||
pool.setTransparency(1)
|
pool.setTransparency(1)
|
||||||
pool.setColorScale(1.0, 1.0, 1.0, 1.0)
|
pool.setColorScale(1.0, 1.0, 1.0, 1.0)
|
||||||
|
|
|
@ -15,7 +15,6 @@ class Walk(StateData.StateData):
|
||||||
State.State('swimming', self.enterSwimming, self.exitSwimming, ['walking', 'slowWalking']),
|
State.State('swimming', self.enterSwimming, self.exitSwimming, ['walking', 'slowWalking']),
|
||||||
State.State('slowWalking', self.enterSlowWalking, self.exitSlowWalking, ['walking', 'swimming'])], 'off', 'off')
|
State.State('slowWalking', self.enterSlowWalking, self.exitSlowWalking, ['walking', 'swimming'])], 'off', 'off')
|
||||||
self.fsm.enterInitialState()
|
self.fsm.enterInitialState()
|
||||||
self.IsSwimSoundAudible = 0
|
|
||||||
self.swimSoundPlaying = 0
|
self.swimSoundPlaying = 0
|
||||||
|
|
||||||
def load(self):
|
def load(self):
|
||||||
|
@ -66,36 +65,31 @@ class Walk(StateData.StateData):
|
||||||
def exitWalking(self):
|
def exitWalking(self):
|
||||||
base.localAvatar.stopTrackAnimToSpeed()
|
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):
|
def enterSwimming(self, swimSound):
|
||||||
base.localAvatar.setWalkSpeedNormal()
|
base.localAvatar.setWalkSpeedNormal()
|
||||||
base.localAvatar.applyBuffs()
|
base.localAvatar.applyBuffs()
|
||||||
self.swimSound = swimSound
|
self.swimSound = swimSound
|
||||||
self.swimSoundPlaying = 0
|
self.swimSoundPlaying = 0
|
||||||
base.localAvatar.b_setAnimState('swim', base.localAvatar.animMultiplier)
|
base.localAvatar.b_setAnimState('swim', base.localAvatar.animMultiplier)
|
||||||
base.localAvatar.startSleepSwimTest()
|
taskMgr.add(self.__swimSoundTest, 'localToonSwimming')
|
||||||
taskMgr.add(self.__swim, 'localToonSwimming')
|
|
||||||
|
|
||||||
def exitSwimming(self):
|
def exitSwimming(self):
|
||||||
taskMgr.remove('localToonSwimming')
|
taskMgr.remove('localToonSwimming')
|
||||||
self.swimSound.stop()
|
self.swimSound.stop()
|
||||||
del self.swimSound
|
del self.swimSound
|
||||||
self.swimSoundPlaying = 0
|
self.swimSoundPlaying = 0
|
||||||
base.localAvatar.stopSleepSwimTest()
|
|
||||||
|
|
||||||
def __swim(self, task):
|
def __swimSoundTest(self, task):
|
||||||
speed = base.mouseInterfaceNode.getSpeed()
|
speed, rotSpeed, slideSpeed = base.localAvatar.controlManager.getSpeeds()
|
||||||
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.swimSoundPlaying = 0
|
||||||
self.swimSound.stop()
|
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
|
return Task.cont
|
||||||
|
|
||||||
def enterSlowWalking(self):
|
def enterSlowWalking(self):
|
||||||
|
|
|
@ -1628,13 +1628,6 @@ class LocalToon(DistributedToon.DistributedToon, LocalAvatar.LocalAvatar):
|
||||||
print 'Local Toon Anim State %s' % animName
|
print 'Local Toon Anim State %s' % animName
|
||||||
DistributedToon.DistributedToon.b_setAnimState(self, animName, animMultiplier, callback, extraArgs)
|
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):
|
def __handleSwimExitTeleport(self, requestStatus):
|
||||||
self.notify.info('closing shard...')
|
self.notify.info('closing shard...')
|
||||||
base.cr.gameFSM.request('closeShard', ['afkTimeout'])
|
base.cr.gameFSM.request('closeShard', ['afkTimeout'])
|
||||||
|
|
Loading…
Reference in a new issue