Autor:TeamMoonstormLast updated:11/09/2021 03:40:242.6M530KB

R2API_Addressables
LoadingScreenSpriteFix

R2API_Colors

R2API_ArtifactCode
MoonstormSharedUtils, otherwise known as MSU, is an API designed to work around the ThunderKit system for creating Content Mods.
![]()
Originally part of the API and Framework built for updating Starstorm2 to a ThunderKit setup for a better development experience, it has grown exponentially into it's own separate library so anyone with the desire to create large Content mods with thunderkit can use it.
MSU strifes for the following goals regarding mod development and management.
While Code only mods create their Content (Prefabs, ScriptableObjects, etc) at Runtime and usually at Awake, this causes the issues known as "Forever Black Screen", where most of the mod's systems are initialized before the Loading Screen of the game starts. this gives the idea that the game is frozen and not responsive to oblivious users. And while this is true, managing the loading and interactions between custom made content from Assetbundles and the game's systems is difficult.
MSU solves this by the triad of the ContentPiece, the ContentPiece Provider, and the Module framework. This triad is utilized to allow mods to Load their assets Asynchronously during the loading screen, and have them working properly with the base game's systems.
, which represents a Content that's tied to a specific UnityEngine.Object.
IContentPiece<T>
IArtifactContentPiece, for ArtifactDefsIEquipmentContentPiece EquipmentDefs
IEliteContentPiece manages EliteDefs associated to a specific Equipment.IItemContentPiece Project Definition.
IVoidItemContentPiece manages the Item Corruption system added in Survivors of the Void.IItemTierContentPiecefor ItemTierDefsISceneContentPiece SceneDefs., which represents a Content that's tied to a specific type of UnityEngine.MonoBehaviour
IGameObjectContentPiece<TComponent>
ICharacterContentPiece for CharacterBodies
IMonsterContentPiece can be used for managing hostile monstersISurvivorContentPiececan be used for managing new Survivors.IInteractableContentPiece for Interactables.IVanillaSurvivorContentPiece, which represents modifications for a Vanilla survivor. classes can also implement the IContentPackModifier, which is used for directly interfacing with your mod's ContentPack.IContentPiece classes with the base game. system.IContentProviderto a module, you can call it's Initialize method to get back a Coroutine that'll initialize your content in an Asynchronous fashion.ArtifactModule IArtifactContentPieces, the ArtifactModule interfaces with R2API.ArtifactCode to add new Artifact Codes to the game. It'll also handle proper hooking and unhooking of the Artifact, so that only when the artifact is enabled it's hooks are enabled.CharacterModule, manages ICharacterContentPiece, ISurvivorContentPiece IMonsterContentPiece, the module interfaces with R2API.Director to handle the spawning of Monsters for the stages of the game.EquipmentModule IEquipmentContentPieceand IEliteContentPiece, the module utilizes a single hook for managing the Execution calls for the Equipments.InteractableModule, manages IInteractableContentPiece, the module interfaces with R2API.Director to handle the spawning of Interactables for the stages of the game.ItemModule IItemContentPiece and IVoidItemContentPiece. It automatically handles item corruptions.Iitemanimal modules IItemTierContentPiece, it automatically creates at run start collections of the available drop list for the tier.SceneModule, manages ISceneContentPiece, it interfaces with R2API.Stages to handle the addition of a Stage to the game.VanillaSurvivorModule, manages IVanillaSurvivorContentPiece. which is used to add new content to the base game's survivors (Skins, skills, etc.) to provide IContentPieces to modules.
IContentPieceProvider interface to manage availability scenarios, MSU's ContentUtil class contains methods for creating them from scratch, by only analyzing your Assembly.One of the key goals of MSU is working alongside the Risk of Rain 2 systems, making content that works with it instead of forcing the base game's systems to work with ours. As such, MSU provides a robust system to interact alongside the game's key systems such as equipments, buffs, items, and more.
To avoid unecesary hooking for commonly used types, MSU provides interfaces that can be used inside components for the following systems:
IOnIncomingDamageOtherServerReciever, it works as a hook on TakeDamage, which can be utilized to modify the incoming damage for a victim.IStatItemBehaviour, an interface that works as an On hook for Recalculate Stats, containing methods for running before and after stat recalculations.IBODYSTATARG, an interface that works as an implementation of R2API.RecalculateStats's GetStatCoefficient delegate.The BaseItemMasterBehaviour, much like it's Body counterpart (BaseItemBodyBehaviour) is utilized for creatinng a behaviour that's added to a CharacterMaster when a specified item is obtained.
The BaseBuffBehaviour is a component that can be used for managing the effects of a Buff. For performance reasons, BaseBuffBehaviours are not destroyed when the buff gets removed, instead, when the buff is first obtained by a body, the behaviour is added, when the buff stacks are depleted, the behaviour is disabled, afterwards, when the body recieves the buff again, the behaviour is enabled. this reduces the workload of the GarbageCollector and overall improves the performance of the system.
As MSU's goals revolve around working in the Editor, MSU comes bundled with a multitude of utilities regarding the creation of content for the game.
MSU provides a custom ImportExtension that can be used to blacklist the WWise assemblies from the game, allowing you to use the WWise Integration system for your project.
MSU provides the following ScriptableObjects that allows for the creation of "runtime only" content at Editor time.
AchievableUnlockableDef, works as an abstraction of the UnlockableDef and AchievementDef system, its an UnlockableDef thats unlocked via an achievement.DotBuffDef, works as an abstraction of the DotDef, and automatically assigns a DotDef to its specified BuffDef.Extended deletion definition, works as an extension of the EliteDef class, supporting automatic addition to base game tiers, elite ramps, overlay materials, and more.InteractableCardProvider, a ScriptableObject that contains the metadata needed for spawning Interactables in stages, multiple stages can be assigned to a single card.MonsterCardProvider, a ScriptableObject that contains the metadata needed for spawning Monsters in stages, multiple stages can be assigned to a single card.ItemDisplayDictionary, a ScriptableObject that works akin to R2API.Items's ItemDisplayDictionary system, it can be used for adding multiple RuleGroups to existing ItemDisplayRuleSets, the key assets and display prefabs are powered by the NamedItemDisplayRuleSet, a ScriptableObject that can be used for creating a complete ItemDisplayRuleSet for character models. the key assets and display prefabs are powered by the ItemDisplayCatalogsystem within MSU.SerializableEliteTierDef, works as an Abstraction of the Elite system within the game, can assign a cost multiplier, addressable references to base game elite tiers and mode.UberSkinDef, works as a catch-all utility for SkinDefs, implementing support for R2API's SkinVFX system and adding skins to vanilla characterSince MSU was created with thunderkit in mind, MSU provides the following CompossableObjects to your project:
Manifest with the necesary Manifest date for declaring your modPathReferences that's used for clean building and releasing of your modCreating configuration for your mod can be extremely verbose using the default BepInEx implementations, MSU implements a Configuration system on top of BepInEx that allows you to easily configure anything.
MSU provides the following abstraction of the BepInEx Config System:
ConfigureField
ConfigSection and Nickname are not necesary to be implemented, MSU by default utilizes the MemberInfo ConfigName, and the DeclaringType's name as the ConfigSectionConfiguredVariable
Tying Configuration changes to Token values is one of the best parts of creating tokens using code, however, translation of these tokens can be difficult to manage as it requires translators to code the translations directly into the C# source file.
MSU provides the FormatToken system, you can now write your token's values utilizing the String Formatting system of C#. With this, you can properly levrage JSON langauge files, which translators can easily use for translations as long as they keep the proper order of indexing.
MSU is a passion project from one of TeamMoonstorm's members, Nebby. as such, he works in his free time on this to allow the rest of the community to create amazing and awe-inspiring content.
MSU will forever be free to use and never gated behind paywalls, however, donations are incredibly appreciated.
(Note: click the icon to open a new tab to the Mod!)

Download Mods For Free
Install LagoFast, start Risk of Rain 2 and play with the mods you love.