Creating a custom role in Hindenburg is a surprisingly light concept, although that's only because most of your role logic (abilities, buttons, etc.) is done in the PlayerControl innernet object, such as the shapeshift method.
Check out the Custom Innernet Objects or Handling Custom RPCs for more information.
Note that this is only a server-side construct, custom roles must also be added to each client using a client mod.
Creating a class for your role is extremely simple:
class MyRole extends BaseRole<Room> {
static roleMetadata = {
roleType: 60 as RoleType,
roleTeam: RoleTeamType.Crewmate,
isGhostRole: false
}
}
Where roleType
is a unique integer/enum value for your role, roleTeam
is the team that your role is for, either Crewmate or Impostor, and isGhostRole
is whether or not your role is assigned on a player's death, like the Guardian Angel.
Registering your role class is as simple as using the RegisterRole decorator and passing in your role class:
@RegisterRole(MyRole)
@HindenburgPlugin("hbplugin-fun-things")
export class FunThingsPlugin extends WorkerPlugin {
}
As noted above, you will have to implement role abilities/buttons either by extending the PlayerControl Innernet Object with your own Custom PlayerControl object), or by hooking into RPCs recieved with {@page ./handling-custom-rpcs.md and sending yourself.
If you're making a full mod and not intending on having any other mods with conflicting roles, you should extend PlayerControl and implement your own rpc handlers and methods.
If you're making a partial mod and expecting other mods to implement their own roles, you should probably just handle custom RPCs for the PlayerControl class and send them yourself.
Generated using TypeDoc