opensoldat / launcher

Launcher for OpenSoldat
MIT License
11 stars 3 forks source link

Add client sniperline and server stationary gun options #11

Open BranDougherty opened 1 year ago

BranDougherty commented 1 year ago

This PR adds support + UI for the sv_stationaryguns and ui_sniperline cvars.

The ui_sniperline and sv_sniperline relationship is not obvious for users so I changed their descriptions to try and make it easier to understand. Unfortunately adding the ui_sniperline setting resulted in a small awkward scrollbar on my screen, but I'm not sure what to do about it, and we need to have UI for this cvar somewhere.

The sv_stationaryguns cvar controls whether stationary guns are allowed to be spawned in maps and shot by players. IMO for a singleplayer experience, having stationary guns enabled by default makes sense.

I also ran into issues with the launcher not starting the server properly. This happened because the node.js stream interface chunks 'data' events, and we were searching for the [NET] ... string only within one chunk. So on the off chance the string spanned two chunks, we would miss it. Consider this a stop-gap measure while proper IPC is implemented.

While this PR is not very ambitious, I'm not familiar with the technologies used in the launcher so please give this a careful review.

rzaba0 commented 1 year ago

I like all of the changes except the approach to ui_sniperline. In my opinion forcing users to check 2 boxes in 2 different areas of the launcher in order to enable sniper line is still not intuitive. What I like about the sniper line in 1.7.1 is that you can toggle it with ALT+F2 (as long as server allows it?) while you are playing, and this is a behavior that I would keep, especially since we have all the functionality to do it this way.

So, what I would recommend is:

  1. Keep the local server setting to "Allow sniper line"
  2. Optionally add a tooltip next to "Allow sniper line" to explain that you can toggle the sniper line while you are playing by pressing some combination of keys (ALT+F2 by default)
  3. Add a new key binding in Settings->Controls->Other (or use a new custom binding if it's not possible otherwise) that maps the /toggle ui_sniperline 0 1 command to ALT+F2. Ideally it would have some intuitive label like "Toggle sniper line (if server allows it)". I think this may also require changes to the configs in base repo.
  4. Remove the option to display sniper line from Settings->Graphics->Interface

Let me know what you think, I'm also fine with keeping your changes if people prefer your approach.