-
Notifications
You must be signed in to change notification settings - Fork 104
feat: Non-Breaking SSS Rework 🤑 #482
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: Non-Breaking SSS Rework 🤑 #482
Conversation
Prepare branch
Only bad thing about this is the fact that the constructor for most settings is now ambiguous unless you specified every input. (not breaking tho 💰 💰 💰 💰 )
|
I kid you not I accidentally hit enter twice when entering the emoji in the title which accidentally submitting the PR 😭 |
|
I also forgot to mention, I had to add some pragma ignores n stuff to keep the functionality of some of this stuff still working, I don't know if that's taboo here though |
Removed default values from obsolete constructors, making the Ambiguous constructor reference error impossible. Added a SubGroups property to SettingGroup to handle recursive groups of settings. SubGroups defaults to null but I made sure to check it in them methods that call it. Notably SettingGroup::GetAllSettings(); that recursively gets all the SettingBase contained within it. I added checks for recursive stuff and an error for it. I also added SettingGroup::GetViewableSettingsOrdered(Player) that gets all the settings viewable by a specified player as well as ordered by priority etc...
|
Check the commit I just made for notes on what I added |
some last minute tweaks including fixing the List<> renting I was doing
Legit realized my recursive check didn't work last night right before I went to bed 😭 This ought to fix it though
…Settings, Add an IReadOnlyCollection of Groups if a plugin-maker manually removes a ServerSpecificSettingsBase from ServerSpecificSettingsSync.DefinedSettings, it's on them to handle who gets what settings, otherwise making this check simply reduces points of failure
Forgor to check predicate :(
|
So a colleague of mine made a SCPSwap Plugin with this PR, and so far it works perfectly. I'm still down to add more features/explain design choices if anyone is interested. Is this PR gonna get merged for 14.1 though :3 ? |
|
idk how we both merged dev into this branch Yamato, but GitHub was yapping about unresolved conflicts, so I just fixed those to the best of my ability |
yknow, I really though that checking DefinedSettings for the setting bases before sending them was a good idea, but SOMEHOW SettingBase::Base doesn't return the value stored in ServerSpecificSettingSync.DefinedSettings!?!?!? 😭 Anyways, removed that, added a specified group for the obsolete methods to register into, then made all SettingBase non-group register/unregister method reference that group. Only way this breaks is if some goofy goobers plugin unregisters all settings, clients would see stuff created via group method, but that's why we obsolete stuff, it doesn't affect pre-change behavior so as long as devs have a few brain cells (crazy request ik) we should be good
as far as I can tell this shouldn't mess with the recursive check but make it more accurate. But now you can have multiple of the same group in SubGroups if you'd like (without them being recursive ofc)
Description
Obsoleted SettingBase.SyncOnJoin, SettingBase::Header, and relevant constructors. Added constructors without Header input. Added SettingGroup class that contains an IEnumerable, int Priority, Predicate Viewers. Priority determines where the setting appears in the clients list of settings (high priority means setting is at top of list) Viewers determines who can see the setting. Replaced all methods that send generalized SSS data (SendToPlayer(Player), SendToAll(), etc...) with methods that reference a new internal static readonly List called Groups. They use this to get the priority of each group, then order them, then convert to an array of ServerSpecificSettingBase to be sent to client. I made sure to keep the functionality of all this stuff (including SyncOnJoin) so in theory this shouldn't break any existing plugins. I thoroughly tested it on my stuff, the only thing that messes with what I made is ServerSpecificSettingSync.SendToAll(); but still, these changes give a LOT of power to the developers. We can order groups of settings, controls who sees them, etc... All without breaking existing plugins. Of course there is one thing that went slightly wrong. The new constructors for each setting type are now ambiguous unless you specify the EXACT form of the non-obsolete constructor, this can be frustrating for devs, but that's about it. Once we get 15.0 though we can just throw out the obsolete stuff which would make the whole SSS process smooth like how it currently is.
What is the current behavior? (You can also link to an open issue here)
📉 📉 📉 📉 📉 📉 📉 📉 😭 😭 😭 😭 👎 👎 👎 👎
This is a non-breaking PR that implements the same features attempted in #472 albeit in a different manner.
What is the new behavior? (if this is a feature change)
💹 📈 🤑 🔥 🔥 👍 📈 📈 📈 📈 🤑🤑🤑
Does this PR introduce a breaking change? (What changes might users need to make in their application due to this PR?)
No, I tried very hard to avoid this.
Other information:
I believe this isn't breaking and works as intended etc... but it would be best if you all looked over this carefully.
Types of changes
Submission checklist
Patches (if there are any changes related to Harmony patches)
Other