From fd9158244e60349b0ea26daf6c5013e7845cc1b8 Mon Sep 17 00:00:00 2001
From: 3cxc <81449257+3cxc@users.noreply.github.com>
Date: Thu, 12 Feb 2026 15:46:14 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20SCP-3114=E7=94=9F=E6=88=90=E6=9C=BA?=
=?UTF-8?q?=E5=88=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Configs/CustomRoleConfig.cs | 19 +++++++++++++++++++
EasyTools.csproj | 1 +
Events/CustomEventHandler.cs | 25 +++++++++++++++++++++++++
3 files changed, 45 insertions(+)
create mode 100644 Configs/CustomRoleConfig.cs
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;