Beispiel #1
0
 def play_sound(self, name, pos=None, pitch=1.0, volume=1.0):
     extra_server_update.reset()
     sound = packets.SoundAction()
     sound.set_name(name)
     if pos is None:
         pos = self.entity.pos
     sound.pos = pos
     sound.pitch = pitch
     sound.volume = volume
     extra_server_update.sound_actions.append(sound)
     self.send_packet(extra_server_update)
Beispiel #2
0
    def play_sound(self, name, pos=None, pitch=1.0, volume=1.0):
        sound = packets.SoundAction()
        sound.set_name(name)
        sound.pitch = pitch
        sound.volume = volume

        if pos is not None:
            sound.pos = pos
            self.update_packet.sound_action.append(sound)
            return

        extra_server_update.reset()

        for player in self.players.values():
            sound.pos = player.entity.pos
            extra_server_update.sound_actions = [sound]
            player.send_packet(extra_server_update)