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

Implement limitsets #454

Open
wants to merge 22 commits into
base: dev
Choose a base branch
from
Open

Implement limitsets #454

wants to merge 22 commits into from

Conversation

marchc1
Copy link
Member

@marchc1 marchc1 commented Jan 18, 2025

Explanation

Limitsets are collections of server-side settings, which when selected can automatically update as we fine tune combat in the future. We can also leave Sandbox alone for the most part (for example, mobility link changes could be placed in Combat instead while Sandbox can leave them as is).

The default value of ACF.SelectedLimitset is set to "none", which is a reserved name for no limitset and will not modify any settings. This should keep server owners happy and not modify their settings without their permission.

To ensure that limitsets have the opportunity to be used and don't just rot on 95% of servers, server owners/superadmins will be given a popup when they receive this update. The popup will tell them about the difference between the two modes, and offer a "Custom" mode (which in reality uses no limitset and sets ACF.SelectedLimitset to "none").

Once they make a choice on which limitset to use (or not to use the feature), an internal convar is set to 1, which will ensure the message does not pop up again (unless they're doing something funky). There is probably a better way to do this, but this is the best way I can think of right now.

For the Future

In the future, we should consider if we want to keep this menu popup but re-write some of the text (ie. remove the "This is a new feature" stuff), or remove the popup altogether. I am in favor of leaving the popup if convars are reliable enough for this and no issues occur.

Also, for future settings we may implement, I think this is how we should do it:

  • Mark the default (for example, if its a legality check, as true) in the definitions for globals.lua
  • Use that default for Combat
  • Determine what it should be for Sandbox or if it should be changed by Sandbox

and with existing settings:

  • Leave Sandbox alone for the most part; it would basically be what ACF currently is (with some exceptions, I think a lot of things are going to end up relying on baseplates for example)
  • Modify/tweak Combat where applicable for balancing sake

Tldr; we should leave Sandbox alone where possible, and provide a much better moderation experience for server staff and a much better combat experience for everyone with Combat. If a server doesn't want to use limitsets, the default values from globals.lua should represent what Combat mode sets, and its up to server staff to adjust them if they want to. This should satisfy all parties that use ACF:

  • Builders on servers that use the Sandbox limitset or a custom limitset won't be impacted by our Combat restrictions
  • PvPers on servers that use the Combat limitset will have a much better experience as time goes on and we develop more restrictions
  • Server owners won't be annoyed we just overrode their settings without asking

Other Notes

  • I had to change the hook that loaded persistdata from Initialize to ACF_OnLoadAddon. This doesn't break anything on my end, but is a change of logic flow so I'm a bit scared, but hopefully it should be fine... the advantage is that acf_reload actually will reload persistent data rather than resetting everything back to their default values.

(it should be obvious, but for the layman reading this PR; we don't think restrictions are the end-all-be-all to improving combat, obviously additions need to happen too and various other balancing fixes; this would just allow us to do much more of that while still keeping builders a lot happier than us hard enforcing things within the addon)

will change things around later
This seems to work perfectly fine.

This solves an issue where ACF persist data doesn't get reloaded when acf_reload is called.
Note: Probably should be checked against hook docs standards before dev -> master merge

This is needed because we want to hook when the user sets the server data key even if it hasn't changed (allows the limitset notice to disappear if they pick "none" for example)
Execute() only calls stuff on the server, but the data (Name, Author, Description, etc) could be shared; which would simplify the limitset menu
Eventually, we should merge something into the menu for this, but this will work for now
@marchc1
Copy link
Member Author

marchc1 commented Jan 18, 2025

Another nice thing about this I forgot to mention; The API for creating limitsets is publicly exposed, so if someone wanted to create their own custom limitset and distribute it, they could easily do so by placing a file in lua/acf/limitsets/limitsets/ like this...

local YourLimitsetHere = ACF.LimitSets.Create("I Hate Links")
    YourLimitsetHere:WithAuthor("Not the ACF Team")
    YourLimitsetHere:WithDescription("Grrr")
    YourLimitsetHere:SetServerData("LinkDistance", 0)

We'd need to add some kind of SetGlobal method or something, which could end up being tricky...

We could also just set up LinkDistance & MobilityLinkDistance as server-data now before PR'ing; up to others how we approach this
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.

1 participant