Welcome to DillyzThe1's Role Api!
This API allows for an easy & documented way off adding a role that works accross mods using the same API!
To use this api, please add either of these links in your readme.md file:
https://github.com/DillyzThe1/DillyzRoleApi
https://discord.gg/49NFTwcYgZ
Assuming you have over 6 braincells, you should probably know how to add a reference in vs.
If not, here's how.
Step 1: Right click "Dependencies" and click "Add Project Reference"
Step 2: Click "Browse" and go to "C:\Program Files (x86)\Steam\steamapps\common\Among Us\BepInEx\plugins" where DillyzRoleAPI-2021.4.12s.dll should be at.
Step 3: Click "Add" like a normal person and start creating!
(adding it to deobfuscate task works too, but this is easier for new people.)
(Your dependencies dropdown should look like this now)
In your HarmonyMain.cs file, you need to add a new static RoleGenerator to the game.
(Don't forget to add "using DillyzRolesAPI.Roles;")
Next, set every variable in the role you want.
There are a limited amount, but there is a way to patch stuff yourself.
(This is a screenshot from the sensei mod.)
"What if I want a setting to determine if my role is enabled?"
Keep reading to the next section and then patch PlayerControl.RpcSetInfected.
(isEnabled is a bool within my custom mono called "RoleGenerator", so make sure to always set true or false.)
Custom options: We all need it, but its uncommon to find.
(NOTE: These settings will only work with other mods that use this api or mods without settings at all.)
(Use any settings api at your compatibility own risk)
First, you need to do something similar to roles:
Next, you'll need to set the values you need for them.
TIP: Use .IncrementValue to set how much it goes up or down.
Boom! Settings!
(Note: "Have Dictator" doesn't appear here due to being scrapped for dictator, as it was only a testing feature)
The way to read if someone is a role is simple.
Here is the 1 updated way on checking a role.
The way to add your own credit is simple.
All you have to do is add it to the list!
In the mod, you might notice everybody can pick the same color.
I added a simple way to disable this as shown here.
When false:
When true:
Wow, you made a role!
Now it only takes 30 seconds rather than 10 minutes!
Enjoy making roles :)
NOTE: ow that new font hurts my eyes. i hope the font gets reverted back to the 12.9s version.