Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
This package has been marked as deprecated, and it's suggested another
alternative is used.
You are viewing a potentially older version of this package.
View all versions.
SharedModLibrary
Contains shared logic for updating player prefabs, interacting with chat, and maintaining RoR2Application.isModded.
| Date uploaded | 7 years ago |
| Version | 1.0.1 |
| Download link | ToyDragon-SharedModLibrary-1.0.1.zip |
| Downloads | 845 |
| Dependency string | ToyDragon-SharedModLibrary-1.0.1 |
README
Frogtown Mod Library
Contains shared logic for updating player prefabs, interacting with chat, maintaining RoR2Application.isModded, and the interface for toggling mods on an off.
This mod is a prerequisite for:
Installation
- Install BepInEx Mod Pack
- Visit the releases page
- Download the latest FrogtownShared.dll
- Move FrogtownShared.dll to your \BepInEx\plugins folder
Developers
This library can help you:
- Toggle your mods on/off
- Maintain the isModded flag
- Add chat commands
public ModDetails modDetails;
public void Awake()
{
//Initializing a ModDetails object will add your mod to the mod
//list, and allow it to be enabled or disabled from chat commands.
modDetails = new ModDetails("com.frogtown.chatcheats");
//This library adds chat command "/enable_mod" and "/disable_mod"
//that users will use to turn your mod on or off. When all mods are
//disabled it will update the isModded flag to false, and when any
//are enabled it will set it back to true.
//Add chat commands
FrogtownShared.AddChatCommand("give_item", OnGiveCommand);
//You command will be called when any user types "/give_item x y z" in the chat.
}
//userName is the display name of the user, and pieces is the command and list of parameters.
private bool OnGiveCommand(string userName, string[] pieces)
{
//All of your code is still ran while disabled, so you must check
//the enabled flag before doing anything.
if (!modDetails.enabled)
{
return false;
}
//Use FrogtownShared.GetPlayerWithName to get a reference to the
//player who called your chat command.
PlayerCharacterMasterController player = FrogtownShared.GetPlayerWithName(userName);
//Do the stuff
}