diff --git a/game_server.py b/game_server.py index ff81f3d..296057d 100644 --- a/game_server.py +++ b/game_server.py @@ -180,8 +180,8 @@ class SynthCoin: self.x = x self.y = y self.radius = 5 - self.follow_radius = 100 - self.follow_speed = 2 + self.follow_radius = 200 + self.follow_speed = 5 self.created_at = time.time() def update(self, players): @@ -1482,6 +1482,7 @@ def game_loop(): 'action': 'change', 'song': f"/{music_player.get_current_song()}", 'startTime': music_player.start_time, + 'serverTime': time.time(), 'songDuration': music_player.get_current_song_duration() }, room=main_room) @@ -1551,6 +1552,7 @@ def start_music(): 'action': 'start', 'song': music_player.get_current_song(), 'startTime': music_player.start_time, + 'serverTime': time.time(), 'songDuration': music_player.get_current_song_duration() }, room=main_room) @@ -1564,6 +1566,7 @@ def change_song(): 'action': 'change', 'song': new_song, 'startTime': music_player.start_time, + 'serverTime': time.time(), 'songDuration': music_player.get_current_song_duration() }, room=main_room) @@ -1649,8 +1652,19 @@ class MusicPlayer: self.current_song_index = (self.current_song_index + 1) % len(self.playlist) self.start_time = time.time() self.load_current_song() - send_discord_alert(f"🎵 Now playing: {self.get_current_song()}") - return self.get_current_song() + new_song = self.get_current_song() + send_discord_alert(f"🎵 Now playing: {new_song}") + + # Emit updated music sync information + socketio.emit('music_control', { + 'action': 'change', + 'song': new_song, + 'startTime': self.start_time, + 'serverTime': time.time(), + 'songDuration': self.get_current_song_duration() + }, room=main_room) + + return new_song @@ -1864,6 +1878,7 @@ class AdminConsole(cmd.Cmd): 'action': 'change', 'song': new_song, 'startTime': music_player.start_time, + 'serverTime': time.time(), 'songDuration': music_player.get_current_song_duration() }, room=main_room) @@ -1889,6 +1904,7 @@ class AdminConsole(cmd.Cmd): 'action': 'change', 'song': new_song, 'startTime': music_player.start_time, + 'serverTime': time.time(), 'songDuration': music_player.get_current_song_duration() }, room=main_room) diff --git a/index.html b/index.html index 022d3fa..ceeca15 100644 --- a/index.html +++ b/index.html @@ -183,5 +183,15 @@ + +
+ +