Skip to content

Commit

Permalink
fix: Ensure escoria#apply_settings only called in game not editor (#543)
Browse files Browse the repository at this point in the history
Co-authored-by: balloonpopper <[email protected]>
Co-authored-by: Julian Murgia <[email protected]>
  • Loading branch information
3 people authored Mar 15, 2022
1 parent 2ab6756 commit 26e4e4c
Showing 1 changed file with 25 additions and 24 deletions.
49 changes: 25 additions & 24 deletions addons/escoria-core/game/escoria.gd
Original file line number Diff line number Diff line change
Expand Up @@ -179,31 +179,32 @@ func new_game():
#
# * p_settings: Loaded settings
func apply_settings(p_settings: ESCSaveSettings) -> void:
logger.info("******* settings loaded")
if p_settings != null:
settings = p_settings
else:
settings = ESCSaveSettings.new()

AudioServer.set_bus_volume_db(
AudioServer.get_bus_index(BUS_MASTER),
linear2db(settings.master_volume)
)
AudioServer.set_bus_volume_db(
AudioServer.get_bus_index(BUS_SFX),
linear2db(settings.sfx_volume)
)
AudioServer.set_bus_volume_db(
AudioServer.get_bus_index(BUS_MUSIC),
linear2db(settings.music_volume)
)
AudioServer.set_bus_volume_db(
AudioServer.get_bus_index(BUS_SPEECH),
linear2db(settings.speech_volume)
)
TranslationServer.set_locale(settings.text_lang)
if not Engine.is_editor_hint():
logger.info("******* settings loaded")
if p_settings != null:
settings = p_settings
else:
settings = ESCSaveSettings.new()

AudioServer.set_bus_volume_db(
AudioServer.get_bus_index(BUS_MASTER),
linear2db(settings.master_volume)
)
AudioServer.set_bus_volume_db(
AudioServer.get_bus_index(BUS_SFX),
linear2db(settings.sfx_volume)
)
AudioServer.set_bus_volume_db(
AudioServer.get_bus_index(BUS_MUSIC),
linear2db(settings.music_volume)
)
AudioServer.set_bus_volume_db(
AudioServer.get_bus_index(BUS_SPEECH),
linear2db(settings.speech_volume)
)
TranslationServer.set_locale(settings.text_lang)

game_scene.apply_custom_settings(settings.custom_settings)
game_scene.apply_custom_settings(settings.custom_settings)


# Input function to manage specific input keys
Expand Down

0 comments on commit 26e4e4c

Please sign in to comment.