feat: complete playtest parity improvements
This commit is contained in:
@@ -20,12 +20,16 @@ var _last_ambience_path := ""
|
||||
var _last_sfx_path := ""
|
||||
|
||||
func _init(manifest_or_legacy_root: Variant = null) -> void:
|
||||
# The former API accepted an external directory override. Intentionally ignore
|
||||
# it for compatibility: external paths are not a safe playback source.
|
||||
if manifest_or_legacy_root is AudioImportManifest:
|
||||
_manifest = manifest_or_legacy_root as AudioImportManifest
|
||||
else:
|
||||
elif manifest_or_legacy_root == null:
|
||||
# Production instances load bundled music and optionally overlay the safe
|
||||
# Godot-native user manifest.
|
||||
_manifest = AudioImportManifestType.load_user_manifest()
|
||||
else:
|
||||
# The former API accepted an external directory override. Keep explicit
|
||||
# legacy instances isolated and silent: arbitrary files are never decoded.
|
||||
_manifest = AudioImportManifestType.new()
|
||||
|
||||
func _ready() -> void:
|
||||
_ensure_players()
|
||||
@@ -40,9 +44,12 @@ func set_manifest(manifest: AudioImportManifest) -> void:
|
||||
func set_ambience_context(context: String) -> void:
|
||||
if not context in AMBIENCE_CONTEXTS:
|
||||
return
|
||||
var stream := _manifest.ambience_for(StringName(context))
|
||||
if current_ambience_context == context and _ambience_player != null and _ambience_player.stream == stream and _ambience_player.playing:
|
||||
return
|
||||
current_ambience_context = context
|
||||
_last_ambience_path = ""
|
||||
_set_ambience_stream(_manifest.ambience_for(StringName(context)))
|
||||
_last_ambience_path = stream.resource_path if stream != null else ""
|
||||
_set_ambience_stream(stream)
|
||||
|
||||
func play_sfx(event: String) -> void:
|
||||
_last_sfx_path = ""
|
||||
|
||||
Reference in New Issue
Block a user