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

[Feature]: Add ability for macro's to determine if they are running on the server client or not. #3464

Closed
cwisniew opened this issue Jul 8, 2022 · 1 comment · Fixed by #3465
Assignees
Labels
documentation needed Missing, out-of-date or bad documentation feature Adding functionality that adds value tested This issue has been QA tested by someone other than the developer.

Comments

@cwisniew
Copy link
Member

cwisniew commented Jul 8, 2022

Feature Request

Some times macros need to ensure they always run on a single client so that running simultaneously on different clients will not cause issues. To aid in this it would be good if a macro could determine if it was running on the server or not.

The Solution you'd like

Add two new fields to the getInfo("client") call

  • isHosting which returns true or false, which indicates if this client is hosting the server for others to connect.
  • isPersonalServer which returns true or false, which indicates if this client running the personal server (i.e. it is not hosting a server or connected to a server)

Add three new macro functions

  • server.isServer() -> Returns 1 if hosting or personal server, 0 otherwise
  • server.isHosting() -> Returns 1 if hosting a server others can connect to, 0 otherwise
  • server.isPersonal() -> Returns 1 if personal server is running

Alternatives that you've considered.

Requiring users to do some trickery to figure it out themselves

Additional Context

No response

@cwisniew cwisniew added the feature Adding functionality that adds value label Jul 8, 2022
@cwisniew cwisniew self-assigned this Jul 8, 2022
@Phergus Phergus added the documentation needed Missing, out-of-date or bad documentation label Jul 8, 2022
@Phergus Phergus added the tested This issue has been QA tested by someone other than the developer. label Jul 11, 2022
@Phergus
Copy link
Contributor

Phergus commented Jul 11, 2022

Tested 3 new functions and getInfo("client"). Working as described.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation needed Missing, out-of-date or bad documentation feature Adding functionality that adds value tested This issue has been QA tested by someone other than the developer.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants