### Example Custom Flags Configuration
Source: https://github.com/uncomplicatedcustomserver/uncomplicatedcustomroles/wiki/Custom-Flags
Demonstrates the syntax for defining custom flags, including one without arguments and another that accepts a 'name' argument.
```yaml
custom_flags:
- DoNotTriggetTeslaGates
- CustomScpAnnouncer:
name: 'SCP-250'
```
--------------------------------
### UCR Custom Role YAML Configuration Example
Source: https://github.com/uncomplicatedcustomserver/uncomplicatedcustomroles/wiki/Outdated-Home
An example of a custom role configuration in YAML format for the UncomplicatedCustomRoles plugin. This demonstrates how to define various attributes for a custom role.
```yaml
id: 1
name: 'Janitor'
override_role_name: false
nickname: 'D-%dnumber%'
custom_info: 'Janitor'
badge_name: 'Janitor'
badge_color: 'pumpkin'
role: ClassD
team:
role_appearance: ClassD
is_friend_of: []
health:
amount: 100
maximum: 100
hume_shield: 0
hume_shield_regeneration_amout: 2
hume_shield_regeneration_delay: 7.5
ahp:
amount: 0
limit: 75
decay: 1.20000005
efficacy: 0.699999988
sustain: 0
persistant: false
effects: []
stamina:
regen_multiplier: 1
usage_multiplier: 1
infinite: false
max_scp330_candies: 2
can_escape: true
role_after_escape:
default: InternalRole Spectator
cuffed by InternalTeam ChaosInsurgency: InternalRole ClassD
scale:
x: 1
y: 1
z: 1
spawn_broadcast: |-
You are a Janitor!
Clean the Light Containment Zone!
spawn_broadcast_duration: 5
spawn_hint: 'This hint will be shown when you will spawn as a Janitor!'
spawn_hint_duration: 5
custom_inventory_limits:
Medical: 2
inventory:
- Flashlight
- KeycardJanitor
custom_items_inventory: []
ammo:
Nato9: 10
damage_multiplier: 1
spawn_settings:
can_replace_roles:
- ClassD
max_players: 10
min_players: 1
spawn_chance: 60
spawn: RoomsSpawn
spawn_zones: []
spawn_rooms:
- LczClassDSpawn
spawn_points: []
required_permission: ''
custom_flags:
ignore_spawn_system: false
```
--------------------------------
### Multiple Nickname Configuration
Source: https://github.com/uncomplicatedcustomserver/uncomplicatedcustomroles/wiki/Specifics
Example of configuring multiple nicknames in YAML, where the plugin selects one randomly.
```yaml
nickname: 'Fox,UwU,Dr.Agenda is a Furry,HELLO,Italy
```
--------------------------------
### Implement EventCustomRole with Event Handling
Source: https://github.com/uncomplicatedcustomserver/uncomplicatedcustomroles/wiki/Developers-World
Extend EventCustomRole to handle events directly by overriding virtual methods. This example shows handling the OnDroppedItem event.
```csharp
namespace UCRExample
{
internal class MyEventCustomRole : EventCustomRole, ICoroutineRole
{
public override int Id { get; set; } = 99;
public override void OnDroppedItem(DroppedItemEventArgs ev)
{
ev.Player.ShowHint("You just dropped an item!", 2.5f);
}
}
}
```
--------------------------------
### Managing Custom Modules in a SummonedCustomRole
Source: https://github.com/uncomplicatedcustomserver/uncomplicatedcustomroles/wiki/Developers-World
Provides functions to check for module presence, retrieve module instances, get lists of modules, and remove modules from a SummonedCustomRole.
```csharp
// Check if the instance has the PetModule
if (role.HasModule())
// Present!
// Try to get the instance of the module PetModule
if (role.Get(out PetModule module))
module.Execute();
// Get a list of modules with the same base
role.GetModules().Length; // omg 13!
// Get a single Custom Module
role.GetModule();
// Remove the module
role.RemoveModule();
```
--------------------------------
### Nickname Placeholder Usage
Source: https://github.com/uncomplicatedcustomserver/uncomplicatedcustomroles/wiki/Specifics
Demonstrates the use of placeholders within nickname configurations for dynamic customization.
```plaintext
%nick% -> Player's nickname
%rand% -> Random 1 digit number
%dnumber% -> Random 4 digit number
%unitid% -> Current unit Id (for FoundationForces)
%unitname% -> Current unit name (for FoundationForces)
```
--------------------------------
### Creating a Custom Module (No Arguments)
Source: https://github.com/uncomplicatedcustomserver/uncomplicatedcustomroles/wiki/Developers-World
Implement the CustomModule abstract class. Use the empty constructor if the module's functionality does not require an instance of SummonedCustomRole.
```csharp
namespace UCRExample
{
internal class AutoDoorBypassModule : CustomModule
{ }
}
```
--------------------------------
### Clone Repository
Source: https://github.com/uncomplicatedcustomserver/uncomplicatedcustomroles/blob/main/CONTRIBUTING.md
Clone your forked repository to your local machine.
```bash
git clone https://github.com/yourusername/repository-name.git
```
--------------------------------
### Implement ICustomRole Interface
Source: https://github.com/uncomplicatedcustomserver/uncomplicatedcustomroles/wiki/Developers-World
Implement the ICustomRole interface for full customization. All properties must be defined.
```csharp
namespace UCRExample
{
internal class MyCustomRole : ICustomRole
{
public int Id { get; set; }
public string Name { get; set; }
public bool OverrideRoleName { get; set; }
public string Nickname { get; set; }
public string CustomInfo { get; set; }
public string BadgeName { get; set; }
public string BadgeColor { get; set; }
public RoleTypeId Role { get; set; }
public Team? Team { get; set; }
public RoleTypeId RoleAppearance { get; set; }
public List IsFriendOf { get; set; }
public HealthBehaviour Health { get; set; }
public AhpBehaviour Ahp { get; set; }
public List Effects { get; set; }
public StaminaBehaviour Stamina { get; set; }
public int MaxScp330Candies { get; set; }
public bool CanEscape { get; set; }
public Dictionary RoleAfterEscape { get; set; }
public Vector3 Scale { get; set; }
public string SpawnBroadcast { get; set; }
public ushort SpawnBroadcastDuration { get; set; }
public string SpawnHint { get; set; }
public float SpawnHintDuration { get; set; }
public Dictionary CustomInventoryLimits { get; set; }
public List Inventory { get; set; }
public List CustomItemsInventory { get; set; }
public Dictionary Ammo { get; set; }
public float DamageMultiplier { get; set; }
public SpawnBehaviour SpawnSettings { get; set; }
public CustomFlags? CustomFlags { get; set; }
public bool IgnoreSpawnSystem { get; set; }
}
}
```
--------------------------------
### Creating a Custom Module (With SummonedCustomRole Argument)
Source: https://github.com/uncomplicatedcustomserver/uncomplicatedcustomroles/wiki/Developers-World
Implement the CustomModule abstract class. Use the constructor with SummonedCustomRole if the module's functionality requires an instance of the associated role.
```csharp
namespace UCRExample
{
internal class PetModule : CustomModule
{
public PetModule(SummonedCustomRole role) : base(role)
{ }
}
}
```
--------------------------------
### Push to Fork
Source: https://github.com/uncomplicatedcustomserver/uncomplicatedcustomroles/blob/main/CONTRIBUTING.md
Push your new branch to your forked repository.
```bash
git push origin feature/your-feature-name
```
--------------------------------
### YAML Spawn Behaviour Parameters
Source: https://github.com/uncomplicatedcustomserver/uncomplicatedcustomroles/wiki/Specifics
Configure role spawning behavior in YAML, specifying player limits, spawn chance, replaceable roles, spawn location, zones, rooms, and permissions.
```yaml
max_players: 5
min_players: 1
spawn_chance: 60
can_replace_roles:
- ClassD
spawn: RoomsSpawn
spawn_zones: []
spawn_rooms:
- LczToilets
spawn_point:
required_permissions
```
--------------------------------
### C# Spawn Behaviour Parameters
Source: https://github.com/uncomplicatedcustomserver/uncomplicatedcustomroles/wiki/Specifics
Manage role spawning behavior in C# using `SpawnBehaviour`. This includes defining roles that can be replaced, player limits, spawn chance, spawn locations, zones, rooms, and required permissions.
```csharp
public List CanReplaceRoles { get; set; } = new() {
RoleTypeId.ClassD
};
public int MaxPlayers { get; set; } = 10;
public int MinPlayers { get; set; } = 1;
public int SpawnChance { get; set; } = 60;
public SpawnLocationType Spawn { get; set; } = SpawnLocationType.RoomsSpawn;
public List SpawnZones { get; set; } = new();
public List SpawnRooms { get; set; } = new() {
RoomType.LczClassDSpawn
};
public List? SpawnPoint { get; set; } = null
public string? RequiredPermission { get; set; } = string.Empty;
```
--------------------------------
### Create New Branch
Source: https://github.com/uncomplicatedcustomserver/uncomplicatedcustomroles/blob/main/CONTRIBUTING.md
Create a new branch for your feature or bugfix.
```bash
git checkout -b feature/your-feature-name
```
--------------------------------
### Registering a Custom Role
Source: https://github.com/uncomplicatedcustomserver/uncomplicatedcustomroles/wiki/Developers-World
Use the static Register function to load a custom role in the traditional way.
```csharp
namespace UCRExample
{
internal class AnotherCustomRole : CustomRole
{
public override int Id { get; set; } = 69;
public override string Name { get; set; } = "AnotherRole";
}
}
```
```csharp
// You can remove the first part if you do use UncomplicatedCustomRoles.API.Features - you should already know that btw
UncomplicatedCustomRoles.API.Features.CustomRole.Register(new AnotherCustomRole());
```
--------------------------------
### C# Health Management Parameters
Source: https://github.com/uncomplicatedcustomserver/uncomplicatedcustomroles/wiki/Specifics
Configure health, maximum health, Hume Shield, and Hume Shield regeneration using the `HealtBehaviour` class in C#. Set regeneration delay and amount as needed.
```csharp
public float Amount { get; set; } = 100;
public float Maximum { get; set; } = 100;
public float HumeShield { get; set; } = 0;
public float HumeShieldRegenerationAmount { get; set; } = 2;
public float HumeShieldRegenerationDelay { get; set; } = 7.5f;
```
--------------------------------
### Custom Role YAML File Format
Source: https://github.com/uncomplicatedcustomserver/uncomplicatedcustomroles/wiki/Outdated-Home
Defines the basic structure for a custom role configuration file. Ensure each file contains only one custom role.
```yaml
id: 1
name: ...
...
```
--------------------------------
### C# Stamina Management Parameters
Source: https://github.com/uncomplicatedcustomserver/uncomplicatedcustomroles/wiki/Specifics
Handle stamina using the `StaminaBehaviour` class in C#, adjusting regeneration and usage multipliers, or enabling infinite stamina.
```csharp
public float RegenMultiplier { get; set; } = 1;
public float UsageMultiplier { get; set; } = 1;
public bool Infinite { get; set; } = false;
```
--------------------------------
### YAML Stamina Management Parameters
Source: https://github.com/uncomplicatedcustomserver/uncomplicatedcustomroles/wiki/Specifics
Configure stamina regeneration and usage multipliers, or set stamina to infinite using YAML format.
```yaml
regen_multiplier: 1
usage_multiplier: 1
infinite: false
```
--------------------------------
### Define Replaceable Roles for Custom Role Spawn
Source: https://github.com/uncomplicatedcustomserver/uncomplicatedcustomroles/wiki/Specifics
Specify which roles can be replaced by this custom role using the `can_replace_roles` parameter. If the list is empty, any role can potentially be replaced.
```yaml
can_replace_roles:
- NtfPrivate
```
--------------------------------
### YAML Artificial Health (AHP) Management Parameters
Source: https://github.com/uncomplicatedcustomserver/uncomplicatedcustomroles/wiki/Specifics
Configure Artificial Health (AHP) settings such as amount, limit, decay, efficacy, sustain, and persistence in YAML format.
```yaml
amount: 0
limit: 75
decay: 1.2
efficacy: 0.7
sustain: 0
persistant: false
```
--------------------------------
### Commit Changes
Source: https://github.com/uncomplicatedcustomserver/uncomplicatedcustomroles/blob/main/CONTRIBUTING.md
Commit your changes with a descriptive message following conventional commits.
```bash
git commit -m "feat: add new feature"
```
--------------------------------
### Extend CustomRole for Easy Implementation
Source: https://github.com/uncomplicatedcustomserver/uncomplicatedcustomroles/wiki/Developers-World
Extend the CustomRole class for a fast and easy implementation, overriding only necessary default values.
```csharp
namespace UCRExample
{
internal class AnotherCustomRole : CustomRole
{
public override int Id { get; set; } = 69;
public override string Name { get; set; } = "AnotherRole";
}
}
```
--------------------------------
### Set Custom Role to Player
Source: https://github.com/uncomplicatedcustomserver/uncomplicatedcustomroles/wiki/Developers-World
Use this extension method to assign a custom role to a player. This is a synchronous operation.
```csharp
player.SetCustomRole(myBeautifulCustomRole);
```
--------------------------------
### Register Custom Role with Attribute
Source: https://github.com/uncomplicatedcustomserver/uncomplicatedcustomroles/wiki/Developers-World
Automatically register a Custom Role by applying the PluginCustomRole attribute to the class.
```csharp
namespace UCRExample
{
[PluginCustomRole]
internal class AnotherCustomRole : CustomRole
{
public override int Id { get; set; } = 69;
public override string Name { get; set; } = "AnotherRole";
}
}
```
--------------------------------
### Implementing a Coroutine Custom Role
Source: https://github.com/uncomplicatedcustomserver/uncomplicatedcustomroles/wiki/Developers-World
Implement the ICoroutineRole interface to create a custom role with repeating actions. The TickRate property controls the interval for the Tick function.
```csharp
namespace UCRExample
{
[PluginCustomRole]
internal class MyCoroutineCustomRole : CustomRole, ICoroutineRole
{
public override int Id { get; set; } = 56;
public CoroutineHandle CoroutineHandler { get; set; }
public float TickRate { get; set; } = 5f;
public long Frame { get; set; } = -1;
public void Tick(SummonedCustomRole roleInstance)
{
roleInstance.Player.ShowHint("UWU", 1f);
}
}
}
```
--------------------------------
### C# Artificial Health (AHP) Management Parameters
Source: https://github.com/uncomplicatedcustomserver/uncomplicatedcustomroles/wiki/Specifics
Control Artificial Health (AHP) parameters including amount, limit, decay, efficacy, sustain, and persistence using the `AhpBehaviour` class in C#.
```csharp
public float Amount { get; set; } = 0;
public float Limit { get; set; } = 75;
public float Decay { get; set; } = 1.2f;
public float Efficacy { get; set; } = 0.7f;
public float Sustain { get; set; } = 0f;
public bool Persistant { get; set; } = false;
```
--------------------------------
### Configure Role After Escape Scenarios
Source: https://github.com/uncomplicatedcustomserver/uncomplicatedcustomroles/wiki/Specifics
The `role_after_escape` function allows defining player roles based on escape conditions. Specify outcomes for escaping with or without handcuffs, and by custom roles or vanilla teams.
```yaml
role_after_escape:
default: InternalRole Spectator
cuffed by InternalTeam ChaosInsurgency: InternalRole ClassD
```
--------------------------------
### YAML Effect Object Structure
Source: https://github.com/uncomplicatedcustomserver/uncomplicatedcustomroles/wiki/Specifics
Illustrates the YAML representation for custom effects, specifying duration, effect type, intensity, and removability.
```yaml
duration: 5,
effect_type: Bleeding,
intensity: 1
removable: true
```
--------------------------------
### YAML Health Management Parameters
Source: https://github.com/uncomplicatedcustomserver/uncomplicatedcustomroles/wiki/Specifics
Manage health, maximum health, Hume Shield, and Hume Shield regeneration in YAML format. Note that `hume_shield` is active even if not displayed for non-SCP roles.
```yaml
amount: 100
maximum: 100
hume_shield: 0
hume_shield_regeneration_amount: 2
hume_shield_regeneration_delay: 7.5
```
--------------------------------
### Adding a Custom Module to a SummonedCustomRole
Source: https://github.com/uncomplicatedcustomserver/uncomplicatedcustomroles/wiki/Developers-World
Use the AddModule() method to attach a custom module to a SummonedCustomRole instance, enabling its functionality.
```csharp
role.AddModule();
```
--------------------------------
### Check if Player Has Custom Role
Source: https://github.com/uncomplicatedcustomserver/uncomplicatedcustomroles/wiki/Developers-World
Checks if a player currently has a custom role assigned. You can use `HasCustomRole()` if you only need a boolean check, or `TryGetSummonedInstance()` if you need to access the role's information.
```csharp
// You can use two methods
// If you don't need the Custom Role info
if (player.HasCustomRole())
Log.Info("Yeah");
// If you need Custom Role info
if (player.TryGetSummonedInstance(out SummonedCustomRole role))
// Your code...
```
--------------------------------
### Define Teams That Cannot Damage Custom Role
Source: https://github.com/uncomplicatedcustomserver/uncomplicatedcustomroles/wiki/Specifics
Use the `is_friend_of` parameter to specify a list of teams that a custom role cannot damage or be damaged by. This is useful for creating alliances or neutral factions.
```yaml
is_friend_of:
- SCPs
- ChaosInsurgency
```
--------------------------------
### UCR Custom Role C# Properties
Source: https://github.com/uncomplicatedcustomserver/uncomplicatedcustomroles/wiki/Outdated-Home
Defines the abstract properties for a custom role configuration in C#. These properties represent various attributes and settings for a custom role.
```csharp
public abstract int Id { get; set; }
public abstract string Name { get; set; }
public abstract bool OverrideRoleName { get; set; }
public abstract string? Nickname { get; set; }
public abstract string CustomInfo { get; set; }
public abstract string BadgeName { get; set; }
public abstract string BadgeColor { get; set; }
public abstract RoleTypeId Role { get; set; }
public abstract Team? Team { get; set; }
public abstract RoleTypeId RoleAppearance { get; set; }
public abstract List IsFriendOf { get; set; }
public abstract HealthBehaviour Health { get; set; }
public abstract AhpBehaviour Ahp { get; set; }
public abstract List? Effects { get; set; }
public abstract StaminaBehaviour Stamina { get; set; }
public abstract int MaxScp330Candies { get; set; }
public abstract bool CanEscape { get; set; }
public abstract Dictionary RoleAfterEscape { get; set; }
public abstract Vector3 Scale { get; set; }
public abstract string SpawnBroadcast { get; set; }
public abstract ushort SpawnBroadcastDuration { get; set; }
public abstract string SpawnHint { get; set; }
public abstract float SpawnHintDuration { get; set; }
public abstract Dictionary CustomInventoryLimits { get; set; }
public abstract List Inventory { get; set; }
public abstract List CustomItemsInventory { get; set; }
public abstract Dictionary Ammo { get; set; }
public abstract float DamageMultiplier { get; set; }
public abstract SpawnBehaviour? SpawnSettings { get; set; }
public abstract List