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
Changes to R2API's ContentPack System #338
Conversation
…pted vanilla compound values-
|
something that i didnt mention where the extensinve amount of changes ive done internally, i'll list them below:
Hopefully i havent missed any important changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems good to me
Next time, try to restrict codemaid to only the files/sections you changed to make the reviewer's life easier.
|
I will keep in mind both the Versioning thing and the Code cleanup only affecting the classes i've modified. I had to do the versioning stuff because it wouldn't load all the mods i had for testing because they required a version greater than 0.0.1, and i dont know how to change the version via build operations. The "entires" is compeltely inexcusable and i'm suprised i didnt catch it before commiting. |
|
The latest commit is an addition to the Object naming system that ensures there are no objects with Null, Whitespace or Empty names. this in turn fixes an issue where skill selections are not saved, because the game remembers the skills you choose depending on the skill's asset name. which shouldn't be Null, Whitespace or Empty. |
|
This should be the final commit i do regarding new features to the system, however, i've made some mildly important changes to 2 classes.
|
|
I think creating a folder called ContentManagement and putting LoadRoR2ContentEarly, R2APIGenericContentPack and R2APIManagedContentPack under R2API.ContentManagement namespace doesnt sound like a bad idea |
I agree that this sounds like a good idea, i'd be willing to do that here too. Also, should i mark BuffAPI, ArtifactAPI, ProjectileAPI, EffectAPI and SurvivorAPI as obsolete? considering anyone can just use the AddNewContent method instead of nameAPI.Add() |
|
Lastest commit should finish everything, if we decide to deprecate the api's i've listed i'll do so. |
|
Hopefully that'll be the final commit i have to do regarding Typos 💀 Regardless, the commit 55709f7 Marks the following things as obsolete:
Considering that some of these API's had some extra functionality (Mainly SurvivorAPI), i think we could add those into some kind of class called "VanillaFixes" and have that run every time r2api gets initialized? i'm unsure. Also, i am aware that the ContentManager doesnt attempt to check if a content is "valid" (Like how projectileAPI adds a projectile only if it has the projectileController, or a better example, is that an ArtifactDef should really, REALLY have icons, or it'll throw errors ingame). i could make an extra class on a different PR called "ContentAdditionHelpers" where each content has its own Add method where we check for properly built content pieces. |
Also removed AddContent() and AddentityState() from R2APIContentManager
|
ContentAdditionHelpers is a public class that can be used to add content pieces to the mod's ContentPack. Since now users should add content thru this class, i've deleted the two public methods in contentManager that added Content itself. ContentAdditionHelpers has a method for each piece of content that's valid in a content pack and checks for common mistakes that would cause the Content to function erroneously (Such as an ArtifactDef not having icons). While this class does contain methods for adding Elites, Items and Equipments, the documentation recommends to add those contents via their respective API's, and R2API will log what mods are adding these 3 content pieces via the ContentAdditionHelper. i've only added those methods for completion sake. |
|
Final, FINAL commit for this pr, for real this time. While the previous version for blocking more content entering the catalog worked allright since it was just one list that got created during R2APIContentPackProvider's methods. this doesnt work as smoothly with the current version of the content management. I've seen mods that like to load their content and add them to their contentpacks in LoadStaticContentAsync from the IContentPackProvider. The previous system wouldn't allow mods to load their content asynchronously. this commit makes it so they can There are 2 major changes in this commit: |
|
For anyone that stumbles on this PR wondering where the deprecated classes have gone: you will have to use the static methods of the static class I could not find any documentation describing this change (the deprecated classes are still listed in the repository's wiki), just started getting compilation errors after updating to the latest version of R2API. Is there any documentation or guidance on what has to be used with the |
|
That change was actually made by me in #344, and using the methods in ContentAddition doesn't require any additional submodule dependencies. The change was documented in a Discord thread that contained all the changes made to both RoR2 and R2API, the wiki just hasn't been updated yet due to time constraints mostly |
R2API currently manages any kind of added content by adding the Content piece to its internal content pack. while this works well in theory, it also produces the issue where All of the content is under R2API. So for example, things like Aetherium, Digger Unearthed and Direseeker are all int he same contentpack, instead of being in separate contentpacks. While ideally each mod should implement their own content pack manually, this Pull request attempts to fix this issue by making it so each mod that adds content gets their own ContentPack.
This entire thing is done thru the new Class called "R2APIContentManager". As the name suggest, it manages the content packs that r2api is creating for each mod that adds content. In a very, very simplified explanation:
There are a few upsides to this method that arent present with the original r2api content handling system.
This Pull Request modifies a LOT of classes, as such, i've left most of the code that's been made reduntant in certain api's commented out. if this PR is about to be approved, i'll remove the comments, add documentation, add Logger messages for errors and run a code cleanup for the classes.