diff --git a/.github/workflows/pull_request_opened.yml b/.github/workflows/pull_request_opened.yml index 6e22488523..bd4aa3ba43 100644 --- a/.github/workflows/pull_request_opened.yml +++ b/.github/workflows/pull_request_opened.yml @@ -17,7 +17,7 @@ jobs: pull-requests: write runs-on: ubuntu-latest steps: - - uses: actions/labeler@v5.0.0 + - uses: actions/labeler with: repo-token: ${{ secrets.GITHUB_TOKEN }} configuration-path: .github/labeler.yml diff --git a/EXILED/.editorconfig b/EXILED/.editorconfig index b64d58c275..e5ab37f77f 100644 --- a/EXILED/.editorconfig +++ b/EXILED/.editorconfig @@ -19,10 +19,37 @@ ij_wrap_on_typing = false csharp_style_var_for_built_in_types = false:error csharp_style_var_when_type_is_apparent = false:error csharp_style_var_elsewhere = false:error +dotnet_diagnostic.IDE0005.severity = warning +dotnet_diagnostic.IDE0017.severity = warning +dotnet_diagnostic.IDE0019.severity = warning +dotnet_diagnostic.IDE0031.severity = warning +dotnet_diagnostic.IDE0048.severity = warning +dotnet_diagnostic.IDE0055.severity = warning +dotnet_diagnostic.IDE0060.severity = warning +dotnet_diagnostic.IDE0074.severity = warning +dotnet_diagnostic.IDE0079.severity = warning +dotnet_diagnostic.IDE0090.severity = warning +dotnet_diagnostic.IDE0200.severity = warning +dotnet_diagnostic.IDE0350.severity = warning +dotnet_diagnostic.IDE0370.severity = warning + +dotnet_diagnostic.IDE0028.severity = none +dotnet_diagnostic.IDE0034.severity = none +dotnet_diagnostic.IDE0056.severity = none +dotnet_diagnostic.IDE0057.severity = none +dotnet_diagnostic.IDE0290.severity = none +dotnet_diagnostic.IDE0300.severity = none +dotnet_diagnostic.IDE0301.severity = none +dotnet_diagnostic.IDE0302.severity = none +dotnet_diagnostic.IDE0303.severity = none +dotnet_diagnostic.IDE0304.severity = none dotnet_diagnostic.IDE0305.severity = none +dotnet_diagnostic.IDE0306.severity = none +dotnet_diagnostic.IDE0340.severity = none -# ReSharper properties -resharper_csharp_max_line_length = 400 +dotnet_sort_system_directives_first = true +dotnet_separate_import_directive_groups = true +csharp_using_directive_placement = inside_namespace [*.properties] ij_properties_align_group_field_declarations = false diff --git a/EXILED/EXILED.props b/EXILED/EXILED.props index a11c9a7429..dca755b61b 100644 --- a/EXILED/EXILED.props +++ b/EXILED/EXILED.props @@ -7,7 +7,7 @@ net48 - 13.0 + 14.0 x64 false $(MSBuildThisFileDirectory)\bin\$(Configuration)\ @@ -19,8 +19,8 @@ false - 2.2.2 - 1.1.118 + 2.4.2 + 1.2.0-beta.556 2.0.2 Copyright © $(Authors) 2020 - $([System.DateTime]::Now.ToString("yyyy")) @@ -35,6 +35,7 @@ True True + True Portable diff --git a/EXILED/Exiled.API/Enums/AmmoType.cs b/EXILED/Exiled.API/Enums/AmmoType.cs index cad8ceb9f2..e0cae8bd12 100644 --- a/EXILED/Exiled.API/Enums/AmmoType.cs +++ b/EXILED/Exiled.API/Enums/AmmoType.cs @@ -40,18 +40,18 @@ public enum AmmoType /// /// 12 gauge shotgun ammo. - /// Used by + /// Used by . /// Ammo12Gauge, /// /// 44 Caliber Revolver Ammo - /// Used by + /// Used by . /// Ammo44Cal, /// - /// Custom has been modified by a plugin + /// Custom has been modified by a plugin. /// Custom, } diff --git a/EXILED/Exiled.API/Enums/AspectRatioType.cs b/EXILED/Exiled.API/Enums/AspectRatioType.cs index 79e4f4c96e..65d6005749 100644 --- a/EXILED/Exiled.API/Enums/AspectRatioType.cs +++ b/EXILED/Exiled.API/Enums/AspectRatioType.cs @@ -57,4 +57,4 @@ public enum AspectRatioType : byte /// Ratio32_9, } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Enums/CameraType.cs b/EXILED/Exiled.API/Enums/CameraType.cs index 292da90b2d..eb18b59633 100644 --- a/EXILED/Exiled.API/Enums/CameraType.cs +++ b/EXILED/Exiled.API/Enums/CameraType.cs @@ -166,4 +166,4 @@ public enum CameraType HczLoadingBayStairwell, #endregion } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Enums/DamageType.cs b/EXILED/Exiled.API/Enums/DamageType.cs index bb6f2524d5..b1b9c8df25 100644 --- a/EXILED/Exiled.API/Enums/DamageType.cs +++ b/EXILED/Exiled.API/Enums/DamageType.cs @@ -60,9 +60,9 @@ public enum DamageType Firearm, /// - /// Damage dealt by a . + /// Damage dealt by a when . /// - MicroHid, + MicroHidPrimaryFire, /// /// Damage dealt by a Tesla Gate. @@ -77,7 +77,7 @@ public enum DamageType /// /// Damage dealt by frag grenades. /// - Explosion, + ExplosionGrenade, /// /// Damage dealt by SCP-018. @@ -135,9 +135,9 @@ public enum DamageType Scp049, /// - /// Damage caused by . + /// Damage caused by with unspecified .. /// - Scp096, + Scp096Other, /// /// Damage caused by . @@ -145,9 +145,9 @@ public enum DamageType Scp173, /// - /// Damage caused by . + /// Damage caused by with . /// - Scp939, + Scp939None, /// /// Damage caused by . @@ -240,7 +240,7 @@ public enum DamageType A7, /// - /// Damage caused by + /// Damage caused by . /// Scp3114, @@ -288,5 +288,85 @@ public enum DamageType /// Damage caused by . /// Scp1509, + + /// + /// Damage caused by with . + /// + Scp939Claw, + + /// + /// Damage caused by with . + /// + Scp939LungeTarget, + + /// + /// Damage caused by with . + /// + Scp939LungeSecondary, + + /// + /// Damage caused by with . + /// + Scp096GateKill, + + /// + /// Damage caused by with . + /// + Scp096SlapLeft, + + /// + /// Damage caused by with . + /// + Scp096SlapRight, + + /// + /// Damage caused by with . + /// + Scp096Charge, + + /// + /// Damage caused by when it's stealing the skin of a . + /// + Scp3114SkinSteal, + + /// + /// Damage cause by the of ."/>. + /// + ExplosionScp018, + + /// + /// Damage cause by the of combining with ."/>. + /// + ExplosionCola, + + /// + /// Damage cause by the of ."/>. + /// + ExplosionPinkCandy, + + /// + /// Damage cause by the ray of ."/>. + /// + ExplosionDisruptor, + + /// + /// Damage cause by the of ."/>. + /// + ExplosionJailbird, + + /// + /// Damage cause by the explosion of or any other not valid ExplosionType."/>. + /// + ExplosionCustom, + + /// + /// Damage dealt by a when . + /// + MicroHidChargeFire, + + /// + /// Damage dealt by a when . + /// + MicroHidBrokenFire, } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Enums/DanceType.cs b/EXILED/Exiled.API/Enums/DanceType.cs index 685c01ed00..94f5eaac16 100644 --- a/EXILED/Exiled.API/Enums/DanceType.cs +++ b/EXILED/Exiled.API/Enums/DanceType.cs @@ -48,7 +48,7 @@ public enum DanceType : byte Swing, /// - /// Dance1 + /// None. /// None = byte.MaxValue, } diff --git a/EXILED/Exiled.API/Enums/DecontaminationState.cs b/EXILED/Exiled.API/Enums/DecontaminationState.cs index c415a6750e..d821f75a5d 100644 --- a/EXILED/Exiled.API/Enums/DecontaminationState.cs +++ b/EXILED/Exiled.API/Enums/DecontaminationState.cs @@ -7,8 +7,6 @@ namespace Exiled.API.Enums { - using System; - using Features; /// @@ -57,4 +55,4 @@ public enum DecontaminationState /// Finish, } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Enums/DoorLockType.cs b/EXILED/Exiled.API/Enums/DoorLockType.cs index b876c24c11..28b5e5447f 100644 --- a/EXILED/Exiled.API/Enums/DoorLockType.cs +++ b/EXILED/Exiled.API/Enums/DoorLockType.cs @@ -74,4 +74,4 @@ public enum DoorLockType /// Lockdown2176 = 512, } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Enums/DoorType.cs b/EXILED/Exiled.API/Enums/DoorType.cs index 5e99c32a22..2df0eb8973 100644 --- a/EXILED/Exiled.API/Enums/DoorType.cs +++ b/EXILED/Exiled.API/Enums/DoorType.cs @@ -10,6 +10,7 @@ namespace Exiled.API.Enums using System; using Exiled.API.Features.Doors; + using Interactables.Interobjects; /// diff --git a/EXILED/Exiled.API/Enums/EffectCategory.cs b/EXILED/Exiled.API/Enums/EffectCategory.cs index c340fca101..cb8af3a988 100644 --- a/EXILED/Exiled.API/Enums/EffectCategory.cs +++ b/EXILED/Exiled.API/Enums/EffectCategory.cs @@ -39,4 +39,4 @@ public enum EffectCategory /// Harmful = 8, } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Enums/EffectType.cs b/EXILED/Exiled.API/Enums/EffectType.cs index 37c1f365b8..0d2117d223 100644 --- a/EXILED/Exiled.API/Enums/EffectType.cs +++ b/EXILED/Exiled.API/Enums/EffectType.cs @@ -46,7 +46,7 @@ public enum EffectType /// /// Blurs the affected player's screen. /// - Blinded, + Blindness, /// /// Increases damage the affected player receives. Does not apply any standalone damage. @@ -406,4 +406,4 @@ public enum EffectType /// AnomalousTarget, } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Enums/FirearmType.cs b/EXILED/Exiled.API/Enums/FirearmType.cs index 05cccf2388..7992265e71 100644 --- a/EXILED/Exiled.API/Enums/FirearmType.cs +++ b/EXILED/Exiled.API/Enums/FirearmType.cs @@ -95,4 +95,4 @@ public enum FirearmType /// Scp127, } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Enums/GlassType.cs b/EXILED/Exiled.API/Enums/GlassType.cs index fef4d59f44..70056bf02c 100644 --- a/EXILED/Exiled.API/Enums/GlassType.cs +++ b/EXILED/Exiled.API/Enums/GlassType.cs @@ -86,7 +86,7 @@ public enum GlassType GateAArmory, /// - /// Represents the window in + /// Represents the window in . /// HczLoadingBay, } diff --git a/EXILED/Exiled.API/Enums/HazardType.cs b/EXILED/Exiled.API/Enums/HazardType.cs index 43d16dac41..f13dc69d60 100644 --- a/EXILED/Exiled.API/Enums/HazardType.cs +++ b/EXILED/Exiled.API/Enums/HazardType.cs @@ -30,7 +30,7 @@ public enum HazardType Tantrum, /// - /// Should never happen + /// Should never happen. /// Unknown, } diff --git a/EXILED/Exiled.API/Enums/LayerMasks.cs b/EXILED/Exiled.API/Enums/LayerMasks.cs index e13683a3a1..53137d47de 100644 --- a/EXILED/Exiled.API/Enums/LayerMasks.cs +++ b/EXILED/Exiled.API/Enums/LayerMasks.cs @@ -84,4 +84,4 @@ public enum LayerMasks InteractionAnticheatMask = Default | Glass | Door | InteractableNoPlayerCollision, } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Enums/LeadingTeam.cs b/EXILED/Exiled.API/Enums/LeadingTeam.cs index b136e854f0..23644058ee 100644 --- a/EXILED/Exiled.API/Enums/LeadingTeam.cs +++ b/EXILED/Exiled.API/Enums/LeadingTeam.cs @@ -45,4 +45,4 @@ public enum LeadingTeam : byte /// Draw, } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Enums/LockerType.cs b/EXILED/Exiled.API/Enums/LockerType.cs index 755da9d18f..21dbe9f78f 100644 --- a/EXILED/Exiled.API/Enums/LockerType.cs +++ b/EXILED/Exiled.API/Enums/LockerType.cs @@ -126,4 +126,4 @@ public enum LockerType /// Scp1509Pedestal, } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Enums/PingType.cs b/EXILED/Exiled.API/Enums/PingType.cs index ab9f8f5fd6..50949d3b93 100644 --- a/EXILED/Exiled.API/Enums/PingType.cs +++ b/EXILED/Exiled.API/Enums/PingType.cs @@ -47,4 +47,4 @@ public enum PingType : byte /// Default, } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Enums/RespawnEffectType.cs b/EXILED/Exiled.API/Enums/RespawnEffectType.cs index 672abb1976..34ce495b51 100644 --- a/EXILED/Exiled.API/Enums/RespawnEffectType.cs +++ b/EXILED/Exiled.API/Enums/RespawnEffectType.cs @@ -7,10 +7,6 @@ namespace Exiled.API.Enums { - using Features; - - using PlayerRoles; - /// /// Layers game respawn effects. /// diff --git a/EXILED/Exiled.API/Enums/RevolverChamberState.cs b/EXILED/Exiled.API/Enums/RevolverChamberState.cs index 421f18587d..13c0095162 100644 --- a/EXILED/Exiled.API/Enums/RevolverChamberState.cs +++ b/EXILED/Exiled.API/Enums/RevolverChamberState.cs @@ -30,4 +30,4 @@ public enum RevolverChamberState /// Discharged, } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Enums/ScenesType.cs b/EXILED/Exiled.API/Enums/ScenesType.cs index 60691443f9..c69874f0d0 100644 --- a/EXILED/Exiled.API/Enums/ScenesType.cs +++ b/EXILED/Exiled.API/Enums/ScenesType.cs @@ -19,7 +19,7 @@ public enum ScenesType /// /// The current main menu. - /// ! Will cause crash when trying joining servers ! + /// ! Will cause crash when trying joining servers !. /// NewMainMenu, @@ -35,7 +35,7 @@ public enum ScenesType /// /// The loading Screen. - /// ! Will cause crash when trying joining servers ! + /// ! Will cause crash when trying joining servers !. /// PreLoader, @@ -44,4 +44,4 @@ public enum ScenesType /// Loader, } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Enums/Scp939VisibilityStates.cs b/EXILED/Exiled.API/Enums/Scp939VisibilityState.cs similarity index 95% rename from EXILED/Exiled.API/Enums/Scp939VisibilityStates.cs rename to EXILED/Exiled.API/Enums/Scp939VisibilityState.cs index 1b7b527500..020cf9e186 100644 --- a/EXILED/Exiled.API/Enums/Scp939VisibilityStates.cs +++ b/EXILED/Exiled.API/Enums/Scp939VisibilityState.cs @@ -1,5 +1,5 @@ // ----------------------------------------------------------------------- -// +// // Copyright (c) ExMod Team. All rights reserved. // Licensed under the CC BY-SA 3.0 license. // @@ -49,4 +49,4 @@ public enum Scp939VisibilityState /// SeenByLastHuman, } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Enums/SpawnLocationType.cs b/EXILED/Exiled.API/Enums/SpawnLocationType.cs index 2fc9d2a780..4752396e34 100644 --- a/EXILED/Exiled.API/Enums/SpawnLocationType.cs +++ b/EXILED/Exiled.API/Enums/SpawnLocationType.cs @@ -152,27 +152,27 @@ public enum SpawnLocationType InsideGr18Glass, /// - /// Inside 106's Primary Door + /// Inside 106's Primary Door. /// Inside106Primary, /// - /// Inside 106's Secondary Door + /// Inside 106's Secondary Door. /// Inside106Secondary, /// - /// Inside 939 Cryo Chamber + /// Inside 939 Cryo Chamber. /// Inside939Cryo, /// - /// Inside SCP-079's Armory + /// Inside SCP-079's Armory. /// Inside079Armory, /// - /// Inside SCP-127's Lab + /// Inside SCP-127's Lab. /// Inside127Lab, diff --git a/EXILED/Exiled.API/Enums/SpeakerPlayMode.cs b/EXILED/Exiled.API/Enums/SpeakerPlayMode.cs new file mode 100644 index 0000000000..9bafa513e1 --- /dev/null +++ b/EXILED/Exiled.API/Enums/SpeakerPlayMode.cs @@ -0,0 +1,35 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) ExMod Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.API.Enums +{ + /// + /// Specifies the available modes for playing audio through a speaker. + /// + public enum SpeakerPlayMode : byte + { + /// + /// Play audio globally to all players. + /// + Global = 0, + + /// + /// Play audio to a specific player. + /// + Player = 1, + + /// + /// Play audio to a specific list of players. + /// + PlayerList = 2, + + /// + /// Play audio to players matching a predicate. + /// + Predicate = 3, + } +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Enums/UncuffReason.cs b/EXILED/Exiled.API/Enums/UncuffReason.cs index 977ad09fe1..1cf4bd6961 100644 --- a/EXILED/Exiled.API/Enums/UncuffReason.cs +++ b/EXILED/Exiled.API/Enums/UncuffReason.cs @@ -27,4 +27,4 @@ public enum UncuffReason /// CufferDied, } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Enums/UsableRippleType.cs b/EXILED/Exiled.API/Enums/UsableRippleType.cs index 1abc6936f8..cef62046c7 100644 --- a/EXILED/Exiled.API/Enums/UsableRippleType.cs +++ b/EXILED/Exiled.API/Enums/UsableRippleType.cs @@ -23,4 +23,4 @@ public enum UsableRippleType /// Footstep, } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Enums/WarheadStatus.cs b/EXILED/Exiled.API/Enums/WarheadStatus.cs index e839c0b8dc..ed6f7d5a6d 100644 --- a/EXILED/Exiled.API/Enums/WarheadStatus.cs +++ b/EXILED/Exiled.API/Enums/WarheadStatus.cs @@ -7,30 +7,38 @@ namespace Exiled.API.Enums { + using System; + /// /// All the available warhead statuses. /// /// + [Flags] public enum WarheadStatus { /// /// The warhead is not armed. /// - NotArmed, + NotArmed = 0, /// /// The warhead is armed. /// - Armed, + Armed = 1, /// /// The warhead detonation is in progress. /// - InProgress, + InProgress = 2, /// /// The warhead has detonated. /// - Detonated, + Detonated = 4, + + /// + /// The warhead is on cooldown. + /// + OnCooldown = 8, } } \ No newline at end of file diff --git a/EXILED/Exiled.API/Enums/ZoneType.cs b/EXILED/Exiled.API/Enums/ZoneType.cs index 382833528c..ab2e7f38a2 100644 --- a/EXILED/Exiled.API/Enums/ZoneType.cs +++ b/EXILED/Exiled.API/Enums/ZoneType.cs @@ -10,6 +10,7 @@ namespace Exiled.API.Enums using System; using Exiled.API.Features.Doors; + using Features; /// diff --git a/EXILED/Exiled.API/Exiled.API.csproj b/EXILED/Exiled.API/Exiled.API.csproj index 70f81bf0d1..6dea6426ae 100644 --- a/EXILED/Exiled.API/Exiled.API.csproj +++ b/EXILED/Exiled.API/Exiled.API.csproj @@ -40,6 +40,7 @@ + diff --git a/EXILED/Exiled.API/Extensions/CommonExtensions.cs b/EXILED/Exiled.API/Extensions/CommonExtensions.cs index 6b175fc281..f44f9a14ab 100644 --- a/EXILED/Exiled.API/Extensions/CommonExtensions.cs +++ b/EXILED/Exiled.API/Extensions/CommonExtensions.cs @@ -80,4 +80,4 @@ public static AnimationCurve Add(this AnimationCurve curve, float amount) return curve; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Extensions/DamageTypeExtensions.cs b/EXILED/Exiled.API/Extensions/DamageTypeExtensions.cs index 8eb58c78a4..82a1878691 100644 --- a/EXILED/Exiled.API/Extensions/DamageTypeExtensions.cs +++ b/EXILED/Exiled.API/Extensions/DamageTypeExtensions.cs @@ -11,10 +11,17 @@ namespace Exiled.API.Extensions using System.Linq; using Enums; + using Features; + + using InventorySystem.Items.MicroHID.Modules; using InventorySystem.Items.Scp1509; + + using PlayerRoles; using PlayerRoles.PlayableScps.Scp1507; using PlayerRoles.PlayableScps.Scp3114; + using PlayerRoles.PlayableScps.Scp939; + using PlayerStatsSystem; /// @@ -24,34 +31,37 @@ public static class DamageTypeExtensions { private static readonly Dictionary TranslationConversionInternal = new() { + { DeathTranslations.Recontained, DamageType.Recontainment }, + { DeathTranslations.Warhead, DamageType.Warhead }, + { DeathTranslations.Scp049, DamageType.Scp049 }, + { DeathTranslations.Unknown, DamageType.Unknown }, { DeathTranslations.Asphyxiated, DamageType.Asphyxiation }, { DeathTranslations.Bleeding, DamageType.Bleeding }, - { DeathTranslations.Crushed, DamageType.Crushed }, - { DeathTranslations.Decontamination, DamageType.Decontamination }, - { DeathTranslations.Explosion, DamageType.Explosion }, { DeathTranslations.Falldown, DamageType.Falldown }, + { DeathTranslations.PocketDecay, DamageType.PocketDimension }, + { DeathTranslations.Decontamination, DamageType.Decontamination }, { DeathTranslations.Poisoned, DamageType.Poison }, - { DeathTranslations.Recontained, DamageType.Recontainment }, - { DeathTranslations.Scp049, DamageType.Scp049 }, - { DeathTranslations.Scp096, DamageType.Scp096 }, - { DeathTranslations.Scp173, DamageType.Scp173 }, { DeathTranslations.Scp207, DamageType.Scp207 }, - { DeathTranslations.Scp939Lunge, DamageType.Scp939 }, - { DeathTranslations.Scp939Other, DamageType.Scp939 }, - { DeathTranslations.Scp3114Slap, DamageType.Scp3114 }, + { DeathTranslations.SeveredHands, DamageType.SeveredHands }, + { DeathTranslations.MicroHID, DamageType.MicroHidPrimaryFire }, { DeathTranslations.Tesla, DamageType.Tesla }, - { DeathTranslations.Unknown, DamageType.Unknown }, - { DeathTranslations.Warhead, DamageType.Warhead }, + { DeathTranslations.Explosion, DamageType.ExplosionCustom }, + { DeathTranslations.Scp096, DamageType.Scp096Other }, + { DeathTranslations.Scp173, DamageType.Scp173 }, + { DeathTranslations.Scp939Lunge, DamageType.Scp939LungeTarget }, { DeathTranslations.Zombie, DamageType.Scp0492 }, { DeathTranslations.BulletWounds, DamageType.Firearm }, - { DeathTranslations.PocketDecay, DamageType.PocketDimension }, - { DeathTranslations.SeveredHands, DamageType.SeveredHands }, - { DeathTranslations.FriendlyFireDetector, DamageType.FriendlyFireDetector }, + { DeathTranslations.Crushed, DamageType.Crushed }, { DeathTranslations.UsedAs106Bait, DamageType.FemurBreaker }, - { DeathTranslations.MicroHID, DamageType.MicroHid }, + { DeathTranslations.FriendlyFireDetector, DamageType.FriendlyFireDetector }, { DeathTranslations.Hypothermia, DamageType.Hypothermia }, + { DeathTranslations.CardiacArrest, DamageType.CardiacArrest }, + { DeathTranslations.Scp939Other, DamageType.Scp939Claw }, + { DeathTranslations.Scp3114Slap, DamageType.Scp3114 }, { DeathTranslations.MarshmallowMan, DamageType.Marshmallow }, { DeathTranslations.Scp1344, DamageType.SeveredEyes }, + { DeathTranslations.Scp1507Peck, DamageType.Scp1507 }, + { DeathTranslations.Scp127Bullets, DamageType.Scp127 }, { DeathTranslations.Scp1509, DamageType.Scp1509 }, }; @@ -69,7 +79,7 @@ public static class DamageTypeExtensions { ItemType.GunCOM18, DamageType.Com18 }, { ItemType.GunFSP9, DamageType.Fsp9 }, { ItemType.GunE11SR, DamageType.E11Sr }, - { ItemType.MicroHID, DamageType.MicroHid }, + { ItemType.MicroHID, DamageType.MicroHidPrimaryFire }, { ItemType.ParticleDisruptor, DamageType.ParticleDisruptor }, { ItemType.Jailbird, DamageType.Jailbird }, { ItemType.GunFRMG0, DamageType.Frmg0 }, @@ -100,8 +110,9 @@ public static class DamageTypeExtensions /// Returns whether the is caused by weapon. public static bool IsWeapon(this DamageType type, bool checkNonFirearm = true) => type switch { + DamageType.Crossvec or DamageType.Logicer or DamageType.Revolver or DamageType.Shotgun or DamageType.AK or DamageType.Com15 or DamageType.Com18 or DamageType.E11Sr or DamageType.Fsp9 or DamageType.ParticleDisruptor or DamageType.Com45 or DamageType.Frmg0 or DamageType.A7 or DamageType.Scp127 => true, - DamageType.MicroHid or DamageType.Jailbird when checkNonFirearm => true, + DamageType.MicroHidPrimaryFire or DamageType.MicroHidChargeFire or DamageType.MicroHidBrokenFire or DamageType.Jailbird when checkNonFirearm => true, _ => false, }; @@ -113,11 +124,46 @@ public static class DamageTypeExtensions /// Returns whether the is caused by SCP. public static bool IsScp(this DamageType type, bool checkItems = true) => type switch { - DamageType.Scp or DamageType.Scp049 or DamageType.Scp096 or DamageType.Scp106 or DamageType.Scp173 or DamageType.Scp939 or DamageType.Scp0492 or DamageType.Scp3114 => true, + DamageType.Scp or DamageType.Scp049 or DamageType.Scp096SlapLeft or DamageType.Scp096SlapRight or DamageType.Scp096Charge or DamageType.Scp096GateKill or DamageType.Scp096Other or DamageType.Scp106 or DamageType.Scp173 or DamageType.Scp939None or DamageType.Scp939Claw or DamageType.Scp939LungeTarget or DamageType.Scp939LungeSecondary or DamageType.Scp0492 or DamageType.Scp3114 or DamageType.Scp3114SkinSteal => true, DamageType.Scp018 or DamageType.Scp207 when checkItems => true, _ => false, }; + /// + /// Check if a damage type is caused by >. + /// + /// The damage type to be checked. + /// Returns whether the is caused by SCP. + public static bool IsScp096(this DamageType type) => type is DamageType.Scp096SlapLeft or DamageType.Scp096SlapRight or DamageType.Scp096Charge or DamageType.Scp096GateKill or DamageType.Scp096Other; + + /// + /// Check if a damage type is caused by >. + /// + /// The damage type to be checked. + /// Returns whether the is caused by SCP. + public static bool IsScp939(this DamageType type) => type is DamageType.Scp939None or DamageType.Scp939Claw or DamageType.Scp939LungeTarget or DamageType.Scp939LungeSecondary; + + /// + /// Check if a damage type is caused by >. + /// + /// The damage type to be checked. + /// Returns whether the is caused by SCP. + public static bool IsScp049(this DamageType type) => type is DamageType.Scp049 or DamageType.CardiacArrest; + + /// + /// Check if a damage type is caused by >. + /// + /// The damage type to be checked. + /// Returns whether the is caused by SCP. + public static bool IsScp3114(this DamageType type) => type is DamageType.Scp3114 or DamageType.Scp3114SkinSteal or DamageType.Strangled; + + /// + /// Check if a damage type is caused by >. + /// + /// The damage type to be checked. + /// Returns whether the is caused by SCP. + public static bool IsMicroHid(this DamageType type) => type is DamageType.MicroHidPrimaryFire or DamageType.MicroHidChargeFire or DamageType.MicroHidBrokenFire; + /// /// Check if a damage type is caused by a status effect. /// @@ -125,7 +171,7 @@ public static class DamageTypeExtensions /// Returns whether the is caused by status effect. public static bool IsStatusEffect(this DamageType type) => type switch { - DamageType.Asphyxiation or DamageType.Poison or DamageType.Bleeding or DamageType.Scp207 or DamageType.Hypothermia or DamageType.Strangled => true, + DamageType.Asphyxiation or DamageType.Poison or DamageType.Bleeding or DamageType.Scp207 or DamageType.Hypothermia or DamageType.Strangled or DamageType.SeveredHands or DamageType.SeveredEyes or DamageType.PocketDimension => true, _ => false, }; @@ -138,20 +184,44 @@ public static DamageType GetDamageType(DamageHandlerBase damageHandlerBase) { switch (damageHandlerBase) { + case Features.DamageHandlers.GenericDamageHandler genericDamageHandler: + return GetDamageType(genericDamageHandler.Base); case CustomReasonDamageHandler: return DamageType.Custom; case WarheadDamageHandler: return DamageType.Warhead; - case ExplosionDamageHandler: - return DamageType.Explosion; + case ExplosionDamageHandler explosionDamageHandler: + return explosionDamageHandler.ExplosionType switch + { + ExplosionType.Grenade => DamageType.ExplosionGrenade, + ExplosionType.SCP018 => DamageType.ExplosionScp018, + ExplosionType.PinkCandy => DamageType.ExplosionPinkCandy, + ExplosionType.Cola => DamageType.ExplosionCola, + ExplosionType.Disruptor => DamageType.ExplosionDisruptor, + ExplosionType.Jailbird => DamageType.ExplosionJailbird, + _ => DamageType.ExplosionCustom, + }; case Scp018DamageHandler: return DamageType.Scp018; case RecontainmentDamageHandler: return DamageType.Recontainment; - case Scp096DamageHandler: - return DamageType.Scp096; - case MicroHidDamageHandler: - return DamageType.MicroHid; + case Scp096DamageHandler scp096DamageHandler: + return scp096DamageHandler._attackType switch + { + Scp096DamageHandler.AttackType.GateKill => DamageType.Scp096GateKill, + Scp096DamageHandler.AttackType.SlapLeft => DamageType.Scp096SlapLeft, + Scp096DamageHandler.AttackType.SlapRight => DamageType.Scp096SlapRight, + Scp096DamageHandler.AttackType.Charge => DamageType.Scp096Charge, + _ => DamageType.Scp096Other, + }; + case MicroHidDamageHandler microHidDamageHandler: + return microHidDamageHandler.FiringMode switch + { + MicroHidFiringMode.PrimaryFire => DamageType.MicroHidPrimaryFire, + MicroHidFiringMode.ChargeFire => DamageType.MicroHidChargeFire, + MicroHidFiringMode.BrokenFire => DamageType.MicroHidBrokenFire, + _ => DamageType.Unknown, + }; case DisruptorDamageHandler: return DamageType.ParticleDisruptor; case Scp1507DamageHandler: @@ -174,26 +244,45 @@ public static DamageType GetDamageType(DamageHandlerBase damageHandlerBase) Scp049DamageHandler.AttackType.Scp0492 => DamageType.Scp0492, _ => DamageType.Unknown, }; + case Scp939DamageHandler scp939DamageHandler: + return scp939DamageHandler.Scp939DamageType switch + { + Scp939DamageType.Claw => DamageType.Scp939Claw, + Scp939DamageType.LungeTarget => DamageType.Scp939LungeTarget, + Scp939DamageType.LungeSecondary => DamageType.Scp939LungeSecondary, + _ => DamageType.Scp939None, + }; case Scp3114DamageHandler scp3114DamageHandler: return scp3114DamageHandler.Subtype switch { Scp3114DamageHandler.HandlerType.Strangulation => DamageType.Strangled, - Scp3114DamageHandler.HandlerType.SkinSteal => DamageType.Scp3114, + Scp3114DamageHandler.HandlerType.SkinSteal => DamageType.Scp3114SkinSteal, Scp3114DamageHandler.HandlerType.Slap => DamageType.Scp3114, _ => DamageType.Unknown, }; case FirearmDamageHandler firearmDamageHandler: - return ItemConversion.ContainsKey(firearmDamageHandler.WeaponType) ? ItemConversion[firearmDamageHandler.WeaponType] : DamageType.Firearm; + { + if (ItemConversion.ContainsKey(firearmDamageHandler.WeaponType)) + return ItemConversion[firearmDamageHandler.WeaponType]; + + if (damageHandlerBase.GetType().Assembly.FullName.StartsWith("Assembly-CSharp")) + Log.Warn($"{nameof(DamageTypeExtensions)}.{nameof(damageHandlerBase)}: No matching {nameof(DamageType)} for {nameof(ScpDamageHandler)} with ItemType {firearmDamageHandler.WeaponType}, type will be reported as {DamageType.Firearm}. Report this to EXILED Devs."); + + return DamageType.Firearm; + } case ScpDamageHandler scpDamageHandler: { - DeathTranslation translation = DeathTranslations.TranslationsById[scpDamageHandler._translationId]; - if (translation.Id == DeathTranslations.PocketDecay.Id) + if (scpDamageHandler._translationId == DeathTranslations.PocketDecay.Id) return DamageType.Scp106; - return TranslationIdConversion.ContainsKey(translation.Id) - ? TranslationIdConversion[translation.Id] - : DamageType.Scp; + if (TranslationIdConversion.ContainsKey(scpDamageHandler._translationId)) + return TranslationIdConversion[scpDamageHandler._translationId]; + + if (damageHandlerBase.GetType().Assembly.FullName.StartsWith("Assembly-CSharp")) + Log.Warn($"{nameof(DamageTypeExtensions)}.{nameof(damageHandlerBase)}: No matching {nameof(DamageType)} for {nameof(ScpDamageHandler)} with ID {scpDamageHandler._translationId}, type will be reported as {DamageType.Scp}. Report this to EXILED Devs."); + + return DamageType.Scp; } case UniversalDamageHandler universal: @@ -203,12 +292,19 @@ public static DamageType GetDamageType(DamageHandlerBase damageHandlerBase) if (TranslationIdConversion.ContainsKey(translation.Id)) return TranslationIdConversion[translation.Id]; - Log.Warn($"{nameof(DamageTypeExtensions)}.{nameof(damageHandlerBase)}: No matching {nameof(DamageType)} for {nameof(UniversalDamageHandler)} with ID {translation.Id}, type will be reported as {DamageType.Unknown}. Report this to EXILED Devs."); + if (damageHandlerBase.GetType().Assembly.FullName.StartsWith("Assembly-CSharp")) + Log.Warn($"{nameof(DamageTypeExtensions)}.{nameof(damageHandlerBase)}: No matching {nameof(DamageType)} for {nameof(UniversalDamageHandler)} with ID {translation.Id}, type will be reported as {DamageType.Unknown}. Report this to EXILED Devs."); + return DamageType.Unknown; } - } - return DamageType.Unknown; + default: + { + if (damageHandlerBase.GetType().Assembly.FullName.StartsWith("Assembly-CSharp")) + Log.Warn($"{nameof(DamageTypeExtensions)}.{nameof(damageHandlerBase)}: No matching {nameof(DamageType)} with Type {damageHandlerBase.GetType()}, type will be reported as {DamageType.Unknown}. Report this to EXILED Devs."); + return DamageType.Unknown; + } + } } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Extensions/DangerTypeExtensions.cs b/EXILED/Exiled.API/Extensions/DangerTypeExtensions.cs index 86c4c27099..2715e726dc 100644 --- a/EXILED/Exiled.API/Extensions/DangerTypeExtensions.cs +++ b/EXILED/Exiled.API/Extensions/DangerTypeExtensions.cs @@ -13,6 +13,7 @@ namespace Exiled.API.Extensions using System.Linq; using CustomPlayerEffects.Danger; + using Exiled.API.Enums; /// diff --git a/EXILED/Exiled.API/Extensions/EffectTypeExtension.cs b/EXILED/Exiled.API/Extensions/EffectTypeExtension.cs index 088438e085..8ceb671037 100644 --- a/EXILED/Exiled.API/Extensions/EffectTypeExtension.cs +++ b/EXILED/Exiled.API/Extensions/EffectTypeExtension.cs @@ -13,11 +13,16 @@ namespace Exiled.API.Extensions using System.Linq; using CustomPlayerEffects; + using CustomRendering; + using Enums; + using Exiled.API.Features; + using InventorySystem.Items.MarshmallowMan; using InventorySystem.Items.Usables.Scp244.Hypothermia; + using PlayerRoles.FirstPersonControl; /// @@ -34,7 +39,7 @@ public static class EffectTypeExtension { EffectType.AmnesiaVision, typeof(AmnesiaVision) }, { EffectType.Asphyxiated, typeof(Asphyxiated) }, { EffectType.Bleeding, typeof(Bleeding) }, - { EffectType.Blinded, typeof(Blindness) }, + { EffectType.Blindness, typeof(Blindness) }, { EffectType.BodyshotReduction, typeof(BodyshotReduction) }, { EffectType.Burned, typeof(Burned) }, { EffectType.CardiacArrest, typeof(CardiacArrest) }, @@ -194,7 +199,7 @@ or EffectType.Corroding or EffectType.Decontaminating or EffectType.Hemorrhage o /// Whether the effect is a negative effect. /// public static bool IsNegative(this EffectType effect) => IsHarmful(effect) || effect is EffectType.AmnesiaItems - or EffectType.AmnesiaVision or EffectType.Blinded or EffectType.Burned or EffectType.Concussed or EffectType.Deafened + or EffectType.AmnesiaVision or EffectType.Blindness or EffectType.Burned or EffectType.Concussed or EffectType.Deafened or EffectType.Disabled or EffectType.Ensnared or EffectType.Exhausted or EffectType.Flashed or EffectType.SinkHole or EffectType.Stained or EffectType.InsufficientLighting or EffectType.SoundtrackMute or EffectType.Scanned or EffectType.Slowness; @@ -242,4 +247,4 @@ public static EffectCategory GetCategories(this EffectType effect) return category; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Extensions/FloatExtensions.cs b/EXILED/Exiled.API/Extensions/FloatExtensions.cs index b7a32af87f..f9608626c0 100644 --- a/EXILED/Exiled.API/Extensions/FloatExtensions.cs +++ b/EXILED/Exiled.API/Extensions/FloatExtensions.cs @@ -53,4 +53,4 @@ public static AspectRatioType GetAspectRatioLabel(this float ratio) return closestRatio; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Extensions/ItemExtensions.cs b/EXILED/Exiled.API/Extensions/ItemExtensions.cs index 462e1a47b4..40e29db837 100644 --- a/EXILED/Exiled.API/Extensions/ItemExtensions.cs +++ b/EXILED/Exiled.API/Extensions/ItemExtensions.cs @@ -20,6 +20,7 @@ namespace Exiled.API.Extensions using InventorySystem.Items.Firearms.Attachments; using InventorySystem.Items.Firearms.Modules; using InventorySystem.Items.Pickups; + using Structs; /// @@ -369,4 +370,4 @@ public static uint GetBaseCode(this FirearmType type) /// true if weapon has the specified attachment. Otherwise, false. public static bool HasAttachment(this Firearm firearm, AttachmentName attachment) => firearm.Attachments.FirstOrDefault(x => x.Name == attachment)?.IsEnabled ?? false; } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Extensions/LockerExtensions.cs b/EXILED/Exiled.API/Extensions/LockerExtensions.cs index fbd60ec2a6..3bf7edf51b 100644 --- a/EXILED/Exiled.API/Extensions/LockerExtensions.cs +++ b/EXILED/Exiled.API/Extensions/LockerExtensions.cs @@ -7,9 +7,8 @@ namespace Exiled.API.Extensions { - using System; - using Exiled.API.Enums; + using MapGeneration.Distributors; /// @@ -53,4 +52,4 @@ public static class LockerExtensions _ => LockerType.Unknown, }; } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Extensions/MirrorExtensions.cs b/EXILED/Exiled.API/Extensions/MirrorExtensions.cs index 9f3a12a8ad..55efa975fc 100644 --- a/EXILED/Exiled.API/Extensions/MirrorExtensions.cs +++ b/EXILED/Exiled.API/Extensions/MirrorExtensions.cs @@ -13,11 +13,13 @@ namespace Exiled.API.Extensions using System.Linq; using System.Reflection; using System.Reflection.Emit; - using System.Text; using AdminToys; + using AudioPooling; + using Cassie; + using CustomPlayerEffects; using Decals; @@ -26,17 +28,21 @@ namespace Exiled.API.Extensions using Exiled.API.Features.Items; using Exiled.API.Features.Items.Keycards; using Exiled.API.Features.Pickups.Keycards; + using Features; - using Features.Pools; + using HarmonyLib; + using InventorySystem; using InventorySystem.Items; using InventorySystem.Items.Autosync; - using InventorySystem.Items.Firearms; using InventorySystem.Items.Firearms.Modules; using InventorySystem.Items.Keycards; + using MEC; + using Mirror; + using PlayerRoles; using PlayerRoles.Blood; using PlayerRoles.FirstPersonControl; @@ -44,10 +50,13 @@ namespace Exiled.API.Extensions using PlayerRoles.PlayableScps.Scp1507; using PlayerRoles.Spectating; using PlayerRoles.Voice; + using RelativePositioning; - using Respawning; + using Unity.Collections.LowLevel.Unsafe; + using UnityEngine; + using Utils.Networking; using Firearm = Features.Items.Firearm; @@ -63,9 +72,6 @@ public static class MirrorExtensions private static readonly ReadOnlyDictionary ReadOnlyWriterExtensionsValue = new(WriterExtensionsValue); private static readonly ReadOnlyDictionary ReadOnlySyncVarDirtyBitsValue = new(SyncVarDirtyBitsValue); private static readonly ReadOnlyDictionary ReadOnlyRpcFullNamesValue = new(RpcFullNamesValue); - private static MethodInfo setDirtyBitsMethodInfoValue; - private static MethodInfo sendSpawnMessageMethodInfoValue; - private static string[] adminToyBaseSyncVarsValue; /// /// Gets corresponding to . @@ -121,7 +127,7 @@ public static ReadOnlyDictionary SyncVarDirtyBits return ReadOnlySyncVarDirtyBitsValue; - ulong GetBit(MethodInfo setter) + static ulong GetBit(MethodInfo setter) { List instructions = PatchProcessor.GetOriginalInstructions(setter); @@ -177,19 +183,19 @@ public static ReadOnlyDictionary RpcFullNames } /// - /// Gets a 's . + /// Gets a NetworkIdentity.SerializeServer's . /// - public static MethodInfo SetDirtyBitsMethodInfo => setDirtyBitsMethodInfoValue ??= typeof(NetworkBehaviour).GetMethod(nameof(NetworkBehaviour.SetSyncVarDirtyBit)); + public static MethodInfo SerializeServerMethodInfo => field ??= typeof(NetworkIdentity).GetMethod("SerializeServer", BindingFlags.NonPublic | BindingFlags.Instance); /// /// Gets a NetworkServer.SendSpawnMessage's . /// - public static MethodInfo SendSpawnMessageMethodInfo => sendSpawnMessageMethodInfoValue ??= typeof(NetworkServer).GetMethod("SendSpawnMessage", BindingFlags.NonPublic | BindingFlags.Static); + public static MethodInfo SendSpawnMessageMethodInfo => field ??= typeof(NetworkServer).GetMethod("SendSpawnMessage", BindingFlags.NonPublic | BindingFlags.Static); /// /// Gets all sync var names. /// - public static string[] AdminToyBaseSyncVars => adminToyBaseSyncVarsValue ??= typeof(AdminToyBase).GetProperties().Where(property => property.Name.Contains("Network")).Select(property => property.Name).ToArray(); + public static string[] AdminToyBaseSyncVars => field ??= typeof(AdminToyBase).GetProperties().Where(property => property.Name.Contains("Network")).Select(property => property.Name).ToArray(); /// /// Plays a beep sound that only the target can hear. @@ -472,6 +478,7 @@ public static bool SpawnDecal(this IEnumerable targets, Vector3 position [Obsolete("Use Player::SpawnBlood(Vector3, Vector3) instead.")] #pragma warning disable IDE0060 // TODO: Deleted the unused param public static void PlaceBlood(this Player player, Vector3 position, Vector3 origin, RoleTypeId roleTypeId, int gettingShotSoundIndex) +#pragma warning restore IDE0060 { if (!roleTypeId.TryGetRoleBase(out PlayerRoleBase playerRoleBase) || playerRoleBase is not IBleedableRole) return; @@ -508,7 +515,8 @@ public static void PlaceBlood(this Player player, Vector3 position, Vector3 orig writer.WriteRelativePosition(new RelativePosition(origin)); writer.WriteByte(255); writer.WriteRoleType(RoleTypeId.ClassD); - }, true); + }, + true); #pragma warning restore SA1116 // Split parameters should start on line after declaration } @@ -630,7 +638,7 @@ public static void ChangeAppearance(this Player player, RoleTypeId type, IEnumer if (target != player || !isRisky) target.Connection.Send(writer.ToArraySegment()); else - Log.Error($"Prevent Seld-Desync of {player.Nickname} with {type}"); + Log.Error($"Prevent Self-Desync of {player.Nickname} with {type}"); } NetworkWriterPool.Return(writer); @@ -758,7 +766,9 @@ public static void PlayCassieAnnouncement(this Player player, string words, bool /// Same on 's isHeld. /// Same on 's isNoisy. /// Same on 's isSubtitles. +#pragma warning disable IDE0060 // TODO: Deleted the unused param public static void MessageTranslated(this Player player, string words, string translation, string customSubtitles, bool makeHold = false, bool makeNoise = true, bool isSubtitles = true) +#pragma warning restore IDE0060 { CassieAnnouncement announcement = new(new CassieTtsPayload(words, customSubtitles, makeHold), 0, makeNoise ? 1 : 0); @@ -768,27 +778,6 @@ public static void MessageTranslated(this Player player, string words, string tr announcement.Payload.SendToHubsConditionally(hub => hub == player.ReferenceHub); } - /// - /// Moves object for the player. - /// - /// Target to send. - /// The to move. - /// The position to change. - public static void MoveNetworkIdentityObject(this Player player, NetworkIdentity identity, Vector3 pos) - { - if (identity == null) - return; - - identity.gameObject.transform.position = pos; - ObjectDestroyMessage objectDestroyMessage = new() - { - netId = identity.netId, - }; - - player.Connection.Send(objectDestroyMessage, 0); - SendSpawnMessageMethodInfo?.Invoke(null, new object[] { identity, player.Connection }); - } - /// /// Sends to the player a Fake Change Scene. /// @@ -818,6 +807,58 @@ public static void ChangeSceneToAllClients(ScenesType scene) NetworkServer.SendToAll(message); } + /// + /// Sends a spawn message for the specified to the given . + /// + /// The player who should receive the spawn message. + /// The to spawn. + public static void SpawnNetworkIdentity(this Player player, NetworkIdentity identity) => SendSpawnMessageMethodInfo?.Invoke(null, new object[] { identity, player.Connection }); + + /// + /// Sends a destroy message for the specified to the given . + /// + /// The player who should receive the destroy message. + /// The to destroy. + public static void DestroyNetworkIdentity(this Player player, NetworkIdentity identity) => player.DestroyNetworkId(identity.netId); + + /// + /// Sends a destroy message for the specified network ID to the given . + /// + /// The player who should receive the destroy message. + /// The network ID of the object to destroy. + public static void DestroyNetworkId(this Player player, uint netId) => player.Connection.Send(new ObjectDestroyMessage() { netId = netId }); + + /// + /// Respawns the specified for the given . + /// This sends a destroy message followed by a spawn message to the player's client. + /// + /// The player who should receive the respawn messages. + /// The to respawn. + public static void RespawnNetworkIdentity(this Player player, NetworkIdentity identity) + { + player.DestroyNetworkIdentity(identity); + player.SpawnNetworkIdentity(identity); + } + + /// + /// Moves object for the player. + /// + /// Target to send. + /// The to move. + /// The position to change. + public static void MoveNetworkIdentityObject(this Player player, NetworkIdentity identity, Vector3 pos) + { + if (identity == null) + return; + + Vector3 originalPosition = identity.transform.position; + identity.transform.position = pos; + + player.RespawnNetworkIdentity(identity); + + identity.transform.position = originalPosition; + } + /// /// Scales an object for the specified player. /// @@ -829,14 +870,135 @@ public static void ScaleNetworkIdentityObject(this Player player, NetworkIdentit if (identity == null) return; - identity.gameObject.transform.localScale = scale; - ObjectDestroyMessage objectDestroyMessage = new() + Vector3 originalScale = identity.transform.localScale; + identity.transform.localScale = scale; + + player.RespawnNetworkIdentity(identity); + + identity.transform.localScale = originalScale; + } + + /// + /// Edit 's parameter and sync. + /// + /// Target to send. + /// Target object. + /// Edit function. + /// Reback function for reset object to original state. + public static void EditNetworkObject(this Player player, NetworkIdentity identity, Action customAction, Action resetAction) + { + if (identity == null) + return; + + customAction?.Invoke(identity); + + player.RespawnNetworkIdentity(identity); + + resetAction?.Invoke(identity); + } + + /// + /// Sends a spawn message for the specified to a targeted collection of players. + /// + /// The to serialize and spawn. + /// The collection of who will receive the spawn message. + public static void SendSpawnMessageForPlayers(this NetworkIdentity identity, IEnumerable players) + { + if (identity == null || identity.netId == 0 || !players.Any()) + return; + + using NetworkWriterPooled ownerWriter = NetworkWriterPool.Get(); + using NetworkWriterPooled observersWriter = NetworkWriterPool.Get(); + + SerializeServerMethodInfo?.Invoke(identity, new object[] { true, ownerWriter, observersWriter }); + + ArraySegment ownerPayload = ownerWriter.ToArraySegment(); + ArraySegment observerPayload = observersWriter.ToArraySegment(); + + SpawnMessage spawnMessage = new() { netId = identity.netId, + isLocalPlayer = false, + isOwner = false, + sceneId = identity.sceneId, + assetId = identity.assetId, + position = identity.transform.localPosition, + rotation = identity.transform.localRotation, + scale = identity.transform.localScale, + payload = observerPayload, }; - player.Connection.Send(objectDestroyMessage, 0); - SendSpawnMessageMethodInfo?.Invoke(null, new object[] { identity, player.Connection }); + using NetworkWriterPooled prepackedObserverWriter = NetworkWriterPool.Get(); + NetworkMessages.Pack(spawnMessage, prepackedObserverWriter); + ArraySegment segment = prepackedObserverWriter.ToArraySegment(); + + foreach (Player player in players) + { + if (!player.IsConnected) + continue; + + bool isOwner = identity.connectionToClient == player.Connection; + + if (!isOwner) + { + player.Connection.Send(segment); + continue; + } + + SpawnMessage ownerMessage = spawnMessage; + ownerMessage.isOwner = true; + ownerMessage.isLocalPlayer = player.NetworkIdentity == identity; + ownerMessage.payload = ownerPayload; + + player.Connection.Send(ownerMessage); + } + } + + /// + /// Sends a destroy message for the specified to a targeted collection of players. + /// + /// The to destroy on the clients. + /// The collection of who will receive the destroy message. + public static void DestroyNetworkIdentityForPlayers(this NetworkIdentity identity, IEnumerable players) + { + if (identity == null || identity.netId == 0 || !players.Any()) + return; + + using NetworkWriterPooled writer = NetworkWriterPool.Get(); + NetworkMessages.Pack(new ObjectDestroyMessage() { netId = identity.netId }, writer); + ArraySegment segment = writer.ToArraySegment(); + + foreach (Player player in players) + { + if (!player.IsConnected) + continue; + + player.Connection.Send(segment); + } + } + + /// + /// Respawns the specified by respawning its underlying on the server. + /// + /// The to respawn. + public static void RespawnNetworkIdentity(this NetworkIdentity identity) + { + if (identity == null || identity.netId == 0) + return; + + NetworkServer.SendToReady(new ObjectDestroyMessage() { netId = identity.netId }); + identity.SendSpawnMessageForPlayers(Player.List); + } + + /// + /// Respawns a networked on the server by unspawning and respawning it. + /// This forces Mirror to reinitialize the network state for the object. + /// + /// The networked GameObject to respawn. + public static void RespawnNetworkObject(this GameObject gameObject) + { + NetworkServer.UnSpawn(gameObject); + NetworkServer.Spawn(gameObject); } /// @@ -849,17 +1011,8 @@ public static void MoveNetworkIdentityObject(this NetworkIdentity identity, Vect if (identity == null) return; - identity.gameObject.transform.position = pos; - ObjectDestroyMessage objectDestroyMessage = new() - { - netId = identity.netId, - }; - - foreach (Player ply in Player.List) - { - ply.Connection.Send(objectDestroyMessage, 0); - SendSpawnMessageMethodInfo?.Invoke(null, new object[] { identity, ply.Connection }); - } + identity.transform.position = pos; + RespawnNetworkIdentity(identity); } /// @@ -872,17 +1025,19 @@ public static void ScaleNetworkIdentityObject(this NetworkIdentity identity, Vec if (identity == null) return; - identity.gameObject.transform.localScale = scale; - ObjectDestroyMessage objectDestroyMessage = new() - { - netId = identity.netId, - }; + identity.transform.localScale = scale; + RespawnNetworkIdentity(identity); + } - foreach (Player ply in Player.List) - { - ply.Connection.Send(objectDestroyMessage, 0); - SendSpawnMessageMethodInfo?.Invoke(null, new object[] { identity, ply.Connection }); - } + /// + /// Edit 's parameter and sync. + /// + /// The to edit. + /// Edit function. + public static void EditNetworkObject(this NetworkIdentity identity, Action customAction) + { + customAction.Invoke(identity); + RespawnNetworkIdentity(identity); } /// @@ -944,7 +1099,12 @@ public static void ResyncSyncVar(NetworkIdentity behaviorOwner, Type targetType, { if (behaviorOwner == null) return; - SetDirtyBitsMethodInfo.Invoke(behaviorOwner.gameObject.GetComponent(targetType), new object[] { SyncVarDirtyBits[$"{targetType.Name}.{propertyName}"] }); + + if (behaviorOwner.gameObject.GetComponent(targetType) is not NetworkBehaviour behaviour) + return; + + ulong dirtyBit = SyncVarDirtyBits[$"{targetType.Name}.{propertyName}"]; + behaviour.SetSyncVarDirtyBit(dirtyBit); } /// @@ -1004,32 +1164,11 @@ public static void SendFakeSyncObject(Player target, NetworkIdentity behaviorOwn NetworkWriterPooled writer = NetworkWriterPool.Get(); NetworkWriterPooled writer2 = NetworkWriterPool.Get(); MakeCustomSyncWriter(behaviorOwner, targetType, customAction, null, writer, writer2); - target.ReferenceHub.networkIdentity.connectionToClient.Send(new EntityStateMessage() { netId = behaviorOwner.netId, payload = writer.ToArraySegment() }); + target.Connection.Send(new EntityStateMessage() { netId = behaviorOwner.netId, payload = writer.ToArraySegment() }); NetworkWriterPool.Return(writer); NetworkWriterPool.Return(writer2); } - /// - /// Edit 's parameter and sync. - /// - /// Target object. - /// Edit function. - public static void EditNetworkObject(NetworkIdentity identity, Action customAction) - { - customAction.Invoke(identity); - - ObjectDestroyMessage objectDestroyMessage = new() - { - netId = identity.netId, - }; - - foreach (Player player in Player.List) - { - player.Connection.Send(objectDestroyMessage, 0); - SendSpawnMessageMethodInfo.Invoke(null, new object[] { identity, player.Connection }); - } - } - // Get components index in identity.(private) private static int GetComponentIndex(NetworkIdentity identity, Type type) { @@ -1076,7 +1215,7 @@ private static void MakeCustomSyncWriter(NetworkIdentity behaviorOwner, Type tar // Write syncdata position data int position3 = owner.Position; owner.Position = position; - owner.WriteByte((byte)(position3 - position2 & 255)); + owner.WriteByte((byte)((position3 - position2) & 255)); owner.Position = position3; // Copy owner to observer @@ -1084,4 +1223,4 @@ private static void MakeCustomSyncWriter(NetworkIdentity behaviorOwner, Type tar observer.WriteBytes(owner.ToArraySegment().Array, position, owner.Position - position); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Extensions/RoleExtensions.cs b/EXILED/Exiled.API/Extensions/RoleExtensions.cs index db1a7c99a9..14e1c4dd59 100644 --- a/EXILED/Exiled.API/Extensions/RoleExtensions.cs +++ b/EXILED/Exiled.API/Extensions/RoleExtensions.cs @@ -12,14 +12,19 @@ namespace Exiled.API.Extensions using System.Linq; using Enums; + using Features.Spawn; + using Footprinting; + using InventorySystem; using InventorySystem.Configs; + using PlayerRoles; using PlayerRoles.FirstPersonControl; - using Respawning; + using Respawning.Waves; + using UnityEngine; using Team = PlayerRoles.Team; @@ -84,7 +89,7 @@ public static class RoleExtensions RoleTypeId.ChaosConscript or RoleTypeId.ChaosMarauder or RoleTypeId.ChaosRepressor or RoleTypeId.ChaosRifleman or RoleTypeId.ChaosFlamingo => Team.ChaosInsurgency, RoleTypeId.Scientist => Team.Scientists, RoleTypeId.ClassD => Team.ClassD, - RoleTypeId.Scp049 or RoleTypeId.Scp939 or RoleTypeId.Scp0492 or RoleTypeId.Scp079 or RoleTypeId.Scp096 or RoleTypeId.Scp106 or RoleTypeId.Scp173 or RoleTypeId.Scp3114 or RoleTypeId.ZombieFlamingo=> Team.SCPs, + RoleTypeId.Scp049 or RoleTypeId.Scp939 or RoleTypeId.Scp0492 or RoleTypeId.Scp079 or RoleTypeId.Scp096 or RoleTypeId.Scp106 or RoleTypeId.Scp173 or RoleTypeId.Scp3114 or RoleTypeId.ZombieFlamingo => Team.SCPs, RoleTypeId.FacilityGuard or RoleTypeId.NtfCaptain or RoleTypeId.NtfPrivate or RoleTypeId.NtfSergeant or RoleTypeId.NtfSpecialist or RoleTypeId.NtfFlamingo => Team.FoundationForces, RoleTypeId.Tutorial => Team.OtherAlive, RoleTypeId.Flamingo or RoleTypeId.AlphaFlamingo => Team.Flamingos, @@ -243,7 +248,7 @@ public static Dictionary GetStartingAmmo(this RoleTypeId roleT NtfMiniWave => SpawnableFaction.NtfMiniWave, ChaosSpawnWave => SpawnableFaction.ChaosWave, ChaosMiniWave => SpawnableFaction.ChaosMiniWave, - _ => SpawnableFaction.None + _ => SpawnableFaction.None, }; /// @@ -283,4 +288,4 @@ public static bool TryGetSpawnableFaction(this Faction faction, out SpawnableFac return true; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Extensions/StringExtensions.cs b/EXILED/Exiled.API/Extensions/StringExtensions.cs index 1cc8dc7c32..c6ccc67202 100644 --- a/EXILED/Exiled.API/Extensions/StringExtensions.cs +++ b/EXILED/Exiled.API/Extensions/StringExtensions.cs @@ -67,7 +67,7 @@ public static int GetDistance(this string firstString, string secondString) /// /// The to extract from. /// Returns a containing the exctracted command name and arguments. - public static (string commandName, string[] arguments) ExtractCommand(this string commandLine) + public static (string CommandName, string[] Arguments) ExtractCommand(this string commandLine) { string[] extractedArguments = commandLine.Split(' '); diff --git a/EXILED/Exiled.API/Features/Audio/AudioDataStorage.cs b/EXILED/Exiled.API/Features/Audio/AudioDataStorage.cs new file mode 100644 index 0000000000..32f75d7d6c --- /dev/null +++ b/EXILED/Exiled.API/Features/Audio/AudioDataStorage.cs @@ -0,0 +1,118 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) ExMod Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.API.Features.Audio +{ + using System.Collections.Generic; + + using Exiled.API.Structs.Audio; + + using RoundRestarting; + + /// + /// Manages a global in-memory storage of decoded PCM audio data. Once stored, audio can be played using . + /// + public static class AudioDataStorage + { + static AudioDataStorage() + { + AudioStorage = new(); + RoundRestart.OnRestartTriggered += OnRoundRestart; + } + + /// + /// Gets the underlying storage, keyed by name. + /// + public static Dictionary AudioStorage { get; } + + /// + /// Gets or sets a value indicating whether the storage is automatically cleared when a round restart is triggered. + /// + public static bool ClearOnRoundRestart { get; set; } = true; + + /// + /// Stores raw PCM audio samples under the specified name. + /// + /// The unique storage key to assign. + /// The raw PCM float array to store. + /// true if successfully added; otherwise, false. + public static bool Add(string name, float[] pcm) + { + if (pcm == null) + { + Log.Error($"[AudioDataStorage] Cannot store null array for key '{name}'."); + return false; + } + + TrackData trackInfo = new() + { + Title = name, + Duration = (double)pcm.Length / VoiceChat.VoiceChatSettings.SampleRate, + }; + + return Add(name, new AudioData(pcm, trackInfo)); + } + + /// + /// Stores a fully constructed under the specified name. + /// + /// The unique storage key to assign. + /// The to store. + /// true if successfully added; otherwise, false. + public static bool Add(string name, AudioData audioData) + { + if (!ValidateName(name)) + return false; + + if (audioData.Pcm == null || audioData.Pcm.Length == 0) + { + Log.Error($"[AudioDataStorage] AudioData for key '{name}' has null or empty PCM."); + return false; + } + + if (AudioStorage.ContainsKey(name)) + { + Log.Warn($"[AudioDataStorage] An entry with the key '{name}' already exists. Skipping add."); + return false; + } + + return AudioStorage.TryAdd(name, audioData); + } + + /// + /// Removes a stored audio entry by name. + /// + /// The storage name/key to remove. + /// true if the entry was found and removed; otherwise, false. + public static bool Remove(string name) => AudioStorage.Remove(name, out _); + + /// + /// Clears all entries from the audio storage, freeing all associated memory. + /// + public static void Clear() => AudioStorage.Clear(); + + /// + /// Validates that the storage name (key) is valid. + /// + /// The storage name (key) to validate. + /// True when name is valid; otherwise false. + internal static bool ValidateName(string name) + { + if (!string.IsNullOrEmpty(name)) + return true; + + Log.Error("[AudioDataStorage] Storage name (key) cannot be null or empty."); + return false; + } + + private static void OnRoundRestart() + { + if (ClearOnRoundRestart) + Clear(); + } + } +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Audio/Extensions/SourceExtensions.cs b/EXILED/Exiled.API/Features/Audio/Extensions/SourceExtensions.cs new file mode 100644 index 0000000000..2c7920e6cf --- /dev/null +++ b/EXILED/Exiled.API/Features/Audio/Extensions/SourceExtensions.cs @@ -0,0 +1,154 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) ExMod Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.API.Features.Audio.Extensions +{ + using System; + using System.Collections.Generic; + using System.Linq; + + using Exiled.API.Features.Audio.PcmSources; + using Exiled.API.Features.Toys; + using Exiled.API.Interfaces.Audio; + + /// + /// Provides extension methods for playing audio for pre-made sources on Speaker instances. + /// + public static class SourceExtensions + { + /// + /// Plays the live voice of a specific player through this speaker. + /// + /// The speaker through which to play the audio. + /// The player whose voice will be broadcasted. + /// If true, prevents the player's original voice message's from being heard while broadcasting. + /// If true, clears the upcoming tracks in the playlist before starting playback. + /// true if the playback started successfully; otherwise, false. + public static bool PlayFromPlayer(this Speaker speaker, Player player, bool blockOriginalVoice = false, bool clearQueue = true) + { + if (player == null) + { + Log.Error("[Speaker] Source player cannot be null when streaming live microphone!"); + return false; + } + + PlayerVoiceSource source; + try + { + source = new PlayerVoiceSource(player, blockOriginalVoice); + } + catch (Exception ex) + { + Log.Error($"[Speaker] Failed to initialize live voice stream for player '{player.Nickname}' ({player.Id}).\nException Details: {ex}"); + return false; + } + + return speaker.Play(source, clearQueue); + } + + /// + /// Plays the specified text as speech through this speaker using the VoiceRss TTS service. + /// + /// The speaker that will play the generated speech. + /// The text to convert to speech.(Length limited by 100KB). + /// Your VoiceRSS API keys. Get a free key at . + /// The language and locale code for the TTS voice. See for all supported language codes. + /// Optional specific voice name for the selected language.(See for available voices per language.) + /// Speech rate from -10 (slowest) to 10 (fastest). Defaults to 0 (normal speed). + /// If true, clears the upcoming tracks in the playlist before starting playback. + /// true if the TTS playback started successfully; otherwise, false. + public static bool PlayTts(this Speaker speaker, string text, IEnumerable apiKeys, string language = "en-us", string voice = null, int rate = 0, bool clearQueue = true) + { + VoiceRssTtsSource ttsSource; + try + { + ttsSource = new(text, apiKeys, language, voice, rate); + } + catch (Exception ex) + { + Log.Error($"Failed to create TTS source: {ex.Message}"); + return false; + } + + return speaker.Play(ttsSource, clearQueue); + } + + /// + /// Plays multiple instances mixed together. + /// + /// The speaker through which to play the audio. + /// The collection of PCM sources to mix and play. + /// If true, clears the upcoming tracks in the playlist before starting playback. + /// true if at least one source was successfully mixed; otherwise, false. + public static bool PlayMixed(this Speaker speaker, IEnumerable sources, bool clearQueue = true) + { + if (sources == null || !sources.Any()) + { + Log.Error("[Speaker] No sources provided for PlayMixed!"); + return false; + } + + if (clearQueue) + speaker.TrackQueue.Clear(); + + bool anyAdded = false; + + foreach (IPcmSource source in sources) + { + if (source == null) + continue; + + if (speaker.AddMixed(source)) + anyAdded = true; + } + + return anyAdded; + } + + /// + /// Dynamically mixes a new audio source into the currently playing audio without interrupting it. + /// + /// The speaker through which to play the audio. + /// The additional to mix with the current playback. + /// true if the source was successfully mixed or started; otherwise, false. + public static bool AddMixed(this Speaker speaker, IPcmSource extraSource) + { + if (extraSource == null) + { + Log.Error("[Speaker] Provided extra IPcmSource for mixing is null!"); + return false; + } + + if (extraSource is ILiveSource) + speaker.Pitch = 1.0f; + + IPcmSource currentSource = speaker.CurrentSource; + + if ((!speaker.IsPlaying && !speaker.IsPaused) || currentSource == null || currentSource.Ended) + return speaker.Play(extraSource, false); + + if (currentSource is MixerSource currentMixer) + { + currentMixer.AddSource(extraSource); + return true; + } + + try + { + IPcmSource oldSource = currentSource; + MixerSource newMixer = new([oldSource, extraSource]); + speaker.CurrentSource = newMixer; + return true; + } + catch (Exception ex) + { + Log.Error($"[Speaker] Failed to transition to MixerSource on the fly!\nException Details: {ex}"); + return false; + } + } + } +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Audio/Extensions/WavExtensions.cs b/EXILED/Exiled.API/Features/Audio/Extensions/WavExtensions.cs new file mode 100644 index 0000000000..d0e881f3e6 --- /dev/null +++ b/EXILED/Exiled.API/Features/Audio/Extensions/WavExtensions.cs @@ -0,0 +1,139 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) ExMod Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +#pragma warning disable SA1129 // Do not use default value type constructor +namespace Exiled.API.Features.Audio.Extensions +{ + using System; + using System.Collections.Generic; + using System.Linq; + + using Exiled.API.Features.Audio.PcmSources; + using Exiled.API.Features.Toys; + using Exiled.API.Interfaces.Audio; + using Exiled.API.Structs.Audio; + + /// + /// Provides methods to play 16-bit, mono, 48 kHz WAV files or web streams via Speaker. + /// + public static class WavExtensions + { + /// + /// Plays a local wav file or web URL through this speaker. (File must be 16-bit, mono, and 48kHz.) + /// + /// The speaker through which to play the audio. + /// The path/url or custom name(if is true) to the wav file. + /// If true, clears the upcoming tracks in the playlist before starting playback. + /// If true, the file will be streamed from disk when played; otherwise, it will be loaded into memory (Ignored for web URLs). + /// If true, loads the audio via for optimized playback. + /// true if the audio file was successfully found, loaded, and playback started; otherwise, false. + public static bool PlayWav(this Speaker speaker, string path, bool clearQueue = true, bool stream = false, bool useCache = false) + { + if (string.IsNullOrEmpty(path)) + { + Log.Error("[Speaker] Provided path/url or name cannot be null or empty!"); + return false; + } + + if (!useCache && !WavUtility.TryValidatePath(path, out string errorMessage)) + { + Log.Error($"[Speaker] {errorMessage}"); + return false; + } + + IPcmSource newSource; + try + { + newSource = WavUtility.CreatePcmSource(path, stream, useCache); + } + catch (Exception ex) + { + Log.Error($"[Speaker] Failed to initialize audio source for file at path: '{path}'.\nException Details: {ex}"); + return false; + } + + return speaker.Play(newSource, clearQueue); + } + + /// + /// Converts provided paths/URLs to sources and plays them mixed together. + /// + /// The speaker through which to play the audio. + /// The collection of paths or URLs to the audio files. + /// If true, clears the upcoming tracks in the playlist before starting playback. + /// If true, streams local files from disk. (Ignored for web URLs). + /// If true, utilizes for the sources. + /// true if at least one valid path was loaded and started; otherwise, false. + public static bool PlayMixedWav(this Speaker speaker, IEnumerable paths, bool clearQueue = true, bool stream = false, bool useCache = false) + { + if (paths == null || !paths.Any()) + { + Log.Error("[Speaker] No paths provided for PlayMixedWav!"); + return false; + } + + List createdSources = new(); + + foreach (string path in paths) + { + if (string.IsNullOrEmpty(path)) + { + Log.Warn("[Speaker] One of the provided paths for PlayMixedWav is null or empty. Skipping this entry."); + continue; + } + + if (!useCache && !WavUtility.TryValidatePath(path, out string error)) + { + Log.Error($"[Speaker] Skipping invalid path in mix: {path}. Reason: {error}"); + continue; + } + + try + { + IPcmSource source = WavUtility.CreatePcmSource(path, stream, useCache); + if (source != null) + createdSources.Add(source); + } + catch (Exception ex) + { + Log.Error($"[Speaker] Failed to create source for mix from '{path}': {ex.Message}"); + } + } + + if (createdSources.Count == 0) + return false; + + return speaker.PlayMixed(createdSources, clearQueue); + } + + /// + /// Helper method to easily queue a .wav file/url with stream support. + /// + /// The speaker through which to queue the track. + /// An optional name or identifier for this track in the queue. This is only used for reference. + /// The path/url or custom name(if is true) to the wav file. + /// If true, the file will be streamed from disk when played; otherwise, it will be loaded into memory (Ignored for web URLs). + /// If true, loads the audio via for optimized playback. + /// true if successfully queued or started. + public static bool QueueWavTrack(this Speaker speaker, string name, string path, bool isStream = false, bool useCache = false) + { + if (string.IsNullOrEmpty(path)) + { + Log.Error("[Speaker] Provided path or cache name cannot be null or empty!"); + return false; + } + + if (!useCache && !WavUtility.TryValidatePath(path, out string errorMessage)) + { + Log.Error($"[Speaker] {errorMessage}"); + return false; + } + + return speaker.QueueTrack(new QueuedTrack(name, () => WavUtility.CreatePcmSource(path, isStream, useCache))); + } + } +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Audio/Filters/EchoFilter.cs b/EXILED/Exiled.API/Features/Audio/Filters/EchoFilter.cs new file mode 100644 index 0000000000..4856100ef9 --- /dev/null +++ b/EXILED/Exiled.API/Features/Audio/Filters/EchoFilter.cs @@ -0,0 +1,183 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) ExMod Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.API.Features.Audio.Filters +{ + using System; + + using Exiled.API.Interfaces.Audio; + + using UnityEngine; + + /// + /// A true DSP Fractional Delay Filter equipped with an RBJ Butterworth Biquad Filter. + /// + public sealed class EchoFilter : IAudioFilter + { + private const float MaxDelayMs = 10000f; + private readonly float[] delayBuffer; + private readonly int maxBufferLength; + + private int writeIndex; + + private float b0; + private float b1; + private float b2; + private float a1; + private float a2; + private float x1; + private float x2; + private float y1; + private float y2; + + /// + /// Initializes a new instance of the class. + /// + /// The delay time in milliseconds (10 - 10000). + /// The feedback multiplier determining how long the echo lasts. + /// The volume of the original sound. + /// The volume of the echoed sound. + /// How much high-frequency is absorbed each bounce (0 = pure digital ring, 1 = heavy muffled echo). + public EchoFilter(float delayMs = 300f, float decay = 0.5f, float dry = 1.0f, float wet = 0.5f, float damp = 0.3f) + { + maxBufferLength = (int)(VoiceChat.VoiceChatSettings.SampleRate * (MaxDelayMs / 1000f)); + delayBuffer = new float[maxBufferLength]; + + writeIndex = 0; + x1 = x2 = y1 = y2 = 0f; + + Delay = delayMs; + Feedback = decay; + DryMix = dry; + WetMix = wet; + Damping = damp; + } + + /// + /// Gets or sets the delay time in milliseconds. Dynamically adjusts the read head. + /// + public float Delay + { + get; + set => field = Mathf.Clamp(value, 10f, MaxDelayMs); + } + + /// + /// Gets or sets the feedback multiplier. Determines how many times the echo repeats before dying out. + /// + public float Feedback + { + get; + set => field = Mathf.Clamp01(value); + } + + /// + /// Gets or sets the volume of the original (dry) unaffected sound. + /// + public float DryMix + { + get; + set => field = Mathf.Clamp01(value); + } + + /// + /// Gets or sets the volume of the delayed (wet) echoed sound. + /// + public float WetMix + { + get; + set => field = Mathf.Clamp01(value); + } + + /// + /// Gets or sets the damping coefficient. Automatically recalculates the RBJ Biquad coefficients. + /// + public float Damping + { + get; + set + { + field = Mathf.Clamp01(value); + CalculateBiquad(field); + } + } + + /// + /// Processes the raw PCM audio frame directly before it is encoded and sending. + /// + /// The array of PCM audio samples. + public void Process(float[] frame) + { + float currentDelayMs = Delay; + float currentFeedback = Feedback; + float currentDry = DryMix; + float currentWet = WetMix; + + float delaySamples = VoiceChat.VoiceChatSettings.SampleRate * (currentDelayMs / 1000f); + + for (int i = 0; i < frame.Length; i++) + { + float input = frame[i]; + float readPos = writeIndex - delaySamples; + if (readPos < 0) + readPos += maxBufferLength; + + int index1 = (int)readPos; + int index2 = (index1 + 1) % maxBufferLength; + float frac = readPos - index1; + + float delayedSample = (delayBuffer[index1] * (1f - frac)) + (delayBuffer[index2] * frac); + float filteredSample = (b0 * delayedSample) + (b1 * x1) + (b2 * x2) - (a1 * y1) - (a2 * y2); + + x2 = x1; + x1 = delayedSample; + y2 = y1; + y1 = filteredSample; + + float output = (input * currentDry) + (filteredSample * currentWet); + delayBuffer[writeIndex] = input + (filteredSample * currentFeedback); + + writeIndex++; + if (writeIndex >= maxBufferLength) + writeIndex = 0; + + frame[i] = output / (1f + Mathf.Abs(output)); + } + } + + /// + public void Reset() + { + Array.Clear(delayBuffer, 0, delayBuffer.Length); + writeIndex = 0; + x1 = x2 = y1 = y2 = 0f; + } + + /// + /// Calculates the Robert Bristow-Johnson (RBJ) Audio EQ parameters for the low-pass filter. + /// + private void CalculateBiquad(float dampValue) + { + float cutoffFrequency = Mathf.Lerp(20000f, 500f, dampValue); + + if (cutoffFrequency >= VoiceChat.VoiceChatSettings.SampleRate / 2f) + cutoffFrequency = (VoiceChat.VoiceChatSettings.SampleRate / 2f) - 100f; + + float w0 = 2f * Mathf.PI * cutoffFrequency / VoiceChat.VoiceChatSettings.SampleRate; + float alpha = Mathf.Sin(w0) / (2f * 0.7071f); + + float a0 = 1f + alpha; + float w0Cos = Mathf.Cos(w0); + float oneMinusW0Cos = 1f - w0Cos; + b0 = (oneMinusW0Cos / 2f) / a0; + b1 = oneMinusW0Cos / a0; + b2 = (oneMinusW0Cos / 2f) / a0; + a1 = (-2f * w0Cos) / a0; + a2 = (1f - alpha) / a0; + } + } +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Audio/Filters/PitchShiftFilter.cs b/EXILED/Exiled.API/Features/Audio/Filters/PitchShiftFilter.cs new file mode 100644 index 0000000000..e013d9fae0 --- /dev/null +++ b/EXILED/Exiled.API/Features/Audio/Filters/PitchShiftFilter.cs @@ -0,0 +1,300 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) ExMod Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.API.Features.Audio.Filters +{ + using System; + + using Exiled.API.Interfaces.Audio; + + using UnityEngine; + + /// + /// A true DSP Granular Pitch Shifter based on the smbPitchShift algorithm. + /// + public sealed class PitchShiftFilter : IAudioFilter + { + private const int FftFrameSize = 2048; + private const int FftFrameSize2 = FftFrameSize / 2; + private const int MaxFrameLength = 8192; + + private static readonly float[] HannWindow = BuildHannWindow(); + + private readonly float[] gInFIFO = new float[MaxFrameLength]; + private readonly float[] gOutFIFO = new float[MaxFrameLength]; + private readonly float[] gFFTworksp = new float[2 * FftFrameSize]; + private readonly float[] gLastPhase = new float[FftFrameSize2 + 1]; + private readonly float[] gSumPhase = new float[FftFrameSize2 + 1]; + private readonly float[] gOutputAccum = new float[2 * FftFrameSize]; + private readonly float[] gAnaFreq = new float[FftFrameSize]; + private readonly float[] gAnaMagn = new float[FftFrameSize]; + private readonly float[] gSynFreq = new float[FftFrameSize]; + private readonly float[] gSynMagn = new float[FftFrameSize]; + + private readonly float[] outputBuffer = new float[MaxFrameLength]; + + private readonly float[] twiddleCos; + private readonly float[] twiddleSin; + + private long gRover = 0; + + private int cachedOversample = -1; + private long stepSize; + private long inFifoLatency; + private float expct; + + /// + /// Initializes a new instance of the class. + /// + /// The pitch multiplier. Above 1.0 for higher pitch, below 1.0 for lower pitch. + /// + /// The overlap factor controlling quality vs CPU usage. Higher values produce better quality but require more CPU. Must be a power of 2. Typical values: 2 (low CPU), 4 (default, balanced), 8 (high quality). + /// + public PitchShiftFilter(float pitch = 1.5f, int oversample = 4) + { + twiddleCos = new float[FftFrameSize]; + twiddleSin = new float[FftFrameSize]; + PrecomputeTwiddleFactors(); + + Pitch = pitch; + Oversample = oversample; + } + + /// + /// Gets or sets the pitch multiplier applied during playback. + /// Values above 1.0 produce a higher (thinner) pitch; values below 1.0 produce a lower (deeper) pitch. + /// + public float Pitch + { + get; + set => field = Mathf.Clamp(value, 0.1f, 4.0f); + } + + /// + /// Gets or sets the overlap factor controlling quality versus CPU usage. + /// Higher values improve quality but increase processing cost. Must be a power of 2. + /// Typical values: 2 (low CPU), 4 (balanced, default), 8 (high quality). + /// + public int Oversample + { + get; + set + { + field = Mathf.Clamp(value, 2, 32); + cachedOversample = -1; + } + } + + /// + public void Process(float[] frame) + { + if (Mathf.Abs(Pitch - 1.0f) < 0.001f) + return; + + EnsureOversampleConstants(); + SmbPitchShift(Pitch, frame.Length, frame, outputBuffer); + + Array.Copy(outputBuffer, frame, frame.Length); + } + + /// + public void Reset() + { + Array.Clear(gInFIFO, 0, gInFIFO.Length); + Array.Clear(gOutFIFO, 0, gOutFIFO.Length); + Array.Clear(gFFTworksp, 0, gFFTworksp.Length); + Array.Clear(gLastPhase, 0, gLastPhase.Length); + Array.Clear(gSumPhase, 0, gSumPhase.Length); + Array.Clear(gOutputAccum, 0, gOutputAccum.Length); + Array.Clear(gAnaFreq, 0, gAnaFreq.Length); + Array.Clear(gAnaMagn, 0, gAnaMagn.Length); + Array.Clear(gSynFreq, 0, gSynFreq.Length); + Array.Clear(gSynMagn, 0, gSynMagn.Length); + Array.Clear(outputBuffer, 0, outputBuffer.Length); + + gRover = 0; + cachedOversample = -1; + } + + private static float[] BuildHannWindow() + { + float[] window = new float[FftFrameSize]; + for (int i = 0; i < FftFrameSize; i++) + window[i] = 0.5f - (0.5f * Mathf.Cos(2.0f * Mathf.PI * i / FftFrameSize)); + + return window; + } + + private void PrecomputeTwiddleFactors() + { + for (int le = 4, k = 0; le <= FftFrameSize * 2; le <<= 1, k++) + { + int le2 = le >> 1; + float arg = Mathf.PI / (le2 >> 1); + twiddleCos[k] = Mathf.Cos(arg); + twiddleSin[k] = Mathf.Sin(arg); + } + } + + private void EnsureOversampleConstants() + { + if (cachedOversample == Oversample) + return; + + cachedOversample = Oversample; + stepSize = FftFrameSize / Oversample; + inFifoLatency = FftFrameSize - stepSize; + expct = 2.0f * Mathf.PI * stepSize / FftFrameSize; + + if (gRover == 0) + gRover = inFifoLatency; + } + + private void SmbPitchShift(float pitchShift, int numSampsToProcess, float[] indata, float[] outdata) + { + float freqPerBin = VoiceChat.VoiceChatSettings.SampleRate / (float)FftFrameSize; + + for (int i = 0; i < numSampsToProcess; i++) + { + gInFIFO[gRover] = indata[i]; + outdata[i] = gOutFIFO[gRover - inFifoLatency]; + gRover++; + + if (gRover < FftFrameSize) + continue; + + gRover = inFifoLatency; + + for (int k = 0; k < FftFrameSize; k++) + { + gFFTworksp[2 * k] = gInFIFO[k] * HannWindow[k]; + gFFTworksp[(2 * k) + 1] = 0.0f; + } + + SmbFft(gFFTworksp, -1); + + for (int k = 0; k <= FftFrameSize2; k++) + { + float real = gFFTworksp[2 * k]; + float imag = gFFTworksp[(2 * k) + 1]; + + float magn = 2.0f * Mathf.Sqrt((real * real) + (imag * imag)); + float phase = Mathf.Atan2(imag, real); + + float tmp = phase - gLastPhase[k]; + gLastPhase[k] = phase; + + tmp -= k * expct; + + long qpd = (long)(tmp / Mathf.PI); + if (qpd >= 0) + qpd += qpd & 1; + else + qpd -= qpd & 1; + + tmp -= Mathf.PI * qpd; + + tmp = Oversample * tmp / (2.0f * Mathf.PI); + tmp = (k * freqPerBin) + (tmp * freqPerBin); + + gAnaMagn[k] = magn; + gAnaFreq[k] = tmp; + } + + Array.Clear(gSynMagn, 0, FftFrameSize); + Array.Clear(gSynFreq, 0, FftFrameSize); + + for (int k = 0; k <= FftFrameSize2; k++) + { + long index = (long)(k * pitchShift); + if (index <= FftFrameSize2) + { + gSynMagn[index] += gAnaMagn[k]; + gSynFreq[index] = gAnaFreq[k] * pitchShift; + } + } + + for (int k = 0; k <= FftFrameSize2; k++) + { + float magn = gSynMagn[k]; + float tmp = gSynFreq[k]; + + tmp -= k * freqPerBin; + tmp /= freqPerBin; + tmp = 2.0f * Mathf.PI * tmp / Oversample; + tmp += k * expct; + + gSumPhase[k] += tmp; + + gFFTworksp[2 * k] = magn * Mathf.Cos(gSumPhase[k]); + gFFTworksp[(2 * k) + 1] = magn * Mathf.Sin(gSumPhase[k]); + } + + Array.Clear(gFFTworksp, FftFrameSize + 2, FftFrameSize - 2); + + SmbFft(gFFTworksp, 1); + + for (int k = 0; k < FftFrameSize; k++) + gOutputAccum[k] += 2.0f * HannWindow[k] * gFFTworksp[2 * k] / (FftFrameSize2 * Oversample); + + for (int k = 0; k < stepSize; k++) + gOutFIFO[k] = gOutputAccum[k]; + + Array.Copy(gOutputAccum, stepSize, gOutputAccum, 0, FftFrameSize); + Array.Clear(gOutputAccum, FftFrameSize, (int)stepSize); + + Array.Copy(gInFIFO, stepSize, gInFIFO, 0, inFifoLatency); + } + } + + private void SmbFft(float[] fftBuffer, int sign) + { + for (int i = 2; i < (2 * FftFrameSize) - 2; i += 2) + { + int j = 0; + for (int bitm = 2; bitm < 2 * FftFrameSize; bitm <<= 1) + { + if ((i & bitm) != 0) + j++; + j <<= 1; + } + + if (i < j) + { + (fftBuffer[j], fftBuffer[i]) = (fftBuffer[i], fftBuffer[j]); + (fftBuffer[j + 1], fftBuffer[i + 1]) = (fftBuffer[i + 1], fftBuffer[j + 1]); + } + } + + int stageIndex = 0; + for (int le = 4; le <= FftFrameSize * 2; le <<= 1, stageIndex++) + { + int le2 = le >> 1; + float wr = twiddleCos[stageIndex]; + float wi = twiddleSin[stageIndex] * sign; + float ur = 1.0f, ui = 0.0f; + + for (int j = 0; j < le2; j += 2) + { + for (int i = j; i < 2 * FftFrameSize; i += le) + { + float tr = (fftBuffer[i + le2] * ur) - (fftBuffer[i + le2 + 1] * ui); + float ti = (fftBuffer[i + le2] * ui) + (fftBuffer[i + le2 + 1] * ur); + fftBuffer[i + le2] = fftBuffer[i] - tr; + fftBuffer[i + le2 + 1] = fftBuffer[i + 1] - ti; + fftBuffer[i] += tr; + fftBuffer[i + 1] += ti; + } + + float newUr = (ur * wr) - (ui * wi); + ui = (ur * wi) + (ui * wr); + ur = newUr; + } + } + } + } +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Audio/PcmSources/CachedPcmSource.cs b/EXILED/Exiled.API/Features/Audio/PcmSources/CachedPcmSource.cs new file mode 100644 index 0000000000..728ccb3bc1 --- /dev/null +++ b/EXILED/Exiled.API/Features/Audio/PcmSources/CachedPcmSource.cs @@ -0,0 +1,122 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) ExMod Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.API.Features.Audio.PcmSources +{ + using System; + using System.IO; + + using Exiled.API.Features.Audio; + using Exiled.API.Interfaces.Audio; + using Exiled.API.Structs.Audio; + + using VoiceChat; + + /// + /// Provides an that plays audio data directly from the for optimized, repeated playback. + /// + public sealed class CachedPcmSource : IPcmSource + { + private readonly float[] data; + private int pos; + + /// + /// Initializes a new instance of the class by fetching already cached audio using its name. + /// + /// The name/key of the audio in the cache. + public CachedPcmSource(string name) + { + if (string.IsNullOrEmpty(name)) + { + Log.Error("[CachedPcmSource] Cannot initialize CachedPcmSource. Cache name cannot be null or empty."); + throw new ArgumentException("Cache name cannot be null or empty.", nameof(name)); + } + + if (!AudioDataStorage.AudioStorage.TryGetValue(name, out AudioData cachedAudio)) + { + Log.Error($"[CachedPcmSource] Audio with name '{name}' not found in AudioDataStorage."); + throw new FileNotFoundException($"Audio '{name}' is not cached. Please cache it first using AudioDataStorage"); + } + + data = cachedAudio.Pcm; + TrackInfo = cachedAudio.TrackInfo; + } + + /// + /// Initializes a new instance of the class by fetching cached audio or injecting raw PCM samples into the cache if not present. + /// + /// The custom name/key to assign to this audio in the cache. + /// The raw PCM audio samples (float array). + public CachedPcmSource(string name, float[] pcm) + { + if (string.IsNullOrEmpty(name) || pcm == null || pcm.Length == 0) + { + Log.Error($"[CachedPcmSource] Cannot initialize CachedPcmSource. Invalid name or empty PCM data for '{name}'."); + throw new ArgumentException("Name or PCM data cannot be null."); + } + + if (!AudioDataStorage.AudioStorage.ContainsKey(name)) + { + if (!AudioDataStorage.Add(name, pcm)) + { + Log.Error($"[CachedPcmSource] Failed to load raw PCM data into cache under the name '{name}'."); + throw new InvalidOperationException($"Failed to cache PCM data for '{name}'."); + } + } + + if (!AudioDataStorage.AudioStorage.TryGetValue(name, out AudioData cachedAudio)) + { + Log.Error($"[CachedPcmSource] Audio with name '{name}' could not be retrieved from storage after adding."); + throw new InvalidOperationException($"Failed to retrieve '{name}' from storage after caching."); + } + + data = cachedAudio.Pcm; + TrackInfo = cachedAudio.TrackInfo; + } + + /// + public TrackData TrackInfo { get; } + + /// + public bool Ended => pos >= data.Length; + + /// + public double TotalDuration => (double)data.Length / VoiceChatSettings.SampleRate; + + /// + public double CurrentTime + { + get => (double)pos / VoiceChatSettings.SampleRate; + set => Seek(value); + } + + /// + public int Read(float[] buffer, int offset, int count) + { + int read = Math.Min(count, data.Length - pos); + Array.Copy(data, pos, buffer, offset, read); + pos += read; + + return read; + } + + /// + public void Seek(double seconds) + { + long targetIndex = (long)(seconds * VoiceChatSettings.SampleRate); + pos = (int)Math.Max(0, Math.Min(targetIndex, data.Length)); + } + + /// + public void Reset() => pos = 0; + + /// + public void Dispose() + { + } + } +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Audio/PcmSources/MixerSource.cs b/EXILED/Exiled.API/Features/Audio/PcmSources/MixerSource.cs new file mode 100644 index 0000000000..d4c41ed693 --- /dev/null +++ b/EXILED/Exiled.API/Features/Audio/PcmSources/MixerSource.cs @@ -0,0 +1,243 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) ExMod Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.API.Features.Audio.PcmSources +{ + using System; + using System.Buffers; + using System.Collections.Generic; + using System.Linq; + + using Exiled.API.Features.Pools; + using Exiled.API.Interfaces.Audio; + using Exiled.API.Structs.Audio; + + using UnityEngine; + + /// + /// Provides an that dynamically mixes multiple audio sources together in real-time. + /// + /// This allows playing overlapping sounds (e.g., background music + voice announcements) simultaneously + /// through a single speaker without needing multiple Voice Controller IDs. + /// + /// + public sealed class MixerSource : IPcmSource + { + private readonly object sourcesLock = new(); + + private volatile IPcmSource[] sources; + + /// + /// Initializes a new instance of the class with the specified initial sources. + /// + /// An array of instances to mix. + public MixerSource(IEnumerable initialSources) + { + sources = initialSources?.Where(source => source != null).ToArray() ?? Array.Empty(); + TrackInfo = new TrackData { Path = "Audio Mixer", Duration = 0 }; + } + + /// + /// Gets a value indicating whether this mixer contains any live audio sources. + /// + public bool ContainsLiveSource + { + get + { + IPcmSource[] currentSources = sources; + return currentSources.Any(source => source is ILiveSource || (source is MixerSource mixer && mixer.ContainsLiveSource)); + } + } + + /// + /// Gets or sets a value indicating whether the mixer should stay alive and output silence even when all internal sources have finished playing. + /// + public bool KeepAlive { get; set; } + + /// + public TrackData TrackInfo { get; } + + /// + public double TotalDuration + { + get + { + IPcmSource[] currentSources = sources; + return currentSources.Length > 0 ? currentSources.Max(x => x.TotalDuration) : 0.0; + } + } + + /// + public double CurrentTime + { + get + { + IPcmSource[] currentSources = sources; + return currentSources.Length > 0 ? currentSources.Max(x => x.CurrentTime) : 0.0; + } + set => Seek(value); + } + + /// + public bool Ended + { + get + { + IPcmSource[] currentSources = sources; + return !KeepAlive && (currentSources.Length == 0 || currentSources.All(x => x.Ended)); + } + } + + /// + public int Read(float[] buffer, int offset, int count) + { + IPcmSource[] currentSources = sources; + + if (currentSources.Length == 0) + { + Array.Clear(buffer, offset, count); + return KeepAlive ? count : 0; + } + + Array.Clear(buffer, offset, count); + + float[] temp = ArrayPool.Shared.Rent(count); + + try + { + int maxRead = 0; + bool needsCleanup = false; + + foreach (IPcmSource src in currentSources) + { + if (src.Ended) + { + needsCleanup = true; + continue; + } + + int read = src.Read(temp, 0, count); + if (read > maxRead) + maxRead = read; + + for (int i = 0; i < read; i++) + buffer[offset + i] += temp[i]; + } + + for (int i = 0; i < maxRead; i++) + buffer[offset + i] = Mathf.Clamp(buffer[offset + i], -1f, 1f); + + if (needsCleanup) + CleanupEndedSources(); + + return KeepAlive ? count : maxRead; + } + finally + { + ArrayPool.Shared.Return(temp); + } + } + + /// + public void Seek(double seconds) + { + IPcmSource[] currentSources = sources; + foreach (IPcmSource pcmSource in currentSources) + pcmSource.Seek(seconds); + } + + /// + public void Reset() + { + IPcmSource[] currentSources = sources; + foreach (IPcmSource pcmSource in currentSources) + pcmSource.Reset(); + } + + /// + public void Dispose() + { + lock (sourcesLock) + { + foreach (IPcmSource pcmSource in sources) + pcmSource?.Dispose(); + + sources = Array.Empty(); + } + } + + /// + /// Dynamically adds a new to the mixer while it is playing. + /// + /// The audio source to add. + public void AddSource(IPcmSource source) + { + if (source == null) + return; + + lock (sourcesLock) + { + List newList = ListPool.Pool.Get(sources); + newList.Add(source); + sources = newList.ToArray(); + ListPool.Pool.Return(newList); + } + } + + /// + /// Dynamically removes an existing from the mixer. + /// + /// The audio source to remove. + /// If true, automatically calls Dispose on the removed source. + public void RemoveSource(IPcmSource source, bool dispose = true) + { + if (source == null) + return; + + lock (sourcesLock) + { + List newList = ListPool.Pool.Get(sources); + if (newList.Remove(source)) + { + sources = newList.ToArray(); + + if (dispose) + source.Dispose(); + } + + ListPool.Pool.Return(newList); + } + } + + private void CleanupEndedSources() + { + lock (sourcesLock) + { + List currentSources = ListPool.Pool.Get(sources); + bool changed = false; + + for (int i = currentSources.Count - 1; i >= 0; i--) + { + IPcmSource source = currentSources[i]; + + if (!source.Ended) + continue; + + source.Dispose(); + currentSources.RemoveAt(i); + + changed = true; + } + + if (changed) + sources = currentSources.ToArray(); + + ListPool.Pool.Return(currentSources); + } + } + } +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Audio/PcmSources/PlayerVoiceSource.cs b/EXILED/Exiled.API/Features/Audio/PcmSources/PlayerVoiceSource.cs new file mode 100644 index 0000000000..bad52adcbd --- /dev/null +++ b/EXILED/Exiled.API/Features/Audio/PcmSources/PlayerVoiceSource.cs @@ -0,0 +1,123 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) ExMod Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.API.Features.Audio.PcmSources +{ + using System.Collections.Concurrent; + + using Exiled.API.Features; + using Exiled.API.Interfaces.Audio; + using Exiled.API.Structs.Audio; + + using LabApi.Events.Arguments.PlayerEvents; + + using VoiceChat; + using VoiceChat.Codec; + + /// + /// Provides a that captures and decodes live microphone input from a specific player. + /// + public sealed class PlayerVoiceSource : IPcmSource, ILiveSource + { + private readonly Player sourcePlayer; + private readonly OpusDecoder decoder; + private readonly float[] decodeBuffer; + private readonly ConcurrentQueue pcmQueue; + + /// + /// Initializes a new instance of the class. + /// + /// The player whose voice will be captured. + /// If true, prevents the player's original voice message's from being heard while broadcasting. + public PlayerVoiceSource(Player player, bool blockOriginalVoice = false) + { + sourcePlayer = player; + BlockOriginalVoice = blockOriginalVoice; + + decoder = new OpusDecoder(); + pcmQueue = new ConcurrentQueue(); + decodeBuffer = new float[VoiceChatSettings.PacketSizePerChannel]; + + TrackInfo = new TrackData + { + Path = $"{player.Nickname}-Mic", + Duration = double.PositiveInfinity, + }; + + LabApi.Events.Handlers.PlayerEvents.SendingVoiceMessage += OnVoiceChatting; + } + + /// + /// Gets or sets a value indicating whether the player's original voice chat should be blocked while being broadcasted by this source. + /// + public bool BlockOriginalVoice { get; set; } + + /// + public TrackData TrackInfo { get; } + + /// + public double TotalDuration => double.PositiveInfinity; + + /// + public double CurrentTime + { + get => 0.0; + set => Seek(value); + } + + /// + public bool Ended => sourcePlayer?.GameObject == null; + + /// + public int Read(float[] buffer, int offset, int count) + { + if (Ended) + return 0; + + int read = 0; + while (read < count && pcmQueue.TryDequeue(out float sample)) + { + buffer[offset + read] = sample; + read++; + } + + return read; + } + + /// + public void Seek(double seconds) => Log.Info("[PlayerVoiceSource] Seeking is not supported for live player voice streams."); + + /// + public void Reset() => Log.Info("[PlayerVoiceSource] Resetting is not supported for live player voice streams."); + + /// + public void Dispose() + { + LabApi.Events.Handlers.PlayerEvents.SendingVoiceMessage -= OnVoiceChatting; + decoder?.Dispose(); + } + + private void OnVoiceChatting(PlayerSendingVoiceMessageEventArgs ev) + { + if (ev.Player != sourcePlayer) + return; + + if (ev.Message.DataLength <= 2) + return; + + if (BlockOriginalVoice) + ev.IsAllowed = false; + + int decodedSamples = decoder.Decode(ev.Message.Data, ev.Message.DataLength, decodeBuffer); + + for (int i = 0; i < decodedSamples; i++) + { + pcmQueue.Enqueue(decodeBuffer[i]); + } + } + } +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Audio/PcmSources/PreloadedPcmSource.cs b/EXILED/Exiled.API/Features/Audio/PcmSources/PreloadedPcmSource.cs new file mode 100644 index 0000000000..3277dedee8 --- /dev/null +++ b/EXILED/Exiled.API/Features/Audio/PcmSources/PreloadedPcmSource.cs @@ -0,0 +1,159 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) ExMod Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.API.Features.Audio.PcmSources +{ + using System; + using System.Threading; + using System.Threading.Tasks; + + using Exiled.API.Features.Audio; + using Exiled.API.Interfaces.Audio; + using Exiled.API.Structs.Audio; + + using VoiceChat; + + /// + /// Provides a preloaded with Pcm data or file. + /// + public sealed class PreloadedPcmSource : IPcmSource, IAsyncPcmSource + { + private readonly object trackInfoLock = new(); + + private int pos; + private float[] data; + private CancellationTokenSource cts; + + private volatile bool isReady; + private volatile bool isFailed; + private volatile bool isDisposed; + + /// + /// Initializes a new instance of the class. + /// + /// The raw PCM float array. + public PreloadedPcmSource(float[] pcmData) + { + data = pcmData; + isReady = true; + TrackInfo = new TrackData { Duration = TotalDuration }; + } + + /// + /// Initializes a new instance of the class. + /// + /// The path to the audio file. + public PreloadedPcmSource(string path) + { + TrackInfo = new TrackData { Path = path, Duration = 0.0 }; + + cts = new CancellationTokenSource(); + CancellationToken token = cts.Token; + + Task.Run(() => ReadAudio(path), token); + } + + /// + public TrackData TrackInfo + { + get + { + lock (trackInfoLock) + return field; + } + + private set + { + lock (trackInfoLock) + field = value; + } + } + + /// + public bool Ended => isFailed || isDisposed || (isReady && data != null && pos >= data.Length); + + /// + public double TotalDuration => isReady && data != null ? (double)data.Length / VoiceChatSettings.SampleRate : 0.0; + + /// + public double CurrentTime + { + get => isReady && data != null ? (double)pos / VoiceChatSettings.SampleRate : 0.0; + set => Seek(value); + } + + /// + public bool IsFailed => isFailed; + + /// + public bool IsReady => isReady; + + /// + public int Read(float[] buffer, int offset, int count) + { + if (isFailed || isDisposed) + return 0; + + if (!isReady || data == null) + { + Array.Clear(buffer, offset, count); + return count; + } + + int read = Math.Min(count, data.Length - pos); + Array.Copy(data, pos, buffer, offset, read); + pos += read; + + return read; + } + + /// + public void Seek(double seconds) + { + if (!isReady || data == null || data.Length == 0) + return; + + pos = (int)Math.Clamp(seconds * VoiceChatSettings.SampleRate, 0, data.Length); + } + + /// + public void Reset() => pos = 0; + + /// + public void Dispose() + { + isDisposed = true; + isReady = false; + + CancellationTokenSource localCts = Interlocked.Exchange(ref cts, null); + if (localCts != null) + { + localCts.Cancel(); + localCts.Dispose(); + } + } + + private void ReadAudio(string path) + { + try + { + AudioData result = WavUtility.WavToPcm(path); + data = result.Pcm; + TrackInfo = result.TrackInfo; + isReady = true; + } + catch (OperationCanceledException) + { + } + catch (Exception ex) + { + Log.Error($"[PreloadedPcmSource] Failed to load audio from path: {path} | Error: {ex.Message}"); + isFailed = true; + } + } + } +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Audio/PcmSources/VoiceRssTtsSource.cs b/EXILED/Exiled.API/Features/Audio/PcmSources/VoiceRssTtsSource.cs new file mode 100644 index 0000000000..b071481c78 --- /dev/null +++ b/EXILED/Exiled.API/Features/Audio/PcmSources/VoiceRssTtsSource.cs @@ -0,0 +1,267 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) ExMod Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.API.Features.Audio.PcmSources +{ + using System; + using System.Collections.Concurrent; + using System.Collections.Generic; + using System.Linq; + using System.Threading; + using System.Threading.Tasks; + + using Exiled.API.Features; + using Exiled.API.Interfaces.Audio; + using Exiled.API.Structs.Audio; + + using MEC; + + using UnityEngine.Networking; + + /// + /// Provides a that converts text to speech using the VoiceRSS Text-to-Speech API. + /// + public sealed class VoiceRssTtsSource : IPcmSource, IAsyncPcmSource + { + private const string ApiEndpoint = "https://api.voicerss.org/"; + private const string AudioFormat = "48khz_16bit_mono"; + + private static readonly ConcurrentDictionary BlacklistKeys = new(); + + private IPcmSource internalSource; + private CancellationTokenSource cts; + private CoroutineHandle downloadRoutine; + + private volatile bool isReady; + private volatile bool isFailed; + private volatile bool isDisposed; + + /// + /// Initializes a new instance of the class. + /// + /// The text to convert to speech.(Length limited by 100KB). + /// Your VoiceRSS API key. Get a free key at . + /// The language and locale code for the TTS voice. See for all supported language codes. + /// Optional specific voice name for the selected language.(See for available voices per language.) + /// Speech rate from -10 (slowest) to 10 (fastest). Defaults to 0 (normal speed). + public VoiceRssTtsSource(string text, string apiKey, string language = "en-us", string voice = null, int rate = 0) + : this(text, new[] { apiKey }, language, voice, rate) + { + } + + /// + /// Initializes a new instance of the class. + /// + /// The text to convert to speech.(Length limited by 100KB). + /// Your VoiceRSS API keys. Get a free key at . + /// The language and locale code for the TTS voice. See for all supported language codes. + /// Optional specific voice name for the selected language.(See for available voices per language.) + /// Speech rate from -10 (slowest) to 10 (fastest). Defaults to 0 (normal speed). + public VoiceRssTtsSource(string text, IEnumerable apiKeys, string language = "en-us", string voice = null, int rate = 0) + { + if (string.IsNullOrEmpty(text)) + { + isFailed = true; + Log.Error("[VoiceRssTtsSource] Text cannot be null or empty."); + throw new ArgumentException("Text cannot be null or empty.", nameof(text)); + } + + if (apiKeys == null || !apiKeys.Any()) + { + isFailed = true; + Log.Error("[VoiceRssTtsSource] At least one API key must be provided."); + throw new ArgumentException("API key collection cannot be null or empty.", nameof(apiKeys)); + } + + cts = new CancellationTokenSource(); + TrackInfo = new TrackData { Path = $"VoiceRssTts: {text}", Duration = 0.0 }; + downloadRoutine = Timing.RunCoroutine(DownloadRoutine(text, apiKeys, language, voice, rate)); + } + + /// + public TrackData TrackInfo { get; private set; } + + /// + public double TotalDuration => isReady && internalSource != null ? internalSource.TotalDuration : 0.0; + + /// + public double CurrentTime + { + get => isReady && internalSource != null ? internalSource.CurrentTime : 0.0; + set => Seek(value); + } + + /// + public bool Ended => isFailed || isDisposed || (isReady && internalSource != null && internalSource.Ended); + + /// + public bool IsFailed => isFailed; + + /// + public bool IsReady => isReady; + + /// + public int Read(float[] buffer, int offset, int count) + { + if (isFailed || isDisposed) + return 0; + + if (!isReady || internalSource == null) + { + Array.Clear(buffer, offset, count); + return count; + } + + return internalSource.Read(buffer, offset, count); + } + + /// + public void Seek(double seconds) + { + if (isReady) + internalSource?.Seek(seconds); + } + + /// + public void Reset() + { + if (isReady) + internalSource?.Reset(); + } + + /// + public void Dispose() + { + isReady = false; + isDisposed = true; + + if (downloadRoutine.IsRunning) + downloadRoutine.IsRunning = false; + + CancellationTokenSource localCts = Interlocked.Exchange(ref cts, null); + if (localCts != null) + { + localCts.Cancel(); + localCts.Dispose(); + } + + internalSource?.Dispose(); + internalSource = null; + } + + private IEnumerator DownloadRoutine(string text, IEnumerable apiKeys, string language, string voice, int rate) + { + CancellationToken token = cts.Token; + string clampedRate = Math.Clamp(rate, -10, 10).ToString(); + string textEscaped = Uri.EscapeDataString(text); + string langEscaped = Uri.EscapeDataString(language); + string voiceEscaped = string.IsNullOrEmpty(voice) ? string.Empty : $"&v={Uri.EscapeDataString(voice)}"; + + bool successfulDownload = false; + byte[] rawBytes = null; + + foreach (string apiKey in apiKeys) + { + if (string.IsNullOrWhiteSpace(apiKey)) + continue; + + if (BlacklistKeys.TryGetValue(apiKey, out DateTime exhaustedAt)) + { + if (DateTime.UtcNow.Day == exhaustedAt.Day) + continue; + + BlacklistKeys.Remove(apiKey, out _); + } + + string url = $"{ApiEndpoint}?key={Uri.EscapeDataString(apiKey)}&hl={langEscaped}&c=WAV&f={AudioFormat}&r={clampedRate}&src={textEscaped}{voiceEscaped}"; + + UnityWebRequest request; + try + { + request = UnityWebRequest.Get(url); + } + catch (Exception ex) + { + Log.Error($"[VoiceRssTtsSource] Failed to create request for URL '{url}'. Error: {ex.Message}"); + break; + } + + using (request) + { + yield return Timing.WaitUntilDone(request.SendWebRequest()); + + if (isDisposed || token.IsCancellationRequested) + yield break; + + if (request.result != UnityWebRequest.Result.Success) + { + Log.Error($"[VoiceRssTtsSource] Network error: {request.error}"); + break; + } + + string responseText = request.downloadHandler.text; + if (!string.IsNullOrEmpty(responseText) && responseText.StartsWith("ERROR: ")) + { + string errorMessage = responseText[7..].Trim(); + + if (errorMessage.Contains("limit") || errorMessage.Contains("expired") || errorMessage.Contains("inactive") || errorMessage.Contains("API key")) + { + Log.Warn($"[VoiceRssTtsSource] Key exhausted: '{apiKey}'. Error: {errorMessage}. Trying next key..."); + BlacklistKeys[apiKey] = DateTime.UtcNow; + continue; + } + + Log.Error($"[VoiceRssTtsSource] API error: {errorMessage}"); + break; + } + + rawBytes = request.downloadHandler.data; + successfulDownload = true; + break; + } + } + + if (!successfulDownload) + { + isFailed = true; + yield break; + } + + if (isDisposed || token.IsCancellationRequested) + yield break; + + Task toPcmTask = Task.Run(() => WavUtility.WavToPcm(rawBytes), token); + + yield return Timing.WaitUntilTrue(() => toPcmTask.IsCompleted || isDisposed || token.IsCancellationRequested); + + if (isDisposed || token.IsCancellationRequested) + yield break; + + if (toPcmTask.IsFaulted) + { + Log.Error($"[VoiceRssTtsSource] Error read the downloaded file! \nError: {toPcmTask.Exception?.InnerException?.Message ?? toPcmTask.Exception?.Message}"); + isFailed = true; + yield break; + } + + AudioData audioData = toPcmTask.Result; + audioData.TrackInfo.Path = $"VoiceRSS: {text}"; + + try + { + internalSource = new PreloadedPcmSource(audioData.Pcm); + TrackInfo = audioData.TrackInfo; + isReady = true; + } + catch (Exception ex) + { + Log.Error($"[VoiceRssTtsSource] Failed to create internal source! \nError: {ex.InnerException?.Message ?? ex.Message}"); + isFailed = true; + } + } + } +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Audio/PcmSources/WavStreamSource.cs b/EXILED/Exiled.API/Features/Audio/PcmSources/WavStreamSource.cs new file mode 100644 index 0000000000..9ac1c09a9c --- /dev/null +++ b/EXILED/Exiled.API/Features/Audio/PcmSources/WavStreamSource.cs @@ -0,0 +1,140 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) ExMod Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.API.Features.Audio.PcmSources +{ + using System; + using System.Buffers; + using System.IO; + using System.Runtime.InteropServices; + using System.Threading; + + using Exiled.API.Features.Audio; + using Exiled.API.Interfaces.Audio; + using Exiled.API.Structs.Audio; + + using VoiceChat; + + /// + /// Provides a from a WAV file stream. + /// + public sealed class WavStreamSource : IPcmSource + { + private const float Divide = 1f / 32768f; + + private readonly long endPosition; + private readonly long startPosition; + private readonly FileStream stream; + + private byte[] internalBuffer; + private volatile bool isDisposed; + + /// + /// Initializes a new instance of the class. + /// + /// The path to the audio file. + public WavStreamSource(string path) + { + stream = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read, 64 * 1024, FileOptions.SequentialScan); + TrackInfo = WavUtility.SkipHeader(stream); + startPosition = stream.Position; + endPosition = stream.Length; + internalBuffer = ArrayPool.Shared.Rent(VoiceChatSettings.PacketSizePerChannel * 2); + } + + /// + public TrackData TrackInfo { get; } + + /// + public double TotalDuration => (endPosition - startPosition) / 2.0 / VoiceChatSettings.SampleRate; + + /// + public double CurrentTime + { + get => isDisposed ? 0.0 : (stream.Position - startPosition) / 2.0 / VoiceChatSettings.SampleRate; + set => Seek(value); + } + + /// + public bool Ended => isDisposed || stream.Position >= endPosition; + + /// + public int Read(float[] buffer, int offset, int count) + { + if (isDisposed) + { + Array.Clear(buffer, offset, count); + return 0; + } + + try + { + count = Math.Min(count, buffer.Length - offset); + + if (count <= 0) + return 0; + + int bytesNeeded = count * 2; + + if (internalBuffer.Length < bytesNeeded) + { + ArrayPool.Shared.Return(internalBuffer); + internalBuffer = ArrayPool.Shared.Rent(bytesNeeded); + } + + int bytesRead = stream.Read(internalBuffer, 0, bytesNeeded); + + if (bytesRead == 0) + return 0; + + if (bytesRead % 2 != 0) + bytesRead--; + + Span byteSpan = internalBuffer.AsSpan(0, bytesRead); + Span shortSpan = MemoryMarshal.Cast(byteSpan); + + for (int i = 0; i < shortSpan.Length; i++) + buffer[offset + i] = shortSpan[i] * Divide; + + return shortSpan.Length; + } + catch (ObjectDisposedException) + { + Array.Clear(buffer, offset, count); + return 0; + } + } + + /// + public void Seek(double seconds) + { + if (isDisposed) + return; + + long newPos = Math.Clamp(startPosition + ((long)(seconds * VoiceChatSettings.SampleRate) * 2), startPosition, endPosition); + + if (newPos % 2 != 0) + newPos--; + + stream.Position = newPos; + } + + /// + public void Reset() => stream.Position = startPosition; + + /// + public void Dispose() + { + isDisposed = true; + stream?.Dispose(); + + byte[] buf = Interlocked.Exchange(ref internalBuffer, null); + if (buf != null) + ArrayPool.Shared.Return(buf); + } + } +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Audio/PcmSources/WebWavPcmSource.cs b/EXILED/Exiled.API/Features/Audio/PcmSources/WebWavPcmSource.cs new file mode 100644 index 0000000000..3376e0d25b --- /dev/null +++ b/EXILED/Exiled.API/Features/Audio/PcmSources/WebWavPcmSource.cs @@ -0,0 +1,185 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) ExMod Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.API.Features.Audio.PcmSources +{ + using System; + using System.Collections.Generic; + using System.Threading; + using System.Threading.Tasks; + + using Exiled.API.Features; + using Exiled.API.Interfaces.Audio; + using Exiled.API.Structs.Audio; + + using MEC; + + using UnityEngine.Networking; + + /// + /// Provides a that downloads a .wav file from a URL and preloads it for playback. + /// + public sealed class WebWavPcmSource : IPcmSource, IAsyncPcmSource + { + private IPcmSource internalSource; + private CancellationTokenSource cts; + private CoroutineHandle downloadRoutine; + + private volatile bool isReady; + private volatile bool isFailed; + private volatile bool isDisposed; + + /// + /// Initializes a new instance of the class. + /// + /// The direct URL to the .wav file. + public WebWavPcmSource(string url) + { + TrackInfo = default; + cts = new CancellationTokenSource(); + downloadRoutine = Timing.RunCoroutine(Download(url)); + } + + /// + public TrackData TrackInfo { get; private set; } + + /// + public double TotalDuration => isReady && internalSource != null ? internalSource.TotalDuration : 0.0; + + /// + public double CurrentTime + { + get => isReady && internalSource != null ? internalSource.CurrentTime : 0.0; + set => Seek(value); + } + + /// + public bool Ended => isFailed || isDisposed || (isReady && internalSource != null && internalSource.Ended); + + /// + public bool IsFailed => isFailed; + + /// + public bool IsReady => isReady; + + /// + public int Read(float[] buffer, int offset, int count) + { + if (isFailed || isDisposed) + return 0; + + if (!isReady || internalSource == null) + { + Array.Clear(buffer, offset, count); + return count; + } + + return internalSource.Read(buffer, offset, count); + } + + /// + public void Seek(double seconds) + { + if (isReady) + internalSource?.Seek(seconds); + } + + /// + public void Reset() + { + if (isReady) + internalSource?.Reset(); + } + + /// + public void Dispose() + { + isDisposed = true; + isReady = false; + + if (downloadRoutine.IsRunning) + downloadRoutine.IsRunning = false; + + CancellationTokenSource localCts = Interlocked.Exchange(ref cts, null); + if (localCts != null) + { + localCts.Cancel(); + localCts.Dispose(); + } + + internalSource?.Dispose(); + internalSource = null; + } + + private IEnumerator Download(string url) + { + CancellationToken token = cts.Token; + byte[] rawBytes = null; + + UnityWebRequest request; + try + { + request = UnityWebRequest.Get(url); + } + catch (Exception ex) + { + Log.Error($"[WebWavPcmSource] Failed to create request. URL: {url} | Error: {ex.Message}"); + isFailed = true; + yield break; + } + + using (request) + { + yield return Timing.WaitUntilDone(request.SendWebRequest()); + + if (isDisposed || token.IsCancellationRequested) + yield break; + + if (request.result != UnityWebRequest.Result.Success) + { + Log.Error($"[WebWavPcmSource] Failed to download! URL: {url} | Error: {request.error}"); + isFailed = true; + yield break; + } + + rawBytes = request.downloadHandler.data; + } + + if (isDisposed || token.IsCancellationRequested) + yield break; + + Task toPcmTask = Task.Run(() => WavUtility.WavToPcm(rawBytes), token); + + yield return Timing.WaitUntilTrue(() => toPcmTask.IsCompleted || token.IsCancellationRequested); + + if (isDisposed || token.IsCancellationRequested) + yield break; + + if (toPcmTask.IsFaulted) + { + Log.Error($"[WebWavPcmSource] Failed to parse WAV. Ensure URL points to a valid 16-bit mono 48kHz WAV.\nError: {toPcmTask.Exception?.InnerException?.Message ?? toPcmTask.Exception?.Message}"); + isFailed = true; + yield break; + } + + AudioData audioData = toPcmTask.Result; + audioData.TrackInfo.Path = url; + + try + { + internalSource = new PreloadedPcmSource(audioData.Pcm); + TrackInfo = audioData.TrackInfo; + isReady = true; + } + catch (Exception ex) + { + Log.Error($"[WebWavPcmSource] Failed to create internal source.\nError: {ex.InnerException?.Message ?? ex.Message}"); + isFailed = true; + } + } + } +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Audio/PlaybackSettings.cs b/EXILED/Exiled.API/Features/Audio/PlaybackSettings.cs new file mode 100644 index 0000000000..85a614ce91 --- /dev/null +++ b/EXILED/Exiled.API/Features/Audio/PlaybackSettings.cs @@ -0,0 +1,96 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) ExMod Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.API.Features.Audio +{ + using System; + using System.Collections.Generic; + + using Exiled.API.Enums; + using Exiled.API.Features; + using Exiled.API.Features.Toys; + using Exiled.API.Interfaces.Audio; + + /// + /// Represents all configurable audio and network settings for play from pool method. + /// + public struct PlaybackSettings + { + /// + /// Initializes a new instance of the struct. + /// + public PlaybackSettings() + { + } + + /// + /// Gets or sets the volume level. + /// + public float Volume { get; set; } = Speaker.DefaultVolume; + + /// + /// Gets or sets the playback pitch. + /// + public float Pitch { get; set; } = 1f; + + /// + /// Gets or sets a value indicating whether the audio source is spatialized (3D sound). + /// + public bool IsSpatial { get; set; } = Speaker.DefaultSpatial; + + /// + /// Gets or sets the minimum distance at which the audio reaches full volume. + /// + public float MinDistance { get; set; } = Speaker.DefaultMinDistance; + + /// + /// Gets or sets the maximum distance at which the audio can be heard. + /// + public float MaxDistance { get; set; } = Speaker.DefaultMaxDistance; + + /// + /// Gets or sets a value indicating whether the file should be streamed from disk. + /// Ignored for web URLs and cached sources. + /// + public bool Stream { get; set; } = false; + + /// + /// Gets or sets a value indicating whether to load the audio via the storage Manager for optimized playback. + /// + public bool UseCache { get; set; } = false; + + /// + /// Gets or sets the Mirror network channel used for sending audio packets. + /// + public int Channel { get; set; } = Speaker.DefaultChannel; + + /// + /// Gets or sets the play mode determining how the audio is sent to players. + /// + public SpeakerPlayMode PlayMode { get; set; } = SpeakerPlayMode.Global; + + /// + /// Gets or sets the target player (used when is ). + /// + public Player TargetPlayer { get; set; } = null; + + /// + /// Gets or sets the list of target players (used when is ). + /// + public HashSet TargetPlayers { get; set; } = null; + + /// + /// Gets or sets the condition used to determine which players hear the audio (used when is ). + /// + public Func Predicate { get; set; } = null; + + /// + /// Gets or sets an optional custom audio filter to apply to the PCM data. + /// + public IAudioFilter Filter { get; set; } = null; + } +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Audio/ScheduledEvent.cs b/EXILED/Exiled.API/Features/Audio/ScheduledEvent.cs new file mode 100644 index 0000000000..a87768f3c8 --- /dev/null +++ b/EXILED/Exiled.API/Features/Audio/ScheduledEvent.cs @@ -0,0 +1,52 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) ExMod Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.API.Features.Audio +{ + using System; + + /// + /// Represents a time-based action for audio playback. + /// + public class ScheduledEvent : IComparable + { + /// + /// Initializes a new instance of the class. + /// + /// The exact time in seconds to trigger the action. + /// The action to execute. + /// The optional unique identifier for the event. If null, a random GUID will be generated automatically. + public ScheduledEvent(double time, Action action, string id = null) + { + Time = time; + Action = action; + Id = id ?? Guid.NewGuid().ToString(); + } + + /// + /// Gets the specific time in seconds at which the event should trigger. + /// + public double Time { get; } + + /// + /// Gets the action to be invoked when the specified time is reached. + /// + public Action Action { get; } + + /// + /// Gets the unique identifier for this time event. + /// + public string Id { get; } + + /// + /// Compares this instance to another based on their trigger times. + /// + /// The other to compare to. + /// A value that indicates the relative order of the events being compared. + public int CompareTo(ScheduledEvent other) => Time.CompareTo(other.Time); + } +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Audio/SpeakerEvents.cs b/EXILED/Exiled.API/Features/Audio/SpeakerEvents.cs new file mode 100644 index 0000000000..da580416f9 --- /dev/null +++ b/EXILED/Exiled.API/Features/Audio/SpeakerEvents.cs @@ -0,0 +1,99 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) ExMod Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.API.Features.Audio +{ + using System; + + using Exiled.API.Structs.Audio; + + using Toys; + + /// + /// Contains global event handlers related to the audio system. + /// + public static class SpeakerEvents + { + /// + /// Invoked when a speaker starts playing an audio track. + /// + public static event Action PlaybackStarted; + + /// + /// Invoked when the audio playback of a speaker is paused. + /// + public static event Action PlaybackPaused; + + /// + /// Invoked when the audio playback of a speaker is resumed from a paused state. + /// + public static event Action PlaybackResumed; + + /// + /// Invoked when the audio playback of a speaker loops back to the beginning. + /// + public static event Action PlaybackLooped; + + /// + /// Invoked just before the speaker switches to the next track in the queue. + /// + public static event Action TrackSwitching; + + /// + /// Invoked when a speaker finishes playing its current audio track. + /// + public static event Action PlaybackFinished; + + /// + /// Invoked when a speaker's audio playback is completely stopped. + /// + public static event Action PlaybackStopped; + + /// + /// Called when a speaker starts playing an audio track. + /// + /// The instance. + internal static void OnPlaybackStarted(Speaker speaker) => PlaybackStarted?.Invoke(speaker); + + /// + /// Called when the audio playback of a speaker is paused. + /// + /// The instance. + internal static void OnPlaybackPaused(Speaker speaker) => PlaybackPaused?.Invoke(speaker); + + /// + /// Called when the audio playback of a speaker is resumed from a paused state. + /// + /// The instance. + internal static void OnPlaybackResumed(Speaker speaker) => PlaybackResumed?.Invoke(speaker); + + /// + /// Called when the audio playback of a speaker loops back to the beginning. + /// + /// The instance. + internal static void OnPlaybackLooped(Speaker speaker) => PlaybackLooped?.Invoke(speaker); + + /// + /// Called just before the speaker switches to the next track in the queue. + /// + /// The instance. + /// The upcoming to be played. + internal static void OnTrackSwitching(Speaker speaker, QueuedTrack nextTrack) => TrackSwitching?.Invoke(speaker, nextTrack); + + /// + /// Called when a speaker finishes playing its current audio track. + /// + /// The instance. + internal static void OnPlaybackFinished(Speaker speaker) => PlaybackFinished?.Invoke(speaker); + + /// + /// Called when a speaker's audio playback is completely stopped. + /// + /// The instance. + internal static void OnPlaybackStopped(Speaker speaker) => PlaybackStopped?.Invoke(speaker); + } +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Audio/WavUtility.cs b/EXILED/Exiled.API/Features/Audio/WavUtility.cs new file mode 100644 index 0000000000..0fbe9a7bf9 --- /dev/null +++ b/EXILED/Exiled.API/Features/Audio/WavUtility.cs @@ -0,0 +1,387 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) ExMod Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.API.Features.Audio +{ + using System; + using System.Buffers; + using System.Buffers.Binary; + using System.Collections.Generic; + using System.IO; + using System.Runtime.InteropServices; + + using Exiled.API.Features.Audio.PcmSources; + using Exiled.API.Interfaces.Audio; + using Exiled.API.Structs.Audio; + + using MEC; + + using UnityEngine.Networking; + + using VoiceChat; + + /// + /// Provides utility methods for working with WAV audio files. + /// + public static class WavUtility + { + private const float Divide = 1f / 32768f; + + /// + /// Evaluates the given local path or URL and returns the appropriate for .wav playback. + /// + /// The local file path or web URL of the .wav file. + /// If true, streams local files directly from disk. If false, preloads them into memory (Ignored for web URLs). + /// If true, loads the audio via for zero-latency memory playback. + /// An initialized . + public static IPcmSource CreatePcmSource(string path, bool stream = false, bool cache = false) + { + if (cache) + { + if (!AudioDataStorage.AudioStorage.ContainsKey(path)) + CacheWav(path, path); + + return new CachedPcmSource(path); + } + + if (path.StartsWith("http")) + return new WebWavPcmSource(path); + + if (stream) + return new WavStreamSource(path); + + return new PreloadedPcmSource(path); + } + + /// + /// Loads and stores a local .wav file under the specified name. + /// + /// The unique storage key to assign to this audio. + /// The absolute path to the local .wav file. + /// true if the file was successfully loaded and stored; otherwise, false. + public static bool CacheWav(string name, string path) + { + if (!AudioDataStorage.ValidateName(name)) + return false; + + if (AudioDataStorage.AudioStorage.ContainsKey(name)) + { + Log.Warn($"[AudioDataStorage] An entry with the key '{name}' already exists. Skipping add."); + return false; + } + + if (path.StartsWith("http")) + { + Log.Error($"[AudioDataStorage] '{path}' is a URL. Use AudioDataStorage.AddUrl() for web sources."); + return false; + } + + if (!File.Exists(path)) + { + Log.Error($"[AudioDataStorage] Local file not found: '{path}'"); + return false; + } + + try + { + AudioData parsed = WavToPcm(path); + return AudioDataStorage.AudioStorage.TryAdd(name, parsed); + } + catch (Exception ex) + { + Log.Error($"[AudioDataStorage] Failed to load '{path}' into storage:\n{ex}"); + return false; + } + } + + /// + /// Starts an asynchronous download of a .wav file from the specified URL and adds it to the storage. + /// + /// The unique storage key to assign. + /// The HTTP or HTTPS URL pointing to a valid .wav file. + /// A for the running download coroutine. + public static CoroutineHandle CacheWavUrl(string name, string url) => Timing.RunCoroutine(CacheUrlCoroutine(name, url)); + + /// + /// Starts an asynchronous download of a .wav file from the specified URL and adds it to the storage. + /// + /// The unique storage key to assign. + /// The HTTP or HTTPS URL pointing to a valid .wav file. + /// A MEC-compatible of . + public static IEnumerator CacheUrlCoroutine(string name, string url) + { + if (!AudioDataStorage.ValidateName(name)) + yield break; + + if (string.IsNullOrEmpty(url) || !url.StartsWith("http")) + { + Log.Error($"[AudioDataStorage] Invalid URL for key '{name}': '{url}'. Must start with http/https."); + yield break; + } + + if (AudioDataStorage.AudioStorage.ContainsKey(name)) + { + Log.Warn($"[AudioDataStorage] An entry with the key '{name}' already exists. Skipping download."); + yield break; + } + + using UnityWebRequest www = UnityWebRequest.Get(url); + yield return Timing.WaitUntilDone(www.SendWebRequest()); + + if (www.result != UnityWebRequest.Result.Success) + { + Log.Error($"[AudioDataStorage] Download failed for '{url}': {www.error}"); + yield break; + } + + try + { + AudioData parsed = WavToPcm(www.downloadHandler.data); + parsed.TrackInfo.Path = url; + AudioDataStorage.AudioStorage.TryAdd(name, parsed); + } + catch (Exception ex) + { + Log.Error($"[AudioDataStorage] Failed to parse downloaded WAV from '{url}':\n{ex}"); + } + } + + /// + /// Converts a WAV file at the specified path to a PCM float array. + /// + /// The file path of the WAV file to convert. + /// A containing an array of floats representing the PCM data and its TrackData. + public static AudioData WavToPcm(string path) + { + if (!File.Exists(path)) + { + Log.Error($"[WavUtility] The specified local file does not exist, path: `{path}`"); + throw new FileNotFoundException("File does not exist"); + } + + if (!path.EndsWith(".wav", StringComparison.OrdinalIgnoreCase)) + { + Log.Error($"[WavUtility] The file type '{Path.GetExtension(path)}' is not supported for wav utility. Please use .wav file."); + throw new InvalidDataException("Unsupported WAV format."); + } + + using FileStream fs = new(path, FileMode.Open, FileAccess.Read, FileShare.Read); + int length = (int)fs.Length; + + byte[] rentedBuffer = ArrayPool.Shared.Rent(length); + + try + { + int bytesRead = fs.Read(rentedBuffer, 0, length); + using MemoryStream ms = new(rentedBuffer, 0, bytesRead); + + AudioData result = ParseWavSpanToPcm(ms, rentedBuffer.AsSpan(0, bytesRead)); + result.TrackInfo.Path = path; + + return result; + } + finally + { + ArrayPool.Shared.Return(rentedBuffer); + } + } + + /// + /// Converts a WAV byte array to a PCM float array. + /// + /// The raw bytes of the WAV file. + /// A containing an array of floats representing the PCM data and its TrackData. + public static AudioData WavToPcm(byte[] data) + { + using MemoryStream ms = new(data, 0, data.Length); + return ParseWavSpanToPcm(ms, data.AsSpan()); + } + + /// + /// Parses the WAV header from the provided stream and converts the remaining audio data span into a PCM float array. + /// + /// The stream used to read and skip the WAV header. + /// The complete span of WAV audio data including the header. + /// A tuple containing an array of floats representing the PCM data and its TrackData. + public static AudioData ParseWavSpanToPcm(Stream stream, ReadOnlySpan audioData) + { + TrackData metaData = SkipHeader(stream); + + int headerOffset = (int)stream.Position; + int dataLength = audioData.Length - headerOffset; + + ReadOnlySpan samples = MemoryMarshal.Cast(audioData.Slice(headerOffset, dataLength)); + + float[] pcm = new float[samples.Length]; + + for (int i = 0; i < samples.Length; i++) + pcm[i] = samples[i] * Divide; + + return new(pcm, metaData); + } + + /// + /// Skips the WAV file header and validates that the format is PCM16 mono with the specified sample rate. + /// + /// The to read from. + /// A struct containing the parsed file information. + public static TrackData SkipHeader(Stream stream) + { + TrackData trackData = default(TrackData); + + if (stream.Length < 12) + { + Log.Error("[WavUtility] WAV file is too short to contain a valid header."); + throw new InvalidDataException("WAV file is too short to contain a valid header."); + } + + Span headerBuffer = stackalloc byte[12]; + stream.Read(headerBuffer); + + int rate = 0; + int bits = 0; + int channels = 0; + + Span chunkHeader = stackalloc byte[8]; + while (true) + { + if (stream.Position + 8 > stream.Length) + { + Log.Error("[WavUtility] WAV file ended prematurely while parsing chunks."); + throw new InvalidDataException("WAV file ended prematurely while parsing chunks."); + } + + int read = stream.Read(chunkHeader); + if (read < 8) + break; + + uint chunkId = BinaryPrimitives.ReadUInt32LittleEndian(chunkHeader[..4]); + int chunkSize = BinaryPrimitives.ReadInt32LittleEndian(chunkHeader.Slice(4, 4)); + + // 'fmt ' chunk + if (chunkId == 0x20746D66) + { + Span fmtData = stackalloc byte[16]; + stream.Read(fmtData); + + short format = BinaryPrimitives.ReadInt16LittleEndian(fmtData[..2]); + channels = BinaryPrimitives.ReadInt16LittleEndian(fmtData.Slice(2, 2)); + rate = BinaryPrimitives.ReadInt32LittleEndian(fmtData.Slice(4, 4)); + bits = BinaryPrimitives.ReadInt16LittleEndian(fmtData.Slice(14, 2)); + + if (format != 1 || channels != 1 || rate != VoiceChatSettings.SampleRate || bits != 16) + { + Log.Error($"[WavUtility] Invalid WAV format (format={format}, channels={channels}, rate={rate}, bits={bits}). Expected PCM16, mono and {VoiceChatSettings.SampleRate}Hz."); + throw new InvalidDataException("Unsupported WAV format."); + } + + if (chunkSize > 16) + stream.Seek(chunkSize - 16, SeekOrigin.Current); + } + + // 'LIST' chunk + else if (chunkId == 0x5453494C) + { + Span listType = stackalloc byte[4]; + stream.Read(listType); + uint type = BinaryPrimitives.ReadUInt32LittleEndian(listType); + + // 'INFO' chunk + if (type == 0x4F464E49) + { + int bytesToRead = chunkSize - 4; + byte[] infoBytes = ArrayPool.Shared.Rent(bytesToRead); + stream.Read(infoBytes, 0, bytesToRead); + + int offset = 0; + while (offset < bytesToRead - 8) + { + uint infoId = BinaryPrimitives.ReadUInt32LittleEndian(infoBytes.AsSpan(offset, 4)); + int infoSize = BinaryPrimitives.ReadInt32LittleEndian(infoBytes.AsSpan(offset + 4, 4)); + offset += 8; + + if (infoSize > 0 && offset + infoSize <= bytesToRead) + { + string value = System.Text.Encoding.UTF8.GetString(infoBytes, offset, infoSize).TrimEnd('\0'); + + if (infoId == 0x4D414E49) + trackData.Title = value; + else if (infoId == 0x54524149) + trackData.Artist = value; + } + + offset += infoSize; + if (infoSize % 2 != 0) + offset++; + } + + ArrayPool.Shared.Return(infoBytes); + } + else + { + stream.Seek(chunkSize - 4, SeekOrigin.Current); + } + } + + // 'data' chunk + else if (chunkId == 0x61746164) + { + int bytesPerSample = bits / 8; + if (bytesPerSample > 0 && channels > 0 && rate > 0) + trackData.Duration = (double)chunkSize / (rate * channels * bytesPerSample); + + return trackData; + } + else + { + stream.Seek(chunkSize, SeekOrigin.Current); + } + + if (stream.Position >= stream.Length) + { + Log.Error("[WavUtility] WAV file does not contain a 'data' chunk."); + throw new InvalidDataException("Missing 'data' chunk in WAV file."); + } + } + + return trackData; + } + + /// + /// Validates a given local file path or web URL to ensure it is suitable for WAV processing. + /// + /// The local file path or web URL to validate. + /// Outputs a specific error message explaining why the validation failed. Returns if successful. + /// true if the path is valid and safe to process; otherwise, false. + public static bool TryValidatePath(string path, out string errorMessage) + { + errorMessage = string.Empty; + if (string.IsNullOrWhiteSpace(path)) + { + errorMessage = "Provided path or URL cannot be null or empty!"; + return false; + } + + if (path.StartsWith("http")) + return true; + + if (!File.Exists(path)) + { + errorMessage = $"The specified local file does not exist. Path: `{path}`"; + return false; + } + + if (!path.EndsWith(".wav", StringComparison.OrdinalIgnoreCase)) + { + errorMessage = $"Unsupported file format! Only .wav files are allowed. Path: `{path}`"; + return false; + } + + return true; + } + } +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Camera.cs b/EXILED/Exiled.API/Features/Camera.cs index bfa38b5288..93f6de7f96 100644 --- a/EXILED/Exiled.API/Features/Camera.cs +++ b/EXILED/Exiled.API/Features/Camera.cs @@ -12,12 +12,16 @@ namespace Exiled.API.Features using System.Linq; using Enums; + using Exiled.API.Extensions; using Exiled.API.Interfaces; + using MapGeneration; + using PlayerRoles.PlayableScps.Scp079; using PlayerRoles.PlayableScps.Scp079.Cameras; using PlayerRoles.PlayableScps.Scp079.GUI; + using UnityEngine; using CameraType = Enums.CameraType; @@ -159,8 +163,6 @@ public class Camera : IWrapper, IWorldSpace ["SZ CAMERA TOY"] = CameraType.SzCameraToy, }; - private Room room; - /// /// Initializes a new instance of the class. /// @@ -227,7 +229,7 @@ internal Camera(Scp079Camera camera079) /// /// Gets the camera's . /// - public Room Room => room ??= Room.Get(Base.Room); + public Room Room => field ??= Room.Get(Base.Room); /// /// Gets the camera's . diff --git a/EXILED/Exiled.API/Features/Cassie.cs b/EXILED/Exiled.API/Features/Cassie.cs index 4fbfb3647b..e14c4c7288 100644 --- a/EXILED/Exiled.API/Features/Cassie.cs +++ b/EXILED/Exiled.API/Features/Cassie.cs @@ -13,12 +13,16 @@ namespace Exiled.API.Features using System.Text; using Exiled.API.Features.Pools; + using global::Cassie; using global::Cassie.Interpreters; + using MEC; + using PlayerRoles; + using PlayerStatsSystem; - using Respawning; + using Respawning.NamingRules; using CustomHandler = DamageHandlers.CustomDamageHandler; @@ -56,7 +60,9 @@ public static void Message(string message, bool isHeld = false, bool isNoisy = t /// Indicates whether C.A.S.S.I.E has to hold the message. /// Indicates whether C.A.S.S.I.E has to make noises during the message. /// Indicates whether C.A.S.S.I.E has to make subtitles. +#pragma warning disable IDE0060 // TODO: Deleted the unused param public static void MessageTranslated(string message, string translation, bool isHeld = false, bool isNoisy = true, bool isSubtitles = true) +#pragma warning restore IDE0060 { new CassieAnnouncement(new CassieTtsPayload(message, translation, isHeld), 0f, isNoisy ? 1 : 0).AddToQueue(); } @@ -116,7 +122,7 @@ public static float CalculateDuration(string message) float value = 0; string[] lines = message.Split(' ', StringSplitOptions.RemoveEmptyEntries); - CassiePlaybackModifiers modifiers = new(); + CassiePlaybackModifiers modifiers = default(CassiePlaybackModifiers); StringBuilder builder = StringBuilderPool.Pool.Get(); for (int i = 0; i < lines.Length; i++) @@ -166,7 +172,7 @@ public static string ConvertNumber(int num) return string.Empty; } - NumberInterpreter numberInterpreter = (NumberInterpreter)CassieTtsAnnouncer.Interpreters.FirstOrDefault((CassieInterpreter x) => x is NumberInterpreter); + NumberInterpreter numberInterpreter = (NumberInterpreter)CassieTtsAnnouncer.Interpreters.FirstOrDefault(x => x is NumberInterpreter); if (numberInterpreter == null) { return string.Empty; @@ -247,7 +253,7 @@ public static void CustomScpTermination(string scpNumber, CustomHandler info) /// /// The word to check. /// if the word is valid; otherwise, . - public static bool IsValid(string word) => CassieTtsAnnouncer.TryGetDatabase(out CassieLineDatabase cassieLineDatabase) ? cassieLineDatabase.AllLines.Any(line => line.ApiName.ToUpper() == word.ToUpper()) : false; + public static bool IsValid(string word) => CassieTtsAnnouncer.TryGetDatabase(out CassieLineDatabase cassieLineDatabase) && cassieLineDatabase.AllLines.Any(line => line.ApiName.ToUpper() == word.ToUpper()); /// /// Gets a value indicating whether the given sentence is all valid C.A.S.S.I.E word. diff --git a/EXILED/Exiled.API/Features/Coffee.cs b/EXILED/Exiled.API/Features/Coffee.cs index 25e0aca154..1cdc96896e 100644 --- a/EXILED/Exiled.API/Features/Coffee.cs +++ b/EXILED/Exiled.API/Features/Coffee.cs @@ -13,6 +13,7 @@ namespace Exiled.API.Features using Exiled.API.Extensions; using Exiled.API.Interfaces; + using UnityEngine; using BaseCoffee = global::Coffee; @@ -127,4 +128,4 @@ public static Coffee Get(BaseCoffee baseCoffee) /// The player who interacts. If , it will be chosen randomly. public void Interact(Player player = null) => Base.ServerInteract((player ?? Player.Get(x => x.IsHuman).GetRandomValue()).ReferenceHub, byte.MaxValue); } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/ComponentsEqualityComparer.cs b/EXILED/Exiled.API/Features/ComponentsEqualityComparer.cs index a61a7f1602..e2db497289 100644 --- a/EXILED/Exiled.API/Features/ComponentsEqualityComparer.cs +++ b/EXILED/Exiled.API/Features/ComponentsEqualityComparer.cs @@ -22,4 +22,4 @@ internal class ComponentsEqualityComparer : IEqualityComparer /// public int GetHashCode(Component obj) => obj == null ? 0 : obj.GetHashCode(); } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Core/EActor.cs b/EXILED/Exiled.API/Features/Core/EActor.cs index f7f6beca77..31a8911725 100644 --- a/EXILED/Exiled.API/Features/Core/EActor.cs +++ b/EXILED/Exiled.API/Features/Core/EActor.cs @@ -15,6 +15,7 @@ namespace Exiled.API.Features.Core using Exiled.API.Features.DynamicEvents; using Exiled.API.Features.Pools; using Exiled.API.Interfaces; + using MEC; using UnityEngine; @@ -31,8 +32,6 @@ public abstract class EActor : EObject, IEntity, IWorldSpace private readonly HashSet componentsInChildren = HashSetPool.Pool.Get(); private CoroutineHandle serverTick; - private bool canEverTick; - private float fixedTickRate; /// /// Initializes a new instance of the class. @@ -42,10 +41,10 @@ protected EActor() { IsEditable = true; CanEverTick = true; - fixedTickRate = DefaultFixedTickRate; + FixedTickRate = DefaultFixedTickRate; PostInitialize(); - Timing.CallDelayed(fixedTickRate, () => OnBeginPlay()); - Timing.CallDelayed(fixedTickRate * 2, () => serverTick = Timing.RunCoroutine(ServerTick())); + Timing.CallDelayed(FixedTickRate, OnBeginPlay); + Timing.CallDelayed(FixedTickRate * 2, () => serverTick = Timing.RunCoroutine(ServerTick())); } /// @@ -99,15 +98,15 @@ public virtual Vector3 Scale /// public virtual bool CanEverTick { - get => canEverTick; + get; set { if (!IsEditable) return; - canEverTick = value; + field = value; - if (canEverTick) + if (field) { Timing.ResumeCoroutines(serverTick); return; @@ -122,13 +121,13 @@ public virtual bool CanEverTick /// public virtual float FixedTickRate { - get => fixedTickRate; + get; set { if (!IsEditable) return; - fixedTickRate = value; + field = value; } } diff --git a/EXILED/Exiled.API/Features/Core/Generic/EBehaviour.cs b/EXILED/Exiled.API/Features/Core/Generic/EBehaviour.cs index 7bd14fb6e2..0ac6098b9b 100644 --- a/EXILED/Exiled.API/Features/Core/Generic/EBehaviour.cs +++ b/EXILED/Exiled.API/Features/Core/Generic/EBehaviour.cs @@ -7,8 +7,6 @@ namespace Exiled.API.Features.Core.Generic { - using System; - using Exiled.API.Features; /// diff --git a/EXILED/Exiled.API/Features/Core/Generic/EnumClass.cs b/EXILED/Exiled.API/Features/Core/Generic/EnumClass.cs index 5f883d0bcf..0f3077d874 100644 --- a/EXILED/Exiled.API/Features/Core/Generic/EnumClass.cs +++ b/EXILED/Exiled.API/Features/Core/Generic/EnumClass.cs @@ -67,10 +67,10 @@ public string Name .GetFields(BindingFlags.Static | BindingFlags.GetField | BindingFlags.Public) .Where(t => t.FieldType == typeof(TObject)); - foreach (FieldInfo field in fields) + foreach (FieldInfo @field in fields) { - TObject instance = (TObject)field.GetValue(null); - instance.name = field.Name; + TObject instance = (TObject)@field.GetValue(null); + instance.name = @field.Name; } isDefined = true; diff --git a/EXILED/Exiled.API/Features/Core/Generic/UnmanagedEnumClass.cs b/EXILED/Exiled.API/Features/Core/Generic/UnmanagedEnumClass.cs index 7928f38783..ce82315efa 100644 --- a/EXILED/Exiled.API/Features/Core/Generic/UnmanagedEnumClass.cs +++ b/EXILED/Exiled.API/Features/Core/Generic/UnmanagedEnumClass.cs @@ -67,10 +67,10 @@ public string Name .GetFields(BindingFlags.Static | BindingFlags.GetField | BindingFlags.Public) .Where(t => t.FieldType == typeof(TObject)); - foreach (FieldInfo field in fields) + foreach (FieldInfo @field in fields) { - TObject instance = (TObject)field.GetValue(null); - instance.name = field.Name; + TObject instance = (TObject)@field.GetValue(null); + instance.name = @field.Name; } isDefined = true; diff --git a/EXILED/Exiled.API/Features/Core/StateMachine/State.cs b/EXILED/Exiled.API/Features/Core/StateMachine/State.cs index e790e61a8d..dee7f4cd49 100644 --- a/EXILED/Exiled.API/Features/Core/StateMachine/State.cs +++ b/EXILED/Exiled.API/Features/Core/StateMachine/State.cs @@ -14,7 +14,6 @@ namespace Exiled.API.Features.Core.StateMachine using Exiled.API.Features; using Exiled.API.Features.Core.Attributes; - using UnityEngine; /// /// The base class which handles in-context states. diff --git a/EXILED/Exiled.API/Features/Core/StateMachine/StateController.cs b/EXILED/Exiled.API/Features/Core/StateMachine/StateController.cs index bce10ed688..ce193ec7a5 100644 --- a/EXILED/Exiled.API/Features/Core/StateMachine/StateController.cs +++ b/EXILED/Exiled.API/Features/Core/StateMachine/StateController.cs @@ -19,7 +19,6 @@ namespace Exiled.API.Features.Core.StateMachine public abstract class StateController : EActor { private readonly List states = new(); - private State currentState; /// /// Gets all handled states. @@ -31,14 +30,14 @@ public abstract class StateController : EActor /// public State CurrentState { - get => currentState; + get; set { - if (currentState.Id == value.Id) + if (field.Id == value.Id) return; - (PreviousState = currentState).OnExit(this); - (currentState = value).OnEnter(this); + (PreviousState = field).OnExit(this); + (field = value).OnEnter(this); OnStateChanged(); } @@ -75,7 +74,7 @@ public virtual void StateUpdate(State state) protected virtual void OnStateChanged() { EndStateMulticastDispatcher.InvokeAll(PreviousState); - BeginStateMulticastDispatcher.InvokeAll(currentState); + BeginStateMulticastDispatcher.InvokeAll(CurrentState); } } } \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Core/UserSettings/ButtonSetting.cs b/EXILED/Exiled.API/Features/Core/UserSettings/ButtonSetting.cs index 46938d13b4..dfccf71d77 100644 --- a/EXILED/Exiled.API/Features/Core/UserSettings/ButtonSetting.cs +++ b/EXILED/Exiled.API/Features/Core/UserSettings/ButtonSetting.cs @@ -11,6 +11,7 @@ namespace Exiled.API.Features.Core.UserSettings using System.Diagnostics; using Exiled.API.Interfaces; + using global::UserSettings.ServerSpecific; /// diff --git a/EXILED/Exiled.API/Features/Core/UserSettings/DropdownSetting.cs b/EXILED/Exiled.API/Features/Core/UserSettings/DropdownSetting.cs index ada19ec63a..8876f74b96 100644 --- a/EXILED/Exiled.API/Features/Core/UserSettings/DropdownSetting.cs +++ b/EXILED/Exiled.API/Features/Core/UserSettings/DropdownSetting.cs @@ -12,6 +12,7 @@ namespace Exiled.API.Features.Core.UserSettings using System.Linq; using Exiled.API.Interfaces; + using global::UserSettings.ServerSpecific; /// diff --git a/EXILED/Exiled.API/Features/Core/UserSettings/HeaderSetting.cs b/EXILED/Exiled.API/Features/Core/UserSettings/HeaderSetting.cs index 4b13238b65..5944a682fd 100644 --- a/EXILED/Exiled.API/Features/Core/UserSettings/HeaderSetting.cs +++ b/EXILED/Exiled.API/Features/Core/UserSettings/HeaderSetting.cs @@ -10,6 +10,7 @@ namespace Exiled.API.Features.Core.UserSettings using System; using Exiled.API.Interfaces; + using global::UserSettings.ServerSpecific; /// diff --git a/EXILED/Exiled.API/Features/Core/UserSettings/KeybindSetting.cs b/EXILED/Exiled.API/Features/Core/UserSettings/KeybindSetting.cs index e3b40e8f0c..98c168adaa 100644 --- a/EXILED/Exiled.API/Features/Core/UserSettings/KeybindSetting.cs +++ b/EXILED/Exiled.API/Features/Core/UserSettings/KeybindSetting.cs @@ -10,7 +10,9 @@ namespace Exiled.API.Features.Core.UserSettings using System; using Exiled.API.Interfaces; + using global::UserSettings.ServerSpecific; + using UnityEngine; /// diff --git a/EXILED/Exiled.API/Features/Core/UserSettings/SettingBase.cs b/EXILED/Exiled.API/Features/Core/UserSettings/SettingBase.cs index 38b5132ec7..9286c5b409 100644 --- a/EXILED/Exiled.API/Features/Core/UserSettings/SettingBase.cs +++ b/EXILED/Exiled.API/Features/Core/UserSettings/SettingBase.cs @@ -14,6 +14,7 @@ namespace Exiled.API.Features.Core.UserSettings using Exiled.API.Features.Pools; using Exiled.API.Interfaces; + using global::UserSettings.ServerSpecific; /// @@ -205,7 +206,7 @@ public static bool TryGetSetting(Player player, int id, out T setting) SSTwoButtonsSetting twoButtonsSetting => new TwoButtonsSetting(twoButtonsSetting), SSPlaintextSetting plainTextSetting => new UserTextInputSetting(plainTextSetting), SSSliderSetting sliderSetting => new SliderSetting(sliderSetting), - _ => new SettingBase(settingBase) + _ => new SettingBase(settingBase), }; /// @@ -419,7 +420,7 @@ internal static void OnSettingUpdated(ReferenceHub hub, ServerSpecificSettingBas setting = list.Find(x => x.Id == settingBase.SettingId); - invoke: + invoke: if (setting.OriginalDefinition == null) { @@ -429,4 +430,4 @@ internal static void OnSettingUpdated(ReferenceHub hub, ServerSpecificSettingBas setting.OriginalDefinition?.OnChanged?.Invoke(player, setting); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Core/UserSettings/SliderSetting.cs b/EXILED/Exiled.API/Features/Core/UserSettings/SliderSetting.cs index abb522fd76..3a88ab477c 100644 --- a/EXILED/Exiled.API/Features/Core/UserSettings/SliderSetting.cs +++ b/EXILED/Exiled.API/Features/Core/UserSettings/SliderSetting.cs @@ -10,6 +10,7 @@ namespace Exiled.API.Features.Core.UserSettings using System; using Exiled.API.Interfaces; + using global::UserSettings.ServerSpecific; /// diff --git a/EXILED/Exiled.API/Features/Core/UserSettings/TextInputSetting.cs b/EXILED/Exiled.API/Features/Core/UserSettings/TextInputSetting.cs index 69c7875ad1..d1c9aa7eb5 100644 --- a/EXILED/Exiled.API/Features/Core/UserSettings/TextInputSetting.cs +++ b/EXILED/Exiled.API/Features/Core/UserSettings/TextInputSetting.cs @@ -10,7 +10,9 @@ namespace Exiled.API.Features.Core.UserSettings using System; using Exiled.API.Interfaces; + using global::UserSettings.ServerSpecific; + using TMPro; /// diff --git a/EXILED/Exiled.API/Features/Core/UserSettings/TwoButtonsSetting.cs b/EXILED/Exiled.API/Features/Core/UserSettings/TwoButtonsSetting.cs index 18233e6ffc..d921ede5a4 100644 --- a/EXILED/Exiled.API/Features/Core/UserSettings/TwoButtonsSetting.cs +++ b/EXILED/Exiled.API/Features/Core/UserSettings/TwoButtonsSetting.cs @@ -10,6 +10,7 @@ namespace Exiled.API.Features.Core.UserSettings using System; using Exiled.API.Interfaces; + using global::UserSettings.ServerSpecific; /// diff --git a/EXILED/Exiled.API/Features/Core/UserSettings/UserTextInputSetting.cs b/EXILED/Exiled.API/Features/Core/UserSettings/UserTextInputSetting.cs index 99c163581e..fe773e8021 100644 --- a/EXILED/Exiled.API/Features/Core/UserSettings/UserTextInputSetting.cs +++ b/EXILED/Exiled.API/Features/Core/UserSettings/UserTextInputSetting.cs @@ -10,7 +10,9 @@ namespace Exiled.API.Features.Core.UserSettings using System; using Exiled.API.Interfaces; + using global::UserSettings.ServerSpecific; + using TMPro; /// diff --git a/EXILED/Exiled.API/Features/CustomStats/CustomHumeShieldStat.cs b/EXILED/Exiled.API/Features/CustomStats/CustomHumeShieldStat.cs index e19ce970f5..f366ba01bf 100644 --- a/EXILED/Exiled.API/Features/CustomStats/CustomHumeShieldStat.cs +++ b/EXILED/Exiled.API/Features/CustomStats/CustomHumeShieldStat.cs @@ -8,9 +8,13 @@ namespace Exiled.API.Features.CustomStats { using Mirror; + using PlayerRoles.PlayableScps.HumeShield; + using PlayerStatsSystem; + using UnityEngine; + using Utils.Networking; /// diff --git a/EXILED/Exiled.API/Features/DamageHandlers/DamageHandler.cs b/EXILED/Exiled.API/Features/DamageHandlers/DamageHandler.cs index 1103ed138e..7b4720f6d3 100644 --- a/EXILED/Exiled.API/Features/DamageHandlers/DamageHandler.cs +++ b/EXILED/Exiled.API/Features/DamageHandlers/DamageHandler.cs @@ -12,6 +12,7 @@ namespace Exiled.API.Features.DamageHandlers using Footprinting; using PlayerStatsSystem; + using UnityEngine; using BaseHandler = PlayerStatsSystem.DamageHandlerBase; diff --git a/EXILED/Exiled.API/Features/DamageHandlers/DamageHandlerBase.cs b/EXILED/Exiled.API/Features/DamageHandlers/DamageHandlerBase.cs index 248e89452b..4f24643880 100644 --- a/EXILED/Exiled.API/Features/DamageHandlers/DamageHandlerBase.cs +++ b/EXILED/Exiled.API/Features/DamageHandlers/DamageHandlerBase.cs @@ -13,12 +13,9 @@ namespace Exiled.API.Features.DamageHandlers using System.Linq; using Enums; - using Exiled.API.Features.Items; + using Extensions; - using InventorySystem.Items.Scp1509; - using PlayerRoles.PlayableScps.Scp1507; - using PlayerRoles.PlayableScps.Scp3114; - using PlayerRoles.PlayableScps.Scp939; + using PlayerStatsSystem; using BaseHandler = PlayerStatsSystem.DamageHandlerBase; @@ -28,9 +25,6 @@ namespace Exiled.API.Features.DamageHandlers /// public abstract class DamageHandlerBase { - private DamageType damageType; - private CassieAnnouncement cassieAnnouncement; - /// /// Initializes a new instance of the class. /// @@ -78,8 +72,8 @@ public enum Action : byte /// public virtual CassieAnnouncement CassieDeathAnnouncement { - get => cassieAnnouncement ?? Base.CassieDeathAnnouncement; - protected set => cassieAnnouncement = value; + get => field ?? Base.CassieDeathAnnouncement; + protected set; } /// @@ -94,11 +88,11 @@ public virtual DamageType Type { get { - if (damageType != DamageType.Unknown) - return damageType; + if (field != DamageType.Unknown) + return field; - damageType = GetDamageType(); - return damageType; + field = DamageTypeExtensions.GetDamageType(Base); + return field; } protected set @@ -106,7 +100,7 @@ protected set if (!Enum.IsDefined(typeof(DamageType), value)) throw new InvalidEnumArgumentException(nameof(value), (int)value, typeof(DamageType)); - damageType = value; + field = value; } } @@ -188,101 +182,6 @@ public bool BaseIs(out T param) return true; } - /// - /// Gets the assosiated with . - /// - /// from which should be get. If null, will be used. - /// Assosiated . - protected DamageType GetDamageType(BaseHandler damageHandler = null) - { - damageHandler ??= Base; - - switch (damageHandler) - { - case GenericDamageHandler genericDamageHandler: - return GetDamageType(genericDamageHandler.Base); - case CustomReasonDamageHandler: - return DamageType.Custom; - case WarheadDamageHandler: - return DamageType.Warhead; - case ExplosionDamageHandler: - return DamageType.Explosion; - case Scp018DamageHandler: - return DamageType.Scp018; - case RecontainmentDamageHandler: - return DamageType.Recontainment; - case MicroHidDamageHandler: - return DamageType.MicroHid; - case DisruptorDamageHandler: - return DamageType.ParticleDisruptor; - case Scp939DamageHandler: - return DamageType.Scp939; - case JailbirdDamageHandler: - return DamageType.Jailbird; - case Scp1507DamageHandler: - return DamageType.Scp1507; - case Scp956DamageHandler: - return DamageType.Scp956; - case SnowballDamageHandler: - return DamageType.SnowBall; - case GrayCandyDamageHandler: - return DamageType.GrayCandy; - case Scp1509DamageHandler: - return DamageType.Scp1509; - case Scp3114DamageHandler scp3114DamageHandler: - return scp3114DamageHandler.Subtype switch - { - Scp3114DamageHandler.HandlerType.Strangulation => DamageType.Strangled, - Scp3114DamageHandler.HandlerType.SkinSteal => DamageType.Scp3114, - Scp3114DamageHandler.HandlerType.Slap => DamageType.Scp3114, - _ => DamageType.Unknown, - }; - case Scp049DamageHandler scp049DamageHandler: - return scp049DamageHandler.DamageSubType switch - { - Scp049DamageHandler.AttackType.CardiacArrest => DamageType.CardiacArrest, - Scp049DamageHandler.AttackType.Instakill => DamageType.Scp049, - Scp049DamageHandler.AttackType.Scp0492 => DamageType.Scp0492, - _ => DamageType.Unknown, - }; - case UniversalDamageHandler universal: - DeathTranslation translation = DeathTranslations.TranslationsById[universal.TranslationId]; - - if (DamageTypeExtensions.TranslationIdConversion.ContainsKey(translation.Id)) - return DamageTypeExtensions.TranslationIdConversion[translation.Id]; - - Log.Warn($"{nameof(DamageHandler)}.{nameof(Type)}: No matching {nameof(DamageType)} for {nameof(UniversalDamageHandler)} with ID {translation.Id}, type will be reported as {DamageType.Unknown}. Report this to EXILED Devs."); - break; - case PlayerStatsSystem.FirearmDamageHandler firearmDamageHandler: - return Item.Get(firearmDamageHandler.Firearm).FirearmType switch - { - FirearmType.A7 => DamageType.A7, - FirearmType.Com15 => DamageType.Com15, - FirearmType.Com18 => DamageType.Com18, - FirearmType.Crossvec => DamageType.Crossvec, - FirearmType.Logicer => DamageType.Logicer, - FirearmType.Revolver => DamageType.Revolver, - FirearmType.Scp127 => DamageType.Scp127, - FirearmType.Shotgun => DamageType.Shotgun, - FirearmType.AK => DamageType.AK, - FirearmType.ParticleDisruptor => DamageType.ParticleDisruptor, - FirearmType.E11SR => DamageType.E11Sr, - FirearmType.FSP9 => DamageType.Fsp9, - FirearmType.FRMG0 => DamageType.Frmg0, - _ => DamageType.Firearm - }; - - case PlayerStatsSystem.AttackerDamageHandler attackerDamageHandler: - { - if (Player.TryGet(attackerDamageHandler.Attacker, out Player attacker) && attacker.CurrentItem?.Type == ItemType.MarshmallowItem) - return DamageType.Marshmallow; - return DamageType.Unknown; - } - } - - return DamageType.Unknown; - } - /// /// A wrapper to easily manipulate the behavior of . /// diff --git a/EXILED/Exiled.API/Features/DamageHandlers/FirearmDamageHandler.cs b/EXILED/Exiled.API/Features/DamageHandlers/FirearmDamageHandler.cs index adcd074a31..4518b21227 100644 --- a/EXILED/Exiled.API/Features/DamageHandlers/FirearmDamageHandler.cs +++ b/EXILED/Exiled.API/Features/DamageHandlers/FirearmDamageHandler.cs @@ -7,10 +7,6 @@ namespace Exiled.API.Features.DamageHandlers { - using Enums; - - using Extensions; - using Items; using PlayerStatsSystem; @@ -35,14 +31,6 @@ public FirearmDamageHandler(Item item, Player target, BaseHandler baseHandler) Item = item; } - /// - public override DamageType Type => Item switch - { - Firearm _ when DamageTypeExtensions.ItemConversion.ContainsKey(Item.Type) => DamageTypeExtensions.ItemConversion[Item.Type], - MicroHid _ => DamageType.MicroHid, - _ => DamageType.Firearm, - }; - /// /// Gets or sets the used by the damage handler. /// diff --git a/EXILED/Exiled.API/Features/DamageHandlers/GenericDamageHandler.cs b/EXILED/Exiled.API/Features/DamageHandlers/GenericDamageHandler.cs index d55324798e..1ee51df09d 100644 --- a/EXILED/Exiled.API/Features/DamageHandlers/GenericDamageHandler.cs +++ b/EXILED/Exiled.API/Features/DamageHandlers/GenericDamageHandler.cs @@ -10,17 +10,23 @@ namespace Exiled.API.Features.DamageHandlers using System; using Enums; - using Exiled.API.Features.Pickups.Projectiles; + + using Exiled.API.Extensions; using Footprinting; + + using InventorySystem; + using InventorySystem.Items.Firearms.ShotEvents; using InventorySystem.Items.Scp1509; - using Items; + using PlayerRoles; using PlayerRoles.PlayableScps.Scp096; using PlayerRoles.PlayableScps.Scp1507; using PlayerRoles.PlayableScps.Scp3114; using PlayerRoles.PlayableScps.Scp939; + using PlayerStatsSystem; + using UnityEngine; /// @@ -56,10 +62,9 @@ public GenericDamageHandler(Player player, Player attacker, float damage, Damage cassieAnnouncement ??= DamageHandlerBase.CassieAnnouncement.Default; customCassieAnnouncement = cassieAnnouncement; - if (customCassieAnnouncement is not null) - customCassieAnnouncement.Announcement ??= $"{player.Nickname} killed by {attacker.Nickname} utilizing {damageType}"; + customCassieAnnouncement?.Announcement ??= $"{player.Nickname} killed by {attacker.Nickname} utilizing {damageType}"; - Attacker = attacker.Footprint; + Attacker = attacker != null ? attacker.Footprint : Server.Host.Footprint; AllowSelfDamage = true; Damage = damage; ServerLogsText = $"GenericDamageHandler damage processing"; @@ -122,70 +127,72 @@ public GenericDamageHandler(Player player, Player attacker, float damage, Damage case DamageType.GrayCandy: Base = new GrayCandyDamageHandler(Attacker.Hub, damage); break; - case DamageType.MicroHid: - InventorySystem.Items.MicroHID.MicroHIDItem microHidOwner = new(); - microHidOwner.Owner = attacker.ReferenceHub; + case DamageType.MicroHidPrimaryFire: + case DamageType.MicroHidChargeFire: + case DamageType.MicroHidBrokenFire: + InventorySystem.Items.MicroHID.MicroHIDItem microHidOwner = new() + { + Owner = attacker.ReferenceHub, + }; Base = new MicroHidDamageHandler(damage, microHidOwner); break; - case DamageType.Explosion: + case DamageType.ExplosionGrenade: Base = new ExplosionDamageHandler(attacker.Footprint, UnityEngine.Vector3.zero, damage, 0, ExplosionType.Grenade); break; case DamageType.Firearm: case DamageType.AK: - GenericFirearm(player, attacker, damage, damageType, ItemType.GunAK); + GenericFirearm(damage, ItemType.GunAK); break; case DamageType.Crossvec: - GenericFirearm(player, attacker, damage, damageType, ItemType.GunCrossvec); + GenericFirearm(damage, ItemType.GunCrossvec); break; case DamageType.Logicer: - GenericFirearm(player, attacker, damage, damageType, ItemType.GunLogicer); + GenericFirearm(damage, ItemType.GunLogicer); break; case DamageType.Revolver: - GenericFirearm(player, attacker, damage, damageType, ItemType.GunRevolver); + GenericFirearm(damage, ItemType.GunRevolver); break; case DamageType.Shotgun: - GenericFirearm(player, attacker, damage, damageType, ItemType.GunShotgun); + GenericFirearm(damage, ItemType.GunShotgun); break; case DamageType.Com15: - GenericFirearm(player, attacker, damage, damageType, ItemType.GunCOM15); + GenericFirearm(damage, ItemType.GunCOM15); break; case DamageType.Com18: - GenericFirearm(player, attacker, damage, damageType, ItemType.GunCOM18); + GenericFirearm(damage, ItemType.GunCOM18); break; case DamageType.Fsp9: - GenericFirearm(player, attacker, damage, damageType, ItemType.GunFSP9); + GenericFirearm(damage, ItemType.GunFSP9); break; case DamageType.E11Sr: - GenericFirearm(player, attacker, damage, damageType, ItemType.GunE11SR); + GenericFirearm(damage, ItemType.GunE11SR); break; case DamageType.Com45: - GenericFirearm(player, attacker, damage, damageType, ItemType.GunCom45); + GenericFirearm(damage, ItemType.GunCom45); break; case DamageType.Frmg0: - GenericFirearm(player, attacker, damage, damageType, ItemType.GunFRMG0); + GenericFirearm(damage, ItemType.GunFRMG0); break; case DamageType.A7: - GenericFirearm(player, attacker, damage, damageType, ItemType.GunA7); + GenericFirearm(damage, ItemType.GunA7); break; case DamageType.Scp127: - GenericFirearm(player, attacker, damage, damageType, ItemType.GunSCP127); + GenericFirearm(damage, ItemType.GunSCP127); break; case DamageType.ParticleDisruptor: - Base = new DisruptorDamageHandler(new (Item.Create(ItemType.ParticleDisruptor, attacker).Base as InventorySystem.Items.Firearms.Firearm, InventorySystem.Items.Firearms.Modules.DisruptorActionModule.FiringState.FiringSingle), Vector3.up, damage); + Base = new DisruptorDamageHandler(new DisruptorShotEvent(default, Attacker, InventorySystem.Items.Firearms.Modules.DisruptorActionModule.FiringState.FiringSingle), Vector3.up, damage); break; - case DamageType.Scp096: + case DamageType.Scp096Other: Scp096Role curr096 = attacker.ReferenceHub.roleManager.CurrentRole as Scp096Role ?? new Scp096Role(); - if (curr096 != null) - curr096._lastOwner = attacker.ReferenceHub; + curr096?._lastOwner = attacker.ReferenceHub; Base = new Scp096DamageHandler(curr096, damage, Scp096DamageHandler.AttackType.SlapRight); break; - case DamageType.Scp939: + case DamageType.Scp939None: Scp939Role curr939 = attacker.ReferenceHub.roleManager.CurrentRole as Scp939Role ?? new Scp939Role(); - if (curr939 != null) - curr939._lastOwner = attacker.ReferenceHub; + curr939?._lastOwner = attacker.ReferenceHub; Base = new Scp939DamageHandler(curr939, damage, Scp939DamageType.LungeTarget); break; @@ -193,9 +200,12 @@ public GenericDamageHandler(Player player, Player attacker, float damage, Damage Base = new PlayerStatsSystem.ScpDamageHandler(attacker.ReferenceHub, damage, DeathTranslations.Unknown); break; case DamageType.Scp018: - Scp018Projectile scp018Projectile = Projectile.Create(ProjectileType.Scp018); - scp018Projectile.PreviousOwner = attacker; - Base = new Scp018DamageHandler(scp018Projectile.Base, damage, true); + InventorySystem.Items.ThrowableProjectiles.Scp018Projectile dummy018 = new() + { + PreviousOwner = Attacker, + }; + + Base = new Scp018DamageHandler(dummy018, damage, true); break; case DamageType.Scp207: Base = new PlayerStatsSystem.ScpDamageHandler(attacker.ReferenceHub, damage, DeathTranslations.Scp207); @@ -303,21 +313,26 @@ public override HandlerOutput ApplyDamage(ReferenceHub ply) /// /// Generic firearm path for handle type. /// - /// Current player. - /// Current attacker. /// Damage amount. - /// Damage type. /// ItemType. - private void GenericFirearm(Player player, Player attacker, float amount, DamageType damageType, ItemType itemType) + private void GenericFirearm(float amount, ItemType itemType) { - Firearm firearm = new(itemType) + ItemType ammoType = ItemType.None; + + if (InventoryItemLoader.TryGetItem(itemType, out InventorySystem.Items.Firearms.Firearm firearmTemplate)) { - Base = - { - Owner = attacker.ReferenceHub, - }, + Items.Firearm firearm = new(firearmTemplate); + ammoType = firearm.AmmoType.GetItemType(); + } + + Base = new PlayerStatsSystem.FirearmDamageHandler + { + Damage = amount, + Attacker = Attacker, + AmmoType = ammoType, + WeaponType = itemType, + Firearm = firearmTemplate, }; - Base = new PlayerStatsSystem.FirearmDamageHandler() { Firearm = firearm.Base, Damage = amount }; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/DamageHandlers/ScpDamageHandler.cs b/EXILED/Exiled.API/Features/DamageHandlers/ScpDamageHandler.cs index 6d44b06d08..7f89262a00 100644 --- a/EXILED/Exiled.API/Features/DamageHandlers/ScpDamageHandler.cs +++ b/EXILED/Exiled.API/Features/DamageHandlers/ScpDamageHandler.cs @@ -7,14 +7,7 @@ namespace Exiled.API.Features.DamageHandlers { - using Enums; - - using Extensions; - - using PlayerStatsSystem; - using BaseHandler = PlayerStatsSystem.DamageHandlerBase; - using BaseScpHandler = PlayerStatsSystem.ScpDamageHandler; /// /// A wrapper to easily manipulate the behavior of . @@ -30,34 +23,5 @@ public ScpDamageHandler(Player target, BaseHandler baseHandler) : base(target, baseHandler) { } - - /// - public override DamageType Type - { - get - { - switch (Base) - { - case Scp096DamageHandler: - return DamageType.Scp096; - case Scp049DamageHandler scp049DamageHandler: - return scp049DamageHandler.DamageSubType switch - { - Scp049DamageHandler.AttackType.Scp0492 => DamageType.Scp0492, - _ => DamageType.Scp049, - }; - case BaseScpHandler scp: - { - DeathTranslation translation = DeathTranslations.TranslationsById[scp._translationId]; - if (translation.Id == DeathTranslations.PocketDecay.Id) - return DamageType.Scp106; - return DamageTypeExtensions.TranslationIdConversion.ContainsKey(translation.Id) ? DamageTypeExtensions.TranslationIdConversion[translation.Id] : DamageType.Scp; - } - - default: - return base.Type; - } - } - } } } \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Doors/BasicDoor.cs b/EXILED/Exiled.API/Features/Doors/BasicDoor.cs index 5a53caa738..a0c184b22a 100644 --- a/EXILED/Exiled.API/Features/Doors/BasicDoor.cs +++ b/EXILED/Exiled.API/Features/Doors/BasicDoor.cs @@ -10,7 +10,9 @@ namespace Exiled.API.Features.Doors using System.Collections.Generic; using Exiled.API.Enums; + using PlayerRoles; + using UnityEngine; using Basegame = Interactables.Interobjects.BasicDoor; diff --git a/EXILED/Exiled.API/Features/Doors/Door.cs b/EXILED/Exiled.API/Features/Doors/Door.cs index a60da6e36c..8518be4a9c 100644 --- a/EXILED/Exiled.API/Features/Doors/Door.cs +++ b/EXILED/Exiled.API/Features/Doors/Door.cs @@ -15,11 +15,15 @@ namespace Exiled.API.Features.Doors using Exiled.API.Extensions; using Exiled.API.Features.Core; using Exiled.API.Interfaces; + using Interactables.Interobjects; using Interactables.Interobjects.DoorButtons; using Interactables.Interobjects.DoorUtils; + using MEC; + using Mirror; + using UnityEngine; using BaseBreakableDoor = Interactables.Interobjects.BreakableDoor; @@ -203,11 +207,7 @@ public Vector3 Position public bool AllowsScp106 { get => Base is not IScp106PassableDoor door || door.IsScp106Passable; - set - { - if (Base is IScp106PassableDoor door) - door.IsScp106Passable = value; - } + set => (Base as IScp106PassableDoor)?.IsScp106Passable = value; } /// @@ -425,7 +425,7 @@ public static void LockAll(float duration, ZoneType zoneType = ZoneType.Unspecif { door.IsOpen = false; door.ChangeLock(lockType); - Timing.CallDelayed(duration, () => door.Unlock()); + Timing.CallDelayed(duration, door.Unlock); } } @@ -452,7 +452,7 @@ public static void LockAll(float duration, DoorLockType lockType = DoorLockType. { door.IsOpen = false; door.ChangeLock(lockType); - Timing.CallDelayed(duration, () => door.Unlock()); + Timing.CallDelayed(duration, door.Unlock); } } @@ -597,7 +597,7 @@ internal static Door Create(DoorVariant doorVariant, List rooms) PryableDoor prbl => new Gate(prbl, rooms), Interactables.Interobjects.BasicNonInteractableDoor nonInteractableDoor => new BasicNonInteractableDoor(nonInteractableDoor, rooms), Interactables.Interobjects.BasicDoor basicDoor => new BasicDoor(basicDoor, rooms), - _ => new Door(doorVariant, rooms) + _ => new Door(doorVariant, rooms), }; } @@ -642,7 +642,7 @@ private DoorType GetDoorType() }, "Cargo Elevator Door" => DoorType.ElevatorServerRoom, "Nuke Elevator Door" => DoorType.ElevatorNuke, - "Elevator Door" or "Elevator Door 02" or "Elevator Door 01" => (Base as Interactables.Interobjects.ElevatorDoor)?.Group switch + not null when Base is Interactables.Interobjects.ElevatorDoor elevatorGroup => elevatorGroup?.Group switch { ElevatorGroup.Scp049 => DoorType.ElevatorScp049, ElevatorGroup.GateB => DoorType.ElevatorGateB, @@ -713,4 +713,4 @@ private DoorType GetDoorType() }; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Doors/ElevatorDoor.cs b/EXILED/Exiled.API/Features/Doors/ElevatorDoor.cs index 8d455e6653..9f5643cb04 100644 --- a/EXILED/Exiled.API/Features/Doors/ElevatorDoor.cs +++ b/EXILED/Exiled.API/Features/Doors/ElevatorDoor.cs @@ -11,7 +11,9 @@ namespace Exiled.API.Features.Doors using System.Linq; using Exiled.API.Enums; + using Interactables.Interobjects; + using UnityEngine; /// diff --git a/EXILED/Exiled.API/Features/Doors/EmergencyReleaseButton.cs b/EXILED/Exiled.API/Features/Doors/EmergencyReleaseButton.cs index 4fb094f639..e115b4416a 100644 --- a/EXILED/Exiled.API/Features/Doors/EmergencyReleaseButton.cs +++ b/EXILED/Exiled.API/Features/Doors/EmergencyReleaseButton.cs @@ -12,6 +12,7 @@ namespace Exiled.API.Features.Doors using System.Linq; using Exiled.API.Interfaces; + using Interactables.Interobjects; /// diff --git a/EXILED/Exiled.API/Features/Doors/Gate.cs b/EXILED/Exiled.API/Features/Doors/Gate.cs index 89cbc3ced0..050c635ef6 100644 --- a/EXILED/Exiled.API/Features/Doors/Gate.cs +++ b/EXILED/Exiled.API/Features/Doors/Gate.cs @@ -10,8 +10,10 @@ namespace Exiled.API.Features.Doors using System.Collections.Generic; using Exiled.API.Enums; + using Interactables.Interobjects; using Interactables.Interobjects.DoorUtils; + using UnityEngine; /// diff --git a/EXILED/Exiled.API/Features/Draw.cs b/EXILED/Exiled.API/Features/Draw.cs index 19a9db0e10..f552bad439 100644 --- a/EXILED/Exiled.API/Features/Draw.cs +++ b/EXILED/Exiled.API/Features/Draw.cs @@ -8,7 +8,6 @@ namespace Exiled.API.Features { using System; - using System.Buffers; using System.Collections.Generic; using DrawableLine; diff --git a/EXILED/Exiled.API/Features/Generator.cs b/EXILED/Exiled.API/Features/Generator.cs index 4f846273e0..538fcc80c0 100644 --- a/EXILED/Exiled.API/Features/Generator.cs +++ b/EXILED/Exiled.API/Features/Generator.cs @@ -12,8 +12,11 @@ namespace Exiled.API.Features using System.Linq; using Enums; + using Exiled.API.Interfaces; + using Interactables.Interobjects.DoorUtils; + using MapGeneration.Distributors; using UnityEngine; @@ -27,7 +30,6 @@ public class Generator : IWrapper, IWorldSpace, IStructureSync /// A of on the map. /// internal static readonly Dictionary Scp079GeneratorToGenerator = new(new ComponentsEqualityComparer()); - private Room room; /// /// Initializes a new instance of the class. @@ -63,7 +65,7 @@ internal Generator(Scp079Generator scp079Generator) /// /// Gets the generator's . /// - public Room Room => room ??= Room.FindParentRoom(GameObject); + public Room Room => field ??= Room.FindParentRoom(GameObject); /// /// Gets or sets the generator' state. diff --git a/EXILED/Exiled.API/Features/GlobalPatchProcessor.cs b/EXILED/Exiled.API/Features/GlobalPatchProcessor.cs index 22d34ffa8e..f7844678c4 100644 --- a/EXILED/Exiled.API/Features/GlobalPatchProcessor.cs +++ b/EXILED/Exiled.API/Features/GlobalPatchProcessor.cs @@ -152,39 +152,35 @@ public static void UnpatchAll(string id = "", string groupId = null) if (string.IsNullOrEmpty(groupId) || patchGroup.GroupId != groupId) continue; - Unpatch: + Unpatch: bool hasMethodBody = methodBase.HasMethodBody(); if (hasMethodBody) { - patchInfo.Postfixes.Do( - delegate(Patch patchInfo) - { - harmony.Unpatch(methodBase, patchInfo.PatchMethod); - }); - patchInfo.Prefixes.Do( - delegate(Patch patchInfo) - { - harmony.Unpatch(methodBase, patchInfo.PatchMethod); - }); - } - - patchInfo.Transpilers.Do( - delegate(Patch patchInfo) + patchInfo.Postfixes.Do((patchInfo) => + { + harmony.Unpatch(methodBase, patchInfo.PatchMethod); + }); + patchInfo.Prefixes.Do((patchInfo) => { harmony.Unpatch(methodBase, patchInfo.PatchMethod); }); + } + + patchInfo.Transpilers.Do((patchInfo) => + { + harmony.Unpatch(methodBase, patchInfo.PatchMethod); + }); if (hasMethodBody) { - patchInfo.Finalizers.Do( - delegate(Patch patchInfo) - { - harmony.Unpatch(methodBase, patchInfo.PatchMethod); - }); + patchInfo.Finalizers.Do((patchInfo) => + { + harmony.Unpatch(methodBase, patchInfo.PatchMethod); + }); } PatchedGroupMethodsValue.Remove(methodBase); } } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Hazards/AmnesticCloudHazard.cs b/EXILED/Exiled.API/Features/Hazards/AmnesticCloudHazard.cs index cc9bff8d67..9a1cc7e110 100644 --- a/EXILED/Exiled.API/Features/Hazards/AmnesticCloudHazard.cs +++ b/EXILED/Exiled.API/Features/Hazards/AmnesticCloudHazard.cs @@ -8,6 +8,7 @@ namespace Exiled.API.Features.Hazards { using Exiled.API.Enums; + using PlayerRoles.PlayableScps.Scp939; /// @@ -15,8 +16,6 @@ namespace Exiled.API.Features.Hazards /// public class AmnesticCloudHazard : TemporaryHazard { - private static Scp939AmnesticCloudInstance amnesticCloudPrefab; - /// /// Initializes a new instance of the class. /// @@ -36,10 +35,10 @@ public static Scp939AmnesticCloudInstance AmnesticCloudPrefab { get { - if (amnesticCloudPrefab == null) - amnesticCloudPrefab = PrefabHelper.GetPrefab(PrefabType.AmnesticCloudHazard); + if (field == null) + field = PrefabHelper.GetPrefab(PrefabType.AmnesticCloudHazard); - return amnesticCloudPrefab; + return field; } } diff --git a/EXILED/Exiled.API/Features/Hazards/Hazard.cs b/EXILED/Exiled.API/Features/Hazards/Hazard.cs index dae1a9703d..33f15915f5 100644 --- a/EXILED/Exiled.API/Features/Hazards/Hazard.cs +++ b/EXILED/Exiled.API/Features/Hazards/Hazard.cs @@ -14,8 +14,11 @@ namespace Exiled.API.Features.Hazards using Exiled.API.Enums; using Exiled.API.Features.Core; using Exiled.API.Interfaces; + using global::Hazards; + using PlayerRoles.PlayableScps.Scp939; + using UnityEngine; /// @@ -121,13 +124,13 @@ public Vector3 Position public static Hazard Get(EnvironmentalHazard environmentalHazard) => EnvironmentalHazardToHazard.TryGetValue(environmentalHazard, out Hazard hazard) ? hazard : environmentalHazard switch - { - TantrumEnvironmentalHazard tantrumEnvironmentalHazard => new TantrumHazard(tantrumEnvironmentalHazard), - Scp939AmnesticCloudInstance scp939AmnesticCloudInstance => new AmnesticCloudHazard(scp939AmnesticCloudInstance), - SinkholeEnvironmentalHazard sinkholeEnvironmentalHazard => new SinkholeHazard(sinkholeEnvironmentalHazard), - global::Hazards.TemporaryHazard temporaryHazard => new TemporaryHazard(temporaryHazard), - _ => new Hazard(environmentalHazard) - }; + { + TantrumEnvironmentalHazard tantrumEnvironmentalHazard => new TantrumHazard(tantrumEnvironmentalHazard), + Scp939AmnesticCloudInstance scp939AmnesticCloudInstance => new AmnesticCloudHazard(scp939AmnesticCloudInstance), + SinkholeEnvironmentalHazard sinkholeEnvironmentalHazard => new SinkholeHazard(sinkholeEnvironmentalHazard), + global::Hazards.TemporaryHazard temporaryHazard => new TemporaryHazard(temporaryHazard), + _ => new Hazard(environmentalHazard), + }; /// /// Gets the by . diff --git a/EXILED/Exiled.API/Features/Hazards/SinkholeHazard.cs b/EXILED/Exiled.API/Features/Hazards/SinkholeHazard.cs index 5e368dfd25..86f924c0d0 100644 --- a/EXILED/Exiled.API/Features/Hazards/SinkholeHazard.cs +++ b/EXILED/Exiled.API/Features/Hazards/SinkholeHazard.cs @@ -8,6 +8,7 @@ namespace Exiled.API.Features.Hazards { using Exiled.API.Enums; + using global::Hazards; /// diff --git a/EXILED/Exiled.API/Features/Hazards/TantrumHazard.cs b/EXILED/Exiled.API/Features/Hazards/TantrumHazard.cs index 2e36627d8b..733096ae26 100644 --- a/EXILED/Exiled.API/Features/Hazards/TantrumHazard.cs +++ b/EXILED/Exiled.API/Features/Hazards/TantrumHazard.cs @@ -8,9 +8,13 @@ namespace Exiled.API.Features.Hazards { using Exiled.API.Enums; + using global::Hazards; + using Mirror; + using RelativePositioning; + using UnityEngine; /// @@ -18,8 +22,6 @@ namespace Exiled.API.Features.Hazards /// public class TantrumHazard : TemporaryHazard { - private static TantrumEnvironmentalHazard tantrumPrefab; - /// /// Initializes a new instance of the class. /// @@ -37,10 +39,10 @@ public static TantrumEnvironmentalHazard TantrumPrefab { get { - if (tantrumPrefab == null) - tantrumPrefab = PrefabHelper.GetPrefab(PrefabType.TantrumObj); + if (field == null) + field = PrefabHelper.GetPrefab(PrefabType.TantrumObj); - return tantrumPrefab; + return field; } } diff --git a/EXILED/Exiled.API/Features/Items/Ammo.cs b/EXILED/Exiled.API/Features/Items/Ammo.cs index d6cf394750..54210cc6d2 100644 --- a/EXILED/Exiled.API/Features/Items/Ammo.cs +++ b/EXILED/Exiled.API/Features/Items/Ammo.cs @@ -8,6 +8,7 @@ namespace Exiled.API.Features.Items { using Enums; + using Exiled.API.Interfaces; using InventorySystem.Items.Firearms.Ammo; diff --git a/EXILED/Exiled.API/Features/Items/Armor.cs b/EXILED/Exiled.API/Features/Items/Armor.cs index 344b7a0118..43676a2e97 100644 --- a/EXILED/Exiled.API/Features/Items/Armor.cs +++ b/EXILED/Exiled.API/Features/Items/Armor.cs @@ -15,10 +15,10 @@ namespace Exiled.API.Features.Items using Exiled.API.Interfaces; using InventorySystem.Items.Armor; + using PlayerRoles; using Structs; - using UnityEngine; /// /// A wrapper class for . diff --git a/EXILED/Exiled.API/Features/Items/Consumable.cs b/EXILED/Exiled.API/Features/Items/Consumable.cs index 6b4ec6c5ce..0927474fe0 100644 --- a/EXILED/Exiled.API/Features/Items/Consumable.cs +++ b/EXILED/Exiled.API/Features/Items/Consumable.cs @@ -49,4 +49,4 @@ internal override void ChangeOwner(Player oldOwner, Player newOwner) Base.Owner = newOwner.ReferenceHub; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Items/ExplosiveGrenade.cs b/EXILED/Exiled.API/Features/Items/ExplosiveGrenade.cs index b550c13456..e9b7b0ce95 100644 --- a/EXILED/Exiled.API/Features/Items/ExplosiveGrenade.cs +++ b/EXILED/Exiled.API/Features/Items/ExplosiveGrenade.cs @@ -15,6 +15,7 @@ namespace Exiled.API.Features.Items using InventorySystem.Items; using InventorySystem.Items.Pickups; using InventorySystem.Items.ThrowableProjectiles; + using UnityEngine; using Object = UnityEngine.Object; diff --git a/EXILED/Exiled.API/Features/Items/Firearm.cs b/EXILED/Exiled.API/Features/Items/Firearm.cs index 9cd3a13395..acc9aecae1 100644 --- a/EXILED/Exiled.API/Features/Items/Firearm.cs +++ b/EXILED/Exiled.API/Features/Items/Firearm.cs @@ -13,6 +13,7 @@ namespace Exiled.API.Features.Items using AudioPooling; using CameraShaking; + using Enums; using Exiled.API.Features.Items.FirearmModules; @@ -21,7 +22,9 @@ namespace Exiled.API.Features.Items using Exiled.API.Features.Pickups; using Exiled.API.Interfaces; using Exiled.API.Structs; + using Extensions; + using InventorySystem.Items.Autosync; using InventorySystem.Items.Firearms.Attachments; using InventorySystem.Items.Firearms.Attachments.Components; @@ -123,8 +126,7 @@ public static IReadOnlyDictionary>> playerPreferences = AttachmentsServerHandler.PlayerPreferences.Where( - kvp => kvp.Key is not null).Select( - (KeyValuePair> keyValuePair) => + kvp => kvp.Key is not null).Select(keyValuePair => { return new KeyValuePair>( Player.Get(keyValuePair.Key), @@ -198,12 +200,7 @@ public int MagazineAmmo public int BarrelAmmo { get => BarrelMagazine?.Ammo ?? 0; - - set - { - if (BarrelMagazine != null) - BarrelMagazine.Ammo = value; - } + set => BarrelMagazine?.Ammo = value; } /// @@ -280,12 +277,7 @@ public float DamageFalloffDistance public int MaxBarrelAmmo { get => BarrelMagazine?.MaxAmmo ?? 0; - - set - { - if (BarrelMagazine != null) - BarrelMagazine.MaxAmmo = value; - } + set => BarrelMagazine?.MaxAmmo = value; } /// @@ -909,4 +901,4 @@ internal override void ReadPickupInfoBefore(Pickup pickup) } } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Items/FirearmModules/Barrel/AutomaticBarrelMagazine.cs b/EXILED/Exiled.API/Features/Items/FirearmModules/Barrel/AutomaticBarrelMagazine.cs index db8992d720..0ddbd8bf54 100644 --- a/EXILED/Exiled.API/Features/Items/FirearmModules/Barrel/AutomaticBarrelMagazine.cs +++ b/EXILED/Exiled.API/Features/Items/FirearmModules/Barrel/AutomaticBarrelMagazine.cs @@ -7,12 +7,6 @@ namespace Exiled.API.Features.Items.FirearmModules.Barrel { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Text; - using System.Threading.Tasks; - using InventorySystem.Items.Firearms.Modules; using UnityEngine; @@ -102,4 +96,4 @@ public bool BoltLocked /// public override void Resync() => AutomaticBarrel.ServerResync(); } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Items/FirearmModules/Barrel/BarrelMagazine.cs b/EXILED/Exiled.API/Features/Items/FirearmModules/Barrel/BarrelMagazine.cs index b1e11f7580..d189df088f 100644 --- a/EXILED/Exiled.API/Features/Items/FirearmModules/Barrel/BarrelMagazine.cs +++ b/EXILED/Exiled.API/Features/Items/FirearmModules/Barrel/BarrelMagazine.cs @@ -28,4 +28,4 @@ public BarrelMagazine(IAmmoContainerModule module) /// public abstract bool IsCocked { get; set; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Items/FirearmModules/Barrel/PumpBarrelMagazine.cs b/EXILED/Exiled.API/Features/Items/FirearmModules/Barrel/PumpBarrelMagazine.cs index afeb1f3248..141cacbab8 100644 --- a/EXILED/Exiled.API/Features/Items/FirearmModules/Barrel/PumpBarrelMagazine.cs +++ b/EXILED/Exiled.API/Features/Items/FirearmModules/Barrel/PumpBarrelMagazine.cs @@ -7,12 +7,6 @@ namespace Exiled.API.Features.Items.FirearmModules.Barrel { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Text; - using System.Threading.Tasks; - using InventorySystem.Items.Firearms.Modules; using UnityEngine; @@ -88,4 +82,4 @@ public override bool IsCocked /// public override void Resync() => PumpBarrel.ServerResync(); } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Items/FirearmModules/Magazine.cs b/EXILED/Exiled.API/Features/Items/FirearmModules/Magazine.cs index 8fb2688bb7..a0633f46c0 100644 --- a/EXILED/Exiled.API/Features/Items/FirearmModules/Magazine.cs +++ b/EXILED/Exiled.API/Features/Items/FirearmModules/Magazine.cs @@ -7,12 +7,12 @@ namespace Exiled.API.Features.Items.FirearmModules { - using System; - using Exiled.API.Features.Items.FirearmModules.Barrel; using Exiled.API.Features.Items.FirearmModules.Primary; + using InventorySystem.Items.Firearms.Modules; using InventorySystem.Items.Firearms.Modules.Scp127; + using UnityEngine; /// @@ -69,7 +69,7 @@ public static Magazine Get(IAmmoContainerModule module) MagazineModule magazine => magazine switch { Scp127MagazineModule scp127MagazineModule => new Scp127Magazine(scp127MagazineModule), - _ => new NormalMagazine(magazine) + _ => new NormalMagazine(magazine), }, _ => null, }, @@ -111,4 +111,4 @@ public int ModifyAmmo(int delta, bool useBorders = true) /// public abstract void Resync(); } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Items/FirearmModules/Primary/CylinderMagazine.cs b/EXILED/Exiled.API/Features/Items/FirearmModules/Primary/CylinderMagazine.cs index fcb6a78dfc..1529e7dab1 100644 --- a/EXILED/Exiled.API/Features/Items/FirearmModules/Primary/CylinderMagazine.cs +++ b/EXILED/Exiled.API/Features/Items/FirearmModules/Primary/CylinderMagazine.cs @@ -7,8 +7,6 @@ namespace Exiled.API.Features.Items.FirearmModules.Primary { - using System; - using System.Collections; using System.Collections.Generic; using System.Linq; @@ -109,4 +107,4 @@ public RevolverChamberState State } } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Items/FirearmModules/Primary/NormalMagazine.cs b/EXILED/Exiled.API/Features/Items/FirearmModules/Primary/NormalMagazine.cs index 4543e0c5a8..b0542134a2 100644 --- a/EXILED/Exiled.API/Features/Items/FirearmModules/Primary/NormalMagazine.cs +++ b/EXILED/Exiled.API/Features/Items/FirearmModules/Primary/NormalMagazine.cs @@ -101,4 +101,4 @@ public bool MagazineInserted /// public override void Resync() => MagazineModule.ServerResyncData(); } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Items/FirearmModules/Primary/PrimaryMagazine.cs b/EXILED/Exiled.API/Features/Items/FirearmModules/Primary/PrimaryMagazine.cs index ab199319b3..8125a70b4c 100644 --- a/EXILED/Exiled.API/Features/Items/FirearmModules/Primary/PrimaryMagazine.cs +++ b/EXILED/Exiled.API/Features/Items/FirearmModules/Primary/PrimaryMagazine.cs @@ -64,4 +64,4 @@ public override int Ammo /// public abstract ItemType AmmoItemType { get; set; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Items/FlashGrenade.cs b/EXILED/Exiled.API/Features/Items/FlashGrenade.cs index 867d11b3ad..88e9129fb0 100644 --- a/EXILED/Exiled.API/Features/Items/FlashGrenade.cs +++ b/EXILED/Exiled.API/Features/Items/FlashGrenade.cs @@ -59,12 +59,12 @@ public float MinimalDurationEffect } /// - /// Gets or sets the additional duration of the effect. + /// Gets or sets the additional duration of the effect. /// - public float AdditionalBlindedEffect + public float AdditionalBlurredEffect { - get => Projectile.AdditionalBlindedEffect; - set => Projectile.AdditionalBlindedEffect = value; + get => Projectile.AdditionalBlurredEffect; + set => Projectile.AdditionalBlurredEffect = value; } /// @@ -105,7 +105,7 @@ public FlashbangProjectile SpawnActive(Vector3 position, Player owner = null) grenade.Base.gameObject.SetActive(true); grenade.MinimalDurationEffect = MinimalDurationEffect; - grenade.AdditionalBlindedEffect = AdditionalBlindedEffect; + grenade.AdditionalBlurredEffect = AdditionalBlurredEffect; grenade.SurfaceDistanceIntensifier = SurfaceDistanceIntensifier; grenade.FuseTime = FuseTime; @@ -125,7 +125,7 @@ public FlashbangProjectile SpawnActive(Vector3 position, Player owner = null) public override Item Clone() => new FlashGrenade() { MinimalDurationEffect = MinimalDurationEffect, - AdditionalBlindedEffect = AdditionalBlindedEffect, + AdditionalBlurredEffect = AdditionalBlurredEffect, SurfaceDistanceIntensifier = SurfaceDistanceIntensifier, FuseTime = FuseTime, Repickable = Repickable, @@ -145,7 +145,7 @@ internal override void ReadPickupInfoBefore(Pickup pickup) if (pickup is FlashGrenadePickup flashGrenadePickup) { MinimalDurationEffect = flashGrenadePickup.MinimalDurationEffect; - AdditionalBlindedEffect = flashGrenadePickup.AdditionalBlindedEffect; + AdditionalBlurredEffect = flashGrenadePickup.AdditionalBlurredEffect; SurfaceDistanceIntensifier = flashGrenadePickup.SurfaceDistanceIntensifier; FuseTime = flashGrenadePickup.FuseTime; } diff --git a/EXILED/Exiled.API/Features/Items/Flashlight.cs b/EXILED/Exiled.API/Features/Items/Flashlight.cs index 93a3876ca6..4030d1a358 100644 --- a/EXILED/Exiled.API/Features/Items/Flashlight.cs +++ b/EXILED/Exiled.API/Features/Items/Flashlight.cs @@ -7,12 +7,12 @@ namespace Exiled.API.Features.Items { - using System; - using Exiled.API.Interfaces; + using InventorySystem.Items.ToggleableLights; using InventorySystem.Items.ToggleableLights.Flashlight; using InventorySystem.Items.ToggleableLights.Lantern; + using Utils.Networking; /// @@ -80,4 +80,4 @@ public float NextAllowedTime /// A string containing item-related data. public override string ToString() => $"{Type} ({Serial}) [{Weight}] *{Scale}* |{IsEmittingLight}| /{NextAllowedTime}/"; } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Items/Item.cs b/EXILED/Exiled.API/Features/Items/Item.cs index 4422101d86..f6a3f5651d 100644 --- a/EXILED/Exiled.API/Features/Items/Item.cs +++ b/EXILED/Exiled.API/Features/Items/Item.cs @@ -15,6 +15,7 @@ namespace Exiled.API.Features.Items using Exiled.API.Features.Items.Keycards; using Exiled.API.Features.Pickups; using Exiled.API.Interfaces; + using InventorySystem; using InventorySystem.Items; using InventorySystem.Items.Armor; @@ -34,7 +35,9 @@ namespace Exiled.API.Features.Items using InventorySystem.Items.Usables.Scp1576; using InventorySystem.Items.Usables.Scp244; using InventorySystem.Items.Usables.Scp330; + using NetworkManagerUtils.Dummies; + using UnityEngine; using BaseConsumable = InventorySystem.Items.Usables.Consumable; @@ -242,7 +245,7 @@ public static Item Get(ItemBase itemBase) ItemType.KeycardCustomManagement => new ManagementKeycard(keycard), ItemType.KeycardCustomMetalCase => new MetalKeycard(keycard), _ => new Keycard(keycard), - } + }, }, UsableItem usable => usable switch { @@ -347,7 +350,7 @@ public static T Get(ushort serial) ItemType.KeycardCustomManagement => new ManagementKeycard(type), ItemType.KeycardCustomMetalCase => new MetalKeycard(type), _ => new Keycard(type, owner), - } + }, }, UsableItem usable => usable switch { @@ -421,7 +424,19 @@ public static T Create(ItemType type, Player owner = null) /// /// Destroy this item. /// - public void Destroy() => Owner.RemoveItem(this); + public void Destroy() + { + if (Owner.RemoveItem(this)) + return; + + if (Base != null) + { + BaseToItem.Remove(Base); + + if (Base.gameObject != null) + Object.Destroy(Base.gameObject); + } + } /// /// Creates the that based on this . @@ -517,4 +532,4 @@ internal virtual void ReadPickupInfoAfter(Pickup pickup) { } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Items/Jailbird.cs b/EXILED/Exiled.API/Features/Items/Jailbird.cs index 4cc9a59c86..d4d5c60302 100644 --- a/EXILED/Exiled.API/Features/Items/Jailbird.cs +++ b/EXILED/Exiled.API/Features/Items/Jailbird.cs @@ -11,10 +11,13 @@ namespace Exiled.API.Features.Items using Exiled.API.Features.Pickups; using Exiled.API.Interfaces; + using InventorySystem.Items; using InventorySystem.Items.Autosync; using InventorySystem.Items.Jailbird; + using Mirror; + using UnityEngine; using JailbirdPickup = Pickups.JailbirdPickup; diff --git a/EXILED/Exiled.API/Features/Items/Keycard.cs b/EXILED/Exiled.API/Features/Items/Keycard.cs index e153ebdbda..92d424cd98 100644 --- a/EXILED/Exiled.API/Features/Items/Keycard.cs +++ b/EXILED/Exiled.API/Features/Items/Keycard.cs @@ -9,7 +9,9 @@ namespace Exiled.API.Features.Items { using Exiled.API.Enums; using Exiled.API.Interfaces; + using Interactables.Interobjects.DoorUtils; + using InventorySystem.Items.Keycards; /// diff --git a/EXILED/Exiled.API/Features/Items/Keycards/CustomKeycardItem.cs b/EXILED/Exiled.API/Features/Items/Keycards/CustomKeycardItem.cs index 7497cfef56..20334bb7f1 100644 --- a/EXILED/Exiled.API/Features/Items/Keycards/CustomKeycardItem.cs +++ b/EXILED/Exiled.API/Features/Items/Keycards/CustomKeycardItem.cs @@ -14,10 +14,13 @@ namespace Exiled.API.Features.Items.Keycards using Exiled.API.Extensions; using Exiled.API.Features.Pools; using Exiled.API.Interfaces.Keycards; + using Interactables.Interobjects.DoorUtils; + using InventorySystem; using InventorySystem.Items; using InventorySystem.Items.Keycards; + using UnityEngine; /// @@ -199,10 +202,10 @@ public ItemType FindMatch(bool matchDesign, bool matchPerms, bool matchColors) goto add; - cont: + cont: continue; - add: + add: matches.Add(type); } diff --git a/EXILED/Exiled.API/Features/Items/Keycards/PermissionsProvider.cs b/EXILED/Exiled.API/Features/Items/Keycards/PermissionsProvider.cs index bbf6b31de7..37ca31f796 100644 --- a/EXILED/Exiled.API/Features/Items/Keycards/PermissionsProvider.cs +++ b/EXILED/Exiled.API/Features/Items/Keycards/PermissionsProvider.cs @@ -8,9 +8,11 @@ namespace Exiled.API.Features.Items.Keycards { using Interactables.Interobjects.DoorUtils; + using InventorySystem.Items; using InventorySystem.Items.Autosync; using InventorySystem.Items.Keycards; + using Mirror; /// diff --git a/EXILED/Exiled.API/Features/Items/Keycards/SingleUseKeycard.cs b/EXILED/Exiled.API/Features/Items/Keycards/SingleUseKeycard.cs index 0caff46af8..e0a6b4676b 100644 --- a/EXILED/Exiled.API/Features/Items/Keycards/SingleUseKeycard.cs +++ b/EXILED/Exiled.API/Features/Items/Keycards/SingleUseKeycard.cs @@ -12,7 +12,9 @@ namespace Exiled.API.Features.Items.Keycards using Exiled.API.Enums; using Exiled.API.Features.Pickups; using Exiled.API.Features.Pickups.Keycards; + using Interactables.Interobjects.DoorUtils; + using InventorySystem.Items; using InventorySystem.Items.Keycards; diff --git a/EXILED/Exiled.API/Features/Items/Marshmallow.cs b/EXILED/Exiled.API/Features/Items/Marshmallow.cs index a893a41c20..1c7769a3a4 100644 --- a/EXILED/Exiled.API/Features/Items/Marshmallow.cs +++ b/EXILED/Exiled.API/Features/Items/Marshmallow.cs @@ -8,10 +8,14 @@ namespace Exiled.API.Features.Items { using CustomPlayerEffects; + using Exiled.API.Interfaces; + using InventorySystem.Items.MarshmallowMan; using InventorySystem.Items.Usables; + using PlayerStatsSystem; + using UnityEngine; /// diff --git a/EXILED/Exiled.API/Features/Items/MicroHid.cs b/EXILED/Exiled.API/Features/Items/MicroHid.cs index 0495a3b3bc..07cad32048 100644 --- a/EXILED/Exiled.API/Features/Items/MicroHid.cs +++ b/EXILED/Exiled.API/Features/Items/MicroHid.cs @@ -7,14 +7,9 @@ namespace Exiled.API.Features.Items { - using System; - using System.Reflection; - - using Exiled.API.Features.Pickups; using Exiled.API.Interfaces; using InventorySystem.Items.Autosync; - using InventorySystem.Items.Firearms.Modules; using InventorySystem.Items.MicroHID; using InventorySystem.Items.MicroHID.Modules; diff --git a/EXILED/Exiled.API/Features/Items/Radio.cs b/EXILED/Exiled.API/Features/Items/Radio.cs index d54abae2d9..449bc6bb21 100644 --- a/EXILED/Exiled.API/Features/Items/Radio.cs +++ b/EXILED/Exiled.API/Features/Items/Radio.cs @@ -8,6 +8,7 @@ namespace Exiled.API.Features.Items { using Enums; + using Exiled.API.Interfaces; using InventorySystem.Items.Radio; diff --git a/EXILED/Exiled.API/Features/Items/Scp127.cs b/EXILED/Exiled.API/Features/Items/Scp127.cs index 2c71fbe4bb..31177095a4 100644 --- a/EXILED/Exiled.API/Features/Items/Scp127.cs +++ b/EXILED/Exiled.API/Features/Items/Scp127.cs @@ -12,6 +12,7 @@ namespace Exiled.API.Features.Items using InventorySystem.Items.Firearms.Modules; using InventorySystem.Items.Firearms.Modules.Scp127; + using UnityEngine; /// @@ -19,12 +20,12 @@ namespace Exiled.API.Features.Items /// public class Scp127 : Firearm { - #pragma warning disable SA1401 +#pragma warning disable SA1401 /// /// Custom amount of max HS. /// internal float? CustomHsMax; - #pragma warning restore SA1401 +#pragma warning restore SA1401 /// /// Initializes a new instance of the class. diff --git a/EXILED/Exiled.API/Features/Items/Scp1344.cs b/EXILED/Exiled.API/Features/Items/Scp1344.cs index 7f96da8903..cd824fc3f0 100644 --- a/EXILED/Exiled.API/Features/Items/Scp1344.cs +++ b/EXILED/Exiled.API/Features/Items/Scp1344.cs @@ -11,6 +11,7 @@ namespace Exiled.API.Features.Items using InventorySystem.Items.Usables; using InventorySystem.Items.Usables.Scp1344; + using PlayerRoles.FirstPersonControl.Thirdperson.Subcontrollers.Wearables; /// @@ -66,10 +67,8 @@ public Scp1344Status Status /// Whether or not 1344 should be dropped. public void Deactivate(bool dropItem = false) { - if (Status is not(Scp1344Status.Active or Scp1344Status.Stabbing or Scp1344Status.Dropping)) - { + if (Status is not (Scp1344Status.Active or Scp1344Status.Stabbing or Scp1344Status.Dropping)) return; - } Base.Owner.DisableWearables(WearableElements.Scp1344Goggles); Base.ActivateFinalEffects(); @@ -86,4 +85,4 @@ public void Deactivate(bool dropItem = false) /// public void Actived() => Status = Scp1344Status.Stabbing; } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Items/Scp1509.cs b/EXILED/Exiled.API/Features/Items/Scp1509.cs index 010aaf666e..7cd4a6eef1 100644 --- a/EXILED/Exiled.API/Features/Items/Scp1509.cs +++ b/EXILED/Exiled.API/Features/Items/Scp1509.cs @@ -12,7 +12,9 @@ namespace Exiled.API.Features.Items using Exiled.API.Enums; using Exiled.API.Interfaces; + using InventorySystem.Items.Scp1509; + using PlayerRoles; /// @@ -176,4 +178,4 @@ public IEnumerable RevivedPlayers UnequipDecayDelay = UnequipDecayDelay, }; } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Items/Scp1576.cs b/EXILED/Exiled.API/Features/Items/Scp1576.cs index 3ff4514e4a..1b2551e66e 100644 --- a/EXILED/Exiled.API/Features/Items/Scp1576.cs +++ b/EXILED/Exiled.API/Features/Items/Scp1576.cs @@ -50,4 +50,4 @@ internal Scp1576() /// public void StopTransmitting() => Base.ServerStopTransmitting(); } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Items/Scp330.cs b/EXILED/Exiled.API/Features/Items/Scp330.cs index 38c9ded765..4df42da51e 100644 --- a/EXILED/Exiled.API/Features/Items/Scp330.cs +++ b/EXILED/Exiled.API/Features/Items/Scp330.cs @@ -290,4 +290,4 @@ internal override void ChangeOwner(Player oldOwner, Player newOwner) Base.Owner = newOwner.ReferenceHub; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Items/Throwable.cs b/EXILED/Exiled.API/Features/Items/Throwable.cs index 00a2e1af89..a4b0434632 100644 --- a/EXILED/Exiled.API/Features/Items/Throwable.cs +++ b/EXILED/Exiled.API/Features/Items/Throwable.cs @@ -113,4 +113,4 @@ public void Throw(bool fullForce = true) /// A string containing Throwable-related data. public override string ToString() => $"{Type} ({Serial}) [{Weight}] *{Scale}* |{PinPullTime}|"; } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Items/Usable.cs b/EXILED/Exiled.API/Features/Items/Usable.cs index efdff0c2ff..9da85656aa 100644 --- a/EXILED/Exiled.API/Features/Items/Usable.cs +++ b/EXILED/Exiled.API/Features/Items/Usable.cs @@ -12,7 +12,6 @@ namespace Exiled.API.Features.Items using Exiled.API.Interfaces; using InventorySystem; - using InventorySystem.Items; using InventorySystem.Items.Pickups; using InventorySystem.Items.Usables; diff --git a/EXILED/Exiled.API/Features/Lift.cs b/EXILED/Exiled.API/Features/Lift.cs index e000ca4d9c..a1f0fb74cc 100644 --- a/EXILED/Exiled.API/Features/Lift.cs +++ b/EXILED/Exiled.API/Features/Lift.cs @@ -16,9 +16,12 @@ namespace Exiled.API.Features using Exiled.API.Features.Doors; using Exiled.API.Features.Pools; using Exiled.API.Interfaces; + using Interactables.Interobjects; using Interactables.Interobjects.DoorUtils; + using UnityEngine; + using Utils; using static Interactables.Interobjects.ElevatorChamber; @@ -83,7 +86,7 @@ internal Lift(ElevatorChamber elevator) /// /// Gets a value of the internal doors list. /// - public IReadOnlyCollection Doors => internalDoorsList.Select(x => Door.Get(x)).ToList(); + public IReadOnlyCollection Doors => internalDoorsList.Select(Door.Get).ToList(); /// /// Gets a of in the . @@ -341,4 +344,4 @@ public void ChangeLock(DoorLockReason lockReason) /// A string containing Lift-related data. public override string ToString() => $"{Type} {Status} [{CurrentLevel}] *{IsLocked}*"; } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Lockers/Chamber.cs b/EXILED/Exiled.API/Features/Lockers/Chamber.cs index a69f0a27b9..29ae859787 100644 --- a/EXILED/Exiled.API/Features/Lockers/Chamber.cs +++ b/EXILED/Exiled.API/Features/Lockers/Chamber.cs @@ -16,8 +16,11 @@ namespace Exiled.API.Features.Lockers using Exiled.API.Extensions; using Exiled.API.Features.Pickups; using Exiled.API.Interfaces; + using InventorySystem.Items.Pickups; + using MapGeneration.Distributors; + using UnityEngine; /// @@ -313,4 +316,4 @@ internal static Chamber Get(LockerChamber chamber) return new(chamber, Locker.Get(x => x.Chambers.Any(x => x.Base == chamber)).FirstOrDefault()); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Lockers/Locker.cs b/EXILED/Exiled.API/Features/Lockers/Locker.cs index 7cc9e28e86..627a9b44c6 100644 --- a/EXILED/Exiled.API/Features/Lockers/Locker.cs +++ b/EXILED/Exiled.API/Features/Lockers/Locker.cs @@ -16,10 +16,8 @@ namespace Exiled.API.Features.Lockers using Exiled.API.Features.Pickups; using Exiled.API.Interfaces; - using InventorySystem.Items.Pickups; using MapGeneration.Distributors; - using Mirror; using UnityEngine; using BaseLocker = MapGeneration.Distributors.Locker; @@ -233,4 +231,4 @@ internal static void ClearCache() Chamber.Chambers.Clear(); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Map.cs b/EXILED/Exiled.API/Features/Map.cs index 0d963b221a..a7c59a1eec 100644 --- a/EXILED/Exiled.API/Features/Map.cs +++ b/EXILED/Exiled.API/Features/Map.cs @@ -15,27 +15,40 @@ namespace Exiled.API.Features using System.Linq; using CommandSystem.Commands.RemoteAdmin.Cleanup; + using Decals; + using Enums; + using Exiled.API.Extensions; using Exiled.API.Features.Items.Keycards; using Exiled.API.Features.Pickups; using Interactables.Interobjects; + using InventorySystem; using InventorySystem.Items; using InventorySystem.Items.Autosync; using InventorySystem.Items.Firearms.Modules; using InventorySystem.Items.Pickups; using InventorySystem.Items.ThrowableProjectiles; + using Items; + using LightContainmentZoneDecontamination; + using MapGeneration; + using Mirror; + using PlayerRoles.Ragdolls; + using RelativePositioning; + using RemoteAdmin; + using UnityEngine; + using Utils; using Utils.Networking; @@ -51,10 +64,6 @@ public static class Map /// internal static List TeleportsValue = new(); - private static AmbientSoundPlayer ambientSoundPlayer; - - private static SqueakSpawner squeakSpawner; - /// /// Gets a value indicating whether decontamination has begun in the light containment zone. /// @@ -128,12 +137,12 @@ public static bool IsDecontaminationEnabled /// /// Gets the . /// - public static AmbientSoundPlayer AmbientSoundPlayer => ambientSoundPlayer ??= ReferenceHub._hostHub.GetComponent(); + public static AmbientSoundPlayer AmbientSoundPlayer => field ??= ReferenceHub._hostHub.GetComponent(); /// /// Gets the . /// - public static SqueakSpawner SqueakSpawner => squeakSpawner ??= Object.FindFirstObjectByType(); + public static SqueakSpawner SqueakSpawner => field ??= Object.FindFirstObjectByType(); /// /// Sends a staff message to all players online with permission. @@ -298,7 +307,7 @@ public static bool PlaySquishSound(Vector3 position) /// /// Forces the light containment zone decontamination process. /// - public static void StartDecontamination() => DecontaminationController.Singleton.FinishDecontamination(); + public static void StartDecontamination() => DecontaminationController.Singleton.DecontaminationOverride = DecontaminationController.DecontaminationStatus.Forced; /// /// Turns on all lights in the facility. @@ -592,4 +601,4 @@ internal static void ClearCache() #pragma warning restore CS0618 } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Npc.cs b/EXILED/Exiled.API/Features/Npc.cs index a52cee7054..1d995194f9 100644 --- a/EXILED/Exiled.API/Features/Npc.cs +++ b/EXILED/Exiled.API/Features/Npc.cs @@ -14,22 +14,30 @@ namespace Exiled.API.Features using CommandSystem; using CommandSystem.Commands.RemoteAdmin.Dummies; + using Exiled.API.Enums; using Exiled.API.Features.CustomStats; using Exiled.API.Features.Items; using Exiled.API.Features.Roles; + using Footprinting; + using InventorySystem; using InventorySystem.Items.Usables; using InventorySystem.Items.Usables.Scp330; + using MEC; + using Mirror; + using NetworkManagerUtils.Dummies; + using PlayerRoles; using PlayerRoles.FirstPersonControl; using PlayerRoles.Subroutines; + using PlayerStatsSystem; - using RelativePositioning; + using UnityEngine; /// @@ -109,7 +117,7 @@ public float? MaxDistance set { - if(!value.HasValue) + if (!value.HasValue) return; if (!GameObject.TryGetComponent(out PlayerFollower follower)) @@ -138,7 +146,7 @@ public float? MinDistance set { - if(!value.HasValue) + if (!value.HasValue) return; if (!GameObject.TryGetComponent(out PlayerFollower follower)) @@ -167,7 +175,7 @@ public float? Speed set { - if(!value.HasValue) + if (!value.HasValue) return; if (!GameObject.TryGetComponent(out PlayerFollower follower)) @@ -298,7 +306,7 @@ public static Npc Spawn(string name, RoleTypeId role = RoleTypeId.None, bool ign }); if (ignored) - Round.IgnoredPlayers.Add(npc.ReferenceHub); + Round.IgnoredPlayers.Add(npc); Dictionary.Add(npc.GameObject, npc); return npc; @@ -341,7 +349,7 @@ public void Destroy() { try { - Round.IgnoredPlayers.Remove(ReferenceHub); + Round.IgnoredPlayers.Remove(this); Dictionary.Remove(ReferenceHub.gameObject); NetworkServer.Destroy(ReferenceHub.gameObject); } @@ -460,7 +468,7 @@ public bool Jump(float? jumpStrength = null) /// True if successful. public bool EatCandy(CandyKindID candyKind) { - foreach(Item? item in Items) + foreach (Item? item in Items) { if (item is not Scp330 scp330) { @@ -656,4 +664,4 @@ public bool StopAction(DummyKeyEmulator? emulator, ActionName name) public bool IsBeingDone(DummyKeyEmulator? emulator, ActionName name) => emulator?.GetAction(name, false) ?? false; } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Objectives/EscapeObjective.cs b/EXILED/Exiled.API/Features/Objectives/EscapeObjective.cs index 9b141f22f9..1bc646df3c 100644 --- a/EXILED/Exiled.API/Features/Objectives/EscapeObjective.cs +++ b/EXILED/Exiled.API/Features/Objectives/EscapeObjective.cs @@ -9,7 +9,9 @@ namespace Exiled.API.Features.Objectives { using Exiled.API.Enums; using Exiled.API.Interfaces; + using PlayerRoles; + using Respawning.Objectives; using BaseObjective = Respawning.Objectives.EscapeObjective; diff --git a/EXILED/Exiled.API/Features/Objectives/GeneratorActivatedObjective.cs b/EXILED/Exiled.API/Features/Objectives/GeneratorActivatedObjective.cs index 77e95fa5e8..283d3b0d1a 100644 --- a/EXILED/Exiled.API/Features/Objectives/GeneratorActivatedObjective.cs +++ b/EXILED/Exiled.API/Features/Objectives/GeneratorActivatedObjective.cs @@ -9,6 +9,7 @@ namespace Exiled.API.Features.Objectives { using Exiled.API.Enums; using Exiled.API.Interfaces; + using Respawning.Objectives; using BaseObjective = Respawning.Objectives.GeneratorActivatedObjective; diff --git a/EXILED/Exiled.API/Features/Objectives/HumanDamageObjective.cs b/EXILED/Exiled.API/Features/Objectives/HumanDamageObjective.cs index 5a9f136ba9..d34fb21611 100644 --- a/EXILED/Exiled.API/Features/Objectives/HumanDamageObjective.cs +++ b/EXILED/Exiled.API/Features/Objectives/HumanDamageObjective.cs @@ -10,6 +10,7 @@ namespace Exiled.API.Features.Objectives using Exiled.API.Enums; using Exiled.API.Features.DamageHandlers; using Exiled.API.Interfaces; + using Respawning.Objectives; using BaseObjective = Respawning.Objectives.HumanDamageObjective; diff --git a/EXILED/Exiled.API/Features/Objectives/HumanKillObjective.cs b/EXILED/Exiled.API/Features/Objectives/HumanKillObjective.cs index 7856d1845b..bd73b46ebc 100644 --- a/EXILED/Exiled.API/Features/Objectives/HumanKillObjective.cs +++ b/EXILED/Exiled.API/Features/Objectives/HumanKillObjective.cs @@ -10,7 +10,9 @@ namespace Exiled.API.Features.Objectives using Exiled.API.Enums; using Exiled.API.Features.DamageHandlers; using Exiled.API.Interfaces; + using PlayerRoles; + using Respawning.Objectives; using BaseObjective = Respawning.Objectives.HumanKillObjective; diff --git a/EXILED/Exiled.API/Features/Objectives/HumanObjective.cs b/EXILED/Exiled.API/Features/Objectives/HumanObjective.cs index 77dd37f5c7..b6f50b4c31 100644 --- a/EXILED/Exiled.API/Features/Objectives/HumanObjective.cs +++ b/EXILED/Exiled.API/Features/Objectives/HumanObjective.cs @@ -8,6 +8,7 @@ namespace Exiled.API.Features.Objectives { using Exiled.API.Interfaces; + using Respawning.Objectives; /// diff --git a/EXILED/Exiled.API/Features/Objectives/Objective.cs b/EXILED/Exiled.API/Features/Objectives/Objective.cs index 7497737b0f..4a4f09388e 100644 --- a/EXILED/Exiled.API/Features/Objectives/Objective.cs +++ b/EXILED/Exiled.API/Features/Objectives/Objective.cs @@ -1,4 +1,4 @@ -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- // // Copyright (c) ExMod Team. All rights reserved. // Licensed under the CC BY-SA 3.0 license. @@ -7,14 +7,15 @@ namespace Exiled.API.Features.Objectives { - using System; using System.Collections.Generic; using System.Linq; using Exiled.API.Enums; using Exiled.API.Features.Core; using Exiled.API.Interfaces; + using PlayerRoles; + using Respawning; using Respawning.Objectives; @@ -69,7 +70,7 @@ internal Objective(FactionObjectiveBase objectiveFootprintBase) ObjectiveType.HumanDamage => FactionInfluenceManager.Objectives.OfType().First(), ObjectiveType.HumanKill => FactionInfluenceManager.Objectives.OfType().First(), ObjectiveType.Escape => FactionInfluenceManager.Objectives.OfType().First(), - _ => null + _ => null, }); /// @@ -89,7 +90,7 @@ public static Objective Get(FactionObjectiveBase factionObjectiveBase) BaseHumanDamageObjective humanDamageObjective => new HumanDamageObjective(humanDamageObjective), BaseHumanKillObjective humanKillObjective => new HumanKillObjective(humanKillObjective), BaseEscapeObjective escapeObjective => new EscapeObjective(escapeObjective), - _ => new Objective(factionObjectiveBase) + _ => new Objective(factionObjectiveBase), }; } diff --git a/EXILED/Exiled.API/Features/Objectives/ScpItemPickupObjective.cs b/EXILED/Exiled.API/Features/Objectives/ScpItemPickupObjective.cs index a50a36057f..e4d79ad4b1 100644 --- a/EXILED/Exiled.API/Features/Objectives/ScpItemPickupObjective.cs +++ b/EXILED/Exiled.API/Features/Objectives/ScpItemPickupObjective.cs @@ -11,7 +11,9 @@ namespace Exiled.API.Features.Objectives using Exiled.API.Features.Items; using Exiled.API.Features.Pickups; using Exiled.API.Interfaces; + using Respawning.Objectives; + using UnityEngine; using BaseObjective = Respawning.Objectives.ScpItemPickupObjective; diff --git a/EXILED/Exiled.API/Features/Pickups/AmmoPickup.cs b/EXILED/Exiled.API/Features/Pickups/AmmoPickup.cs index ce68921031..b061a06ba4 100644 --- a/EXILED/Exiled.API/Features/Pickups/AmmoPickup.cs +++ b/EXILED/Exiled.API/Features/Pickups/AmmoPickup.cs @@ -68,4 +68,4 @@ public ushort Ammo /// A string containing AmmoPickup related data. public override string ToString() => $"{Type} ({Serial}) [{Weight}] *{Scale}* |{MaxDisplayedAmmo}| -{Ammo}-"; } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Pickups/BodyArmorPickup.cs b/EXILED/Exiled.API/Features/Pickups/BodyArmorPickup.cs index 1b63763531..aef81f1c79 100644 --- a/EXILED/Exiled.API/Features/Pickups/BodyArmorPickup.cs +++ b/EXILED/Exiled.API/Features/Pickups/BodyArmorPickup.cs @@ -18,8 +18,6 @@ namespace Exiled.API.Features.Pickups using InventorySystem.Items; using InventorySystem.Items.Armor; - using UnityEngine; - using BaseBodyArmor = InventorySystem.Items.Armor.BodyArmorPickup; /// @@ -27,9 +25,6 @@ namespace Exiled.API.Features.Pickups /// public class BodyArmorPickup : Pickup, IWrapper { - private int helmetEfficacy; - private int vestEfficacy; - /// /// Initializes a new instance of the class. /// @@ -79,20 +74,12 @@ internal BodyArmorPickup(ItemType type) /// /// Gets or sets how strong the helmet on the armor is. /// - public int HelmetEfficacy - { - get => helmetEfficacy; - set => helmetEfficacy = value; - } + public int HelmetEfficacy { get; set; } /// /// Gets or sets how strong the vest on the armor is. /// - public int VestEfficacy - { - get => vestEfficacy; - set => vestEfficacy = value; - } + public int VestEfficacy { get; set; } /// /// Gets or sets how much faster stamina will drain when wearing this armor. @@ -131,8 +118,8 @@ internal override void ReadItemInfo(Item item) base.ReadItemInfo(item); if (item is Armor armoritem) { - helmetEfficacy = armoritem.HelmetEfficacy; - vestEfficacy = armoritem.VestEfficacy; + HelmetEfficacy = armoritem.HelmetEfficacy; + VestEfficacy = armoritem.VestEfficacy; StaminaUseMultiplier = armoritem.StaminaUseMultiplier; StaminaRegenMultiplier = armoritem.StaminaRegenMultiplier; AmmoLimits = armoritem.AmmoLimits; @@ -146,8 +133,8 @@ protected override void InitializeProperties(ItemBase itemBase) base.InitializeProperties(itemBase); if (itemBase is BodyArmor armoritem) { - helmetEfficacy = armoritem.HelmetEfficacy; - vestEfficacy = armoritem.VestEfficacy; + HelmetEfficacy = armoritem.HelmetEfficacy; + VestEfficacy = armoritem.VestEfficacy; StaminaUseMultiplier = armoritem._staminaUseMultiplier; StaminaRegenMultiplier = armoritem.StaminaRegenMultiplier; AmmoLimits = armoritem.AmmoLimits.Select(limit => (ArmorAmmoLimit)limit); @@ -155,4 +142,4 @@ protected override void InitializeProperties(ItemBase itemBase) } } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Pickups/FirearmPickup.cs b/EXILED/Exiled.API/Features/Pickups/FirearmPickup.cs index 710b8dad8e..db1182b39b 100644 --- a/EXILED/Exiled.API/Features/Pickups/FirearmPickup.cs +++ b/EXILED/Exiled.API/Features/Pickups/FirearmPickup.cs @@ -11,8 +11,6 @@ namespace Exiled.API.Features.Pickups using Exiled.API.Enums; using Exiled.API.Extensions; - using Exiled.API.Features.Items.FirearmModules; - using Exiled.API.Features.Items.FirearmModules.Primary; using Exiled.API.Interfaces; using InventorySystem.Items; @@ -213,4 +211,4 @@ protected override void InitializeProperties(ItemBase itemBase) } } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Pickups/FlashGrenadePickup.cs b/EXILED/Exiled.API/Features/Pickups/FlashGrenadePickup.cs index 3e4c979b50..d8d9f9bf95 100644 --- a/EXILED/Exiled.API/Features/Pickups/FlashGrenadePickup.cs +++ b/EXILED/Exiled.API/Features/Pickups/FlashGrenadePickup.cs @@ -42,9 +42,9 @@ internal FlashGrenadePickup() public float MinimalDurationEffect { get; set; } /// - /// Gets or sets the additional duration of the effect. + /// Gets or sets the additional duration of the effect. /// - public float AdditionalBlindedEffect { get; set; } + public float AdditionalBlurredEffect { get; set; } /// /// Gets or sets the how mush the flash grenade going to be intensified when explode at . @@ -58,7 +58,7 @@ internal override void ReadItemInfo(Item item) if (item is FlashGrenade flashGrenadeitem) { MinimalDurationEffect = flashGrenadeitem.MinimalDurationEffect; - AdditionalBlindedEffect = flashGrenadeitem.AdditionalBlindedEffect; + AdditionalBlurredEffect = flashGrenadeitem.AdditionalBlurredEffect; SurfaceDistanceIntensifier = flashGrenadeitem.SurfaceDistanceIntensifier; FuseTime = flashGrenadeitem.FuseTime; } @@ -70,7 +70,7 @@ internal override void WriteProjectileInfo(Projectile projectile) if (projectile is FlashbangProjectile flashbangProjectile) { flashbangProjectile.MinimalDurationEffect = MinimalDurationEffect; - flashbangProjectile.AdditionalBlindedEffect = AdditionalBlindedEffect; + flashbangProjectile.AdditionalBlurredEffect = AdditionalBlurredEffect; flashbangProjectile.SurfaceDistanceIntensifier = SurfaceDistanceIntensifier; flashbangProjectile.FuseTime = FuseTime; } @@ -83,9 +83,9 @@ protected override void InitializeProperties(ItemBase itemBase) if (itemBase is ThrowableItem throwable && throwable.Projectile is FlashbangGrenade flashGrenade) { MinimalDurationEffect = flashGrenade._minimalEffectDuration; - AdditionalBlindedEffect = flashGrenade._additionalBlurDuration; + AdditionalBlurredEffect = flashGrenade._additionalBlurDuration; SurfaceDistanceIntensifier = flashGrenade._surfaceZoneDistanceIntensifier; } } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Pickups/GrenadePickup.cs b/EXILED/Exiled.API/Features/Pickups/GrenadePickup.cs index 3d62c428fc..3cb4e21bf6 100644 --- a/EXILED/Exiled.API/Features/Pickups/GrenadePickup.cs +++ b/EXILED/Exiled.API/Features/Pickups/GrenadePickup.cs @@ -94,4 +94,4 @@ protected override void InitializeProperties(ItemBase itemBase) } } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Pickups/JailbirdPickup.cs b/EXILED/Exiled.API/Features/Pickups/JailbirdPickup.cs index eaaf77cb7a..d7f0ef0df2 100644 --- a/EXILED/Exiled.API/Features/Pickups/JailbirdPickup.cs +++ b/EXILED/Exiled.API/Features/Pickups/JailbirdPickup.cs @@ -109,6 +109,9 @@ internal override void ReadItemInfo(Item item) if (item is Jailbird jailBirditem) { + // TODO: Remove if this is fixed https://git.scpslgame.com/northwood-qa/scpsl-bug-reporting/-/issues/2816 + jailBirditem.Base._deterioration.RecheckUsage(); + MeleeDamage = jailBirditem.MeleeDamage; ChargeDamage = jailBirditem.ChargeDamage; FlashDuration = jailBirditem.FlashDuration; @@ -131,4 +134,4 @@ protected override void InitializeProperties(ItemBase itemBase) } } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Pickups/KeycardPickup.cs b/EXILED/Exiled.API/Features/Pickups/KeycardPickup.cs index 5a80eb35ca..f084899e32 100644 --- a/EXILED/Exiled.API/Features/Pickups/KeycardPickup.cs +++ b/EXILED/Exiled.API/Features/Pickups/KeycardPickup.cs @@ -87,4 +87,4 @@ protected override void InitializeProperties(ItemBase itemBase) } } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Pickups/Keycards/CustomKeycardPickup.cs b/EXILED/Exiled.API/Features/Pickups/Keycards/CustomKeycardPickup.cs index 58e24a105e..d8694292f8 100644 --- a/EXILED/Exiled.API/Features/Pickups/Keycards/CustomKeycardPickup.cs +++ b/EXILED/Exiled.API/Features/Pickups/Keycards/CustomKeycardPickup.cs @@ -16,11 +16,14 @@ namespace Exiled.API.Features.Pickups.Keycards using Exiled.API.Features.Items.Keycards; using Exiled.API.Features.Pools; using Exiled.API.Interfaces.Keycards; + using Interactables.Interobjects.DoorUtils; + using InventorySystem; using InventorySystem.Items; using InventorySystem.Items.Keycards; using InventorySystem.Items.Pickups; + using UnityEngine; /// @@ -164,10 +167,10 @@ public ItemType FindMatch(bool matchDesign, bool matchPerms, bool matchColors) goto add; - cont: + cont: continue; - add: + add: matches.Add(type); } diff --git a/EXILED/Exiled.API/Features/Pickups/Keycards/ManagementKeycardPickup.cs b/EXILED/Exiled.API/Features/Pickups/Keycards/ManagementKeycardPickup.cs index 9666c24b21..cf6d6e6b82 100644 --- a/EXILED/Exiled.API/Features/Pickups/Keycards/ManagementKeycardPickup.cs +++ b/EXILED/Exiled.API/Features/Pickups/Keycards/ManagementKeycardPickup.cs @@ -9,9 +9,12 @@ namespace Exiled.API.Features.Pickups.Keycards { using Exiled.API.Features.Items.Keycards; using Exiled.API.Interfaces.Keycards; + using Interactables.Interobjects.DoorUtils; + using InventorySystem.Items.Keycards; using InventorySystem.Items.Pickups; + using UnityEngine; /// diff --git a/EXILED/Exiled.API/Features/Pickups/Keycards/MetalKeycardPickup.cs b/EXILED/Exiled.API/Features/Pickups/Keycards/MetalKeycardPickup.cs index cf1c0ea894..94b34e7c92 100644 --- a/EXILED/Exiled.API/Features/Pickups/Keycards/MetalKeycardPickup.cs +++ b/EXILED/Exiled.API/Features/Pickups/Keycards/MetalKeycardPickup.cs @@ -9,9 +9,12 @@ namespace Exiled.API.Features.Pickups.Keycards { using Exiled.API.Features.Items.Keycards; using Exiled.API.Interfaces.Keycards; + using Interactables.Interobjects.DoorUtils; + using InventorySystem.Items.Keycards; using InventorySystem.Items.Pickups; + using UnityEngine; /// diff --git a/EXILED/Exiled.API/Features/Pickups/Keycards/SingleUseKeycardPickup.cs b/EXILED/Exiled.API/Features/Pickups/Keycards/SingleUseKeycardPickup.cs index 8a79b0d405..62037fb344 100644 --- a/EXILED/Exiled.API/Features/Pickups/Keycards/SingleUseKeycardPickup.cs +++ b/EXILED/Exiled.API/Features/Pickups/Keycards/SingleUseKeycardPickup.cs @@ -10,6 +10,7 @@ namespace Exiled.API.Features.Pickups.Keycards using Exiled.API.Enums; using Exiled.API.Features.Items; using Exiled.API.Features.Items.Keycards; + using InventorySystem.Items; using InventorySystem.Items.Keycards; using InventorySystem.Items.Pickups; diff --git a/EXILED/Exiled.API/Features/Pickups/Keycards/Site02KeycardPickup.cs b/EXILED/Exiled.API/Features/Pickups/Keycards/Site02KeycardPickup.cs index 162ec6a721..9417f4c4e2 100644 --- a/EXILED/Exiled.API/Features/Pickups/Keycards/Site02KeycardPickup.cs +++ b/EXILED/Exiled.API/Features/Pickups/Keycards/Site02KeycardPickup.cs @@ -9,9 +9,12 @@ namespace Exiled.API.Features.Pickups.Keycards { using Exiled.API.Features.Items.Keycards; using Exiled.API.Interfaces.Keycards; + using Interactables.Interobjects.DoorUtils; + using InventorySystem.Items.Keycards; using InventorySystem.Items.Pickups; + using UnityEngine; /// diff --git a/EXILED/Exiled.API/Features/Pickups/Keycards/TaskForceKeycardPickup.cs b/EXILED/Exiled.API/Features/Pickups/Keycards/TaskForceKeycardPickup.cs index a6874f57d3..a55c810864 100644 --- a/EXILED/Exiled.API/Features/Pickups/Keycards/TaskForceKeycardPickup.cs +++ b/EXILED/Exiled.API/Features/Pickups/Keycards/TaskForceKeycardPickup.cs @@ -9,9 +9,12 @@ namespace Exiled.API.Features.Pickups.Keycards { using Exiled.API.Features.Items.Keycards; using Exiled.API.Interfaces.Keycards; + using Interactables.Interobjects.DoorUtils; + using InventorySystem.Items.Keycards; using InventorySystem.Items.Pickups; + using UnityEngine; /// diff --git a/EXILED/Exiled.API/Features/Pickups/MicroHIDPickup.cs b/EXILED/Exiled.API/Features/Pickups/MicroHIDPickup.cs index 255c32b6ad..5091387416 100644 --- a/EXILED/Exiled.API/Features/Pickups/MicroHIDPickup.cs +++ b/EXILED/Exiled.API/Features/Pickups/MicroHIDPickup.cs @@ -7,8 +7,8 @@ namespace Exiled.API.Features.Pickups { - using Exiled.API.Features.Items; using Exiled.API.Interfaces; + using InventorySystem.Items.MicroHID.Modules; using BaseMicroHID = InventorySystem.Items.MicroHID.MicroHIDPickup; @@ -149,4 +149,4 @@ public bool TryGetFireController(MicroHidFiringMode firingMode, out T module) /// A string containing MicroHIDPickup related data. public override string ToString() => $"{Type} ({Serial}) [{Weight}] *{Scale}* |{Energy}|"; } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Pickups/Pickup.cs b/EXILED/Exiled.API/Features/Pickups/Pickup.cs index 35dd521333..6c2e41c516 100644 --- a/EXILED/Exiled.API/Features/Pickups/Pickup.cs +++ b/EXILED/Exiled.API/Features/Pickups/Pickup.cs @@ -7,7 +7,6 @@ namespace Exiled.API.Features.Pickups { - using System; using System.Collections.Generic; using System.Linq; @@ -24,7 +23,9 @@ namespace Exiled.API.Features.Pickups using InventorySystem.Items.Usables.Scp244; using Mirror; + using RelativePositioning; + using UnityEngine; using BaseAmmoPickup = InventorySystem.Items.Firearms.Ammo.AmmoPickup; @@ -376,7 +377,7 @@ public static T Get(ItemPickupBase pickupBase) /// /// An of to convert into an of . /// An of containing all existing instances. - public static IEnumerable Get(IEnumerable pickups) => pickups.Select(ipb => Get(ipb)); + public static IEnumerable Get(IEnumerable pickups) => pickups.Select(Get); /// /// Gets an of containing all existing instances given an . @@ -688,4 +689,4 @@ protected virtual void InitializeProperties(ItemBase itemBase) { } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Pickups/Projectiles/EffectGrenadeProjectile.cs b/EXILED/Exiled.API/Features/Pickups/Projectiles/EffectGrenadeProjectile.cs index a4cd84ef93..6508d90160 100644 --- a/EXILED/Exiled.API/Features/Pickups/Projectiles/EffectGrenadeProjectile.cs +++ b/EXILED/Exiled.API/Features/Pickups/Projectiles/EffectGrenadeProjectile.cs @@ -47,4 +47,4 @@ internal EffectGrenadeProjectile(ItemType type) /// A string containing EffectGrenadePickup-related data. public override string ToString() => $"{Type} ({Serial}) [{Weight}] *{Scale}* |{Position}| -{IsLocked}- ={InUse}="; } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Pickups/Projectiles/ExplosionGrenadeProjectile.cs b/EXILED/Exiled.API/Features/Pickups/Projectiles/ExplosionGrenadeProjectile.cs index 07cdbebefb..47809957a9 100644 --- a/EXILED/Exiled.API/Features/Pickups/Projectiles/ExplosionGrenadeProjectile.cs +++ b/EXILED/Exiled.API/Features/Pickups/Projectiles/ExplosionGrenadeProjectile.cs @@ -104,4 +104,4 @@ public float ScpDamageMultiplier /// A string containing ExplosionGrenadePickup-related data. public override string ToString() => $"{Type} ({Serial}) [{Weight}] *{Scale}* |{Position}| -{IsLocked}- ={InUse}="; } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Pickups/Projectiles/FlashbangProjectile.cs b/EXILED/Exiled.API/Features/Pickups/Projectiles/FlashbangProjectile.cs index 8c289c2840..361d5428fa 100644 --- a/EXILED/Exiled.API/Features/Pickups/Projectiles/FlashbangProjectile.cs +++ b/EXILED/Exiled.API/Features/Pickups/Projectiles/FlashbangProjectile.cs @@ -51,9 +51,9 @@ public float MinimalDurationEffect } /// - /// Gets or sets the additional duration of the effect. + /// Gets or sets the additional duration of the effect. /// - public float AdditionalBlindedEffect + public float AdditionalBlurredEffect { get => Base._additionalBlurDuration; set => Base._additionalBlurDuration = value; @@ -74,4 +74,4 @@ public float SurfaceDistanceIntensifier /// A string containing FlashbangPickup-related data. public override string ToString() => $"{Type} ({Serial}) [{Weight}] *{Scale}* |{Position}| -{IsLocked}- ={InUse}="; } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Pickups/Projectiles/Projectile.cs b/EXILED/Exiled.API/Features/Pickups/Projectiles/Projectile.cs index f9d5b4f10d..276353262a 100644 --- a/EXILED/Exiled.API/Features/Pickups/Projectiles/Projectile.cs +++ b/EXILED/Exiled.API/Features/Pickups/Projectiles/Projectile.cs @@ -12,10 +12,12 @@ namespace Exiled.API.Features.Pickups.Projectiles using Exiled.API.Enums; using Exiled.API.Extensions; using Exiled.API.Interfaces; + using InventorySystem; using InventorySystem.Items; using InventorySystem.Items.Pickups; using InventorySystem.Items.ThrowableProjectiles; + using UnityEngine; using Object = UnityEngine.Object; @@ -170,4 +172,4 @@ public Projectile Spawn(Vector3 position, Quaternion? rotation = null, bool shou /// A string containing ProjectilePickup-related data. public override string ToString() => $"{Type} ({Serial}) [{Weight}] *{Scale}* |{Position}| -{IsLocked}- ={InUse}="; } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Pickups/Projectiles/Scp018Projectile.cs b/EXILED/Exiled.API/Features/Pickups/Projectiles/Scp018Projectile.cs index f33d935a97..9e44ea478c 100644 --- a/EXILED/Exiled.API/Features/Pickups/Projectiles/Scp018Projectile.cs +++ b/EXILED/Exiled.API/Features/Pickups/Projectiles/Scp018Projectile.cs @@ -7,10 +7,10 @@ namespace Exiled.API.Features.Pickups.Projectiles { - using System; using System.Reflection; using Exiled.API.Interfaces; + using HarmonyLib; using InventorySystem.Items.ThrowableProjectiles; @@ -105,4 +105,4 @@ public float FriendlyFireTime /// A string containing Scp018Pickup-related data. public override string ToString() => $"{Type} ({Serial}) [{Weight}] *{Scale}* |{Position}| -{Damage}- ={IgnoreFriendlyFire}="; } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Pickups/Projectiles/Scp2176Projectile.cs b/EXILED/Exiled.API/Features/Pickups/Projectiles/Scp2176Projectile.cs index 0c5715a9b9..f1a902828c 100644 --- a/EXILED/Exiled.API/Features/Pickups/Projectiles/Scp2176Projectile.cs +++ b/EXILED/Exiled.API/Features/Pickups/Projectiles/Scp2176Projectile.cs @@ -62,4 +62,4 @@ public bool DropSound /// A string containing Scp2176Pickup related data. public override string ToString() => $"{Type} ({Serial}) [{Weight}] *{Scale}* |{FuseTime}| ={IsAlreadyDetonated}="; } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Pickups/Projectiles/TimeGrenadeProjectile.cs b/EXILED/Exiled.API/Features/Pickups/Projectiles/TimeGrenadeProjectile.cs index cafd9be8cb..5a26e9a2ef 100644 --- a/EXILED/Exiled.API/Features/Pickups/Projectiles/TimeGrenadeProjectile.cs +++ b/EXILED/Exiled.API/Features/Pickups/Projectiles/TimeGrenadeProjectile.cs @@ -92,4 +92,4 @@ public void Explode() /// A string containing TimeGrenadePickup related data. public override string ToString() => $"{Type} ({Serial}) [{Weight}] *{Scale}* |{FuseTime}| ={IsAlreadyDetonated}="; } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Pickups/RadioPickup.cs b/EXILED/Exiled.API/Features/Pickups/RadioPickup.cs index b2eef73401..80bb879b27 100644 --- a/EXILED/Exiled.API/Features/Pickups/RadioPickup.cs +++ b/EXILED/Exiled.API/Features/Pickups/RadioPickup.cs @@ -74,4 +74,4 @@ public bool IsEnabled /// A string containing RadioPickup related data. public override string ToString() => $"{Type} ({Serial}) [{Weight}] *{Scale}* |{BatteryLevel}| -{Range}- /{IsEnabled}/"; } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Pickups/Scp1509Pickup.cs b/EXILED/Exiled.API/Features/Pickups/Scp1509Pickup.cs index 935bc636ca..6ea875e2fe 100644 --- a/EXILED/Exiled.API/Features/Pickups/Scp1509Pickup.cs +++ b/EXILED/Exiled.API/Features/Pickups/Scp1509Pickup.cs @@ -9,6 +9,7 @@ namespace Exiled.API.Features.Pickups { using Exiled.API.Features.Items; using Exiled.API.Interfaces; + using InventorySystem.Items; using InventorySystem.Items.Scp1509; @@ -95,4 +96,4 @@ protected override void InitializeProperties(ItemBase itemBase) } } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Pickups/Scp1576Pickup.cs b/EXILED/Exiled.API/Features/Pickups/Scp1576Pickup.cs index 64ab902dc6..805cf32ebe 100644 --- a/EXILED/Exiled.API/Features/Pickups/Scp1576Pickup.cs +++ b/EXILED/Exiled.API/Features/Pickups/Scp1576Pickup.cs @@ -46,4 +46,4 @@ internal Scp1576Pickup() /// A string containing Scp1576Pickup related data. public override string ToString() => $"{Type} ({Serial}) [{Weight}] *{Scale}*"; } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Pickups/Scp244Pickup.cs b/EXILED/Exiled.API/Features/Pickups/Scp244Pickup.cs index bd11cecc42..0652792e3d 100644 --- a/EXILED/Exiled.API/Features/Pickups/Scp244Pickup.cs +++ b/EXILED/Exiled.API/Features/Pickups/Scp244Pickup.cs @@ -12,7 +12,7 @@ namespace Exiled.API.Features.Pickups using Exiled.API.Features.DamageHandlers; using Exiled.API.Features.Items; using Exiled.API.Interfaces; - using InventorySystem.Items; + using InventorySystem.Items.Usables.Scp244; using UnityEngine; @@ -148,4 +148,4 @@ internal override void ReadItemInfo(Item item) } } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Pickups/Scp330Pickup.cs b/EXILED/Exiled.API/Features/Pickups/Scp330Pickup.cs index a4a971afb7..1ff14d5b15 100644 --- a/EXILED/Exiled.API/Features/Pickups/Scp330Pickup.cs +++ b/EXILED/Exiled.API/Features/Pickups/Scp330Pickup.cs @@ -68,4 +68,4 @@ public List Candies /// A string containing Scp330Pickup related data. public override string ToString() => $"{Type} ({Serial}) [{Weight}] *{Scale}* |{ExposedCandy}| -{Candies}-"; } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Pickups/UsablePickup.cs b/EXILED/Exiled.API/Features/Pickups/UsablePickup.cs index 023469e4fe..511e7ce4ac 100644 --- a/EXILED/Exiled.API/Features/Pickups/UsablePickup.cs +++ b/EXILED/Exiled.API/Features/Pickups/UsablePickup.cs @@ -68,4 +68,4 @@ protected override void InitializeProperties(ItemBase itemBase) } } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Player.cs b/EXILED/Exiled.API/Features/Player.cs index 9df845cbd8..9080dabeba 100644 --- a/EXILED/Exiled.API/Features/Player.cs +++ b/EXILED/Exiled.API/Features/Player.cs @@ -17,10 +17,14 @@ namespace Exiled.API.Features using AudioPooling; using Core; + using CustomPlayerEffects; using CustomPlayerEffects.Danger; + using DamageHandlers; + using Enums; + using Exiled.API.Features.Core.Interfaces; using Exiled.API.Features.CustomStats; using Exiled.API.Features.Doors; @@ -31,11 +35,17 @@ namespace Exiled.API.Features using Exiled.API.Features.Roles; using Exiled.API.Interfaces; using Exiled.API.Structs; + using Extensions; + using Footprinting; + using global::Scp914; + using Hints; + using Interactables.Interobjects; + using InventorySystem; using InventorySystem.Disarming; using InventorySystem.Items; @@ -46,29 +56,38 @@ namespace Exiled.API.Features using InventorySystem.Items.Firearms.ShotEvents; using InventorySystem.Items.Usables; using InventorySystem.Items.Usables.Scp330; + using MapGeneration.Distributors; using MapGeneration.Rooms; + using MEC; + using Mirror; using Mirror.LiteNetLib4Mirror; + using PlayerRoles; using PlayerRoles.FirstPersonControl; - using PlayerRoles.FirstPersonControl.Thirdperson; using PlayerRoles.FirstPersonControl.Thirdperson.Subcontrollers; using PlayerRoles.FirstPersonControl.Thirdperson.Subcontrollers.Wearables; using PlayerRoles.RoleAssign; using PlayerRoles.Spectating; using PlayerRoles.Voice; + using PlayerStatsSystem; + using RelativePositioning; + using RemoteAdmin; + using RoundRestarting; using Unity.Collections.LowLevel.Unsafe; using UnityEngine; + using Utils; using Utils.Networking; + using VoiceChat; using VoiceChat.Playbacks; @@ -104,10 +123,6 @@ public class Player : TypeCastObject, IEntity, IWorldSpace private readonly HashSet componentsInChildren = new(); - private ReferenceHub referenceHub; - - private Role role; - /// /// Initializes a new instance of the class. /// @@ -201,10 +216,10 @@ public Player(GameObject gameObject) /// public ReferenceHub ReferenceHub { - get => referenceHub; + get; private set { - referenceHub = value ?? throw new NullReferenceException("Player's ReferenceHub cannot be null!"); + field = value ?? throw new NullReferenceException("Player's ReferenceHub cannot be null!"); GameObject = value.gameObject; HintDisplay = value.hints; Inventory = value.inventory; @@ -287,7 +302,7 @@ public int Id /// /// Gets the player's user id. /// - public string UserId => referenceHub.authManager.UserId; + public string UserId => ReferenceHub.authManager.UserId; /// /// Gets the player's user id without the authentication. @@ -608,11 +623,11 @@ public PlayerPermissions RemoteAdminPermissions /// public Role Role { - get => role ??= Role.Create(RoleManager.CurrentRole); + get => field ??= Role.Create(RoleManager.CurrentRole); internal set { - PreviousRole = role?.Type ?? RoleTypeId.None; - role = value; + PreviousRole = field?.Type ?? RoleTypeId.None; + field = value; } } @@ -663,7 +678,7 @@ public ScpSpawnPreferences.SpawnPreferences ScpPreferences public bool IsJumping { get => Role is FpcRole fpc && fpc.FirstPersonController.FpcModule.Motor.JumpController.IsJumping; - set => _ = Role is FpcRole fpc ? fpc.FirstPersonController.FpcModule.Motor.JumpController.IsJumping = value : _ = value; + set => (Role as FpcRole)?.FirstPersonController.FpcModule.Motor.JumpController.IsJumping = value; } /// @@ -933,7 +948,7 @@ public bool IsGodModeEnabled public byte UnitId { get => Role.Base is PlayerRoles.HumanRole humanRole ? humanRole.UnitNameId : byte.MinValue; - set => _ = Role.Base is PlayerRoles.HumanRole humanRole ? humanRole.UnitNameId = value : _ = value; + set => (Role.Base as PlayerRoles.HumanRole)?.UnitNameId = value; } /// @@ -992,10 +1007,7 @@ public float ArtificialHealth if (value > MaxArtificialHealth) MaxArtificialHealth = value; - AhpProcess ahp = ActiveArtificialHealthProcesses.FirstOrDefault(); - - if (ahp is not null) - ahp.CurrentAmount = value; + ActiveArtificialHealthProcesses.FirstOrDefault()?.CurrentAmount = value; } } @@ -1012,8 +1024,7 @@ public float MaxArtificialHealth AhpProcess ahp = ActiveArtificialHealthProcesses.FirstOrDefault(); - if (ahp is not null) - ahp.Limit = value; + ahp?.Limit = value; } } @@ -1144,7 +1155,7 @@ public string GroupName /// /// /// - public IEnumerable ActiveEffects => referenceHub.playerEffectsController.AllEffects.Where(effect => effect.Intensity > 0); + public IEnumerable ActiveEffects => ReferenceHub.playerEffectsController.AllEffects.Where(effect => effect.Intensity > 0); /// /// Gets or sets the player's group. @@ -1619,7 +1630,7 @@ public static Player Get(string args) /// Contains the updated arguments after processing. /// Determines whether empty entries should be kept in the result. /// An representing the processed players. - public static IEnumerable GetProcessedData(ArraySegment args, int startIndex, out string[] newargs, bool keepEmptyEntries = false) => RAUtils.ProcessPlayerIdOrNamesList(args, startIndex, out newargs, keepEmptyEntries).Select(hub => Get(hub)); + public static IEnumerable GetProcessedData(ArraySegment args, int startIndex, out string[] newargs, bool keepEmptyEntries = false) => RAUtils.ProcessPlayerIdOrNamesList(args, startIndex, out newargs, keepEmptyEntries).Select(Get); /// /// Gets an containing all players processed based on the arguments specified. @@ -2040,7 +2051,7 @@ public void Handcuff() { ReferenceHub.inventory.SetDisarmedStatus(null); - DisarmedPlayers.Entries.Add(new DisarmedPlayers.DisarmedEntry(referenceHub.networkIdentity.netId, 0U)); + DisarmedPlayers.Entries.Add(new DisarmedPlayers.DisarmedEntry(ReferenceHub.networkIdentity.netId, 0U)); new DisarmedPlayersListMessage(DisarmedPlayers.Entries).SendToAuthenticated(0); } @@ -2261,7 +2272,7 @@ public int RemoveItem(Func predicate, bool destroy = true) /// /// The message to be sent. /// The message color. - public void SendConsoleMessage(string message, string color) => referenceHub.gameConsoleTransmission.SendToClient(message, color); + public void SendConsoleMessage(string message, string color) => ReferenceHub.gameConsoleTransmission.SendToClient(message, color); /// /// Disconnects the player. @@ -2406,7 +2417,17 @@ public void Heal(float amount, bool overrideMaxHealth = false) /// /// The ItemType to be used. /// if item was used successfully. Otherwise, . - public bool UseItem(ItemType usableItem) => UseItem(Item.Create(usableItem)); + public bool UseItem(ItemType usableItem) + { + if (usableItem.GetTemplate() is not UsableItem) + return false; + + Item usable = Item.Create(usableItem); + + UseItem(usable); + usable.Destroy(); + return true; + } /// /// Forces the player to use an item. @@ -2470,7 +2491,8 @@ public void Vaporize(Player attacker = null, string cassieAnnouncement = "") if ((Role.Side != Side.Scp) && !string.IsNullOrEmpty(cassieAnnouncement)) Cassie.Message(cassieAnnouncement); - Kill(new DisruptorDamageHandler(new DisruptorShotEvent(Item.Create(ItemType.ParticleDisruptor, attacker).Base as InventorySystem.Items.Firearms.Firearm, DisruptorActionModule.FiringState.FiringSingle), Vector3.up, -1)); + Footprint footprint = attacker != null ? attacker.Footprint : Server.Host.Footprint; + Kill(new DisruptorDamageHandler(new DisruptorShotEvent(default, footprint, DisruptorActionModule.FiringState.FiringSingle), Vector3.up, -1)); } /// @@ -2682,7 +2704,7 @@ public ushort GetAmmoLimit(AmmoType type, bool ignoreArmor = false) return ServerConfigSynchronizer.Singleton.AmmoLimitsSync.FirstOrDefault(x => x.AmmoType == itemType).Limit; } - return InventorySystem.Configs.InventoryLimits.GetAmmoLimit(type.GetItemType(), referenceHub); + return InventorySystem.Configs.InventoryLimits.GetAmmoLimit(type.GetItemType(), ReferenceHub); } /// @@ -2758,7 +2780,7 @@ public sbyte GetCategoryLimit(ItemCategory category, bool ignoreArmor = false) return ServerConfigSynchronizer.Singleton.CategoryLimits[index]; } - sbyte limit = InventorySystem.Configs.InventoryLimits.GetCategoryLimit(category, referenceHub); + sbyte limit = InventorySystem.Configs.InventoryLimits.GetCategoryLimit(category, ReferenceHub); return limit == -1 ? (sbyte)1 : limit; } @@ -3795,9 +3817,10 @@ public void ChangeEffectIntensity(string effectName, byte intensity, float durat /// Percent of incoming damage absorbed by this stat. /// The number of seconds to delay the start of the decay. /// Whether the process is removed when the value hits 0. - public void AddAhp(float amount, float limit = 75f, float decay = 1.2f, float efficacy = 0.7f, float sustain = 0f, bool persistant = false) + /// The instance.. + public AhpProcess AddAhp(float amount, float limit = 75f, float decay = 1.2f, float efficacy = 0.7f, float sustain = 0f, bool persistant = false) { - ReferenceHub.playerStats.GetModule() + return ReferenceHub.playerStats.GetModule() .ServerAddProcess(amount, limit, decay, efficacy, sustain, persistant); } @@ -4182,8 +4205,7 @@ public void SetCooldownItem(float time, ItemType itemType) /// public override bool Equals(object obj) { - Player player = obj as Player; - return (object)player != null && ReferenceHub == player.ReferenceHub; + return obj is Player player && ReferenceHub == player.ReferenceHub; } /// @@ -4199,7 +4221,7 @@ public override int GetHashCode() /// The second player instance. /// if the values are equal. #pragma warning disable SA1201 - public static bool operator ==(Player player1, Player player2) => player1?.Equals(player2) ?? player2 is null; + public static bool operator ==(Player player1, Player player2) => player1?.Equals(player2) ?? (player2 is null); /// /// Returns whether the two players are different. diff --git a/EXILED/Exiled.API/Features/Plugin.cs b/EXILED/Exiled.API/Features/Plugin.cs index cebeab971f..e2818fb8df 100644 --- a/EXILED/Exiled.API/Features/Plugin.cs +++ b/EXILED/Exiled.API/Features/Plugin.cs @@ -15,9 +15,13 @@ namespace Exiled.API.Features using System.Reflection; using CommandSystem; + using Enums; + using Extensions; + using Interfaces; + using RemoteAdmin; /// @@ -122,9 +126,7 @@ public virtual void OnRegisteringCommands() if (typeof(ParentCommand).IsAssignableFrom(commandHandlerType)) { - ParentCommand parentCommand = GetCommand(commandHandlerType) as ParentCommand; - - if (parentCommand == null) + if (GetCommand(commandHandlerType) is not ParentCommand parentCommand) { if (!toRegister.TryGetValue(commandHandlerType, out List list)) toRegister.Add(commandHandlerType, new() { command }); diff --git a/EXILED/Exiled.API/Features/Pools/DictionaryPool.cs b/EXILED/Exiled.API/Features/Pools/DictionaryPool.cs index 93ebd299d4..a1352d6b8d 100644 --- a/EXILED/Exiled.API/Features/Pools/DictionaryPool.cs +++ b/EXILED/Exiled.API/Features/Pools/DictionaryPool.cs @@ -83,4 +83,4 @@ public KeyValuePair[] ToArrayReturn(Dictionary obj) return array; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Pools/HashSetPool.cs b/EXILED/Exiled.API/Features/Pools/HashSetPool.cs index b8749f5faa..06332c0437 100644 --- a/EXILED/Exiled.API/Features/Pools/HashSetPool.cs +++ b/EXILED/Exiled.API/Features/Pools/HashSetPool.cs @@ -56,4 +56,4 @@ public T[] ToArrayReturn(HashSet obj) return array; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Pools/IPool.cs b/EXILED/Exiled.API/Features/Pools/IPool.cs index 57a2f3da46..edd40fedf4 100644 --- a/EXILED/Exiled.API/Features/Pools/IPool.cs +++ b/EXILED/Exiled.API/Features/Pools/IPool.cs @@ -25,4 +25,4 @@ public interface IPool /// The object to return, of type . public void Return(T obj); } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Pools/ListPool.cs b/EXILED/Exiled.API/Features/Pools/ListPool.cs index f0508f7834..dda0918930 100644 --- a/EXILED/Exiled.API/Features/Pools/ListPool.cs +++ b/EXILED/Exiled.API/Features/Pools/ListPool.cs @@ -62,4 +62,4 @@ public T[] ToArrayReturn(List obj) return array; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Pools/QueuePool.cs b/EXILED/Exiled.API/Features/Pools/QueuePool.cs index 04b5f3df50..7b3e093a9f 100644 --- a/EXILED/Exiled.API/Features/Pools/QueuePool.cs +++ b/EXILED/Exiled.API/Features/Pools/QueuePool.cs @@ -77,4 +77,4 @@ public T[] ToArrayReturn(Queue obj) return array; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Pools/StringBuilderPool.cs b/EXILED/Exiled.API/Features/Pools/StringBuilderPool.cs index 16d84cc697..edf576e663 100644 --- a/EXILED/Exiled.API/Features/Pools/StringBuilderPool.cs +++ b/EXILED/Exiled.API/Features/Pools/StringBuilderPool.cs @@ -52,4 +52,4 @@ public string ToStringReturn(StringBuilder obj) return s; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/PrefabHelper.cs b/EXILED/Exiled.API/Features/PrefabHelper.cs index e5c3bf1c71..e89fd36cee 100644 --- a/EXILED/Exiled.API/Features/PrefabHelper.cs +++ b/EXILED/Exiled.API/Features/PrefabHelper.cs @@ -14,9 +14,12 @@ namespace Exiled.API.Features using Exiled.API.Enums; using Exiled.API.Features.Attributes; + using MapGeneration.Distributors; using MapGeneration.RoomConnectors; + using Mirror; + using UnityEngine; /// @@ -32,7 +35,7 @@ public static class PrefabHelper /// /// Gets a of and their corresponding . /// - public static IReadOnlyDictionary PrefabToGameObjectAndComponent => Prefabs; + public static IReadOnlyDictionary PrefabToGameObjectAndComponent => Prefabs; /// /// Gets a of and their corresponding . @@ -123,7 +126,7 @@ public static GameObject Spawn(PrefabType prefabType, Vector3 position = default PrefabType.HCZTwoSided => 0b00000000, PrefabType.HCZOneSided => 0b00000001, PrefabType.HCZBreakableDoor => 0b00000011, - _ => 0 + _ => 0, }; } #pragma warning restore CS0618 // Type or member is obsolete diff --git a/EXILED/Exiled.API/Features/Ragdoll.cs b/EXILED/Exiled.API/Features/Ragdoll.cs index 9bd58e8f70..fdfb042df5 100644 --- a/EXILED/Exiled.API/Features/Ragdoll.cs +++ b/EXILED/Exiled.API/Features/Ragdoll.cs @@ -12,15 +12,22 @@ namespace Exiled.API.Features using System.Linq; using DeathAnimations; + using Enums; + using Exiled.API.Extensions; using Exiled.API.Interfaces; + using Mirror; + using PlayerRoles; using PlayerRoles.PlayableScps.Scp049.Zombies; using PlayerRoles.Ragdolls; + using PlayerStatsSystem; + using RelativePositioning; + using UnityEngine; using BaseScp3114Ragdoll = PlayerRoles.PlayableScps.Scp3114.Scp3114Ragdoll; @@ -483,4 +490,4 @@ public void Spawn(NetworkConnection ownerConnection, uint? assetId = null) /// A string containing Ragdoll-related data. public override string ToString() => $"{Owner} ({Name}) [{DeathReason}] *{Role}* |{CreationTime}| ={IsExpired}="; } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Recontainer.cs b/EXILED/Exiled.API/Features/Recontainer.cs index dbc31a35bf..4b17861038 100644 --- a/EXILED/Exiled.API/Features/Recontainer.cs +++ b/EXILED/Exiled.API/Features/Recontainer.cs @@ -12,8 +12,11 @@ namespace Exiled.API.Features using System.Linq; using Enums; + using Exiled.API.Features.Doors; + using PlayerRoles.PlayableScps.Scp079; + using UnityEngine; /// @@ -187,7 +190,9 @@ public static bool IsContainmentSequenceSuccessful /// /// The announcement to play. /// The glitchy multiplier. +#pragma warning disable IDE0060 // TODO: glitchyMultiplier is not used public static void PlayAnnouncement(string announcement, float glitchyMultiplier) => Base.PlayAnnouncement(announcement, false, false, null); +#pragma warning restore IDE0060 /// /// Begins the overcharge procedure. diff --git a/EXILED/Exiled.API/Features/Respawn.cs b/EXILED/Exiled.API/Features/Respawn.cs index f347438564..aeebe336f6 100644 --- a/EXILED/Exiled.API/Features/Respawn.cs +++ b/EXILED/Exiled.API/Features/Respawn.cs @@ -12,12 +12,17 @@ namespace Exiled.API.Features using System.Linq; using CustomPlayerEffects; + using Enums; + using Extensions; + using PlayerRoles; + using Respawning; using Respawning.Waves; using Respawning.Waves.Generic; + using UnityEngine; /// @@ -25,9 +30,6 @@ namespace Exiled.API.Features /// public static class Respawn { - private static GameObject ntfHelicopterGameObject; - private static GameObject chaosCarGameObject; - /// /// Gets the of paused 's. /// @@ -46,10 +48,10 @@ public static GameObject NtfHelicopter { get { - if (ntfHelicopterGameObject == null) - ntfHelicopterGameObject = GameObject.Find("Chopper"); + if (field == null) + field = GameObject.Find("Chopper"); - return ntfHelicopterGameObject; + return field; } } @@ -60,10 +62,10 @@ public static GameObject ChaosVan { get { - if (chaosCarGameObject == null) - chaosCarGameObject = GameObject.Find("CIVanArrive"); + if (field == null) + field = GameObject.Find("CIVanArrive"); - return chaosCarGameObject; + return field; } } diff --git a/EXILED/Exiled.API/Features/Roles/DestroyedRole.cs b/EXILED/Exiled.API/Features/Roles/DestroyedRole.cs index 42e6cfe349..230a127c4c 100644 --- a/EXILED/Exiled.API/Features/Roles/DestroyedRole.cs +++ b/EXILED/Exiled.API/Features/Roles/DestroyedRole.cs @@ -7,14 +7,7 @@ namespace Exiled.API.Features.Roles { - using System; - using System.Collections.Generic; - using System.Linq; - using System.Text; - using System.Threading.Tasks; - using PlayerRoles; - using PlayerRoles.Voice; /// /// Defines a role that represents players with destroyed role. @@ -33,4 +26,4 @@ internal DestroyedRole(PlayerRoleBase baseRole) /// public override RoleTypeId Type { get; } = RoleTypeId.Destroyed; } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Roles/FilmMakerRole.cs b/EXILED/Exiled.API/Features/Roles/FilmMakerRole.cs index 632abc33aa..a245812f32 100644 --- a/EXILED/Exiled.API/Features/Roles/FilmMakerRole.cs +++ b/EXILED/Exiled.API/Features/Roles/FilmMakerRole.cs @@ -8,6 +8,7 @@ namespace Exiled.API.Features.Roles { using PlayerRoles; + using UnityEngine; using FilmmakerGameRole = PlayerRoles.Filmmaker.FilmmakerRole; diff --git a/EXILED/Exiled.API/Features/Roles/FpcRole.cs b/EXILED/Exiled.API/Features/Roles/FpcRole.cs index 9a1156833e..17294f5236 100644 --- a/EXILED/Exiled.API/Features/Roles/FpcRole.cs +++ b/EXILED/Exiled.API/Features/Roles/FpcRole.cs @@ -11,6 +11,7 @@ namespace Exiled.API.Features.Roles using System.Collections.Generic; using Exiled.API.Features.Pools; + using PlayerRoles; using PlayerRoles.FirstPersonControl; using PlayerRoles.FirstPersonControl.Thirdperson; @@ -18,8 +19,11 @@ namespace Exiled.API.Features.Roles using PlayerRoles.Spectating; using PlayerRoles.Visibility; using PlayerRoles.Voice; + using PlayerStatsSystem; + using RelativePositioning; + using UnityEngine; /// @@ -27,8 +31,6 @@ namespace Exiled.API.Features.Roles /// public abstract class FpcRole : Role, IVoiceRole { - private bool isUsingStamina = true; - /// /// Initializes a new instance of the class. /// @@ -37,6 +39,7 @@ protected FpcRole(FpcStandardRoleBase baseRole) : base(baseRole) { FirstPersonController = baseRole; + IsUsingStamina = true; } /// @@ -190,12 +193,12 @@ public bool MovementDetected /// public bool IsUsingStamina { - get => isUsingStamina; + get; set { if (!value) Owner.ResetStamina(); - isUsingStamina = value; + field = value; } } @@ -349,4 +352,4 @@ public void Jump(float? jumpStrength = null) FirstPersonController.FpcModule.Motor.JumpController.ForceJump(strength); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Roles/HumanRole.cs b/EXILED/Exiled.API/Features/Roles/HumanRole.cs index 767a010d45..307376b44b 100644 --- a/EXILED/Exiled.API/Features/Roles/HumanRole.cs +++ b/EXILED/Exiled.API/Features/Roles/HumanRole.cs @@ -9,7 +9,7 @@ namespace Exiled.API.Features.Roles { using PlayerRoles; using PlayerRoles.PlayableScps.HumeShield; - using Respawning; + using Respawning.NamingRules; using HumanGameRole = PlayerRoles.HumanRole; diff --git a/EXILED/Exiled.API/Features/Roles/IHumeShieldRole.cs b/EXILED/Exiled.API/Features/Roles/IHumeShieldRole.cs index e0921af831..741d274e0d 100644 --- a/EXILED/Exiled.API/Features/Roles/IHumeShieldRole.cs +++ b/EXILED/Exiled.API/Features/Roles/IHumeShieldRole.cs @@ -19,4 +19,4 @@ public interface IHumeShieldRole /// HumeShieldModuleBase HumeShieldModule { get; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Roles/NoneRole.cs b/EXILED/Exiled.API/Features/Roles/NoneRole.cs index ed52752a5a..fe7aeb774f 100644 --- a/EXILED/Exiled.API/Features/Roles/NoneRole.cs +++ b/EXILED/Exiled.API/Features/Roles/NoneRole.cs @@ -30,6 +30,6 @@ internal NoneRole(PlayerRoleBase baseRole) public override RoleTypeId Type { get; } = RoleTypeId.None; /// - public VoiceModuleBase VoiceModule => (Base as NoneGameRole) !.VoiceModule; + public VoiceModuleBase VoiceModule => (Base as NoneGameRole).VoiceModule; } } \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Roles/OverwatchRole.cs b/EXILED/Exiled.API/Features/Roles/OverwatchRole.cs index 92ce09fa3f..d8f94198a9 100644 --- a/EXILED/Exiled.API/Features/Roles/OverwatchRole.cs +++ b/EXILED/Exiled.API/Features/Roles/OverwatchRole.cs @@ -40,4 +40,4 @@ internal OverwatchRole(OverwatchGameRole baseRole) /// The overwatch RoleType. public RoleTypeId GetObfuscatedRole() => Base.GetRoleForUser(Owner.ReferenceHub); } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Roles/Role.cs b/EXILED/Exiled.API/Features/Roles/Role.cs index 31f53ac040..f6745bcb12 100644 --- a/EXILED/Exiled.API/Features/Roles/Role.cs +++ b/EXILED/Exiled.API/Features/Roles/Role.cs @@ -10,12 +10,16 @@ namespace Exiled.API.Features.Roles using System; using Enums; + using Exiled.API.Features.Core; using Exiled.API.Features.Spawn; using Exiled.API.Interfaces; + using Extensions; + using PlayerRoles; using PlayerRoles.PlayableScps.Scp049.Zombies; + using UnityEngine; using DestroyedGameRole = PlayerRoles.DestroyedRole; @@ -138,7 +142,7 @@ protected Role(PlayerRoleBase baseRole) /// The role. /// The other role. /// if the values are equal. - public static bool operator ==(Role left, Role right) => left?.Equals(right) ?? right is null; + public static bool operator ==(Role left, Role right) => left?.Equals(right) ?? (right is null); /// /// Returns whether the two roles are different. @@ -242,4 +246,4 @@ public virtual void Set(RoleTypeId newRole, SpawnReason reason, RoleSpawnFlags s _ => throw new Exception($"Missing role found in Exiled.API.Features.Roles.Role::Create ({role?.RoleTypeId}). Please contact an Exiled developer."), }; } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Roles/Scp049Role.cs b/EXILED/Exiled.API/Features/Roles/Scp049Role.cs index 6283226eb4..05b163d390 100644 --- a/EXILED/Exiled.API/Features/Roles/Scp049Role.cs +++ b/EXILED/Exiled.API/Features/Roles/Scp049Role.cs @@ -11,13 +11,16 @@ namespace Exiled.API.Features.Roles using System.Linq; using CustomPlayerEffects; + using PlayerRoles; using PlayerRoles.PlayableScps; using PlayerRoles.PlayableScps.HumeShield; using PlayerRoles.PlayableScps.Scp049; using PlayerRoles.Ragdolls; using PlayerRoles.Subroutines; + using PlayerStatsSystem; + using UnityEngine; using Scp049GameRole = PlayerRoles.PlayableScps.Scp049.Scp049Role; @@ -116,7 +119,7 @@ internal Scp049Role(Scp049GameRole baseRole) /// /// Gets all the dead zombies. /// - public IEnumerable DeadZombies => Scp049ResurrectAbility.DeadZombies.Select(x => Player.Get(x)); + public IEnumerable DeadZombies => Scp049ResurrectAbility.DeadZombies.Select(Player.Get); /// /// Gets all the resurrected players. @@ -362,4 +365,4 @@ public void Sense(Player player) /// The Spawn Chance. public float GetSpawnChance(List alreadySpawned) => Base.GetSpawnChance(alreadySpawned); } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Roles/Scp079Role.cs b/EXILED/Exiled.API/Features/Roles/Scp079Role.cs index 9d7e308659..37202c1cdb 100644 --- a/EXILED/Exiled.API/Features/Roles/Scp079Role.cs +++ b/EXILED/Exiled.API/Features/Roles/Scp079Role.cs @@ -12,9 +12,13 @@ namespace Exiled.API.Features.Roles using Exiled.API.Enums; using Exiled.API.Features.Doors; + using Interactables.Interobjects.DoorUtils; + using MapGeneration; + using Mirror; + using PlayerRoles; using PlayerRoles.PlayableScps; using PlayerRoles.PlayableScps.Scp079; @@ -23,7 +27,9 @@ namespace Exiled.API.Features.Roles using PlayerRoles.PlayableScps.Scp079.Rewards; using PlayerRoles.Subroutines; using PlayerRoles.Voice; + using RelativePositioning; + using Utils.NonAllocLINQ; using Mathf = UnityEngine.Mathf; @@ -621,4 +627,4 @@ public void ActivateTesla(bool consumeEnergy = true) /// The Spawn Chance. public float GetSpawnChance(List alreadySpawned) => Base.GetSpawnChance(alreadySpawned); } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Roles/Scp096Role.cs b/EXILED/Exiled.API/Features/Roles/Scp096Role.cs index 6e78b6c662..7dba16ecd4 100644 --- a/EXILED/Exiled.API/Features/Roles/Scp096Role.cs +++ b/EXILED/Exiled.API/Features/Roles/Scp096Role.cs @@ -322,4 +322,4 @@ public void Charge(float cooldown = 1f) /// The Spawn Chance. public float GetSpawnChance(List alreadySpawned) => Base.GetSpawnChance(alreadySpawned); } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Roles/Scp106Role.cs b/EXILED/Exiled.API/Features/Roles/Scp106Role.cs index 8c5fda149a..fa94fe883e 100644 --- a/EXILED/Exiled.API/Features/Roles/Scp106Role.cs +++ b/EXILED/Exiled.API/Features/Roles/Scp106Role.cs @@ -10,11 +10,13 @@ namespace Exiled.API.Features.Roles using System.Collections.Generic; using Exiled.API.Enums; + using PlayerRoles; using PlayerRoles.PlayableScps; using PlayerRoles.PlayableScps.HumeShield; using PlayerRoles.PlayableScps.Scp106; using PlayerRoles.Subroutines; + using PlayerStatsSystem; using UnityEngine; diff --git a/EXILED/Exiled.API/Features/Roles/Scp1507Role.cs b/EXILED/Exiled.API/Features/Roles/Scp1507Role.cs index a4c9ba78cf..cb1bce9f4f 100644 --- a/EXILED/Exiled.API/Features/Roles/Scp1507Role.cs +++ b/EXILED/Exiled.API/Features/Roles/Scp1507Role.cs @@ -66,4 +66,4 @@ internal Scp1507Role(Scp1507GameRole baseRole) /// The Spawn Chance. public float GetSpawnChance(List alreadySpawned) => Base is ISpawnableScp spawnableScp ? spawnableScp.GetSpawnChance(alreadySpawned) : 0; } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Roles/Scp173Role.cs b/EXILED/Exiled.API/Features/Roles/Scp173Role.cs index f7f603eece..30928530d0 100644 --- a/EXILED/Exiled.API/Features/Roles/Scp173Role.cs +++ b/EXILED/Exiled.API/Features/Roles/Scp173Role.cs @@ -11,12 +11,15 @@ namespace Exiled.API.Features.Roles using System.Linq; using Exiled.API.Features.Hazards; + using Mirror; + using PlayerRoles; using PlayerRoles.PlayableScps; using PlayerRoles.PlayableScps.HumeShield; using PlayerRoles.PlayableScps.Scp173; using PlayerRoles.Subroutines; + using UnityEngine; using Scp173GameRole = PlayerRoles.PlayableScps.Scp173.Scp173Role; @@ -162,7 +165,7 @@ public float RemainingTantrumCooldown /// /// Gets a of players that are currently viewing SCP-173. Can be empty. /// - public IEnumerable ObservingPlayers => ObserversTracker.Observers.Select(x => Player.Get(x)); + public IEnumerable ObservingPlayers => ObserversTracker.Observers.Select(Player.Get); /// /// Gets SCP-173's max move speed. diff --git a/EXILED/Exiled.API/Features/Roles/Scp3114Role.cs b/EXILED/Exiled.API/Features/Roles/Scp3114Role.cs index 35a3aa032a..4d685518cd 100644 --- a/EXILED/Exiled.API/Features/Roles/Scp3114Role.cs +++ b/EXILED/Exiled.API/Features/Roles/Scp3114Role.cs @@ -10,6 +10,7 @@ namespace Exiled.API.Features.Roles using System.Collections.Generic; using Exiled.API.Enums; + using PlayerRoles; using PlayerRoles.PlayableScps; using PlayerRoles.PlayableScps.HumeShield; diff --git a/EXILED/Exiled.API/Features/Roles/Scp939Role.cs b/EXILED/Exiled.API/Features/Roles/Scp939Role.cs index 222a57670d..5ff399080a 100644 --- a/EXILED/Exiled.API/Features/Roles/Scp939Role.cs +++ b/EXILED/Exiled.API/Features/Roles/Scp939Role.cs @@ -10,7 +10,6 @@ namespace Exiled.API.Features.Roles using System.Collections.Generic; using Exiled.API.Enums; - using Exiled.API.Features.Pools; using PlayerRoles; using PlayerRoles.PlayableScps; @@ -85,11 +84,6 @@ internal Scp939Role(Scp939GameRole baseRole) MimicPointController = EnvironmentalMimicry._mimicPoint; } - /// - /// Finalizes an instance of the class. - /// - ~Scp939Role() => ListPool.Pool.Return(VisiblePlayers); - /// public override RoleTypeId Type { get; } = RoleTypeId.Scp939; @@ -236,11 +230,6 @@ public float MimicryCooldown /// public Vector3? MimicryPointPosition => MimicPointController.Active ? MimicPointController.MimicPointTransform.position : null; - /// - /// Gets a list of players this SCP-939 instance can see regardless of their movement. - /// - public List VisiblePlayers { get; } = ListPool.Pool.Get(); - /// /// Gets the instance. /// @@ -329,4 +318,4 @@ public void DestroyCurrentMimicPoint() /// The Spawn Chance. public float GetSpawnChance(List alreadySpawned) => Base.GetSpawnChance(alreadySpawned); } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Roles/SpectatorRole.cs b/EXILED/Exiled.API/Features/Roles/SpectatorRole.cs index d7fbcc7920..1ae9c59cab 100644 --- a/EXILED/Exiled.API/Features/Roles/SpectatorRole.cs +++ b/EXILED/Exiled.API/Features/Roles/SpectatorRole.cs @@ -11,6 +11,7 @@ namespace Exiled.API.Features.Roles using PlayerRoles; using PlayerRoles.Voice; + using UnityEngine; using SpectatorGameRole = PlayerRoles.Spectating.SpectatorRole; @@ -74,4 +75,4 @@ public Player SpectatedPlayer /// public VoiceModuleBase VoiceModule => Base.VoiceModule; } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Room.cs b/EXILED/Exiled.API/Features/Room.cs index 45a86e7580..bee30fa96c 100644 --- a/EXILED/Exiled.API/Features/Room.cs +++ b/EXILED/Exiled.API/Features/Room.cs @@ -12,18 +12,26 @@ namespace Exiled.API.Features using System.Linq; using Enums; + using Exiled.API.Extensions; using Exiled.API.Features.Doors; using Exiled.API.Features.Pickups; using Exiled.API.Interfaces; + using MapGeneration; using MapGeneration.Holidays; using MapGeneration.Rooms; + using MEC; + using Mirror; + using PlayerRoles.PlayableScps.Scp079; + using RelativePositioning; + using UnityEngine; + using Utils.NonAllocLINQ; /// @@ -500,7 +508,7 @@ private static RoomType FindType(GameObject gameObject) "HCZ_Corner_Deep" => RoomType.HczCornerDeep, "HCZ_Straight" => RoomType.HczStraight, "HCZ_Straight_C" => RoomType.HczStraightC, - "HCZ_Straight_PipeRoom"=> RoomType.HczStraightPipeRoom, + "HCZ_Straight_PipeRoom" => RoomType.HczStraightPipeRoom, "HCZ_Straight Variant" => RoomType.HczStraightVariant, "HCZ_ChkpA" => RoomType.HczElevatorA, "HCZ_ChkpB" => RoomType.HczElevatorB, @@ -533,7 +541,7 @@ private static RoomType FindType(GameObject gameObject) "HCZ_EZ_Checkpoint Part" => gameObject.transform.position.z switch { > 95 => RoomType.HczEzCheckpointA, - _ => RoomType.HczEzCheckpointB + _ => RoomType.HczEzCheckpointB, }, _ => RoomType.Unknown, }; @@ -546,4 +554,4 @@ private static string TryRemovePostfixes(string str) return str; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Round.cs b/EXILED/Exiled.API/Features/Round.cs index 38bb4407ed..1ee9b16407 100644 --- a/EXILED/Exiled.API/Features/Round.cs +++ b/EXILED/Exiled.API/Features/Round.cs @@ -26,7 +26,7 @@ public static class Round /// /// Gets a list of players who will be ignored from determining round end. /// - public static HashSet IgnoredPlayers { get; } = new(20); // TODO: Replace ReferenceHub to Player remind to change RoundEnd transpiler + public static HashSet IgnoredPlayers { get; } = new(20); /// /// Gets the time elapsed from the start of the round. @@ -259,4 +259,4 @@ public static bool EndRound(bool forceEnd = false) /// public static void Start() => CharacterClassManager.ForceRoundStart(); } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Scp3114Ragdoll.cs b/EXILED/Exiled.API/Features/Scp3114Ragdoll.cs index e8bb6a3f02..de6006d8f8 100644 --- a/EXILED/Exiled.API/Features/Scp3114Ragdoll.cs +++ b/EXILED/Exiled.API/Features/Scp3114Ragdoll.cs @@ -8,6 +8,7 @@ namespace Exiled.API.Features { using Exiled.API.Interfaces; + using PlayerRoles; using BaseScp3114Ragdoll = PlayerRoles.PlayableScps.Scp3114.Scp3114Ragdoll; @@ -75,4 +76,4 @@ public bool IsPlayingAnimation set => Base._playingAnimation = value; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Scp559.cs b/EXILED/Exiled.API/Features/Scp559.cs index e742c1a09c..4cfc434eda 100644 --- a/EXILED/Exiled.API/Features/Scp559.cs +++ b/EXILED/Exiled.API/Features/Scp559.cs @@ -12,7 +12,9 @@ namespace Exiled.API.Features using System.Linq; using Exiled.API.Interfaces; + using MapGeneration; + using UnityEngine; /// diff --git a/EXILED/Exiled.API/Features/Scp914.cs b/EXILED/Exiled.API/Features/Scp914.cs index 7d9ea65818..3088d8849c 100644 --- a/EXILED/Exiled.API/Features/Scp914.cs +++ b/EXILED/Exiled.API/Features/Scp914.cs @@ -13,7 +13,9 @@ namespace Exiled.API.Features using Exiled.API.Features.Doors; using Exiled.API.Features.Pickups; using Exiled.API.Features.Pools; + using global::Scp914; + using UnityEngine; /// @@ -141,4 +143,4 @@ public static IEnumerable Scp914InputObject(out IEnumerable /// Interact code. public static void Start(Player player = null, Scp914InteractCode code = Scp914InteractCode.Activate) => Scp914Controller.ServerInteract((player ?? Server.Host).ReferenceHub, (byte)code); } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Scp956.cs b/EXILED/Exiled.API/Features/Scp956.cs index 49c90a5b36..cdcc2b75ee 100644 --- a/EXILED/Exiled.API/Features/Scp956.cs +++ b/EXILED/Exiled.API/Features/Scp956.cs @@ -12,6 +12,7 @@ namespace Exiled.API.Features using Exiled.API.Enums; using Exiled.API.Extensions; + using UnityEngine; /// diff --git a/EXILED/Exiled.API/Features/Server.cs b/EXILED/Exiled.API/Features/Server.cs index 825cfb3566..fd90b8d14c 100644 --- a/EXILED/Exiled.API/Features/Server.cs +++ b/EXILED/Exiled.API/Features/Server.cs @@ -11,8 +11,6 @@ namespace Exiled.API.Features using System.Collections.Generic; using System.Reflection; - using Exiled.API.Enums; - using GameCore; using Interfaces; @@ -32,8 +30,6 @@ namespace Exiled.API.Features /// public static class Server { - private static MethodInfo sendSpawnMessage; - /// /// Gets a dictionary that pairs assemblies with their associated plugins. /// @@ -53,7 +49,7 @@ public static class Server /// /// Gets the cached . /// - public static MethodInfo SendSpawnMessage => sendSpawnMessage ??= typeof(NetworkServer).GetMethod("SendSpawnMessage", BindingFlags.NonPublic | BindingFlags.Static); + public static MethodInfo SendSpawnMessage => field ??= typeof(NetworkServer).GetMethod("SendSpawnMessage", BindingFlags.NonPublic | BindingFlags.Static); /// /// Gets or sets the name of the server. diff --git a/EXILED/Exiled.API/Features/Spawn/LockerSpawnPoint.cs b/EXILED/Exiled.API/Features/Spawn/LockerSpawnPoint.cs index 405a285098..63f85fa6a4 100644 --- a/EXILED/Exiled.API/Features/Spawn/LockerSpawnPoint.cs +++ b/EXILED/Exiled.API/Features/Spawn/LockerSpawnPoint.cs @@ -12,7 +12,9 @@ namespace Exiled.API.Features.Spawn using Exiled.API.Enums; using Exiled.API.Extensions; using Exiled.API.Features.Lockers; + using UnityEngine; + using YamlDotNet.Serialization; /// @@ -78,4 +80,4 @@ public void GetSpawningInfo(out Locker locker, out Chamber chamber, out Vector3 position = chamber?.GetRandomSpawnPoint() ?? (Offset == Vector3.zero ? locker.Position : locker.Transform.TransformPoint(Offset)); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Spawn/RoomSpawnPoint.cs b/EXILED/Exiled.API/Features/Spawn/RoomSpawnPoint.cs index 97041a2c92..dc219b40a6 100644 --- a/EXILED/Exiled.API/Features/Spawn/RoomSpawnPoint.cs +++ b/EXILED/Exiled.API/Features/Spawn/RoomSpawnPoint.cs @@ -56,4 +56,4 @@ public override Vector3 Position set => throw new InvalidOperationException("The position of this type of SpawnPoint cannot be changed."); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Spawn/SpawnLocation.cs b/EXILED/Exiled.API/Features/Spawn/SpawnLocation.cs index 975d5bc77e..a1426f2fa6 100644 --- a/EXILED/Exiled.API/Features/Spawn/SpawnLocation.cs +++ b/EXILED/Exiled.API/Features/Spawn/SpawnLocation.cs @@ -8,6 +8,7 @@ namespace Exiled.API.Features.Spawn { using Exiled.API.Interfaces; + using PlayerRoles; using UnityEngine; @@ -45,4 +46,4 @@ public SpawnLocation(RoleTypeId roleType, Vector3 position, float horizontalRota /// public float HorizontalRotation { get; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Spawn/SpawnPoint.cs b/EXILED/Exiled.API/Features/Spawn/SpawnPoint.cs index 880ea9e35a..66ccfb4f22 100644 --- a/EXILED/Exiled.API/Features/Spawn/SpawnPoint.cs +++ b/EXILED/Exiled.API/Features/Spawn/SpawnPoint.cs @@ -8,6 +8,7 @@ namespace Exiled.API.Features.Spawn { using Exiled.API.Interfaces; + using UnityEngine; /// diff --git a/EXILED/Exiled.API/Features/TeslaGate.cs b/EXILED/Exiled.API/Features/TeslaGate.cs index ddc04ac791..dd9893e929 100644 --- a/EXILED/Exiled.API/Features/TeslaGate.cs +++ b/EXILED/Exiled.API/Features/TeslaGate.cs @@ -12,9 +12,13 @@ namespace Exiled.API.Features using System.Linq; using Exiled.API.Interfaces; + using Hazards; + using MEC; + using PlayerRoles; + using UnityEngine; using BaseTeslaGate = global::TeslaGate; @@ -178,7 +182,7 @@ public bool UseInstantBurst /// /// Gets a of which contains all the tantrums to destroy. /// - public IEnumerable TantrumsToDestroy => Base.TantrumsToBeDestroyed.Select(x => Hazard.Get(x)); + public IEnumerable TantrumsToDestroy => Base.TantrumsToBeDestroyed.Select(Hazard.Get); /// /// Gets a of which contains all the players inside the hurt range. @@ -293,4 +297,4 @@ public bool CanBeIdle(Player player) => player is not null && player.IsAlive && public bool CanBeTriggered(Player player) => player is not null && player.IsAlive && !IgnoredPlayers.Contains(player) && !IgnoredRoles.Contains(player.Role) && !IgnoredTeams.Contains(player.Role.Team) && IsPlayerInTriggerRange(player); } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Toys/AdminToy.cs b/EXILED/Exiled.API/Features/Toys/AdminToy.cs index c93cee110e..9c58b1df82 100644 --- a/EXILED/Exiled.API/Features/Toys/AdminToy.cs +++ b/EXILED/Exiled.API/Features/Toys/AdminToy.cs @@ -12,8 +12,11 @@ namespace Exiled.API.Features.Toys using AdminToys; using Enums; + using Exiled.API.Interfaces; + using Footprinting; + using Mirror; using UnityEngine; @@ -79,11 +82,11 @@ public Footprint Footprint /// public Vector3 Position { - get => AdminToyBase.transform.position; + get => Transform.position; set { - AdminToyBase.transform.position = value; - AdminToyBase.NetworkPosition = value; + Transform.position = value; + AdminToyBase.NetworkPosition = Transform.localPosition; } } @@ -92,23 +95,49 @@ public Vector3 Position /// public Quaternion Rotation { - get => AdminToyBase.transform.rotation; + get => Transform.rotation; + set + { + Transform.rotation = value; + AdminToyBase.NetworkRotation = Transform.localRotation; + } + } + + /// + /// Gets or sets the local position of the toy relative to its parent. + /// + public Vector3 LocalPosition + { + get => Transform.localPosition; + set + { + Transform.localPosition = value; + AdminToyBase.NetworkPosition = value; + } + } + + /// + /// Gets or sets the local rotation of the toy relative to its parent. + /// + public Quaternion LocalRotation + { + get => Transform.localRotation; set { - AdminToyBase.transform.rotation = value; + Transform.localRotation = value; AdminToyBase.NetworkRotation = value; } } /// - /// Gets or sets the scale of the toy. + /// Gets or sets the local scale of the toy. /// public Vector3 Scale { - get => AdminToyBase.transform.localScale; + get => Transform.localScale; set { - AdminToyBase.transform.localScale = value; + Transform.localScale = value; AdminToyBase.NetworkScale = value; } } @@ -132,7 +161,7 @@ public Vector3 Scale /// public byte MovementSmoothing { - get => AdminToyBase.MovementSmoothing; + get => AdminToyBase.NetworkMovementSmoothing; set => AdminToyBase.NetworkMovementSmoothing = value; } @@ -141,7 +170,7 @@ public byte MovementSmoothing /// public bool IsStatic { - get => AdminToyBase.IsStatic; + get => AdminToyBase.NetworkIsStatic; set => AdminToyBase.NetworkIsStatic = value; } diff --git a/EXILED/Exiled.API/Features/Toys/CameraToy.cs b/EXILED/Exiled.API/Features/Toys/CameraToy.cs index 54a7128e63..f71e460d9a 100644 --- a/EXILED/Exiled.API/Features/Toys/CameraToy.cs +++ b/EXILED/Exiled.API/Features/Toys/CameraToy.cs @@ -124,10 +124,10 @@ public string Name /// Creates a new . /// /// The transform to create this on. - /// The of the camera. /// The local position of the camera. /// The local rotation of the camera. /// The local scale of the camera. + /// The of the camera. /// The name (label) of the camera. /// The room associated with this camera. /// The vertical limits. Leave null to use prefab default. @@ -135,7 +135,7 @@ public string Name /// The zoom limits. Leave null to use prefab default. /// Whether the camera should be initially spawned. /// The new . - public static CameraToy Create(Transform parent = null, CameraType type = CameraType.EzArmCameraToy, Vector3? position = null, Quaternion? rotation = null, Vector3? scale = null, string name = "New Camera", Room room = null, Vector2? verticalConstraint = null, Vector2? horizontalConstraint = null, Vector2? zoomConstraint = null, bool spawn = true) + public static CameraToy Create(Transform parent = null, Vector3? position = null, Quaternion? rotation = null, Vector3? scale = null, CameraType type = CameraType.EzArmCameraToy, string name = "New Camera", Room room = null, Vector2? verticalConstraint = null, Vector2? horizontalConstraint = null, Vector2? zoomConstraint = null, bool spawn = true) { Scp079CameraToy prefab = type switch { @@ -156,12 +156,11 @@ public static CameraToy Create(Transform parent = null, CameraType type = Camera CameraToy toy = new(Object.Instantiate(prefab, parent)) { Name = name, + LocalPosition = position ?? Vector3.zero, + LocalRotation = rotation ?? Quaternion.identity, + Scale = scale ?? Vector3.one, }; - toy.Transform.localPosition = position ?? Vector3.zero; - toy.Transform.localRotation = rotation ?? Quaternion.identity; - toy.Transform.localScale = scale ?? Vector3.one; - if (verticalConstraint.HasValue) toy.VerticalConstraint = verticalConstraint.Value; diff --git a/EXILED/Exiled.API/Features/Toys/Capybara.cs b/EXILED/Exiled.API/Features/Toys/Capybara.cs index fcfca34296..6d901f1a8d 100644 --- a/EXILED/Exiled.API/Features/Toys/Capybara.cs +++ b/EXILED/Exiled.API/Features/Toys/Capybara.cs @@ -83,12 +83,11 @@ public static Capybara Create(Transform parent = null, Vector3? position = null, Capybara toy = new(Object.Instantiate(Prefab, parent)) { Collidable = collidable, + LocalPosition = position ?? Vector3.zero, + LocalRotation = rotation ?? Quaternion.identity, + Scale = scale ?? Vector3.one, }; - toy.Transform.localPosition = position ?? Vector3.zero; - toy.Transform.localRotation = rotation ?? Quaternion.identity; - toy.Transform.localScale = scale ?? Vector3.one; - if (spawn) toy.Spawn(); diff --git a/EXILED/Exiled.API/Features/Toys/InteractableToy.cs b/EXILED/Exiled.API/Features/Toys/InteractableToy.cs index 72072063d0..033c52faff 100644 --- a/EXILED/Exiled.API/Features/Toys/InteractableToy.cs +++ b/EXILED/Exiled.API/Features/Toys/InteractableToy.cs @@ -66,22 +66,7 @@ public bool IsLocked } /// - /// Creates a new at the specified position. - /// - /// The local position of the . - /// The new . - public static InteractableToy Create(Vector3 position) => Create(position: position, spawn: true); - - /// - /// Creates a new with a specific position and shape. - /// - /// The local position of the . - /// The shape of the collider. - /// The new . - public static InteractableToy Create(Vector3 position, ColliderShape shape) => Create(position: position, shape: shape, spawn: true); - - /// - /// Creates a new with a specific position, shape, and interaction duration. + /// Creates a new . /// /// The local position of the . /// The shape of the collider. @@ -90,16 +75,16 @@ public bool IsLocked public static InteractableToy Create(Vector3 position, ColliderShape shape, float duration) => Create(position: position, shape: shape, interactionDuration: duration, spawn: true); /// - /// Creates a new from a Transform. + /// Creates a new . /// - /// The transform to create this on. + /// The local position of the . /// The shape of the collider. /// How long the interaction takes. /// Whether the object is locked. /// Whether the should be initially spawned. /// The new . - public static InteractableToy Create(Transform transform, ColliderShape shape = ColliderShape.Sphere, float interactionDuration = 1f, bool isLocked = false, bool spawn = true) - => Create(parent: transform, shape: shape, interactionDuration: interactionDuration, isLocked: isLocked, spawn: spawn); + public static InteractableToy Create(Vector3 position, ColliderShape shape = ColliderShape.Sphere, float interactionDuration = 1f, bool isLocked = false, bool spawn = true) + => Create(position: position, shape: shape, interactionDuration: interactionDuration, isLocked: isLocked, spawn: spawn); /// /// Creates a new . @@ -120,12 +105,11 @@ public static InteractableToy Create(Transform parent = null, Vector3? position Shape = shape, IsLocked = isLocked, InteractionDuration = interactionDuration, + LocalPosition = position ?? Vector3.zero, + LocalRotation = rotation ?? Quaternion.identity, + Scale = scale ?? Vector3.one, }; - toy.Transform.localPosition = position ?? Vector3.zero; - toy.Transform.localRotation = rotation ?? Quaternion.identity; - toy.Transform.localScale = scale ?? Vector3.one; - if (spawn) toy.Spawn(); diff --git a/EXILED/Exiled.API/Features/Toys/Light.cs b/EXILED/Exiled.API/Features/Toys/Light.cs index f6b1dc3967..1618940761 100644 --- a/EXILED/Exiled.API/Features/Toys/Light.cs +++ b/EXILED/Exiled.API/Features/Toys/Light.cs @@ -8,15 +8,17 @@ namespace Exiled.API.Features.Toys { using System; - using System.Linq; using AdminToys; using Enums; + using Exiled.API.Interfaces; using UnityEngine; + using Object = UnityEngine.Object; + /// /// A wrapper class for . /// @@ -128,37 +130,62 @@ public LightShadows ShadowType /// Creates a new . /// /// The position of the . - /// The rotation of the . - /// The scale of the . - /// Whether the should be initially spawned. + /// The color of the . /// The new . - public static Light Create(Vector3? position = null, Vector3? rotation = null, Vector3? scale = null, bool spawn = true) - => Create(position, rotation, scale, spawn, null); + public static Light Create(Vector3 position, Color color) => Create(position: position, color: color, spawn: true); /// /// Creates a new . /// - /// The position of the . - /// The rotation of the . + /// The transform to create this on. + /// The local position of the . + /// The local rotation of the . /// The scale of the . - /// Whether the should be initially spawned. /// The color of the . + /// The intensity of the light. + /// The range of the light. + /// The angle of the light. + /// The inner angle of the light. + /// The shadow strength of the light. + /// The type of light the Light emits. + /// The type of shadows the light casts. + /// Whether the should be initially spawned. /// The new . - public static Light Create(Vector3? position /*= null*/, Vector3? rotation /*= null*/, Vector3? scale /*= null*/, bool spawn /*= true*/, Color? color /*= null*/) + public static Light Create(Transform parent = null, Vector3? position = null, Quaternion? rotation = null, Vector3? scale = null, Color? color = null, float? intensity = null, float? range = null, float? spotAngle = null, float? innerSpotAngle = null, float? shadowStrength = null, LightType? lightType = null, LightShadows? shadowType = null, bool spawn = true) { - Light light = new(UnityEngine.Object.Instantiate(Prefab)) + Light toy = new(Object.Instantiate(Prefab, parent)) { - Position = position ?? Vector3.zero, - Rotation = Quaternion.Euler(rotation ?? Vector3.zero), + LocalPosition = position ?? Vector3.zero, + LocalRotation = rotation ?? Quaternion.identity, Scale = scale ?? Vector3.one, + Color = color ?? Color.white, }; - if (spawn) - light.Spawn(); + if (intensity.HasValue) + toy.Intensity = intensity.Value; + + if (range.HasValue) + toy.Range = range.Value; + + if (spotAngle.HasValue) + toy.SpotAngle = spotAngle.Value; + + if (innerSpotAngle.HasValue) + toy.InnerSpotAngle = innerSpotAngle.Value; - light.Color = color ?? Color.gray; + if (shadowStrength.HasValue) + toy.ShadowStrength = shadowStrength.Value; + + if (lightType.HasValue) + toy.LightType = lightType.Value; + + if (shadowType.HasValue) + toy.ShadowType = shadowType.Value; + + if (spawn) + toy.Spawn(); - return light; + return toy; } /// diff --git a/EXILED/Exiled.API/Features/Toys/Primitive.cs b/EXILED/Exiled.API/Features/Toys/Primitive.cs index 54e1036499..1235afdc2a 100644 --- a/EXILED/Exiled.API/Features/Toys/Primitive.cs +++ b/EXILED/Exiled.API/Features/Toys/Primitive.cs @@ -8,13 +8,14 @@ namespace Exiled.API.Features.Toys { using System; - using System.Linq; using AdminToys; using Enums; + using Exiled.API.Interfaces; using Exiled.API.Structs; + using UnityEngine; using Object = UnityEngine.Object; @@ -89,128 +90,63 @@ public PrimitiveFlags Flags /// /// Creates a new . /// + /// The type of primitive to spawn. /// The position of the . - /// The rotation of the . - /// The scale of the . - /// Whether the should be initially spawned. /// The new . - public static Primitive Create(Vector3? position = null, Vector3? rotation = null, Vector3? scale = null, bool spawn = true) - => Create(position, rotation, scale, spawn, null); + public static Primitive Create(PrimitiveType type, Vector3 position) => Create(type: type, position: position, spawn: true); /// /// Creates a new . /// - /// The type of primitive to spawn. - /// The position of the . - /// The rotation of the . - /// The scale of the . - /// Whether the should be initially spawned. - /// The new . - public static Primitive Create(PrimitiveType primitiveType = PrimitiveType.Sphere, Vector3? position = null, Vector3? rotation = null, Vector3? scale = null, bool spawn = true) - => Create(primitiveType, position, rotation, scale, spawn, null); - - /// - /// Creates a new . - /// - /// The position of the . - /// The rotation of the . + /// The transform to create this on. + /// The local position of the . + /// The local rotation of the . /// The scale of the . - /// Whether the should be initially spawned. - /// The color of the . - /// The new . - public static Primitive Create(Vector3? position /*= null*/, Vector3? rotation /*= null*/, Vector3? scale /*= null*/, bool spawn /*= true*/, Color? color /*= null*/) - { - Primitive primitive = new(Object.Instantiate(Prefab)); - - primitive.Position = position ?? Vector3.zero; - primitive.Rotation = Quaternion.Euler(rotation ?? Vector3.zero); - primitive.Scale = scale ?? Vector3.one; - primitive.Color = color ?? Color.gray; - - if (spawn) - primitive.Spawn(); - - return primitive; - } - - /// - /// Creates a new . - /// - /// The type of primitive to spawn. - /// The position of the . - /// The rotation of the . - /// The scale of the . - /// Whether the should be initially spawned. - /// The color of the . - /// The new . - public static Primitive Create(PrimitiveType primitiveType /*= PrimitiveType.Sphere*/, Vector3? position /*= null*/, Vector3? rotation /*= null*/, Vector3? scale /*= null*/, bool spawn /*= true*/, Color? color /*= null*/) - { - Primitive primitive = new(Object.Instantiate(Prefab)); - - primitive.Position = position ?? Vector3.zero; - primitive.Rotation = Quaternion.Euler(rotation ?? Vector3.zero); - primitive.Scale = scale ?? Vector3.one; - - primitive.Base.NetworkPrimitiveType = primitiveType; - primitive.Color = color ?? Color.gray; - - if (spawn) - primitive.Spawn(); - - return primitive; - } - - /// - /// Creates a new . - /// - /// The type of primitive to spawn. + /// The type of primitive to spawn. /// The primitive flags. - /// The position of the . - /// The rotation of the . - /// The scale of the . - /// Whether the should be initially spawned. /// The color of the . + /// Whether the should be initially spawned. /// The new . - public static Primitive Create(PrimitiveType primitiveType /*= PrimitiveType.Sphere*/, PrimitiveFlags flags, Vector3? position /*= null*/, Vector3? rotation /*= null*/, Vector3? scale /*= null*/, bool spawn /*= true*/, Color? color /*= null*/) + public static Primitive Create(Transform parent = null, Vector3? position = null, Quaternion? rotation = null, Vector3? scale = null, PrimitiveType type = PrimitiveType.Sphere, PrimitiveFlags flags = PrimitiveFlags.Visible | PrimitiveFlags.Collidable, Color? color = null, bool spawn = true) { - Primitive primitive = new(Object.Instantiate(Prefab)); - - primitive.Position = position ?? Vector3.zero; - primitive.Rotation = Quaternion.Euler(rotation ?? Vector3.zero); - primitive.Scale = scale ?? Vector3.one; - primitive.Flags = flags; - - primitive.Base.NetworkPrimitiveType = primitiveType; - primitive.Color = color ?? Color.gray; + Primitive toy = new(Object.Instantiate(Prefab, parent)) + { + Type = type, + Flags = flags, + LocalPosition = position ?? Vector3.zero, + LocalRotation = rotation ?? Quaternion.identity, + Scale = scale ?? Vector3.one, + Color = color ?? Color.gray, + }; if (spawn) - primitive.Spawn(); + toy.Spawn(); - return primitive; + return toy; } /// - /// Creates a new . + /// Creates a new with using . /// /// The settings of the . /// The new . public static Primitive Create(PrimitiveSettings primitiveSettings) { - Primitive primitive = new(Object.Instantiate(Prefab)); - - primitive.Position = primitiveSettings.Position; - primitive.Rotation = Quaternion.Euler(primitiveSettings.Rotation); - primitive.Scale = primitiveSettings.Scale; - primitive.Flags = primitiveSettings.Flags; - - primitive.Base.NetworkPrimitiveType = primitiveSettings.PrimitiveType; - primitive.Color = primitiveSettings.Color; - primitive.IsStatic = primitiveSettings.IsStatic; + Primitive toy = new(Object.Instantiate(Prefab)) + { + Type = primitiveSettings.PrimitiveType, + Flags = primitiveSettings.Flags, + LocalPosition = primitiveSettings.Position, + LocalRotation = Quaternion.Euler(primitiveSettings.Rotation), + Scale = primitiveSettings.Scale, + Color = primitiveSettings.Color, + IsStatic = primitiveSettings.IsStatic, + }; if (primitiveSettings.Spawn) - primitive.Spawn(); + toy.Spawn(); - return primitive; + return toy; } /// @@ -221,4 +157,4 @@ public static Primitive Create(PrimitiveSettings primitiveSettings) [Obsolete("This method is deprecated, please use the generic Get method instead.")] public static Primitive Get(PrimitiveObjectToy primitiveObjectToy) => Get(primitiveObjectToy); } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Toys/ShootingTargetToy.cs b/EXILED/Exiled.API/Features/Toys/ShootingTargetToy.cs index 1266a6501f..dc5b069a3f 100644 --- a/EXILED/Exiled.API/Features/Toys/ShootingTargetToy.cs +++ b/EXILED/Exiled.API/Features/Toys/ShootingTargetToy.cs @@ -9,12 +9,10 @@ namespace Exiled.API.Features.Toys { using System; using System.Collections.Generic; - using System.Linq; using Enums; - using Exiled.API.Interfaces; - using Mirror; + using Exiled.API.Interfaces; using PlayerStatsSystem; @@ -133,20 +131,6 @@ public int AutoResetTime } } - /// - /// Gets or sets the size scale of the target. - /// - public new Vector3 Scale - { - get => GameObject.transform.localScale; - set - { - NetworkServer.UnSpawn(GameObject); - GameObject.transform.localScale = value; - NetworkServer.Spawn(GameObject); - } - } - /// /// Gets or sets a value indicating whether the target is in sync mode. /// @@ -166,43 +150,39 @@ public bool IsSynced /// /// The of the . /// The position of the . + /// The new . + public static ShootingTargetToy Create(ShootingTargetType type, Vector3 position) => Create(type: type, position: position, spawn: true); + + /// + /// Creates a new . + /// + /// The transform to create this on. + /// The position of the . /// The rotation of the . /// The scale of the . + /// The of the . /// Whether the should be initially spawned. /// The new . - public static ShootingTargetToy Create(ShootingTargetType type, Vector3? position = null, Vector3? rotation = null, Vector3? scale = null, bool spawn = true) + public static ShootingTargetToy Create(Transform parent = null, Vector3? position = null, Quaternion? rotation = null, Vector3? scale = null, ShootingTargetType type = ShootingTargetType.Sport, bool spawn = true) { - ShootingTargetToy shootingTargetToy; - - switch (type) + ShootingTarget prefab = type switch { - case ShootingTargetType.ClassD: - { - shootingTargetToy = new(Object.Instantiate(DboyShootingTargetPrefab)); - break; - } - - case ShootingTargetType.Binary: - { - shootingTargetToy = new(Object.Instantiate(BinaryShootingTargetPrefab)); - break; - } - - default: - { - shootingTargetToy = new(Object.Instantiate(SportShootingTargetPrefab)); - break; - } - } + ShootingTargetType.ClassD => DboyShootingTargetPrefab, + ShootingTargetType.Binary => BinaryShootingTargetPrefab, + _ => SportShootingTargetPrefab, + }; - shootingTargetToy.Position = position ?? Vector3.zero; - shootingTargetToy.Rotation = Quaternion.Euler(rotation ?? Vector3.zero); - shootingTargetToy.Scale = scale ?? Vector3.one; + ShootingTargetToy toy = new(Object.Instantiate(prefab, parent)) + { + LocalPosition = position ?? Vector3.zero, + LocalRotation = rotation ?? Quaternion.identity, + Scale = scale ?? Vector3.one, + }; if (spawn) - shootingTargetToy.Spawn(); + toy.Spawn(); - return shootingTargetToy; + return toy; } /// diff --git a/EXILED/Exiled.API/Features/Toys/Speaker.cs b/EXILED/Exiled.API/Features/Toys/Speaker.cs index e71bb729cb..4729624c37 100644 --- a/EXILED/Exiled.API/Features/Toys/Speaker.cs +++ b/EXILED/Exiled.API/Features/Toys/Speaker.cs @@ -4,23 +4,112 @@ // Licensed under the CC BY-SA 3.0 license. // // ----------------------------------------------------------------------- - +#pragma warning disable SA1124 // DoNotUseRegions namespace Exiled.API.Features.Toys { + using System; + using System.Collections.Concurrent; using System.Collections.Generic; + using System.Threading; using AdminToys; + using Enums; - using Exiled.API.Interfaces; + + using Exiled.API.Features.Audio; + using Exiled.API.Features.Audio.PcmSources; + using Exiled.API.Interfaces.Audio; + using Exiled.API.Structs.Audio; + + using Interfaces; + + using MEC; + + using Mirror; + + using NorthwoodLib.Pools; + + using RoundRestarting; + using UnityEngine; + + using VoiceChat; + using VoiceChat.Codec; + using VoiceChat.Codec.Enums; using VoiceChat.Networking; using VoiceChat.Playbacks; + using Object = UnityEngine.Object; + using Random = UnityEngine.Random; + /// /// A wrapper class for . /// public class Speaker : AdminToy, IWrapper { + /// + /// The default volume level of the base SpeakerToy prefab. + /// + public const float DefaultVolume = 1f; + + /// + /// The default minimum spatial distance of the base SpeakerToy prefab. + /// + public const float DefaultMinDistance = 1f; + + /// + /// The default maximum spatial distance of the base SpeakerToy prefab. + /// + public const float DefaultMaxDistance = 15f; + + /// + /// The default network controller ID of the base SpeakerToy prefab. + /// + public const byte DefaultControllerId = 0; + + /// + /// The default spatialization setting of the base SpeakerToy prefab. + /// + public const bool DefaultSpatial = true; + + /// + /// Default channel used when sending data if no channel is specified. + /// + public const int DefaultChannel = Channels.Unreliable; + + private const int PacketQueueCapacity = 8; + private const int ResampleBufferPadding = 10; + private const float PitchTolerance = 0.0001f; + private const int FrameSize = VoiceChatSettings.PacketSizePerChannel; + private const double FrameTime = (double)FrameSize / VoiceChatSettings.SampleRate; + + private static readonly Queue Pool; + private static readonly Vector3 SpeakerParkPosition = Vector3.down * 999; + + private readonly object opusLock = new(); + + private OpusEncoder encoder; + private CoroutineHandle fadeRoutine; + private CoroutineHandle playBackRoutine; + private CancellationTokenSource processCts; + + private volatile IPcmSource currentSource; + private volatile IAudioFilter activeFilter; + private volatile BlockingCollection<(byte[] Data, int Length)> packetQueue; + + private int nextScheduledEventIndex; + private int idChangeFrame; + private bool needsSyncWait; + private double nextSendTime; + private bool isPitchDefault = true; + private bool isPlayBackInitialized; + + static Speaker() + { + Pool = new(); + RoundRestart.OnRestartTriggered += Pool.Clear; + } + /// /// Initializes a new instance of the class. /// @@ -28,6 +117,43 @@ public class Speaker : AdminToy, IWrapper internal Speaker(SpeakerToy speakerToy) : base(speakerToy, AdminToyType.Speaker) => Base = speakerToy; + /// + /// Invoked when the audio playback starts. + /// + public event Action OnPlaybackStarted; + + /// + /// Invoked when the audio playback is paused. + /// + public event Action OnPlaybackPaused; + + /// + /// Invoked when the audio playback is resumed from a paused state. + /// + public event Action OnPlaybackResumed; + + /// + /// Invoked when the audio playback loops back to the beginning. + /// + public event Action OnPlaybackLooped; + + /// + /// Invoked when the audio track finishes playing. + /// If looping is enabled, this triggers every time the track finished. + /// + public event Action OnPlaybackFinished; + + /// + /// Invoked when the audio playback stops completely (either manually or end of file). + /// + public event Action OnPlaybackStopped; + + /// + /// Invoked just before the speaker switches to the next track in the queue. + /// Passes the upcoming as an argument. + /// + public event Action OnTrackSwitching; + /// /// Gets the prefab. /// @@ -38,6 +164,213 @@ internal Speaker(SpeakerToy speakerToy) /// public SpeakerToy Base { get; } + /// + /// Gets or sets the network channel used for sending audio packets from this speaker . + /// + public int Channel { get; set; } = DefaultChannel; + + /// + /// Gets or sets a value indicating whether the audio playback should loop when it reaches the end. + /// + public bool Loop { get; set; } + + /// + /// Gets or sets a value indicating whether the speaker should be destroyed after playback finishes. + /// + public bool DestroyAfter { get; set; } + + /// + /// Gets or sets a value indicating whether the speaker should return to the pool after playback finishes. + /// + public bool ReturnToPoolAfter { get; set; } + + /// + /// Gets a value indicating whether this speaker is currently pooled in the speaker pool. + /// + public bool IsPooled { get; private set; } + + /// + /// Gets or sets the play mode for this speaker, determining how audio is sent to players. + /// + public SpeakerPlayMode PlayMode { get; set; } + + /// + /// Gets or sets the target player who will hear the audio played by this speaker when is set to . + /// + public Player TargetPlayer { get; set; } + + /// + /// Gets or sets the list of target players who will hear the audio played by this speaker when is set to . + /// + public HashSet TargetPlayers { get; set; } + + /// + /// Gets or sets the predicate used to determine which players will hear the audio when is set to . + /// The predicate should return true for players who should receive the audio. + /// + public Func Predicate { get; set; } + + /// + /// Gets a value indicating whether a sound is currently playing on this speaker. + /// + public bool IsPlaying => playBackRoutine.IsRunning && !IsPaused; + + /// + /// Gets or sets a value indicating whether the playback is paused. + /// + /// + /// A where true means the playback is paused; false means it is not paused. + /// + public bool IsPaused + { + get => playBackRoutine.IsAliveAndPaused; + set + { + if (!playBackRoutine.IsRunning) + return; + + if (playBackRoutine.IsAliveAndPaused == value) + return; + + if (value && currentSource is ILiveSource) + { + Log.Warn("[Speaker] Cannot pause or resume playback of a live source."); + return; + } + + playBackRoutine.IsAliveAndPaused = value; + if (value) + { + StopProccesThread(); + OnPlaybackPaused?.Invoke(); + SpeakerEvents.OnPlaybackPaused(this); + } + else + { + nextSendTime = Time.unscaledTimeAsDouble; + StartProccesThread(); + OnPlaybackResumed?.Invoke(); + SpeakerEvents.OnPlaybackResumed(this); + } + } + } + + /// + /// Gets or sets the current playback time in seconds. + /// Returns 0 if not playing. + /// + public double CurrentTime + { + get => currentSource?.CurrentTime ?? 0.0; + set + { + if (currentSource == null || value < 0.0) + return; + + StopProccesThread(); + + currentSource.CurrentTime = value; + + activeFilter?.Reset(); + UpdateNextScheduledEventIndex(); + + if (playBackRoutine.IsRunning) + StartProccesThread(); + } + } + + /// + /// Gets the total duration of the current track in seconds. + /// Returns 0 if not playing. + /// + public double TotalDuration => currentSource?.TotalDuration ?? 0.0; + + /// + /// Gets the remaining playback time in seconds. + /// + public double TimeLeft => Math.Max(0.0, TotalDuration - CurrentTime); + + /// + /// Gets or sets the current playback progress as a value between 0.0 and 1.0. + /// Returns 0 if not playing. + /// + public float PlaybackProgress + { + get => TotalDuration > 0.0 ? (float)(CurrentTime / TotalDuration) : 0f; + set + { + if (TotalDuration > 0.0) + CurrentTime = TotalDuration * Mathf.Clamp01(value); + } + } + + /// + /// Gets or sets the currently playing audio source. + /// Pre-made sources are available in the namespace. + /// + public IPcmSource CurrentSource + { + get => currentSource; + set => currentSource = value; + } + + /// + /// Gets the metadata information (Title, Artist, Duration) of the last played audio track. + /// + public TrackData LastTrackInfo { get; private set; } + + /// + /// Gets or sets the custom audio filter applied to the PCM data right before encoding. + /// Pre-made filters are available in the namespace. + /// + public IAudioFilter Filter + { + get => activeFilter; + set => activeFilter = value; + } + + /// + /// Gets the queue of audio tracks to be played sequentially. + /// + public List TrackQueue => field ??= new(); + + /// + /// Gets the list of time-based events for the current audio track. + /// + public List ScheduledEvents => field ??= new(); + + /// + /// Gets or sets the playback pitch. + /// + /// + /// A representing the pitch level of the audio source, + /// where 1.0 is normal pitch, less than 1.0 is lower pitch (slower), and greater than 1.0 is higher pitch (faster). + /// + public float Pitch + { + get; + set + { + if (field == value) + return; + + field = Mathf.Max(0.1f, Mathf.Abs(value)); + isPitchDefault = Mathf.Abs(field - 1f) < PitchTolerance; + + if (isPitchDefault) + return; + + if (currentSource != null && (currentSource is ILiveSource || (currentSource is MixerSource mixer && mixer.ContainsLiveSource))) + { + field = 1f; + isPitchDefault = true; + Log.Warn("[Speaker] Pitch adjustment is not supported for live sources. Pitch has been reset to default value (1)."); + } + } + } + + = 1f; + /// /// Gets or sets the volume of the audio source. /// @@ -48,7 +381,13 @@ internal Speaker(SpeakerToy speakerToy) public float Volume { get => Base.NetworkVolume; - set => Base.NetworkVolume = value; + set + { + if (isPlayBackInitialized) + StopFade(); + + Base.NetworkVolume = value; + } } /// @@ -96,24 +435,76 @@ public float MinDistance public byte ControllerId { get => Base.NetworkControllerId; - set => Base.NetworkControllerId = value; + set + { + if (Base.NetworkControllerId == value) + return; + + Base.NetworkControllerId = value; + needsSyncWait = true; + idChangeFrame = Time.frameCount; + } + } + + /// + /// Gets the next available controller ID for a . + /// + /// An optional ID to check first. + /// The next available byte ID. If all IDs are currently in use, returns a default of 0. + public static byte GetNextFreeControllerId(byte? preferredId = null) + { + HashSet usedIds = HashSetPool.Shared.Rent(byte.MaxValue + 1); + + foreach (SpeakerToyPlaybackBase playbackBase in SpeakerToyPlaybackBase.AllInstances) + { + usedIds.Add(playbackBase.ControllerId); + } + + if (usedIds.Count >= byte.MaxValue + 1) + { + HashSetPool.Shared.Return(usedIds); + Log.Warn("[Speaker] All controller IDs are in use. Default Controll Id will be use, Audio may conflict!"); + return DefaultControllerId; + } + + if (preferredId.HasValue && !usedIds.Contains(preferredId.Value)) + { + HashSetPool.Shared.Return(usedIds); + return preferredId.Value; + } + + byte id = 0; + while (usedIds.Contains(id)) + { + id++; + } + + HashSetPool.Shared.Return(usedIds); + return id; } /// /// Creates a new . /// - /// The position of the . - /// The rotation of the . - /// The scale of the . + /// The parent transform to attach the to. + /// The local position of the . + /// The volume level of the audio source. + /// Whether the audio source is spatialized (3D sound). + /// The minimum distance at which the audio reaches full volume. + /// The maximum distance at which the audio can be heard. + /// The specific controller ID to assign. If null, the next available ID is used. /// Whether the should be initially spawned. /// The new . - public static Speaker Create(Vector3? position, Vector3? rotation, Vector3? scale, bool spawn) + public static Speaker Create(Transform parent = null, Vector3? position = null, float volume = DefaultVolume, bool isSpatial = DefaultSpatial, float minDistance = DefaultMinDistance, float maxDistance = DefaultMaxDistance, byte? controllerId = null, bool spawn = true) { - Speaker speaker = new(UnityEngine.Object.Instantiate(Prefab)) + Speaker speaker = new(Object.Instantiate(Prefab, parent)) { - Position = position ?? Vector3.zero, - Rotation = Quaternion.Euler(rotation ?? Vector3.zero), - Scale = scale ?? Vector3.one, + Volume = volume, + IsSpatial = isSpatial, + MinDistance = minDistance, + MaxDistance = maxDistance, + ControllerId = controllerId ?? GetNextFreeControllerId(), + LocalPosition = position ?? Vector3.zero, }; if (spawn) @@ -123,44 +514,812 @@ public static Speaker Create(Vector3? position, Vector3? rotation, Vector3? scal } /// - /// Creates a new . + /// Rents an available speaker from the pool or creates a new one if the pool is empty. /// - /// The transform to create this on. - /// Whether the should be initially spawned. - /// Whether the should keep the same world position. - /// The new . - public static Speaker Create(Transform transform, bool spawn, bool worldPositionStays = true) + /// The parent transform to attach the to. + /// The local position of the . + /// A clean instance ready for use. + public static Speaker Rent(Transform parent = null, Vector3? position = null) { - Speaker speaker = new(Object.Instantiate(Prefab, transform, worldPositionStays)) + Speaker speaker = null; + + while (Pool.Count > 0) { - Position = transform.position, - Rotation = transform.rotation, - Scale = transform.localScale.normalized, - }; + speaker = Pool.Dequeue(); - if(spawn) - speaker.Spawn(); + if (speaker?.Base != null) + break; + + speaker = null; + } + + if (speaker == null) + { + speaker = Create(parent, position); + } + else + { + speaker.IsPooled = false; + speaker.IsStatic = false; + + if (parent != null) + speaker.Transform.SetParent(parent); + + speaker.LocalPosition = position ?? Vector3.zero; + speaker.ControllerId = GetNextFreeControllerId(speaker.ControllerId); + SpeakerToyPlaybackBase.AllInstances.Add(speaker.Base.Playback); + } return speaker; } /// - /// Plays audio through this speaker. + /// Rents a speaker from the pool, plays a custom PCM source one time, and automatically returns it to the pool afterwards. /// - /// An instance. - /// Targets who will hear the audio. If null, audio will be sent to all players. - public static void Play(AudioMessage message, IEnumerable targets = null) + /// The custom IPcmSource to play. + /// The parent transform, if any. + /// The local position of the speaker. + /// The optional audio and network settings. If null, default settings are used. + /// true if the source is valid and playback started; otherwise, false. + public static bool PlayFromPool(IPcmSource source, Transform parent = null, Vector3? position = null, in PlaybackSettings? settings = null) { - foreach (Player target in targets ?? Player.List) - target.Connection.Send(message); + if (source == null) + { + Log.Error("[Speaker] Provided custom IPcmSource is null for PlayFromPool!"); + return false; + } + + Speaker speaker = Rent(parent, position); + + PlaybackSettings settingsFull = settings ?? new PlaybackSettings(); + + speaker.Volume = settingsFull.Volume; + speaker.IsSpatial = settingsFull.IsSpatial; + speaker.MinDistance = settingsFull.MinDistance; + speaker.MaxDistance = settingsFull.MaxDistance; + + speaker.Pitch = settingsFull.Pitch; + speaker.Channel = settingsFull.Channel; + speaker.PlayMode = settingsFull.PlayMode; + speaker.Predicate = settingsFull.Predicate; + speaker.TargetPlayer = settingsFull.TargetPlayer; + speaker.TargetPlayers = settingsFull.TargetPlayers; + speaker.activeFilter = settingsFull.Filter; + + speaker.ReturnToPoolAfter = true; + + if (!speaker.Play(source, true)) + { + speaker.ReturnToPool(); + return false; + } + + return true; } + #region Format Supported PlayFromPool Overloads + /// - /// Plays audio through this speaker. + /// Rents a speaker from the pool, plays a local wav file or web stream one time, and automatically returns it to the pool afterwards. (File must be 16 bit, mono and 48khz.) /// - /// Audio samples. - /// The length of the samples array. - /// Targets who will hear the audio. If null, audio will be sent to all players. - public void Play(byte[] samples, int? length = null, IEnumerable targets = null) => Play(new AudioMessage(ControllerId, samples, length ?? samples.Length), targets); + /// The path/url or custom name/key (if has set to true) to the wav file. + /// The parent transform, if any. + /// The local position of the speaker. + /// The optional audio and network settings. If null, default settings are used. + /// true if the audio file was successfully found, loaded, and playback started; otherwise, false. + public static bool PlayWavFromPool(string path, Transform parent = null, Vector3? position = null, in PlaybackSettings? settings = null) + { + if (string.IsNullOrEmpty(path)) + { + Log.Error("[Speaker] Provided path/url or name cannot be null or empty!"); + return false; + } + + PlaybackSettings settingsFull = settings ?? new PlaybackSettings(); + + if (!settingsFull.UseCache && !WavUtility.TryValidatePath(path, out string errorMessage)) + { + Log.Error($"[Speaker] {errorMessage}"); + return false; + } + + IPcmSource source; + try + { + source = WavUtility.CreatePcmSource(path, settingsFull.Stream, settingsFull.UseCache); + } + catch (Exception ex) + { + Log.Error($"[Speaker] Failed to initialize audio source for PlayFromPool. Path: '{path}'.\n{ex}"); + return false; + } + + return PlayFromPool(source, parent, position, settingsFull); + } + #endregion + + /// + /// Plays audio directly from a provided PCM source. + /// + /// The custom IPcmSource to play. + /// If true, clears the upcoming tracks in the playlist before starting playback. + /// true if the source is valid and playback started; otherwise, false. + public bool Play(IPcmSource customSource, bool clearQueue = true) + { + if (IsPooled) + { + Log.Warn("[Speaker] Cannot play audio on a speaker that is currently in the pool!"); + return false; + } + + if (customSource == null) + { + Log.Error("[Speaker] Provided custom IPcmSource is null!"); + return false; + } + + TryInitializePlayBack(); + Stop(clearQueue); + + currentSource = customSource; + LastTrackInfo = currentSource.TrackInfo; + + if (currentSource is ILiveSource) + Pitch = 1.0f; + + playBackRoutine = Timing.RunCoroutine(PlayBackCoroutine().CancelWith(GameObject)); + return true; + } + + /// + /// Stops playback. + /// + /// If true, clears the upcoming tracks in the playlist. + public void Stop(bool clearQueue = true) + { + if (!isPlayBackInitialized) + return; + + if (playBackRoutine.IsRunning) + { + playBackRoutine.IsRunning = false; + + OnPlaybackStopped?.Invoke(); + SpeakerEvents.OnPlaybackStopped(this); + } + + if (clearQueue) + TrackQueue.Clear(); + + ResetEncoder(); + StopProccesThread(); + ClearScheduledEvents(); + + activeFilter?.Reset(); + currentSource?.Dispose(); + currentSource = null; + } + + /// + /// Fades the volume to a specific target over a given duration. + /// IMPORTANT: If the property is manually changed while a fade is in progress, the fade operation will be immediately aborted. + /// + /// The initial volume level when the fade begins. + /// The final volume level to reach at the end of the fade. + /// The time in seconds the fading process should take to complete. + /// If true, uses linear interpolation; if false, uses natural easing (ease-in for fade-in, ease-out for fade-out). + /// An optional action to invoke when the fade process is fully finished. + public void FadeVolume(float startVolume, float targetVolume, float duration = 3, bool linear = false, Action onComplete = null) + { + if (IsPooled) + { + Log.Warn("[Speaker] Cannot fade volume on a speaker that is currently in the pool!"); + return; + } + + if (fadeRoutine.IsRunning) + fadeRoutine.IsRunning = false; + + fadeRoutine = Timing.RunCoroutine(FadeCoroutine(startVolume, targetVolume, duration, linear, onComplete).CancelWith(GameObject)); + } + + /// + /// Stops currently active volume fading process, leaving the volume at its exact current level. + /// + public void StopFade() + { + if (fadeRoutine.IsRunning) + fadeRoutine.IsRunning = false; + } + + /// + /// Restarts the currently playing track from the beginning. + /// + public void RestartTrack() + { + if (!playBackRoutine.IsRunning) + return; + + nextScheduledEventIndex = 0; + + ResetEncoder(); + activeFilter?.Reset(); + currentSource?.Reset(); + } + + /// + /// Adds a track to the playback queue. If nothing is playing, playback starts immediately. + /// + /// The queued track containing its creation logic and optional identifier. + /// true if successfully queued or started. + public bool QueueTrack(QueuedTrack track) + { + if (IsPooled) + { + Log.Warn("[Speaker] Cannot queue tracks on a speaker that is currently in the pool!"); + return false; + } + + if (!playBackRoutine.IsRunning && !IsPaused) + return Play(track.SourceProvider.Invoke()); + + TrackQueue.Add(track); + return true; + } + + /// + /// Removes a specific track from the playback queue by its file path. + /// + /// The exact file path of the track to remove. + /// If true, removes the first occurrence; if false, removes the last occurrence. + /// If true, removes all occurrences; if false, removes only the first or last occurrence based on . + /// true if the track was successfully found and removed; otherwise, false. + public bool RemoveTrack(string path, bool findFirst = true, bool removeAll = false) + { + if (removeAll) + { + int removed = TrackQueue.RemoveAll(t => t.Name == path); + if (removed > 0) + return true; + + return false; + } + + int index = findFirst ? TrackQueue.FindIndex(t => t.Name == path) : TrackQueue.FindLastIndex(t => t.Name == path); + + if (index == -1) + return false; + + TrackQueue.RemoveAt(index); + return true; + } + + /// + /// Skips the currently playing track and starts playing the next one in the queue. + /// + public void SkipTrack() + { + if (TrackQueue.Count == 0) + { + Stop(); + return; + } + + Stop(clearQueue: false); + + QueuedTrack nextTrack = TrackQueue[0]; + TrackQueue.RemoveAt(0); + + try + { + IPcmSource newSource = nextTrack.SourceProvider.Invoke(); + + OnTrackSwitching?.Invoke(nextTrack); + SpeakerEvents.OnTrackSwitching(this, nextTrack); + + Play(newSource, clearQueue: false); + } + catch (Exception ex) + { + Log.Error($"[Speaker] Playlist next track failed: '{nextTrack}'.\n{ex}"); + SkipTrack(); + } + } + + /// + /// Shuffles the tracks in the into a random order with Fisher-Yates algorithm. + /// + public void ShuffleTracks() + { + if (TrackQueue.Count <= 1) + return; + + for (int i = TrackQueue.Count - 1; i > 0; i--) + { + int j = Random.Range(0, i + 1); + (TrackQueue[i], TrackQueue[j]) = (TrackQueue[j], TrackQueue[i]); + } + } + + /// + /// Adds an action to be executed at a specific time in seconds during the current playback. + /// WARNING: Heavy operations can cause audio interruptions. If you need to perform heavy operations, start a MEC Coroutine inside the action. + /// + /// The exact time in seconds to trigger the action. + /// The action to invoke when the specified time is reached. + /// An optional unique string identifier for this event. If not provided, a random GUID will be assigned. + /// The unique string ID of the created time event, which can be used to remove it later via . + public string AddScheduledEvent(double timeInSeconds, Action action, string id = null) + { + if (IsPooled) + { + Log.Warn("[Speaker] Cannot add scheduled events on a speaker that is currently in the pool!"); + return null; + } + + ScheduledEvent timeEvent = new(timeInSeconds, action, id); + + ScheduledEvents.Add(timeEvent); + ScheduledEvents.Sort(); + UpdateNextScheduledEventIndex(); + + return timeEvent.Id; + } + + /// + /// Removes a specific time-based event using its ID. + /// + /// The unique string identifier of the event to remove. + /// true if the event was successfully found and removed; otherwise, false. + public bool RemoveScheduledEvent(string id) + { + int removed = ScheduledEvents.RemoveAll(e => e.Id == id); + + if (removed <= 0) + return false; + + UpdateNextScheduledEventIndex(); + return true; + } + + /// + /// Clears all time-based events for the current playback. + /// + public void ClearScheduledEvents() + { + ScheduledEvents.Clear(); + nextScheduledEventIndex = 0; + } + + /// + /// Stops the current playback, resets all properties of the , and returns the instance to the object pool for future reuse. + /// + public void ReturnToPool() + { + if (Base == null || IsPooled) + return; + + Stop(); + StopFade(); + ClearEvents(); + Transform.SetParent(null); + + IsPooled = true; + LocalPosition = SpeakerParkPosition; + + Volume = DefaultVolume; + IsSpatial = DefaultSpatial; + MinDistance = DefaultMinDistance; + MaxDistance = DefaultMaxDistance; + + IsStatic = true; + Loop = false; + DestroyAfter = false; + ReturnToPoolAfter = false; + PlayMode = SpeakerPlayMode.Global; + Channel = DefaultChannel; + + LastTrackInfo = default; + + Predicate = null; + TargetPlayer = null; + TargetPlayers = null; + + Pitch = 1f; + activeFilter = null; + isPitchDefault = true; + needsSyncWait = false; + + SpeakerToyPlaybackBase.AllInstances.Remove(Base.Playback); + + Pool.Enqueue(this); + } + + /// + /// Sends the constructed audio message to the appropriate players based on the current . + /// + /// The . + public void SendAudioMessage(AudioMessage audioMessage) + { + switch (PlayMode) + { + case SpeakerPlayMode.Global: + NetworkServer.SendToReady(audioMessage, Channel); + break; + + case SpeakerPlayMode.Player: + TargetPlayer?.Connection?.Send(audioMessage, Channel); + break; + + case SpeakerPlayMode.PlayerList: + + if (TargetPlayers is null) + break; + + using (NetworkWriterPooled writer = NetworkWriterPool.Get()) + { + NetworkMessages.Pack(audioMessage, writer); + ArraySegment segment = writer.ToArraySegment(); + + foreach (Player ply in TargetPlayers) + { + ply?.Connection?.Send(segment, Channel); + } + } + + break; + + case SpeakerPlayMode.Predicate: + if (Predicate is null) + break; + + using (NetworkWriterPooled writer = NetworkWriterPool.Get()) + { + NetworkMessages.Pack(audioMessage, writer); + ArraySegment segment = writer.ToArraySegment(); + + foreach (Player ply in Player.List) + { + if (Predicate(ply)) + ply.Connection?.Send(segment, Channel); + } + } + + break; + } + } + + private void TryInitializePlayBack() + { + if (isPlayBackInitialized) + return; + + isPlayBackInitialized = true; + + encoder = new(OpusApplicationType.Audio); + + // 3002 => OPUS_SIGNAL_MUSIC (https://github.com/xiph/opus/blob/2d862ea14b233e5a3f3afaf74d96050691af3cd5/include/opus_defines.h#L229) + OpusWrapper.SetEncoderSetting(encoder._handle, OpusCtlSetRequest.Signal, 3002); + + AdminToyBase.OnRemoved += OnToyRemoved; + } + + private void ResetEncoder() + { + lock (opusLock) + { + if (encoder != null && encoder._handle != IntPtr.Zero) + { + // 4028 => OPUS_RESET_STATE (https://github.com/xiph/opus/blob/2d862ea14b233e5a3f3afaf74d96050691af3cd5/include/opus_defines.h#L710) + OpusWrapper.SetEncoderSetting(encoder._handle, (OpusCtlSetRequest)4028, 0); + } + } + } + + private IEnumerator PlayBackCoroutine() + { + StartProccesThread(); + + if (needsSyncWait) + { + int framesPassed = Time.frameCount - idChangeFrame; + while (framesPassed < 2) + { + yield return Timing.WaitForOneFrame; + framesPassed = Time.frameCount - idChangeFrame; + } + + needsSyncWait = false; + } + + OnPlaybackStarted?.Invoke(); + SpeakerEvents.OnPlaybackStarted(this); + + nextSendTime = Time.unscaledTimeAsDouble; + + while (true) + { + double currentTime = Time.unscaledTimeAsDouble; + + while (currentTime >= nextSendTime) + { + nextSendTime += FrameTime; + + if (packetQueue != null && packetQueue.TryTake(out (byte[] Data, int Length) packet) && packet.Length > 2) + SendAudioMessage(new AudioMessage(ControllerId, packet.Data, packet.Length)); + + if (packetQueue != null && !packetQueue.IsCompleted) + continue; + + bool trackFailed = currentSource is IAsyncPcmSource asyncSource && asyncSource.IsFailed; + + if (!trackFailed) + { + OnPlaybackFinished?.Invoke(); + SpeakerEvents.OnPlaybackFinished(this); + + yield return Timing.WaitForOneFrame; + + if (Loop) + { + RestartTrack(); + + OnPlaybackLooped?.Invoke(); + SpeakerEvents.OnPlaybackLooped(this); + + nextSendTime = Time.unscaledTimeAsDouble; + + StartProccesThread(); + continue; + } + } + + EndingPlayBack(); + yield break; + } + + while (nextScheduledEventIndex < ScheduledEvents.Count && CurrentTime >= ScheduledEvents[nextScheduledEventIndex].Time) + { + try + { + ScheduledEvents[nextScheduledEventIndex].Action?.Invoke(); + } + catch (Exception ex) + { + Log.Error($"[Speaker] Failed to execute scheduled time event at {ScheduledEvents[nextScheduledEventIndex].Time:F2}s.\nException Details: {ex}"); + } + + nextScheduledEventIndex++; + } + + yield return Timing.WaitForOneFrame; + } + } + + private void StartProccesThread() + { + StopProccesThread(); + + BlockingCollection<(byte[], int)> localQueue = new(PacketQueueCapacity); + packetQueue = localQueue; + processCts = new CancellationTokenSource(); + CancellationToken token = processCts.Token; + + new Thread(() => ProcessLoop(localQueue, token)) + { + IsBackground = true, + Priority = System.Threading.ThreadPriority.BelowNormal, + Name = $"[Exiled Speaker Api] Speaker.ProcessThread Id:[{ControllerId}]", + }.Start(); + } + + private void ProcessLoop(BlockingCollection<(byte[] Data, int Lenght)> localQueue, CancellationToken token) + { + float[] localFrame = new float[FrameSize]; + byte[] localEncoded = new byte[VoiceChatSettings.MaxEncodedSize]; + float[] localResampleBuffer = Array.Empty(); + double localResampleTime = 0.0; + int localResampleBufferFilled = 0; + + try + { + while (!token.IsCancellationRequested) + { + IPcmSource source = currentSource; + if (source == null || source.Ended) + break; + + if (isPitchDefault) + { + int read = source.Read(localFrame, 0, FrameSize); + if (read < FrameSize) + Array.Clear(localFrame, read, FrameSize - read); + } + else + { + ResampleFrame(source, localFrame, ref localResampleBuffer, ref localResampleTime, ref localResampleBufferFilled); + } + + activeFilter?.Process(localFrame); + + int length; + lock (opusLock) + { + if (encoder == null) + break; + + length = encoder.Encode(localFrame, localEncoded); + } + + byte[] packet = new byte[length]; + Array.Copy(localEncoded, packet, length); + + localQueue.TryAdd((packet, length), -1, token); + } + } + catch (OperationCanceledException) + { + } + catch (Exception ex) + { + Log.Error($"[Speaker] Encode worker error.\nException Details: {ex}"); + } + finally + { + localQueue.CompleteAdding(); + } + } + + private void StopProccesThread() + { + CancellationTokenSource localCts = Interlocked.Exchange(ref processCts, null); + if (localCts != null) + { + localCts.Cancel(); + localCts.Dispose(); + } + + packetQueue = null; + } + + private void UpdateNextScheduledEventIndex() + { + nextScheduledEventIndex = 0; + double current = CurrentTime; + + while (nextScheduledEventIndex < ScheduledEvents.Count && ScheduledEvents[nextScheduledEventIndex].Time <= current) + { + nextScheduledEventIndex++; + } + } + + private void EndingPlayBack() + { + if (TrackQueue.Count > 0) + { + playBackRoutine.IsRunning = false; + SkipTrack(); + } + else if (ReturnToPoolAfter) + { + ReturnToPool(); + } + else if (DestroyAfter) + { + Destroy(); + } + else + { + Stop(); + } + } + + private void ResampleFrame(IPcmSource source, float[] outFrame, ref float[] buffer, ref double time, ref int filled) + { + int requiredSize = (int)(FrameSize * Mathf.Abs(Pitch) * 2) + ResampleBufferPadding; + + if (buffer.Length < requiredSize) + { + buffer = new float[requiredSize]; + time = 0.0; + filled = 0; + } + + int outputIdx = 0; + + while (outputIdx < FrameSize) + { + if (filled == 0) + { + int actualRead = source.Read(buffer, 0, buffer.Length - ResampleBufferPadding); + if (actualRead == 0) + { + Array.Clear(outFrame, outputIdx, FrameSize - outputIdx); + return; + } + + filled = actualRead; + time = 0.0; + } + + int currentSample = (int)time; + + if (currentSample >= filled - 1) + { + if (filled > 0) + { + buffer[0] = buffer[filled - 1]; + int actualRead = source.Read(buffer, 1, buffer.Length - ResampleBufferPadding - 1); + if (actualRead == 0) + { + Array.Clear(outFrame, outputIdx, FrameSize - outputIdx); + return; + } + + filled = actualRead + 1; + time -= currentSample; + } + else + { + filled = 0; + } + + continue; + } + + double frac = time - currentSample; + outFrame[outputIdx++] = (float)(buffer[currentSample] + ((buffer[currentSample + 1] - buffer[currentSample]) * frac)); + time += Pitch; + } + } + + private IEnumerator FadeCoroutine(float startVolume, float targetVolume, float duration, bool linear, Action onComplete) + { + float timePassed = 0f; + bool isFadeOut = startVolume > targetVolume; + + while (timePassed < duration) + { + timePassed += Time.deltaTime; + float t = timePassed / duration; + + if (!linear) + t = isFadeOut ? 1f - ((1f - t) * (1f - t)) : t * t; + + Base.NetworkVolume = Mathf.Lerp(startVolume, targetVolume, t); + yield return Timing.WaitForOneFrame; + } + + Base.NetworkVolume = targetVolume; + onComplete?.Invoke(); + } + + private void OnToyRemoved(AdminToyBase toy) + { + if (toy != Base) + return; + + AdminToyBase.OnRemoved -= OnToyRemoved; + + Stop(); + ClearEvents(); + + lock (opusLock) + { + encoder?.Dispose(); + encoder = null; + } + } + + private void ClearEvents() + { + OnPlaybackStarted = null; + OnPlaybackPaused = null; + OnPlaybackResumed = null; + OnPlaybackLooped = null; + OnTrackSwitching = null; + OnPlaybackFinished = null; + OnPlaybackStopped = null; + } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Toys/Text.cs b/EXILED/Exiled.API/Features/Toys/Text.cs index ad22ac6827..2ff586952d 100644 --- a/EXILED/Exiled.API/Features/Toys/Text.cs +++ b/EXILED/Exiled.API/Features/Toys/Text.cs @@ -55,7 +55,7 @@ public Vector2 DisplaySize } /// - /// Creates a new at the specified position. + /// Creates a new . /// /// The local position of the . /// The text content to display. @@ -63,7 +63,7 @@ public Vector2 DisplaySize public static Text Create(Vector3 position, string text) => Create(position: position, text: text, spawn: true); /// - /// Creates a new with a specific position, text, and display size. + /// Creates a new . /// /// The local position of the . /// The text content to display. @@ -71,50 +71,32 @@ public Vector2 DisplaySize /// The new . public static Text Create(Vector3 position, string text, Vector2 displaySize) => Create(position: position, text: text, displaySize: displaySize, spawn: true); - /// - /// Creates a new based on a Transform. - /// - /// The transform to spawn at. - /// The text content to display. - /// The new . - public static Text Create(Transform transform, string text) => Create(parent: transform, text: text, spawn: true); - - /// - /// Creates a new based on a Transform with custom size. - /// - /// The transform to spawn at. - /// The text content to display. - /// The display size of the text. - /// The new . - public static Text Create(Transform transform, string text, Vector2 displaySize) => Create(parent: transform, text: text, displaySize: displaySize, spawn: true); - /// /// Creates a new . /// + /// The transform to create this on. /// The local position of the . /// The local rotation of the . /// The local scale of the . /// The text content to display. /// The display size of the text. - /// The transform to create this on. /// Whether the should be initially spawned. /// The new . - public static Text Create(Vector3? position = null, Quaternion? rotation = null, Vector3? scale = null, string text = "Default Text", Vector2? displaySize = null, Transform parent = null, bool spawn = true) + public static Text Create(Transform parent = null, Vector3? position = null, Quaternion? rotation = null, Vector3? scale = null, string text = "Hello World!", Vector2? displaySize = null, bool spawn = true) { - Text textToy = new(Object.Instantiate(Prefab, parent)) + Text toy = new(Object.Instantiate(Prefab, parent)) { + DisplaySize = displaySize ?? new Vector2(50, 50), + LocalPosition = position ?? Vector3.zero, + LocalRotation = rotation ?? Quaternion.identity, + Scale = scale ?? Vector3.one, TextFormat = text, - DisplaySize = displaySize ?? new Vector3(50, 50), }; - textToy.Transform.localPosition = position ?? Vector3.zero; - textToy.Transform.localRotation = rotation ?? Quaternion.identity; - textToy.Transform.localScale = scale ?? Vector3.one; - if (spawn) - textToy.Spawn(); + toy.Spawn(); - return textToy; + return toy; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Toys/Waypoint.cs b/EXILED/Exiled.API/Features/Toys/Waypoint.cs index 706d1e6a50..ce5def9898 100644 --- a/EXILED/Exiled.API/Features/Toys/Waypoint.cs +++ b/EXILED/Exiled.API/Features/Toys/Waypoint.cs @@ -60,7 +60,11 @@ public bool VisualizeBounds public Bounds Bounds { get => new(Position, Base.NetworkBoundsSize); - set => Base.NetworkBoundsSize = value.size; + set + { + Position = value.center; + Base.NetworkBoundsSize = value.size; + } } /// @@ -78,7 +82,7 @@ public Vector3 BoundsSize public byte WaypointId => Base._waypointId; /// - /// Creates a new with a specific position and size (bounds). + /// Creates a new . /// /// The position of the . /// The size of the bounds (Applied to NetworkBoundsSize). @@ -86,7 +90,7 @@ public Vector3 BoundsSize public static Waypoint Create(Vector3 position, Vector3 size) => Create(position: position, scale: size, spawn: true); /// - /// Creates a new based on a Transform. + /// Creates a new . /// /// The transform to spawn at (LocalScale is applied to Bounds). /// The size of the bounds (Applied to NetworkBoundsSize). @@ -109,13 +113,12 @@ public static Waypoint Create(Transform parent = null, Vector3? position = null, Waypoint toy = new(Object.Instantiate(Prefab, parent)) { Priority = priority, - BoundsSize = scale ?? Vector3.one * 255.9961f, VisualizeBounds = visualizeBounds, + BoundsSize = scale ?? (Vector3.one * WaypointToy.MaxBounds), + LocalPosition = position ?? Vector3.zero, + LocalRotation = rotation ?? Quaternion.identity, }; - toy.Transform.localPosition = position ?? Vector3.zero; - toy.Transform.localRotation = rotation ?? Quaternion.identity; - if (spawn) toy.Spawn(); diff --git a/EXILED/Exiled.API/Features/Warhead.cs b/EXILED/Exiled.API/Features/Warhead.cs index 5b53082a8c..2913e3aee7 100644 --- a/EXILED/Exiled.API/Features/Warhead.cs +++ b/EXILED/Exiled.API/Features/Warhead.cs @@ -7,10 +7,13 @@ namespace Exiled.API.Features { + using System; using System.Collections.Generic; using Enums; + using Interactables.Interobjects.DoorUtils; + using Mirror; using UnityEngine; @@ -20,8 +23,6 @@ namespace Exiled.API.Features /// public static class Warhead { - private static AlphaWarheadOutsitePanel alphaWarheadOutsitePanel; - /// /// Gets the cached component. /// @@ -35,7 +36,7 @@ public static class Warhead /// /// Gets the cached component. /// - public static AlphaWarheadOutsitePanel OutsitePanel => alphaWarheadOutsitePanel != null ? alphaWarheadOutsitePanel : (alphaWarheadOutsitePanel = UnityEngine.Object.FindFirstObjectByType()); + public static AlphaWarheadOutsitePanel OutsitePanel => field?.gameObject != null ? field : (field = UnityEngine.Object.FindFirstObjectByType()); /// /// Gets the of the warhead lever. @@ -69,6 +70,15 @@ public static bool OpenDoors set => Controller._openDoors = value; } + /// + /// Gets or sets the remaining cooldown before the nuke can be triggered again. + /// + public static double RemainingCooldown + { + get => Math.Max(0, Controller.NetworkCooldownEndTime - NetworkTime.time); + set => Controller.NetworkCooldownEndTime = NetworkTime.time + Math.Max(0, value); + } + /// /// Gets all of the warhead blast doors. /// @@ -97,25 +107,42 @@ public static bool IsKeycardActivated /// public static WarheadStatus Status { - get => IsInProgress ? IsDetonated ? WarheadStatus.Detonated : WarheadStatus.InProgress : LeverStatus ? WarheadStatus.Armed : WarheadStatus.NotArmed; + get + { + WarheadStatus status = WarheadStatus.NotArmed; + + if (IsDetonated) + status |= WarheadStatus.Detonated; + + if (IsInProgress) + status |= WarheadStatus.InProgress; + + if (IsOnCooldown) + status |= WarheadStatus.OnCooldown; + + if (LeverStatus) + status |= WarheadStatus.Armed; + + return status; + } + set { - switch (value) - { - case WarheadStatus.NotArmed: - case WarheadStatus.Armed: - Stop(); - LeverStatus = value is WarheadStatus.Armed; - break; - - case WarheadStatus.InProgress: - Start(); - break; - - case WarheadStatus.Detonated: - Detonate(); - break; - } + if (IsDetonated) + return; + + LeverStatus = value.HasFlag(WarheadStatus.Armed); + + if (!IsInProgress && value.HasFlag(WarheadStatus.InProgress)) + Start(); + else if (!value.HasFlag(WarheadStatus.InProgress)) + Stop(); + + if (value.HasFlag(WarheadStatus.Detonated)) + Detonate(); + + if (!IsOnCooldown && value.HasFlag(WarheadStatus.OnCooldown)) + RemainingCooldown = Controller._cooldown; } } @@ -132,7 +159,7 @@ public static WarheadStatus Status /// /// Gets a value indicating whether the warhead detonation is on cooldown. /// - public static bool IsOnCooldown => Controller.CooldownEndTime > NetworkTime.time; + public static bool IsOnCooldown => RemainingCooldown > 0; /// /// Gets or sets the warhead detonation timer. @@ -213,7 +240,7 @@ public static void Start() public static void Start(bool isAutomatic, bool suppressSubtitles = false, Player trigger = null) { Controller.InstantPrepare(); - Controller.StartDetonation(isAutomatic, suppressSubtitles, trigger == null ? null : trigger.ReferenceHub); + Controller.StartDetonation(isAutomatic, suppressSubtitles, trigger?.ReferenceHub); } /// @@ -265,4 +292,4 @@ public static void Start(bool isAutomatic, bool suppressSubtitles = false, Playe /// Whether the given position is prone to being detonated. public static bool CanBeDetonated(Vector3 pos, bool includeOnlyLifts = false) => AlphaWarheadController.CanBeDetonated(pos, includeOnlyLifts); } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Features/Waves/TimedWave.cs b/EXILED/Exiled.API/Features/Waves/TimedWave.cs index 6e9a5c55bf..ebded06851 100644 --- a/EXILED/Exiled.API/Features/Waves/TimedWave.cs +++ b/EXILED/Exiled.API/Features/Waves/TimedWave.cs @@ -11,7 +11,9 @@ namespace Exiled.API.Features.Waves using System.Linq; using Exiled.API.Enums; + using PlayerRoles; + using Respawning; using Respawning.Announcements; using Respawning.Waves; @@ -67,7 +69,7 @@ public class TimedWave Faction.FoundationStaff when IsMiniWave => SpawnableFaction.NtfMiniWave, Faction.FoundationStaff => SpawnableFaction.NtfWave, Faction.FoundationEnemy when IsMiniWave => SpawnableFaction.ChaosMiniWave, - _ => SpawnableFaction.ChaosWave + _ => SpawnableFaction.ChaosWave, }; /// @@ -96,7 +98,7 @@ public class TimedWave public static bool TryGetTimedWaves(Faction faction, out List waves) { List spawnableWaveBases = WaveManager.Waves.Where(w => w is TimeBasedWave wave && wave.TargetFaction == faction).ToList(); - if(!spawnableWaveBases.Any()) + if (!spawnableWaveBases.Any()) { waves = null; return false; @@ -115,7 +117,7 @@ public static bool TryGetTimedWaves(Faction faction, out List waves) public static bool TryGetTimedWaves(Team team, out List waves) { List spawnableWaveBases = WaveManager.Waves.Where(w => w is TimeBasedWave wave && wave.TargetFaction.GetSpawnableTeam() == team).ToList(); - if(!spawnableWaveBases.Any()) + if (!spawnableWaveBases.Any()) { waves = null; return false; diff --git a/EXILED/Exiled.API/Features/Waves/WaveTimer.cs b/EXILED/Exiled.API/Features/Waves/WaveTimer.cs index b99f2cf2bf..df96fee7cc 100644 --- a/EXILED/Exiled.API/Features/Waves/WaveTimer.cs +++ b/EXILED/Exiled.API/Features/Waves/WaveTimer.cs @@ -15,8 +15,6 @@ namespace Exiled.API.Features.Waves using PlayerRoles; - using Respawning; - using Respawning.Waves; /// diff --git a/EXILED/Exiled.API/Features/Window.cs b/EXILED/Exiled.API/Features/Window.cs index 2d327ff0c4..a1f92bc26f 100644 --- a/EXILED/Exiled.API/Features/Window.cs +++ b/EXILED/Exiled.API/Features/Window.cs @@ -12,10 +12,13 @@ namespace Exiled.API.Features using System.Linq; using DamageHandlers; + using Enums; + using Exiled.API.Extensions; using Exiled.API.Features.Doors; using Exiled.API.Interfaces; + using UnityEngine; /// diff --git a/EXILED/Exiled.API/Features/Workstation.cs b/EXILED/Exiled.API/Features/Workstation.cs index ae4b2612d3..2bc63e1e5e 100644 --- a/EXILED/Exiled.API/Features/Workstation.cs +++ b/EXILED/Exiled.API/Features/Workstation.cs @@ -14,9 +14,11 @@ namespace Exiled.API.Features using Exiled.API.Enums; using Exiled.API.Interfaces; + using InventorySystem.Items.Firearms.Attachments; + using MapGeneration.Distributors; - using Mirror; + using UnityEngine; /// diff --git a/EXILED/Exiled.API/Interfaces/Audio/IAsyncPcmSource.cs b/EXILED/Exiled.API/Interfaces/Audio/IAsyncPcmSource.cs new file mode 100644 index 0000000000..1ae0a2f7e5 --- /dev/null +++ b/EXILED/Exiled.API/Interfaces/Audio/IAsyncPcmSource.cs @@ -0,0 +1,25 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) ExMod Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.API.Interfaces.Audio +{ + /// + /// Represents an audio source that loads its data asynchronously and can potentially fail. + /// + public interface IAsyncPcmSource + { + /// + /// Gets a value indicating whether the asynchronous source has finished loading/buffering and is ready to be played. + /// + bool IsReady { get; } + + /// + /// Gets a value indicating whether the source failed to load. + /// + bool IsFailed { get; } + } +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Interfaces/Audio/IAudioFilter.cs b/EXILED/Exiled.API/Interfaces/Audio/IAudioFilter.cs new file mode 100644 index 0000000000..c0ffcb97d2 --- /dev/null +++ b/EXILED/Exiled.API/Interfaces/Audio/IAudioFilter.cs @@ -0,0 +1,26 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) ExMod Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.API.Interfaces.Audio +{ + /// + /// Represents a custom filter for the speaker. + /// + public interface IAudioFilter + { + /// + /// Processes the raw PCM audio frame directly before it is encoded and sending. + /// + /// The array of PCM audio samples. + void Process(float[] frame); + + /// + /// Resets the internal state and buffers of the filter. + /// + void Reset(); + } +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Interfaces/Audio/ILiveSource.cs b/EXILED/Exiled.API/Interfaces/Audio/ILiveSource.cs new file mode 100644 index 0000000000..32eeaf798f --- /dev/null +++ b/EXILED/Exiled.API/Interfaces/Audio/ILiveSource.cs @@ -0,0 +1,16 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) ExMod Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.API.Interfaces.Audio +{ + /// + /// A marker interface used to identify PCM sources that are live or continuous. + /// + public interface ILiveSource + { + } +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Interfaces/Audio/IPcmSource.cs b/EXILED/Exiled.API/Interfaces/Audio/IPcmSource.cs new file mode 100644 index 0000000000..7ab6211c81 --- /dev/null +++ b/EXILED/Exiled.API/Interfaces/Audio/IPcmSource.cs @@ -0,0 +1,59 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) ExMod Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.API.Interfaces.Audio +{ + using System; + + using Exiled.API.Structs.Audio; + + /// + /// Represents a source of PCM audio data. + /// + public interface IPcmSource : IDisposable + { + /// + /// Gets a value indicating whether the end of the PCM source has been reached. + /// + bool Ended { get; } + + /// + /// Gets the total duration of the audio in seconds. + /// + double TotalDuration { get; } + + /// + /// Gets or sets the current playback position in seconds. + /// + double CurrentTime { get; set; } + + /// + /// Gets the metadata of the streaming track. + /// + TrackData TrackInfo { get; } + + /// + /// Reads a sequence of PCM samples into the specified buffer. + /// + /// The buffer to read the samples into. + /// The zero-based index in the buffer at which to begin storing the data read from the source. + /// The maximum number of samples to read. + /// The total number of samples read into the buffer. + int Read(float[] buffer, int offset, int count); + + /// + /// Seeks to the specified position in the PCM source. + /// + /// The position in seconds to seek to. + void Seek(double seconds); + + /// + /// Resets the PCM source to its initial state, allowing reading from the beginning. + /// + void Reset(); + } +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Interfaces/IPosition.cs b/EXILED/Exiled.API/Interfaces/IPosition.cs index 467495137a..a169aa2965 100644 --- a/EXILED/Exiled.API/Interfaces/IPosition.cs +++ b/EXILED/Exiled.API/Interfaces/IPosition.cs @@ -19,4 +19,4 @@ public interface IPosition /// public Vector3 Position { get; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Interfaces/IRotation.cs b/EXILED/Exiled.API/Interfaces/IRotation.cs index f7e244b19b..c7f1090d79 100644 --- a/EXILED/Exiled.API/Interfaces/IRotation.cs +++ b/EXILED/Exiled.API/Interfaces/IRotation.cs @@ -19,4 +19,4 @@ public interface IRotation /// public Quaternion Rotation { get; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Interfaces/IWorldSpace.cs b/EXILED/Exiled.API/Interfaces/IWorldSpace.cs index 0df54e81e9..f17d2219fc 100644 --- a/EXILED/Exiled.API/Interfaces/IWorldSpace.cs +++ b/EXILED/Exiled.API/Interfaces/IWorldSpace.cs @@ -15,4 +15,4 @@ namespace Exiled.API.Interfaces public interface IWorldSpace : IPosition, IRotation { } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Interfaces/Keycards/ILabelKeycard.cs b/EXILED/Exiled.API/Interfaces/Keycards/ILabelKeycard.cs index d724f997ea..fbc1b980aa 100644 --- a/EXILED/Exiled.API/Interfaces/Keycards/ILabelKeycard.cs +++ b/EXILED/Exiled.API/Interfaces/Keycards/ILabelKeycard.cs @@ -8,6 +8,7 @@ namespace Exiled.API.Interfaces.Keycards { using Exiled.API.Features.Items.Keycards; + using UnityEngine; /// diff --git a/EXILED/Exiled.API/Structs/Audio/AudioData.cs b/EXILED/Exiled.API/Structs/Audio/AudioData.cs new file mode 100644 index 0000000000..e8924f8c10 --- /dev/null +++ b/EXILED/Exiled.API/Structs/Audio/AudioData.cs @@ -0,0 +1,36 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) ExMod Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.API.Structs.Audio +{ + /// + /// Represents raw audio data and its associated metadata. + /// + public struct AudioData + { + /// + /// Gets the raw PCM audio samples. + /// + public float[] Pcm; + + /// + /// Gets the metadata of the audio track, including its total duration. + /// + public TrackData TrackInfo; + + /// + /// Initializes a new instance of the struct. + /// + /// The raw PCM float array containing the audio data. + /// The metadata associated with the audio track. + public AudioData(float[] pcmData, TrackData trackInfo) + { + Pcm = pcmData; + TrackInfo = trackInfo; + } + } +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Structs/Audio/QueuedTrack.cs b/EXILED/Exiled.API/Structs/Audio/QueuedTrack.cs new file mode 100644 index 0000000000..34d1cfbf63 --- /dev/null +++ b/EXILED/Exiled.API/Structs/Audio/QueuedTrack.cs @@ -0,0 +1,40 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) ExMod Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.API.Structs.Audio +{ + using System; + + using Exiled.API.Interfaces.Audio; + + /// + /// Represents a track waiting in the queue, along with its specific playback options. + /// + public readonly struct QueuedTrack + { + /// + /// Initializes a new instance of the struct. + /// + /// The name, path, or identifier of the track (used for displaying or removing from queue). + /// A function that returns the instantiated . + public QueuedTrack(string name, Func sourceFactory) + { + Name = name; + SourceProvider = sourceFactory; + } + + /// + /// Gets the name, path, or identifier of the track. + /// + public string Name { get; } + + /// + /// Gets the provider function used to create the custom audio source on demand. + /// + public Func SourceProvider { get; } + } +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Structs/Audio/TrackData.cs b/EXILED/Exiled.API/Structs/Audio/TrackData.cs new file mode 100644 index 0000000000..596b137d23 --- /dev/null +++ b/EXILED/Exiled.API/Structs/Audio/TrackData.cs @@ -0,0 +1,74 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) ExMod Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.API.Structs.Audio +{ + using System; + + /// + /// Contains metadata about a audio track. + /// + public struct TrackData + { + /// + /// Gets the title of the track, if available in the metadata. + /// + public string Title { get; internal set; } + + /// + /// Gets the artist of the track, if available in the metadata. + /// + public string Artist { get; internal set; } + + /// + /// Gets the total duration of the track in seconds. + /// + public double Duration { get; internal set; } + + /// + /// Gets the file path of the track. + /// + public string Path { get; internal set; } + + /// + /// Gets a value indicating whether the track data is completely empty. + /// + public readonly bool IsEmpty => string.IsNullOrEmpty(Title) && string.IsNullOrEmpty(Artist) && Duration <= 0; + + /// + /// Gets a formatted display name for the track. + /// + public string DisplayName + { + get + { + if (!string.IsNullOrEmpty(Artist) && !string.IsNullOrEmpty(Title)) + return $"{Artist} - {Title}"; + + if (!string.IsNullOrEmpty(Title)) + return Title; + + if (!string.IsNullOrEmpty(Path)) + return System.IO.Path.GetFileNameWithoutExtension(Path); + + return "Unknown Track"; + } + } + + /// + /// Gets the duration formatted as a digital clock string. + /// + public readonly string FormattedDuration + { + get + { + TimeSpan t = TimeSpan.FromSeconds(Duration); + return t.Hours > 0 ? t.ToString(@"hh\:mm\:ss") : t.ToString(@"mm\:ss"); + } + } + } +} \ No newline at end of file diff --git a/EXILED/Exiled.API/Structs/PrimitiveSettings.cs b/EXILED/Exiled.API/Structs/PrimitiveSettings.cs index 24fcc04393..0da6238ce4 100644 --- a/EXILED/Exiled.API/Structs/PrimitiveSettings.cs +++ b/EXILED/Exiled.API/Structs/PrimitiveSettings.cs @@ -8,6 +8,7 @@ namespace Exiled.API.Structs { using AdminToys; + using UnityEngine; /// diff --git a/EXILED/Exiled.CreditTags/Enums/InfoSide.cs b/EXILED/Exiled.CreditTags/Enums/InfoSide.cs index 9d87360d4b..7bf491865a 100644 --- a/EXILED/Exiled.CreditTags/Enums/InfoSide.cs +++ b/EXILED/Exiled.CreditTags/Enums/InfoSide.cs @@ -18,7 +18,7 @@ public enum InfoSide Badge, /// - /// Uses Custom Player Info area + /// Uses Custom Player Info area. /// CustomPlayerInfo, diff --git a/EXILED/Exiled.CreditTags/Events/CreditsHandler.cs b/EXILED/Exiled.CreditTags/Events/CreditsHandler.cs index 06c30e30fb..4d1bfd0bed 100644 --- a/EXILED/Exiled.CreditTags/Events/CreditsHandler.cs +++ b/EXILED/Exiled.CreditTags/Events/CreditsHandler.cs @@ -9,6 +9,7 @@ namespace Exiled.CreditTags.Events { using Exiled.CreditTags.Features; using Exiled.Events.EventArgs.Player; + using MEC; using static CreditTags; diff --git a/EXILED/Exiled.CreditTags/Features/DatabaseHandler.cs b/EXILED/Exiled.CreditTags/Features/DatabaseHandler.cs index ac3cc91781..9092ae4056 100644 --- a/EXILED/Exiled.CreditTags/Features/DatabaseHandler.cs +++ b/EXILED/Exiled.CreditTags/Features/DatabaseHandler.cs @@ -12,6 +12,7 @@ namespace Exiled.CreditTags.Features using System.IO; using Cryptography; + using Exiled.API.Features; using Exiled.CreditTags.Enums; @@ -55,7 +56,7 @@ static DatabaseHandler() /// /// Gets the path to the cache directory. /// - private static DirectoryInfo CacheDirectory { get; } = new (Path.Combine(Paths.Configs, "CreditTags")); + private static DirectoryInfo CacheDirectory { get; } = new(Path.Combine(Paths.Configs, "CreditTags")); /// /// Gets the path to the cache file. diff --git a/EXILED/Exiled.CreditTags/Features/ThreadSafeRequest.cs b/EXILED/Exiled.CreditTags/Features/ThreadSafeRequest.cs index b6ceaee015..15aa4ae1e9 100644 --- a/EXILED/Exiled.CreditTags/Features/ThreadSafeRequest.cs +++ b/EXILED/Exiled.CreditTags/Features/ThreadSafeRequest.cs @@ -10,7 +10,9 @@ namespace Exiled.CreditTags.Features using System.Collections.Generic; using Exiled.API.Features; + using MEC; + using UnityEngine.Networking; internal sealed class ThreadSafeRequest diff --git a/EXILED/Exiled.CustomItems/API/EventArgs/OwnerEscapingEventArgs.cs b/EXILED/Exiled.CustomItems/API/EventArgs/OwnerEscapingEventArgs.cs index 54f478d7ce..219f9e8aba 100644 --- a/EXILED/Exiled.CustomItems/API/EventArgs/OwnerEscapingEventArgs.cs +++ b/EXILED/Exiled.CustomItems/API/EventArgs/OwnerEscapingEventArgs.cs @@ -7,18 +7,11 @@ namespace Exiled.CustomItems.API.EventArgs { - using System.Collections.Generic; - - using Exiled.API.Enums; using Exiled.API.Features; using Exiled.API.Features.Items; using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Player; - using PlayerRoles; - - using Respawning; - /// /// Contains all information of a before a escapes. /// diff --git a/EXILED/Exiled.CustomItems/API/Features/CustomArmor.cs b/EXILED/Exiled.CustomItems/API/Features/CustomArmor.cs index e6f1932905..4b1e23ef21 100644 --- a/EXILED/Exiled.CustomItems/API/Features/CustomArmor.cs +++ b/EXILED/Exiled.CustomItems/API/Features/CustomArmor.cs @@ -18,6 +18,7 @@ namespace Exiled.CustomItems.API.Features using Exiled.Events.EventArgs.Player; using InventorySystem.Items.Armor; + using MEC; /// @@ -82,7 +83,7 @@ public override void Give(Player player, bool displayMessage = true) if (AmmoLimits.Count != 0) armor.AmmoLimits = AmmoLimits; - if (AmmoLimits.Count != 0) + if (CategoryLimits.Count != 0) armor.CategoryLimits = CategoryLimits; player.AddItem(armor); diff --git a/EXILED/Exiled.CustomItems/API/Features/CustomGoggles.cs b/EXILED/Exiled.CustomItems/API/Features/CustomGoggles.cs index c9ed3a74b3..7ac099f9bd 100644 --- a/EXILED/Exiled.CustomItems/API/Features/CustomGoggles.cs +++ b/EXILED/Exiled.CustomItems/API/Features/CustomGoggles.cs @@ -187,7 +187,7 @@ private void InternalRemove(Player player, Scp1344 goggles) if (!Remove1344Effect) player.DisableEffect(EffectType.Scp1344); - player.DisableEffect(EffectType.Blinded); + player.DisableEffect(EffectType.Blindness); player.ReferenceHub?.DisableWearables(WearableElements.Scp1344Goggles); } @@ -245,4 +245,4 @@ private void RemoveSafely(ReferenceHub hub) } } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.CustomItems/API/Features/CustomGrenade.cs b/EXILED/Exiled.CustomItems/API/Features/CustomGrenade.cs index 48d725ce7e..00ee5157a5 100644 --- a/EXILED/Exiled.CustomItems/API/Features/CustomGrenade.cs +++ b/EXILED/Exiled.CustomItems/API/Features/CustomGrenade.cs @@ -11,18 +11,19 @@ namespace Exiled.CustomItems.API.Features using Exiled.API.Extensions; using Exiled.API.Features; - using Exiled.API.Features.Items; using Exiled.API.Features.Pickups; using Exiled.API.Features.Pickups.Projectiles; using Exiled.API.Features.Roles; using Exiled.Events.EventArgs.Map; using Exiled.Events.EventArgs.Player; - using Footprinting; + using InventorySystem; using InventorySystem.Items; using InventorySystem.Items.Pickups; using InventorySystem.Items.ThrowableProjectiles; + using Mirror; + using UnityEngine; using Object = UnityEngine.Object; @@ -70,31 +71,43 @@ public override ItemType Type /// The spawned. public virtual Pickup Throw(Vector3 position, float force, float weight, float fuseTime = 3f, ItemType grenadeType = ItemType.GrenadeHE, Player? player = null) { - if (player is null) - player = Server.Host; + player ??= Server.Host; + + Vector3 velocity = Vector3.zero; + Quaternion rotation = Quaternion.identity; + + if (player != Server.Host) + { + if (player.Role.Is(out FpcRole fpcRole)) + velocity = fpcRole.FirstPersonController.FpcModule.Motor.Velocity; - player.Role.Is(out FpcRole fpcRole); - Vector3 velocity = fpcRole.FirstPersonController.FpcModule.Motor.Velocity; + if (player.CameraTransform != null) + rotation = player.CameraTransform.rotation; + } - Throwable throwable = (Throwable)Item.Create(grenadeType, player); + InventoryItemLoader.TryGetItem(grenadeType, out ThrowableItem template); - ThrownProjectile thrownProjectile = Object.Instantiate(throwable.Base.Projectile, position, throwable.Owner.CameraTransform.rotation); + ThrownProjectile thrownProjectile = Object.Instantiate(template.Projectile, position, rotation); PickupSyncInfo newInfo = new() { - ItemId = throwable.Type, - Locked = !throwable.Base._repickupable, + ItemId = grenadeType, + Locked = !template._repickupable, Serial = ItemSerialGenerator.GenerateNext(), WeightKg = weight, }; + if (thrownProjectile is TimeGrenade time) time._fuseTime = fuseTime; + thrownProjectile.NetworkInfo = newInfo; - thrownProjectile.PreviousOwner = new Footprint(throwable.Owner.ReferenceHub); + thrownProjectile.PreviousOwner = player.Footprint; NetworkServer.Spawn(thrownProjectile.gameObject); thrownProjectile.InfoReceivedHook(default, newInfo); + if (thrownProjectile.TryGetComponent(out Rigidbody component)) - throwable.Base.PropelBody(component, throwable.Base.FullThrowSettings.StartTorque, ThrowableNetworkHandler.GetLimitedVelocity(velocity)); + template.PropelBody(component, template.FullThrowSettings.StartTorque, ThrowableNetworkHandler.GetLimitedVelocity(velocity)); + thrownProjectile.ServerActivate(); return Pickup.Get(thrownProjectile); @@ -209,4 +222,4 @@ private void OnInternalChangedIntoGrenade(ChangedIntoGrenadeEventArgs ev) ev.Projectile.GameObject.AddComponent().Init((ev.Pickup.PreviousOwner ?? Server.Host).GameObject, ev.Projectile.Base); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.CustomItems/API/Features/CustomItem.cs b/EXILED/Exiled.CustomItems/API/Features/CustomItem.cs index 789fd25ceb..2b7356c0b6 100644 --- a/EXILED/Exiled.CustomItems/API/Features/CustomItem.cs +++ b/EXILED/Exiled.CustomItems/API/Features/CustomItem.cs @@ -26,18 +26,21 @@ namespace Exiled.CustomItems.API.Features using Exiled.Events.EventArgs.Player; using Exiled.Events.EventArgs.Scp914; using Exiled.Loader; + using InventorySystem.Items.Pickups; + using MEC; + using PlayerRoles; + using UnityEngine; + using YamlDotNet.Serialization; using static CustomItems; - using BaseFirearmPickup = InventorySystem.Items.Firearms.FirearmPickup; using Firearm = Exiled.API.Features.Items.Firearm; using Item = Exiled.API.Features.Items.Item; - using Map = Exiled.API.Features.Map; using Player = Exiled.API.Features.Player; using UpgradingPickupEventArgs = Exiled.Events.EventArgs.Scp914.UpgradingPickupEventArgs; @@ -540,7 +543,7 @@ public static IEnumerable UnregisterItems(IEnumerable targetTy Pickup? pickup = Spawn(position, item, previousOwner); - UnityEngine.Object.Destroy(item.Base); + item.Destroy(); return pickup; } @@ -554,6 +557,7 @@ public static IEnumerable UnregisterItems(IEnumerable targetTy public virtual Pickup? Spawn(Vector3 position, Item item, Player? previousOwner = null) { Pickup? pickup = item.CreatePickup(position); + pickup.Scale = Scale; pickup.Weight = Weight; @@ -1105,4 +1109,4 @@ private void OnInternalUpgradingPickup(UpgradingPickupEventArgs ev) }); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.CustomItems/API/Features/CustomItem{T}.cs b/EXILED/Exiled.CustomItems/API/Features/CustomItem{T}.cs new file mode 100644 index 0000000000..65fd3bd07f --- /dev/null +++ b/EXILED/Exiled.CustomItems/API/Features/CustomItem{T}.cs @@ -0,0 +1,180 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) ExMod Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- +#pragma warning disable SA1402 // File may only contain a single type +namespace Exiled.CustomItems.API.Features +{ + using YamlDotNet.Serialization; + + /// + /// A generic base class for that provides a typed singleton . + /// + /// The concrete type. + public abstract class CustomItem : CustomItem + where T : CustomItem, new() + { + /// + /// Gets the singleton instance of this . + /// + [YamlIgnore] + public static T? Instance { get; private set; } + + /// + public override void Init() + { + base.Init(); + Instance = this as T; + } + + /// + public override void Destroy() + { + Instance = null; + base.Destroy(); + } + } + + /// + /// A generic base class for that provides a typed singleton . + /// + /// The concrete type. + public abstract class CustomWeapon : CustomWeapon + where T : CustomWeapon, new() + { + /// + /// Gets the singleton instance of this . + /// + [YamlIgnore] + public static T? Instance { get; private set; } + + /// + public override void Init() + { + base.Init(); + Instance = this as T; + } + + /// + public override void Destroy() + { + Instance = null; + base.Destroy(); + } + } + + /// + /// A generic base class for that provides a typed singleton . + /// + /// The concrete type. + public abstract class CustomKeycard : CustomKeycard + where T : CustomKeycard, new() + { + /// + /// Gets the singleton instance of this . + /// + [YamlIgnore] + public static T? Instance { get; private set; } + + /// + public override void Init() + { + base.Init(); + Instance = this as T; + } + + /// + public override void Destroy() + { + Instance = null; + base.Destroy(); + } + } + + /// + /// A generic base class for that provides a typed singleton . + /// + /// The concrete type. + public abstract class CustomGrenade : CustomGrenade + where T : CustomGrenade, new() + { + /// + /// Gets the singleton instance of this . + /// + [YamlIgnore] + public static T? Instance { get; private set; } + + /// + public override void Init() + { + base.Init(); + Instance = this as T; + } + + /// + public override void Destroy() + { + Instance = null; + base.Destroy(); + } + } + + /// + /// A generic base class for that provides a typed singleton . + /// + /// The concrete type. + public abstract class CustomArmor : CustomArmor + where T : CustomArmor, new() + { + /// + /// Gets the singleton instance of this . + /// + [YamlIgnore] + public static T? Instance { get; private set; } + + /// + public override void Init() + { + base.Init(); + Instance = this as T; + } + + /// + public override void Destroy() + { + Instance = null; + base.Destroy(); + } + } + + /// + /// A generic base class for that provides a typed singleton . + /// + /// The concrete type. + public abstract class CustomGoggles : CustomGoggles + where T : CustomGoggles, new() + { + /// + /// Gets the singleton instance of this . + /// + [YamlIgnore] + public static T? Instance { get; private set; } + + /// + public override void Init() + { + base.Init(); + Instance = this as T; + } + + /// + public override void Destroy() + { + Instance = null; + base.Destroy(); + } + } +} +#pragma warning restore SA1402 // File may only contain a single type \ No newline at end of file diff --git a/EXILED/Exiled.CustomItems/API/Features/CustomKeycard.cs b/EXILED/Exiled.CustomItems/API/Features/CustomKeycard.cs index 1777953129..3347c4b44f 100644 --- a/EXILED/Exiled.CustomItems/API/Features/CustomKeycard.cs +++ b/EXILED/Exiled.CustomItems/API/Features/CustomKeycard.cs @@ -21,7 +21,9 @@ namespace Exiled.CustomItems.API.Features using Exiled.API.Interfaces.Keycards; using Exiled.Events.EventArgs.Item; using Exiled.Events.EventArgs.Player; + using InventorySystem.Items.Keycards; + using UnityEngine; /// diff --git a/EXILED/Exiled.CustomItems/API/Features/CustomWeapon.cs b/EXILED/Exiled.CustomItems/API/Features/CustomWeapon.cs index 521fff7a41..64dda2185f 100644 --- a/EXILED/Exiled.CustomItems/API/Features/CustomWeapon.cs +++ b/EXILED/Exiled.CustomItems/API/Features/CustomWeapon.cs @@ -18,9 +18,11 @@ namespace Exiled.CustomItems.API.Features using Exiled.API.Features.Pickups; using Exiled.Events.EventArgs.Item; using Exiled.Events.EventArgs.Player; + using InventorySystem.Items.Firearms.Attachments; using InventorySystem.Items.Firearms.Attachments.Components; using InventorySystem.Items.Firearms.Modules; + using UnityEngine; using Firearm = Exiled.API.Features.Items.Firearm; @@ -71,7 +73,7 @@ public override ItemType Type { if (!Type.IsWeapon(false)) { - Log.Debug($"{nameof(Spawn)}: Item is not Firearm."); + Log.Warn($"{nameof(Spawn)}: Item is not Firearm."); return null; } @@ -83,7 +85,11 @@ public override ItemType Type if (!Attachments.IsEmpty()) firearm.AddAttachment(Attachments); - Pickup? pickup = firearm.CreatePickup(position); + if (ClipSize > 0) + firearm.MagazineAmmo = ClipSize; + + FirearmPickup? pickup = (FirearmPickup?)firearm.CreatePickup(position, spawn: false); + firearm.Destroy(); if (pickup is null) { @@ -91,15 +97,16 @@ public override ItemType Type return null; } - if (ClipSize > 0) - firearm.MagazineAmmo = ClipSize; - pickup.Weight = Weight; pickup.Scale = Scale; + if (previousOwner is not null) pickup.PreviousOwner = previousOwner; + pickup.Spawn(); + TrackedSerials.Add(pickup.Serial); + return pickup; } @@ -120,6 +127,7 @@ public override ItemType Type int ammo = firearm.MagazineAmmo; Log.Debug($"{nameof(Name)}.{nameof(Spawn)}: Spawning weapon with {ammo} ammo."); Pickup? pickup = firearm.CreatePickup(position); + pickup.Scale = Scale; if (previousOwner is not null) @@ -365,4 +373,4 @@ private void OnInternalChangingAttachment(ChangingAttachmentsEventArgs ev) OnChangingAttachment(ev); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.CustomItems/Commands/Give.cs b/EXILED/Exiled.CustomItems/Commands/Give.cs index cc63ed2228..d4083c6097 100644 --- a/EXILED/Exiled.CustomItems/Commands/Give.cs +++ b/EXILED/Exiled.CustomItems/Commands/Give.cs @@ -18,8 +18,6 @@ namespace Exiled.CustomItems.Commands using Exiled.Permissions.Extensions; using RemoteAdmin; - using UnityStandardAssets.Effects; - using Utils; /// /// The command to give a player an item. @@ -127,4 +125,4 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s /// private bool CheckEligible(Player player) => player.IsAlive && !player.IsCuffed && (player.Items.Count < 8); } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.CustomItems/Commands/Main.cs b/EXILED/Exiled.CustomItems/Commands/Main.cs index de3b3ad2f6..e3557d1a66 100644 --- a/EXILED/Exiled.CustomItems/Commands/Main.cs +++ b/EXILED/Exiled.CustomItems/Commands/Main.cs @@ -51,4 +51,4 @@ protected override bool ExecuteParent(ArraySegment arguments, ICommandSe return false; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.CustomItems/Events/MapHandler.cs b/EXILED/Exiled.CustomItems/Events/MapHandler.cs index ed1ae61970..bb9966ba01 100644 --- a/EXILED/Exiled.CustomItems/Events/MapHandler.cs +++ b/EXILED/Exiled.CustomItems/Events/MapHandler.cs @@ -9,6 +9,7 @@ namespace Exiled.CustomItems.Events { using Exiled.API.Features; using Exiled.CustomItems.API.Features; + using MEC; /// diff --git a/EXILED/Exiled.CustomItems/Patches/PlayerInventorySee.cs b/EXILED/Exiled.CustomItems/Patches/PlayerInventorySee.cs index 8efcc98fb7..da551cd4f1 100644 --- a/EXILED/Exiled.CustomItems/Patches/PlayerInventorySee.cs +++ b/EXILED/Exiled.CustomItems/Patches/PlayerInventorySee.cs @@ -76,4 +76,4 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstruction); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.CustomRoles/API/Extensions.cs b/EXILED/Exiled.CustomRoles/API/Extensions.cs index 8a0821216d..6cd23c603d 100644 --- a/EXILED/Exiled.CustomRoles/API/Extensions.cs +++ b/EXILED/Exiled.CustomRoles/API/Extensions.cs @@ -124,4 +124,4 @@ public static void Unregister(this IEnumerable customRoles) /// The the has selected, or . public static ActiveAbility? GetSelectedAbility(this Player player) => !ActiveAbility.AllActiveAbilities.TryGetValue(player, out HashSet abilities) ? null : abilities.FirstOrDefault(a => a.Check(player, CheckType.Selected)); } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.CustomRoles/API/Features/ActiveAbility.cs b/EXILED/Exiled.CustomRoles/API/Features/ActiveAbility.cs index cadc7c63f0..9b823fbf95 100644 --- a/EXILED/Exiled.CustomRoles/API/Features/ActiveAbility.cs +++ b/EXILED/Exiled.CustomRoles/API/Features/ActiveAbility.cs @@ -141,7 +141,7 @@ public virtual bool Check(Player player, CheckType type) CheckType.Active => ActivePlayers.Contains(player), CheckType.Selected => SelectedPlayers.Contains(player), CheckType.Available => Players.Contains(player), - _ => throw new ArgumentOutOfRangeException(nameof(type), type, null) + _ => throw new ArgumentOutOfRangeException(nameof(type), type, null), }; return result; diff --git a/EXILED/Exiled.CustomRoles/API/Features/CustomAbility.cs b/EXILED/Exiled.CustomRoles/API/Features/CustomAbility.cs index 1528d08fa3..91198b9e3b 100644 --- a/EXILED/Exiled.CustomRoles/API/Features/CustomAbility.cs +++ b/EXILED/Exiled.CustomRoles/API/Features/CustomAbility.cs @@ -166,8 +166,7 @@ public static IEnumerable RegisterAbilities(bool skipReflection = } } - if (customAbility is null) - customAbility = (CustomAbility)Activator.CreateInstance(type); + customAbility ??= (CustomAbility)Activator.CreateInstance(type); if (customAbility.TryRegister()) abilities.Add(customAbility); @@ -209,8 +208,7 @@ public static IEnumerable RegisterAbilities(IEnumerable tar } } - if (customAbility is null) - customAbility = (CustomAbility)Activator.CreateInstance(type); + customAbility ??= (CustomAbility)Activator.CreateInstance(type); if (customAbility.TryRegister()) abilities.Add(customAbility); @@ -311,7 +309,7 @@ public void RemoveAbility(Player player) /// True if the ability registered properly. internal bool TryRegister() { - if (!CustomRoles.Instance!.Config.IsEnabled) + if (!CustomRoles.Instance.Config.IsEnabled) return false; if (!Registered.Contains(this)) diff --git a/EXILED/Exiled.CustomRoles/API/Features/CustomRole.cs b/EXILED/Exiled.CustomRoles/API/Features/CustomRole.cs index add0d807d1..7c64fcb426 100644 --- a/EXILED/Exiled.CustomRoles/API/Features/CustomRole.cs +++ b/EXILED/Exiled.CustomRoles/API/Features/CustomRole.cs @@ -25,8 +25,11 @@ namespace Exiled.CustomRoles.API.Features using Exiled.CustomItems.API.Features; using Exiled.Events.EventArgs.Player; using Exiled.Loader; + using InventorySystem.Configs; + using MEC; + using PlayerRoles; using UnityEngine; @@ -718,7 +721,7 @@ public virtual void AddRole(Player player) ability.AddAbility(player); } - if (CustomRoles.Instance!.Config.GotRoleHint.Show) + if (CustomRoles.Instance.Config.GotRoleHint.Show) ShowMessage(player); ShowBroadcast(player); @@ -882,7 +885,7 @@ public bool TryAddFriendlyFire(Dictionary ffRules, bool overw /// True if the role registered properly. internal bool TryRegister() { - if (!CustomRoles.Instance!.Config.IsEnabled) + if (!CustomRoles.Instance.Config.IsEnabled) return false; if (!IsEnabled) @@ -973,7 +976,7 @@ protected Vector3 GetSpawnPosition() } float totalchance = 0f; - List<(float chance, Vector3 pos)> spawnPointPool = new(4); + List<(float Chance, Vector3 Pos)> spawnPointPool = new(4); void Add(Vector3 pos, float chance) { @@ -1066,7 +1069,7 @@ protected virtual void UnsubscribeEvents() /// Shows the spawn message to the player. /// /// The to show the message to. - protected virtual void ShowMessage(Player player) => player.ShowHint(string.Format(CustomRoles.Instance!.Config.GotRoleHint.Content, Name, Description), CustomRoles.Instance.Config.GotRoleHint.Duration); + protected virtual void ShowMessage(Player player) => player.ShowHint(string.Format(CustomRoles.Instance.Config.GotRoleHint.Content, Name, Description), CustomRoles.Instance.Config.GotRoleHint.Duration); /// /// Shows the spawn broadcast to the player. diff --git a/EXILED/Exiled.CustomRoles/API/Features/CustomRole{T}.cs b/EXILED/Exiled.CustomRoles/API/Features/CustomRole{T}.cs new file mode 100644 index 0000000000..5d4149e8c5 --- /dev/null +++ b/EXILED/Exiled.CustomRoles/API/Features/CustomRole{T}.cs @@ -0,0 +1,39 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) ExMod Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.CustomRoles.API.Features +{ + using YamlDotNet.Serialization; + + /// + /// A generic base class for that provides a typed singleton . + /// + /// The concrete type. + public abstract class CustomRole : CustomRole + where T : CustomRole, new() + { + /// + /// Gets the singleton instance of this . + /// + [YamlIgnore] + public static T? Instance { get; private set; } + + /// + public override void Init() + { + base.Init(); + Instance = this as T; + } + + /// + public override void Destroy() + { + Instance = null; + base.Destroy(); + } + } +} \ No newline at end of file diff --git a/EXILED/Exiled.CustomRoles/API/Features/Enums/KeypressActivationType.cs b/EXILED/Exiled.CustomRoles/API/Features/Enums/AbilityKeypressTriggerType.cs similarity index 93% rename from EXILED/Exiled.CustomRoles/API/Features/Enums/KeypressActivationType.cs rename to EXILED/Exiled.CustomRoles/API/Features/Enums/AbilityKeypressTriggerType.cs index d63845ff70..3ba1d84bc7 100644 --- a/EXILED/Exiled.CustomRoles/API/Features/Enums/KeypressActivationType.cs +++ b/EXILED/Exiled.CustomRoles/API/Features/Enums/AbilityKeypressTriggerType.cs @@ -1,5 +1,5 @@ // ----------------------------------------------------------------------- -// +// // Copyright (c) ExMod Team. All rights reserved. // Licensed under the CC BY-SA 3.0 license. // diff --git a/EXILED/Exiled.CustomRoles/API/Features/Enums/CheckType.cs b/EXILED/Exiled.CustomRoles/API/Features/Enums/CheckType.cs index fb636665a8..5e6ba3ab31 100644 --- a/EXILED/Exiled.CustomRoles/API/Features/Enums/CheckType.cs +++ b/EXILED/Exiled.CustomRoles/API/Features/Enums/CheckType.cs @@ -13,7 +13,7 @@ namespace Exiled.CustomRoles.API.Features.Enums public enum CheckType { /// - /// Check if the ability is available to the player. (DOES NOT CHECK COOLDOWNS) + /// Check if the ability is available to the player. (DOES NOT CHECK COOLDOWNS). /// Available, diff --git a/EXILED/Exiled.CustomRoles/API/Features/Parsers/AggregateExpectationTypeResolver.cs b/EXILED/Exiled.CustomRoles/API/Features/Parsers/AggregateExpectationTypeResolver.cs index 0807e0a79a..cf767d294c 100644 --- a/EXILED/Exiled.CustomRoles/API/Features/Parsers/AggregateExpectationTypeResolver.cs +++ b/EXILED/Exiled.CustomRoles/API/Features/Parsers/AggregateExpectationTypeResolver.cs @@ -52,7 +52,7 @@ public AggregateExpectationTypeResolver(INamingConvention namingConvention) } /// - public Type BaseType => typeof(CustomAbility); + public Type BaseType => field ??= typeof(CustomAbility); /// public bool TryResolve(ParsingEventBuffer buffer, out Type? suggestedType) diff --git a/EXILED/Exiled.CustomRoles/Commands/Get.cs b/EXILED/Exiled.CustomRoles/Commands/Get.cs index 7d96d5f6b4..acaf661554 100644 --- a/EXILED/Exiled.CustomRoles/Commands/Get.cs +++ b/EXILED/Exiled.CustomRoles/Commands/Get.cs @@ -14,13 +14,13 @@ namespace Exiled.CustomRoles.Commands using System.Text; using CommandSystem; + using Exiled.API.Extensions; using Exiled.API.Features; using Exiled.API.Features.Pools; using Exiled.CustomRoles.API; using Exiled.CustomRoles.API.Features; using Exiled.Permissions.Extensions; - using HarmonyLib; /// /// The command to get specified player(s) current custom roles. diff --git a/EXILED/Exiled.CustomRoles/Commands/Parent.cs b/EXILED/Exiled.CustomRoles/Commands/Parent.cs index eca719d667..c5a46a0e7a 100644 --- a/EXILED/Exiled.CustomRoles/Commands/Parent.cs +++ b/EXILED/Exiled.CustomRoles/Commands/Parent.cs @@ -51,4 +51,4 @@ protected override bool ExecuteParent(ArraySegment arguments, ICommandSe return false; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.CustomRoles/CustomRoles.cs b/EXILED/Exiled.CustomRoles/CustomRoles.cs index a66457b3bd..fc7a3e4333 100644 --- a/EXILED/Exiled.CustomRoles/CustomRoles.cs +++ b/EXILED/Exiled.CustomRoles/CustomRoles.cs @@ -82,4 +82,4 @@ public override void OnDisabled() base.OnDisabled(); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.CustomRoles/Events/PlayerHandlers.cs b/EXILED/Exiled.CustomRoles/Events/PlayerHandlers.cs index 38ed195d64..7bad2cc83e 100644 --- a/EXILED/Exiled.CustomRoles/Events/PlayerHandlers.cs +++ b/EXILED/Exiled.CustomRoles/Events/PlayerHandlers.cs @@ -7,9 +7,7 @@ namespace Exiled.CustomRoles.Events { - using System; using System.Collections.Generic; - using System.Threading; using Exiled.API.Enums; using Exiled.API.Features; diff --git a/EXILED/Exiled.Events/Commands/Config/Merge.cs b/EXILED/Exiled.Events/Commands/Config/Merge.cs index c6cf79042d..c8d5ff08b1 100644 --- a/EXILED/Exiled.Events/Commands/Config/Merge.cs +++ b/EXILED/Exiled.Events/Commands/Config/Merge.cs @@ -9,12 +9,13 @@ namespace Exiled.Events.Commands.Config { using System; using System.Collections.Generic; - using System.Linq; - using API.Enums; - using API.Features; - using API.Interfaces; using CommandSystem; + + using Exiled.API.Enums; + using Exiled.API.Features; + using Exiled.API.Interfaces; + using Loader; /// diff --git a/EXILED/Exiled.Events/Commands/Config/Split.cs b/EXILED/Exiled.Events/Commands/Config/Split.cs index 34816af579..a083e4388c 100644 --- a/EXILED/Exiled.Events/Commands/Config/Split.cs +++ b/EXILED/Exiled.Events/Commands/Config/Split.cs @@ -9,12 +9,13 @@ namespace Exiled.Events.Commands.Config { using System; using System.Collections.Generic; - using System.Linq; - using API.Enums; - using API.Features; - using API.Interfaces; using CommandSystem; + + using Exiled.API.Enums; + using Exiled.API.Features; + using Exiled.API.Interfaces; + using Loader; /// diff --git a/EXILED/Exiled.Events/Commands/PluginManager/Disable.cs b/EXILED/Exiled.Events/Commands/PluginManager/Disable.cs index 4169b84cd7..54fc5e4260 100644 --- a/EXILED/Exiled.Events/Commands/PluginManager/Disable.cs +++ b/EXILED/Exiled.Events/Commands/PluginManager/Disable.cs @@ -9,9 +9,11 @@ namespace Exiled.Events.Commands.PluginManager { using System; - using API.Interfaces; using CommandSystem; + + using Exiled.API.Interfaces; using Exiled.Permissions.Extensions; + using RemoteAdmin; /// diff --git a/EXILED/Exiled.Events/Commands/PluginManager/Enable.cs b/EXILED/Exiled.Events/Commands/PluginManager/Enable.cs index 36b6aa1ecd..59350f2500 100644 --- a/EXILED/Exiled.Events/Commands/PluginManager/Enable.cs +++ b/EXILED/Exiled.Events/Commands/PluginManager/Enable.cs @@ -12,10 +12,12 @@ namespace Exiled.Events.Commands.PluginManager using System.Linq; using System.Reflection; - using API.Interfaces; using CommandSystem; + using Exiled.API.Features; + using Exiled.API.Interfaces; using Exiled.Permissions.Extensions; + using RemoteAdmin; /// @@ -92,4 +94,4 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s return true; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Commands/PluginManager/PluginManager.cs b/EXILED/Exiled.Events/Commands/PluginManager/PluginManager.cs index 1f9a62c13d..f789174a33 100644 --- a/EXILED/Exiled.Events/Commands/PluginManager/PluginManager.cs +++ b/EXILED/Exiled.Events/Commands/PluginManager/PluginManager.cs @@ -39,4 +39,4 @@ protected override bool ExecuteParent(ArraySegment arguments, ICommandSe return false; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Commands/PluginManager/Show.cs b/EXILED/Exiled.Events/Commands/PluginManager/Show.cs index 0b9f4d5459..edaac0d85e 100644 --- a/EXILED/Exiled.Events/Commands/PluginManager/Show.cs +++ b/EXILED/Exiled.Events/Commands/PluginManager/Show.cs @@ -12,11 +12,10 @@ namespace Exiled.Events.Commands.PluginManager using System.Linq; using System.Text; - using API.Features.Pools; - using API.Interfaces; - using CommandSystem; + using Exiled.API.Features.Pools; + using Exiled.API.Interfaces; using Exiled.Permissions.Extensions; using RemoteAdmin; diff --git a/EXILED/Exiled.Events/Commands/Reload/Configs.cs b/EXILED/Exiled.Events/Commands/Reload/Configs.cs index 05f75a07ed..12beb34a1b 100644 --- a/EXILED/Exiled.Events/Commands/Reload/Configs.cs +++ b/EXILED/Exiled.Events/Commands/Reload/Configs.cs @@ -9,10 +9,9 @@ namespace Exiled.Events.Commands.Reload { using System; - using API.Interfaces; - using CommandSystem; + using Exiled.API.Interfaces; using Exiled.Permissions.Extensions; using Loader; @@ -63,4 +62,4 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s return haveBeenReloaded; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Commands/Reload/Translations.cs b/EXILED/Exiled.Events/Commands/Reload/Translations.cs index 99459b3f19..d2c4132b0d 100644 --- a/EXILED/Exiled.Events/Commands/Reload/Translations.cs +++ b/EXILED/Exiled.Events/Commands/Reload/Translations.cs @@ -9,10 +9,9 @@ namespace Exiled.Events.Commands.Reload { using System; - using API.Interfaces; - using CommandSystem; + using Exiled.API.Interfaces; using Exiled.Permissions.Extensions; using Loader; diff --git a/EXILED/Exiled.Events/Commands/TpsCommand.cs b/EXILED/Exiled.Events/Commands/TpsCommand.cs index 14c0def05e..15ca3d44c9 100644 --- a/EXILED/Exiled.Events/Commands/TpsCommand.cs +++ b/EXILED/Exiled.Events/Commands/TpsCommand.cs @@ -10,6 +10,7 @@ namespace Exiled.Events.Commands using System; using CommandSystem; + using Exiled.API.Features; /// @@ -35,7 +36,7 @@ public bool Execute(ArraySegment arguments, ICommandSender sender, out s { > 0.9 => "green", > 0.5 => "yellow", - _ => "red" + _ => "red", }; response = $"{Server.SmoothTps}/{Server.MaxTps}"; diff --git a/EXILED/Exiled.Events/Config.cs b/EXILED/Exiled.Events/Config.cs index fd244f699b..c4f94d76a8 100644 --- a/EXILED/Exiled.Events/Config.cs +++ b/EXILED/Exiled.Events/Config.cs @@ -9,7 +9,7 @@ namespace Exiled.Events { using System.ComponentModel; - using API.Interfaces; + using Exiled.API.Interfaces; /// public sealed class Config : IConfig @@ -111,4 +111,4 @@ public sealed class Config : IConfig [Description("Whether to log RA commands.")] public bool LogRaCommands { get; set; } = true; } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Cassie/SendingCassieMessageEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Cassie/SendingCassieMessageEventArgs.cs index abd2f4877f..c7c2c633df 100644 --- a/EXILED/Exiled.Events/EventArgs/Cassie/SendingCassieMessageEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Cassie/SendingCassieMessageEventArgs.cs @@ -11,8 +11,11 @@ namespace Exiled.Events.EventArgs.Cassie using System.Text; using Exiled.API.Features.Pools; + using global::Cassie; + using Interfaces; + using Subtitles; /// @@ -20,12 +23,8 @@ namespace Exiled.Events.EventArgs.Cassie /// public class SendingCassieMessageEventArgs : IDeniableEvent { - private readonly CassieAnnouncement announcement; private readonly CassieTtsPayload payload; - private string customSubtitles; - private float glitchScale; - /// /// Initializes a new instance of the class. /// @@ -35,7 +34,7 @@ public class SendingCassieMessageEventArgs : IDeniableEvent /// public SendingCassieMessageEventArgs(CassieAnnouncement annc, bool isAllowed = true) { - announcement = annc; + Announcement = annc; payload = annc.Payload; Words = payload.Content; @@ -84,13 +83,13 @@ public SendingCassieMessageEventArgs(CassieAnnouncement annc, bool isAllowed = t /// public string CustomSubtitles { - get => customSubtitles; + get; set { - if (customSubtitles != value) + if (field != value) SubtitleSource = CassieTtsPayload.SubtitleMode.Custom; - customSubtitles = value; + field = value; } } @@ -104,13 +103,13 @@ public string CustomSubtitles /// public float GlitchScale { - get => glitchScale; + get; set { if (!MakeNoise && value is not 0) MakeNoise = true; - glitchScale = value; + field = value; } } @@ -157,7 +156,7 @@ public CassieAnnouncement Announcement newPayload = new CassieTtsPayload(Words, CustomSubtitles, MakeHold); } - return announcement switch + return field switch { CassieScpTerminationAnnouncement => @@ -169,6 +168,7 @@ public CassieAnnouncement Announcement _ => new CassieAnnouncement(newPayload, 0, GlitchScale / (API.Features.Warhead.IsDetonated ? 2F : 1F) * (MakeNoise ? 1F : 0F)), }; } + private set; } } } \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Interfaces/IAttackerEvent.cs b/EXILED/Exiled.Events/EventArgs/Interfaces/IAttackerEvent.cs index bb523f3d75..7abe187114 100644 --- a/EXILED/Exiled.Events/EventArgs/Interfaces/IAttackerEvent.cs +++ b/EXILED/Exiled.Events/EventArgs/Interfaces/IAttackerEvent.cs @@ -7,8 +7,8 @@ namespace Exiled.Events.EventArgs.Interfaces { - using API.Features; - using API.Features.DamageHandlers; + using Exiled.API.Features; + using Exiled.API.Features.DamageHandlers; /// /// Event args for when a player is taking damage. diff --git a/EXILED/Exiled.Events/EventArgs/Interfaces/ICameraEvent.cs b/EXILED/Exiled.Events/EventArgs/Interfaces/ICameraEvent.cs index 8c44ab58b6..d86189d40b 100644 --- a/EXILED/Exiled.Events/EventArgs/Interfaces/ICameraEvent.cs +++ b/EXILED/Exiled.Events/EventArgs/Interfaces/ICameraEvent.cs @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Interfaces { - using API.Features; + using Exiled.API.Features; /// /// Event args used for all related events. diff --git a/EXILED/Exiled.Events/EventArgs/Interfaces/IConsumableEvent.cs b/EXILED/Exiled.Events/EventArgs/Interfaces/IConsumableEvent.cs index eaa1babdcc..1a8711d078 100644 --- a/EXILED/Exiled.Events/EventArgs/Interfaces/IConsumableEvent.cs +++ b/EXILED/Exiled.Events/EventArgs/Interfaces/IConsumableEvent.cs @@ -19,4 +19,4 @@ public interface IConsumableEvent : IItemEvent /// public Consumable Consumable { get; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Interfaces/IFirearmEvent.cs b/EXILED/Exiled.Events/EventArgs/Interfaces/IFirearmEvent.cs index 0cf0ba2810..f27c8c0ec6 100644 --- a/EXILED/Exiled.Events/EventArgs/Interfaces/IFirearmEvent.cs +++ b/EXILED/Exiled.Events/EventArgs/Interfaces/IFirearmEvent.cs @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Interfaces { - using API.Features.Items; + using Exiled.API.Features.Items; /// /// Event args used for all related events. diff --git a/EXILED/Exiled.Events/EventArgs/Interfaces/IGeneratorEvent.cs b/EXILED/Exiled.Events/EventArgs/Interfaces/IGeneratorEvent.cs index 5cddb0a8fb..265aa5a2d7 100644 --- a/EXILED/Exiled.Events/EventArgs/Interfaces/IGeneratorEvent.cs +++ b/EXILED/Exiled.Events/EventArgs/Interfaces/IGeneratorEvent.cs @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Interfaces { - using API.Features; + using Exiled.API.Features; /// /// Event args used for all related events. diff --git a/EXILED/Exiled.Events/EventArgs/Interfaces/IItemEvent.cs b/EXILED/Exiled.Events/EventArgs/Interfaces/IItemEvent.cs index c2fcb61da9..bde0b9c466 100644 --- a/EXILED/Exiled.Events/EventArgs/Interfaces/IItemEvent.cs +++ b/EXILED/Exiled.Events/EventArgs/Interfaces/IItemEvent.cs @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Interfaces { - using API.Features.Items; + using Exiled.API.Features.Items; /// /// Event args used for all related events. diff --git a/EXILED/Exiled.Events/EventArgs/Interfaces/IMicroHIDEvent.cs b/EXILED/Exiled.Events/EventArgs/Interfaces/IMicroHIDEvent.cs index bc17988cc2..ee42510c79 100644 --- a/EXILED/Exiled.Events/EventArgs/Interfaces/IMicroHIDEvent.cs +++ b/EXILED/Exiled.Events/EventArgs/Interfaces/IMicroHIDEvent.cs @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Interfaces { - using API.Features.Items; + using Exiled.API.Features.Items; /// /// Event args used for all related events. diff --git a/EXILED/Exiled.Events/EventArgs/Interfaces/IPlayerEvent.cs b/EXILED/Exiled.Events/EventArgs/Interfaces/IPlayerEvent.cs index fec096f0b3..2f2e7d9962 100644 --- a/EXILED/Exiled.Events/EventArgs/Interfaces/IPlayerEvent.cs +++ b/EXILED/Exiled.Events/EventArgs/Interfaces/IPlayerEvent.cs @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Interfaces { - using API.Features; + using Exiled.API.Features; /// /// Event args used for all related events. diff --git a/EXILED/Exiled.Events/EventArgs/Interfaces/IRagdollEvent.cs b/EXILED/Exiled.Events/EventArgs/Interfaces/IRagdollEvent.cs index c15fbc028a..1889c43cd7 100644 --- a/EXILED/Exiled.Events/EventArgs/Interfaces/IRagdollEvent.cs +++ b/EXILED/Exiled.Events/EventArgs/Interfaces/IRagdollEvent.cs @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Interfaces { - using API.Features; + using Exiled.API.Features; /// /// Event args used for all related events. diff --git a/EXILED/Exiled.Events/EventArgs/Interfaces/IRoomEvent.cs b/EXILED/Exiled.Events/EventArgs/Interfaces/IRoomEvent.cs index 0ff4df980b..64bac5ca77 100644 --- a/EXILED/Exiled.Events/EventArgs/Interfaces/IRoomEvent.cs +++ b/EXILED/Exiled.Events/EventArgs/Interfaces/IRoomEvent.cs @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Interfaces { - using API.Features; + using Exiled.API.Features; /// /// Event args used for all related events. diff --git a/EXILED/Exiled.Events/EventArgs/Interfaces/ITeslaEvent.cs b/EXILED/Exiled.Events/EventArgs/Interfaces/ITeslaEvent.cs index 7f79c1b15d..fcc91cc850 100644 --- a/EXILED/Exiled.Events/EventArgs/Interfaces/ITeslaEvent.cs +++ b/EXILED/Exiled.Events/EventArgs/Interfaces/ITeslaEvent.cs @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Interfaces { - using API.Features; + using Exiled.API.Features; /// /// Event args used for all related events. diff --git a/EXILED/Exiled.Events/EventArgs/Item/CacklingEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Item/CacklingEventArgs.cs index 8e491ee0b1..995daa4b2f 100644 --- a/EXILED/Exiled.Events/EventArgs/Item/CacklingEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Item/CacklingEventArgs.cs @@ -10,6 +10,7 @@ namespace Exiled.Events.EventArgs.Item using Exiled.API.Features; using Exiled.API.Features.Items; using Exiled.Events.EventArgs.Interfaces; + using InventorySystem.Items.MarshmallowMan; /// diff --git a/EXILED/Exiled.Events/EventArgs/Item/ChangingAmmoEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Item/ChangingAmmoEventArgs.cs index 6e76f8b7a6..f339e8c5ed 100644 --- a/EXILED/Exiled.Events/EventArgs/Item/ChangingAmmoEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Item/ChangingAmmoEventArgs.cs @@ -65,4 +65,4 @@ public ChangingAmmoEventArgs(InventorySystem.Items.ItemBase firearm, byte oldAmm /// public bool IsAllowed { get; set; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Item/ChangingAttachmentsEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Item/ChangingAttachmentsEventArgs.cs index 6f4dc2ef60..d8dcfc1883 100644 --- a/EXILED/Exiled.Events/EventArgs/Item/ChangingAttachmentsEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Item/ChangingAttachmentsEventArgs.cs @@ -10,11 +10,10 @@ namespace Exiled.Events.EventArgs.Item using System.Collections.Generic; using System.Linq; - using API.Features; - using API.Features.Items; - using API.Structs; - using Exiled.API.Extensions; + using Exiled.API.Features; + using Exiled.API.Features.Items; + using Exiled.API.Structs; using Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Item/ChangingMicroHIDPickupStateEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Item/ChangingMicroHIDPickupStateEventArgs.cs index a70c37fde7..510a4718d6 100644 --- a/EXILED/Exiled.Events/EventArgs/Item/ChangingMicroHIDPickupStateEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Item/ChangingMicroHIDPickupStateEventArgs.cs @@ -10,6 +10,7 @@ namespace Exiled.Events.EventArgs.Item using Exiled.API.Features.Pickups; using Interfaces; + using InventorySystem.Items.MicroHID.Modules; using InventorySystem.Items.Pickups; diff --git a/EXILED/Exiled.Events/EventArgs/Item/ChargingJailbirdEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Item/ChargingJailbirdEventArgs.cs index 98f2588187..e9ec5fd5ea 100644 --- a/EXILED/Exiled.Events/EventArgs/Item/ChargingJailbirdEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Item/ChargingJailbirdEventArgs.cs @@ -49,4 +49,4 @@ public ChargingJailbirdEventArgs(ReferenceHub player, InventorySystem.Items.Item /// public bool IsAllowed { get; set; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Item/DisruptorFiringEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Item/DisruptorFiringEventArgs.cs index ad3feef017..4252578733 100644 --- a/EXILED/Exiled.Events/EventArgs/Item/DisruptorFiringEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Item/DisruptorFiringEventArgs.cs @@ -8,9 +8,10 @@ namespace Exiled.Events.EventArgs.Item { using Exiled.API.Features.Pickups; + using Interfaces; + using InventorySystem.Items.Firearms.Modules; - using InventorySystem.Items.Pickups; /// /// Contains all information before a pickup shoot while on the ground. diff --git a/EXILED/Exiled.Events/EventArgs/Item/InspectedItemEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Item/InspectedItemEventArgs.cs index 283fd4910f..23c20404b1 100644 --- a/EXILED/Exiled.Events/EventArgs/Item/InspectedItemEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Item/InspectedItemEventArgs.cs @@ -1,4 +1,4 @@ -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- // // Copyright (c) ExMod Team. All rights reserved. // Licensed under the CC BY-SA 3.0 license. @@ -10,6 +10,7 @@ namespace Exiled.Events.EventArgs.Item using Exiled.API.Features; using Exiled.API.Features.Items; using Exiled.Events.EventArgs.Interfaces; + using InventorySystem.Items; /// diff --git a/EXILED/Exiled.Events/EventArgs/Item/InspectingItemEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Item/InspectingItemEventArgs.cs index 5bb7cb4077..2e51f8d305 100644 --- a/EXILED/Exiled.Events/EventArgs/Item/InspectingItemEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Item/InspectingItemEventArgs.cs @@ -1,4 +1,4 @@ -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- // // Copyright (c) ExMod Team. All rights reserved. // Licensed under the CC BY-SA 3.0 license. @@ -10,6 +10,7 @@ namespace Exiled.Events.EventArgs.Item using Exiled.API.Features; using Exiled.API.Features.Items; using Exiled.Events.EventArgs.Interfaces; + using InventorySystem.Items; /// diff --git a/EXILED/Exiled.Events/EventArgs/Item/JailbirdChangedWearStateEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Item/JailbirdChangedWearStateEventArgs.cs index 1bfbcd529e..f7fe990ce5 100644 --- a/EXILED/Exiled.Events/EventArgs/Item/JailbirdChangedWearStateEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Item/JailbirdChangedWearStateEventArgs.cs @@ -10,6 +10,7 @@ namespace Exiled.Events.EventArgs.Item using Exiled.API.Features; using Exiled.API.Features.Items; using Exiled.Events.EventArgs.Interfaces; + using InventorySystem.Items.Jailbird; /// @@ -56,4 +57,4 @@ public JailbirdChangedWearStateEventArgs(InventorySystem.Items.ItemBase jailbird /// public Item Item => Jailbird; } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Item/JailbirdChangingWearStateEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Item/JailbirdChangingWearStateEventArgs.cs index bf7ac51d95..31c15e72e6 100644 --- a/EXILED/Exiled.Events/EventArgs/Item/JailbirdChangingWearStateEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Item/JailbirdChangingWearStateEventArgs.cs @@ -10,6 +10,7 @@ namespace Exiled.Events.EventArgs.Item using Exiled.API.Features; using Exiled.API.Features.Items; using Exiled.Events.EventArgs.Interfaces; + using InventorySystem.Items.Jailbird; /// @@ -61,4 +62,4 @@ public JailbirdChangingWearStateEventArgs(InventorySystem.Items.ItemBase jailbir /// public bool IsAllowed { get; set; } = true; } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Item/JailbirdChargeCompleteEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Item/JailbirdChargeCompleteEventArgs.cs index d583f22b3f..f6adb9770b 100644 --- a/EXILED/Exiled.Events/EventArgs/Item/JailbirdChargeCompleteEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Item/JailbirdChargeCompleteEventArgs.cs @@ -49,4 +49,4 @@ public JailbirdChargeCompleteEventArgs(ReferenceHub player, InventorySystem.Item /// public bool IsAllowed { get; set; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Item/KeycardInteractingEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Item/KeycardInteractingEventArgs.cs index 11f82ddbb4..50b8b39e49 100644 --- a/EXILED/Exiled.Events/EventArgs/Item/KeycardInteractingEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Item/KeycardInteractingEventArgs.cs @@ -11,6 +11,7 @@ namespace Exiled.Events.EventArgs.Item using Exiled.API.Features.Doors; using Exiled.API.Features.Pickups; using Exiled.Events.EventArgs.Interfaces; + using Interactables.Interobjects.DoorUtils; using BaseKeycardPickup = InventorySystem.Items.Keycards.KeycardPickup; diff --git a/EXILED/Exiled.Events/EventArgs/Item/PunchingEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Item/PunchingEventArgs.cs index d2d927d95a..ab58078c81 100644 --- a/EXILED/Exiled.Events/EventArgs/Item/PunchingEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Item/PunchingEventArgs.cs @@ -10,6 +10,7 @@ namespace Exiled.Events.EventArgs.Item using Exiled.API.Features; using Exiled.API.Features.Items; using Exiled.Events.EventArgs.Interfaces; + using InventorySystem.Items.MarshmallowMan; /// diff --git a/EXILED/Exiled.Events/EventArgs/Item/ReceivingPreferenceEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Item/ReceivingPreferenceEventArgs.cs index a7cdb73f70..3d6764df0a 100644 --- a/EXILED/Exiled.Events/EventArgs/Item/ReceivingPreferenceEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Item/ReceivingPreferenceEventArgs.cs @@ -10,11 +10,10 @@ namespace Exiled.Events.EventArgs.Item using System.Collections.Generic; using System.Linq; - using API.Features; - using API.Structs; - using Exiled.API.Enums; using Exiled.API.Extensions; + using Exiled.API.Features; + using Exiled.API.Structs; using Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Item/SwingingEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Item/SwingingEventArgs.cs index 0d97d9da16..8c768a5379 100644 --- a/EXILED/Exiled.Events/EventArgs/Item/SwingingEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Item/SwingingEventArgs.cs @@ -49,4 +49,4 @@ public SwingingEventArgs(ReferenceHub player, InventorySystem.Items.ItemBase swi /// public bool IsAllowed { get; set; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Map/AnnouncingChaosEntranceEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Map/AnnouncingChaosEntranceEventArgs.cs index e0e7fb8931..1e6ec08d27 100644 --- a/EXILED/Exiled.Events/EventArgs/Map/AnnouncingChaosEntranceEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Map/AnnouncingChaosEntranceEventArgs.cs @@ -1,4 +1,4 @@ -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- // // Copyright (c) ExMod Team. All rights reserved. // Licensed under the CC BY-SA 3.0 license. @@ -11,6 +11,7 @@ namespace Exiled.Events.EventArgs.Map using Exiled.API.Features.Waves; using Exiled.Events.EventArgs.Interfaces; + using Respawning.Announcements; /// diff --git a/EXILED/Exiled.Events/EventArgs/Map/AnnouncingNtfEntranceEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Map/AnnouncingNtfEntranceEventArgs.cs index fd5a8f417e..0d3e0121d9 100644 --- a/EXILED/Exiled.Events/EventArgs/Map/AnnouncingNtfEntranceEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Map/AnnouncingNtfEntranceEventArgs.cs @@ -8,7 +8,9 @@ namespace Exiled.Events.EventArgs.Map { using Exiled.API.Features.Waves; + using Interfaces; + using Respawning.Announcements; /// diff --git a/EXILED/Exiled.Events/EventArgs/Map/AnnouncingScpTerminationEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Map/AnnouncingScpTerminationEventArgs.cs index d8d38cc474..b693cfc0b9 100644 --- a/EXILED/Exiled.Events/EventArgs/Map/AnnouncingScpTerminationEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Map/AnnouncingScpTerminationEventArgs.cs @@ -9,9 +9,10 @@ namespace Exiled.Events.EventArgs.Map { using System; - using API.Features; - using API.Features.DamageHandlers; - using API.Features.Roles; + using Exiled.API.Features; + using Exiled.API.Features.DamageHandlers; + using Exiled.API.Features.Roles; + using Interfaces; /// diff --git a/EXILED/Exiled.Events/EventArgs/Map/ChangedIntoGrenadeEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Map/ChangedIntoGrenadeEventArgs.cs index 197c741949..e0439cfbe8 100644 --- a/EXILED/Exiled.Events/EventArgs/Map/ChangedIntoGrenadeEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Map/ChangedIntoGrenadeEventArgs.cs @@ -10,6 +10,7 @@ namespace Exiled.Events.EventArgs.Map using Exiled.API.Features.Pickups; using Exiled.API.Features.Pickups.Projectiles; using Exiled.Events.EventArgs.Interfaces; + using InventorySystem.Items.ThrowableProjectiles; /// @@ -41,4 +42,4 @@ public ChangedIntoGrenadeEventArgs(TimedGrenadePickup pickup, ThrownProjectile p /// Pickup IPickupEvent.Pickup => Pickup; } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Map/ElevatorSequencesUpdatedEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Map/ElevatorSequencesUpdatedEventArgs.cs index c2a8fbe9aa..4d62722f63 100644 --- a/EXILED/Exiled.Events/EventArgs/Map/ElevatorSequencesUpdatedEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Map/ElevatorSequencesUpdatedEventArgs.cs @@ -1,4 +1,4 @@ -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- // // Copyright (c) ExMod Team. All rights reserved. // Licensed under the CC BY-SA 3.0 license. @@ -9,6 +9,7 @@ namespace Exiled.Events.EventArgs.Map { using Exiled.API.Features; using Exiled.Events.EventArgs.Interfaces; + using Interactables.Interobjects; /// diff --git a/EXILED/Exiled.Events/EventArgs/Map/ExplodingGrenadeEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Map/ExplodingGrenadeEventArgs.cs index a0bba7e674..474995b3b8 100644 --- a/EXILED/Exiled.Events/EventArgs/Map/ExplodingGrenadeEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Map/ExplodingGrenadeEventArgs.cs @@ -27,8 +27,6 @@ namespace Exiled.Events.EventArgs.Map /// public class ExplodingGrenadeEventArgs : IPlayerEvent, IDeniableEvent, IPickupEvent { - private ExplosionType explosionType; - /// /// Initializes a new instance of the class. /// @@ -125,8 +123,8 @@ public ExplodingGrenadeEventArgs(Player thrower, EffectGrenade grenade, HashSet< /// Explosion that are not from will return and can't be modified. public ExplosionType ExplosionType { - get => explosionType; - set => explosionType = Projectile is ExplosionGrenadeProjectile ? value : ExplosionType.Custom; + get; + set => field = Projectile is ExplosionGrenadeProjectile ? value : ExplosionType.Custom; } /// diff --git a/EXILED/Exiled.Events/EventArgs/Map/FillingLockerEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Map/FillingLockerEventArgs.cs index 205500cf60..d480492ce9 100644 --- a/EXILED/Exiled.Events/EventArgs/Map/FillingLockerEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Map/FillingLockerEventArgs.cs @@ -10,7 +10,9 @@ namespace Exiled.Events.EventArgs.Map using Exiled.API.Features.Lockers; using Exiled.API.Features.Pickups; using Exiled.Events.EventArgs.Interfaces; + using InventorySystem.Items.Pickups; + using MapGeneration.Distributors; /// diff --git a/EXILED/Exiled.Events/EventArgs/Map/GeneratingEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Map/GeneratingEventArgs.cs index 15725ac6c6..32f7ef7ceb 100644 --- a/EXILED/Exiled.Events/EventArgs/Map/GeneratingEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Map/GeneratingEventArgs.cs @@ -1,4 +1,4 @@ -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- // // Copyright (c) ExMod Team. All rights reserved. // Licensed under the CC BY-SA 3.0 license. @@ -9,7 +9,6 @@ namespace Exiled.Events.EventArgs.Map { using Exiled.API.Enums; using Exiled.Events.EventArgs.Interfaces; - using UnityEngine; /// /// Contains all information after the server generates a seed, but before the map is generated. diff --git a/EXILED/Exiled.Events/EventArgs/Map/GeneratorActivatingEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Map/GeneratorActivatingEventArgs.cs index b6187bb2ba..856950f7e6 100644 --- a/EXILED/Exiled.Events/EventArgs/Map/GeneratorActivatingEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Map/GeneratorActivatingEventArgs.cs @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Map { - using API.Features; + using Exiled.API.Features; using Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Map/PickupAddedEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Map/PickupAddedEventArgs.cs index faa0b772a4..f41b0bc637 100644 --- a/EXILED/Exiled.Events/EventArgs/Map/PickupAddedEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Map/PickupAddedEventArgs.cs @@ -9,6 +9,7 @@ namespace Exiled.Events.EventArgs.Map { using Exiled.API.Features.Pickups; using Exiled.Events.EventArgs.Interfaces; + using InventorySystem.Items.Pickups; /// @@ -32,4 +33,4 @@ public PickupAddedEventArgs(ItemPickupBase pickupBase) /// public Pickup Pickup { get; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Map/PickupDestroyedEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Map/PickupDestroyedEventArgs.cs index 49bba314cc..1661f669c3 100644 --- a/EXILED/Exiled.Events/EventArgs/Map/PickupDestroyedEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Map/PickupDestroyedEventArgs.cs @@ -9,6 +9,7 @@ namespace Exiled.Events.EventArgs.Map { using Exiled.API.Features.Pickups; using Exiled.Events.EventArgs.Interfaces; + using InventorySystem.Items.Pickups; /// @@ -32,4 +33,4 @@ public PickupDestroyedEventArgs(ItemPickupBase pickupBase) /// public Pickup Pickup { get; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Map/PlacingBulletHoleEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Map/PlacingBulletHoleEventArgs.cs index 8a066fbaf9..da482dee23 100644 --- a/EXILED/Exiled.Events/EventArgs/Map/PlacingBulletHoleEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Map/PlacingBulletHoleEventArgs.cs @@ -7,8 +7,9 @@ namespace Exiled.Events.EventArgs.Map { - using API.Features; + using Exiled.API.Features; using Exiled.API.Features.Items; + using Interfaces; using UnityEngine; diff --git a/EXILED/Exiled.Events/EventArgs/Map/PlacingPickupIntoPocketDimensionEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Map/PlacingPickupIntoPocketDimensionEventArgs.cs index 3dcef688d2..a47ccaf63b 100644 --- a/EXILED/Exiled.Events/EventArgs/Map/PlacingPickupIntoPocketDimensionEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Map/PlacingPickupIntoPocketDimensionEventArgs.cs @@ -9,6 +9,7 @@ namespace Exiled.Events.EventArgs.Map { using Exiled.API.Features.Pickups; using Exiled.Events.EventArgs.Interfaces; + using InventorySystem.Items.Pickups; using UnityEngine; diff --git a/EXILED/Exiled.Events/EventArgs/Map/Scp244SpawningEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Map/Scp244SpawningEventArgs.cs index 263deba65c..b751b05c80 100644 --- a/EXILED/Exiled.Events/EventArgs/Map/Scp244SpawningEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Map/Scp244SpawningEventArgs.cs @@ -7,10 +7,13 @@ namespace Exiled.Events.EventArgs.Map { - using API.Features; + using Exiled.API.Features; using Exiled.API.Features.Pickups; + using Interfaces; + using InventorySystem.Items.Usables.Scp244; + using MapGeneration; /// diff --git a/EXILED/Exiled.Events/EventArgs/Map/SpawningItemEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Map/SpawningItemEventArgs.cs index 4476b88419..6c83d590bd 100644 --- a/EXILED/Exiled.Events/EventArgs/Map/SpawningItemEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Map/SpawningItemEventArgs.cs @@ -10,7 +10,9 @@ namespace Exiled.Events.EventArgs.Map using Exiled.API.Features.Doors; using Exiled.API.Features.Pickups; using Exiled.Events.EventArgs.Interfaces; + using Interactables.Interobjects.DoorUtils; + using InventorySystem.Items.Pickups; /// diff --git a/EXILED/Exiled.Events/EventArgs/Map/SpawningRoomConnectorEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Map/SpawningRoomConnectorEventArgs.cs index 179c244e83..8717f22371 100644 --- a/EXILED/Exiled.Events/EventArgs/Map/SpawningRoomConnectorEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Map/SpawningRoomConnectorEventArgs.cs @@ -9,6 +9,7 @@ namespace Exiled.Events.EventArgs.Map { using Exiled.API.Features; using Exiled.Events.EventArgs.Interfaces; + using MapGeneration.RoomConnectors; using MapGeneration.RoomConnectors.Spawners; @@ -55,4 +56,4 @@ public SpawningRoomConnectorEventArgs(RoomConnectorSpawnpointBase roomConnectorS /// public bool IsAllowed { get; set; } = true; } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Map/SpawningTeamVehicleEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Map/SpawningTeamVehicleEventArgs.cs index 2e455ff305..1bc1c3b0ce 100644 --- a/EXILED/Exiled.Events/EventArgs/Map/SpawningTeamVehicleEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Map/SpawningTeamVehicleEventArgs.cs @@ -8,7 +8,7 @@ namespace Exiled.Events.EventArgs.Map { using Exiled.Events.EventArgs.Interfaces; - using Respawning; + using Respawning.Waves; /// diff --git a/EXILED/Exiled.Events/EventArgs/Player/ActivatingGeneratorEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/ActivatingGeneratorEventArgs.cs index 8050e534bf..dfafdd0808 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/ActivatingGeneratorEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/ActivatingGeneratorEventArgs.cs @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; + using Exiled.API.Features; using Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Player/ActivatingWarheadPanelEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/ActivatingWarheadPanelEventArgs.cs index 65504085ed..e6c1004b80 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/ActivatingWarheadPanelEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/ActivatingWarheadPanelEventArgs.cs @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; + using Exiled.API.Features; using Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Player/ActivatingWorkstationEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/ActivatingWorkstationEventArgs.cs index e035556555..a10068d1c8 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/ActivatingWorkstationEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/ActivatingWorkstationEventArgs.cs @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; + using Exiled.API.Features; using Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Player/AimingDownSightEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/AimingDownSightEventArgs.cs index 945295631a..9e9b2a932b 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/AimingDownSightEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/AimingDownSightEventArgs.cs @@ -7,8 +7,8 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; - using API.Features.Items; + using Exiled.API.Features; + using Exiled.API.Features.Items; using Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Player/BannedEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/BannedEventArgs.cs index 0c060df6dc..d4814305df 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/BannedEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/BannedEventArgs.cs @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; + using Exiled.API.Features; using Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Player/BanningEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/BanningEventArgs.cs index 86d15bf8d8..5fea86b4c6 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/BanningEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/BanningEventArgs.cs @@ -9,16 +9,15 @@ namespace Exiled.Events.EventArgs.Player { using System.Reflection; - using API.Features; using CommandSystem; + using Exiled.API.Features; + /// /// Contains all information before banning a player from the server. /// public class BanningEventArgs : KickingEventArgs { - private long duration; - /// /// Initializes a new instance of the class. /// @@ -40,16 +39,16 @@ public BanningEventArgs(Player target, Player issuer, ICommandSender commandSend /// public long Duration { - get => duration; + get; set { - if (duration == value) + if (field == value) return; if (Events.Instance.Config.ShouldLogBans) - LogBanChange(Assembly.GetCallingAssembly().GetName().Name, $" changed Ban duration: {duration} to {value} for ID: {Target.UserId}"); + LogBanChange(Assembly.GetCallingAssembly().GetName().Name, $" changed Ban duration: {field} to {value} for ID: {Target.UserId}"); - duration = value; + field = value; } } } diff --git a/EXILED/Exiled.Events/EventArgs/Player/CancelledItemUseEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/CancelledItemUseEventArgs.cs index 19435c5250..71a39402c7 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/CancelledItemUseEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/CancelledItemUseEventArgs.cs @@ -7,9 +7,10 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; + using Exiled.API.Features; using Exiled.API.Features.Items; using Exiled.Events.EventArgs.Interfaces; + using InventorySystem.Items.Usables; /// diff --git a/EXILED/Exiled.Events/EventArgs/Player/CancellingItemUseEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/CancellingItemUseEventArgs.cs index a030f171c2..f2e9778d81 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/CancellingItemUseEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/CancellingItemUseEventArgs.cs @@ -7,9 +7,10 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; + using Exiled.API.Features; using Exiled.API.Features.Items; using Exiled.Events.EventArgs.Interfaces; + using InventorySystem.Items.Usables; /// diff --git a/EXILED/Exiled.Events/EventArgs/Player/ChangedEmotionEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/ChangedEmotionEventArgs.cs index cd5e3447a9..06fdc3ef0e 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/ChangedEmotionEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/ChangedEmotionEventArgs.cs @@ -9,6 +9,7 @@ namespace Exiled.Events.EventArgs.Player { using Exiled.API.Features; using Exiled.Events.EventArgs.Interfaces; + using PlayerRoles.FirstPersonControl.Thirdperson.Subcontrollers; /// diff --git a/EXILED/Exiled.Events/EventArgs/Player/ChangedItemEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/ChangedItemEventArgs.cs index 2381256901..42dfc76855 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/ChangedItemEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/ChangedItemEventArgs.cs @@ -7,8 +7,8 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; - using API.Features.Items; + using Exiled.API.Features; + using Exiled.API.Features.Items; using Interfaces; @@ -50,4 +50,4 @@ public ChangedItemEventArgs(Player player, ItemBase oldItem) /// public Player Player { get; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Player/ChangedRatioEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/ChangedRatioEventArgs.cs index 5df04b729e..329aaa2a54 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/ChangedRatioEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/ChangedRatioEventArgs.cs @@ -51,4 +51,4 @@ public ChangedRatioEventArgs(ReferenceHub player, float oldratio, float newratio /// public AspectRatioType NewRatio { get; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Player/ChangingDangerStateEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/ChangingDangerStateEventArgs.cs index 8ee98adb01..1579036d2a 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/ChangingDangerStateEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/ChangingDangerStateEventArgs.cs @@ -8,6 +8,7 @@ namespace Exiled.Events.EventArgs.Player { using CustomPlayerEffects.Danger; + using Exiled.API.Enums; using Exiled.API.Features; using Exiled.Events.EventArgs.Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Player/ChangingDisruptorModeEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/ChangingDisruptorModeEventArgs.cs index 699848459b..08fe6b0a82 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/ChangingDisruptorModeEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/ChangingDisruptorModeEventArgs.cs @@ -11,6 +11,7 @@ namespace Exiled.Events.EventArgs.Player using Exiled.API.Features; using Exiled.API.Features.Items; using Exiled.Events.EventArgs.Interfaces; + using InventorySystem.Items; /// @@ -43,4 +44,4 @@ public ChangingDisruptorModeEventArgs(ItemBase firearm, bool mode) /// public Player Player => Item.Owner; } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Player/ChangingEmotionEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/ChangingEmotionEventArgs.cs index 759f1fa9ed..71a691b25c 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/ChangingEmotionEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/ChangingEmotionEventArgs.cs @@ -9,6 +9,7 @@ namespace Exiled.Events.EventArgs.Player { using Exiled.API.Features; using Exiled.Events.EventArgs.Interfaces; + using PlayerRoles.FirstPersonControl.Thirdperson.Subcontrollers; /// diff --git a/EXILED/Exiled.Events/EventArgs/Player/ChangingGroupEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/ChangingGroupEventArgs.cs index feffd9882d..54ec5d2f11 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/ChangingGroupEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/ChangingGroupEventArgs.cs @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; + using Exiled.API.Features; using Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Player/ChangingItemEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/ChangingItemEventArgs.cs index 6978172b54..97fdd988b4 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/ChangingItemEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/ChangingItemEventArgs.cs @@ -9,8 +9,8 @@ namespace Exiled.Events.EventArgs.Player { using System; - using API.Features; - using API.Features.Items; + using Exiled.API.Features; + using Exiled.API.Features.Items; using Interfaces; @@ -21,8 +21,6 @@ namespace Exiled.Events.EventArgs.Player /// public class ChangingItemEventArgs : IPlayerEvent, IDeniableEvent, IItemEvent { - private Item newItem; - /// /// Initializes a new instance of the class. /// @@ -35,7 +33,7 @@ public class ChangingItemEventArgs : IPlayerEvent, IDeniableEvent, IItemEvent public ChangingItemEventArgs(Player player, ItemBase newItem) { Player = player; - this.newItem = Item.Get(newItem); + Item = Item.Get(newItem); } /// @@ -43,13 +41,13 @@ public ChangingItemEventArgs(Player player, ItemBase newItem) /// public Item Item { - get => newItem; + get; set { if (value != null && !Player.Inventory.UserInventory.Items.TryGetValue(value.Serial, out _)) throw new InvalidOperationException("ev.NewItem cannot be set to an item they do not have."); - newItem = value; + field = value; } } diff --git a/EXILED/Exiled.Events/EventArgs/Player/ChangingMicroHIDStateEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/ChangingMicroHIDStateEventArgs.cs index 3e3c1eee9c..4240a4482d 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/ChangingMicroHIDStateEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/ChangingMicroHIDStateEventArgs.cs @@ -7,14 +7,12 @@ namespace Exiled.Events.EventArgs.Player { - using System; + using Exiled.API.Features; + using Exiled.API.Features.Items; - using API.Features; - using API.Features.Items; using Interfaces; using InventorySystem.Items; - using InventorySystem.Items.MicroHID; using InventorySystem.Items.MicroHID.Modules; /// diff --git a/EXILED/Exiled.Events/EventArgs/Player/ChangingMoveStateEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/ChangingMoveStateEventArgs.cs index 36d5240158..5c8c6e4ff4 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/ChangingMoveStateEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/ChangingMoveStateEventArgs.cs @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; + using Exiled.API.Features; using Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Player/ChangingRadioPresetEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/ChangingRadioPresetEventArgs.cs index c00696a759..e73f6e9cff 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/ChangingRadioPresetEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/ChangingRadioPresetEventArgs.cs @@ -7,9 +7,8 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; - using Exiled.API.Enums; + using Exiled.API.Features; using Exiled.API.Features.Items; using Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Player/ChangingRoleEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/ChangingRoleEventArgs.cs index 888f2f9b59..f1f05804a5 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/ChangingRoleEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/ChangingRoleEventArgs.cs @@ -10,14 +10,18 @@ namespace Exiled.Events.EventArgs.Player using System.Collections.Generic; using System.Linq; - using API.Enums; - using API.Features; + using Exiled.API.Enums; using Exiled.API.Extensions; + using Exiled.API.Features; using Exiled.API.Features.Pools; + using Interfaces; + using InventorySystem; + using LabApi.Events.Arguments.PlayerEvents; using LabApi.Events.Handlers; + using PlayerRoles; /// @@ -25,8 +29,6 @@ namespace Exiled.Events.EventArgs.Player /// public class ChangingRoleEventArgs : IPlayerEvent, IDeniableEvent { - private RoleTypeId newRole; - /// /// Initializes a new instance of the class. /// @@ -69,7 +71,7 @@ public ChangingRoleEventArgs(Player player, RoleTypeId newRole, RoleChangeReason /// public RoleTypeId NewRole { - get => newRole; + get; set { InventoryRoleInfo inventory = value.GetInventory(); @@ -90,7 +92,7 @@ public RoleTypeId NewRole foreach (KeyValuePair ammoPair in playerReceivingLoadoutEventArgs.Ammo) Ammo.Add(ammoPair.Key, ammoPair.Value); - newRole = value; + field = value; } } diff --git a/EXILED/Exiled.Events/EventArgs/Player/ChangingSpectatedPlayerEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/ChangingSpectatedPlayerEventArgs.cs index c50f5d6116..c39918116e 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/ChangingSpectatedPlayerEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/ChangingSpectatedPlayerEventArgs.cs @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; + using Exiled.API.Features; using Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Player/ClosingGeneratorEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/ClosingGeneratorEventArgs.cs index c33b0bcc0f..348316e0a6 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/ClosingGeneratorEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/ClosingGeneratorEventArgs.cs @@ -7,8 +7,9 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; + using Exiled.API.Features; using Exiled.Events.EventArgs.Interfaces; + using MapGeneration.Distributors; /// @@ -43,4 +44,4 @@ public ClosingGeneratorEventArgs(Player player, Scp079Generator generator) /// public Player Player { get; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Player/ConsumingItemEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/ConsumingItemEventArgs.cs index 0e48f83a8b..ec72c82b78 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/ConsumingItemEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/ConsumingItemEventArgs.cs @@ -7,8 +7,8 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; - using API.Features.Items; + using Exiled.API.Features; + using Exiled.API.Features.Items; using Exiled.Events.EventArgs.Interfaces; @@ -46,4 +46,4 @@ public ConsumingItemEventArgs(ReferenceHub hub, InventorySystem.Items.Usables.Co /// public bool IsAllowed { get; set; } = true; } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Player/DamagingDoorEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/DamagingDoorEventArgs.cs index 4ed1981db1..177cb27f4c 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/DamagingDoorEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/DamagingDoorEventArgs.cs @@ -9,8 +9,11 @@ namespace Exiled.Events.EventArgs.Player { using Exiled.API.Features; using Exiled.API.Features.Doors; + using Footprinting; + using Interactables.Interobjects.DoorUtils; + using Interfaces; /// diff --git a/EXILED/Exiled.Events/EventArgs/Player/DamagingShootingTargetEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/DamagingShootingTargetEventArgs.cs index 950e0bb426..a577f50b19 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/DamagingShootingTargetEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/DamagingShootingTargetEventArgs.cs @@ -9,9 +9,9 @@ namespace Exiled.Events.EventArgs.Player { using AdminToys; - using API.Features; - using API.Features.Items; - using API.Features.Toys; + using Exiled.API.Features; + using Exiled.API.Features.Items; + using Exiled.API.Features.Toys; using Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Player/DamagingWindowEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/DamagingWindowEventArgs.cs index 03e4aa1fa8..a766449316 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/DamagingWindowEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/DamagingWindowEventArgs.cs @@ -7,8 +7,8 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; - using API.Features.DamageHandlers; + using Exiled.API.Features; + using Exiled.API.Features.DamageHandlers; using Interfaces; @@ -33,8 +33,10 @@ public class DamagingWindowEventArgs : IPlayerEvent, IDeniableEvent public DamagingWindowEventArgs(BreakableWindow window, float damage, DamageHandlerBase handler) { Window = Window.Get(window); - Handler = new DamageHandler(handler is AttackerDamageHandler attackerDamageHandler ? Player.Get(attackerDamageHandler.Attacker.Hub) : null, handler); - Handler.Damage = damage; + Handler = new DamageHandler(handler is AttackerDamageHandler attackerDamageHandler ? Player.Get(attackerDamageHandler.Attacker.Hub) : null, handler) + { + Damage = damage, + }; Player = Handler.Attacker; } diff --git a/EXILED/Exiled.Events/EventArgs/Player/DeactivatingWorkstationEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/DeactivatingWorkstationEventArgs.cs index 20ce6f84d0..6eded5ff67 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/DeactivatingWorkstationEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/DeactivatingWorkstationEventArgs.cs @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; + using Exiled.API.Features; using Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Player/DestroyingEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/DestroyingEventArgs.cs index 219838dc6f..504fbbdf4f 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/DestroyingEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/DestroyingEventArgs.cs @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; + using Exiled.API.Features; using Interfaces; @@ -35,4 +35,4 @@ public DestroyingEventArgs(Player player) /// public Player Player { get; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Player/DiedEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/DiedEventArgs.cs index 24e91e6870..9e6c119f43 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/DiedEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/DiedEventArgs.cs @@ -7,8 +7,8 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; - using API.Features.DamageHandlers; + using Exiled.API.Features; + using Exiled.API.Features.DamageHandlers; using Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Player/DroppedAmmoEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/DroppedAmmoEventArgs.cs index 78d229d08f..3550bf9905 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/DroppedAmmoEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/DroppedAmmoEventArgs.cs @@ -9,10 +9,11 @@ namespace Exiled.Events.EventArgs.Player { using System.Collections.Generic; - using API.Enums; - using API.Features; + using Exiled.API.Enums; using Exiled.API.Extensions; + using Exiled.API.Features; using Exiled.API.Features.Pickups; + using Interfaces; using AmmoPickup = API.Features.Pickups.AmmoPickup; @@ -71,4 +72,4 @@ public DroppedAmmoEventArgs(Player player, ItemType itemType, ushort amount, Lis /// public Player Player { get; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Player/DroppedItemEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/DroppedItemEventArgs.cs index c315553660..11ecf5c7c6 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/DroppedItemEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/DroppedItemEventArgs.cs @@ -7,9 +7,11 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; + using Exiled.API.Features; using Exiled.API.Features.Pickups; + using Interfaces; + using InventorySystem.Items.Pickups; /// diff --git a/EXILED/Exiled.Events/EventArgs/Player/DroppingAmmoEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/DroppingAmmoEventArgs.cs index 0b379c903a..bcef3e3911 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/DroppingAmmoEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/DroppingAmmoEventArgs.cs @@ -7,9 +7,10 @@ namespace Exiled.Events.EventArgs.Player { - using API.Enums; - using API.Features; + using Exiled.API.Enums; using Exiled.API.Extensions; + using Exiled.API.Features; + using Interfaces; using PlayerRoles; @@ -19,8 +20,6 @@ namespace Exiled.Events.EventArgs.Player /// public class DroppingAmmoEventArgs : IPlayerEvent, IDeniableEvent { - private bool isAllowed = true; - /// /// Initializes a new instance of the class. /// @@ -66,18 +65,12 @@ public DroppingAmmoEventArgs(Player player, ItemType itemType, ushort amount, bo /// public bool IsAllowed { - get - { - if (Player.Role == RoleTypeId.Spectator) - isAllowed = true; - return isAllowed; - } - + get; set { if (Player.Role == RoleTypeId.Spectator) - value = true; - isAllowed = value; + return; + field = value; } } @@ -86,4 +79,4 @@ public bool IsAllowed /// public Player Player { get; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Player/DroppingItemEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/DroppingItemEventArgs.cs index cf15df90d3..712b8963a2 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/DroppingItemEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/DroppingItemEventArgs.cs @@ -7,8 +7,8 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; - using API.Features.Items; + using Exiled.API.Features; + using Exiled.API.Features.Items; using Interfaces; @@ -21,8 +21,6 @@ namespace Exiled.Events.EventArgs.Player /// public class DroppingItemEventArgs : IItemEvent, IDeniableEvent { - private bool isAllowed = true; - /// /// Initializes a new instance of the class. /// @@ -44,6 +42,7 @@ public DroppingItemEventArgs(Player player, ItemBase item, bool isThrown, bool i Item = Item.Get(item); IsAllowed = isAllowed; IsThrown = isThrown; + IsAllowed = isAllowed; } /// @@ -56,18 +55,12 @@ public DroppingItemEventArgs(Player player, ItemBase item, bool isThrown, bool i /// public bool IsAllowed { - get - { - if (Player.Role == RoleTypeId.Spectator) - isAllowed = true; - return isAllowed; - } - + get; set { if (Player.Role == RoleTypeId.Spectator) - value = true; - isAllowed = value; + return; + field = value; } } diff --git a/EXILED/Exiled.Events/EventArgs/Player/DroppingNothingEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/DroppingNothingEventArgs.cs index dd9c80aa35..9273188f7f 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/DroppingNothingEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/DroppingNothingEventArgs.cs @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; + using Exiled.API.Features; using Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Player/DryfiringWeaponEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/DryfiringWeaponEventArgs.cs index 2073d62678..0f9aa9f844 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/DryfiringWeaponEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/DryfiringWeaponEventArgs.cs @@ -7,8 +7,8 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; - using API.Features.Items; + using Exiled.API.Features; + using Exiled.API.Features.Items; using Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Player/DyingEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/DyingEventArgs.cs index 9919ac0899..63cbc5e5e8 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/DyingEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/DyingEventArgs.cs @@ -10,9 +10,9 @@ namespace Exiled.Events.EventArgs.Player using System.Collections.Generic; using System.Linq; - using API.Features; - using API.Features.DamageHandlers; - using API.Features.Items; + using Exiled.API.Features; + using Exiled.API.Features.DamageHandlers; + using Exiled.API.Features.Items; using Interfaces; @@ -37,9 +37,7 @@ public DyingEventArgs(Player target, DamageHandlerBase damageHandler) { DamageHandler = new CustomDamageHandler(target, damageHandler); Player = target; -#pragma warning disable CS0618 ItemsToDrop = Player.Items.ToList(); -#pragma warning restore CS0618 Attacker = DamageHandler.BaseIs(out CustomAttackerHandler attackerDamageHandler) ? attackerDamageHandler.Attacker : null; } diff --git a/EXILED/Exiled.Events/EventArgs/Player/EarningAchievementEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/EarningAchievementEventArgs.cs index d4594b42b3..2286cfe056 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/EarningAchievementEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/EarningAchievementEventArgs.cs @@ -8,7 +8,9 @@ namespace Exiled.Events.EventArgs.Player { using Achievements; + using Exiled.API.Features; + using Interfaces; /// diff --git a/EXILED/Exiled.Events/EventArgs/Player/EnteringEnvironmentalHazardEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/EnteringEnvironmentalHazardEventArgs.cs index dc61bef74e..fb87567110 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/EnteringEnvironmentalHazardEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/EnteringEnvironmentalHazardEventArgs.cs @@ -8,7 +8,9 @@ namespace Exiled.Events.EventArgs.Player { using Exiled.API.Features.Hazards; + using Hazards; + using Interfaces; /// diff --git a/EXILED/Exiled.Events/EventArgs/Player/EnteringKillerCollisionEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/EnteringKillerCollisionEventArgs.cs index 0d8a82d3f6..398600ebba 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/EnteringKillerCollisionEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/EnteringKillerCollisionEventArgs.cs @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; + using Exiled.API.Features; using Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Player/EnteringPocketDimensionEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/EnteringPocketDimensionEventArgs.cs index 2b66874acd..1ea381387b 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/EnteringPocketDimensionEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/EnteringPocketDimensionEventArgs.cs @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; + using Exiled.API.Features; using Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Player/EscapingEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/EscapingEventArgs.cs index 2e94fd0e6d..6717ff03ff 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/EscapingEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/EscapingEventArgs.cs @@ -7,8 +7,9 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; using Exiled.API.Enums; + using Exiled.API.Features; + using Interfaces; using PlayerRoles; @@ -18,8 +19,6 @@ namespace Exiled.Events.EventArgs.Player /// public class EscapingEventArgs : IPlayerEvent, IDeniableEvent { - private EscapeScenario escapeScenario; - /// /// Initializes a new instance of the class. /// @@ -55,8 +54,8 @@ public EscapingEventArgs(ReferenceHub referenceHub, RoleTypeId newRole, EscapeSc /// public EscapeScenario EscapeScenario { - get => (escapeScenario is EscapeScenario.None && IsAllowed) ? EscapeScenario.CustomEscape : escapeScenario; - set => escapeScenario = value; + get => (field is EscapeScenario.None && IsAllowed) ? EscapeScenario.CustomEscape : field; + set; } /// @@ -64,4 +63,4 @@ public EscapeScenario EscapeScenario /// public bool IsAllowed { get; set; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Player/EscapingPocketDimensionEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/EscapingPocketDimensionEventArgs.cs index 841edfdcf6..5426880210 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/EscapingPocketDimensionEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/EscapingPocketDimensionEventArgs.cs @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; + using Exiled.API.Features; using Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Player/ExitingEnvironmentalHazardEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/ExitingEnvironmentalHazardEventArgs.cs index e0b24de298..6043c9285e 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/ExitingEnvironmentalHazardEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/ExitingEnvironmentalHazardEventArgs.cs @@ -8,7 +8,9 @@ namespace Exiled.Events.EventArgs.Player { using Exiled.API.Features.Hazards; + using Hazards; + using Interfaces; /// diff --git a/EXILED/Exiled.Events/EventArgs/Player/ExplodingMicroHIDEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/ExplodingMicroHIDEventArgs.cs index c2727317aa..0618e8cb7f 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/ExplodingMicroHIDEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/ExplodingMicroHIDEventArgs.cs @@ -9,6 +9,7 @@ namespace Exiled.Events.EventArgs.Player { using Exiled.API.Features.Items; using Exiled.Events.EventArgs.Interfaces; + using InventorySystem.Items.MicroHID; /// diff --git a/EXILED/Exiled.Events/EventArgs/Player/FailingEscapePocketDimensionEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/FailingEscapePocketDimensionEventArgs.cs index 620178368c..2579fcb43d 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/FailingEscapePocketDimensionEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/FailingEscapePocketDimensionEventArgs.cs @@ -7,9 +7,7 @@ namespace Exiled.Events.EventArgs.Player { - using System; - - using API.Features; + using Exiled.API.Features; using Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Player/FlippingCoinEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/FlippingCoinEventArgs.cs index 954d2f39e8..a7e92b0d45 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/FlippingCoinEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/FlippingCoinEventArgs.cs @@ -7,9 +7,11 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; - using API.Features.Items; + using Exiled.API.Features; + using Exiled.API.Features.Items; + using Interfaces; + using InventorySystem.Items.Coin; /// diff --git a/EXILED/Exiled.Events/EventArgs/Player/HandcuffingEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/HandcuffingEventArgs.cs index 7f2d8c34c3..4d5ff2803a 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/HandcuffingEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/HandcuffingEventArgs.cs @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; + using Exiled.API.Features; using Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Player/HitEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/HitEventArgs.cs index d9d18adc0e..b8bfdcf015 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/HitEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/HitEventArgs.cs @@ -1,4 +1,4 @@ -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- // // Copyright (c) ExMod Team. All rights reserved. // Licensed under the CC BY-SA 3.0 license. @@ -10,8 +10,10 @@ namespace Exiled.Events.EventArgs.Player using System.Collections.Generic; using System.Linq; - using API.Features; + using Exiled.API.Features; + using Interfaces; + using PlayerRoles.PlayableScps.Subroutines; /// diff --git a/EXILED/Exiled.Events/EventArgs/Player/HurtEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/HurtEventArgs.cs index b42a7ab209..d970db90c9 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/HurtEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/HurtEventArgs.cs @@ -7,8 +7,8 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; - using API.Features.DamageHandlers; + using Exiled.API.Features; + using Exiled.API.Features.DamageHandlers; using Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Player/HurtingEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/HurtingEventArgs.cs index f328bddd20..7da8ade642 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/HurtingEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/HurtingEventArgs.cs @@ -7,9 +7,11 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; - using API.Features.DamageHandlers; + using Exiled.API.Features; + using Exiled.API.Features.DamageHandlers; + using Interfaces; + using PlayerStatsSystem; using CustomAttackerHandler = API.Features.DamageHandlers.AttackerDamageHandler; diff --git a/EXILED/Exiled.Events/EventArgs/Player/InteractedEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/InteractedEventArgs.cs index f73f97451a..83d93bfd34 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/InteractedEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/InteractedEventArgs.cs @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; + using Exiled.API.Features; using Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Player/InteractingDoorEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/InteractingDoorEventArgs.cs index 509b8bc329..3cde5a1883 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/InteractingDoorEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/InteractingDoorEventArgs.cs @@ -7,10 +7,12 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; + using Exiled.API.Features; using Exiled.API.Features.Doors; + using Interactables; using Interactables.Interobjects.DoorUtils; + using Interfaces; /// @@ -74,4 +76,4 @@ public InteractingDoorEventArgs(Player player, DoorVariant door, byte colliderId /// public Player Player { get; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Player/InteractingEmergencyButtonEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/InteractingEmergencyButtonEventArgs.cs index 9efbad6105..9e3013178c 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/InteractingEmergencyButtonEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/InteractingEmergencyButtonEventArgs.cs @@ -1,4 +1,4 @@ -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- // // Copyright (c) ExMod Team. All rights reserved. // Licensed under the CC BY-SA 3.0 license. @@ -10,6 +10,7 @@ namespace Exiled.Events.EventArgs.Player using Exiled.API.Features; using Exiled.API.Features.Doors; using Exiled.Events.EventArgs.Interfaces; + using Interactables.Interobjects; /// diff --git a/EXILED/Exiled.Events/EventArgs/Player/InteractingLockerEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/InteractingLockerEventArgs.cs index b7cc7f3b5c..f598b07eb6 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/InteractingLockerEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/InteractingLockerEventArgs.cs @@ -7,8 +7,9 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; + using Exiled.API.Features; using Exiled.API.Features.Lockers; + using Interfaces; /// diff --git a/EXILED/Exiled.Events/EventArgs/Player/InteractingShootingTargetEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/InteractingShootingTargetEventArgs.cs index 6bda1ab0cf..6c413daeb4 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/InteractingShootingTargetEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/InteractingShootingTargetEventArgs.cs @@ -7,13 +7,11 @@ namespace Exiled.Events.EventArgs.Player { - using System; - using AdminToys; - using API.Enums; - using API.Features; - using API.Features.Toys; + using Exiled.API.Enums; + using Exiled.API.Features; + using Exiled.API.Features.Toys; using Interfaces; @@ -24,9 +22,6 @@ namespace Exiled.Events.EventArgs.Player /// public class InteractingShootingTargetEventArgs : IPlayerEvent, IDeniableEvent { - private int autoResetTime; - private int maxHp; - /// /// Initializes a new instance of the class. /// @@ -54,8 +49,8 @@ public InteractingShootingTargetEventArgs(Player player, ShootingTarget shooting ShootingTarget = AdminToy.Get(shootingTarget); TargetButton = targetButton; IsAllowed = isAllowed; - this.maxHp = maxHp; - this.autoResetTime = autoResetTime; + NewMaxHp = maxHp; + NewAutoResetTime = autoResetTime; } /// @@ -73,7 +68,7 @@ public InteractingShootingTargetEventArgs(Player player, ShootingTarget shooting /// public int NewMaxHp { - get => maxHp; + get; set { if (!ShootingTarget.IsSynced) @@ -82,7 +77,7 @@ public int NewMaxHp return; } - maxHp = Mathf.Clamp(value, 1, 256); + field = Mathf.Clamp(value, 1, 256); } } @@ -91,7 +86,7 @@ public int NewMaxHp /// public int NewAutoResetTime { - get => autoResetTime; + get; set { if (!ShootingTarget.IsSynced) @@ -100,7 +95,7 @@ public int NewAutoResetTime return; } - autoResetTime = Mathf.Clamp(value, 0, 10); + field = Mathf.Clamp(value, 0, 10); } } diff --git a/EXILED/Exiled.Events/EventArgs/Player/IntercomSpeakingEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/IntercomSpeakingEventArgs.cs index d17296909b..d7c59cfb50 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/IntercomSpeakingEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/IntercomSpeakingEventArgs.cs @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; + using Exiled.API.Features; using Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Player/IssuingMuteEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/IssuingMuteEventArgs.cs index 71c4cef39a..25ccce6f1b 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/IssuingMuteEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/IssuingMuteEventArgs.cs @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; + using Exiled.API.Features; using Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Player/JoinedEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/JoinedEventArgs.cs index 64b15a6888..a10eb18bf8 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/JoinedEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/JoinedEventArgs.cs @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; + using Exiled.API.Features; using Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Player/JumpingEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/JumpingEventArgs.cs index 410897b531..e25552d149 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/JumpingEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/JumpingEventArgs.cs @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; + using Exiled.API.Features; using Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Player/KickedEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/KickedEventArgs.cs index b99b6051b4..040e2d3e0b 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/KickedEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/KickedEventArgs.cs @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; + using Exiled.API.Features; using Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Player/KickingEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/KickingEventArgs.cs index cfa2864b85..bae8413450 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/KickingEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/KickingEventArgs.cs @@ -9,8 +9,10 @@ namespace Exiled.Events.EventArgs.Player { using System.Reflection; - using API.Features; using CommandSystem; + + using Exiled.API.Features; + using Interfaces; /// @@ -19,9 +21,6 @@ namespace Exiled.Events.EventArgs.Player public class KickingEventArgs : IPlayerEvent, IDeniableEvent { private readonly string startkickmessage; - private bool isAllowed; - private Player issuer; - private Player target; /// /// Initializes a new instance of the class. @@ -59,16 +58,16 @@ public KickingEventArgs(Player target, Player issuer, ICommandSender commandSend /// public Player Target { - get => target; + get; set { - if (value is null || target == value) + if (value is null || field == value) return; - if (Events.Instance.Config.ShouldLogBans && target is not null) - LogBanChange(Assembly.GetCallingAssembly().GetName().Name, $" changed the banned player from user {target.Nickname} ({target.UserId}) to {value.Nickname} ({value.UserId})"); + if (Events.Instance.Config.ShouldLogBans && field is not null) + LogBanChange(Assembly.GetCallingAssembly().GetName().Name, $" changed the banned player from user {field.Nickname} ({field.UserId}) to {value.Nickname} ({value.UserId})"); - target = value; + field = value; } } @@ -87,16 +86,16 @@ public Player Target /// public bool IsAllowed { - get => isAllowed; + get; set { - if (isAllowed == value) + if (field == value) return; if (Events.Instance.Config.ShouldLogBans) LogBanChange(Assembly.GetCallingAssembly().GetName().Name, $" {(value ? "allowed" : "denied")} banning user with ID: {Target.UserId}"); - isAllowed = value; + field = value; } } @@ -105,16 +104,16 @@ public bool IsAllowed /// public Player Player { - get => issuer; + get; set { - if (value is null || issuer == value) + if (value is null || field == value) return; - if (Events.Instance.Config.ShouldLogBans && issuer is not null) - LogBanChange(Assembly.GetCallingAssembly().GetName().Name, $" changed the ban issuer from user {issuer.Nickname} ({issuer.UserId}) to {value.Nickname} ({value.UserId})"); + if (Events.Instance.Config.ShouldLogBans && field is not null) + LogBanChange(Assembly.GetCallingAssembly().GetName().Name, $" changed the ban issuer from user {field.Nickname} ({field.UserId}) to {value.Nickname} ({value.UserId})"); - issuer = value; + field = value; } } diff --git a/EXILED/Exiled.Events/EventArgs/Player/LandingEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/LandingEventArgs.cs index 1ef0bac618..6e41af086d 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/LandingEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/LandingEventArgs.cs @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; + using Exiled.API.Features; using Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Player/LeftEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/LeftEventArgs.cs index 419a185713..057849e6f7 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/LeftEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/LeftEventArgs.cs @@ -7,20 +7,23 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; + using Exiled.API.Features; + using Exiled.Events.EventArgs.Interfaces; /// /// Contains all information after a disconnects from the server. /// - public class LeftEventArgs : JoinedEventArgs + public class LeftEventArgs : IPlayerEvent { /// /// Initializes a new instance of the class. /// /// The player who left the server. - public LeftEventArgs(Player player) - : base(player) - { - } + public LeftEventArgs(Player player) => Player = player; + + /// + /// Gets the left player. + /// + public Player Player { get; } } } \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Player/MakingNoiseEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/MakingNoiseEventArgs.cs index e0522ed31a..4ab397d828 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/MakingNoiseEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/MakingNoiseEventArgs.cs @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; + using Exiled.API.Features; using Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Player/MicroHIDOpeningDoorEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/MicroHIDOpeningDoorEventArgs.cs index fc1024823f..1b66453503 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/MicroHIDOpeningDoorEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/MicroHIDOpeningDoorEventArgs.cs @@ -12,6 +12,7 @@ namespace Exiled.Events.EventArgs.Player using Exiled.Events.EventArgs.Interfaces; using Interactables.Interobjects.DoorUtils; + using InventorySystem.Items.MicroHID; /// diff --git a/EXILED/Exiled.Events/EventArgs/Player/OpeningGeneratorEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/OpeningGeneratorEventArgs.cs index 13dc43febf..472da40bcb 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/OpeningGeneratorEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/OpeningGeneratorEventArgs.cs @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; + using Exiled.API.Features; using Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Player/PickingUpItemEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/PickingUpItemEventArgs.cs index f71781e3b7..0e61c47e8e 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/PickingUpItemEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/PickingUpItemEventArgs.cs @@ -52,4 +52,4 @@ public PickingUpItemEventArgs(ReferenceHub referenceHub, ItemPickupBase pickup, /// public Player Player { get; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Player/PlayingAudioLogEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/PlayingAudioLogEventArgs.cs index 41574b280c..4ea90f622d 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/PlayingAudioLogEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/PlayingAudioLogEventArgs.cs @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; + using Exiled.API.Features; using Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Player/ReceivingEffectEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/ReceivingEffectEventArgs.cs index 038a3e16c4..b323e997bb 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/ReceivingEffectEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/ReceivingEffectEventArgs.cs @@ -7,10 +7,10 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; - using CustomPlayerEffects; + using Exiled.API.Features; + using Interfaces; /// diff --git a/EXILED/Exiled.Events/EventArgs/Player/ReceivingGunSoundEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/ReceivingGunSoundEventArgs.cs index b12fe11972..8620534e04 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/ReceivingGunSoundEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/ReceivingGunSoundEventArgs.cs @@ -7,11 +7,10 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; - using API.Features.Items; - using AudioPooling; + using Exiled.API.Features; + using Exiled.API.Features.Items; using Exiled.Events.EventArgs.Interfaces; using UnityEngine; @@ -98,4 +97,4 @@ public ReceivingGunSoundEventArgs(ReferenceHub hub, InventorySystem.Items.Firear /// public bool IsAllowed { get; set; } = true; } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Player/ReceivingVoiceMessageEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/ReceivingVoiceMessageEventArgs.cs index 4b491f739a..2261640c97 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/ReceivingVoiceMessageEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/ReceivingVoiceMessageEventArgs.cs @@ -9,7 +9,9 @@ namespace Exiled.Events.EventArgs.Player { using Exiled.API.Features; using Exiled.Events.EventArgs.Interfaces; + using PlayerRoles.Voice; + using VoiceChat.Networking; /// @@ -57,4 +59,4 @@ public ReceivingVoiceMessageEventArgs(Player receiver, Player sender, VoiceModul /// public bool IsAllowed { get; set; } = true; } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Player/ReloadedWeaponEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/ReloadedWeaponEventArgs.cs index 464f2db6c5..6e30138b89 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/ReloadedWeaponEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/ReloadedWeaponEventArgs.cs @@ -7,8 +7,8 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; - using API.Features.Items; + using Exiled.API.Features; + using Exiled.API.Features.Items; using Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Player/ReloadingWeaponEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/ReloadingWeaponEventArgs.cs index a33a3cabbc..d1edfe37c0 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/ReloadingWeaponEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/ReloadingWeaponEventArgs.cs @@ -7,8 +7,8 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; - using API.Features.Items; + using Exiled.API.Features; + using Exiled.API.Features.Items; using Interfaces; @@ -47,4 +47,4 @@ public ReloadingWeaponEventArgs(InventorySystem.Items.Firearms.Firearm firearm, /// public Player Player { get; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Player/RemovedHandcuffsEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/RemovedHandcuffsEventArgs.cs index cef326e42d..5569f47e76 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/RemovedHandcuffsEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/RemovedHandcuffsEventArgs.cs @@ -7,8 +7,8 @@ namespace Exiled.Events.EventArgs.Player { - using API.Enums; - using API.Features; + using Exiled.API.Enums; + using Exiled.API.Features; using Exiled.Events.EventArgs.Interfaces; /// @@ -44,4 +44,4 @@ public RemovedHandcuffsEventArgs(Player cuffer, Player target, UncuffReason uncu /// public UncuffReason UncuffReason { get; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Player/RemovingHandcuffsEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/RemovingHandcuffsEventArgs.cs index 782d77f0fb..bd683b6f25 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/RemovingHandcuffsEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/RemovingHandcuffsEventArgs.cs @@ -7,8 +7,8 @@ namespace Exiled.Events.EventArgs.Player { - using API.Enums; - using API.Features; + using Exiled.API.Enums; + using Exiled.API.Features; using Exiled.Events.EventArgs.Interfaces; /// diff --git a/EXILED/Exiled.Events/EventArgs/Player/ReservedSlotsCheckEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/ReservedSlotsCheckEventArgs.cs index ebb22cf345..e757034c37 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/ReservedSlotsCheckEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/ReservedSlotsCheckEventArgs.cs @@ -15,8 +15,6 @@ namespace Exiled.Events.EventArgs.Player /// public class ReservedSlotsCheckEventArgs : IExiledEvent, IDeniableEvent { - private ReservedSlotEventResult reservedSlotEventResult = ReservedSlotEventResult.UseBaseGameSystem; - /// /// Initializes a new instance of the class. /// @@ -31,6 +29,7 @@ public ReservedSlotsCheckEventArgs(bool hasReservedSlot, string userId) UserId = userId; HasReservedSlot = hasReservedSlot; IsAllowed = hasReservedSlot; + Result = ReservedSlotEventResult.UseBaseGameSystem; } /// @@ -53,7 +52,7 @@ public ReservedSlotsCheckEventArgs(bool hasReservedSlot, string userId) /// public ReservedSlotEventResult Result { - get => reservedSlotEventResult; + get; set { switch (value) @@ -71,8 +70,8 @@ public ReservedSlotEventResult Result return; } - reservedSlotEventResult = value; + field = value; } } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Player/RevokingMuteEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/RevokingMuteEventArgs.cs index eb3251599a..871f831155 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/RevokingMuteEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/RevokingMuteEventArgs.cs @@ -7,12 +7,13 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; + using Exiled.API.Features; + using Exiled.Events.EventArgs.Interfaces; /// /// Contains all information before unmuting a player. /// - public class RevokingMuteEventArgs : IssuingMuteEventArgs + public class RevokingMuteEventArgs : IPlayerEvent, IDeniableEvent { /// /// Initializes a new instance of the class. @@ -27,8 +28,25 @@ public class RevokingMuteEventArgs : IssuingMuteEventArgs /// Indicates whether the player can be unmuted. /// public RevokingMuteEventArgs(Player player, bool isIntercom, bool isAllowed = true) - : base(player, isIntercom, isAllowed) { + Player = player; + IsIntercom = isIntercom; + IsAllowed = isAllowed; } + + /// + /// Gets the player who's being revoking the mute. + /// + public Player Player { get; } + + /// + /// Gets or sets a value indicating whether the player is being revoking intercom muted. + /// + public bool IsIntercom { get; set; } + + /// + /// Gets or sets a value indicating whether the player can be revoked muted. + /// + public bool IsAllowed { get; set; } } } \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Player/RoomChangedEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/RoomChangedEventArgs.cs index c640b78217..469d5811d1 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/RoomChangedEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/RoomChangedEventArgs.cs @@ -42,4 +42,4 @@ public RoomChangedEventArgs(ReferenceHub player, RoomIdentifier oldRoom, RoomIde /// public Room NewRoom { get; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Player/RotatingRevolverEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/RotatingRevolverEventArgs.cs index 515d8c7b04..c0286f7edb 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/RotatingRevolverEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/RotatingRevolverEventArgs.cs @@ -7,15 +7,11 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; - using API.Features.Items; - - using Exiled.API.Features.Items.FirearmModules.Primary; + using Exiled.API.Features; + using Exiled.API.Features.Items; using Interfaces; - using InventorySystem.Items.Firearms.Modules; - using FirearmBase = InventorySystem.Items.Firearms.Firearm; /// diff --git a/EXILED/Exiled.Events/EventArgs/Player/SavingByAntiScp207EventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/SavingByAntiScp207EventArgs.cs index 47b568d667..ef098bd4d7 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/SavingByAntiScp207EventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/SavingByAntiScp207EventArgs.cs @@ -8,6 +8,7 @@ namespace Exiled.Events.EventArgs.Player { using CustomPlayerEffects; + using Exiled.API.Features; using Exiled.API.Features.DamageHandlers; using Exiled.Events.EventArgs.Interfaces; @@ -64,4 +65,4 @@ public SavingByAntiScp207EventArgs(ReferenceHub player, float damageAmount, Dama /// public bool IsAllowed { get; set; } = true; } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Player/Scp1576TransmissionEndedEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/Scp1576TransmissionEndedEventArgs.cs index 6dce01109c..bef34edd65 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/Scp1576TransmissionEndedEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/Scp1576TransmissionEndedEventArgs.cs @@ -1,4 +1,4 @@ -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- // // Copyright (c) ExMod Team. All rights reserved. // Licensed under the CC BY-SA 3.0 license. @@ -7,9 +7,11 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; - using API.Features.Items; + using Exiled.API.Features; + using Exiled.API.Features.Items; + using Interfaces; + using InventorySystem.Items.Usables.Scp1576; /// diff --git a/EXILED/Exiled.Events/EventArgs/Player/SendingAdminChatMessageEventsArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/SendingAdminChatMessageEventsArgs.cs index 921be7a267..5903268c82 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/SendingAdminChatMessageEventsArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/SendingAdminChatMessageEventsArgs.cs @@ -8,12 +8,8 @@ namespace Exiled.Events.EventArgs.Player { using Exiled.API.Features; - using Exiled.API.Features.Pickups; using Exiled.Events.EventArgs.Interfaces; - using InventorySystem.Items.Pickups; - using InventorySystem.Searching; - /// /// Contains all information before a player sends a message in AdminChat. /// @@ -53,4 +49,4 @@ public SendingAdminChatMessageEventsArgs(Player player, string message, bool isA /// public Player Player { get; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Player/SendingGunSoundEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/SendingGunSoundEventArgs.cs index c1041453ab..636d3fec80 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/SendingGunSoundEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/SendingGunSoundEventArgs.cs @@ -6,11 +6,10 @@ // ----------------------------------------------------------------------- namespace Exiled.Events.EventArgs.Player { - using API.Features; - using API.Features.Items; - using AudioPooling; + using Exiled.API.Features; + using Exiled.API.Features.Items; using Exiled.Events.EventArgs.Interfaces; using UnityEngine; @@ -83,4 +82,4 @@ public SendingGunSoundEventArgs(InventorySystem.Items.Firearms.Firearm firearm, /// public bool IsAllowed { get; set; } = true; } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Player/SendingValidCommandEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/SendingValidCommandEventArgs.cs index 1ea8a6df71..f4ef316f08 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/SendingValidCommandEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/SendingValidCommandEventArgs.cs @@ -8,11 +8,11 @@ namespace Exiled.Events.EventArgs.Player { using CommandSystem; + using Exiled.API.Features; - using Exiled.API.Features.Pickups; using Exiled.Events.EventArgs.Interfaces; + using LabApi.Features.Enums; - using RemoteAdmin; /// /// Contains all information before a player sends the command. @@ -76,4 +76,4 @@ public SendingValidCommandEventArgs(Player player, ICommand command, CommandType /// public ICommand Command { get; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Player/SentValidCommandEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/SentValidCommandEventArgs.cs index 1c96ff88f9..3ecddd2c87 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/SentValidCommandEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/SentValidCommandEventArgs.cs @@ -8,11 +8,11 @@ namespace Exiled.Events.EventArgs.Player { using CommandSystem; + using Exiled.API.Features; - using Exiled.API.Features.Pickups; using Exiled.Events.EventArgs.Interfaces; + using LabApi.Features.Enums; - using RemoteAdmin; /// /// Contains all information after a player sends the command. @@ -80,4 +80,4 @@ public SentValidCommandEventArgs(Player player, ICommand command, CommandType co /// public ICommand Command { get; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Player/ShootingEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/ShootingEventArgs.cs index 3c2f9d12b6..8195b894a1 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/ShootingEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/ShootingEventArgs.cs @@ -7,10 +7,13 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; + using Exiled.API.Features; using Exiled.API.Features.Items; + using Interfaces; + using InventorySystem.Items.Firearms.Modules.Misc; + using UnityEngine; using BaseFirearm = InventorySystem.Items.Firearms.Firearm; diff --git a/EXILED/Exiled.Events/EventArgs/Player/ShotEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/ShotEventArgs.cs index 18d2303353..41ee8ac4f2 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/ShotEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/ShotEventArgs.cs @@ -7,10 +7,13 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; + using Exiled.API.Features; using Exiled.API.Features.Items; + using Interfaces; + using InventorySystem.Items.Firearms.Modules; + using UnityEngine; /// @@ -106,4 +109,4 @@ public ShotEventArgs(HitscanHitregModuleBase hitregModule, RaycastHit hitInfo, I /// public bool CanSpawnImpactEffects { get; set; } = true; } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Player/SpawnedEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/SpawnedEventArgs.cs index aa231bce41..b4364b8200 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/SpawnedEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/SpawnedEventArgs.cs @@ -7,8 +7,8 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; using Exiled.API.Enums; + using Exiled.API.Features; using Exiled.API.Features.Roles; using Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Player/SpawnedRagdollEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/SpawnedRagdollEventArgs.cs index a500495017..d8e41a57f6 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/SpawnedRagdollEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/SpawnedRagdollEventArgs.cs @@ -7,14 +7,17 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; + using Exiled.API.Features; using Interfaces; using PlayerRoles; using PlayerRoles.Ragdolls; + using PlayerStatsSystem; + using RelativePositioning; + using UnityEngine; /// diff --git a/EXILED/Exiled.Events/EventArgs/Player/SpawningEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/SpawningEventArgs.cs index 785ff5a3cc..67311616d5 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/SpawningEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/SpawningEventArgs.cs @@ -7,12 +7,12 @@ namespace Exiled.Events.EventArgs.Player { - using System; - using Exiled.API.Features; using Exiled.API.Features.Roles; using Exiled.Events.EventArgs.Interfaces; + using PlayerRoles; + using UnityEngine; /// @@ -20,6 +20,8 @@ namespace Exiled.Events.EventArgs.Player /// public class SpawningEventArgs : IPlayerEvent { + private Vector2 spawningRotation; + /// /// Initializes a new instance of the class. /// @@ -30,7 +32,7 @@ public class SpawningEventArgs : IPlayerEvent /// /// /// - /// + /// /// /// /// the spawned player's new role. @@ -39,7 +41,7 @@ public SpawningEventArgs(Player player, Vector3 position, float rotation, Player { Player = player; Position = position; - HorizontalRotation = rotation; + spawningRotation = new Vector2(0, rotation); NewRole = Role.Create(newRole); } @@ -62,17 +64,24 @@ public SpawningEventArgs(Player player, Vector3 position, float rotation, Player /// /// Rotation will apply only for . /// - public float HorizontalRotation { get; set; } + public Vector2 SpawningRotation + { + get => spawningRotation; + set + { + spawningRotation = value; + IsRotationModified = true; + } + } /// - /// Gets the player's old role. + /// Gets the player's new role. /// - [Obsolete("Removed because the method is no longer provide OldRole since version 14.0. Use Player.Role instead")] - public Role OldRole => Player.Role; + public Role NewRole { get; } /// - /// Gets the player's new role. + /// Gets a value indicating whether the spawning rotation was modified. /// - public Role NewRole { get; } + public bool IsRotationModified { get; private set; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Player/SpawningRagdollEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/SpawningRagdollEventArgs.cs index 9212024a25..9694a53946 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/SpawningRagdollEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/SpawningRagdollEventArgs.cs @@ -7,13 +7,17 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; + using Exiled.API.Features; + using Interfaces; using PlayerRoles; using PlayerRoles.Ragdolls; + using PlayerStatsSystem; + using RelativePositioning; + using UnityEngine; /// diff --git a/EXILED/Exiled.Events/EventArgs/Player/StayingOnEnvironmentalHazardEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/StayingOnEnvironmentalHazardEventArgs.cs index 002e6a9b8f..89f201ee26 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/StayingOnEnvironmentalHazardEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/StayingOnEnvironmentalHazardEventArgs.cs @@ -8,7 +8,9 @@ namespace Exiled.Events.EventArgs.Player { using Exiled.API.Features.Hazards; + using Hazards; + using Interfaces; /// diff --git a/EXILED/Exiled.Events/EventArgs/Player/StoppingGeneratorEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/StoppingGeneratorEventArgs.cs index 6462c655d8..87f61e1835 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/StoppingGeneratorEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/StoppingGeneratorEventArgs.cs @@ -7,8 +7,9 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; + using Exiled.API.Features; using Exiled.Events.EventArgs.Interfaces; + using MapGeneration.Distributors; /// diff --git a/EXILED/Exiled.Events/EventArgs/Player/ThrowingRequestEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/ThrowingRequestEventArgs.cs index ee1b36558a..32e04847ce 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/ThrowingRequestEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/ThrowingRequestEventArgs.cs @@ -50,4 +50,4 @@ public ThrowingRequestEventArgs(Player player, ThrowableItem item, ThrowableNetw /// public ThrowRequest RequestType { get; set; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Player/ThrownProjectileEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/ThrownProjectileEventArgs.cs index 14ab42de1e..48238a8e60 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/ThrownProjectileEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/ThrownProjectileEventArgs.cs @@ -54,4 +54,4 @@ public ThrownProjectileEventArgs(ThrownProjectile projectile, Player player, Thr /// public Pickup Pickup => Projectile; } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Player/TogglingFlashlightEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/TogglingFlashlightEventArgs.cs index 183476b48a..6ffaa716e3 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/TogglingFlashlightEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/TogglingFlashlightEventArgs.cs @@ -7,10 +7,11 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; - using API.Features.Items; + using Exiled.API.Features; + using Exiled.API.Features.Items; using Interfaces; + using InventorySystem.Items.ToggleableLights; /// diff --git a/EXILED/Exiled.Events/EventArgs/Player/TogglingNoClipEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/TogglingNoClipEventArgs.cs index 65ea273731..c0f397f7cf 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/TogglingNoClipEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/TogglingNoClipEventArgs.cs @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; + using Exiled.API.Features; using Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Player/TogglingRadioEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/TogglingRadioEventArgs.cs index 7b0c68d7a6..95dc42d62a 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/TogglingRadioEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/TogglingRadioEventArgs.cs @@ -7,10 +7,11 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; - + using Exiled.API.Features; using Exiled.API.Features.Items; + using Interfaces; + using InventorySystem.Items.Radio; /// @@ -64,4 +65,4 @@ public TogglingRadioEventArgs(Player player, RadioItem radio, bool newState, boo /// public Player Player { get; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Player/TogglingWeaponFlashlightEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/TogglingWeaponFlashlightEventArgs.cs index 3c6f2f7886..cb30b5dc42 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/TogglingWeaponFlashlightEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/TogglingWeaponFlashlightEventArgs.cs @@ -7,8 +7,8 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; - using API.Features.Items; + using Exiled.API.Features; + using Exiled.API.Features.Items; using Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Player/TriggeringTeslaEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/TriggeringTeslaEventArgs.cs index 6c897ba955..908c3c1ffb 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/TriggeringTeslaEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/TriggeringTeslaEventArgs.cs @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; + using Exiled.API.Features; using Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Player/UnloadedWeaponEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/UnloadedWeaponEventArgs.cs index 69a37671dc..e3be85338e 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/UnloadedWeaponEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/UnloadedWeaponEventArgs.cs @@ -7,8 +7,8 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; - using API.Features.Items; + using Exiled.API.Features; + using Exiled.API.Features.Items; using Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Player/UnloadingWeaponEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/UnloadingWeaponEventArgs.cs index 2ac5ce4a2f..1cc14e9f77 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/UnloadingWeaponEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/UnloadingWeaponEventArgs.cs @@ -7,8 +7,8 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; - using API.Features.Items; + using Exiled.API.Features; + using Exiled.API.Features.Items; using Interfaces; @@ -51,4 +51,4 @@ public UnloadingWeaponEventArgs(InventorySystem.Items.Firearms.Firearm firearm, /// public Player Player { get; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Player/UnlockingGeneratorEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/UnlockingGeneratorEventArgs.cs index 77541732d0..63c5ce8a4f 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/UnlockingGeneratorEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/UnlockingGeneratorEventArgs.cs @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; + using Exiled.API.Features; using Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Player/UsedItemEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/UsedItemEventArgs.cs index c6aeed7ffb..3d57657aed 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/UsedItemEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/UsedItemEventArgs.cs @@ -7,8 +7,8 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; - using API.Features.Items; + using Exiled.API.Features; + using Exiled.API.Features.Items; using Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Player/UsingItemCompletedEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/UsingItemCompletedEventArgs.cs index 027d0a36c4..51b133fce6 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/UsingItemCompletedEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/UsingItemCompletedEventArgs.cs @@ -7,8 +7,9 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; + using Exiled.API.Features; using Exiled.API.Features.Items; + using Interfaces; using InventorySystem.Items.Usables; diff --git a/EXILED/Exiled.Events/EventArgs/Player/UsingItemEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/UsingItemEventArgs.cs index 317d6ddbeb..e11878f465 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/UsingItemEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/UsingItemEventArgs.cs @@ -7,8 +7,9 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; + using Exiled.API.Features; using Exiled.API.Features.Items; + using Interfaces; using InventorySystem.Items.Usables; diff --git a/EXILED/Exiled.Events/EventArgs/Player/UsingMicroHIDEnergyEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/UsingMicroHIDEnergyEventArgs.cs index 2cfe7fee35..c87c0ade86 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/UsingMicroHIDEnergyEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/UsingMicroHIDEnergyEventArgs.cs @@ -7,8 +7,8 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; - using API.Features.Items; + using Exiled.API.Features; + using Exiled.API.Features.Items; using Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Player/UsingRadioBatteryEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/UsingRadioBatteryEventArgs.cs index 3b3af1c73f..340f07bd0e 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/UsingRadioBatteryEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/UsingRadioBatteryEventArgs.cs @@ -7,8 +7,8 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; - using API.Features.Items; + using Exiled.API.Features; + using Exiled.API.Features.Items; using Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Player/VerifiedEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/VerifiedEventArgs.cs index ec1d841365..d0586ecd65 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/VerifiedEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/VerifiedEventArgs.cs @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Player { - using API.Features; + using Exiled.API.Features; using Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Player/VoiceChattingEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Player/VoiceChattingEventArgs.cs index 5a488c3d2e..06b6500a71 100644 --- a/EXILED/Exiled.Events/EventArgs/Player/VoiceChattingEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Player/VoiceChattingEventArgs.cs @@ -58,4 +58,4 @@ public VoiceChattingEventArgs(Player player, VoiceModuleBase voiceModule, VoiceM /// public bool IsAllowed { get; set; } = true; } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Scp049/ActivatingSenseEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp049/ActivatingSenseEventArgs.cs index a6144bbb8c..3fe1d31ba6 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp049/ActivatingSenseEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp049/ActivatingSenseEventArgs.cs @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Scp049 { - using API.Features; + using Exiled.API.Features; using Exiled.Events.EventArgs.Interfaces; using Scp049Role = API.Features.Roles.Scp049Role; @@ -61,4 +61,4 @@ public ActivatingSenseEventArgs(Player player, Player target, bool isAllowed = t /// public bool IsAllowed { get; set; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Scp049/FinishingRecallEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp049/FinishingRecallEventArgs.cs index fc773a7fcb..f6767158ca 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp049/FinishingRecallEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp049/FinishingRecallEventArgs.cs @@ -7,9 +7,11 @@ namespace Exiled.Events.EventArgs.Scp049 { - using API.Features; + using Exiled.API.Features; using Exiled.API.Features.Roles; + using Interfaces; + using PlayerRoles.Ragdolls; /// diff --git a/EXILED/Exiled.Events/EventArgs/Scp049/FinishingSenseEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp049/FinishingSenseEventArgs.cs index 43baf5987b..d8c918c99d 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp049/FinishingSenseEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp049/FinishingSenseEventArgs.cs @@ -63,4 +63,4 @@ public FinishingSenseEventArgs(ReferenceHub scp049, ReferenceHub target, double /// public bool IsAllowed { get; set; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Scp049/SendingCallEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp049/SendingCallEventArgs.cs index e859023690..c261aae666 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp049/SendingCallEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp049/SendingCallEventArgs.cs @@ -7,8 +7,9 @@ namespace Exiled.Events.EventArgs.Scp049 { - using API.Features; + using Exiled.API.Features; using Exiled.API.Features.Roles; + using Interfaces; /// diff --git a/EXILED/Exiled.Events/EventArgs/Scp049/StartingRecallEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp049/StartingRecallEventArgs.cs index 93757c990a..d591160096 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp049/StartingRecallEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp049/StartingRecallEventArgs.cs @@ -7,8 +7,9 @@ namespace Exiled.Events.EventArgs.Scp049 { - using API.Features; + using Exiled.API.Features; using Exiled.API.Features.Roles; + using Interfaces; /// @@ -60,4 +61,4 @@ public StartingRecallEventArgs(Player player, Ragdoll ragdoll, bool isAllowed = /// public Ragdoll Ragdoll { get; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Scp0492/ConsumedCorpseEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp0492/ConsumedCorpseEventArgs.cs index 56aff95ac3..43fd31568e 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp0492/ConsumedCorpseEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp0492/ConsumedCorpseEventArgs.cs @@ -7,8 +7,9 @@ namespace Exiled.Events.EventArgs.Scp0492 { - using API.Features; + using Exiled.API.Features; using Exiled.API.Features.Roles; + using Interfaces; using PlayerRoles.PlayableScps.Scp049.Zombies; @@ -50,4 +51,4 @@ public ConsumedCorpseEventArgs(ReferenceHub player, BasicRagdoll ragDoll) /// public float ConsumeHeal { get; set; } = ZombieConsumeAbility.ConsumeHeal; } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Scp0492/ConsumingCorpseEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp0492/ConsumingCorpseEventArgs.cs index 06de15a086..94c539686e 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp0492/ConsumingCorpseEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp0492/ConsumingCorpseEventArgs.cs @@ -7,8 +7,9 @@ namespace Exiled.Events.EventArgs.Scp0492 { - using API.Features; + using Exiled.API.Features; using Exiled.API.Features.Roles; + using Interfaces; using PlayerRoles.PlayableScps.Scp049.Zombies; diff --git a/EXILED/Exiled.Events/EventArgs/Scp079/ChangingSpeakerStatusEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp079/ChangingSpeakerStatusEventArgs.cs index d827bbd254..b93d7a3775 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp079/ChangingSpeakerStatusEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp079/ChangingSpeakerStatusEventArgs.cs @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Scp079 { - using API.Features; + using Exiled.API.Features; using Exiled.API.Features.Roles; diff --git a/EXILED/Exiled.Events/EventArgs/Scp079/GainingExperienceEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp079/GainingExperienceEventArgs.cs index 973cbfe84d..ecfcc677e4 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp079/GainingExperienceEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp079/GainingExperienceEventArgs.cs @@ -9,11 +9,10 @@ namespace Exiled.Events.EventArgs.Scp079 { using Exiled.API.Features; using Exiled.Events.EventArgs.Interfaces; + using PlayerRoles; using PlayerRoles.PlayableScps.Scp079; - using Scp079Role = API.Features.Roles.Scp079Role; - /// /// Contains all information before SCP-079 gains experience. /// diff --git a/EXILED/Exiled.Events/EventArgs/Scp079/GainingLevelEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp079/GainingLevelEventArgs.cs index 57eeae5ded..54c781883e 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp079/GainingLevelEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp079/GainingLevelEventArgs.cs @@ -7,8 +7,9 @@ namespace Exiled.Events.EventArgs.Scp079 { - using API.Features; + using Exiled.API.Features; using Exiled.API.Features.Roles; + using Interfaces; /// diff --git a/EXILED/Exiled.Events/EventArgs/Scp079/LosingSignalEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp079/LosingSignalEventArgs.cs index cae1c775e2..33d635bed1 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp079/LosingSignalEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp079/LosingSignalEventArgs.cs @@ -41,4 +41,4 @@ public LosingSignalEventArgs(ReferenceHub player) /// public API.Features.Roles.Scp079Role Scp079 { get; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Scp079/LostSignalEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp079/LostSignalEventArgs.cs index 247eb5c20f..38f8dd2ee8 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp079/LostSignalEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp079/LostSignalEventArgs.cs @@ -35,4 +35,4 @@ public LostSignalEventArgs(ReferenceHub player) /// public API.Features.Roles.Scp079Role Scp079 { get; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Scp079/PingingEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp079/PingingEventArgs.cs index 811dca1977..065658655e 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp079/PingingEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp079/PingingEventArgs.cs @@ -7,10 +7,10 @@ namespace Exiled.Events.EventArgs.Scp079 { - using API.Features; - using Exiled.API.Enums; + using Exiled.API.Features; using Exiled.API.Features.Roles; + using Interfaces; using RelativePositioning; diff --git a/EXILED/Exiled.Events/EventArgs/Scp079/RecontainedEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp079/RecontainedEventArgs.cs index c897dd1a5f..4be20db3cb 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp079/RecontainedEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp079/RecontainedEventArgs.cs @@ -7,8 +7,9 @@ namespace Exiled.Events.EventArgs.Scp079 { - using API.Features; + using Exiled.API.Features; using Exiled.API.Features.Roles; + using Interfaces; /// @@ -57,4 +58,4 @@ public RecontainedEventArgs(Player player, PlayerRoles.PlayableScps.Scp079.Scp07 /// public bool IsAutomatic { get; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Scp079/RecontainingEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp079/RecontainingEventArgs.cs index 5bde59481d..d344068959 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp079/RecontainingEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp079/RecontainingEventArgs.cs @@ -39,4 +39,4 @@ public RecontainingEventArgs(BreakableWindow recontainer) /// public bool IsAutomatic { get; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Scp079/RoomBlackoutEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp079/RoomBlackoutEventArgs.cs index 513a7d266a..6c1705e4c5 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp079/RoomBlackoutEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp079/RoomBlackoutEventArgs.cs @@ -8,7 +8,6 @@ namespace Exiled.Events.EventArgs.Scp079 { using Exiled.API.Features; - using Exiled.API.Features.Roles; using Exiled.Events.EventArgs.Interfaces; using MapGeneration; diff --git a/EXILED/Exiled.Events/EventArgs/Scp079/TriggeringDoorEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp079/TriggeringDoorEventArgs.cs index e93c97772e..3ee025e03a 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp079/TriggeringDoorEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp079/TriggeringDoorEventArgs.cs @@ -7,10 +7,11 @@ namespace Exiled.Events.EventArgs.Scp079 { - using API.Features; + using Exiled.API.Features; using Exiled.API.Features.Doors; using Exiled.API.Features.Roles; using Exiled.Events.EventArgs.Interfaces; + using Interactables.Interobjects.DoorUtils; using Player; diff --git a/EXILED/Exiled.Events/EventArgs/Scp079/ZoneBlackoutEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp079/ZoneBlackoutEventArgs.cs index 6f23053ee4..e7eb9cb02e 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp079/ZoneBlackoutEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp079/ZoneBlackoutEventArgs.cs @@ -11,10 +11,10 @@ namespace Exiled.Events.EventArgs.Scp079 using Exiled.API.Extensions; using Exiled.API.Features; using Exiled.Events.EventArgs.Interfaces; + using MapGeneration; - using PlayerRoles.PlayableScps.Scp079; - using Scp079Role = API.Features.Roles.Scp079Role; + using PlayerRoles.PlayableScps.Scp079; /// /// Contains all information before SCP-079 lockdowns a room. @@ -92,4 +92,4 @@ public ZoneBlackoutEventArgs(ReferenceHub player, FacilityZone zone, float auxil /// public API.Features.Roles.Scp079Role Scp079 { get; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Scp096/AddingTargetEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp096/AddingTargetEventArgs.cs index 13e0660a7e..dfd9b25120 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp096/AddingTargetEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp096/AddingTargetEventArgs.cs @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Scp096 { - using API.Features; + using Exiled.API.Features; using Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Scp096/CalmingDownEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp096/CalmingDownEventArgs.cs index c025e712ce..5a35f807f3 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp096/CalmingDownEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp096/CalmingDownEventArgs.cs @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Scp096 { - using API.Features; + using Exiled.API.Features; using Exiled.API.Features.Roles; using Exiled.Events.EventArgs.Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Scp096/ChargingEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp096/ChargingEventArgs.cs index 299ce58675..6f40cd9fdc 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp096/ChargingEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp096/ChargingEventArgs.cs @@ -7,8 +7,9 @@ namespace Exiled.Events.EventArgs.Scp096 { - using API.Features; + using Exiled.API.Features; using Exiled.API.Features.Roles; + using Interfaces; /// diff --git a/EXILED/Exiled.Events/EventArgs/Scp096/EnragingEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp096/EnragingEventArgs.cs index 67ce2db693..d931149bd8 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp096/EnragingEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp096/EnragingEventArgs.cs @@ -7,8 +7,9 @@ namespace Exiled.Events.EventArgs.Scp096 { - using API.Features; + using Exiled.API.Features; using Exiled.API.Features.Roles; + using Interfaces; /// diff --git a/EXILED/Exiled.Events/EventArgs/Scp096/RemovingTargetEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp096/RemovingTargetEventArgs.cs index 1dc1934942..f5afec9bf7 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp096/RemovingTargetEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp096/RemovingTargetEventArgs.cs @@ -1,4 +1,4 @@ -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- // // Copyright (c) ExMod Team. All rights reserved. // Licensed under the CC BY-SA 3.0 license. @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Scp096 { - using API.Features; + using Exiled.API.Features; using Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Scp096/StartPryingGateEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp096/StartPryingGateEventArgs.cs index 22052c0350..648199d227 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp096/StartPryingGateEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp096/StartPryingGateEventArgs.cs @@ -7,10 +7,11 @@ namespace Exiled.Events.EventArgs.Scp096 { - using API.Features; - using API.Features.Doors; + using Exiled.API.Features; + using Exiled.API.Features.Doors; using Interactables.Interobjects; + using Interfaces; using Scp096Role = API.Features.Roles.Scp096Role; diff --git a/EXILED/Exiled.Events/EventArgs/Scp096/TryingNotToCryEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp096/TryingNotToCryEventArgs.cs index 803d7ddbcc..288ea9f8fe 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp096/TryingNotToCryEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp096/TryingNotToCryEventArgs.cs @@ -7,9 +7,11 @@ namespace Exiled.Events.EventArgs.Scp096 { - using API.Features; + using Exiled.API.Features; using Exiled.API.Features.Doors; + using Interfaces; + using UnityEngine; using Scp096Role = API.Features.Roles.Scp096Role; diff --git a/EXILED/Exiled.Events/EventArgs/Scp106/ExitStalkingEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp106/ExitStalkingEventArgs.cs index b501c112c9..26aba1480c 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp106/ExitStalkingEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp106/ExitStalkingEventArgs.cs @@ -7,7 +7,8 @@ namespace Exiled.Events.EventArgs.Scp106 { - using API.Features; + using Exiled.API.Features; + using Interfaces; using Scp106Role = API.Features.Roles.Scp106Role; diff --git a/EXILED/Exiled.Events/EventArgs/Scp106/StalkingEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp106/StalkingEventArgs.cs index b94a3db6ff..cb3a10626b 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp106/StalkingEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp106/StalkingEventArgs.cs @@ -7,8 +7,10 @@ namespace Exiled.Events.EventArgs.Scp106 { - using API.Features; + using Exiled.API.Features; + using Interfaces; + using PlayerRoles.PlayableScps.Scp106; using Scp106Role = API.Features.Roles.Scp106Role; diff --git a/EXILED/Exiled.Events/EventArgs/Scp106/TeleportingEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp106/TeleportingEventArgs.cs index 52f503cf6a..9e5067f528 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp106/TeleportingEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp106/TeleportingEventArgs.cs @@ -7,8 +7,9 @@ namespace Exiled.Events.EventArgs.Scp106 { - using API.Features; + using Exiled.API.Features; using Exiled.API.Features.Roles; + using Interfaces; using UnityEngine; diff --git a/EXILED/Exiled.Events/EventArgs/Scp127/GainedExperienceEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp127/GainedExperienceEventArgs.cs index 533ccbb5ce..da3268e6f2 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp127/GainedExperienceEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp127/GainedExperienceEventArgs.cs @@ -10,6 +10,7 @@ namespace Exiled.Events.EventArgs.Scp127 using Exiled.API.Features; using Exiled.API.Features.Items; using Exiled.Events.EventArgs.Interfaces; + using InventorySystem.Items.Firearms.Modules.Scp127; /// diff --git a/EXILED/Exiled.Events/EventArgs/Scp127/GainingExperienceEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp127/GainingExperienceEventArgs.cs index 6a1d7b738b..86b22c14df 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp127/GainingExperienceEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp127/GainingExperienceEventArgs.cs @@ -1,4 +1,4 @@ -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- // // Copyright (c) ExMod Team. All rights reserved. // Licensed under the CC BY-SA 3.0 license. @@ -10,6 +10,7 @@ namespace Exiled.Events.EventArgs.Scp127 using Exiled.API.Features; using Exiled.API.Features.Items; using Exiled.Events.EventArgs.Interfaces; + using InventorySystem.Items.Firearms.Modules.Scp127; /// diff --git a/EXILED/Exiled.Events/EventArgs/Scp127/TalkedEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp127/TalkedEventArgs.cs index 10810403d5..8c77180c9e 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp127/TalkedEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp127/TalkedEventArgs.cs @@ -1,4 +1,4 @@ -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- // // Copyright (c) ExMod Team. All rights reserved. // Licensed under the CC BY-SA 3.0 license. @@ -10,6 +10,7 @@ namespace Exiled.Events.EventArgs.Scp127 using Exiled.API.Features; using Exiled.API.Features.Items; using Exiled.Events.EventArgs.Interfaces; + using InventorySystem.Items.Firearms.Modules.Scp127; /// diff --git a/EXILED/Exiled.Events/EventArgs/Scp127/TalkingEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp127/TalkingEventArgs.cs index b8934566a8..614551c797 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp127/TalkingEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp127/TalkingEventArgs.cs @@ -10,6 +10,7 @@ namespace Exiled.Events.EventArgs.Scp127 using Exiled.API.Features; using Exiled.API.Features.Items; using Exiled.Events.EventArgs.Interfaces; + using InventorySystem.Items.Firearms.Modules.Scp127; /// diff --git a/EXILED/Exiled.Events/EventArgs/Scp1344/ChangedStatusEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp1344/ChangedStatusEventArgs.cs index c5c772529f..7c8c6b287e 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp1344/ChangedStatusEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp1344/ChangedStatusEventArgs.cs @@ -56,4 +56,4 @@ public ChangedStatusEventArgs(ItemBase item, Scp1344Status scp1344Status) [Obsolete("Please use ChangingStatusEventArgs::IsAllowed instead of this", true)] public bool IsAllowed { get; set; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Scp1344/ChangingStatusEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp1344/ChangingStatusEventArgs.cs index 6cf7449e99..4330cc41ce 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp1344/ChangingStatusEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp1344/ChangingStatusEventArgs.cs @@ -9,6 +9,7 @@ namespace Exiled.Events.EventArgs.Scp1344 { using Exiled.API.Features.Items; using Exiled.Events.EventArgs.Interfaces; + using InventorySystem.Items; using InventorySystem.Items.Usables.Scp1344; @@ -61,4 +62,4 @@ public ChangingStatusEventArgs(ItemBase item, Scp1344Status scp1344StatusNew, Sc /// public bool IsAllowed { get; set; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Scp1344/DeactivatedEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp1344/DeactivatedEventArgs.cs index 79ec6925ee..c00535c169 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp1344/DeactivatedEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp1344/DeactivatedEventArgs.cs @@ -41,4 +41,4 @@ public DeactivatedEventArgs(Item item) /// public Scp1344 Scp1344 { get; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Scp1344/DeactivatingEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp1344/DeactivatingEventArgs.cs index 8ff103fa53..680041f5df 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp1344/DeactivatingEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp1344/DeactivatingEventArgs.cs @@ -54,4 +54,4 @@ public DeactivatingEventArgs(Item item, bool isAllowed = true) /// public bool IsAllowed { get; set; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Scp1507/AttackingDoorEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp1507/AttackingDoorEventArgs.cs index c58330e252..e3f92113bc 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp1507/AttackingDoorEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp1507/AttackingDoorEventArgs.cs @@ -13,6 +13,7 @@ namespace Exiled.Events.EventArgs.Scp1507 using Exiled.API.Features.Doors; using Exiled.API.Features.Roles; using Exiled.Events.EventArgs.Interfaces; + using Interactables.Interobjects.DoorUtils; /// diff --git a/EXILED/Exiled.Events/EventArgs/Scp1507/SpawningFlamingosEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp1507/SpawningFlamingosEventArgs.cs index 376eba5abf..1806cc8eb4 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp1507/SpawningFlamingosEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp1507/SpawningFlamingosEventArgs.cs @@ -13,8 +13,8 @@ namespace Exiled.Events.EventArgs.Scp1507 using Exiled.API.Features; using Exiled.Events.EventArgs.Interfaces; + using PlayerRoles.PlayableScps.Scp1507; - using Utils.NonAllocLINQ; /// /// Contains all information before flamingos get spawned. @@ -30,7 +30,7 @@ public class SpawningFlamingosEventArgs : IDeniableEvent, IPlayerEvent public SpawningFlamingosEventArgs(Player newAlpha, bool isAllowed = true) { Player = newAlpha; - SpawnablePlayers = ReferenceHub.AllHubs.Where(Scp1507Spawner.ValidatePlayer).Select(x => Player.Get(x)).ToHashSet(); + SpawnablePlayers = ReferenceHub.AllHubs.Where(Scp1507Spawner.ValidatePlayer).Select(Player.Get).ToHashSet(); IsAllowed = isAllowed; } diff --git a/EXILED/Exiled.Events/EventArgs/Scp1507/UsingTapeEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp1507/UsingTapeEventArgs.cs index 0121d02d95..09eb92c630 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp1507/UsingTapeEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp1507/UsingTapeEventArgs.cs @@ -12,6 +12,7 @@ namespace Exiled.Events.EventArgs.Scp1507 using Exiled.API.Features; using Exiled.API.Features.Items; using Exiled.Events.EventArgs.Interfaces; + using InventorySystem.Items; /// diff --git a/EXILED/Exiled.Events/EventArgs/Scp1509/ResurrectingEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp1509/ResurrectingEventArgs.cs index 4484f3b730..90e3fd07cd 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp1509/ResurrectingEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp1509/ResurrectingEventArgs.cs @@ -1,4 +1,4 @@ -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- // // Copyright (c) ExMod Team. All rights reserved. // Licensed under the CC BY-SA 3.0 license. @@ -10,7 +10,9 @@ namespace Exiled.Events.EventArgs.Scp1509 using Exiled.API.Features; using Exiled.API.Features.Items; using Exiled.Events.EventArgs.Interfaces; + using InventorySystem.Items.Scp1509; + using PlayerRoles; /// diff --git a/EXILED/Exiled.Events/EventArgs/Scp1509/TriggeringAttackEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp1509/TriggeringAttackEventArgs.cs index cbc9b54106..17d8d7c63c 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp1509/TriggeringAttackEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp1509/TriggeringAttackEventArgs.cs @@ -1,4 +1,4 @@ -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- // // Copyright (c) ExMod Team. All rights reserved. // Licensed under the CC BY-SA 3.0 license. @@ -10,6 +10,7 @@ namespace Exiled.Events.EventArgs.Scp1509 using Exiled.API.Features; using Exiled.API.Features.Items; using Exiled.Events.EventArgs.Interfaces; + using InventorySystem.Items.Scp1509; /// diff --git a/EXILED/Exiled.Events/EventArgs/Scp173/AddingObserverEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp173/AddingObserverEventArgs.cs index b47ee821c6..6df42adb33 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp173/AddingObserverEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp173/AddingObserverEventArgs.cs @@ -9,6 +9,7 @@ namespace Exiled.Events.EventArgs.Scp173 { using Exiled.API.Features; using Exiled.API.Features.Roles; + using Interfaces; /// diff --git a/EXILED/Exiled.Events/EventArgs/Scp173/BeingObservedEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp173/BeingObservedEventArgs.cs index d1ee0750bf..005499bb89 100755 --- a/EXILED/Exiled.Events/EventArgs/Scp173/BeingObservedEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp173/BeingObservedEventArgs.cs @@ -54,4 +54,4 @@ public BeingObservedEventArgs(API.Features.Player target, API.Features.Player sc /// public bool IsAllowed { get; set; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Scp173/BlinkingEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp173/BlinkingEventArgs.cs index 95f3e2a084..36990b3464 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp173/BlinkingEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp173/BlinkingEventArgs.cs @@ -9,7 +9,7 @@ namespace Exiled.Events.EventArgs.Scp173 { using System.Collections.Generic; - using API.Features; + using Exiled.API.Features; using Interfaces; @@ -73,4 +73,4 @@ public BlinkingEventArgs(Player player, List targets, Vector3 blinkPos) /// public Scp173Role Scp173 { get; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Scp173/BlinkingRequestEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp173/BlinkingRequestEventArgs.cs index f526d55c38..af7b57a865 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp173/BlinkingRequestEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp173/BlinkingRequestEventArgs.cs @@ -10,7 +10,8 @@ namespace Exiled.Events.EventArgs.Scp173 using System.Collections.Generic; using System.Linq; - using API.Features; + using Exiled.API.Features; + using Interfaces; using Scp173Role = API.Features.Roles.Scp173Role; @@ -33,7 +34,7 @@ public BlinkingRequestEventArgs(Player player, HashSet targets) { Player = player; Scp173 = player.Role.As(); - Targets = targets.Select(target => Player.Get(target)).ToList(); + Targets = targets.Select(Player.Get).ToList(); } /// @@ -54,4 +55,4 @@ public BlinkingRequestEventArgs(Player player, HashSet targets) /// public Scp173Role Scp173 { get; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Scp173/PlacingTantrumEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp173/PlacingTantrumEventArgs.cs index 70ed06bdf4..6b651d01a4 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp173/PlacingTantrumEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp173/PlacingTantrumEventArgs.cs @@ -13,6 +13,7 @@ namespace Exiled.Events.EventArgs.Scp173 using Exiled.Events.EventArgs.Interfaces; using Hazards; + using PlayerRoles.Subroutines; using Scp173Role = API.Features.Roles.Scp173Role; diff --git a/EXILED/Exiled.Events/EventArgs/Scp173/RemovedObserverEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp173/RemovedObserverEventArgs.cs index a941cfeea6..c4db144aec 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp173/RemovedObserverEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp173/RemovedObserverEventArgs.cs @@ -9,6 +9,7 @@ namespace Exiled.Events.EventArgs.Scp173 { using Exiled.API.Features; using Exiled.API.Features.Roles; + using Interfaces; /// diff --git a/EXILED/Exiled.Events/EventArgs/Scp173/UsingBreakneckSpeedsEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp173/UsingBreakneckSpeedsEventArgs.cs index 32216ba9e0..df671cccc2 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp173/UsingBreakneckSpeedsEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp173/UsingBreakneckSpeedsEventArgs.cs @@ -7,8 +7,9 @@ namespace Exiled.Events.EventArgs.Scp173 { - using API.Features; + using Exiled.API.Features; using Exiled.API.Features.Roles; + using Interfaces; /// @@ -54,4 +55,4 @@ public UsingBreakneckSpeedsEventArgs(Player player, bool isActivationRequested, /// public Scp173Role Scp173 { get; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Scp244/OpeningScp244EventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp244/OpeningScp244EventArgs.cs index d8550dd4e4..808c41a500 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp244/OpeningScp244EventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp244/OpeningScp244EventArgs.cs @@ -38,4 +38,4 @@ public OpeningScp244EventArgs(Scp244DeployablePickup pickup) /// public bool IsAllowed { get; set; } = true; } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Scp244/UsingScp244EventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp244/UsingScp244EventArgs.cs index ab00eaab12..cc53b717a8 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp244/UsingScp244EventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp244/UsingScp244EventArgs.cs @@ -7,8 +7,8 @@ namespace Exiled.Events.EventArgs.Scp244 { - using API.Features; - using API.Features.Items; + using Exiled.API.Features; + using Exiled.API.Features.Items; using Interfaces; @@ -53,4 +53,4 @@ public UsingScp244EventArgs(Scp244Item scp244, Player player, bool isAllowed = t /// public Player Player { get; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Scp2536/FindingPositionEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp2536/FindingPositionEventArgs.cs index 1bb5773188..c891012223 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp2536/FindingPositionEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp2536/FindingPositionEventArgs.cs @@ -8,6 +8,7 @@ namespace Exiled.Events.EventArgs.Scp2536 { using Christmas.Scp2536; + using Exiled.API.Features; using Exiled.Events.EventArgs.Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Scp2536/FoundPositionEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp2536/FoundPositionEventArgs.cs index d4935e6c92..193e057934 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp2536/FoundPositionEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp2536/FoundPositionEventArgs.cs @@ -1,4 +1,4 @@ -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- // // Copyright (c) ExMod Team. All rights reserved. // Licensed under the CC BY-SA 3.0 license. @@ -8,6 +8,7 @@ namespace Exiled.Events.EventArgs.Scp2536 { using Christmas.Scp2536; + using Exiled.API.Features; using Exiled.Events.EventArgs.Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Scp2536/GrantingGiftEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp2536/GrantingGiftEventArgs.cs index 4ecd4af405..7e1297d2da 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp2536/GrantingGiftEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp2536/GrantingGiftEventArgs.cs @@ -8,6 +8,7 @@ namespace Exiled.Events.EventArgs.Scp2536 { using Christmas.Scp2536; + using Exiled.API.Features; using Exiled.Events.EventArgs.Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Scp2536/OpeningGiftEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp2536/OpeningGiftEventArgs.cs index b952ed7fe3..8cc44aec2a 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp2536/OpeningGiftEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp2536/OpeningGiftEventArgs.cs @@ -7,7 +7,6 @@ namespace Exiled.Events.EventArgs.Scp2536 { - using Christmas.Scp2536; using Exiled.API.Features; using Exiled.Events.EventArgs.Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Scp3114/DancingEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp3114/DancingEventArgs.cs index 49488a20bf..af9abfcf79 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp3114/DancingEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp3114/DancingEventArgs.cs @@ -11,7 +11,6 @@ namespace Exiled.Events.EventArgs.Scp3114 using Exiled.API.Features; using Exiled.API.Features.Roles; using Exiled.Events.EventArgs.Interfaces; - using Exiled.Events.Patches.Events.Scp3114; /// /// Contains all information before SCP-3114 changes its dancing status. diff --git a/EXILED/Exiled.Events/EventArgs/Scp3114/DisguisedEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp3114/DisguisedEventArgs.cs index b7c7d4bf6b..5f74301a1b 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp3114/DisguisedEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp3114/DisguisedEventArgs.cs @@ -7,8 +7,9 @@ namespace Exiled.Events.EventArgs.Scp3114 { - using API.Features; + using Exiled.API.Features; using Exiled.API.Features.Roles; + using Interfaces; /// diff --git a/EXILED/Exiled.Events/EventArgs/Scp3114/DisguisingEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp3114/DisguisingEventArgs.cs index 050b4beb5b..3296b107d1 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp3114/DisguisingEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp3114/DisguisingEventArgs.cs @@ -7,8 +7,9 @@ namespace Exiled.Events.EventArgs.Scp3114 { - using API.Features; + using Exiled.API.Features; using Exiled.API.Features.Roles; + using Interfaces; /// diff --git a/EXILED/Exiled.Events/EventArgs/Scp3114/RevealedEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp3114/RevealedEventArgs.cs index cab47ebc91..4bd687b7d5 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp3114/RevealedEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp3114/RevealedEventArgs.cs @@ -7,8 +7,9 @@ namespace Exiled.Events.EventArgs.Scp3114 { - using API.Features; + using Exiled.API.Features; using Exiled.API.Features.Roles; + using Interfaces; /// diff --git a/EXILED/Exiled.Events/EventArgs/Scp3114/RevealingEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp3114/RevealingEventArgs.cs index 215ffd1771..b19db42e62 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp3114/RevealingEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp3114/RevealingEventArgs.cs @@ -7,8 +7,9 @@ namespace Exiled.Events.EventArgs.Scp3114 { - using API.Features; + using Exiled.API.Features; using Exiled.API.Features.Roles; + using Interfaces; /// diff --git a/EXILED/Exiled.Events/EventArgs/Scp3114/SlappedEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp3114/SlappedEventArgs.cs index 41a01cdce7..3562415936 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp3114/SlappedEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp3114/SlappedEventArgs.cs @@ -7,9 +7,11 @@ namespace Exiled.Events.EventArgs.Scp3114 { - using API.Features; + using Exiled.API.Features; using Exiled.API.Features.Roles; + using Interfaces; + using PlayerRoles.PlayableScps.Subroutines; /// diff --git a/EXILED/Exiled.Events/EventArgs/Scp3114/StranglingEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp3114/StranglingEventArgs.cs index 94b45227c4..bb803f6606 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp3114/StranglingEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp3114/StranglingEventArgs.cs @@ -7,9 +7,9 @@ namespace Exiled.Events.EventArgs.Scp3114 { - using API.Features; + using Exiled.API.Features; + using Interfaces; - using PlayerRoles.PlayableScps.Scp3114; using Scp3114Role = Exiled.API.Features.Roles.Scp3114Role; @@ -51,4 +51,4 @@ public StranglingEventArgs(ReferenceHub hub, ReferenceHub target) /// public bool IsAllowed { get; set; } = true; } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Scp3114/TryUseBodyEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp3114/TryUseBodyEventArgs.cs index f63aaba952..9d067c1a0a 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp3114/TryUseBodyEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp3114/TryUseBodyEventArgs.cs @@ -7,8 +7,9 @@ namespace Exiled.Events.EventArgs.Scp3114 { - using API.Features; + using Exiled.API.Features; using Exiled.API.Features.Roles; + using Interfaces; /// diff --git a/EXILED/Exiled.Events/EventArgs/Scp3114/VoiceLinesEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp3114/VoiceLinesEventArgs.cs index db71b6815a..ff96443174 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp3114/VoiceLinesEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp3114/VoiceLinesEventArgs.cs @@ -7,8 +7,9 @@ namespace Exiled.Events.EventArgs.Scp3114 { - using API.Features; + using Exiled.API.Features; using Exiled.API.Features.Roles; + using Interfaces; using static PlayerRoles.PlayableScps.Scp3114.Scp3114VoiceLines; diff --git a/EXILED/Exiled.Events/EventArgs/Scp330/DroppingScp330EventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp330/DroppingScp330EventArgs.cs index dbb905ee8a..af5d2b7e80 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp330/DroppingScp330EventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp330/DroppingScp330EventArgs.cs @@ -7,8 +7,8 @@ namespace Exiled.Events.EventArgs.Scp330 { - using API.Features; - using API.Features.Items; + using Exiled.API.Features; + using Exiled.API.Features.Items; using Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Scp330/EatenScp330EventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp330/EatenScp330EventArgs.cs index 74633d8c61..0f7f0a5123 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp330/EatenScp330EventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp330/EatenScp330EventArgs.cs @@ -7,8 +7,9 @@ namespace Exiled.Events.EventArgs.Scp330 { - using API.Features; + using Exiled.API.Features; using Exiled.API.Features.Items; + using Interfaces; using InventorySystem.Items.Usables.Scp330; diff --git a/EXILED/Exiled.Events/EventArgs/Scp330/EatingScp330EventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp330/EatingScp330EventArgs.cs index ab15aa1d6b..b84aafaf61 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp330/EatingScp330EventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp330/EatingScp330EventArgs.cs @@ -7,8 +7,9 @@ namespace Exiled.Events.EventArgs.Scp330 { - using API.Features; + using Exiled.API.Features; using Exiled.API.Features.Items; + using Interfaces; using InventorySystem.Items.Usables.Scp330; diff --git a/EXILED/Exiled.Events/EventArgs/Scp330/InteractingScp330EventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp330/InteractingScp330EventArgs.cs index d706ea289d..c0b6ba40ab 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp330/InteractingScp330EventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp330/InteractingScp330EventArgs.cs @@ -7,8 +7,10 @@ namespace Exiled.Events.EventArgs.Scp330 { - using API.Features; + using Exiled.API.Features; + using Exiled.API.Features.Items; + using Interfaces; using InventorySystem.Items.Usables.Scp330; @@ -40,10 +42,10 @@ public InteractingScp330EventArgs(ReferenceHub referenceHub, int usage, bool sho { Player = Player.Get(referenceHub); UsageCount = usage; - ShouldSever = usage >= 2; + ShouldSever = shouldSever; ShouldPlaySound = shouldPlaySound; IsAllowed = Player.IsHuman; - Candy = Scp330Candies.GetRandom(); + Candy = candy; } /// diff --git a/EXILED/Exiled.Events/EventArgs/Scp559/SpawningEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp559/SpawningEventArgs.cs index 6e3a81f06a..8efc9cf7d6 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp559/SpawningEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp559/SpawningEventArgs.cs @@ -11,6 +11,7 @@ namespace Exiled.Events.EventArgs.Scp559 using Exiled.API.Features; using Exiled.Events.EventArgs.Interfaces; + using UnityEngine; /// diff --git a/EXILED/Exiled.Events/EventArgs/Scp914/ActivatingEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp914/ActivatingEventArgs.cs index 1309a55978..491b626b00 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp914/ActivatingEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp914/ActivatingEventArgs.cs @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Scp914 { - using API.Features; + using Exiled.API.Features; using global::Scp914; diff --git a/EXILED/Exiled.Events/EventArgs/Scp914/ChangingKnobSettingEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp914/ChangingKnobSettingEventArgs.cs index b7af91e658..ddde646524 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp914/ChangingKnobSettingEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp914/ChangingKnobSettingEventArgs.cs @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Scp914 { - using API.Features; + using Exiled.API.Features; using global::Scp914; @@ -18,8 +18,6 @@ namespace Exiled.Events.EventArgs.Scp914 /// public class ChangingKnobSettingEventArgs : IPlayerEvent, IDeniableEvent { - private Scp914KnobSetting knobSetting; - /// /// Initializes a new instance of the class. /// @@ -44,8 +42,8 @@ public ChangingKnobSettingEventArgs(Player player, Scp914KnobSetting knobSetting /// public Scp914KnobSetting KnobSetting { - get => knobSetting; - set => knobSetting = value > Scp914KnobSetting.VeryFine ? Scp914KnobSetting.Coarse : value; + get; + set => field = value > Scp914KnobSetting.VeryFine ? Scp914KnobSetting.Coarse : value; } /// diff --git a/EXILED/Exiled.Events/EventArgs/Scp914/UpgradedInventoryItemEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp914/UpgradedInventoryItemEventArgs.cs index 4bd590dc55..fb77bcc015 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp914/UpgradedInventoryItemEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp914/UpgradedInventoryItemEventArgs.cs @@ -7,12 +7,14 @@ namespace Exiled.Events.EventArgs.Scp914 { - using API.Features; - using API.Features.Items; + using Exiled.API.Features; + using Exiled.API.Features.Items; + using global::Scp914; + using Interfaces; + using InventorySystem.Items; - using InventorySystem.Items.Pickups; /// /// Contains all information before SCP-914 upgrades an item. diff --git a/EXILED/Exiled.Events/EventArgs/Scp914/UpgradedPickupEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp914/UpgradedPickupEventArgs.cs index 5bd2c9d952..8ead02480c 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp914/UpgradedPickupEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp914/UpgradedPickupEventArgs.cs @@ -9,8 +9,11 @@ namespace Exiled.Events.EventArgs.Scp914 { using Exiled.API.Features.Pickups; using Exiled.Events.EventArgs.Interfaces; + using global::Scp914; + using InventorySystem.Items.Pickups; + using UnityEngine; /// diff --git a/EXILED/Exiled.Events/EventArgs/Scp914/UpgradingInventoryItemEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp914/UpgradingInventoryItemEventArgs.cs index 667320e57e..b46ec984aa 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp914/UpgradingInventoryItemEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp914/UpgradingInventoryItemEventArgs.cs @@ -7,10 +7,13 @@ namespace Exiled.Events.EventArgs.Scp914 { - using API.Features; - using API.Features.Items; + using Exiled.API.Features; + using Exiled.API.Features.Items; + using global::Scp914; + using Interfaces; + using InventorySystem.Items; /// diff --git a/EXILED/Exiled.Events/EventArgs/Scp914/UpgradingPickupEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp914/UpgradingPickupEventArgs.cs index 691db20a15..9a6fb7f4b5 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp914/UpgradingPickupEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp914/UpgradingPickupEventArgs.cs @@ -9,8 +9,11 @@ namespace Exiled.Events.EventArgs.Scp914 { using Exiled.API.Features.Pickups; using Exiled.Events.EventArgs.Interfaces; + using global::Scp914; + using InventorySystem.Items.Pickups; + using UnityEngine; /// diff --git a/EXILED/Exiled.Events/EventArgs/Scp914/UpgradingPlayerEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp914/UpgradingPlayerEventArgs.cs index cf4487eccc..268f2cba15 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp914/UpgradingPlayerEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp914/UpgradingPlayerEventArgs.cs @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Scp914 { - using API.Features; + using Exiled.API.Features; using global::Scp914; diff --git a/EXILED/Exiled.Events/EventArgs/Scp939/ChangingFocusEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp939/ChangingFocusEventArgs.cs index 982fbd09fd..48b6c05313 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp939/ChangingFocusEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp939/ChangingFocusEventArgs.cs @@ -7,8 +7,9 @@ namespace Exiled.Events.EventArgs.Scp939 { - using API.Features; + using Exiled.API.Features; using Exiled.API.Features.Roles; + using Interfaces; /// diff --git a/EXILED/Exiled.Events/EventArgs/Scp939/ClawedEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp939/ClawedEventArgs.cs index 8ce4a1f1a2..5f82547a40 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp939/ClawedEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp939/ClawedEventArgs.cs @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Scp939 { - using API.Features; + using Exiled.API.Features; using Exiled.API.Features.Roles; using Exiled.Events.EventArgs.Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Scp939/LungingEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp939/LungingEventArgs.cs index 387f0467cb..30125cb3e0 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp939/LungingEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp939/LungingEventArgs.cs @@ -7,8 +7,10 @@ namespace Exiled.Events.EventArgs.Scp939 { - using API.Features; + using Exiled.API.Features; + using Exiled.API.Features.Roles; + using Interfaces; /// @@ -36,4 +38,4 @@ public LungingEventArgs(Player player) /// public Scp939Role Scp939 { get; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Scp939/PlacedAmnesticCloudEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp939/PlacedAmnesticCloudEventArgs.cs index d2545aad3d..0d53bbe6a4 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp939/PlacedAmnesticCloudEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp939/PlacedAmnesticCloudEventArgs.cs @@ -7,9 +7,11 @@ namespace Exiled.Events.EventArgs.Scp939 { - using API.Features; - using API.Features.Hazards; + using Exiled.API.Features; + using Exiled.API.Features.Hazards; + using Interfaces; + using PlayerRoles.PlayableScps.Scp939; using Scp939Role = API.Features.Roles.Scp939Role; diff --git a/EXILED/Exiled.Events/EventArgs/Scp939/PlacingAmnesticCloudEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp939/PlacingAmnesticCloudEventArgs.cs index 3d77ff708d..9571fb98cc 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp939/PlacingAmnesticCloudEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp939/PlacingAmnesticCloudEventArgs.cs @@ -7,8 +7,9 @@ namespace Exiled.Events.EventArgs.Scp939 { - using API.Features; + using Exiled.API.Features; using Exiled.API.Features.Roles; + using Interfaces; /// diff --git a/EXILED/Exiled.Events/EventArgs/Scp939/PlacingMimicPointEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp939/PlacingMimicPointEventArgs.cs index a761942caf..3428e7a171 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp939/PlacingMimicPointEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp939/PlacingMimicPointEventArgs.cs @@ -10,6 +10,7 @@ namespace Exiled.Events.EventArgs.Scp939 using Exiled.API.Features; using Exiled.API.Features.Roles; using Exiled.Events.EventArgs.Interfaces; + using RelativePositioning; /// diff --git a/EXILED/Exiled.Events/EventArgs/Scp939/PlayingFootstepEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp939/PlayingFootstepEventArgs.cs index 269bb3ea3b..698ba3f498 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp939/PlayingFootstepEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp939/PlayingFootstepEventArgs.cs @@ -7,8 +7,10 @@ namespace Exiled.Events.EventArgs.Scp939 { - using API.Features; + using Exiled.API.Features; + using Exiled.API.Features.Roles; + using Interfaces; /// @@ -54,4 +56,4 @@ public PlayingFootstepEventArgs(Player target, Player player, bool isAllowed = t /// public bool IsAllowed { get; set; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Scp939/PlayingSoundEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp939/PlayingSoundEventArgs.cs index 675884707c..12011c7547 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp939/PlayingSoundEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp939/PlayingSoundEventArgs.cs @@ -7,9 +7,11 @@ namespace Exiled.Events.EventArgs.Scp939 { - using API.Features; + using Exiled.API.Features; using Exiled.API.Features.Roles; + using Interfaces; + using PlayerRoles.PlayableScps.Scp939.Mimicry; /// diff --git a/EXILED/Exiled.Events/EventArgs/Scp939/PlayingVoiceEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp939/PlayingVoiceEventArgs.cs index b744934b8c..7fd8ec4862 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp939/PlayingVoiceEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp939/PlayingVoiceEventArgs.cs @@ -7,8 +7,9 @@ namespace Exiled.Events.EventArgs.Scp939 { - using API.Features; + using Exiled.API.Features; using Exiled.API.Features.Roles; + using Interfaces; /// diff --git a/EXILED/Exiled.Events/EventArgs/Scp939/SavingVoiceEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp939/SavingVoiceEventArgs.cs index 60133cc196..c8f60d96ed 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp939/SavingVoiceEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp939/SavingVoiceEventArgs.cs @@ -7,8 +7,9 @@ namespace Exiled.Events.EventArgs.Scp939 { - using API.Features; + using Exiled.API.Features; using Exiled.API.Features.Roles; + using Interfaces; /// diff --git a/EXILED/Exiled.Events/EventArgs/Scp939/UpdatedCloudStateEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp939/UpdatedCloudStateEventArgs.cs index e75a835f44..a6dc837cc9 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp939/UpdatedCloudStateEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp939/UpdatedCloudStateEventArgs.cs @@ -7,10 +7,10 @@ namespace Exiled.Events.EventArgs.Scp939 { - using API.Features; + using Exiled.API.Features; using Exiled.API.Features.Hazards; - using Exiled.API.Features.Roles; + using Interfaces; using PlayerRoles.PlayableScps.Scp939; @@ -38,6 +38,7 @@ public UpdatedCloudStateEventArgs(ReferenceHub hub, Scp939AmnesticCloudInstance. { Player = Player.Get(hub); AmnesticCloud = Hazard.Get(cloud); + NewState = cloudState; Scp939 = Player.Role.As(); } diff --git a/EXILED/Exiled.Events/EventArgs/Scp939/ValidatingVisibilityEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Scp939/ValidatingVisibilityEventArgs.cs index 5780914d9d..7e35e6d244 100644 --- a/EXILED/Exiled.Events/EventArgs/Scp939/ValidatingVisibilityEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Scp939/ValidatingVisibilityEventArgs.cs @@ -7,9 +7,8 @@ namespace Exiled.Events.EventArgs.Scp939 { - using API.Features; - using Exiled.API.Enums; + using Exiled.API.Features; using Exiled.API.Features.Roles; using Interfaces; @@ -43,7 +42,7 @@ public ValidatingVisibilityEventArgs(Scp939VisibilityState state, ReferenceHub p Scp939VisibilityState.SeenByDetonation when !Warhead.IsDetonated && LastHumanTracker.IsLastTarget(target) => Scp939VisibilityState.SeenByLastHuman, _ => state, }; - IsAllowed = TargetVisibilityState is not(Scp939VisibilityState.NotSeen or Scp939VisibilityState.None); + IsAllowed = TargetVisibilityState is not (Scp939VisibilityState.NotSeen or Scp939VisibilityState.None); IsLateSeen = TargetVisibilityState is Scp939VisibilityState.SeenByRange; } @@ -76,4 +75,4 @@ public ValidatingVisibilityEventArgs(Scp939VisibilityState state, ReferenceHub p /// public bool IsAllowed { get; set; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Server/ChoosingStartTeamQueueEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Server/ChoosingStartTeamQueueEventArgs.cs index 84c4457973..aaa305cc1f 100644 --- a/EXILED/Exiled.Events/EventArgs/Server/ChoosingStartTeamQueueEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Server/ChoosingStartTeamQueueEventArgs.cs @@ -12,7 +12,9 @@ namespace Exiled.Events.EventArgs.Server using System.Text; using Exiled.API.Features.Pools; + using Interfaces; + using PlayerRoles; /// diff --git a/EXILED/Exiled.Events/EventArgs/Server/CompletingObjectiveEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Server/CompletingObjectiveEventArgs.cs index def486974b..d685cbab5b 100644 --- a/EXILED/Exiled.Events/EventArgs/Server/CompletingObjectiveEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Server/CompletingObjectiveEventArgs.cs @@ -1,4 +1,4 @@ -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- // // Copyright (c) ExMod Team. All rights reserved. // Licensed under the CC BY-SA 3.0 license. @@ -9,6 +9,7 @@ namespace Exiled.Events.EventArgs.Server { using Exiled.API.Features.Objectives; using Exiled.Events.EventArgs.Interfaces; + using Respawning.Objectives; /// diff --git a/EXILED/Exiled.Events/EventArgs/Server/EndingRoundEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Server/EndingRoundEventArgs.cs index 2e5c11dc05..c919f8ac1b 100644 --- a/EXILED/Exiled.Events/EventArgs/Server/EndingRoundEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Server/EndingRoundEventArgs.cs @@ -9,7 +9,8 @@ namespace Exiled.Events.EventArgs.Server { using System; - using API.Enums; + using Exiled.API.Enums; + using Interfaces; /// diff --git a/EXILED/Exiled.Events/EventArgs/Server/LocalReportingEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Server/LocalReportingEventArgs.cs index 02d1d6b984..834c0b516c 100644 --- a/EXILED/Exiled.Events/EventArgs/Server/LocalReportingEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Server/LocalReportingEventArgs.cs @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Server { - using API.Features; + using Exiled.API.Features; using Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Server/ReportingCheaterEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Server/ReportingCheaterEventArgs.cs index b102bdb377..4eedf333dd 100644 --- a/EXILED/Exiled.Events/EventArgs/Server/ReportingCheaterEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Server/ReportingCheaterEventArgs.cs @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Server { - using API.Features; + using Exiled.API.Features; using Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Server/RespawnedTeamEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Server/RespawnedTeamEventArgs.cs index d3d62667a0..e8543f64a7 100644 --- a/EXILED/Exiled.Events/EventArgs/Server/RespawnedTeamEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Server/RespawnedTeamEventArgs.cs @@ -12,7 +12,7 @@ namespace Exiled.Events.EventArgs.Server using Exiled.API.Features; using Exiled.Events.EventArgs.Interfaces; - using Respawning; + using Respawning.Waves; /// @@ -41,4 +41,4 @@ public RespawnedTeamEventArgs(SpawnableWaveBase wave, IEnumerable /// public SpawnableWaveBase Wave { get; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Server/RespawningTeamEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Server/RespawningTeamEventArgs.cs index df999d90dd..b334d64ef6 100644 --- a/EXILED/Exiled.Events/EventArgs/Server/RespawningTeamEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Server/RespawningTeamEventArgs.cs @@ -7,15 +7,15 @@ namespace Exiled.Events.EventArgs.Server { - using System; using System.Collections.Generic; using Exiled.API.Features; using Exiled.API.Features.Waves; using Exiled.Events.EventArgs.Interfaces; + using PlayerRoles; using PlayerRoles.Spectating; - using Respawning; + using Respawning.Objectives; using Respawning.Waves; @@ -24,8 +24,6 @@ namespace Exiled.Events.EventArgs.Server /// public class RespawningTeamEventArgs : IDeniableEvent { - private int maximumRespawnAmount; - /// /// Initializes a new instance of the class. /// @@ -69,16 +67,16 @@ public RespawningTeamEventArgs(List players, int maxRespawn, SpawnableWa /// public int MaximumRespawnAmount { - get => maximumRespawnAmount; + get; set { - if (value < maximumRespawnAmount) + if (value < field) { if (Players.Count > value) Players.RemoveRange(value, Players.Count - value); } - maximumRespawnAmount = value; + field = value; } } @@ -102,4 +100,4 @@ public int MaximumRespawnAmount /// public Queue SpawnQueue { get; set; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Server/RoundEndedEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Server/RoundEndedEventArgs.cs index 0e614d8a64..460747d00d 100644 --- a/EXILED/Exiled.Events/EventArgs/Server/RoundEndedEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Server/RoundEndedEventArgs.cs @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Server { - using API.Enums; + using Exiled.API.Enums; using Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Server/RoundStartingEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Server/RoundStartingEventArgs.cs new file mode 100644 index 0000000000..10de2a7c6e --- /dev/null +++ b/EXILED/Exiled.Events/EventArgs/Server/RoundStartingEventArgs.cs @@ -0,0 +1,56 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) ExMod Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Events.EventArgs.Server +{ + using Exiled.Events.EventArgs.Interfaces; + + /// + /// Contains all information before the start of a round. + /// + public class RoundStartingEventArgs : IDeniableEvent + { + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// + /// + public RoundStartingEventArgs(short timeLeft, short originalTimeLeft, int topPlayer, int playerCount) + { + TimeLeft = timeLeft; + OriginalTimeLeft = originalTimeLeft; + TopPlayer = topPlayer; + PlayerCount = playerCount; + IsAllowed = TimeLeft == -1; + } + + /// + /// Gets or sets the time before the start of the Round. + /// + public int TimeLeft { get; set; } + + /// + /// Gets or sets the time before the start of the Round. + /// + public int OriginalTimeLeft { get; set; } + + /// + /// Gets or sets the maximum number of Player on the server since restart. + /// + public int TopPlayer { get; set; } + + /// + /// Gets the number of Player. + /// + public int PlayerCount { get; } + + /// + public bool IsAllowed { get; set; } + } +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Server/SelectingRespawnTeamEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Server/SelectingRespawnTeamEventArgs.cs index dd62947778..689ebd12f0 100644 --- a/EXILED/Exiled.Events/EventArgs/Server/SelectingRespawnTeamEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Server/SelectingRespawnTeamEventArgs.cs @@ -10,6 +10,7 @@ namespace Exiled.Events.EventArgs.Server using Exiled.API.Enums; using Exiled.API.Features.Waves; using Exiled.Events.EventArgs.Interfaces; + using Respawning.Waves; /// diff --git a/EXILED/Exiled.Events/EventArgs/Warhead/ChangingLeverStatusEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Warhead/ChangingLeverStatusEventArgs.cs index 407cdfd762..b3cce5d9a4 100644 --- a/EXILED/Exiled.Events/EventArgs/Warhead/ChangingLeverStatusEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Warhead/ChangingLeverStatusEventArgs.cs @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Warhead { - using API.Features; + using Exiled.API.Features; using Interfaces; diff --git a/EXILED/Exiled.Events/EventArgs/Warhead/DeadmanSwitchInitiatingEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Warhead/DeadmanSwitchInitiatingEventArgs.cs index 389677132c..9c63e9ec19 100644 --- a/EXILED/Exiled.Events/EventArgs/Warhead/DeadmanSwitchInitiatingEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Warhead/DeadmanSwitchInitiatingEventArgs.cs @@ -17,4 +17,4 @@ public class DeadmanSwitchInitiatingEventArgs : IDeniableEvent /// public bool IsAllowed { get; set; } = true; } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Warhead/DetonatingEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Warhead/DetonatingEventArgs.cs index d9c00e9da4..4cc024c942 100644 --- a/EXILED/Exiled.Events/EventArgs/Warhead/DetonatingEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Warhead/DetonatingEventArgs.cs @@ -17,4 +17,4 @@ public class DetonatingEventArgs : IDeniableEvent /// public bool IsAllowed { get; set; } = true; } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Warhead/StartingEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Warhead/StartingEventArgs.cs index 6f006c5299..214c8f8c2b 100644 --- a/EXILED/Exiled.Events/EventArgs/Warhead/StartingEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Warhead/StartingEventArgs.cs @@ -8,11 +8,12 @@ namespace Exiled.Events.EventArgs.Warhead { using Exiled.API.Features; + using Exiled.Events.EventArgs.Interfaces; /// /// Contains all information before starting the warhead. /// - public class StartingEventArgs : StoppingEventArgs + public class StartingEventArgs : IPlayerEvent, IDeniableEvent { /// /// Initializes a new instance of the class. @@ -21,14 +22,25 @@ public class StartingEventArgs : StoppingEventArgs /// Indicating whether the nuke was set off automatically. /// Indicating whether the event can be executed. public StartingEventArgs(Player player, bool isAuto, bool isAllowed = true) - : base(player, isAllowed) { IsAuto = isAuto; + Player = player ?? Server.Host; + IsAllowed = isAllowed; } /// /// Gets or sets a value indicating whether the nuke was set off automatically. /// public bool IsAuto { get; set; } + + /// + /// Gets or sets a value indicating whether the warhead can be started. + /// + public bool IsAllowed { get; set; } + + /// + /// Gets the player who's going to start the warhead. + /// + public Player Player { get; } } } \ No newline at end of file diff --git a/EXILED/Exiled.Events/EventArgs/Warhead/StoppingEventArgs.cs b/EXILED/Exiled.Events/EventArgs/Warhead/StoppingEventArgs.cs index 403380511b..71eff5af38 100644 --- a/EXILED/Exiled.Events/EventArgs/Warhead/StoppingEventArgs.cs +++ b/EXILED/Exiled.Events/EventArgs/Warhead/StoppingEventArgs.cs @@ -7,7 +7,7 @@ namespace Exiled.Events.EventArgs.Warhead { - using API.Features; + using Exiled.API.Features; using Interfaces; diff --git a/EXILED/Exiled.Events/Events.cs b/EXILED/Exiled.Events/Events.cs index 8067335576..0472122aef 100644 --- a/EXILED/Exiled.Events/Events.cs +++ b/EXILED/Exiled.Events/Events.cs @@ -10,19 +10,23 @@ namespace Exiled.Events using System; using System.Diagnostics; - using API.Enums; - using API.Features; using CentralAuth; + + using Exiled.API.Enums; + using Exiled.API.Features; using Exiled.API.Features.Core.UserSettings; using Exiled.Events.Features; - using HarmonyLib; + using InventorySystem.Items.Pickups; using InventorySystem.Items.Usables; + using PlayerRoles.Ragdolls; using PlayerRoles.RoleAssign; using Respawning; + using UnityEngine.SceneManagement; + using UserSettings.ServerSpecific; /// @@ -30,12 +34,10 @@ namespace Exiled.Events /// public sealed class Events : Plugin { - private static Events instance; - /// /// Gets the plugin instance. /// - public static Events Instance => instance; + public static Events Instance { get; private set; } /// public override PluginPriority Priority { get; } = PluginPriority.First; @@ -48,7 +50,7 @@ public sealed class Events : Plugin /// public override void OnEnabled() { - instance = this; + Instance = this; base.OnEnabled(); Stopwatch watch = Stopwatch.StartNew(); @@ -155,8 +157,8 @@ public void Patch() { Patcher = new Patcher(); #if DEBUG - bool lastDebugStatus = Harmony.DEBUG; - Harmony.DEBUG = true; + bool lastDebugStatus = HarmonyLib.Harmony.DEBUG; + HarmonyLib.Harmony.DEBUG = true; #endif Patcher.PatchAll(!Config.UseDynamicPatching, out int failedPatch); @@ -165,7 +167,7 @@ public void Patch() else Log.Error($"Patching failed! There are {failedPatch} broken patches."); #if DEBUG - Harmony.DEBUG = lastDebugStatus; + HarmonyLib.Harmony.DEBUG = lastDebugStatus; #endif } catch (Exception exception) @@ -185,4 +187,4 @@ public void Unpatch() Log.Debug("All events have been unpatched complete. Goodbye!"); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Exiled.Events.csproj b/EXILED/Exiled.Events/Exiled.Events.csproj index c8d9aa1cd1..e686633b20 100644 --- a/EXILED/Exiled.Events/Exiled.Events.csproj +++ b/EXILED/Exiled.Events/Exiled.Events.csproj @@ -18,7 +18,7 @@ - + diff --git a/EXILED/Exiled.Events/Features/Event.cs b/EXILED/Exiled.Events/Features/Event.cs index 7c2d146635..8d27e46b02 100644 --- a/EXILED/Exiled.Events/Features/Event.cs +++ b/EXILED/Exiled.Events/Features/Event.cs @@ -10,7 +10,6 @@ namespace Exiled.Events.Features using System; using System.Buffers; using System.Collections.Generic; - using System.Linq; using Exiled.API.Features; using Exiled.Events.EventArgs.Interfaces; @@ -33,15 +32,11 @@ namespace Exiled.Events.Features /// public class Event : IExiledEvent { - private record Registration(CustomEventHandler handler, int priority); - - private record AsyncRegistration(CustomAsyncEventHandler handler, int priority); - private static readonly List EventsValue = new(); - private static readonly IComparer RegisterComparable = Comparer.Create((x, y) => y.priority - x.priority); + private static readonly IComparer RegisterComparable = Comparer.Create((x, y) => y.Priority - x.Priority); - private static readonly IComparer AsyncRegisterComparable = Comparer.Create((x, y) => y.priority - x.priority); + private static readonly IComparer AsyncRegisterComparable = Comparer.Create((x, y) => y.Priority - x.Priority); private readonly List innerEvent = new(); @@ -138,7 +133,7 @@ public void Subscribe(CustomEventHandler handler, int priority) if (handler == null) return; - Registration registration = new Registration(handler, priority); + Registration registration = new(handler, priority); int index = innerEvent.BinarySearch(registration, RegisterComparable); if (index < 0) { @@ -146,7 +141,7 @@ public void Subscribe(CustomEventHandler handler, int priority) } else { - while (index < innerEvent.Count && innerEvent[index].priority == priority) + while (index < innerEvent.Count && innerEvent[index].Priority == priority) index++; innerEvent.Insert(index, registration); } @@ -177,7 +172,7 @@ public void Subscribe(CustomAsyncEventHandler handler, int priority) if (handler == null) return; - AsyncRegistration registration = new AsyncRegistration(handler, 0); + AsyncRegistration registration = new(handler, 0); int index = innerAsyncEvent.BinarySearch(registration, AsyncRegisterComparable); if (index < 0) { @@ -185,7 +180,7 @@ public void Subscribe(CustomAsyncEventHandler handler, int priority) } else { - while (index < innerAsyncEvent.Count && innerAsyncEvent[index].priority == priority) + while (index < innerAsyncEvent.Count && innerAsyncEvent[index].Priority == priority) index++; innerAsyncEvent.Insert(index, registration); } @@ -197,7 +192,7 @@ public void Subscribe(CustomAsyncEventHandler handler, int priority) /// The handler to add. public void Unsubscribe(CustomEventHandler handler) { - int index = innerEvent.FindIndex(p => p.handler == handler); + int index = innerEvent.FindIndex(p => p.Handler == handler); if (index != -1) innerEvent.RemoveAt(index); } @@ -208,7 +203,7 @@ public void Unsubscribe(CustomEventHandler handler) /// The handler to add. public void Unsubscribe(CustomAsyncEventHandler handler) { - int index = innerAsyncEvent.FindIndex(p => p.handler == handler); + int index = innerAsyncEvent.FindIndex(p => p.Handler == handler); if (index != -1) innerAsyncEvent.RemoveAt(index); } @@ -241,15 +236,15 @@ internal void BlendedInvoke() for (int i = 0; i < count; i++) { - if (eventIndex < syncCount && (asyncEventIndex >= asyncCount || localInnerEvent[eventIndex].priority >= localInnerAsyncEvent[asyncEventIndex].priority)) + if (eventIndex < syncCount && (asyncEventIndex >= asyncCount || localInnerEvent[eventIndex].Priority >= localInnerAsyncEvent[asyncEventIndex].Priority)) { try { - localInnerEvent[eventIndex].handler(); + localInnerEvent[eventIndex].Handler(); } catch (Exception ex) { - Log.Error($"Method \"{localInnerEvent[eventIndex].handler.Method.Name}\" of the class \"{localInnerEvent[eventIndex].handler.Method.ReflectedType.FullName}\" caused an exception when handling the event \"{GetType().FullName}\"\n{ex}"); + Log.Error($"Method \"{localInnerEvent[eventIndex].Handler.Method.Name}\" of the class \"{localInnerEvent[eventIndex].Handler.Method.ReflectedType.FullName}\" caused an exception when handling the event \"{GetType().FullName}\"\n{ex}"); } eventIndex++; @@ -258,11 +253,11 @@ internal void BlendedInvoke() { try { - Timing.RunCoroutine(localInnerAsyncEvent[asyncEventIndex].handler()); + Timing.RunCoroutine(localInnerAsyncEvent[asyncEventIndex].Handler()); } catch (Exception ex) { - Log.Error($"Method \"{localInnerAsyncEvent[asyncEventIndex].handler.Method.Name}\" of the class \"{localInnerAsyncEvent[asyncEventIndex].handler.Method.ReflectedType.FullName}\" caused an exception when handling the event \"{GetType().FullName}\"\n{ex}"); + Log.Error($"Method \"{localInnerAsyncEvent[asyncEventIndex].Handler.Method.Name}\" of the class \"{localInnerAsyncEvent[asyncEventIndex].Handler.Method.ReflectedType.FullName}\" caused an exception when handling the event \"{GetType().FullName}\"\n{ex}"); } asyncEventIndex++; @@ -290,11 +285,11 @@ internal void InvokeNormal() { try { - localInnerEvent[i].handler(); + localInnerEvent[i].Handler(); } catch (Exception ex) { - Log.Error($"Method \"{localInnerEvent[i].handler.Method.Name}\" of the class \"{localInnerEvent[i].handler.Method.ReflectedType.FullName}\" caused an exception when handling the event \"{GetType().FullName}\"\n{ex}"); + Log.Error($"Method \"{localInnerEvent[i].Handler.Method.Name}\" of the class \"{localInnerEvent[i].Handler.Method.ReflectedType.FullName}\" caused an exception when handling the event \"{GetType().FullName}\"\n{ex}"); } } } @@ -318,11 +313,11 @@ internal void InvokeAsync() { try { - Timing.RunCoroutine(localInnerAsyncEvent[i].handler()); + Timing.RunCoroutine(localInnerAsyncEvent[i].Handler()); } catch (Exception ex) { - Log.Error($"Method \"{localInnerAsyncEvent[i].handler.Method.Name}\" of the class \"{localInnerAsyncEvent[i].handler.Method.ReflectedType.FullName}\" caused an exception when handling the event \"{GetType().FullName}\"\n{ex}"); + Log.Error($"Method \"{localInnerAsyncEvent[i].Handler.Method.Name}\" of the class \"{localInnerAsyncEvent[i].Handler.Method.ReflectedType.FullName}\" caused an exception when handling the event \"{GetType().FullName}\"\n{ex}"); } } } @@ -331,5 +326,9 @@ internal void InvokeAsync() ArrayPool.Shared.Return(localInnerAsyncEvent, true); } } + + private record Registration(CustomEventHandler Handler, int Priority); + + private record AsyncRegistration(CustomAsyncEventHandler Handler, int Priority); } } \ No newline at end of file diff --git a/EXILED/Exiled.Events/Features/Event{T}.cs b/EXILED/Exiled.Events/Features/Event{T}.cs index 40fdb85be7..095cb17b40 100644 --- a/EXILED/Exiled.Events/Features/Event{T}.cs +++ b/EXILED/Exiled.Events/Features/Event{T}.cs @@ -10,7 +10,6 @@ namespace Exiled.Events.Features using System; using System.Buffers; using System.Collections.Generic; - using System.Linq; using Exiled.API.Features; using Exiled.Events.EventArgs.Interfaces; @@ -38,15 +37,11 @@ namespace Exiled.Events.Features /// The specified that the event will use. public class Event : IExiledEvent { - private record Registration(CustomEventHandler handler, int priority); - - private record AsyncRegistration(CustomAsyncEventHandler handler, int priority); - private static readonly Dictionary> TypeToEvent = new(); - private static readonly IComparer RegisterComparable = Comparer.Create((x, y) => y.priority - x.priority); + private static readonly IComparer RegisterComparable = Comparer.Create((x, y) => y.Priority - x.Priority); - private static readonly IComparer AsyncRegisterComparable = Comparer.Create((x, y) => y.priority - x.priority); + private static readonly IComparer AsyncRegisterComparable = Comparer.Create((x, y) => y.Priority - x.Priority); private readonly List innerEvent = new(); @@ -143,7 +138,7 @@ public void Subscribe(CustomEventHandler handler, int priority) if (handler == null) return; - Registration registration = new Registration(handler, priority); + Registration registration = new(handler, priority); int index = innerEvent.BinarySearch(registration, RegisterComparable); if (index < 0) { @@ -151,7 +146,7 @@ public void Subscribe(CustomEventHandler handler, int priority) } else { - while (index < innerEvent.Count && innerEvent[index].priority == priority) + while (index < innerEvent.Count && innerEvent[index].Priority == priority) index++; innerEvent.Insert(index, registration); } @@ -182,7 +177,7 @@ public void Subscribe(CustomAsyncEventHandler handler, int priority) if (handler == null) return; - AsyncRegistration registration = new AsyncRegistration(handler, 0); + AsyncRegistration registration = new(handler, 0); int index = innerAsyncEvent.BinarySearch(registration, AsyncRegisterComparable); if (index < 0) { @@ -190,7 +185,7 @@ public void Subscribe(CustomAsyncEventHandler handler, int priority) } else { - while (index < innerAsyncEvent.Count && innerAsyncEvent[index].priority == priority) + while (index < innerAsyncEvent.Count && innerAsyncEvent[index].Priority == priority) index++; innerAsyncEvent.Insert(index, registration); } @@ -202,7 +197,7 @@ public void Subscribe(CustomAsyncEventHandler handler, int priority) /// The handler to add. public void Unsubscribe(CustomEventHandler handler) { - int index = innerEvent.FindIndex(p => p.handler == handler); + int index = innerEvent.FindIndex(p => p.Handler == handler); if (index != -1) innerEvent.RemoveAt(index); } @@ -213,7 +208,7 @@ public void Unsubscribe(CustomEventHandler handler) /// The handler to add. public void Unsubscribe(CustomAsyncEventHandler handler) { - int index = innerAsyncEvent.FindIndex(p => p.handler == handler); + int index = innerAsyncEvent.FindIndex(p => p.Handler == handler); if (index != -1) innerAsyncEvent.RemoveAt(index); } @@ -247,15 +242,15 @@ internal void BlendedInvoke(T arg) for (int i = 0; i < count; i++) { - if (eventIndex < syncCount && (asyncEventIndex >= asyncCount || localInnerEvent[eventIndex].priority >= localInnerAsyncEvent[asyncEventIndex].priority)) + if (eventIndex < syncCount && (asyncEventIndex >= asyncCount || localInnerEvent[eventIndex].Priority >= localInnerAsyncEvent[asyncEventIndex].Priority)) { try { - localInnerEvent[eventIndex].handler(arg); + localInnerEvent[eventIndex].Handler(arg); } catch (Exception ex) { - Log.Error($"Method \"{localInnerEvent[eventIndex].handler.Method.Name}\" of the class \"{localInnerEvent[eventIndex].handler.Method.ReflectedType.FullName}\" caused an exception when handling the event \"{GetType().FullName}\"\n{ex}"); + Log.Error($"Method \"{localInnerEvent[eventIndex].Handler.Method.Name}\" of the class \"{localInnerEvent[eventIndex].Handler.Method.ReflectedType.FullName}\" caused an exception when handling the event \"{GetType().FullName}\"\n{ex}"); } eventIndex++; @@ -264,11 +259,11 @@ internal void BlendedInvoke(T arg) { try { - Timing.RunCoroutine(localInnerAsyncEvent[asyncEventIndex].handler(arg)); + Timing.RunCoroutine(localInnerAsyncEvent[asyncEventIndex].Handler(arg)); } catch (Exception ex) { - Log.Error($"Method \"{localInnerAsyncEvent[asyncEventIndex].handler.Method.Name}\" of the class \"{localInnerAsyncEvent[asyncEventIndex].handler.Method.ReflectedType.FullName}\" caused an exception when handling the event \"{GetType().FullName}\"\n{ex}"); + Log.Error($"Method \"{localInnerAsyncEvent[asyncEventIndex].Handler.Method.Name}\" of the class \"{localInnerAsyncEvent[asyncEventIndex].Handler.Method.ReflectedType.FullName}\" caused an exception when handling the event \"{GetType().FullName}\"\n{ex}"); } asyncEventIndex++; @@ -296,11 +291,11 @@ internal void InvokeNormal(T arg) { try { - localInnerEvent[i].handler(arg); + localInnerEvent[i].Handler(arg); } catch (Exception ex) { - Log.Error($"Method \"{localInnerEvent[i].handler.Method.Name}\" of the class \"{localInnerEvent[i].handler.Method.ReflectedType.FullName}\" caused an exception when handling the event \"{GetType().FullName}\"\n{ex}"); + Log.Error($"Method \"{localInnerEvent[i].Handler.Method.Name}\" of the class \"{localInnerEvent[i].Handler.Method.ReflectedType.FullName}\" caused an exception when handling the event \"{GetType().FullName}\"\n{ex}"); } } } @@ -324,11 +319,11 @@ internal void InvokeAsync(T arg) { try { - Timing.RunCoroutine(localInnerAsyncEvent[i].handler(arg)); + Timing.RunCoroutine(localInnerAsyncEvent[i].Handler(arg)); } catch (Exception ex) { - Log.Error($"Method \"{localInnerAsyncEvent[i].handler.Method.Name}\" of the class \"{localInnerAsyncEvent[i].handler.Method.ReflectedType.FullName}\" caused an exception when handling the event \"{GetType().FullName}\"\n{ex}"); + Log.Error($"Method \"{localInnerAsyncEvent[i].Handler.Method.Name}\" of the class \"{localInnerAsyncEvent[i].Handler.Method.ReflectedType.FullName}\" caused an exception when handling the event \"{GetType().FullName}\"\n{ex}"); } } } @@ -337,5 +332,9 @@ internal void InvokeAsync(T arg) ArrayPool.Shared.Return(localInnerAsyncEvent, true); } } + + private record Registration(CustomEventHandler Handler, int Priority); + + private record AsyncRegistration(CustomAsyncEventHandler Handler, int Priority); } } \ No newline at end of file diff --git a/EXILED/Exiled.Events/Features/Patcher.cs b/EXILED/Exiled.Events/Features/Patcher.cs index cbc739fb35..7ece301802 100644 --- a/EXILED/Exiled.Events/Features/Patcher.cs +++ b/EXILED/Exiled.Events/Features/Patcher.cs @@ -16,6 +16,7 @@ namespace Exiled.Events.Features using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Interfaces; + using HarmonyLib; /// @@ -154,4 +155,4 @@ public void UnpatchAll() /// A of all patch types. internal static HashSet GetAllPatchTypes() => Assembly.GetExecutingAssembly().GetTypes().Where((type) => type.CustomAttributes.Any((customAtt) => customAtt.AttributeType == typeof(HarmonyPatch))).ToHashSet(); } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Handlers/Internal/AdminToyList.cs b/EXILED/Exiled.Events/Handlers/Internal/AdminToyList.cs index 2d4ebf971e..7c830f1310 100644 --- a/EXILED/Exiled.Events/Handlers/Internal/AdminToyList.cs +++ b/EXILED/Exiled.Events/Handlers/Internal/AdminToyList.cs @@ -24,4 +24,4 @@ internal static class AdminToyList /// The destroyed ragdoll. public static void OnRemovedAdminToys(AdminToys.AdminToyBase adminToy) => API.Features.Toys.AdminToy.BaseToAdminToy.Remove(adminToy); } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Handlers/Internal/ClientStarted.cs b/EXILED/Exiled.Events/Handlers/Internal/ClientStarted.cs index 9c2938be83..3ff63778dc 100644 --- a/EXILED/Exiled.Events/Handlers/Internal/ClientStarted.cs +++ b/EXILED/Exiled.Events/Handlers/Internal/ClientStarted.cs @@ -13,12 +13,16 @@ namespace Exiled.Events.Handlers.Internal using System.Reflection; using AdminToys; + using Exiled.API.Enums; using Exiled.API.Features; using Exiled.API.Features.Attributes; using Exiled.API.Features.Toys; + using Mirror; + using PlayerRoles.Ragdolls; + using UnityEngine; /// diff --git a/EXILED/Exiled.Events/Handlers/Internal/ExplodingGrenade.cs b/EXILED/Exiled.Events/Handlers/Internal/ExplodingGrenade.cs index c7f0a36698..14abd46be7 100644 --- a/EXILED/Exiled.Events/Handlers/Internal/ExplodingGrenade.cs +++ b/EXILED/Exiled.Events/Handlers/Internal/ExplodingGrenade.cs @@ -7,7 +7,6 @@ namespace Exiled.Events.Handlers.Internal { - using Exiled.API.Features.Pickups; using Exiled.Events.EventArgs.Map; /// @@ -21,4 +20,4 @@ public static void OnChangedIntoGrenade(ChangedIntoGrenadeEventArgs ev) ev.Pickup.WriteProjectileInfo(ev.Projectile); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Handlers/Internal/MapGenerated.cs b/EXILED/Exiled.Events/Handlers/Internal/MapGenerated.cs index 60ec679791..fe545f2e48 100644 --- a/EXILED/Exiled.Events/Handlers/Internal/MapGenerated.cs +++ b/EXILED/Exiled.Events/Handlers/Internal/MapGenerated.cs @@ -7,10 +7,8 @@ namespace Exiled.Events.Handlers.Internal { - using System.Collections.Generic; - using System.Linq; + using Exiled.API.Features; - using API.Features; using Exiled.API.Features.Lockers; using MEC; diff --git a/EXILED/Exiled.Events/Handlers/Internal/PickupEvent.cs b/EXILED/Exiled.Events/Handlers/Internal/PickupEvent.cs index 88c6aa43c9..f1062dddb2 100644 --- a/EXILED/Exiled.Events/Handlers/Internal/PickupEvent.cs +++ b/EXILED/Exiled.Events/Handlers/Internal/PickupEvent.cs @@ -8,6 +8,7 @@ namespace Exiled.Events.Handlers.Internal { using Exiled.API.Features.Pickups; + using InventorySystem.Items.Pickups; /// @@ -34,4 +35,4 @@ public static void OnRemovedPickup(ItemPickupBase itemPickupBase) Pickup.BaseToPickup.Remove(itemPickupBase); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Handlers/Internal/RagdollList.cs b/EXILED/Exiled.Events/Handlers/Internal/RagdollList.cs index 4c2b955631..cbff088505 100644 --- a/EXILED/Exiled.Events/Handlers/Internal/RagdollList.cs +++ b/EXILED/Exiled.Events/Handlers/Internal/RagdollList.cs @@ -28,4 +28,4 @@ internal static class RagdollList /// The destroyed ragdoll. public static void OnRemovedRagdoll(BasicRagdoll ragdoll) => Ragdoll.BasicRagdollToRagdoll.Remove(ragdoll); } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Handlers/Internal/Round.cs b/EXILED/Exiled.Events/Handlers/Internal/Round.cs index 2cd82920bd..38dd38bbd4 100644 --- a/EXILED/Exiled.Events/Handlers/Internal/Round.cs +++ b/EXILED/Exiled.Events/Handlers/Internal/Round.cs @@ -11,10 +11,12 @@ namespace Exiled.Events.Handlers.Internal using System.Linq; using CentralAuth; + using Exiled.API.Enums; using Exiled.API.Extensions; using Exiled.API.Features; using Exiled.API.Features.Core.UserSettings; + using Exiled.API.Features.Doors; using Exiled.API.Features.Items; using Exiled.API.Features.Pools; using Exiled.API.Features.Roles; @@ -23,19 +25,19 @@ namespace Exiled.Events.Handlers.Internal using Exiled.Events.EventArgs.Scp049; using Exiled.Loader; using Exiled.Loader.Features; + using global::Scp914.Processors; + using InventorySystem; using InventorySystem.Items; using InventorySystem.Items.Firearms.Attachments; using InventorySystem.Items.Firearms.Attachments.Components; using InventorySystem.Items.Usables; - using InventorySystem.Items.Usables.Scp244.Hypothermia; using InventorySystem.Items.Usables.Scp330; + using PlayerRoles; - using PlayerRoles.FirstPersonControl; using PlayerRoles.RoleAssign; - using UnityEngine; - using Utils.Networking; + using Utils.NonAllocLINQ; /// @@ -44,7 +46,7 @@ namespace Exiled.Events.Handlers.Internal internal static class Round { /// - public static void OnServerOnUsingCompleted(ReferenceHub hub, UsableItem usable) => Handlers.Player.OnUsedItem(new (hub, usable, false)); + public static void OnServerOnUsingCompleted(ReferenceHub hub, UsableItem usable) => Handlers.Player.OnUsedItem(new(hub, usable, false)); /// public static void OnWaitingForPlayers() @@ -63,6 +65,10 @@ public static void OnWaitingForPlayers() if (Events.Instance.Config.Debug) Patches.Events.Map.Generating.Benchmark(); + + // TODO: Remove when this has been fixed https://git.scpslgame.com/northwood-qa/scpsl-bug-reporting/-/issues/1560 + Door door = Door.Get(DoorType.Scp079Armory); + door.AllowsScp106 = false; } /// @@ -200,4 +206,4 @@ private static void AddMissingScp914Processors() } } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Handlers/Internal/SceneUnloaded.cs b/EXILED/Exiled.Events/Handlers/Internal/SceneUnloaded.cs index 55b9d0738b..5ebd2c2285 100644 --- a/EXILED/Exiled.Events/Handlers/Internal/SceneUnloaded.cs +++ b/EXILED/Exiled.Events/Handlers/Internal/SceneUnloaded.cs @@ -7,8 +7,8 @@ namespace Exiled.Events.Handlers.Internal { - using API.Features; - using Exiled.API.Features.Toys; + using Exiled.API.Features; + using UnityEngine.SceneManagement; #pragma warning disable SA1611 // Element parameters should be documented diff --git a/EXILED/Exiled.Events/Handlers/Item.cs b/EXILED/Exiled.Events/Handlers/Item.cs index d4344493b0..50cd5425b9 100644 --- a/EXILED/Exiled.Events/Handlers/Item.cs +++ b/EXILED/Exiled.Events/Handlers/Item.cs @@ -21,7 +21,7 @@ public static class Item /// /// Invoked before the ammo of an firearm are changed. /// - public static Event ChangingAmmo { get; set; } = new (); + public static Event ChangingAmmo { get; set; } = new(); /// /// Invoked before item attachments are changed. diff --git a/EXILED/Exiled.Events/Handlers/Player.cs b/EXILED/Exiled.Events/Handlers/Player.cs index 4248231162..a8062aa820 100644 --- a/EXILED/Exiled.Events/Handlers/Player.cs +++ b/EXILED/Exiled.Events/Handlers/Player.cs @@ -10,7 +10,6 @@ namespace Exiled.Events.Handlers using System; using Exiled.API.Enums; - using Exiled.API.Features; #pragma warning disable IDE0079 #pragma warning disable IDE0060 @@ -30,7 +29,7 @@ public class Player /// /// Invoked after a player triggers the attack as an SCP. /// - public static Event Hit { get; set; } = new (); + public static Event Hit { get; set; } = new(); /// /// Invoked before authenticating a . @@ -87,7 +86,7 @@ public class Player /// /// Invoked before a finishes using a . In other words, it is invoked after the animation finishes but before the is actually used. /// - public static Event UsingItemCompleted { get; set; } = new (); + public static Event UsingItemCompleted { get; set; } = new(); /// /// Invoked after a uses an . @@ -1457,4 +1456,4 @@ public static void OnItemRemoved(ReferenceHub referenceHub, InventorySystem.Item /// The instance. public static void OnChangingWearables(ChangingWearablesEventArgs ev) => ChangingWearables.InvokeSafely(ev); } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Handlers/Scp049.cs b/EXILED/Exiled.Events/Handlers/Scp049.cs index f4a2010794..34a1bbfe83 100644 --- a/EXILED/Exiled.Events/Handlers/Scp049.cs +++ b/EXILED/Exiled.Events/Handlers/Scp049.cs @@ -83,4 +83,4 @@ public static class Scp049 /// The instance. public static void OnAttacking(AttackingEventArgs ev) => Attacking.InvokeSafely(ev); } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Handlers/Scp0492.cs b/EXILED/Exiled.Events/Handlers/Scp0492.cs index 0d03a3727f..11466dfec2 100644 --- a/EXILED/Exiled.Events/Handlers/Scp0492.cs +++ b/EXILED/Exiled.Events/Handlers/Scp0492.cs @@ -20,7 +20,7 @@ public class Scp0492 /// /// Invoked before a player triggers the bloodlust effect for 049-2. /// - public static Event TriggeringBloodlust { get; set; } = new (); + public static Event TriggeringBloodlust { get; set; } = new(); /// /// Called after 049-2 gets his benefits from consumed ability. @@ -50,4 +50,4 @@ public class Scp0492 /// instance. public static void OnConsumingCorpse(ConsumingCorpseEventArgs ev) => ConsumingCorpse.InvokeSafely(ev); } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Handlers/Scp127.cs b/EXILED/Exiled.Events/Handlers/Scp127.cs index bfdb1bcada..9c111ed0d6 100644 --- a/EXILED/Exiled.Events/Handlers/Scp127.cs +++ b/EXILED/Exiled.Events/Handlers/Scp127.cs @@ -9,6 +9,7 @@ namespace Exiled.Events.Handlers { using Exiled.Events.EventArgs.Scp127; using Exiled.Events.Features; + using LabApi.Events.Arguments.Scp127Events; #pragma warning disable SA1623 diff --git a/EXILED/Exiled.Events/Handlers/Scp1344.cs b/EXILED/Exiled.Events/Handlers/Scp1344.cs index e3cd688c7c..79ae3376ab 100644 --- a/EXILED/Exiled.Events/Handlers/Scp1344.cs +++ b/EXILED/Exiled.Events/Handlers/Scp1344.cs @@ -72,4 +72,4 @@ public static class Scp1344 /// The instance. public static void OnChangedStatus(ChangedStatusEventArgs ev) => ChangedStatus.InvokeSafely(ev); } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Handlers/Scp173.cs b/EXILED/Exiled.Events/Handlers/Scp173.cs index b5d577d5cd..cc5ba216c8 100644 --- a/EXILED/Exiled.Events/Handlers/Scp173.cs +++ b/EXILED/Exiled.Events/Handlers/Scp173.cs @@ -94,4 +94,4 @@ public static class Scp173 /// The instance. public static void OnRemovedObserver(RemovedObserverEventArgs ev) => RemovedObserver.InvokeSafely(ev); } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Handlers/Server.cs b/EXILED/Exiled.Events/Handlers/Server.cs index 80453625bb..7356338ef5 100644 --- a/EXILED/Exiled.Events/Handlers/Server.cs +++ b/EXILED/Exiled.Events/Handlers/Server.cs @@ -9,7 +9,6 @@ namespace Exiled.Events.Handlers { using System.Collections.Generic; - using Respawning; using Respawning.Waves; #pragma warning disable SA1623 // Property summary documentation should match accessors @@ -32,6 +31,11 @@ public static class Server /// public static Event RoundStarted { get; set; } = new(); + /// + /// Invoked after the start of a new round. + /// + public static Event RoundStarting { get; set; } = new(); + /// /// Invoked after all players have spawned at the start of a new round. /// @@ -137,6 +141,12 @@ public static class Server /// public static void OnWaitingForPlayers() => WaitingForPlayers.InvokeSafely(); + /// + /// Called before the start of a new round. + /// + /// The instance. + public static void OnRoundStarting(RoundStartingEventArgs ev) => RoundStarting.InvokeSafely(ev); + /// /// Called after the start of a new round. /// @@ -255,4 +265,4 @@ public static class Server /// The instance. public static void OnCompletingObjective(CompletingObjectiveEventArgs ev) => CompletingObjective.InvokeSafely(ev); } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Cassie/SendingCassieMessage.cs b/EXILED/Exiled.Events/Patches/Events/Cassie/SendingCassieMessage.cs index 1e7b55e3a8..9e184b1aba 100644 --- a/EXILED/Exiled.Events/Patches/Events/Cassie/SendingCassieMessage.cs +++ b/EXILED/Exiled.Events/Patches/Events/Cassie/SendingCassieMessage.cs @@ -11,13 +11,16 @@ namespace Exiled.Events.Patches.Events.Cassie using System.Linq; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; + using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Cassie; + using global::Cassie; + using Handlers; + using HarmonyLib; - using Respawning; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Item/Cackling.cs b/EXILED/Exiled.Events/Patches/Events/Item/Cackling.cs index fec7811ecf..7454f3bd42 100644 --- a/EXILED/Exiled.Events/Patches/Events/Item/Cackling.cs +++ b/EXILED/Exiled.Events/Patches/Events/Item/Cackling.cs @@ -10,11 +10,12 @@ namespace Exiled.Events.Patches.Events.Item using System.Collections.Generic; using System.Reflection.Emit; - using Exiled.API.Features; using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Item; + using HarmonyLib; + using InventorySystem.Items.MarshmallowMan; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Item/ChangingAmmo.cs b/EXILED/Exiled.Events/Patches/Events/Item/ChangingAmmo.cs index 7ef8824daf..c658520201 100644 --- a/EXILED/Exiled.Events/Patches/Events/Item/ChangingAmmo.cs +++ b/EXILED/Exiled.Events/Patches/Events/Item/ChangingAmmo.cs @@ -7,21 +7,12 @@ namespace Exiled.Events.Patches.Events.Item { - using System.Collections.Generic; - using System.Reflection.Emit; - - using API.Features.Pools; using Exiled.Events.Attributes; - using Exiled.Events.EventArgs.Item; using Handlers; - using HarmonyLib; - using InventorySystem.Items.Firearms; - using static HarmonyLib.AccessTools; - /// /// Patches . /// Adds the event. diff --git a/EXILED/Exiled.Events/Patches/Events/Item/ChangingAttachments.cs b/EXILED/Exiled.Events/Patches/Events/Item/ChangingAttachments.cs index 6e45fbd152..29ae01023b 100644 --- a/EXILED/Exiled.Events/Patches/Events/Item/ChangingAttachments.cs +++ b/EXILED/Exiled.Events/Patches/Events/Item/ChangingAttachments.cs @@ -8,12 +8,10 @@ namespace Exiled.Events.Patches.Events.Item { using System.Collections.Generic; - using System.Linq; using System.Reflection.Emit; - using API.Features; - using API.Features.Items; - using API.Features.Pools; + using Exiled.API.Features.Pools; + using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Item; diff --git a/EXILED/Exiled.Events/Patches/Events/Item/DisruptorFiring.cs b/EXILED/Exiled.Events/Patches/Events/Item/DisruptorFiring.cs index 889cbada1c..69b24013bd 100644 --- a/EXILED/Exiled.Events/Patches/Events/Item/DisruptorFiring.cs +++ b/EXILED/Exiled.Events/Patches/Events/Item/DisruptorFiring.cs @@ -10,17 +10,18 @@ namespace Exiled.Events.Patches.Events.Item using System.Collections.Generic; using System.Reflection.Emit; - using Exiled.API.Features; using Exiled.API.Features.Pickups; using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Item; + using Footprinting; + using HarmonyLib; + using InventorySystem.Items; using InventorySystem.Items.Firearms; using InventorySystem.Items.Firearms.Extensions; - using InventorySystem.Items.Firearms.Modules; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Item/Inspect.cs b/EXILED/Exiled.Events/Patches/Events/Item/Inspect.cs index 4ba2d307e8..f45ca975ef 100644 --- a/EXILED/Exiled.Events/Patches/Events/Item/Inspect.cs +++ b/EXILED/Exiled.Events/Patches/Events/Item/Inspect.cs @@ -1,4 +1,4 @@ -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- // // Copyright (c) ExMod Team. All rights reserved. // Licensed under the CC BY-SA 3.0 license. @@ -15,7 +15,9 @@ namespace Exiled.Events.Patches.Events.Item using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Item; + using HarmonyLib; + using InventorySystem.Items.Firearms.Modules; using InventorySystem.Items.Jailbird; using InventorySystem.Items.Keycards; diff --git a/EXILED/Exiled.Events/Patches/Events/Item/JailbirdPatch.cs b/EXILED/Exiled.Events/Patches/Events/Item/JailbirdPatch.cs index 653afada85..57fcbaca50 100644 --- a/EXILED/Exiled.Events/Patches/Events/Item/JailbirdPatch.cs +++ b/EXILED/Exiled.Events/Patches/Events/Item/JailbirdPatch.cs @@ -12,10 +12,15 @@ namespace Exiled.Events.Patches.Events.Item using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Item; + using Handlers; + using HarmonyLib; + using InventorySystem.Items.Jailbird; + using Mirror; + using NorthwoodLib.Pools; using static HarmonyLib.AccessTools; @@ -76,43 +81,43 @@ private static bool HandleJailbird(JailbirdItem instance, JailbirdMessageType me switch (messageType) { case JailbirdMessageType.AttackTriggered: - { - SwingingEventArgs ev = new(instance.Owner, instance); + { + SwingingEventArgs ev = new(instance.Owner, instance); - Item.OnSwinging(ev); + Item.OnSwinging(ev); - return ev.IsAllowed; - } + return ev.IsAllowed; + } case JailbirdMessageType.ChargeLoadTriggered: - { - ChargingJailbirdEventArgs ev = new(instance.Owner, instance); + { + ChargingJailbirdEventArgs ev = new(instance.Owner, instance); - Item.OnChargingJailbird(ev); - if (ev.IsAllowed) - return true; + Item.OnChargingJailbird(ev); + if (ev.IsAllowed) + return true; - ev.Player.RemoveHeldItem(destroy: false); - ev.Player.CurrentItem = ev.Item; - return false; - } + ev.Player.RemoveHeldItem(destroy: false); + ev.Player.CurrentItem = ev.Item; + return false; + } case JailbirdMessageType.ChargeStarted: - { - JailbirdChargeCompleteEventArgs ev = new(instance.Owner, instance); + { + JailbirdChargeCompleteEventArgs ev = new(instance.Owner, instance); - Item.OnJailbirdChargeComplete(ev); - if (ev.IsAllowed) - return true; + Item.OnJailbirdChargeComplete(ev); + if (ev.IsAllowed) + return true; - ev.Player.RemoveHeldItem(destroy: false); - ev.Player.AddItem(ev.Item); - return false; - } + ev.Player.RemoveHeldItem(destroy: false); + ev.Player.AddItem(ev.Item); + return false; + } default: return true; } } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Item/JailbirdWearState.cs b/EXILED/Exiled.Events/Patches/Events/Item/JailbirdWearState.cs index cd4499e115..8918a88768 100644 --- a/EXILED/Exiled.Events/Patches/Events/Item/JailbirdWearState.cs +++ b/EXILED/Exiled.Events/Patches/Events/Item/JailbirdWearState.cs @@ -13,7 +13,9 @@ namespace Exiled.Events.Patches.Events.Item using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Item; + using HarmonyLib; + using InventorySystem.Items.Jailbird; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Item/KeycardInteracting.cs b/EXILED/Exiled.Events/Patches/Events/Item/KeycardInteracting.cs index 62faa353cd..af222f2c7a 100644 --- a/EXILED/Exiled.Events/Patches/Events/Item/KeycardInteracting.cs +++ b/EXILED/Exiled.Events/Patches/Events/Item/KeycardInteracting.cs @@ -10,10 +10,11 @@ namespace Exiled.Events.Patches.Events.Item using System.Collections.Generic; using System.Reflection.Emit; - using API.Features; - using API.Features.Pickups; - using API.Features.Pools; using Attributes; + + using Exiled.API.Features; + using Exiled.API.Features.Pickups; + using Exiled.API.Features.Pools; using Exiled.Events.EventArgs.Item; using Footprinting; @@ -21,6 +22,7 @@ namespace Exiled.Events.Patches.Events.Item using HarmonyLib; using Interactables.Interobjects.DoorUtils; + using UnityEngine; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Item/Punching.cs b/EXILED/Exiled.Events/Patches/Events/Item/Punching.cs index 15c74b57b1..08c22a8c66 100644 --- a/EXILED/Exiled.Events/Patches/Events/Item/Punching.cs +++ b/EXILED/Exiled.Events/Patches/Events/Item/Punching.cs @@ -10,11 +10,12 @@ namespace Exiled.Events.Patches.Events.Item using System.Collections.Generic; using System.Reflection.Emit; - using Exiled.API.Features; using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Item; + using HarmonyLib; + using InventorySystem.Items.MarshmallowMan; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Item/ReceivingPreference.cs b/EXILED/Exiled.Events/Patches/Events/Item/ReceivingPreference.cs index 324c8cb6d4..c3df3a6776 100644 --- a/EXILED/Exiled.Events/Patches/Events/Item/ReceivingPreference.cs +++ b/EXILED/Exiled.Events/Patches/Events/Item/ReceivingPreference.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Item using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Item; diff --git a/EXILED/Exiled.Events/Patches/Events/Item/UsingRadioPickupBattery.cs b/EXILED/Exiled.Events/Patches/Events/Item/UsingRadioPickupBattery.cs index 7d54efe70f..cb1d21b71a 100644 --- a/EXILED/Exiled.Events/Patches/Events/Item/UsingRadioPickupBattery.cs +++ b/EXILED/Exiled.Events/Patches/Events/Item/UsingRadioPickupBattery.cs @@ -12,7 +12,9 @@ namespace Exiled.Events.Patches.Events.Item using Exiled.API.Features.Pools; using Exiled.Events.EventArgs.Item; + using HarmonyLib; + using InventorySystem.Items.Radio; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Map/AnnouncingChaosEntrance.cs b/EXILED/Exiled.Events/Patches/Events/Map/AnnouncingChaosEntrance.cs index 3033a0327d..d48225d34c 100644 --- a/EXILED/Exiled.Events/Patches/Events/Map/AnnouncingChaosEntrance.cs +++ b/EXILED/Exiled.Events/Patches/Events/Map/AnnouncingChaosEntrance.cs @@ -1,4 +1,4 @@ -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- // // Copyright (c) ExMod Team. All rights reserved. // Licensed under the CC BY-SA 3.0 license. @@ -16,8 +16,11 @@ namespace Exiled.Events.Patches.Events.Map using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Map; + using HarmonyLib; + using Respawning.Announcements; + using Subtitles; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Map/AnnouncingDecontamination.cs b/EXILED/Exiled.Events/Patches/Events/Map/AnnouncingDecontamination.cs index 23882fa6c1..f91f64c17c 100644 --- a/EXILED/Exiled.Events/Patches/Events/Map/AnnouncingDecontamination.cs +++ b/EXILED/Exiled.Events/Patches/Events/Map/AnnouncingDecontamination.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Map using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Map; @@ -30,7 +30,7 @@ namespace Exiled.Events.Patches.Events.Map [HarmonyPatch(typeof(DecontaminationController), nameof(DecontaminationController.UpdateSpeaker))] internal static class AnnouncingDecontamination { - private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) + private static IEnumerable Transpiler(IEnumerable instructions) { List newInstructions = ListPool.Pool.Get(instructions); diff --git a/EXILED/Exiled.Events/Patches/Events/Map/AnnouncingNtfEntrance.cs b/EXILED/Exiled.Events/Patches/Events/Map/AnnouncingNtfEntrance.cs index 75cf10177c..99822f8fc6 100644 --- a/EXILED/Exiled.Events/Patches/Events/Map/AnnouncingNtfEntrance.cs +++ b/EXILED/Exiled.Events/Patches/Events/Map/AnnouncingNtfEntrance.cs @@ -7,17 +7,19 @@ namespace Exiled.Events.Patches.Events.Map { - using System; using System.Collections.Generic; - using System.Reflection; using System.Reflection.Emit; using System.Text.RegularExpressions; - using API.Features.Pools; + using Exiled.API.Features.Pools; + using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Map; + using Handlers; + using HarmonyLib; + using Respawning.Announcements; using Respawning.NamingRules; diff --git a/EXILED/Exiled.Events/Patches/Events/Map/AnnouncingNtfMiniEntrance.cs b/EXILED/Exiled.Events/Patches/Events/Map/AnnouncingNtfMiniEntrance.cs index 018362acde..3c2a295484 100644 --- a/EXILED/Exiled.Events/Patches/Events/Map/AnnouncingNtfMiniEntrance.cs +++ b/EXILED/Exiled.Events/Patches/Events/Map/AnnouncingNtfMiniEntrance.cs @@ -1,4 +1,4 @@ -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- // // Copyright (c) ExMod Team. All rights reserved. // Licensed under the CC BY-SA 3.0 license. @@ -10,11 +10,15 @@ namespace Exiled.Events.Patches.Events.Map using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; + using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Map; + using Handlers; + using HarmonyLib; + using Respawning.Announcements; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Map/AnnouncingScpTermination.cs b/EXILED/Exiled.Events/Patches/Events/Map/AnnouncingScpTermination.cs index 1a0b5d5111..3178abccfe 100644 --- a/EXILED/Exiled.Events/Patches/Events/Map/AnnouncingScpTermination.cs +++ b/EXILED/Exiled.Events/Patches/Events/Map/AnnouncingScpTermination.cs @@ -12,13 +12,15 @@ namespace Exiled.Events.Patches.Events.Map using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; - using Exiled.API.Features; + using Exiled.API.Features.Pools; + using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Map; - using Exiled.Events.Handlers; + using Footprinting; + using global::Cassie; + using HarmonyLib; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Map/BreakingScp2176.cs b/EXILED/Exiled.Events/Patches/Events/Map/BreakingScp2176.cs index 8236e2c485..fbce1e7320 100644 --- a/EXILED/Exiled.Events/Patches/Events/Map/BreakingScp2176.cs +++ b/EXILED/Exiled.Events/Patches/Events/Map/BreakingScp2176.cs @@ -10,12 +10,16 @@ namespace Exiled.Events.Patches.Events.Map using System.Collections.Generic; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; + using Exiled.API.Features; + using Exiled.API.Features.Pools; + using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Map; + using Footprinting; + using HarmonyLib; + using InventorySystem.Items.ThrowableProjectiles; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Map/ChangingIntoGrenade.cs b/EXILED/Exiled.Events/Patches/Events/Map/ChangingIntoGrenade.cs index 30ec11522f..58453f2874 100644 --- a/EXILED/Exiled.Events/Patches/Events/Map/ChangingIntoGrenade.cs +++ b/EXILED/Exiled.Events/Patches/Events/Map/ChangingIntoGrenade.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Map using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Map; diff --git a/EXILED/Exiled.Events/Patches/Events/Map/Decontaminating.cs b/EXILED/Exiled.Events/Patches/Events/Map/Decontaminating.cs index 6c8ad469a3..16cbf115fe 100644 --- a/EXILED/Exiled.Events/Patches/Events/Map/Decontaminating.cs +++ b/EXILED/Exiled.Events/Patches/Events/Map/Decontaminating.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Map using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Map; @@ -30,7 +30,7 @@ namespace Exiled.Events.Patches.Events.Map [HarmonyPatch(typeof(DecontaminationController), nameof(DecontaminationController.FinishDecontamination))] internal static class Decontaminating { - private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) + private static IEnumerable Transpiler(IEnumerable instructions) { List newInstructions = ListPool.Pool.Get(instructions); diff --git a/EXILED/Exiled.Events/Patches/Events/Map/ElevatorSequencesUpdated.cs b/EXILED/Exiled.Events/Patches/Events/Map/ElevatorSequencesUpdated.cs index 098a5852ae..a623790fcd 100644 --- a/EXILED/Exiled.Events/Patches/Events/Map/ElevatorSequencesUpdated.cs +++ b/EXILED/Exiled.Events/Patches/Events/Map/ElevatorSequencesUpdated.cs @@ -1,4 +1,4 @@ -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- // // Copyright (c) ExMod Team. All rights reserved. // Licensed under the CC BY-SA 3.0 license. @@ -9,7 +9,9 @@ namespace Exiled.Events.Patches.Events.Map { using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Map; + using HarmonyLib; + using Interactables.Interobjects; /// diff --git a/EXILED/Exiled.Events/Patches/Events/Map/ExplodingFlashGrenade.cs b/EXILED/Exiled.Events/Patches/Events/Map/ExplodingFlashGrenade.cs index 63968c0232..6cd2bc8b08 100644 --- a/EXILED/Exiled.Events/Patches/Events/Map/ExplodingFlashGrenade.cs +++ b/EXILED/Exiled.Events/Patches/Events/Map/ExplodingFlashGrenade.cs @@ -11,13 +11,16 @@ namespace Exiled.Events.Patches.Events.Map using System.Linq; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; using Exiled.API.Extensions; + using Exiled.API.Features; + using Exiled.API.Features.Pools; using Exiled.Events.EventArgs.Map; using Exiled.Events.Patches.Generic; + using HarmonyLib; + using InventorySystem.Items.ThrowableProjectiles; + using UnityEngine; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Map/ExplodingFragGrenade.cs b/EXILED/Exiled.Events/Patches/Events/Map/ExplodingFragGrenade.cs index ad35198c58..2a544767d9 100644 --- a/EXILED/Exiled.Events/Patches/Events/Map/ExplodingFragGrenade.cs +++ b/EXILED/Exiled.Events/Patches/Events/Map/ExplodingFragGrenade.cs @@ -10,8 +10,9 @@ namespace Exiled.Events.Patches.Events.Map using System.Collections.Generic; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; + using Exiled.API.Features; + using Exiled.API.Features.Pools; + using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Map; diff --git a/EXILED/Exiled.Events/Patches/Events/Map/FillingLocker.cs b/EXILED/Exiled.Events/Patches/Events/Map/FillingLocker.cs index 0816e0934e..c72e70dd72 100644 --- a/EXILED/Exiled.Events/Patches/Events/Map/FillingLocker.cs +++ b/EXILED/Exiled.Events/Patches/Events/Map/FillingLocker.cs @@ -66,4 +66,4 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Map/Generating.cs b/EXILED/Exiled.Events/Patches/Events/Map/Generating.cs index ce68e1588d..1c14a8d8a1 100644 --- a/EXILED/Exiled.Events/Patches/Events/Map/Generating.cs +++ b/EXILED/Exiled.Events/Patches/Events/Map/Generating.cs @@ -1,4 +1,4 @@ -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- // // Copyright (c) ExMod Team. All rights reserved. // Licensed under the CC BY-SA 3.0 license. @@ -18,10 +18,14 @@ namespace Exiled.Events.Patches.Events.Map using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Map; + using HarmonyLib; + using LabApi.Events.Arguments.ServerEvents; + using MapGeneration; using MapGeneration.Holidays; + using UnityEngine; using static HarmonyLib.AccessTools; @@ -521,7 +525,7 @@ private static void FakeSpawn(AtlasZoneGenerator gen, AtlasInterpretation interp Spawned.Add(new AtlasZoneGenerator.SpawnedRoomData { ChosenCandidate = spawnableRoom, - Instance = null!, + Instance = null, Interpretation = interpretation, }); @@ -545,7 +549,7 @@ private static void FakeSpawn(AtlasZoneGenerator gen, AtlasInterpretation interp Spawned.Add(new AtlasZoneGenerator.SpawnedRoomData { ChosenCandidate = room, - Instance = null!, + Instance = null, Interpretation = interpretation, }); diff --git a/EXILED/Exiled.Events/Patches/Events/Map/GeneratorActivating.cs b/EXILED/Exiled.Events/Patches/Events/Map/GeneratorActivating.cs index dad7714174..578782d10c 100644 --- a/EXILED/Exiled.Events/Patches/Events/Map/GeneratorActivating.cs +++ b/EXILED/Exiled.Events/Patches/Events/Map/GeneratorActivating.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Map using System.Diagnostics; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Map; diff --git a/EXILED/Exiled.Events/Patches/Events/Map/PlacingBulletHole.cs b/EXILED/Exiled.Events/Patches/Events/Map/PlacingBulletHole.cs index ff3a09dfa8..bc8da0cc5e 100644 --- a/EXILED/Exiled.Events/Patches/Events/Map/PlacingBulletHole.cs +++ b/EXILED/Exiled.Events/Patches/Events/Map/PlacingBulletHole.cs @@ -11,13 +11,19 @@ namespace Exiled.Events.Patches.Events.Map using System.Linq; using System.Reflection.Emit; - using API.Features.Pools; using Attributes; + using Decals; + + using Exiled.API.Features.Pools; using Exiled.Events.EventArgs.Map; + using Handlers; + using HarmonyLib; + using InventorySystem.Items.Firearms.Modules; + using UnityEngine; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Map/PlacingPickupIntoPocketDimension.cs b/EXILED/Exiled.Events/Patches/Events/Map/PlacingPickupIntoPocketDimension.cs index d82c118797..ea127c946f 100644 --- a/EXILED/Exiled.Events/Patches/Events/Map/PlacingPickupIntoPocketDimension.cs +++ b/EXILED/Exiled.Events/Patches/Events/Map/PlacingPickupIntoPocketDimension.cs @@ -7,14 +7,15 @@ namespace Exiled.Events.Patches.Events.Map { - using System.Collections.Generic; - using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Map; + using Handlers; + using HarmonyLib; + using InventorySystem.Items.Pickups; - using Mirror; + using PlayerRoles.PlayableScps.Scp106; using static PlayerRoles.PlayableScps.Scp106.Scp106PocketItemManager; diff --git a/EXILED/Exiled.Events/Patches/Events/Map/Scp244Spawning.cs b/EXILED/Exiled.Events/Patches/Events/Map/Scp244Spawning.cs index 449fd14c57..3ee65548c0 100644 --- a/EXILED/Exiled.Events/Patches/Events/Map/Scp244Spawning.cs +++ b/EXILED/Exiled.Events/Patches/Events/Map/Scp244Spawning.cs @@ -8,18 +8,21 @@ namespace Exiled.Events.Patches.Events.Map { using System.Collections.Generic; - using System.Linq; using System.Reflection.Emit; - using Exiled.API.Features.Pickups; using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Map; + using HarmonyLib; + using InventorySystem.Items.Pickups; using InventorySystem.Items.Usables.Scp244; + using MapGeneration; + using Mirror; + using UnityEngine; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Map/SpawningItem.cs b/EXILED/Exiled.Events/Patches/Events/Map/SpawningItem.cs index bac813d138..e932c0c6ef 100644 --- a/EXILED/Exiled.Events/Patches/Events/Map/SpawningItem.cs +++ b/EXILED/Exiled.Events/Patches/Events/Map/SpawningItem.cs @@ -10,13 +10,13 @@ namespace Exiled.Events.Patches.Events.Map using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Doors; - using API.Features.Pools; - using Attributes; using EventArgs.Map; + using Exiled.API.Features.Doors; + using Exiled.API.Features.Pools; + using HarmonyLib; using Interactables.Interobjects.DoorUtils; diff --git a/EXILED/Exiled.Events/Patches/Events/Map/SpawningRoomConnector.cs b/EXILED/Exiled.Events/Patches/Events/Map/SpawningRoomConnector.cs index 4d6a72a8f9..f5d5f20da6 100644 --- a/EXILED/Exiled.Events/Patches/Events/Map/SpawningRoomConnector.cs +++ b/EXILED/Exiled.Events/Patches/Events/Map/SpawningRoomConnector.cs @@ -17,7 +17,9 @@ namespace Exiled.Events.Patches.Events.Map using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Map; + using HarmonyLib; + using MapGeneration; using MapGeneration.RoomConnectors.Spawners; diff --git a/EXILED/Exiled.Events/Patches/Events/Map/TurningOffLights.cs b/EXILED/Exiled.Events/Patches/Events/Map/TurningOffLights.cs index cbc12540eb..e2449ec261 100644 --- a/EXILED/Exiled.Events/Patches/Events/Map/TurningOffLights.cs +++ b/EXILED/Exiled.Events/Patches/Events/Map/TurningOffLights.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Map using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Map; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/ActivatingWarheadPanel.cs b/EXILED/Exiled.Events/Patches/Events/Player/ActivatingWarheadPanel.cs index d7c8be8354..9b764e9e5d 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/ActivatingWarheadPanel.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/ActivatingWarheadPanel.cs @@ -8,14 +8,16 @@ namespace Exiled.Events.Patches.Events.Player { using System.Collections.Generic; - using System.Diagnostics; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; + using Exiled.API.Features; + using Exiled.API.Features.Pools; + using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; + using HarmonyLib; + using Interactables.Interobjects.DoorUtils; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/ActivatingWorkstation.cs b/EXILED/Exiled.Events/Patches/Events/Player/ActivatingWorkstation.cs index 4dec7db382..b47a21d98a 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/ActivatingWorkstation.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/ActivatingWorkstation.cs @@ -10,8 +10,9 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; + using Exiled.API.Features; + using Exiled.API.Features.Pools; + using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/Aiming.cs b/EXILED/Exiled.Events/Patches/Events/Player/Aiming.cs index 737ff4ead2..83ba4a1fc6 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/Aiming.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/Aiming.cs @@ -10,16 +10,13 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using Exiled.API.Extensions; using Exiled.API.Features.Pools; - using Exiled.Events.Attributes; - using Exiled.Events.EventArgs.Player; - using Exiled.Events.Handlers; using HarmonyLib; + using InventorySystem.Items.Firearms.Modules; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/Banned.cs b/EXILED/Exiled.Events/Patches/Events/Player/Banned.cs index f8486d05fc..96c2c708e1 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/Banned.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/Banned.cs @@ -10,8 +10,8 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; + using Exiled.API.Features; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/Banning.cs b/EXILED/Exiled.Events/Patches/Events/Player/Banning.cs index 573c2bd820..c6a0a26344 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/Banning.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/Banning.cs @@ -10,12 +10,15 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features; using CommandSystem; + + using Exiled.API.Features; using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; + using Footprinting; + using HarmonyLib; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/ChangedAspectRatio.cs b/EXILED/Exiled.Events/Patches/Events/Player/ChangedAspectRatio.cs index 1cc7dfc8a9..faaad99f57 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/ChangedAspectRatio.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/ChangedAspectRatio.cs @@ -10,11 +10,14 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; using CentralAuth; + + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; + using HarmonyLib; + using UnityEngine; using static HarmonyLib.AccessTools; @@ -83,4 +86,4 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Player/ChangedItem.cs b/EXILED/Exiled.Events/Patches/Events/Player/ChangedItem.cs index 465935ad7a..0ed278469a 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/ChangedItem.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/ChangedItem.cs @@ -10,8 +10,8 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; + using Exiled.API.Features; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; @@ -29,7 +29,7 @@ namespace Exiled.Events.Patches.Events.Player [HarmonyPatch(typeof(Inventory), nameof(Inventory.CurInstance), MethodType.Setter)] internal static class ChangedItem { - private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) + private static IEnumerable Transpiler(IEnumerable instructions) { List newInstructions = ListPool.Pool.Get(instructions); int index = newInstructions.Count - 1; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/ChangedRoom.cs b/EXILED/Exiled.Events/Patches/Events/Player/ChangedRoom.cs index 071e1c5fe1..ce5e44d505 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/ChangedRoom.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/ChangedRoom.cs @@ -14,9 +14,13 @@ namespace Exiled.Events.Patches.Events.Player using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; using Exiled.Events.Handlers; + using HarmonyLib; + using MapGeneration; + using PlayerRoles; + using UnityEngine; using static HarmonyLib.AccessTools; @@ -66,4 +70,4 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Player/ChangingDangerState.cs b/EXILED/Exiled.Events/Patches/Events/Player/ChangingDangerState.cs index 11030dddd8..7afe94bbd5 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/ChangingDangerState.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/ChangingDangerState.cs @@ -14,12 +14,14 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using CustomPlayerEffects.Danger; + using Exiled.API.Enums; using Exiled.API.Extensions; using Exiled.API.Features; using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; + using HarmonyLib; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/ChangingDisruptorMode.cs b/EXILED/Exiled.Events/Patches/Events/Player/ChangingDisruptorMode.cs index 1263f56daa..caf13eed8c 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/ChangingDisruptorMode.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/ChangingDisruptorMode.cs @@ -13,9 +13,11 @@ namespace Exiled.Events.Patches.Events.Player using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; + using HarmonyLib; using InventorySystem.Items.Firearms.Modules; + using Mirror; using static HarmonyLib.AccessTools; @@ -67,4 +69,4 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Player/ChangingGroup.cs b/EXILED/Exiled.Events/Patches/Events/Player/ChangingGroup.cs index 3e94bf497b..846320aac2 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/ChangingGroup.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/ChangingGroup.cs @@ -10,8 +10,8 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; + using Exiled.API.Features; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; @@ -92,4 +92,4 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Player/ChangingItem.cs b/EXILED/Exiled.Events/Patches/Events/Player/ChangingItem.cs index fa964cad82..646fd7de25 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/ChangingItem.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/ChangingItem.cs @@ -10,9 +10,9 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features; - using API.Features.Items; - using API.Features.Pools; + using Exiled.API.Features; + using Exiled.API.Features.Items; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/ChangingMicroHIDState.cs b/EXILED/Exiled.Events/Patches/Events/Player/ChangingMicroHIDState.cs index fdab782419..e945ba24a8 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/ChangingMicroHIDState.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/ChangingMicroHIDState.cs @@ -8,15 +8,15 @@ namespace Exiled.Events.Patches.Events.Player { using System.Collections.Generic; - using System.Linq; using System.Reflection.Emit; - using API.Features.Items; - using API.Features.Pools; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Item; using Exiled.Events.EventArgs.Player; + using HarmonyLib; + using InventorySystem.Items.MicroHID; using InventorySystem.Items.MicroHID.Modules; @@ -101,4 +101,4 @@ private static bool CallPickupEvent(ushort serial, ref MicroHidPhase phase) return ev.IsAllowed; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Player/ChangingMoveState.cs b/EXILED/Exiled.Events/Patches/Events/Player/ChangingMoveState.cs index 5c9879f7ca..94e93456fe 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/ChangingMoveState.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/ChangingMoveState.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; using Exiled.Events.Handlers; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/ChangingRadioPreset.cs b/EXILED/Exiled.Events/Patches/Events/Player/ChangingRadioPreset.cs index ad77fa94ba..ddc7c834a2 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/ChangingRadioPreset.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/ChangingRadioPreset.cs @@ -10,8 +10,8 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; + using Exiled.API.Features; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; @@ -97,4 +97,4 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Player/ChangingRoleAndSpawned.cs b/EXILED/Exiled.Events/Patches/Events/Player/ChangingRoleAndSpawned.cs index bc37907d62..d5fa2ee0fd 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/ChangingRoleAndSpawned.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/ChangingRoleAndSpawned.cs @@ -12,25 +12,25 @@ namespace Exiled.Events.Patches.Events.Player using System.Linq; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; - using API.Features.Roles; + using Exiled.API.Features; + using Exiled.API.Features.Pools; + using Exiled.API.Features.Roles; + using Exiled.Events.EventArgs.Player; + using HarmonyLib; + using InventorySystem; - using InventorySystem.Configs; using InventorySystem.Items; - using InventorySystem.Items.Armor; using InventorySystem.Items.Pickups; using InventorySystem.Items.Usables.Scp1344; + using LabApi.Events.Arguments.PlayerEvents; using LabApi.Events.Handlers; - using Mirror; using PlayerRoles; using static HarmonyLib.AccessTools; - using static UnityEngine.GraphicsBuffer; using Player = Handlers.Player; @@ -181,7 +181,7 @@ private static void ChangeInventory(ChangingRoleEventArgs ev) Inventory inventory = ev.Player.Inventory; if (InventoryItemProvider.KeepItemsAfterEscaping && ev.Reason == API.Enums.SpawnReason.Escaped) { - List list = new List(); + List list = new(); HashSet hashSet = HashSetPool.Pool.Get(); foreach (KeyValuePair item2 in inventory.UserInventory.Items) @@ -225,4 +225,4 @@ private static void ChangeInventory(ChangingRoleEventArgs ev) } } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Player/ChangingSpectatedPlayerPatch.cs b/EXILED/Exiled.Events/Patches/Events/Player/ChangingSpectatedPlayerPatch.cs index 52617181a2..ae911e7917 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/ChangingSpectatedPlayerPatch.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/ChangingSpectatedPlayerPatch.cs @@ -10,11 +10,12 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; using HarmonyLib; + using PlayerRoles; using PlayerRoles.Spectating; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/ChangingWearables.cs b/EXILED/Exiled.Events/Patches/Events/Player/ChangingWearables.cs index 9ae402e3ff..0618d3d560 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/ChangingWearables.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/ChangingWearables.cs @@ -11,7 +11,6 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using Exiled.API.Enums; - using Exiled.API.Extensions; using Exiled.API.Features; using Exiled.API.Features.Pools; using Exiled.Events.Attributes; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/ConsumingItem.cs b/EXILED/Exiled.Events/Patches/Events/Player/ConsumingItem.cs index 85e9f6698f..e71926d609 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/ConsumingItem.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/ConsumingItem.cs @@ -75,4 +75,4 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Player/DamagingDoor.cs b/EXILED/Exiled.Events/Patches/Events/Player/DamagingDoor.cs index 3b693af58e..a262608e3d 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/DamagingDoor.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/DamagingDoor.cs @@ -10,16 +10,14 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; - - using Exiled.Events.Attributes; + using Exiled.API.Features.Pools; using Exiled.Events.EventArgs.Player; using Handlers; using HarmonyLib; + using Interactables.Interobjects; - using Interactables.Interobjects.DoorUtils; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/DamagingShootingTarget.cs b/EXILED/Exiled.Events/Patches/Events/Player/DamagingShootingTarget.cs index 2687d9b0e7..ac7b873f44 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/DamagingShootingTarget.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/DamagingShootingTarget.cs @@ -12,8 +12,8 @@ namespace Exiled.Events.Patches.Events.Player using AdminToys; - using API.Features; - using API.Features.Pools; + using Exiled.API.Features; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/DamagingWindow.cs b/EXILED/Exiled.Events/Patches/Events/Player/DamagingWindow.cs index f8db09f753..0d4d002567 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/DamagingWindow.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/DamagingWindow.cs @@ -10,8 +10,8 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.DamageHandlers; - using API.Features.Pools; + using Exiled.API.Features.DamageHandlers; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/DeactivatingWorkstation.cs b/EXILED/Exiled.Events/Patches/Events/Player/DeactivatingWorkstation.cs index a31db55d0b..ad9acd6009 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/DeactivatingWorkstation.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/DeactivatingWorkstation.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/Destroying.cs b/EXILED/Exiled.Events/Patches/Events/Player/Destroying.cs index 5b1b6ac58a..c5cd661dc1 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/Destroying.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/Destroying.cs @@ -11,8 +11,8 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using System.Runtime.CompilerServices; - using API.Features; - using API.Features.Pools; + using Exiled.API.Features; + using Exiled.API.Features.Pools; using Exiled.Events.EventArgs.Player; using HarmonyLib; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/DrinkingCoffee.cs b/EXILED/Exiled.Events/Patches/Events/Player/DrinkingCoffee.cs index 3ec5e18953..759b3632d7 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/DrinkingCoffee.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/DrinkingCoffee.cs @@ -15,6 +15,7 @@ namespace Exiled.Events.Patches.Events.Player using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; + using HarmonyLib; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/DroppingAmmo.cs b/EXILED/Exiled.Events/Patches/Events/Player/DroppingAmmo.cs index 180a0bd115..84537ce483 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/DroppingAmmo.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/DroppingAmmo.cs @@ -11,8 +11,8 @@ namespace Exiled.Events.Patches.Events.Player using System.Linq; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; + using Exiled.API.Features; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/DroppingItem.cs b/EXILED/Exiled.Events/Patches/Events/Player/DroppingItem.cs index f5802d2a84..5b8b63b66a 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/DroppingItem.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/DroppingItem.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/DryFire.cs b/EXILED/Exiled.Events/Patches/Events/Player/DryFire.cs index 9ea721c3b6..20566d1349 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/DryFire.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/DryFire.cs @@ -56,7 +56,7 @@ internal static IEnumerable GetInstructions(CodeInstruction sta yield return new(OpCodes.Brfalse_S, ret); } - private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) + private static IEnumerable Transpiler(IEnumerable instructions) { List newInstructions = ListPool.Pool.Get(instructions); @@ -123,7 +123,7 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Player/EarningAchievement.cs b/EXILED/Exiled.Events/Patches/Events/Player/EarningAchievement.cs index 8acd20cb62..0c42bce6ed 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/EarningAchievement.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/EarningAchievement.cs @@ -12,8 +12,8 @@ namespace Exiled.Events.Patches.Events.Player using Achievements; - using API.Features; - using API.Features.Pools; + using Exiled.API.Features; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; @@ -77,4 +77,4 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Player/Emotion.cs b/EXILED/Exiled.Events/Patches/Events/Player/Emotion.cs index a7d4475693..2df58c54c6 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/Emotion.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/Emotion.cs @@ -13,7 +13,9 @@ namespace Exiled.Events.Patches.Events.Player using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; + using HarmonyLib; + using PlayerRoles.FirstPersonControl.Thirdperson.Subcontrollers; using static HarmonyLib.AccessTools; @@ -67,7 +69,7 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Player/EnteringKillerCollision.cs b/EXILED/Exiled.Events/Patches/Events/Player/EnteringKillerCollision.cs index 59259d210c..f8038bcdc3 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/EnteringKillerCollision.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/EnteringKillerCollision.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/EnteringPocketDimension.cs b/EXILED/Exiled.Events/Patches/Events/Player/EnteringPocketDimension.cs index f0dbbef923..0f8e063d7a 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/EnteringPocketDimension.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/EnteringPocketDimension.cs @@ -10,8 +10,8 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; + using Exiled.API.Features; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/EnteringSinkholeEnvironmentalHazard.cs b/EXILED/Exiled.Events/Patches/Events/Player/EnteringSinkholeEnvironmentalHazard.cs index c98d661747..e17f9752ee 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/EnteringSinkholeEnvironmentalHazard.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/EnteringSinkholeEnvironmentalHazard.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/EnteringTantrumEnvironmentalHazard.cs b/EXILED/Exiled.Events/Patches/Events/Player/EnteringTantrumEnvironmentalHazard.cs index b1d8fa813d..409524e490 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/EnteringTantrumEnvironmentalHazard.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/EnteringTantrumEnvironmentalHazard.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/EscapingAndEscaped.cs b/EXILED/Exiled.Events/Patches/Events/Player/EscapingAndEscaped.cs index 87ad9273bb..060fd61672 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/EscapingAndEscaped.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/EscapingAndEscaped.cs @@ -13,12 +13,15 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; using EventArgs.Player; + + using Exiled.API.Features; + using Exiled.API.Features.Pools; using Exiled.API.Features.Roles; using Exiled.Events.Attributes; + using HarmonyLib; + using LabApi.Events.Arguments.PlayerEvents; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/EscapingPocketDimension.cs b/EXILED/Exiled.Events/Patches/Events/Player/EscapingPocketDimension.cs index 03153ab7a5..3597f76d21 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/EscapingPocketDimension.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/EscapingPocketDimension.cs @@ -8,11 +8,10 @@ namespace Exiled.Events.Patches.Events.Player { using System.Collections.Generic; - using System.Reflection; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; + using Exiled.API.Features.Pools; + using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; @@ -21,8 +20,6 @@ namespace Exiled.Events.Patches.Events.Player using PlayerRoles.FirstPersonControl; using PlayerRoles.PlayableScps.Scp106; - using UnityEngine; - using static HarmonyLib.AccessTools; /// diff --git a/EXILED/Exiled.Events/Patches/Events/Player/ExitingSinkholeEnvironmentalHazard.cs b/EXILED/Exiled.Events/Patches/Events/Player/ExitingSinkholeEnvironmentalHazard.cs index 677a7dbda8..81d1b47cd5 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/ExitingSinkholeEnvironmentalHazard.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/ExitingSinkholeEnvironmentalHazard.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/ExitingTantrumEnvironmentalHazard.cs b/EXILED/Exiled.Events/Patches/Events/Player/ExitingTantrumEnvironmentalHazard.cs index 113155064e..7e1bcece75 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/ExitingTantrumEnvironmentalHazard.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/ExitingTantrumEnvironmentalHazard.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/ExplodingMicroHID.cs b/EXILED/Exiled.Events/Patches/Events/Player/ExplodingMicroHID.cs index 2fdf38da46..64855a893c 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/ExplodingMicroHID.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/ExplodingMicroHID.cs @@ -13,7 +13,9 @@ namespace Exiled.Events.Patches.Events.Player using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; + using HarmonyLib; + using InventorySystem.Items.MicroHID.Modules; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/FailingEscapePocketDimension.cs b/EXILED/Exiled.Events/Patches/Events/Player/FailingEscapePocketDimension.cs index 5e4a7cfcb6..a5cb3ba790 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/FailingEscapePocketDimension.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/FailingEscapePocketDimension.cs @@ -10,15 +10,13 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; + using Exiled.API.Features.Pools; + using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; using HarmonyLib; - using UnityEngine; - using static HarmonyLib.AccessTools; /// diff --git a/EXILED/Exiled.Events/Patches/Events/Player/FlippingCoin.cs b/EXILED/Exiled.Events/Patches/Events/Player/FlippingCoin.cs index 4ec1ce8c9f..d79e200c29 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/FlippingCoin.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/FlippingCoin.cs @@ -10,13 +10,15 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; + using HarmonyLib; + using InventorySystem.Items; using InventorySystem.Items.Coin; + using Mirror; using static HarmonyLib.AccessTools; @@ -83,4 +85,4 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Player/Healing.cs b/EXILED/Exiled.Events/Patches/Events/Player/Healing.cs index 11e53cd79a..ed2ede6b71 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/Healing.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/Healing.cs @@ -11,11 +11,13 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features; + using Exiled.API.Features; using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; + using HarmonyLib; + using PlayerStatsSystem; /// diff --git a/EXILED/Exiled.Events/Patches/Events/Player/Hit.cs b/EXILED/Exiled.Events/Patches/Events/Player/Hit.cs index 2002397b50..568a6b8f9d 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/Hit.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/Hit.cs @@ -1,4 +1,4 @@ -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- // // Copyright (c) ExMod Team. All rights reserved. // Licensed under the CC BY-SA 3.0 license. @@ -10,11 +10,14 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; using Attributes; + + using Exiled.API.Features; + using Exiled.API.Features.Pools; using Exiled.Events.EventArgs.Player; + using HarmonyLib; + using PlayerRoles.PlayableScps.Scp049.Zombies; using PlayerRoles.PlayableScps.Subroutines; using PlayerRoles.Subroutines; @@ -29,7 +32,7 @@ namespace Exiled.Events.Patches.Events.Player [HarmonyPatch(typeof(ScpAttackAbilityBase), nameof(ScpAttackAbilityBase.ServerPerformAttack))] public class Hit { - private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) + private static IEnumerable Transpiler(IEnumerable instructions) { List newInstructions = ListPool.Pool.Get(instructions); diff --git a/EXILED/Exiled.Events/Patches/Events/Player/Hurting.cs b/EXILED/Exiled.Events/Patches/Events/Player/Hurting.cs index ffd5392b06..f77e680ec2 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/Hurting.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/Hurting.cs @@ -10,12 +10,9 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; - using API.Features.Roles; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; - using Exiled.Events.EventArgs.Scp079; - using Exiled.Events.Handlers; using HarmonyLib; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/Interacted.cs b/EXILED/Exiled.Events/Patches/Events/Player/Interacted.cs index 3c6c6e7f30..4d39378981 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/Interacted.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/Interacted.cs @@ -10,12 +10,15 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; + using Exiled.API.Features; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; + using HarmonyLib; + using Interactables; + using UnityEngine; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/InteractingDoor.cs b/EXILED/Exiled.Events/Patches/Events/Player/InteractingDoor.cs index ddd406ac1f..7b341892c0 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/InteractingDoor.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/InteractingDoor.cs @@ -11,11 +11,16 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection; using System.Reflection.Emit; - using API.Features.Pools; using Attributes; + using EventArgs.Player; + + using Exiled.API.Features.Pools; + using HarmonyLib; + using Interactables.Interobjects.DoorUtils; + using LabApi.Events.Arguments.PlayerEvents; using LabApi.Events.Handlers; @@ -171,7 +176,7 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) + private static IEnumerable Transpiler(IEnumerable instructions) { List newInstructions = ListPool.Pool.Get(instructions); diff --git a/EXILED/Exiled.Events/Patches/Events/Player/InteractingElevator.cs b/EXILED/Exiled.Events/Patches/Events/Player/InteractingElevator.cs index 39382fd680..4a13be49f0 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/InteractingElevator.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/InteractingElevator.cs @@ -11,8 +11,8 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; + using Exiled.API.Features; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/InteractingEmergencyButton.cs b/EXILED/Exiled.Events/Patches/Events/Player/InteractingEmergencyButton.cs index dcde1d57eb..6629cbcc70 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/InteractingEmergencyButton.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/InteractingEmergencyButton.cs @@ -1,4 +1,4 @@ -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- // // Copyright (c) ExMod Team. All rights reserved. // Licensed under the CC BY-SA 3.0 license. @@ -16,7 +16,9 @@ namespace Exiled.Events.Patches.Events.Player using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; + using HarmonyLib; + using Interactables.Interobjects; using Interactables.Interobjects.DoorUtils; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/InteractingGenerator.cs b/EXILED/Exiled.Events/Patches/Events/Player/InteractingGenerator.cs index ade2d45a67..ec52a34a24 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/InteractingGenerator.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/InteractingGenerator.cs @@ -13,7 +13,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/InteractingLocker.cs b/EXILED/Exiled.Events/Patches/Events/Player/InteractingLocker.cs index 3ce7b9aeee..18864269a7 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/InteractingLocker.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/InteractingLocker.cs @@ -11,12 +11,14 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; + using Exiled.API.Features; + using Exiled.API.Features.Pools; + using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; using HarmonyLib; + using MapGeneration.Distributors; using static HarmonyLib.AccessTools; @@ -29,7 +31,7 @@ namespace Exiled.Events.Patches.Events.Player [HarmonyPatch(typeof(Locker), nameof(Locker.ServerInteract))] internal static class InteractingLocker { - private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) + private static IEnumerable Transpiler(IEnumerable instructions) { List newInstructions = ListPool.Pool.Get(instructions); diff --git a/EXILED/Exiled.Events/Patches/Events/Player/InteractingShootingTarget.cs b/EXILED/Exiled.Events/Patches/Events/Player/InteractingShootingTarget.cs index 131705bf4b..85ecd07ef3 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/InteractingShootingTarget.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/InteractingShootingTarget.cs @@ -10,8 +10,8 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; + using Exiled.API.Features; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/IntercomSpeaking.cs b/EXILED/Exiled.Events/Patches/Events/Player/IntercomSpeaking.cs index 08542cd432..1f995b12ff 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/IntercomSpeaking.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/IntercomSpeaking.cs @@ -8,10 +8,9 @@ namespace Exiled.Events.Patches.Events.Player { using System.Collections.Generic; - using System.Diagnostics; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; @@ -72,4 +71,4 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Player/IssuingMute.cs b/EXILED/Exiled.Events/Patches/Events/Player/IssuingMute.cs index e7b92c0426..a94ac61ad6 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/IssuingMute.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/IssuingMute.cs @@ -10,8 +10,8 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; + using Exiled.API.Features; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/Joined.cs b/EXILED/Exiled.Events/Patches/Events/Player/Joined.cs index 18421e5044..75e66beb5b 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/Joined.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/Joined.cs @@ -12,7 +12,7 @@ namespace Exiled.Events.Patches.Events.Player using System; - using API.Features; + using Exiled.API.Features; using Exiled.Events.EventArgs.Player; using Exiled.Loader.Features; @@ -61,4 +61,4 @@ private static void Postfix(ReferenceHub __instance) CallEvent(__instance, out _); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Player/Jumping.cs b/EXILED/Exiled.Events/Patches/Events/Player/Jumping.cs index 6f50676792..ff3bac88e1 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/Jumping.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/Jumping.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; using Exiled.Events.Handlers; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/Kicked.cs b/EXILED/Exiled.Events/Patches/Events/Player/Kicked.cs index cf6a9261d0..73214335ad 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/Kicked.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/Kicked.cs @@ -10,8 +10,8 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; + using Exiled.API.Features; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/Kicking.cs b/EXILED/Exiled.Events/Patches/Events/Player/Kicking.cs index 0ab9467d61..5943b4cf8f 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/Kicking.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/Kicking.cs @@ -11,6 +11,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using CommandSystem; + using Exiled.API.Features; using Exiled.API.Features.Pools; using Exiled.Events.Attributes; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/Landing.cs b/EXILED/Exiled.Events/Patches/Events/Player/Landing.cs index ac28cd901a..4b9ff3291f 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/Landing.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/Landing.cs @@ -10,13 +10,14 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; using Exiled.Events.Handlers; + using HarmonyLib; + using PlayerRoles.FirstPersonControl; - using PlayerRoles.FirstPersonControl.Thirdperson; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/Left.cs b/EXILED/Exiled.Events/Patches/Events/Player/Left.cs index 3621429dce..8c4b5eaaf8 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/Left.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/Left.cs @@ -11,8 +11,8 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; + using Exiled.API.Features; + using Exiled.API.Features.Pools; using Exiled.Events.EventArgs.Player; using HarmonyLib; @@ -28,7 +28,7 @@ namespace Exiled.Events.Patches.Events.Player [HarmonyPatch(typeof(CustomNetworkManager), nameof(CustomNetworkManager.OnServerDisconnect), typeof(NetworkConnectionToClient))] internal static class Left { - private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) + private static IEnumerable Transpiler(IEnumerable instructions) { List newInstructions = ListPool.Pool.Get(instructions); diff --git a/EXILED/Exiled.Events/Patches/Events/Player/MakingNoise.cs b/EXILED/Exiled.Events/Patches/Events/Player/MakingNoise.cs index eb64428da5..f3b4f42e4d 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/MakingNoise.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/MakingNoise.cs @@ -14,7 +14,9 @@ namespace Exiled.Events.Patches.Events.Player using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; + using HarmonyLib; + using PlayerRoles.FirstPersonControl.Thirdperson; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/MicroHIDOpeningDoor.cs b/EXILED/Exiled.Events/Patches/Events/Player/MicroHIDOpeningDoor.cs index a631bdd812..9587ff3040 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/MicroHIDOpeningDoor.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/MicroHIDOpeningDoor.cs @@ -11,10 +11,12 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using Attributes; + using Exiled.API.Features.Pools; using Exiled.Events.EventArgs.Player; using HarmonyLib; + using InventorySystem.Items.MicroHID.Modules; using static HarmonyLib.AccessTools; @@ -72,4 +74,4 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Player/PickingUp330.cs b/EXILED/Exiled.Events/Patches/Events/Player/PickingUp330.cs index b4ad99a32a..88cb84bec9 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/PickingUp330.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/PickingUp330.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; @@ -20,8 +20,6 @@ namespace Exiled.Events.Patches.Events.Player using static HarmonyLib.AccessTools; - using Player = API.Features.Player; - /// /// Patches the method to add the /// event. diff --git a/EXILED/Exiled.Events/Patches/Events/Player/PickingUpAmmo.cs b/EXILED/Exiled.Events/Patches/Events/Player/PickingUpAmmo.cs index 17c16af893..270cdb6da8 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/PickingUpAmmo.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/PickingUpAmmo.cs @@ -10,12 +10,12 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; using HarmonyLib; + using InventorySystem.Items.Pickups; using InventorySystem.Searching; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/PickingUpArmor.cs b/EXILED/Exiled.Events/Patches/Events/Player/PickingUpArmor.cs index b7d09303bd..3c895bd058 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/PickingUpArmor.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/PickingUpArmor.cs @@ -11,8 +11,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/PickingUpItem.cs b/EXILED/Exiled.Events/Patches/Events/Player/PickingUpItem.cs index 23ed931424..8c5305e3a9 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/PickingUpItem.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/PickingUpItem.cs @@ -11,8 +11,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/PickingUpScp244.cs b/EXILED/Exiled.Events/Patches/Events/Player/PickingUpScp244.cs index daeae1f672..5984ae2d43 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/PickingUpScp244.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/PickingUpScp244.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/PlayingAudioLog.cs b/EXILED/Exiled.Events/Patches/Events/Player/PlayingAudioLog.cs index 4e09d7d062..4212f57ba0 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/PlayingAudioLog.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/PlayingAudioLog.cs @@ -10,11 +10,13 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; + using Exiled.API.Features; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; + using HarmonyLib; + using MapGeneration.Spawnables; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/PreAuthenticating.cs b/EXILED/Exiled.Events/Patches/Events/Player/PreAuthenticating.cs index 10386c48d1..2660447758 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/PreAuthenticating.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/PreAuthenticating.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; @@ -28,7 +28,7 @@ namespace Exiled.Events.Patches.Events.Player [HarmonyPatch(typeof(CustomLiteNetLib4MirrorTransport), nameof(CustomLiteNetLib4MirrorTransport.ProcessConnectionRequest))] internal static class PreAuthenticating { - private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) + private static IEnumerable Transpiler(IEnumerable instructions) { List newInstructions = ListPool.Pool.Get(instructions); @@ -39,7 +39,7 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Player/ProcessDisarmMessage.cs b/EXILED/Exiled.Events/Patches/Events/Player/ProcessDisarmMessage.cs index 559af2a032..157e37b66a 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/ProcessDisarmMessage.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/ProcessDisarmMessage.cs @@ -7,13 +7,13 @@ namespace Exiled.Events.Patches.Events.Player { - #pragma warning disable SA1402 // File may only contain a single type +#pragma warning disable SA1402 // File may only contain a single type using System.Collections.Generic; using System.Reflection; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; + using Exiled.API.Features; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/ReceivingGunSound.cs b/EXILED/Exiled.Events/Patches/Events/Player/ReceivingGunSound.cs index 46881a8d6d..c93e75c798 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/ReceivingGunSound.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/ReceivingGunSound.cs @@ -183,4 +183,4 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Player/ReceivingStatusEffect.cs b/EXILED/Exiled.Events/Patches/Events/Player/ReceivingStatusEffect.cs index 707743a243..6ed6f26308 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/ReceivingStatusEffect.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/ReceivingStatusEffect.cs @@ -10,11 +10,10 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; - using CustomPlayerEffects; - using Exiled.Events.Attributes; + + using Exiled.API.Features; + using Exiled.API.Features.Pools; using Exiled.Events.EventArgs.Player; using HarmonyLib; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/ReceivingVoiceMessage.cs b/EXILED/Exiled.Events/Patches/Events/Player/ReceivingVoiceMessage.cs index fcefcbbd0d..9fae37e842 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/ReceivingVoiceMessage.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/ReceivingVoiceMessage.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/ReloadedAndUnloaded.cs b/EXILED/Exiled.Events/Patches/Events/Player/ReloadedAndUnloaded.cs index 96152eafbe..e325480829 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/ReloadedAndUnloaded.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/ReloadedAndUnloaded.cs @@ -11,23 +11,17 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; + using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; using HarmonyLib; - using InventorySystem.Items.Autosync; - using InventorySystem.Items.Firearms; + using InventorySystem.Items.Firearms.Modules; - using InventorySystem.Items.Firearms.Modules.Misc; - using InventorySystem.Searching; - using Mirror; - using UnityEngine; using static HarmonyLib.AccessTools; - using Player = API.Features.Player; - /// /// Patches to add missing event handler to the /// and . diff --git a/EXILED/Exiled.Events/Patches/Events/Player/ReservedSlotPatch.cs b/EXILED/Exiled.Events/Patches/Events/Player/ReservedSlotPatch.cs index 309164aabf..2bd832aeb5 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/ReservedSlotPatch.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/ReservedSlotPatch.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/RevokingMute.cs b/EXILED/Exiled.Events/Patches/Events/Player/RevokingMute.cs index 827960840f..0813987c6f 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/RevokingMute.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/RevokingMute.cs @@ -10,8 +10,8 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; + using Exiled.API.Features; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/RotatingRevolver.cs b/EXILED/Exiled.Events/Patches/Events/Player/RotatingRevolver.cs index 7dd1ea6065..4445af13fe 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/RotatingRevolver.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/RotatingRevolver.cs @@ -10,7 +10,6 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using Exiled.API.Extensions; using Exiled.API.Features.Pools; using Exiled.Events.Attributes; @@ -20,6 +19,7 @@ namespace Exiled.Events.Patches.Events.Player using Exiled.Events.Handlers; using HarmonyLib; + using InventorySystem.Items.Firearms.Modules; using static HarmonyLib.AccessTools; @@ -32,7 +32,7 @@ namespace Exiled.Events.Patches.Events.Player [HarmonyPatch(typeof(CylinderAmmoModule), nameof(CylinderAmmoModule.RotateCylinder))] internal class RotatingRevolver { - private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) + private static IEnumerable Transpiler(IEnumerable instructions) { List newInstructions = ListPool.Pool.Get(instructions); diff --git a/EXILED/Exiled.Events/Patches/Events/Player/SavingByAntiScp207.cs b/EXILED/Exiled.Events/Patches/Events/Player/SavingByAntiScp207.cs index daa9f0c6fb..138214adf2 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/SavingByAntiScp207.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/SavingByAntiScp207.cs @@ -11,6 +11,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using CustomPlayerEffects; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; @@ -92,4 +93,4 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Player/Scp1576TransmissionEnded.cs b/EXILED/Exiled.Events/Patches/Events/Player/Scp1576TransmissionEnded.cs index 2f81bec7c7..385abdfd68 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/Scp1576TransmissionEnded.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/Scp1576TransmissionEnded.cs @@ -1,4 +1,4 @@ -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- // // Copyright (c) ExMod Team. All rights reserved. // Licensed under the CC BY-SA 3.0 license. @@ -13,7 +13,9 @@ namespace Exiled.Events.Patches.Events.Player using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; + using HarmonyLib; + using InventorySystem.Items.Usables.Scp1576; using static HarmonyLib.AccessTools; @@ -22,38 +24,36 @@ namespace Exiled.Events.Patches.Events.Player /// Patches to add event. /// [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.Scp1576TransmissionEnded))] - [HarmonyPatch(typeof(InventorySystem.Items.Usables.Scp1576.Scp1576Item), nameof(Scp1576Item.ServerStopTransmitting))] + [HarmonyPatch(typeof(Scp1576Item), nameof(Scp1576Item.ServerStopTransmitting))] public class Scp1576TransmissionEnded { - private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) + private static IEnumerable Transpiler(IEnumerable instructions) { - List newInstructions = ListPool.Pool.Get(instructions); + List newInstructions = ListPool.Pool.Get(instructions); - int index = newInstructions.Count - 1; + int index = newInstructions.Count - 1; - newInstructions.InsertRange( - index, - new[] - { - // Player.Get(base.Owner) - new CodeInstruction(OpCodes.Ldarg_0), - new CodeInstruction(OpCodes.Callvirt, PropertyGetter(typeof(Scp1576Item), nameof(Scp1576Item.Owner))), - new CodeInstruction(OpCodes.Call, Method(typeof(API.Features.Player), nameof(API.Features.Player.Get), new[] { typeof(ReferenceHub) })), + newInstructions.InsertRange(index, new[] + { + // Player.Get(base.Owner) + new CodeInstruction(OpCodes.Ldarg_0), + new CodeInstruction(OpCodes.Callvirt, PropertyGetter(typeof(Scp1576Item), nameof(Scp1576Item.Owner))), + new CodeInstruction(OpCodes.Call, Method(typeof(API.Features.Player), nameof(API.Features.Player.Get), new[] { typeof(ReferenceHub) })), - // this - new CodeInstruction(OpCodes.Ldarg_0), + // this + new CodeInstruction(OpCodes.Ldarg_0), - // Scp1576TransmissionEndedEventArgs ev = new(Player, this) - new CodeInstruction(OpCodes.Newobj, GetDeclaredConstructors(typeof(Scp1576TransmissionEndedEventArgs))[0]), + // Scp1576TransmissionEndedEventArgs ev = new(Player, this) + new CodeInstruction(OpCodes.Newobj, GetDeclaredConstructors(typeof(Scp1576TransmissionEndedEventArgs))[0]), - // OnScp1576TransmissionEnded(ev) - new CodeInstruction(OpCodes.Call, Method(typeof(Handlers.Player), nameof(Handlers.Player.OnScp1576TransmissionEnded))), - }); + // OnScp1576TransmissionEnded(ev) + new CodeInstruction(OpCodes.Call, Method(typeof(Handlers.Player), nameof(Handlers.Player.OnScp1576TransmissionEnded))), + }); - for (int i = 0; i < newInstructions.Count; i++) - yield return newInstructions[i]; + for (int i = 0; i < newInstructions.Count; i++) + yield return newInstructions[i]; - ListPool.Pool.Return(newInstructions); + ListPool.Pool.Return(newInstructions); } } } \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Player/SearchingPickupEvent.cs b/EXILED/Exiled.Events/Patches/Events/Player/SearchingPickupEvent.cs index c05e73f0c7..a872bbb5c5 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/SearchingPickupEvent.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/SearchingPickupEvent.cs @@ -10,8 +10,8 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; + using Exiled.API.Features; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; @@ -146,4 +146,4 @@ private static float SafeGetTime(SearchingPickupEventArgs ev, SearchCoordinator return coordinator.SessionPipe.Request.Target.SearchTimeForPlayer(coordinator.Hub); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Player/SendingAdminChatMessage.cs b/EXILED/Exiled.Events/Patches/Events/Player/SendingAdminChatMessage.cs index cf74131a00..6adbfea602 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/SendingAdminChatMessage.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/SendingAdminChatMessage.cs @@ -10,15 +10,14 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; + using Exiled.API.Features; + using Exiled.API.Features.Pools; + using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; using HarmonyLib; - using InventorySystem.Items.Pickups; - using InventorySystem.Searching; using RemoteAdmin; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/SendingGunSound.cs b/EXILED/Exiled.Events/Patches/Events/Player/SendingGunSound.cs index 203a31dc51..fc0d604781 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/SendingGunSound.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/SendingGunSound.cs @@ -138,4 +138,4 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Player/SendingValidGameConsoleCommand.cs b/EXILED/Exiled.Events/Patches/Events/Player/SendingValidGameConsoleCommand.cs index e1ff66c95a..6fc0be997a 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/SendingValidGameConsoleCommand.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/SendingValidGameConsoleCommand.cs @@ -7,18 +7,20 @@ namespace Exiled.Events.Patches.Events.Player { - using System; using System.Collections.Generic; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; using CommandSystem; + + using Exiled.API.Features; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; using HarmonyLib; + using LabApi.Features.Enums; + using RemoteAdmin; using static HarmonyLib.AccessTools; @@ -167,4 +169,4 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Player/SendingValidRACommand.cs b/EXILED/Exiled.Events/Patches/Events/Player/SendingValidRACommand.cs index a9a0f9d9fb..0934d04b05 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/SendingValidRACommand.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/SendingValidRACommand.cs @@ -11,14 +11,17 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; using CommandSystem; + + using Exiled.API.Features; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; using HarmonyLib; + using LabApi.Features.Enums; + using RemoteAdmin; using static HarmonyLib.AccessTools; @@ -167,4 +170,4 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Player/Shooting.cs b/EXILED/Exiled.Events/Patches/Events/Player/Shooting.cs index ac526807b8..e50f6b7a28 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/Shooting.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/Shooting.cs @@ -7,16 +7,17 @@ namespace Exiled.Events.Patches.Events.Player { - using System; using System.Collections.Generic; using System.Reflection; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; + using Exiled.API.Features; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; + using HarmonyLib; + using InventorySystem.Items.Firearms.Modules.Misc; using static HarmonyLib.AccessTools; @@ -100,9 +101,9 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Player/Spawning.cs b/EXILED/Exiled.Events/Patches/Events/Player/Spawning.cs index af8b3a6c20..8b59b44be0 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/Spawning.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/Spawning.cs @@ -8,16 +8,20 @@ namespace Exiled.Events.Patches.Events.Player { using System.Collections.Generic; - using System.Reflection; using System.Reflection.Emit; using Exiled.API.Features; using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; + using HarmonyLib; + using MEC; + + using PlayerRoles.FirstPersonControl; using PlayerRoles.FirstPersonControl.Spawnpoints; + using UnityEngine; using static HarmonyLib.AccessTools; @@ -35,50 +39,43 @@ private static IEnumerable Transpiler(IEnumerable newInstructions = ListPool.Pool.Get(instructions); - int offset = -1; + LocalBuilder ev = generator.DeclareLocal(typeof(SpawningEventArgs)); - // Locate the call to `Transform.position` setter to determine where to insert new instructions. + int offset = -1; int index = newInstructions.FindIndex(instr => instr.Calls(PropertySetter(typeof(Transform), nameof(Transform.position)))) + offset; - // Declare the `SpawningEventArgs` local variable. - LocalBuilder ev = generator.DeclareLocal(typeof(SpawningEventArgs)); - - newInstructions.InsertRange( - index, - new[] + newInstructions.InsertRange(index, new CodeInstruction[] { - // Load `ReferenceHub` (argument 0) and get `Player`. - new CodeInstruction(OpCodes.Ldarg_0), // Load `hub` (first argument passed to the method). - new CodeInstruction(OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new[] { typeof(ReferenceHub) })), // Call Player.Get(hub) to get the Player instance. - - // Load `position` (local variable 2). - new CodeInstruction(OpCodes.Ldloc_2), + // Player.Get(hub); + new(OpCodes.Ldarg_0), + new(OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new[] { typeof(ReferenceHub) })), - // Load `rotation` (local variable 3). - new CodeInstruction(OpCodes.Ldloc_3), + // spawnLocation + new(OpCodes.Ldloc_2), - // Load `newRole` (argument 1). - new CodeInstruction(OpCodes.Ldarg_1), // Load `newRole` from argument 1. + // horizontalRotation + new(OpCodes.Ldloc_3), - // Create a new instance of `SpawningEventArgs`. - new CodeInstruction(OpCodes.Newobj, GetDeclaredConstructors(typeof(SpawningEventArgs))[0]), + // newRole + new(OpCodes.Ldarg_1), - // Duplicate the object to store it and pass it around. - new CodeInstruction(OpCodes.Dup), // Duplicate the `SpawningEventArgs` object. - new CodeInstruction(OpCodes.Stloc, ev.LocalIndex), // Store the duplicated object in a local variable. + // SpawningEventArg ev = new SpawningEventArgs(player, spawnLocation, horizontalRotation, newRole); + new(OpCodes.Newobj, GetDeclaredConstructors(typeof(SpawningEventArgs))[0]), + new(OpCodes.Dup), + new(OpCodes.Stloc, ev.LocalIndex), - // Call `Handlers.Player.OnSpawning`. - new CodeInstruction(OpCodes.Call, Method(typeof(Handlers.Player), nameof(Handlers.Player.OnSpawning))), + // Handlers.Player.OnSpawning(ev); + new(OpCodes.Call, Method(typeof(Handlers.Player), nameof(Handlers.Player.OnSpawning))), - // Modify `position` from `ev.Position`. - new CodeInstruction(OpCodes.Ldloc, ev.LocalIndex), // Load the `SpawningEventArgs` object stored in the local variable. - new CodeInstruction(OpCodes.Call, PropertyGetter(typeof(SpawningEventArgs), nameof(SpawningEventArgs.Position))), // Get the `Position` property from `SpawningEventArgs`. - new CodeInstruction(OpCodes.Stloc_2), // Store the position value back in the local variable 2 (`position`). + // spawnLocation = ev.Position; + new(OpCodes.Ldloc, ev.LocalIndex), + new(OpCodes.Call, PropertyGetter(typeof(SpawningEventArgs), nameof(SpawningEventArgs.Position))), + new(OpCodes.Stloc_2), - // Modify `rotation` from `ev.HorizontalRotation`. - new CodeInstruction(OpCodes.Ldloc, ev.LocalIndex), // Load the `SpawningEventArgs` object again. - new CodeInstruction(OpCodes.Call, PropertyGetter(typeof(SpawningEventArgs), nameof(SpawningEventArgs.HorizontalRotation))), // Get the `HorizontalRotation` property from `SpawningEventArgs`. - new CodeInstruction(OpCodes.Stloc_3), // Store the rotation value back in the local variable 3 (`rotation`). + // ApplyRotation(fpcRole, ev) + new(OpCodes.Ldloc_0), + new(OpCodes.Ldloc, ev.LocalIndex), + new(OpCodes.Call, Method(typeof(Spawning), nameof(ApplyRotation))), }); for (int z = 0; z < newInstructions.Count; z++) @@ -86,5 +83,24 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } + + private static void ApplyRotation(IFpcRole fpcRole, SpawningEventArgs ev) + { + if (!ev.IsRotationModified || fpcRole == null || fpcRole.FpcModule == null) + return; + + Timing.RunCoroutine(WaitForMouseLookAndApply(fpcRole.FpcModule, ev.SpawningRotation), ev.Player.GameObject); + } + + private static IEnumerator WaitForMouseLookAndApply(FirstPersonMovementModule fpcModule, Vector2 rotation) + { + yield return Timing.WaitUntilFalse(() => fpcModule != null && fpcModule.MouseLook == null); + + if (fpcModule == null) + yield break; + + yield return Timing.WaitForOneFrame; + fpcModule.ServerOverrideRotation(rotation); + } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Player/SpawningRagdoll.cs b/EXILED/Exiled.Events/Patches/Events/Player/SpawningRagdoll.cs index 413e29bc51..2a2a98760b 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/SpawningRagdoll.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/SpawningRagdoll.cs @@ -10,9 +10,8 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; - using Exiled.API.Features; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; @@ -136,4 +135,4 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Player/StayingOnEnvironmentalHazard.cs b/EXILED/Exiled.Events/Patches/Events/Player/StayingOnEnvironmentalHazard.cs index b89eac29eb..5f6ac2536a 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/StayingOnEnvironmentalHazard.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/StayingOnEnvironmentalHazard.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; @@ -30,7 +30,7 @@ namespace Exiled.Events.Patches.Events.Player [HarmonyPatch(typeof(EnvironmentalHazard), nameof(EnvironmentalHazard.OnStay))] internal static class StayingOnEnvironmentalHazard { - internal static CodeInstruction[] GetInstructions(Label ret) => new CodeInstruction[] + internal static CodeInstruction[] GetInstructions() => new CodeInstruction[] { // Player.Get(player) new(OpCodes.Ldarg_1), @@ -46,15 +46,11 @@ internal static class StayingOnEnvironmentalHazard new(OpCodes.Call, Method(typeof(Handlers.Player), nameof(Handlers.Player.OnStayingOnEnvironmentalHazard))), }; - private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) + private static IEnumerable Transpiler(IEnumerable instructions) { List newInstructions = ListPool.Pool.Get(instructions); - Label ret = generator.DefineLabel(); - - newInstructions.InsertRange(0, GetInstructions(ret)); - - newInstructions[newInstructions.Count - 1].WithLabels(ret); + newInstructions.InsertRange(0, GetInstructions()); for (int z = 0; z < newInstructions.Count; z++) yield return newInstructions[z]; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/StayingOnSinkholeEnvironmentalHazard.cs b/EXILED/Exiled.Events/Patches/Events/Player/StayingOnSinkholeEnvironmentalHazard.cs index 19e6863645..56b4919d41 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/StayingOnSinkholeEnvironmentalHazard.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/StayingOnSinkholeEnvironmentalHazard.cs @@ -8,10 +8,10 @@ namespace Exiled.Events.Patches.Events.Player { using System.Collections.Generic; - using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; + using HarmonyLib; using Hazards; @@ -24,15 +24,11 @@ namespace Exiled.Events.Patches.Events.Player [HarmonyPatch(typeof(SinkholeEnvironmentalHazard), nameof(SinkholeEnvironmentalHazard.OnStay))] internal static class StayingOnSinkholeEnvironmentalHazard { - private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) + private static IEnumerable Transpiler(IEnumerable instructions) { List newInstructions = ListPool.Pool.Get(instructions); - Label ret = generator.DefineLabel(); - - newInstructions.InsertRange(0, StayingOnEnvironmentalHazard.GetInstructions(ret)); - - newInstructions[newInstructions.Count - 1].WithLabels(ret); + newInstructions.InsertRange(0, StayingOnEnvironmentalHazard.GetInstructions()); for (int z = 0; z < newInstructions.Count; z++) yield return newInstructions[z]; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/StayingOnTantrumEnvironmentalHazard.cs b/EXILED/Exiled.Events/Patches/Events/Player/StayingOnTantrumEnvironmentalHazard.cs index de0f5b7ca9..b9d2fcc9ff 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/StayingOnTantrumEnvironmentalHazard.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/StayingOnTantrumEnvironmentalHazard.cs @@ -8,10 +8,11 @@ namespace Exiled.Events.Patches.Events.Player { using System.Collections.Generic; - using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; + using Exiled.Events.Attributes; + using HarmonyLib; using Hazards; @@ -24,15 +25,11 @@ namespace Exiled.Events.Patches.Events.Player [HarmonyPatch(typeof(TantrumEnvironmentalHazard), nameof(TantrumEnvironmentalHazard.OnStay))] internal static class StayingOnTantrumEnvironmentalHazard { - private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) + private static IEnumerable Transpiler(IEnumerable instructions) { List newInstructions = ListPool.Pool.Get(instructions); - Label ret = generator.DefineLabel(); - - newInstructions.InsertRange(0, StayingOnEnvironmentalHazard.GetInstructions(ret)); - - newInstructions[newInstructions.Count - 1].WithLabels(ret); + newInstructions.InsertRange(0, StayingOnEnvironmentalHazard.GetInstructions()); for (int z = 0; z < newInstructions.Count; z++) yield return newInstructions[z]; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/ThrowingRequest.cs b/EXILED/Exiled.Events/Patches/Events/Player/ThrowingRequest.cs index 0b2a10d46d..474859a8e4 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/ThrowingRequest.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/ThrowingRequest.cs @@ -10,8 +10,9 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; + using Exiled.API.Features; + using Exiled.API.Features.Pools; + using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/ThrownProjectile.cs b/EXILED/Exiled.Events/Patches/Events/Player/ThrownProjectile.cs index d4ecc59a65..0078a8db87 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/ThrownProjectile.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/ThrownProjectile.cs @@ -10,7 +10,8 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; + using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; @@ -69,4 +70,4 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Player/TogglingFlashlight.cs b/EXILED/Exiled.Events/Patches/Events/Player/TogglingFlashlight.cs index 91f8aa87ad..01f77f1c20 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/TogglingFlashlight.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/TogglingFlashlight.cs @@ -10,7 +10,8 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; + using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; @@ -68,4 +69,4 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Player/TogglingNoClip.cs b/EXILED/Exiled.Events/Patches/Events/Player/TogglingNoClip.cs index 9b6ebab9ce..fb2602f419 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/TogglingNoClip.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/TogglingNoClip.cs @@ -10,10 +10,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; - - using Exiled.API.Features.Roles; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/TogglingOverwatch.cs b/EXILED/Exiled.Events/Patches/Events/Player/TogglingOverwatch.cs index 70a04812e2..46eb04a6a4 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/TogglingOverwatch.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/TogglingOverwatch.cs @@ -10,8 +10,9 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; using CommandSystem.Commands.RemoteAdmin; + + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/TogglingRadio.cs b/EXILED/Exiled.Events/Patches/Events/Player/TogglingRadio.cs index 3b8b66ed5d..54fd3e6e66 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/TogglingRadio.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/TogglingRadio.cs @@ -108,4 +108,4 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Player/TogglingWeaponFlashlight.cs b/EXILED/Exiled.Events/Patches/Events/Player/TogglingWeaponFlashlight.cs index 88fd7d7cd7..09aa48a3be 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/TogglingWeaponFlashlight.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/TogglingWeaponFlashlight.cs @@ -10,7 +10,6 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using Exiled.API.Extensions; using Exiled.API.Features.Pools; using Exiled.Events.Attributes; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/TriggeringTesla.cs b/EXILED/Exiled.Events/Patches/Events/Player/TriggeringTesla.cs index ccf67613bc..734ce34ad0 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/TriggeringTesla.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/TriggeringTesla.cs @@ -8,14 +8,14 @@ namespace Exiled.Events.Patches.Events.Player { using System.Collections.Generic; - using System.Linq; using System.Reflection.Emit; - using API.Features; + using Exiled.API.Features; using Exiled.API.Features.Pools; - using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; + using HarmonyLib; + using LabApi.Events.Arguments.PlayerEvents; using LabApi.Events.Handlers; @@ -127,4 +127,4 @@ private static void TriggeringTeslaEvent(BaseTeslaGate baseTeslaGate, ref bool i } } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Player/UsedItemByHolstering.cs b/EXILED/Exiled.Events/Patches/Events/Player/UsedItemByHolstering.cs index 4aab1c1327..208a9b9ee4 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/UsedItemByHolstering.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/UsedItemByHolstering.cs @@ -1,4 +1,4 @@ -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- // // Copyright (c) ExMod Team. All rights reserved. // Licensed under the CC BY-SA 3.0 license. @@ -11,12 +11,15 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using CustomPlayerEffects; - using Exiled.API.Features; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; + using HarmonyLib; + using InventorySystem.Items.Usables; + using UnityEngine; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/UsingAndCancellingItemUse.cs b/EXILED/Exiled.Events/Patches/Events/Player/UsingAndCancellingItemUse.cs index ec10d374a6..fe4a09b96d 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/UsingAndCancellingItemUse.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/UsingAndCancellingItemUse.cs @@ -11,17 +11,15 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; using CustomPlayerEffects; + + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; using HarmonyLib; using InventorySystem.Items.Usables; - using LabApi.Events.Arguments.PlayerEvents; - using Utils.Networking; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/UsingItemCompleted.cs b/EXILED/Exiled.Events/Patches/Events/Player/UsingItemCompleted.cs index 5a89cf2ba6..30ecb92fea 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/UsingItemCompleted.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/UsingItemCompleted.cs @@ -10,14 +10,14 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; - + using Exiled.API.Features; + using Exiled.API.Features.Pools; using Exiled.Events.EventArgs.Player; using HarmonyLib; using InventorySystem.Items.Usables; + using Mirror; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/UsingMicroHIDEnergy.cs b/EXILED/Exiled.Events/Patches/Events/Player/UsingMicroHIDEnergy.cs index 115ffc8391..30817d44c5 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/UsingMicroHIDEnergy.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/UsingMicroHIDEnergy.cs @@ -10,10 +10,12 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; + using HarmonyLib; + using InventorySystem.Items.MicroHID.Modules; using static HarmonyLib.AccessTools; @@ -81,4 +83,4 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Player/UsingRadioBattery.cs b/EXILED/Exiled.Events/Patches/Events/Player/UsingRadioBattery.cs index 1baf62c851..bca01e1ddb 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/UsingRadioBattery.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/UsingRadioBattery.cs @@ -10,8 +10,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/Verified.cs b/EXILED/Exiled.Events/Patches/Events/Player/Verified.cs index 7b274bc7c1..b029e90350 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/Verified.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/Verified.cs @@ -13,11 +13,13 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; using CentralAuth; + using Exiled.API.Extensions; + using Exiled.API.Features; + using Exiled.API.Features.Pools; using Exiled.Events.EventArgs.Player; + using HarmonyLib; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Player/VoiceChatting.cs b/EXILED/Exiled.Events/Patches/Events/Player/VoiceChatting.cs index 17ba25773c..97da7328b4 100644 --- a/EXILED/Exiled.Events/Patches/Events/Player/VoiceChatting.cs +++ b/EXILED/Exiled.Events/Patches/Events/Player/VoiceChatting.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/EXILED/Exiled.Events/Patches/Events/Scp049/ActivatingSense.cs b/EXILED/Exiled.Events/Patches/Events/Scp049/ActivatingSense.cs index 849ba4ae93..48f4dab1af 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp049/ActivatingSense.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp049/ActivatingSense.cs @@ -12,16 +12,12 @@ namespace Exiled.Events.Patches.Events.Scp049 using Exiled.API.Features; using Exiled.API.Features.Pools; - using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp049; + using HarmonyLib; - using Mirror; - using PlayerRoles; - using PlayerRoles.PlayableScps; using PlayerRoles.PlayableScps.Scp049; using PlayerRoles.Subroutines; - using Utils.Networking; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Scp049/Attacking.cs b/EXILED/Exiled.Events/Patches/Events/Scp049/Attacking.cs index 0786079299..34fe444301 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp049/Attacking.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp049/Attacking.cs @@ -14,9 +14,10 @@ namespace Exiled.Events.Patches.Events.Scp049 using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp049; + using HarmonyLib; + using PlayerRoles.PlayableScps.Scp049; - using PlayerRoles.Subroutines; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Scp049/FinishingRecall.cs b/EXILED/Exiled.Events/Patches/Events/Scp049/FinishingRecall.cs index 6ea1385c8c..0d69554754 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp049/FinishingRecall.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp049/FinishingRecall.cs @@ -10,8 +10,8 @@ namespace Exiled.Events.Patches.Events.Scp049 using System.Collections.Generic; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; + using Exiled.API.Features; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp049; diff --git a/EXILED/Exiled.Events/Patches/Events/Scp049/FinishingSense.cs b/EXILED/Exiled.Events/Patches/Events/Scp049/FinishingSense.cs index 9a63f16e7e..22e9ea8a40 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp049/FinishingSense.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp049/FinishingSense.cs @@ -11,9 +11,10 @@ namespace Exiled.Events.Patches.Events.Scp049 using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp049; + using HarmonyLib; using PlayerRoles.PlayableScps.Scp049; @@ -255,4 +256,4 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Scp049/SendingCall.cs b/EXILED/Exiled.Events/Patches/Events/Scp049/SendingCall.cs index 275313384b..baeb1eef2e 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp049/SendingCall.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp049/SendingCall.cs @@ -12,7 +12,6 @@ namespace Exiled.Events.Patches.Events.Scp049 using Exiled.API.Features; using Exiled.API.Features.Pools; - using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp049; using HarmonyLib; diff --git a/EXILED/Exiled.Events/Patches/Events/Scp049/StartingRecall.cs b/EXILED/Exiled.Events/Patches/Events/Scp049/StartingRecall.cs index 044e074872..57e094ea7d 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp049/StartingRecall.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp049/StartingRecall.cs @@ -9,11 +9,13 @@ namespace Exiled.Events.Patches.Events.Scp049 using System.Collections.Generic; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; + using Exiled.API.Features; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp049; + using HarmonyLib; + using PlayerRoles.PlayableScps.Scp049; using PlayerRoles.Ragdolls; @@ -71,4 +73,4 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Scp0492/Consumed.cs b/EXILED/Exiled.Events/Patches/Events/Scp0492/Consumed.cs index 592dd3a7b1..7c7e8e8836 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp0492/Consumed.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp0492/Consumed.cs @@ -10,17 +10,15 @@ namespace Exiled.Events.Patches.Events.Scp0492 using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; - - using Exiled.API.Extensions; - using Exiled.API.Features; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp0492; + using HarmonyLib; + using PlayerRoles.PlayableScps.Scp049; using PlayerRoles.PlayableScps.Scp049.Zombies; using PlayerRoles.Subroutines; - using PlayerStatsSystem; using static HarmonyLib.AccessTools; @@ -83,4 +81,4 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Scp0492/Consuming.cs b/EXILED/Exiled.Events/Patches/Events/Scp0492/Consuming.cs index 5422d0b2e2..2c326f207a 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp0492/Consuming.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp0492/Consuming.cs @@ -10,13 +10,12 @@ namespace Exiled.Events.Patches.Events.Scp0492 using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; - - using Exiled.API.Extensions; - using Exiled.API.Features; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp0492; + using HarmonyLib; + using PlayerRoles.PlayableScps.Scp049; using PlayerRoles.PlayableScps.Scp049.Zombies; using PlayerRoles.Subroutines; @@ -31,7 +30,7 @@ namespace Exiled.Events.Patches.Events.Scp0492 [HarmonyPatch(typeof(ZombieConsumeAbility), nameof(ZombieConsumeAbility.ServerValidateBegin))] public class Consuming { - private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) + private static IEnumerable Transpiler(IEnumerable instructions) { List newInstructions = ListPool.Pool.Get(instructions); diff --git a/EXILED/Exiled.Events/Patches/Events/Scp0492/TriggeringBloodlustEvent.cs b/EXILED/Exiled.Events/Patches/Events/Scp0492/TriggeringBloodlustEvent.cs index 32cd7264d0..09a4844d33 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp0492/TriggeringBloodlustEvent.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp0492/TriggeringBloodlustEvent.cs @@ -28,7 +28,7 @@ namespace Exiled.Events.Patches.Events.Scp0492 [HarmonyPatch(typeof(ZombieBloodlustAbility), nameof(ZombieBloodlustAbility.AnyTargets))] internal static class TriggeringBloodlustEvent { - private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) + private static IEnumerable Transpiler(IEnumerable instructions) { List newInstructions = ListPool.Pool.Get(instructions); Label continueLabel = newInstructions[newInstructions.FindIndex(i => i.opcode == OpCodes.Leave_S) + 1].labels[0]; diff --git a/EXILED/Exiled.Events/Patches/Events/Scp079/ChangingCamera.cs b/EXILED/Exiled.Events/Patches/Events/Scp079/ChangingCamera.cs index 3afb14f354..4f251f68ef 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp079/ChangingCamera.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp079/ChangingCamera.cs @@ -11,14 +11,17 @@ namespace Exiled.Events.Patches.Events.Scp079 using System.Reflection; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp079; using Exiled.Events.Handlers; using HarmonyLib; + using LabApi.Events.Arguments.Scp079Events; + using Mirror; + using PlayerRoles.PlayableScps.Scp079; using PlayerRoles.PlayableScps.Scp079.Cameras; using PlayerRoles.Subroutines; diff --git a/EXILED/Exiled.Events/Patches/Events/Scp079/ChangingSpeakerStatus.cs b/EXILED/Exiled.Events/Patches/Events/Scp079/ChangingSpeakerStatus.cs index 2cd42b575f..8be79fbfb3 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp079/ChangingSpeakerStatus.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp079/ChangingSpeakerStatus.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Scp079 using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp079; using Exiled.Events.Handlers; @@ -100,4 +100,4 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Scp079/ElevatorTeleporting.cs b/EXILED/Exiled.Events/Patches/Events/Scp079/ElevatorTeleporting.cs index 2173ed5f07..b161d569b2 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp079/ElevatorTeleporting.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp079/ElevatorTeleporting.cs @@ -10,12 +10,15 @@ namespace Exiled.Events.Patches.Events.Scp079 using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp079; using Exiled.Events.Handlers; + using HarmonyLib; + using Mirror; + using PlayerRoles.PlayableScps.Scp079; using PlayerRoles.PlayableScps.Scp079.Cameras; using PlayerRoles.Subroutines; diff --git a/EXILED/Exiled.Events/Patches/Events/Scp079/GainingExperience.cs b/EXILED/Exiled.Events/Patches/Events/Scp079/GainingExperience.cs index 057c8ee31e..b1d9888006 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp079/GainingExperience.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp079/GainingExperience.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Scp079 using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp079; using Exiled.Events.Handlers; diff --git a/EXILED/Exiled.Events/Patches/Events/Scp079/GainingLevel.cs b/EXILED/Exiled.Events/Patches/Events/Scp079/GainingLevel.cs index d82b1d0ff6..30c0c5b58c 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp079/GainingLevel.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp079/GainingLevel.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Scp079 using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp079; using Exiled.Events.Handlers; diff --git a/EXILED/Exiled.Events/Patches/Events/Scp079/InteractingTesla.cs b/EXILED/Exiled.Events/Patches/Events/Scp079/InteractingTesla.cs index bde75b05d9..97a7e4e3c4 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp079/InteractingTesla.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp079/InteractingTesla.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Scp079 using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp079; using Exiled.Events.Handlers; diff --git a/EXILED/Exiled.Events/Patches/Events/Scp079/LockingDown.cs b/EXILED/Exiled.Events/Patches/Events/Scp079/LockingDown.cs index 1688c3d9bf..fa4c2930c0 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp079/LockingDown.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp079/LockingDown.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Scp079 using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp079; using Exiled.Events.Handlers; @@ -57,7 +57,7 @@ private static IEnumerable Transpiler(IEnumerable), nameof(StandardSubroutine.Owner))), new(OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new[] { typeof(ReferenceHub) })), diff --git a/EXILED/Exiled.Events/Patches/Events/Scp079/Lost.cs b/EXILED/Exiled.Events/Patches/Events/Scp079/Lost.cs index 4583f447f2..d5de957dc5 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp079/Lost.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp079/Lost.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Scp079 using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp079; using Exiled.Events.Handlers; diff --git a/EXILED/Exiled.Events/Patches/Events/Scp079/Pinging.cs b/EXILED/Exiled.Events/Patches/Events/Scp079/Pinging.cs index d2677745de..37c9e52b1f 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp079/Pinging.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp079/Pinging.cs @@ -8,18 +8,20 @@ namespace Exiled.Events.Patches.Events.Scp079 { using System.Collections.Generic; - using System.Reflection; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp079; + using HarmonyLib; - using Mirror; + using PlayerRoles.PlayableScps.Scp079; using PlayerRoles.PlayableScps.Scp079.Pinging; using PlayerRoles.Subroutines; + using RelativePositioning; + using UnityEngine; using static HarmonyLib.AccessTools; @@ -71,7 +73,7 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) + private static IEnumerable Transpiler(IEnumerable instructions) { List newInstructions = ListPool.Pool.Get(instructions); diff --git a/EXILED/Exiled.Events/Patches/Events/Scp079/Recontaining.cs b/EXILED/Exiled.Events/Patches/Events/Scp079/Recontaining.cs index 680bbbf0dd..c6dd1b844d 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp079/Recontaining.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp079/Recontaining.cs @@ -65,4 +65,4 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Scp079/RoomBlackout.cs b/EXILED/Exiled.Events/Patches/Events/Scp079/RoomBlackout.cs index 0ede86b0d9..3490cbf591 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp079/RoomBlackout.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp079/RoomBlackout.cs @@ -10,10 +10,12 @@ namespace Exiled.Events.Patches.Events.Scp079 using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp079; + using HarmonyLib; + using PlayerRoles.PlayableScps.Scp079; using PlayerRoles.Subroutines; @@ -161,4 +163,4 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Scp079/TriggeringDoor.cs b/EXILED/Exiled.Events/Patches/Events/Scp079/TriggeringDoor.cs index fa6ecb2bc2..a0aa8b4f99 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp079/TriggeringDoor.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp079/TriggeringDoor.cs @@ -10,14 +10,16 @@ namespace Exiled.Events.Patches.Events.Scp079 using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; using Exiled.API.Features.Doors; - + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp079; using Exiled.Events.Handlers; + using HarmonyLib; + using Interactables.Interobjects.DoorUtils; + using PlayerRoles.PlayableScps.Scp079; using PlayerRoles.Subroutines; diff --git a/EXILED/Exiled.Events/Patches/Events/Scp079/ZoneBlackout.cs b/EXILED/Exiled.Events/Patches/Events/Scp079/ZoneBlackout.cs index 12e0dc375f..dde75796bf 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp079/ZoneBlackout.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp079/ZoneBlackout.cs @@ -10,9 +10,8 @@ namespace Exiled.Events.Patches.Events.Scp079 using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; using Exiled.API.Extensions; - using Exiled.API.Features; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp079; diff --git a/EXILED/Exiled.Events/Patches/Events/Scp096/AddingTarget.cs b/EXILED/Exiled.Events/Patches/Events/Scp096/AddingTarget.cs index 3a17a255e4..9d44ac1a21 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp096/AddingTarget.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp096/AddingTarget.cs @@ -10,8 +10,8 @@ namespace Exiled.Events.Patches.Events.Scp096 using System.Collections.Generic; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; + using Exiled.API.Features; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp096; diff --git a/EXILED/Exiled.Events/Patches/Events/Scp096/CalmingDown.cs b/EXILED/Exiled.Events/Patches/Events/Scp096/CalmingDown.cs index cb6cf1fa7e..9c742f56f7 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp096/CalmingDown.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp096/CalmingDown.cs @@ -10,8 +10,8 @@ namespace Exiled.Events.Patches.Events.Scp096 using System.Collections.Generic; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; + using Exiled.API.Features; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp096; diff --git a/EXILED/Exiled.Events/Patches/Events/Scp096/Charging.cs b/EXILED/Exiled.Events/Patches/Events/Scp096/Charging.cs index a4763fed00..26ab618bed 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp096/Charging.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp096/Charging.cs @@ -10,8 +10,8 @@ namespace Exiled.Events.Patches.Events.Scp096 using System.Collections.Generic; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; + using Exiled.API.Features; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp096; diff --git a/EXILED/Exiled.Events/Patches/Events/Scp096/Enraging.cs b/EXILED/Exiled.Events/Patches/Events/Scp096/Enraging.cs index 85c02bab9c..5fba31a01f 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp096/Enraging.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp096/Enraging.cs @@ -10,8 +10,8 @@ namespace Exiled.Events.Patches.Events.Scp096 using System.Collections.Generic; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; + using Exiled.API.Features; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp096; diff --git a/EXILED/Exiled.Events/Patches/Events/Scp096/RemovingTarget.cs b/EXILED/Exiled.Events/Patches/Events/Scp096/RemovingTarget.cs index 869988bda6..47ed33bac0 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp096/RemovingTarget.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp096/RemovingTarget.cs @@ -1,4 +1,4 @@ -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- // // Copyright (c) ExMod Team. All rights reserved. // Licensed under the CC BY-SA 3.0 license. @@ -7,16 +7,16 @@ namespace Exiled.Events.Patches.Events.Scp096 { - using System; using System.Collections.Generic; - using System.Diagnostics; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; + using Exiled.API.Features; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp096; + using HarmonyLib; + using PlayerRoles.PlayableScps.Scp096; using PlayerRoles.Subroutines; diff --git a/EXILED/Exiled.Events/Patches/Events/Scp096/StartPryingGate.cs b/EXILED/Exiled.Events/Patches/Events/Scp096/StartPryingGate.cs index e1d8b5b690..e39c1ca18a 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp096/StartPryingGate.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp096/StartPryingGate.cs @@ -10,8 +10,8 @@ namespace Exiled.Events.Patches.Events.Scp096 using System.Collections.Generic; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; + using Exiled.API.Features; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp096; diff --git a/EXILED/Exiled.Events/Patches/Events/Scp096/TryingNotToCry.cs b/EXILED/Exiled.Events/Patches/Events/Scp096/TryingNotToCry.cs index 247934beb7..22822c1226 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp096/TryingNotToCry.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp096/TryingNotToCry.cs @@ -10,8 +10,8 @@ namespace Exiled.Events.Patches.Events.Scp096 using System.Collections.Generic; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; + using Exiled.API.Features; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp096; diff --git a/EXILED/Exiled.Events/Patches/Events/Scp106/Attacking.cs b/EXILED/Exiled.Events/Patches/Events/Scp106/Attacking.cs index 92c28c0548..901c5a0a2b 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp106/Attacking.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp106/Attacking.cs @@ -8,14 +8,15 @@ namespace Exiled.Events.Patches.Events.Scp106 { using System.Collections.Generic; - using System.Linq; using System.Reflection.Emit; using Exiled.API.Features; using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp106; + using HarmonyLib; + using PlayerRoles.PlayableScps.Scp106; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Scp106/ExitStalking.cs b/EXILED/Exiled.Events/Patches/Events/Scp106/ExitStalking.cs index 4265abef8b..1580c1b345 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp106/ExitStalking.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp106/ExitStalking.cs @@ -10,10 +10,11 @@ namespace Exiled.Events.Patches.Events.Scp106 using System.Collections.Generic; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; + using Exiled.API.Features; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp106; + using HarmonyLib; using PlayerRoles.PlayableScps.Scp106; diff --git a/EXILED/Exiled.Events/Patches/Events/Scp106/Stalking.cs b/EXILED/Exiled.Events/Patches/Events/Scp106/Stalking.cs index 2ffad3da94..ab823ced8e 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp106/Stalking.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp106/Stalking.cs @@ -8,13 +8,13 @@ namespace Exiled.Events.Patches.Events.Scp106 { using System.Collections.Generic; - using System.Reflection; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; + using Exiled.API.Features; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp106; + using HarmonyLib; using PlayerRoles.PlayableScps.Scp106; diff --git a/EXILED/Exiled.Events/Patches/Events/Scp106/Teleporting.cs b/EXILED/Exiled.Events/Patches/Events/Scp106/Teleporting.cs index fd1f8ba42e..0078cf8876 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp106/Teleporting.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp106/Teleporting.cs @@ -10,12 +10,15 @@ namespace Exiled.Events.Patches.Events.Scp106 using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp106; using Exiled.Events.Handlers; + using HarmonyLib; + using PlayerRoles.PlayableScps.Scp106; + using UnityEngine; using static HarmonyLib.AccessTools; @@ -88,4 +91,4 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Scp1344/Deactivating.cs b/EXILED/Exiled.Events/Patches/Events/Scp1344/Deactivating.cs index ca0bbe8e35..6d30ba8dc0 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp1344/Deactivating.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp1344/Deactivating.cs @@ -4,7 +4,6 @@ // Licensed under the CC BY-SA 3.0 license. // // ----------------------------------------------------------------------- - #pragma warning disable SA1313 // Parameter names should begin with lower-case letter namespace Exiled.Events.Patches.Events.Scp1344 @@ -16,12 +15,9 @@ namespace Exiled.Events.Patches.Events.Scp1344 using HarmonyLib; using InventorySystem.Items.Usables.Scp1344; - using InventorySystem.Items.Usables.Scp244; using UnityEngine; - using static PlayerList; - /// /// Patches . /// Adds the event, @@ -84,4 +80,4 @@ private static bool StopDeactivation(Scp1344Item instance, Scp1344Status newStat return false; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Scp1344/Status.cs b/EXILED/Exiled.Events/Patches/Events/Scp1344/Status.cs index b4db23211a..588d770620 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp1344/Status.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp1344/Status.cs @@ -7,7 +7,6 @@ namespace Exiled.Events.Patches.Events.Scp1344 { - using System; using System.Collections.Generic; using System.Reflection; using System.Reflection.Emit; @@ -15,6 +14,7 @@ namespace Exiled.Events.Patches.Events.Scp1344 using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp1344; + using HarmonyLib; using InventorySystem.Items.Usables.Scp1344; @@ -108,4 +108,4 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Scp1507/AttackingDoor.cs b/EXILED/Exiled.Events/Patches/Events/Scp1507/AttackingDoor.cs index 76e5dcb1ef..49ddc17a0b 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp1507/AttackingDoor.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp1507/AttackingDoor.cs @@ -15,7 +15,9 @@ namespace Exiled.Events.Patches.Events.Scp1507 using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp1507; + using HarmonyLib; + using PlayerRoles.PlayableScps.Scp1507; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Scp1507/Scream.cs b/EXILED/Exiled.Events/Patches/Events/Scp1507/Scream.cs index cb9a6d3cb6..23329274ff 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp1507/Scream.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp1507/Scream.cs @@ -15,7 +15,9 @@ namespace Exiled.Events.Patches.Events.Scp1507 using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp1507; + using HarmonyLib; + using PlayerRoles.PlayableScps.Scp1507; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Scp1507/SpawningFlamingos.cs b/EXILED/Exiled.Events/Patches/Events/Scp1507/SpawningFlamingos.cs index 0fbaa80f10..6b5c747348 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp1507/SpawningFlamingos.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp1507/SpawningFlamingos.cs @@ -16,7 +16,9 @@ namespace Exiled.Events.Patches.Events.Scp1507 using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp1507; + using HarmonyLib; + using PlayerRoles.PlayableScps.Scp1507; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Scp1507/TapeUsing.cs b/EXILED/Exiled.Events/Patches/Events/Scp1507/TapeUsing.cs index 34118b901e..4a90822497 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp1507/TapeUsing.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp1507/TapeUsing.cs @@ -15,7 +15,9 @@ namespace Exiled.Events.Patches.Events.Scp1507 using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp1507; + using HarmonyLib; + using InventorySystem.Items.FlamingoTapePlayer; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Scp1509/InspectingAndTriggeringAttack.cs b/EXILED/Exiled.Events/Patches/Events/Scp1509/InspectingAndTriggeringAttack.cs index 214aa79aec..df8c952455 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp1509/InspectingAndTriggeringAttack.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp1509/InspectingAndTriggeringAttack.cs @@ -14,7 +14,9 @@ namespace Exiled.Events.Patches.Events.Scp1509 using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Item; using Exiled.Events.EventArgs.Scp1509; + using HarmonyLib; + using InventorySystem.Items.Scp1509; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Scp1509/Resurrecting.cs b/EXILED/Exiled.Events/Patches/Events/Scp1509/Resurrecting.cs index cf9c490079..2556926d52 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp1509/Resurrecting.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp1509/Resurrecting.cs @@ -1,4 +1,4 @@ -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- // // Copyright (c) ExMod Team. All rights reserved. // Licensed under the CC BY-SA 3.0 license. @@ -14,7 +14,9 @@ namespace Exiled.Events.Patches.Events.Scp1509 using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp1509; + using HarmonyLib; + using InventorySystem.Items.Scp1509; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Scp173/BeingObserved.cs b/EXILED/Exiled.Events/Patches/Events/Scp173/BeingObserved.cs index a2c276d9d8..1c94b9f300 100755 --- a/EXILED/Exiled.Events/Patches/Events/Scp173/BeingObserved.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp173/BeingObserved.cs @@ -7,17 +7,13 @@ namespace Exiled.Events.Patches.Events.Scp173 { - using System; using System.Collections.Generic; - using System.Linq; - using System.Reflection; using System.Reflection.Emit; - using API.Features; - using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp173; + using HarmonyLib; using PlayerRoles.PlayableScps; diff --git a/EXILED/Exiled.Events/Patches/Events/Scp173/Blinking.cs b/EXILED/Exiled.Events/Patches/Events/Scp173/Blinking.cs index c828cd8b70..a59d229a39 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp173/Blinking.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp173/Blinking.cs @@ -11,8 +11,8 @@ namespace Exiled.Events.Patches.Events.Scp173 using System.Linq; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; + using Exiled.API.Features; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp173; diff --git a/EXILED/Exiled.Events/Patches/Events/Scp173/BlinkingRequest.cs b/EXILED/Exiled.Events/Patches/Events/Scp173/BlinkingRequest.cs index 0972c96386..abddf10ae9 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp173/BlinkingRequest.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp173/BlinkingRequest.cs @@ -8,12 +8,10 @@ namespace Exiled.Events.Patches.Events.Scp173 { using System.Collections.Generic; - using System.Linq; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; - + using Exiled.API.Features; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp173; diff --git a/EXILED/Exiled.Events/Patches/Events/Scp173/Observers.cs b/EXILED/Exiled.Events/Patches/Events/Scp173/Observers.cs index 4f3cee3a94..fe1eee3e3b 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp173/Observers.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp173/Observers.cs @@ -10,11 +10,14 @@ namespace Exiled.Events.Patches.Events.Scp173 using System.Collections.Generic; using System.Reflection.Emit; - using API.Features; using Attributes; + + using Exiled.API.Features; using Exiled.API.Features.Pools; using Exiled.Events.EventArgs.Scp173; + using HarmonyLib; + using PlayerRoles.PlayableScps.Scp173; using PlayerRoles.Subroutines; @@ -64,8 +67,7 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable), nameof(StandardSubroutine.Owner))), + new(OpCodes.Callvirt, PropertyGetter(typeof(StandardSubroutine), nameof(StandardSubroutine.Owner))), new(OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new[] { typeof(ReferenceHub) })), // Player.Get(ply); diff --git a/EXILED/Exiled.Events/Patches/Events/Scp173/PlacingTantrum.cs b/EXILED/Exiled.Events/Patches/Events/Scp173/PlacingTantrum.cs index 9da814466b..62359a7c27 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp173/PlacingTantrum.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp173/PlacingTantrum.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Scp173 using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp173; diff --git a/EXILED/Exiled.Events/Patches/Events/Scp173/UsingBreakneckSpeeds.cs b/EXILED/Exiled.Events/Patches/Events/Scp173/UsingBreakneckSpeeds.cs index 8e3c718ce4..f3ee4d7005 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp173/UsingBreakneckSpeeds.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp173/UsingBreakneckSpeeds.cs @@ -10,8 +10,8 @@ namespace Exiled.Events.Patches.Events.Scp173 using System.Collections.Generic; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; + using Exiled.API.Features; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp173; @@ -85,4 +85,4 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Scp244/DamagingScp244.cs b/EXILED/Exiled.Events/Patches/Events/Scp244/DamagingScp244.cs index fe511401fe..060fea6351 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp244/DamagingScp244.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp244/DamagingScp244.cs @@ -10,8 +10,8 @@ namespace Exiled.Events.Patches.Events.Scp244 using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.DamageHandlers; - using API.Features.Pools; + using Exiled.API.Features.DamageHandlers; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp244; diff --git a/EXILED/Exiled.Events/Patches/Events/Scp244/UpdateScp244.cs b/EXILED/Exiled.Events/Patches/Events/Scp244/UpdateScp244.cs index ce12d65377..bd389e767a 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp244/UpdateScp244.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp244/UpdateScp244.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Scp244 using System.Diagnostics; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp244; diff --git a/EXILED/Exiled.Events/Patches/Events/Scp244/UsingScp244.cs b/EXILED/Exiled.Events/Patches/Events/Scp244/UsingScp244.cs index 8b03fa883f..bb7e8d1ba8 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp244/UsingScp244.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp244/UsingScp244.cs @@ -10,7 +10,8 @@ namespace Exiled.Events.Patches.Events.Scp244 using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; + using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp244; diff --git a/EXILED/Exiled.Events/Patches/Events/Scp2536/FindingPosition.cs b/EXILED/Exiled.Events/Patches/Events/Scp2536/FindingPosition.cs index 8fbaa35ed1..387831a899 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp2536/FindingPosition.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp2536/FindingPosition.cs @@ -11,13 +11,13 @@ namespace Exiled.Events.Patches.Events.Scp2536 using System.Reflection.Emit; using Christmas.Scp2536; + using Exiled.API.Features; using Exiled.API.Features.Pools; using Exiled.Events.Attributes; - using Exiled.Events.EventArgs.Scp244; using Exiled.Events.EventArgs.Scp2536; + using HarmonyLib; - using UnityEngine; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Scp2536/FoundPosition.cs b/EXILED/Exiled.Events/Patches/Events/Scp2536/FoundPosition.cs index dd942042fb..257c1cb863 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp2536/FoundPosition.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp2536/FoundPosition.cs @@ -1,4 +1,4 @@ -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- // // Copyright (c) ExMod Team. All rights reserved. // Licensed under the CC BY-SA 3.0 license. @@ -11,10 +11,12 @@ namespace Exiled.Events.Patches.Events.Scp2536 using System.Reflection.Emit; using Christmas.Scp2536; + using Exiled.API.Features; using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp2536; + using HarmonyLib; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Scp2536/GrantingGift.cs b/EXILED/Exiled.Events/Patches/Events/Scp2536/GrantingGift.cs index 855523f1e3..0e6a00de6e 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp2536/GrantingGift.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp2536/GrantingGift.cs @@ -12,10 +12,12 @@ namespace Exiled.Events.Patches.Events.Scp2536 using Christmas.Scp2536; using Christmas.Scp2536.Gifts; + using Exiled.API.Features; using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp2536; + using HarmonyLib; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Scp2536/OpeningGift.cs b/EXILED/Exiled.Events/Patches/Events/Scp2536/OpeningGift.cs index 60c8fe059b..b10785d328 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp2536/OpeningGift.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp2536/OpeningGift.cs @@ -11,10 +11,12 @@ namespace Exiled.Events.Patches.Events.Scp2536 using System.Reflection.Emit; using Christmas.Scp2536; + using Exiled.API.Features; using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp2536; + using HarmonyLib; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Scp3114/Dancing.cs b/EXILED/Exiled.Events/Patches/Events/Scp3114/Dancing.cs index 53798e1a31..197a852ab8 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp3114/Dancing.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp3114/Dancing.cs @@ -8,16 +8,14 @@ namespace Exiled.Events.Patches.Events.Scp3114 { using System.Collections.Generic; - using System.Linq; using System.Reflection.Emit; - using Exiled.API.Enums; using Exiled.API.Features; using Exiled.API.Features.Pools; - using Exiled.API.Features.Roles; using Exiled.Events.EventArgs.Scp3114; + using HarmonyLib; - using Mirror; + using PlayerRoles.PlayableScps.Scp3114; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Scp3114/Disguising.cs b/EXILED/Exiled.Events/Patches/Events/Scp3114/Disguising.cs index 515b59a856..f6a8244858 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp3114/Disguising.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp3114/Disguising.cs @@ -98,4 +98,4 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Scp3114/Slapped.cs b/EXILED/Exiled.Events/Patches/Events/Scp3114/Slapped.cs index b49b32622b..82b403bcba 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp3114/Slapped.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp3114/Slapped.cs @@ -8,7 +8,6 @@ namespace Exiled.Events.Patches.Events.Scp3114 { using System.Collections.Generic; - using System.Linq; using System.Reflection.Emit; using Exiled.API.Features.Pools; @@ -17,6 +16,7 @@ namespace Exiled.Events.Patches.Events.Scp3114 using Exiled.Events.Handlers; using HarmonyLib; + using PlayerRoles.PlayableScps.Scp3114; using PlayerRoles.PlayableScps.Subroutines; @@ -69,4 +69,4 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Scp3114/Strangling.cs b/EXILED/Exiled.Events/Patches/Events/Scp3114/Strangling.cs index c0dbbe2ef8..d1926cbfcd 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp3114/Strangling.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp3114/Strangling.cs @@ -14,13 +14,13 @@ namespace Exiled.Events.Patches.Events.Scp3114 using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp3114; using Exiled.Events.Handlers; + using HarmonyLib; + using PlayerRoles.PlayableScps.Scp3114; using static HarmonyLib.AccessTools; - using Player = API.Features.Player; - /// /// Patches to add the event. /// diff --git a/EXILED/Exiled.Events/Patches/Events/Scp3114/TryUseBody.cs b/EXILED/Exiled.Events/Patches/Events/Scp3114/TryUseBody.cs index 5ff62d8112..ff45998d30 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp3114/TryUseBody.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp3114/TryUseBody.cs @@ -78,4 +78,4 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Scp330/DroppingCandy.cs b/EXILED/Exiled.Events/Patches/Events/Scp330/DroppingCandy.cs index 6004294efa..2fcb30d653 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp330/DroppingCandy.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp330/DroppingCandy.cs @@ -10,23 +10,19 @@ namespace Exiled.Events.Patches.Events.Scp330 using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp330; using Handlers; using HarmonyLib; + using InventorySystem.Items; - using InventorySystem.Items.Pickups; using InventorySystem.Items.Usables.Scp330; - using Mirror; - using static HarmonyLib.AccessTools; - using Player = API.Features.Player; - /// /// Patches the method to add the /// event. diff --git a/EXILED/Exiled.Events/Patches/Events/Scp330/EatingScp330.cs b/EXILED/Exiled.Events/Patches/Events/Scp330/EatingScp330.cs index 5ac86c50fe..2cb52ad65c 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp330/EatingScp330.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp330/EatingScp330.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Scp330 using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp330; diff --git a/EXILED/Exiled.Events/Patches/Events/Scp330/InteractingScp330.cs b/EXILED/Exiled.Events/Patches/Events/Scp330/InteractingScp330.cs index b7e714470a..dc92656f2f 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp330/InteractingScp330.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp330/InteractingScp330.cs @@ -7,26 +7,21 @@ namespace Exiled.Events.Patches.Events.Scp330 { - using InventorySystem.Items; - -#pragma warning disable SA1402 -#pragma warning disable SA1313 - using System.Collections.Generic; using System.Reflection.Emit; using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp330; + using HarmonyLib; + using Interactables.Interobjects; - using InventorySystem; + using InventorySystem.Items.Usables.Scp330; using static HarmonyLib.AccessTools; - using Player = API.Features.Player; - /// /// Patches the method to add the /// event. diff --git a/EXILED/Exiled.Events/Patches/Events/Scp559/Interacting.cs b/EXILED/Exiled.Events/Patches/Events/Scp559/Interacting.cs index dcf788f079..23ad872908 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp559/Interacting.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp559/Interacting.cs @@ -15,6 +15,7 @@ namespace Exiled.Events.Patches.Events.Scp559 using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp559; + using HarmonyLib; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Scp559/Spawning.cs b/EXILED/Exiled.Events/Patches/Events/Scp559/Spawning.cs index cd52be3cc0..57fe71a059 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp559/Spawning.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp559/Spawning.cs @@ -15,6 +15,7 @@ namespace Exiled.Events.Patches.Events.Scp559 using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp559; + using HarmonyLib; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Scp914/InteractingEvents.cs b/EXILED/Exiled.Events/Patches/Events/Scp914/InteractingEvents.cs index defc59b9b6..9685166453 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp914/InteractingEvents.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp914/InteractingEvents.cs @@ -10,11 +10,14 @@ namespace Exiled.Events.Patches.Events.Scp914 using System.Collections.Generic; using System.Reflection.Emit; - using API.Features; + using Exiled.API.Features; + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp914; + using global::Scp914; + using HarmonyLib; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Scp914/UpgradedPickup.cs b/EXILED/Exiled.Events/Patches/Events/Scp914/UpgradedPickup.cs index 64842911da..0f63715269 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp914/UpgradedPickup.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp914/UpgradedPickup.cs @@ -10,7 +10,8 @@ namespace Exiled.Events.Patches.Events.Scp914 using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; + using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp914; @@ -30,7 +31,7 @@ namespace Exiled.Events.Patches.Events.Scp914 [HarmonyPatch(typeof(Scp914Upgrader), nameof(Scp914Upgrader.ProcessPickup))] internal static class UpgradedPickup { - private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) + private static IEnumerable Transpiler(IEnumerable instructions) { List newInstructions = ListPool.Pool.Get(instructions); diff --git a/EXILED/Exiled.Events/Patches/Events/Scp914/UpgradedPlayer.cs b/EXILED/Exiled.Events/Patches/Events/Scp914/UpgradedPlayer.cs index d1441c3e22..7fd1cf35c9 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp914/UpgradedPlayer.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp914/UpgradedPlayer.cs @@ -7,24 +7,21 @@ namespace Exiled.Events.Patches.Events.Scp914 { - using System.CodeDom; using System.Collections.Generic; - using System.Reflection; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; + using Exiled.API.Features; + using Exiled.API.Features.Pools; + using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp914; + using global::Scp914; + using HarmonyLib; - using Mono.Cecil.Cil; - using PlayerRoles.FirstPersonControl; - using UnityEngine; using static HarmonyLib.AccessTools; - using OpCode = System.Reflection.Emit.OpCode; using Scp914 = Handlers.Scp914; /// diff --git a/EXILED/Exiled.Events/Patches/Events/Scp914/UpgradingPickup.cs b/EXILED/Exiled.Events/Patches/Events/Scp914/UpgradingPickup.cs index 9562decaed..ccd8056d61 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp914/UpgradingPickup.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp914/UpgradingPickup.cs @@ -10,7 +10,8 @@ namespace Exiled.Events.Patches.Events.Scp914 using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; + using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp914; diff --git a/EXILED/Exiled.Events/Patches/Events/Scp914/UpgradingPlayer.cs b/EXILED/Exiled.Events/Patches/Events/Scp914/UpgradingPlayer.cs index 3927ed9a55..ea14b30804 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp914/UpgradingPlayer.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp914/UpgradingPlayer.cs @@ -11,19 +11,18 @@ namespace Exiled.Events.Patches.Events.Scp914 using System.Reflection; using System.Reflection.Emit; - using API.Features; - using API.Features.Pools; + using Exiled.API.Features; + using Exiled.API.Features.Pools; + using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp914; + using global::Scp914; + using HarmonyLib; - using Mono.Cecil.Cil; - using PlayerRoles.FirstPersonControl; - using UnityEngine; using static HarmonyLib.AccessTools; - using OpCode = System.Reflection.Emit.OpCode; using Scp914 = Handlers.Scp914; /// diff --git a/EXILED/Exiled.Events/Patches/Events/Scp939/Clawed.cs b/EXILED/Exiled.Events/Patches/Events/Scp939/Clawed.cs index c1cf9dd589..5eca08deec 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp939/Clawed.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp939/Clawed.cs @@ -14,7 +14,9 @@ namespace Exiled.Events.Patches.Events.Scp939 using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp939; + using HarmonyLib; + using PlayerRoles.PlayableScps.Scp939; using static HarmonyLib.AccessTools; @@ -27,7 +29,7 @@ namespace Exiled.Events.Patches.Events.Scp939 [HarmonyPatch(typeof(Scp939ClawAbility), nameof(Scp939ClawAbility.ServerProcessCmd))] internal class Clawed { - private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) + private static IEnumerable Transpiler(IEnumerable instructions) { List newInstructions = ListPool.Pool.Get(instructions); diff --git a/EXILED/Exiled.Events/Patches/Events/Scp939/Focus.cs b/EXILED/Exiled.Events/Patches/Events/Scp939/Focus.cs index ced8ee89ae..cbc7d3e8a0 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp939/Focus.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp939/Focus.cs @@ -16,6 +16,7 @@ namespace Exiled.Events.Patches.Events.Scp939 using Exiled.Events.Handlers; using HarmonyLib; + using Mirror; using PlayerRoles.PlayableScps.Scp939; diff --git a/EXILED/Exiled.Events/Patches/Events/Scp939/Lunge.cs b/EXILED/Exiled.Events/Patches/Events/Scp939/Lunge.cs index 1b6bc31f5f..e0cd5a26eb 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp939/Lunge.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp939/Lunge.cs @@ -14,8 +14,11 @@ namespace Exiled.Events.Patches.Events.Scp939 using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp939; using Exiled.Events.Handlers; + using HarmonyLib; + using Mirror; + using PlayerRoles.PlayableScps.Scp939; using static HarmonyLib.AccessTools; @@ -28,7 +31,7 @@ namespace Exiled.Events.Patches.Events.Scp939 [HarmonyPatch(typeof(Scp939LungeAbility), nameof(Scp939LungeAbility.TriggerLunge))] internal static class Lunge { - private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) + private static IEnumerable Transpiler(IEnumerable instructions) { List newInstructions = ListPool.Pool.Get(instructions); diff --git a/EXILED/Exiled.Events/Patches/Events/Scp939/PlacedAmnesticCloud.cs b/EXILED/Exiled.Events/Patches/Events/Scp939/PlacedAmnesticCloud.cs index 61583050bf..52edc3fbb8 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp939/PlacedAmnesticCloud.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp939/PlacedAmnesticCloud.cs @@ -14,7 +14,9 @@ namespace Exiled.Events.Patches.Events.Scp939 using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp939; using Exiled.Events.Handlers; + using HarmonyLib; + using PlayerRoles.PlayableScps.Scp939; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Scp939/PlacingAmnesticCloud.cs b/EXILED/Exiled.Events/Patches/Events/Scp939/PlacingAmnesticCloud.cs index 7a803e9805..20c2aefca3 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp939/PlacingAmnesticCloud.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp939/PlacingAmnesticCloud.cs @@ -16,7 +16,9 @@ namespace Exiled.Events.Patches.Events.Scp939 using Exiled.Events.Handlers; using HarmonyLib; + using Mirror; + using PlayerRoles.PlayableScps.Scp939; using PlayerRoles.Subroutines; @@ -117,4 +119,4 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Scp939/PlacingMimicPoint.cs b/EXILED/Exiled.Events/Patches/Events/Scp939/PlacingMimicPoint.cs index 753291df01..6b4685ec12 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp939/PlacingMimicPoint.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp939/PlacingMimicPoint.cs @@ -1,4 +1,4 @@ -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- // // Copyright (c) ExMod Team. All rights reserved. // Licensed under the CC BY-SA 3.0 license. @@ -14,7 +14,9 @@ namespace Exiled.Events.Patches.Events.Scp939 using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp939; + using HarmonyLib; + using PlayerRoles.PlayableScps.Scp939.Mimicry; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Scp939/PlayingFootstep.cs b/EXILED/Exiled.Events/Patches/Events/Scp939/PlayingFootstep.cs index e0d0485430..a1139a7124 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp939/PlayingFootstep.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp939/PlayingFootstep.cs @@ -16,6 +16,7 @@ namespace Exiled.Events.Patches.Events.Scp939 using Exiled.Events.Handlers; using HarmonyLib; + using PlayerRoles.FirstPersonControl.Thirdperson; using PlayerRoles.PlayableScps.Scp939; using PlayerRoles.PlayableScps.Scp939.Ripples; @@ -76,4 +77,4 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Scp939/PlayingSound.cs b/EXILED/Exiled.Events/Patches/Events/Scp939/PlayingSound.cs index cfd4da4ec8..9c7f67b00a 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp939/PlayingSound.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp939/PlayingSound.cs @@ -15,6 +15,7 @@ namespace Exiled.Events.Patches.Events.Scp939 using Exiled.Events.Handlers; using HarmonyLib; + using Mirror; using PlayerRoles.PlayableScps.Scp939; @@ -33,6 +34,9 @@ internal static class PlayingSound { private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) { + // TODO: This is bad practice should be reworked. + _ = instructions; + List newInstructions = new(); LocalBuilder option = generator.DeclareLocal(typeof(byte)); @@ -117,4 +121,4 @@ private static IEnumerable Transpiler(IEnumerable instance.ServerSendRpc(true); } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Scp939/PlayingVoice.cs b/EXILED/Exiled.Events/Patches/Events/Scp939/PlayingVoice.cs index b74e6c49e5..2d3cd49cfe 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp939/PlayingVoice.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp939/PlayingVoice.cs @@ -79,4 +79,4 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Scp939/SavingVoice.cs b/EXILED/Exiled.Events/Patches/Events/Scp939/SavingVoice.cs index 9b8c3707b5..2c15e4543f 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp939/SavingVoice.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp939/SavingVoice.cs @@ -16,7 +16,9 @@ namespace Exiled.Events.Patches.Events.Scp939 using Exiled.Events.Handlers; using HarmonyLib; + using PlayerRoles.PlayableScps.Scp939.Mimicry; + using PlayerStatsSystem; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Scp939/ValidatingVisibility.cs b/EXILED/Exiled.Events/Patches/Events/Scp939/ValidatingVisibility.cs index a139646363..90e3ac22aa 100644 --- a/EXILED/Exiled.Events/Patches/Events/Scp939/ValidatingVisibility.cs +++ b/EXILED/Exiled.Events/Patches/Events/Scp939/ValidatingVisibility.cs @@ -1,4 +1,4 @@ -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- // // Copyright (c) ExMod Team. All rights reserved. // Licensed under the CC BY-SA 3.0 license. @@ -7,20 +7,18 @@ namespace Exiled.Events.Patches.Events.Scp939 { - using System; using System.Collections.Generic; using System.Linq; using System.Reflection.Emit; using Exiled.API.Enums; - using Exiled.API.Extensions; - using Exiled.API.Features; using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp939; + using HarmonyLib; - using InventorySystem.Items; + using Mirror; using PlayerRoles.PlayableScps.Scp939; @@ -87,7 +85,7 @@ private static IEnumerable Transpiler(IEnumerable StaticCallEvent(ILGenerator generator, LocalBuilder ev, Label ret, CodeInstruction insertInstuction, Scp939VisibilityState state, bool setLabel = true) { - CodeInstruction first = new CodeInstruction(OpCodes.Ldc_I4, (int)state); + CodeInstruction first = new(OpCodes.Ldc_I4, (int)state); if (setLabel) { @@ -146,4 +144,4 @@ private static void SetToLastSeen(ReferenceHub target) }; } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Server/AddingUnitName.cs b/EXILED/Exiled.Events/Patches/Events/Server/AddingUnitName.cs index 758ffea323..d9779f1817 100644 --- a/EXILED/Exiled.Events/Patches/Events/Server/AddingUnitName.cs +++ b/EXILED/Exiled.Events/Patches/Events/Server/AddingUnitName.cs @@ -10,12 +10,15 @@ namespace Exiled.Events.Patches.Events.Server using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; + using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Server; + using HarmonyLib; + using PlayerRoles; - using Respawning; + using Respawning.NamingRules; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Server/ChoosingStartTeamQueue.cs b/EXILED/Exiled.Events/Patches/Events/Server/ChoosingStartTeamQueue.cs index d5d80d9250..81cae085e5 100644 --- a/EXILED/Exiled.Events/Patches/Events/Server/ChoosingStartTeamQueue.cs +++ b/EXILED/Exiled.Events/Patches/Events/Server/ChoosingStartTeamQueue.cs @@ -10,10 +10,13 @@ namespace Exiled.Events.Patches.Events.Server using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; + using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Server; + using HarmonyLib; + using PlayerRoles.RoleAssign; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Server/CompletingObjective.cs b/EXILED/Exiled.Events/Patches/Events/Server/CompletingObjective.cs index cf9f9aacbe..17d4885887 100644 --- a/EXILED/Exiled.Events/Patches/Events/Server/CompletingObjective.cs +++ b/EXILED/Exiled.Events/Patches/Events/Server/CompletingObjective.cs @@ -1,4 +1,4 @@ -// ----------------------------------------------------------------------- +// ----------------------------------------------------------------------- // // Copyright (c) ExMod Team. All rights reserved. // Licensed under the CC BY-SA 3.0 license. @@ -13,7 +13,9 @@ namespace Exiled.Events.Patches.Events.Server using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Server; + using HarmonyLib; + using Respawning.Objectives; using static HarmonyLib.AccessTools; diff --git a/EXILED/Exiled.Events/Patches/Events/Server/Reporting.cs b/EXILED/Exiled.Events/Patches/Events/Server/Reporting.cs index d5150c2c81..921839a189 100644 --- a/EXILED/Exiled.Events/Patches/Events/Server/Reporting.cs +++ b/EXILED/Exiled.Events/Patches/Events/Server/Reporting.cs @@ -10,15 +10,14 @@ namespace Exiled.Events.Patches.Events.Server using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; + using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Server; using Exiled.Events.Handlers; using HarmonyLib; - using UnityEngine; - using static HarmonyLib.AccessTools; using Player = API.Features.Player; diff --git a/EXILED/Exiled.Events/Patches/Events/Server/RespawningTeam.cs b/EXILED/Exiled.Events/Patches/Events/Server/RespawningTeam.cs index 501f6d90e6..e9bca60dd0 100644 --- a/EXILED/Exiled.Events/Patches/Events/Server/RespawningTeam.cs +++ b/EXILED/Exiled.Events/Patches/Events/Server/RespawningTeam.cs @@ -12,13 +12,17 @@ namespace Exiled.Events.Patches.Events.Server using System.Linq; using System.Reflection.Emit; - using API.Features.Pools; + using Exiled.API.Features.Pools; + using Exiled.API.Features.Waves; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Server; using Exiled.Events.Handlers; + using HarmonyLib; + using PlayerRoles; + using Respawning.NamingRules; using Respawning.Waves; @@ -122,4 +126,4 @@ private static IEnumerable Transpiler(IEnumerable players) => players.Select(player => player.ReferenceHub).ToArray(); } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Server/RestartingRound.cs b/EXILED/Exiled.Events/Patches/Events/Server/RestartingRound.cs index ab4ef8b267..9f3cfa9c53 100644 --- a/EXILED/Exiled.Events/Patches/Events/Server/RestartingRound.cs +++ b/EXILED/Exiled.Events/Patches/Events/Server/RestartingRound.cs @@ -7,24 +7,12 @@ namespace Exiled.Events.Patches.Events.Server { - using System; - using System.Collections.Generic; - using System.Reflection.Emit; - - using API.Features.Pools; - using CustomPlayerEffects.Danger; - using Exiled.API.Enums; using Exiled.Events.Attributes; - using Exiled.Events.EventArgs.Player; - using GameCore; using HarmonyLib; using RoundRestarting; - using static HarmonyLib.AccessTools; - using static PlayerList; - /// /// Patches . /// Adds the event. @@ -42,4 +30,4 @@ private static void Prefix(bool value) Handlers.Server.OnRestartingRound(); } } -} +} \ No newline at end of file diff --git a/EXILED/Exiled.Events/Patches/Events/Server/RoundEnd.cs b/EXILED/Exiled.Events/Patches/Events/Server/RoundEnd.cs index fba037de79..343c96ba2c 100644 --- a/EXILED/Exiled.Events/Patches/Events/Server/RoundEnd.cs +++ b/EXILED/Exiled.Events/Patches/Events/Server/RoundEnd.cs @@ -18,6 +18,7 @@ namespace Exiled.Events.Patches.Events.Server using Exiled.Events.EventArgs.Server; using HarmonyLib; + using PlayerRoles; using static HarmonyLib.AccessTools; @@ -59,7 +60,7 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable), nameof(HashSet.Contains))), + new(OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new[] { typeof(ReferenceHub) })), + new(OpCodes.Callvirt, Method(typeof(HashSet), nameof(HashSet.Contains))), new(OpCodes.Brtrue_S, jmp), }); diff --git a/EXILED/Exiled.Events/Patches/Events/Server/RoundStarting.cs b/EXILED/Exiled.Events/Patches/Events/Server/RoundStarting.cs new file mode 100644 index 0000000000..73eefaf610 --- /dev/null +++ b/EXILED/Exiled.Events/Patches/Events/Server/RoundStarting.cs @@ -0,0 +1,118 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) ExMod Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Events.Patches.Events.Server +{ + using System; + using System.Collections.Generic; + using System.Linq; + using System.Reflection; + using System.Reflection.Emit; + + using Exiled.API.Features.Pools; + using Exiled.Events.EventArgs.Server; + + using HarmonyLib; + + using static HarmonyLib.AccessTools; + + /// + /// Patches . + /// Adds the event. + /// + [HarmonyPatch] + internal class RoundStarting + { +#pragma warning disable SA1600 // Elements should be documented + public static Type PrivateType { get; internal set; } + + private static MethodInfo TargetMethod() + { + PrivateType = typeof(CharacterClassManager).GetNestedTypes(all) + .FirstOrDefault(currentType => currentType.Name.Contains("Init")); + if (PrivateType == null) + throw new Exception("State machine type for Init not found."); + MethodInfo moveNextMethod = PrivateType.GetMethod("MoveNext", all); + + if (moveNextMethod == null) + throw new Exception("MoveNext method not found in the state machine type."); + return moveNextMethod; + } + + private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) + { + List newInstructions = ListPool.Pool.Get(instructions); + + const string TimeLeft = "5__3"; + const string OriginalTimeLeft = "5__2"; + const string TopPlayer = "5__4"; + + LocalBuilder ev = generator.DeclareLocal(typeof(RoundStartingEventArgs)); + int offset = -4; + int index = newInstructions.FindLastIndex(x => x.Calls(Method(typeof(CharacterClassManager), nameof(CharacterClassManager.ForceRoundStart)))) + offset; + + List