From 9e7b69d6b0d49235aa50ead64d403cd8be2d474c Mon Sep 17 00:00:00 2001 From: Metroid_Skittles Date: Fri, 13 Feb 2026 16:29:03 +0100 Subject: [PATCH] Update torchlight_changes_unloze/torchlight3/Torchlight/AudioManager.py --- .../torchlight3/Torchlight/AudioManager.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/torchlight_changes_unloze/torchlight3/Torchlight/AudioManager.py b/torchlight_changes_unloze/torchlight3/Torchlight/AudioManager.py index 5db4016..1323637 100755 --- a/torchlight_changes_unloze/torchlight3/Torchlight/AudioManager.py +++ b/torchlight_changes_unloze/torchlight3/Torchlight/AudioManager.py @@ -272,15 +272,29 @@ class AudioManager(): return True def Stop(self, player, extra): - Result = {"matched": 0, "stopped": 0, "pending": 0} + Result = {"active": 0, "matched": 0, "stopped": 0, "pending": 0} + stopper_level = player.Access["level"] if player.Access else 0 for AudioClip in self.AudioClips[:]: + Result["active"] += 1 + target_level = AudioClip.Player.Access["level"] if AudioClip.Player.Access else 0 + same_player = False + if getattr(player, "UniqueID", None) is not None and getattr(AudioClip.Player, "UniqueID", None) is not None: + same_player = player.UniqueID == AudioClip.Player.UniqueID + elif getattr(player, "UserID", None) is not None and getattr(AudioClip.Player, "UserID", None) is not None: + same_player = player.UserID == AudioClip.Player.UserID + else: + same_player = player == AudioClip.Player + + if not same_player and target_level > stopper_level: + Result["pending"] += 1 + continue Result["matched"] += 1 AudioClip.Stop() Result["stopped"] += 1 self.Torchlight().SayPrivate(AudioClip.Player, "Your audio clip was stopped.") - if player != AudioClip.Player: + if not same_player: self.Torchlight().SayPrivate(player, "Stopped \"{0}\"({1}) audio clip.".format(AudioClip.Player.Name, AudioClip.Player.UserID)) return Result