Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added -lan flag #95

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open

feat: added -lan flag #95

wants to merge 2 commits into from

Conversation

WantedDV
Copy link
Contributor

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.

- intended for offline/lan gaming
- lan flag disables node system
@diamante0018
Copy link
Contributor

missing documentation of this flag in README.md

@Rackover
Copy link
Contributor

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
Copy link
Contributor Author

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
Copy link
Contributor

Rackover commented May 28, 2024

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
Copy link
Contributor Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants