feat: SCP-3114生成机制

This commit is contained in:
3cxc
2026-02-12 15:46:14 +08:00
parent 453c90f0c3
commit fd9158244e
3 changed files with 45 additions and 0 deletions

View File

@@ -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;