Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions EXILED/EXILED.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.4.33205.214
# Visual Studio Version 18
VisualStudioVersion = 18.3.11512.155 d18.3
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Exiled.Events", "Exiled.Events\Exiled.Events.csproj", "{1E6C4350-5067-4CE7-91DB-6420D027A4FC}"
EndProject
Expand All @@ -23,6 +23,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Exiled.CustomRoles", "Exile
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "docs", "docs\docs.csproj", "{BE130A80-6819-44C6-AA1B-BF068DEA67FF}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Exiled.Utility", "Exiled.Utility\Exiled.Utility.csproj", "{70A4E012-0DBB-18AA-A972-770281EEF726}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -82,6 +84,12 @@ Global
{BE130A80-6819-44C6-AA1B-BF068DEA67FF}.Installer|Any CPU.Build.0 = Installer|Any CPU
{BE130A80-6819-44C6-AA1B-BF068DEA67FF}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BE130A80-6819-44C6-AA1B-BF068DEA67FF}.Release|Any CPU.Build.0 = Release|Any CPU
{70A4E012-0DBB-18AA-A972-770281EEF726}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{70A4E012-0DBB-18AA-A972-770281EEF726}.Debug|Any CPU.Build.0 = Debug|Any CPU
{70A4E012-0DBB-18AA-A972-770281EEF726}.Installer|Any CPU.ActiveCfg = Installer|Any CPU
{70A4E012-0DBB-18AA-A972-770281EEF726}.Installer|Any CPU.Build.0 = Installer|Any CPU
{70A4E012-0DBB-18AA-A972-770281EEF726}.Release|Any CPU.ActiveCfg = Release|Any CPU
{70A4E012-0DBB-18AA-A972-770281EEF726}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
1 change: 0 additions & 1 deletion EXILED/Exiled.Events/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ public sealed class Config : IConfig
/// <summary>
/// Gets or sets a value indicating whether keycard throw can affect basic doors.
/// </summary>
/// TODO: Make a poll about removing this config. (unimplemented since 9.6.0-beta7)
[Description("Indicates whether thrown keycards can affect doors that don't require any permissions")]
public bool CanKeycardThrowAffectDoors { get; set; } = false;

