-
Notifications
You must be signed in to change notification settings - Fork 13
Developers World
We also built UncomplicatedCustomRoles so that it would be easy and quick to use by other developers to more quickly implement a custom role system.
Each CustomRole is defined by an object (class) that forces the definition of various properties.
The class addressed to developers is the CustomRole
:
public class CustomRole : ICustomRole
{
public int Id { get; set; } = 1;
public string Name { get; set; } = "Janitor";
public string CustomInfo { get; set; } = "Clean the Light Containment Zone.";
public string DisplayNickname { get; set; } = "D-%name%";
public int MaxPlayers { get; set; } = 5;
public int MinPlayers { get; set; } = 1;
public int SpawnChance { get; set; } = 60;
public RoleTypeId Role { get; set; } = RoleTypeId.ClassD;
public RoleTypeId RoleAppearance { get; set; } = RoleTypeId.ClassD;
public List<RoleTypeId> CanReplaceRoles { get; set; } = new()
{
RoleTypeId.ClassD
};
public float Health { get; set; } = 100f;
public float MaxHealth { get; set; } = 100f;
public float Ahp { get; set; } = 0f;
public float HumeShield { get; set; } = 0f;
public float MovementBoost { get; set; } = 0f;
public List<UCREffect>? Effects { get; set; } = new();
public bool CanEscape { get; set; } = true;
public Vector3 Scale { get; set; } = new();
public string SpawnBroadcast { get; set; } = "You are a <color=orange><b>Janitor</b></color>!\nClean the Light Containment Zone!";
public ushort SpawnBroadcastDuration { get; set; } = 5;
public string SpawnHint { get; set; } = "This is an hint shown when you spawn as a Janitor!";
public float SpawnHintDuration { get; set; } = 3;
public List<ItemType> Inventory { get; set; } = new()
{
ItemType.Flashlight,
ItemType.KeycardJanitor
};
public List<uint> CustomItemsInventory { get; set; } = new();
public Dictionary<AmmoType, ushort> Ammo { get; set; } = new()
{
{AmmoType.Nato9, 5 }
};
public SpawnLocationType Spawn { get; set; } = SpawnLocationType.RoomsSpawn;
public List<ZoneType> SpawnZones { get; set; } = new();
public List<RoomType> SpawnRooms { get; set; } = new()
{
RoomType.LczToilets
};
public Vector3 SpawnPosition { get; set; } = new();
public Vector3 SpawnOffset { get; set; } = new();
public string? RequiredPermission { get; set; } = null;
public bool IgnoreSpawnSystem { get; set; } = false;
}
Important
Remember that the CustomRole class or whatever you want to call it must necessarily implement the ICustomRole
interface!
Our API offers various functions for role management.
UncomplicatedCustomRoles.API.Features.Manager
Controls whether a player has a custom role.
Check whether a custom role has been successfully loaded.
Retrieves the class of a custom role from its ID or via a player who has the role.
Spawn a player as a custom role, either through ID or class
Register a new custom role and load in in the plugin via it's class.
Get the number of players who have a custom role (in the first case) or the number of players who have a specific custom role, via it's ID or class.
Unregister a registered custom role via it's ID or class.
Note
Class interfaces (structures) are indicated with a []
at the beginning!
Simple, here is the guide in steps:
- Create a class for the custom role that implements the
ICustomRole
one - Register the custom role class with the [
Register
](#void-registericustomrole-role method) - Summon the custom role with the
Summon
method
UncomplicatedCustomRoles is a free plugin developed by FoxWorn3365 and
DrAgenda.
Please consider Donatig 1$ if you found this plugin helpful