Erabior / RouteManager

Mod for Railroader the game that adds basic automation for passenger routes
12 stars 5 forks source link

[enhancement] Console Arrive & Departing Printing to whole server (.ini option?) #94

Open NicholasRB opened 7 months ago

NicholasRB commented 7 months ago

One of my friends was thinking it would probably be more then doable to make it so the mod prints from whoever is running the mod into the chat for whole server. I'm not sure if this is possible, I was thinking about it too as I know that getting it to print from a connected client and not the host could probably be a bit complex to do. Just wanted to chuck this in here anyway to see if it was possible.

AdamC1228 commented 7 months ago

I believe this to be possible and already have a solid idea of how this could be done however at this time I do not plan to put forth extensive effort into multiplayer sessions until we get 2.0 rock solid. So while it is feasible this I think would be deferred until at least after the first 2.0 stable release.

NicholasRB commented 7 months ago

I believe this to be possible and already have a solid idea of how this could be done however at this time I do not plan to put forth extensive effort into multiplayer sessions until we get 2.0 rock solid. So while it is feasible this I think would be deferred until at least after the first 2.0 stable release.

Ah alright, thanks for the quick reply too. I'll tell the guy then and kinda figured as much. Your mod is working very well right now even in the unstable state. Keep up the good work

AMacro commented 7 months ago

I've tested and it's very easy to do, just depends on whether you want to implement full multiplayer support prior to implementing. This alone will send the messages, but other players still won't have control over the loco.

Wherever you have a line like: RouteManager.logger.LogToConsole(String.Format("{0} has departed {1} for {2}", Hyperlink.To(locomotive), LocoTelem.previousDestinations[locomotive].Last().DisplayName.ToUpper(), LocoTelem.currentDestination[locomotive].DisplayName.ToUpper()));

You can simply change it to: Multiplayer.Broadcast(String.Format("Dispatcher: {0} has departed {1} for {2}", Hyperlink.To(locomotive), LocoTelem.previousDestinations[locomotive].Last().DisplayName.ToUpper(), LocoTelem.currentDestination[locomotive].DisplayName.ToUpper()));

NicholasRB commented 7 months ago

Ah sweet. Yeah the guy just wanted the ability to see the messages for the whole server so everyone knows where our passenger train is at the time, not really to be able to control the loco. Though, I don't have any skill in compiling code into ddl

AdamC1228 commented 7 months ago

I've tested and it's very easy to do, just depends on whether you want to implement full multiplayer support prior to implementing. This alone will send the messages, but other players still won't have control over the loco.

Wherever you have a line like: RouteManager.logger.LogToConsole(String.Format("{0} has departed {1} for {2}", Hyperlink.To(locomotive), LocoTelem.previousDestinations[locomotive].Last().DisplayName.ToUpper(), LocoTelem.currentDestination[locomotive].DisplayName.ToUpper()));

You can simply change it to: Multiplayer.Broadcast(String.Format("Dispatcher: {0} has departed {1} for {2}", Hyperlink.To(locomotive), LocoTelem.previousDestinations[locomotive].Last().DisplayName.ToUpper(), LocoTelem.currentDestination[locomotive].DisplayName.ToUpper()));

This was exactly what I was referring to with my earlier comment and something that I am open to investigating one the road to v2.1. But, only after we address the Cochran station and Alarka depot routing issues.

On the subject though, I have not ran a multiplayer session not even once so I have not knowledge of how the multiplayer operations work nor how the mod interacts in a multiplayer scenario. There is one issue though that comes to mind (again could be moot as I don't have any insight into multiplayer) and that is what happens in a 4 player environment. If each player has the mod installed. Would the message get broadcast 4 times? If so, there would be a lot more work than just changing logtoconsole to Multiplayer.broadcast.