Expand Down
2 changes: 1 addition & 1 deletion EXILED/Exiled.Events/Handlers/Internal/Round.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public static void OnActivatingSense(ActivatingSenseEventArgs ev)
{
if (ev.Target is null)
return;
if ((Events.Instance.Config.CanScp049SenseTutorial || ev.Target.Role.Type is not RoleTypeId.Tutorial) && !Scp049Role.TurnedPlayers.Contains(ev.Target))
if (!Scp049Role.TurnedPlayers.Contains(ev.Target))
return;
ev.Target = ev.Scp049.SenseAbility.CanFindTarget(out ReferenceHub hub) ? Player.Get(hub) : null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ namespace Exiled.Events.Patches.Events.Map

/// <summary>
/// Patches <see cref="FlashbangGrenade.ServerFuseEnd()"/>.
/// Adds the <see cref="Handlers.Map.ExplodingGrenade"/> event and <see cref="Config.CanFlashbangsAffectThrower"/>.
/// Adds the <see cref="Handlers.Map.ExplodingGrenade"/> event"/>.
/// </summary>
[HarmonyPatch(typeof(FlashbangGrenade), nameof(FlashbangGrenade.ServerFuseEnd))]
internal static class ExplodingFlashGrenade
Expand Down Expand Up @@ -69,10 +69,7 @@ private static void ProcessEvent(FlashbangGrenade instance, float distance)
if ((instance.transform.position - player.Position).sqrMagnitude > distance)
continue;

if (!ExiledEvents.Instance.Config.CanFlashbangsAffectThrower && instance.PreviousOwner.CompareLife(player.ReferenceHub))
continue;

if (!IndividualFriendlyFire.CheckFriendlyFirePlayer(instance.PreviousOwner, player.ReferenceHub) && !instance.PreviousOwner.CompareLife(player.ReferenceHub))
if (!IndividualFriendlyFire.CheckFriendlyFirePlayer(instance.PreviousOwner, player.ReferenceHub))
continue;

if (Physics.Linecast(instance.transform.position, player.CameraTransform.position, instance.BlindingMask))
Expand Down
17 changes: 1 addition & 16 deletions EXILED/Exiled.Events/Patches/Generic/CanScp049SenseTutorial.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
int index = newInstructions.FindIndex(instruction => instruction.opcode == OpCodes.Brfalse);

Label continueLabel = (Label)newInstructions[index].operand;
Label skip = generator.DefineLabel();

index += 1;

Expand All @@ -46,22 +45,8 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
index,
new[]
{
// if (referenceHub.roleManager.CurrentRole.RoleTypeId == RoleTypeId.Tutorial)
new(OpCodes.Ldloc_S, 6),
new(OpCodes.Ldfld, Field(typeof(ReferenceHub), nameof(ReferenceHub.roleManager))),
new(OpCodes.Callvirt, PropertyGetter(typeof(PlayerRoleManager), nameof(PlayerRoleManager.CurrentRole))),
new(OpCodes.Callvirt, PropertyGetter(typeof(PlayerRoleBase), nameof(PlayerRoleBase.RoleTypeId))),
new(OpCodes.Ldc_I4_S, (sbyte)RoleTypeId.Tutorial),
new(OpCodes.Bne_Un_S, skip),

// if (!ExiledEvents.Instance.Config.CanScp049SenseTutorial)
new(OpCodes.Call, PropertyGetter(typeof(ExiledEvents), nameof(ExiledEvents.Instance))),
new(OpCodes.Callvirt, PropertyGetter(typeof(Plugin<Config>), nameof(Plugin<Config>.Config))),
new(OpCodes.Callvirt, PropertyGetter(typeof(Config), nameof(Config.CanScp049SenseTutorial))),
new(OpCodes.Brfalse_S, continueLabel),

// if (Scp049Role.TurnedPlayers.Contains(Player.Get(referenceHub)))
new CodeInstruction(OpCodes.Call, PropertyGetter(typeof(API.Features.Roles.Scp049Role), nameof(API.Features.Roles.Scp049Role.TurnedPlayers))).WithLabels(skip),
new CodeInstruction(OpCodes.Call, PropertyGetter(typeof(API.Features.Roles.Scp049Role), nameof(API.Features.Roles.Scp049Role.TurnedPlayers))),
new(OpCodes.Ldloc_S, 6),
new(OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new[] { typeof(ReferenceHub) })),
new(OpCodes.Callvirt, Method(typeof(HashSet<Player>), nameof(HashSet<Player>.Contains))),
Expand Down
27 changes: 3 additions & 24 deletions EXILED/Exiled.Events/Patches/Generic/ParseVisionInformation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,37 +38,16 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi

Label returnLabel = generator.DefineLabel();

// Second check pointer
// We use it to pass execution
// to the second check if the first check fails,
// otherwise the second check won't be executed
Label secondCheckPointer = generator.DefineLabel();

newInstructions[0].labels.Add(continueLabel);

// if (referenceHub.roleManager.CurrentRole.RoleTypeId == RoleTypeId.Tutorial && !ExiledEvents.Instance.Config.CanTutorialTriggerScp096
// || Scp096Role.TurnedPlayers.Contains(Player.Get(referenceHub)))
// if (!Scp096Role.TurnedPlayers.Contains(Player.Get(referenceHub)))
// return false;
newInstructions.InsertRange(
0,
new[]
{
// if ((referenceHub.roleManager.CurrentRole.RoleTypeId == RoleTypeId.Tutorial &&
new(OpCodes.Ldarg_1),
new(OpCodes.Ldfld, Field(typeof(ReferenceHub), nameof(ReferenceHub.roleManager))),
new(OpCodes.Callvirt, PropertyGetter(typeof(PlayerRoleManager), nameof(PlayerRoleManager.CurrentRole))),
new(OpCodes.Callvirt, PropertyGetter(typeof(PlayerRoleBase), nameof(PlayerRoleBase.RoleTypeId))),
new(OpCodes.Ldc_I4_S, (sbyte)RoleTypeId.Tutorial),
new(OpCodes.Bne_Un_S, secondCheckPointer),

// !ExiledEvents.Instance.Config.CanTutorialTriggerScp096)
new(OpCodes.Call, PropertyGetter(typeof(ExiledEvents), nameof(ExiledEvents.Instance))),
new(OpCodes.Callvirt, PropertyGetter(typeof(Plugin<Config>), nameof(Plugin<Config>.Config))),
new(OpCodes.Callvirt, PropertyGetter(typeof(Config), nameof(Config.CanTutorialTriggerScp096))),
new(OpCodes.Brfalse_S, returnLabel),

// || Scp096Role.TurnedPlayers.Contains(Player.Get(referenceHub))
new CodeInstruction(OpCodes.Call, PropertyGetter(typeof(Scp096Role), nameof(Scp096Role.TurnedPlayers))).WithLabels(secondCheckPointer),
// if (!Scp096Role.TurnedPlayers.Contains(Player.Get(referenceHub)))
new CodeInstruction(OpCodes.Call, PropertyGetter(typeof(Scp096Role), nameof(Scp096Role.TurnedPlayers))),
new(OpCodes.Ldarg_1),
new(OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new[] { typeof(ReferenceHub) })),
new(OpCodes.Callvirt, Method(typeof(HashSet<Player>), nameof(HashSet<Player>.Contains))),
Expand Down
2 changes: 1 addition & 1 deletion EXILED/Exiled.Events/Patches/Generic/Scp173BeingLooked.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi

private static bool HelpMethod(Scp173ObserversTracker instance, ReferenceHub targetHub)
{
return Player.Get(targetHub) is Player player && ((player.Role.Type == RoleTypeId.Tutorial && !ExiledEvents.Instance.Config.CanTutorialBlockScp173) || Scp173Role.TurnedPlayers.Contains(player)) && instance.IsObservedBy(targetHub, Scp173ObserversTracker.WidthMultiplier);
return Player.Get(targetHub) is Player player && Scp173Role.TurnedPlayers.Contains(player) && instance.IsObservedBy(targetHub, Scp173ObserversTracker.WidthMultiplier);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// </copyright>
// -----------------------------------------------------------------------

namespace Exiled.Events.Commands
namespace Exiled.Utility.Commands
{
using System;

Expand Down
83 changes: 83 additions & 0 deletions EXILED/Exiled.Utility/Config.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
// -----------------------------------------------------------------------
// <copyright file="Config.cs" company="ExMod Team">
// Copyright (c) ExMod Team. All rights reserved.
// Licensed under the CC BY-SA 3.0 license.
// </copyright>
// -----------------------------------------------------------------------

namespace Exiled.Utility
{
using System.Collections.Generic;
using System.ComponentModel;

using API.Interfaces;
using Decals;
using Exiled.Utility.Enums;
using PlayerRoles;

/// <inheritdoc cref="IConfig"/>
public sealed class Config : IConfig
{
/// <inheritdoc/>
public bool IsEnabled { get; set; } = true;

/// <inheritdoc/>
public bool Debug { get; set; }

/// <summary>
/// Gets or sets a value indicating whether SCP-173 can be blocked by the tutorial.
/// </summary>
[Description("Indicates whether RoleTypeId or CustomRole(Name or Id) prevented behaviours")]
public Dictionary<string, NewEnumForAllStuffThatWasAboutTutorial> NewStuffThatWasAboutTutorial { get; set; } =
Events.Events.Instance.Config.CanTutorialBlockScp173 ?
new()
{
{ RoleTypeId.Tutorial.ToString(), NewEnumForAllStuffThatWasAboutTutorial.CanBlockScp173 },
}
: new() { };

/*
/// <summary>
/// Gets or sets a value indicating whether SCP-096 can be triggered by the tutorial.
/// </summary>
[Description("Indicates whether SCP-096 can be triggered by the tutorial")]
public bool CanTutorialTriggerScp096 { get; set; } = true;

/// <summary>
/// Gets or sets a value indicating whether SCP-049 can activate the sense ability on tutorials.
/// </summary>
[Description("Indicates whether SCP-049 can sense tutorial players")]
public bool CanScp049SenseTutorial { get; set; } = true;

/// <summary>
/// Gets or sets a value indicating whether tutorial is affected by SCP-079 scan.
/// </summary>
[Description("Indicates whether tutorial is affected by SCP-079 scan.")]
public bool TutorialNotAffectedByScp079Scan { get; set; } = false;
*/

/// <summary>
/// Gets or sets a value indicating whether flashbangs flash original thrower.
/// </summary>
[Description("Indicates whether flashbangs flash original thrower.")]
public bool CanFlashbangsAffectThrower { get; set; } = Events.Events.Instance.Config.CanFlashbangsAffectThrower;

/// <summary>
/// Gets or sets a value indicating whether the inventory should be dropped before being set as spectator, through commands or plugins.
/// </summary>
[Description("Indicates whether the inventory should be dropped before being set as spectator, through commands or plugins")]
public bool ShouldDropInventory { get; set; } = Events.Events.Instance.Config.ShouldDropInventory;

/// <summary>
/// Gets or sets a value indicating whether Decal spawned.
/// </summary>
[Description("Indicates whether the Decal (Blood, Bullet, Buckshot, GlassCrack) can be spawned")]
public List<DecalPoolType> PreventDecalSpawn { get; set; } = Events.Events.Instance.Config.CanSpawnBlood ? new() { DecalPoolType.Blood } : new() { };

/// <summary>
/// Gets or sets a value indicating whether the SCP079 will recontained if there are no SCPs left.
/// </summary>
[Description("Indicates whether the SCP079 will recontained if there are no SCPs left.")]
public bool RecontainScp079IfNoScpsLeft { get; set; } = Events.Events.Instance.Config.RecontainScp079IfNoScpsLeft;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
// -----------------------------------------------------------------------
// <copyright file="NewEnumForAllStuffThatWasAboutTutorial.cs" company="ExMod Team">
// Copyright (c) ExMod Team. All rights reserved.
// Licensed under the CC BY-SA 3.0 license.
// </copyright>
// -----------------------------------------------------------------------

namespace Exiled.Utility.Enums
{
using System;

/// <summary>
/// All available screen aspect ratio types.
/// </summary>
[Flags]
public enum NewEnumForAllStuffThatWasAboutTutorial
{
/// <summary>
/// Unknown aspect ratio.
/// </summary>
None = 0,

/// <summary>
/// Prevent from blocking Scp173.
/// </summary>
CanBlockScp173 = 1,

/// <summary>
/// Prevent from being target of Scp096.
/// </summary>
CanTriggerScp096 = 2,

/// <summary>
/// Prevent from being target of Scp049.
/// </summary>
CanScp049Sense = 4,

/// <summary>
/// Prevent Player to be Alarmed by Scp079.
/// </summary>
NotAffectedByScp079Scan = 8,
}
}
52 changes: 52 additions & 0 deletions EXILED/Exiled.Utility/Exiled.Utility.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Library</OutputType>
<AssemblyName>Exiled.Utility</AssemblyName>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Configurations>Debug;Release;Installer</Configurations>
<Platforms>AnyCPU</Platforms>
</PropertyGroup>

<Import Project="../EXILED.props" />

<ItemGroup>
<ProjectReference Include="..\Exiled.API\Exiled.API.csproj" />
<ProjectReference Include="..\Exiled.Events\Exiled.Events.csproj" />
<ProjectReference Include="..\Exiled.Loader\Exiled.Loader.csproj" />
<ProjectReference Include="..\Exiled.Permissions\Exiled.Permissions.csproj" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="StyleCop.Analyzers" Version="$(StyleCopVersion)" IncludeAssets="All" PrivateAssets="All" />
<PackageReference Include="Lib.Harmony" Version="$(HarmonyVersion)" />
</ItemGroup>

<ItemGroup>
<Reference Include="Assembly-CSharp" HintPath="$(EXILED_REFERENCES)\Assembly-CSharp-Publicized.dll" Private="false" />
<Reference Include="Assembly-CSharp-firstpass" HintPath="$(EXILED_REFERENCES)\Assembly-CSharp-firstpass.dll" Private="false" />
<Reference Include="CommandSystem.Core" HintPath="$(EXILED_REFERENCES)\CommandSystem.Core.dll" Private="false" />
<Reference Include="LabApi" HintPath="$(EXILED_REFERENCES)\LabApi.dll" Private="false" />
<Reference Include="Pooling" HintPath="$(EXILED_REFERENCES)\Pooling.dll" Private="false" />
<Reference Include="Mirror" HintPath="$(EXILED_REFERENCES)\Mirror.dll" Private="false" />
<Reference Include="NorthwoodLib" HintPath="$(EXILED_REFERENCES)\NorthwoodLib.dll" Private="false" />
<Reference Include="System.Net.Http" />
<Reference Include="UnityEngine" HintPath="$(EXILED_REFERENCES)\UnityEngine.dll" Private="false" />
<Reference Include="UnityEngine.AudioModule" HintPath="$(EXILED_REFERENCES)\UnityEngine.AudioModule.dll" Private="false" />
<Reference Include="UnityEngine.AnimationModule" HintPath="$(EXILED_REFERENCES)\UnityEngine.AnimationModule.dll" Private="false" />
<Reference Include="UnityEngine.CoreModule" HintPath="$(EXILED_REFERENCES)\UnityEngine.CoreModule.dll" Private="false" />
<Reference Include="UnityEngine.PhysicsModule" HintPath="$(EXILED_REFERENCES)\UnityEngine.PhysicsModule.dll" Private="false" />
<Reference Include="YamlDotNet" HintPath="$(EXILED_REFERENCES)\YamlDotNet.dll" Private="false" />
<Reference Include="mscorlib" HintPath="$(EXILED_REFERENCES)\mscorlib.dll" Private="false" />
<Reference Include="System" HintPath="$(EXILED_REFERENCES)\System.dll" Private="false" />
</ItemGroup>

<PropertyGroup Condition=" '$(OS)' == 'Windows_NT' ">
<PostBuildEvent>if not "$(EXILED_DEV_REFERENCES)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\"</PostBuildEvent>
</PropertyGroup>
<PropertyGroup Condition=" '$(OS)' == 'Unix' ">
<PostBuildEvent>if [[ ! -z "$EXILED_DEV_REFERENCES" ]]; then cp "$(OutputPath)$(AssemblyName).dll" "$EXILED_DEV_REFERENCES/Plugins/"; fi</PostBuildEvent>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// </copyright>
// -----------------------------------------------------------------------

namespace Exiled.Events.Patches.Generic
namespace Exiled.Utility.Patches
{
using System.Collections.Generic;
using System.Reflection.Emit;
Expand Down Expand Up @@ -37,8 +37,8 @@ private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstructi
{
// if (!Events.Instance.Config.ShouldScp079RecontainedWhenNoScps)
// return;
new CodeInstruction(OpCodes.Call, PropertyGetter(typeof(Exiled.Events.Events), nameof(Exiled.Events.Events.Instance))),
new(OpCodes.Callvirt, PropertyGetter(typeof(Exiled.Events.Events), nameof(Exiled.Events.Events.Config))),
new CodeInstruction(OpCodes.Call, PropertyGetter(typeof(Events.Events), nameof(Exiled.Events.Events.Instance))),
new(OpCodes.Callvirt, PropertyGetter(typeof(Events.Events), nameof(Exiled.Events.Events.Config))),
new(OpCodes.Callvirt, PropertyGetter(typeof(Config), nameof(Config.RecontainScp079IfNoScpsLeft))),
new(OpCodes.Brfalse_S, ret),
});
Expand Down
Loading
Loading