Update torchlight_changes_unloze/torchlight3/Torchlight/AudioManager.py
This commit is contained in:
parent
6f7da0efd3
commit
9e7b69d6b0
@ -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
|
||||
|
||||
Loading…
Reference in New Issue
Block a user