Add CuffedFrenemies
This commit is contained in:
parent
e099ee5071
commit
5b8dcb282f
66
CuffedFrenemies/CuffedFrenemies.cs
Normal file
66
CuffedFrenemies/CuffedFrenemies.cs
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
using LabApi.Events.Arguments.PlayerEvents;
|
||||||
|
using LabApi.Events.Handlers;
|
||||||
|
using LabApi.Features;
|
||||||
|
using LabApi.Features.Console;
|
||||||
|
using LabApi.Features.Wrappers;
|
||||||
|
using LabApi.Loader.Features.Plugins;
|
||||||
|
using Mirror;
|
||||||
|
using PlayerRoles;
|
||||||
|
|
||||||
|
namespace CuffedFrenemies;
|
||||||
|
|
||||||
|
public class CuffedFrenemies : Plugin
|
||||||
|
{
|
||||||
|
public override string Name => "GamblingCoin";
|
||||||
|
public override string Author => "Code002Lover";
|
||||||
|
public override Version Version { get; } = new(1, 0, 0);
|
||||||
|
public override string Description => "Gamble your life away";
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void OnCuff(PlayerCuffedEventArgs ev)
|
||||||
|
{
|
||||||
|
Logger.Debug($"Team: {ev.Target.Team}");
|
||||||
|
if (ev.Target.Team is Team.ClassD or Team.Scientists)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ev.Target.Team == ev.Player.Team)
|
||||||
|
{
|
||||||
|
Logger.Debug("Same team, not changing role");
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
ev.Target.Position = newPos;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
37
CuffedFrenemies/CuffedFrenemies.csproj
Normal file
37
CuffedFrenemies/CuffedFrenemies.csproj
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>net48</TargetFramework>
|
||||||
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
<Nullable>disable</Nullable>
|
||||||
|
<LangVersion>10</LangVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
|
||||||
|
<DebugType>full</DebugType>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<PropertyGroup Condition=" '$(Configuration)' == 'Release' ">
|
||||||
|
<Optimize>true</Optimize>
|
||||||
|
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
|
||||||
|
<DebugType>none</DebugType>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="Assembly-CSharp">
|
||||||
|
<HintPath>..\..\.local\share\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Assembly-CSharp.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
<Reference Include="Mirror">
|
||||||
|
<HintPath>..\..\.local\share\Steam\steamapps\common\SCP Secret Laboratory Dedicated Server\SCPSL_Data\Managed\Mirror.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" />
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
@ -16,6 +16,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RangeBan", "RangeBan\RangeB
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RangeBan.Tests", "RangeBan.Tests\RangeBan.Tests.csproj", "{AA495D0E-0122-4C26-8D26-C728B65BFF12}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RangeBan.Tests", "RangeBan.Tests\RangeBan.Tests.csproj", "{AA495D0E-0122-4C26-8D26-C728B65BFF12}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CuffedFrenemies", "CuffedFrenemies\CuffedFrenemies.csproj", "{C3FEEC52-B7C0-4DB6-A0CA-54BE175072D8}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
@ -54,5 +56,9 @@ Global
|
|||||||
{AA495D0E-0122-4C26-8D26-C728B65BFF12}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{AA495D0E-0122-4C26-8D26-C728B65BFF12}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{AA495D0E-0122-4C26-8D26-C728B65BFF12}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{AA495D0E-0122-4C26-8D26-C728B65BFF12}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{AA495D0E-0122-4C26-8D26-C728B65BFF12}.Release|Any CPU.Build.0 = Release|Any CPU
|
{AA495D0E-0122-4C26-8D26-C728B65BFF12}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{C3FEEC52-B7C0-4DB6-A0CA-54BE175072D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{C3FEEC52-B7C0-4DB6-A0CA-54BE175072D8}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{C3FEEC52-B7C0-4DB6-A0CA-54BE175072D8}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{C3FEEC52-B7C0-4DB6-A0CA-54BE175072D8}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
Loading…
x
Reference in New Issue
Block a user