Skip to content

Conversation

@Someone-193
Copy link
Collaborator

@Someone-193 Someone-193 commented Apr 12, 2025

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

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentations

Submission checklist

  • I have checked the project can be compiled
  • I have tested my changes and it worked as expected

Patches (if there are any changes related to Harmony patches)

  • I have checked no IL patching errors in the console

Other

  • Still requires more testing

Someone-193 and others added 3 commits April 11, 2025 20:12
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 💰 💰 💰 💰 )
@Someone-193
Copy link
Collaborator Author

I kid you not I accidentally hit enter twice when entering the emoji in the title which accidentally submitting the PR 😭

@Someone-193
Copy link
Collaborator Author

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...
@Someone-193
Copy link
Collaborator Author

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 :(
@Someone-193
Copy link
Collaborator Author

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 ?

@Someone-193
Copy link
Collaborator Author

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
Someone-193 and others added 3 commits April 25, 2025 16:39
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)
@Someone-193 Someone-193 closed this by deleting the head repository May 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants