diff --git a/Configs/CustomRoleConfig.cs b/Configs/CustomRoleConfig.cs
new file mode 100644
index 0000000..a9abb77
--- /dev/null
+++ b/Configs/CustomRoleConfig.cs
@@ -0,0 +1,19 @@
+using LabApi.Loader.Features.Paths;
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace EasyTools.Configs
+{
+ public class CustomRoleConfig
+ {
+ [Description("开启3114?")]
+ public bool spawn_scp_3114 { get; set; } = false;
+ [Description("当有多少人时才会生成3114?")]
+ public int spawn_scp_3114_limit { get; set; } = 8;
+ }
+}
diff --git a/EasyTools.csproj b/EasyTools.csproj
index c2056ee..78140f9 100644
--- a/EasyTools.csproj
+++ b/EasyTools.csproj
@@ -122,6 +122,7 @@
+
diff --git a/Events/CustomEventHandler.cs b/Events/CustomEventHandler.cs
index 2cd015e..66973a5 100644
--- a/Events/CustomEventHandler.cs
+++ b/Events/CustomEventHandler.cs
@@ -37,6 +37,9 @@ namespace EasyTools.Events
public static TranslateConfig TranslateConfig;
public static BadgeConfig BadgeConfig;
+
+ public static CustomRoleConfig CustomRoleConfig;
+
public static CoroutineHandle Badge_Coroutine;
public override void OnServerWaitingForPlayers()
@@ -170,6 +173,28 @@ namespace EasyTools.Events
}
}
+ public static bool scp_3114_spawned = false; //用以确保不会重复生成SCP-3114
+
+ public override void OnPlayerSpawning(PlayerSpawningEventArgs ev)
+ {
+ if (CustomRoleConfig.spawn_scp_3114 && Player.ReadyList.Count() >= CustomRoleConfig.spawn_scp_3114_limit && !scp_3114_spawned)
+ {
+ foreach (Player p in Player.ReadyList)
+ {
+ bool weaponIndex = UnityEngine.Random.Range(0, 10) == 3;
+ if (weaponIndex)
+ {
+ Timing.CallDelayed(0.5f, () =>
+ {
+ ev.Player.Role = RoleTypeId.Scp3114;
+ ev.IsAllowed = true;
+ scp_3114_spawned = true;
+ });
+ }
+ }
+ }
+ }
+
public override void OnPlayerSpawned(PlayerSpawnedEventArgs ev)
{
Player Player = ev.Player;