PC-Logix / OpenFM

Streaming radio mod for Minecraft, with OpenComputers control support
MIT License
25 stars 17 forks source link

Radio does not resume playing a stream when disconnecting/reconnecting #51

Closed SwadicalRag closed 7 years ago

SwadicalRag commented 7 years ago

I apologise if this is intentional, nevertheless, it would be great if radios would resume a stream automatically after disconnecting and reconnecting to a server.

I'm using OpenFM as an announcement system for my base using text-to-speech and a custom stream server, and having to detect whether players are connecting/disconnecting and toggling stop/play is a bit unintuitive.

SwadicalRag commented 7 years ago

Addendum:

It seems that the radio also stops playing when the player dies and respawns, or returns to the overworld (where the radio is) from another dimension

SwadicalRag commented 7 years ago

Addendum part 2:

The radio also does not resume if a player goes out of range of the radio (until the chunk where the radio is unloads clientside) and returns

CaitlynMainer commented 7 years ago

Which OFM/MC Version?

SwadicalRag commented 7 years ago

1.9.4-0.1.0.17 OFM running on 1.10.2 Minecraft

SwadicalRag commented 7 years ago

I'm not 100% familiar with minecraft/forge's API, but I had a look through the codebase for you

It seems that you send 'update' packets every tick from the server to the clients from TileEntityRadio::update right, and those packets are type 13, so this bit of logic here should make the client play a stream if it is stopped.

So the code seems like it should work, but isn't, unless I'm missing something...

CaitlynMainer commented 7 years ago

I know this works properly in 1.7 as that's the version I run, I'll try to poke at this asap. It's likely some small issue in the network rewrite for 1.8+

CaitlynMainer commented 7 years ago

(Note the files you linked are on the Master branch, which is 1.7 there is a 1.8.9, and 1.9.4 branch for those versions)

SwadicalRag commented 7 years ago

OH alright, I didn't notice, I assumed the master branch have the most up to date version of OFM.

CaitlynMainer commented 7 years ago

Please try build 18 on curseforge

SwadicalRag commented 7 years ago

Okay, I don't have access to the server right now, but I should be able to test clientside

SwadicalRag commented 7 years ago

Seems to work in singleplayer, I will let you know if it works in multiplayer asap. The guy managing the server (@lixquid) is busy during weekdays, so I'll try and pester him to update OpenFM soon.

SwadicalRag commented 7 years ago

Okay, this issue has mainly been resolved as of the latest update, but I do notice that when I approach a speaker connected to a radio that's reasonably far away from the radio, the music plays, but cuts out when I get closer to the speaker. Is that a separate issue?

CaitlynMainer commented 7 years ago

I can't reproduce that with the current version, my speaker is about 25-30 blocks away from the radio and the volume slowly lowers from the radio until the speaker picks it back up.

SwadicalRag commented 7 years ago

Try 200-300 blocks away (sorry for not specifying!), we had two mountain bases set up, connected to the same radio, and they're pretty far apart.

CaitlynMainer commented 7 years ago

Is the chunk with the radio still loaded?

SwadicalRag commented 7 years ago

I mean we could use opencomputers to control and synchronise two radios at once, but it seemed like a bug, so I wanted to report it as well.

SwadicalRag commented 7 years ago

Uh, no, it isn't, is that the problem?

CaitlynMainer commented 7 years ago

Yes, the radio controls the stream, if it unloads, the stream will stop.

SwadicalRag commented 7 years ago

Ah wait no, I misread, the chunk with the radio is loaded serverside, but the chunk with the speakers aren't

CaitlynMainer commented 7 years ago

I don't think that's fixable without increasing the range for the packet broadcast which would be bad on server performance. I'm going to go ahead and close this as the original issue is resolved, but I'll keep thinking about better ways to solve the range issue.

SwadicalRag commented 7 years ago

Alright