iw4x / iw4x-client

GNU General Public License v3.0
113 stars 35 forks source link

feat: added -lan flag #95

Open WantedDV opened 6 months ago

WantedDV commented 6 months ago

What does this PR do?

Adds -lan startup flag for offline/lan gaming.

How does this PR change IW4x's behaviour?

Disables node system which would print nearly 600 error messages to the console as a result of Sys_SendPacket failing when offline (called from Node::Entry::sendRequest).

Anything else we should know?

Master server still works should the user regain internet connection.

diamante0018 commented 6 months ago

missing documentation of this flag in README.md

Rackover commented 5 months ago

This new flag seems entirely equivalent to sv_lanOnly In fact i feel like you can achieve the exact same behaviour by just adding +set sv_lanOnly 1 to the game launch options, which will act just the same way as your new flag except it will not require any new implementation.

On the basis that this feature already exists, I think this PR does not warrant merging?

WantedDV commented 5 months ago

sv_lanOnly dvar only applies to servers lan can be used for both client and server

Alternatively we could change sv_lanOnly to work for clients but I thought it might be best to have separate toggles in case we later want to disable things for the client but not servers.

Rackover commented 3 months ago

Looking at your implementation, everywhere where you use your flag you could also just use SVLanOnly The Dvar works whether you're a dedicated server or not, but maybe it indeed doesn't need to be in Dedicated.cpp and could belong in another component. This does not warrant the addition of a new flag, imo

- if (Dedicated::IsEnabled() && Dedicated::SVLanOnly.get<bool>()) return;
+ if (Network::SVLanOnly.get<bool>()) return;

for instance?

WantedDV commented 3 months ago

Sure, that’s fine.

My reason for creating a new flag was mostly due to naming and consistency with other clients. As of right now the only purpose of the flag is to disable the node system for clients, but I was anticipating it might be used for other things where a separate option for servers and clients would be useful.

You are welcome to close this PR and make the single line change mentioned above. Thanks