mirror of
https://gitee.com/cssfw/EasyTools.git
synced 2026-03-28 03:51:36 +08:00
feat: SCP-3114生成机制
This commit is contained in:
19
Configs/CustomRoleConfig.cs
Normal file
19
Configs/CustomRoleConfig.cs
Normal file
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -122,6 +122,7 @@
|
|||||||
<Compile Include="Commands\RescueCommand.cs" />
|
<Compile Include="Commands\RescueCommand.cs" />
|
||||||
<Compile Include="Configs\BadgeConfig.cs" />
|
<Compile Include="Configs\BadgeConfig.cs" />
|
||||||
<Compile Include="Configs\Config.cs" />
|
<Compile Include="Configs\Config.cs" />
|
||||||
|
<Compile Include="Configs\CustomRoleConfig.cs" />
|
||||||
<Compile Include="Configs\TranslateConfig.cs" />
|
<Compile Include="Configs\TranslateConfig.cs" />
|
||||||
<Compile Include="Events\CustomEventHandler.cs" />
|
<Compile Include="Events\CustomEventHandler.cs" />
|
||||||
<Compile Include="Plugins.cs" />
|
<Compile Include="Plugins.cs" />
|
||||||
|
|||||||
@@ -37,6 +37,9 @@ namespace EasyTools.Events
|
|||||||
public static TranslateConfig TranslateConfig;
|
public static TranslateConfig TranslateConfig;
|
||||||
|
|
||||||
public static BadgeConfig BadgeConfig;
|
public static BadgeConfig BadgeConfig;
|
||||||
|
|
||||||
|
public static CustomRoleConfig CustomRoleConfig;
|
||||||
|
|
||||||
public static CoroutineHandle Badge_Coroutine;
|
public static CoroutineHandle Badge_Coroutine;
|
||||||
|
|
||||||
public override void OnServerWaitingForPlayers()
|
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)
|
public override void OnPlayerSpawned(PlayerSpawnedEventArgs ev)
|
||||||
{
|
{
|
||||||
Player Player = ev.Player;
|
Player Player = ev.Player;
|
||||||
|
|||||||
Reference in New Issue
Block a user