refactor
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
using CustomPlayerEffects;
|
||||
using LabApi.Events.Arguments.PlayerEvents;
|
||||
using LabApi.Events.Arguments.PlayerEvents;
|
||||
using LabApi.Events.Handlers;
|
||||
using LabApi.Features;
|
||||
using LabApi.Features.Console;
|
||||
@@ -7,8 +6,6 @@ using LabApi.Features.Wrappers;
|
||||
using LabApi.Loader.Features.Plugins;
|
||||
using Mirror;
|
||||
using PlayerRoles;
|
||||
using PlayerRoles.PlayableScps.Scp3114;
|
||||
using PlayerRoles.Ragdolls;
|
||||
|
||||
namespace CuffedFrenemies;
|
||||
|
||||
@@ -16,16 +13,16 @@ public class CuffedFrenemies : Plugin
|
||||
{
|
||||
public override string Name => "CuffedFrenemies";
|
||||
public override string Author => "Code002Lover";
|
||||
public override Version Version { get; } = new(1, 0, 0);
|
||||
public override Version Version { get; } = new(1, 0, 0);
|
||||
public override string Description => "Cuff your enemies";
|
||||
public override Version RequiredApiVersion { get; } = new (LabApiProperties.CompiledVersion);
|
||||
|
||||
public override Version RequiredApiVersion { get; } = new(LabApiProperties.CompiledVersion);
|
||||
|
||||
public override void Enable()
|
||||
{
|
||||
Logger.Debug("Loading");
|
||||
PlayerEvents.Cuffed += OnCuff;
|
||||
}
|
||||
|
||||
|
||||
public override void Disable()
|
||||
{
|
||||
PlayerEvents.Cuffed -= OnCuff;
|
||||
@@ -33,10 +30,7 @@ public class CuffedFrenemies : Plugin
|
||||
|
||||
private static void OnCuff(PlayerCuffedEventArgs ev)
|
||||
{
|
||||
if (ev.Target.Team is Team.ClassD or Team.Scientists)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (ev.Target.Team is Team.ClassD or Team.Scientists) return;
|
||||
|
||||
if (ev.Target.Team == ev.Player.Team)
|
||||
{
|
||||
@@ -44,30 +38,23 @@ public class CuffedFrenemies : Plugin
|
||||
return;
|
||||
}
|
||||
|
||||
if (ev.Target.Team is Team.SCPs or Team.Dead)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (ev.Target.Team is Team.SCPs or Team.Dead) return;
|
||||
|
||||
var newRole = ev.Target.Team == Team.ChaosInsurgency ? RoleTypeId.NtfPrivate : RoleTypeId.ChaosConscript;
|
||||
Logger.Debug($"Setting role to {newRole}");
|
||||
var newItems = new List<Item>();
|
||||
ev.Target.Items.CopyTo(newItems);
|
||||
newItems.Reverse();
|
||||
|
||||
|
||||
var newPos = ev.Target.Position;
|
||||
|
||||
|
||||
ev.Target.Inventory.UserInventory.Items.Clear();
|
||||
|
||||
|
||||
ev.Target.SetRole(newRole);
|
||||
ev.Target.ClearItems();
|
||||
|
||||
foreach (var newItem in newItems)
|
||||
{
|
||||
ev.Target.Inventory.UserInventory.Items.Add(newItem.Serial,newItem.Base);
|
||||
}
|
||||
|
||||
foreach (var newItem in newItems) ev.Target.Inventory.UserInventory.Items.Add(newItem.Serial, newItem.Base);
|
||||
|
||||
ev.Target.Position = newPos;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -26,15 +26,12 @@
|
||||
<Reference Include="Mirror">
|
||||
<HintPath>..\..\.local\share\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Mirror.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Pooling">
|
||||
<HintPath>..\..\.local\share\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Pooling.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.CoreModule">
|
||||
<HintPath>..\..\.local\share\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Northwood.LabAPI" Version="1.0.2" />
|
||||
<PackageReference Include="Northwood.LabAPI" Version="1.0.2"/>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
||||
Reference in New Issue
Block a user