print "Loading mod: quiet_hangar v2016-05-25"

import SoundGroups

volume = 0.0

def __onGUISpaceChanged(spaceID):
    from gui.app_loader.settings import GUI_GLOBAL_SPACE_ID
    global volume
    if spaceID == GUI_GLOBAL_SPACE_ID.LOBBY:
        volume = SoundGroups.g_instance.getVolume('ambient')
        if volume:
            print "muting ambient sounds"
            SoundGroups.g_instance.setVolume('ambient', 0.0)
    else:
        if volume:
            print "unmuting ambient sounds"
            SoundGroups.g_instance.setVolume('ambient', volume)
            volume = 0.0

from gui.app_loader import g_appLoader
g_appLoader.onGUISpaceEntered += __onGUISpaceChanged
