added AmbientSound

This commit is contained in:
Darren Ranalli 2003-12-11 04:24:42 +00:00
parent 335370b515
commit 84e1b2ee2e
4 changed files with 39 additions and 0 deletions

View File

@ -0,0 +1,30 @@
from IntervalGlobal import *
import BasicEntities
class AmbientSound(BasicEntities.NodePathEntity):
def __init__(self, level, entId):
BasicEntities.NodePathEntity.__init__(self, level, entId)
def destroy(self):
BasicEntities.NodePathEntity.destroy(self)
def initSound(self):
if self.soundPath == '':
return
self.sound = base.loadSfx(self.soundPath)
if self.sound is None:
return
self.soundIval = SoundInterval(self.sound, node=self)
self.soundIval.loop()
def destroySound(self):
if hasattr(self, 'soundIval'):
self.soundIval.pause()
del self.soundIval
if hasattr(self, 'sound'):
del self.sound
if __dev__:
def attribChanged(self, *args):
self.destroySound()
self.initSound()

View File

@ -13,6 +13,7 @@ import ModelEntity
import PathEntity
import VisibilityExtender
import PropSpinner
import AmbientSound
# some useful constructor functions
# ctor functions must take (level, entId)
@ -32,6 +33,7 @@ class EntityCreator(EntityCreatorBase.EntityCreatorBase):
EntityCreatorBase.EntityCreatorBase.__init__(self, level)
self.level = level
self.privRegisterTypes({
'ambientSound': AmbientSound.AmbientSound,
'cutScene': CutScene.CutScene,
'editMgr': EditMgr.EditMgr,
'entityGroup': nothing,

View File

@ -44,6 +44,7 @@ class EntityCreatorAI(EntityCreatorBase.EntityCreatorBase):
cLE = createLocalEntity
self.privRegisterTypes({
'ambientSound': nothing,
'cutScene': nothing,
'editMgr': Functor(cLE, EditMgrAI.EditMgrAI),
'entityGroup': nothing,

View File

@ -119,6 +119,12 @@ class VisibilityExtender(Entity):
('newZones', [], 'visZoneList'),
)
class AmbientSound(Entity):
type = 'ambientSound'
attribs = (
('soundPath', '', 'bamfilename'),
)
class PropSpinner(Entity):
type = 'propSpinner'