From 84e496ffb9cc7c45c27b10c86a6989c88faad7ea Mon Sep 17 00:00:00 2001 From: Misaka-ZeroTwo <45165615+Misaka-ZeroTwo@users.noreply.github.com> Date: Fri, 1 Dec 2023 01:14:46 -0500 Subject: [PATCH 001/141] v8.4.3 (#2305) --- EXILED.props | 2 +- Exiled.API/Features/Items/Firearm.cs | 6 +- Exiled.API/Features/Player.cs | 24 ++++++- .../API/Features/CustomWeapon.cs | 7 ++- .../Map/SpawningTeamVehicleEventArgs.cs | 2 +- .../Player/ClosingGeneratorEventArgs.cs | 8 +-- .../EventArgs/Player/ItemRemovedEventArgs.cs | 50 +++++++++++++++ .../Player/PickingUpItemEventArgs.cs | 6 +- .../Player/TogglingFlashlightEventArgs.cs | 5 +- .../Scp244/OpeningScp244EventArgs.cs | 8 +-- .../EventArgs/Scp244/UsingScp244EventArgs.cs | 8 +-- Exiled.Events/Events.cs | 1 + Exiled.Events/Handlers/Player.cs | 14 +++++ .../Patches/Events/Map/SpawningTeamVehicle.cs | 62 ++++++++++++++++--- Exiled.Events/Patches/Events/Player/Joined.cs | 4 +- .../Events/Player/TogglingFlashlight.cs | 6 +- 16 files changed, 173 insertions(+), 40 deletions(-) create mode 100644 Exiled.Events/EventArgs/Player/ItemRemovedEventArgs.cs diff --git a/EXILED.props b/EXILED.props index b92d785d8d..9271862ac3 100644 --- a/EXILED.props +++ b/EXILED.props @@ -15,7 +15,7 @@ - 8.4.2 + 8.4.3 false diff --git a/Exiled.API/Features/Items/Firearm.cs b/Exiled.API/Features/Items/Firearm.cs index 4aeda30e11..b6ab15fb4e 100644 --- a/Exiled.API/Features/Items/Firearm.cs +++ b/Exiled.API/Features/Items/Firearm.cs @@ -130,13 +130,13 @@ public byte MaxAmmo switch (Base.AmmoManagerModule) { case TubularMagazineAmmoManager tubularMagazineAmmoManager: - tubularMagazineAmmoManager.MaxAmmo = value; + tubularMagazineAmmoManager.MaxAmmo = (byte)(value - Base.AttachmentsValue(AttachmentParam.MagazineCapacityModifier) - (Base.Status.Flags.HasFlagFast(FirearmStatusFlags.Cocked) ? tubularMagazineAmmoManager.ChamberedRounds : 0)); break; case ClipLoadedInternalMagAmmoManager clipLoadedInternalMagAmmoManager: - clipLoadedInternalMagAmmoManager.MaxAmmo = value; + clipLoadedInternalMagAmmoManager.MaxAmmo = (byte)(value - Base.AttachmentsValue(AttachmentParam.MagazineCapacityModifier)); break; case AutomaticAmmoManager automaticAmmoManager: - automaticAmmoManager.MaxAmmo = value; + automaticAmmoManager.MaxAmmo = (byte)(value - Base.AttachmentsValue(AttachmentParam.MagazineCapacityModifier) - automaticAmmoManager.ChamberedAmount); break; default: Log.Warn($"MaxAmmo can't be used for this Item: {Type} ({Base.AmmoManagerModule})"); diff --git a/Exiled.API/Features/Player.cs b/Exiled.API/Features/Player.cs index c425e92a94..2febc7e6a2 100644 --- a/Exiled.API/Features/Player.cs +++ b/Exiled.API/Features/Player.cs @@ -916,7 +916,7 @@ public float HumeShield /// /// Gets or sets the item in the player's hand. Value will be if the player is not holding anything. /// - /// + /// public Item CurrentItem { get => Item.Get(Inventory.CurInstance); @@ -1834,9 +1834,27 @@ public void Broadcast(Broadcast broadcast, bool shouldClearPrevious = false) /// /// Drops an item from the player's inventory. /// - /// The item to be dropped. + /// The to be dropped. + /// Is the item Thrown?. + public void DropItem(Item item, bool isThrown = false) + { + if (item is null) + return; + Inventory.UserCode_CmdDropItem__UInt16__Boolean(item.Serial, isThrown); + } + + /// + /// Drops an item from the player's inventory. + /// + /// The to be dropped. /// dropped . - public Pickup DropItem(Item item) => Pickup.Get(Inventory.ServerDropItem(item.Serial)); + public Pickup DropItem(Item item) => item is not null ? Pickup.Get(Inventory.ServerDropItem(item.Serial)) : null; + + /// + /// Drops the held item. Will not do anything if the player is not holding an item. + /// + /// Is the item Thrown?. + public void DropHeldItem(bool isThrown = false) => DropItem(CurrentItem, isThrown); /// /// Drops the held item. Will not do anything if the player is not holding an item. diff --git a/Exiled.CustomItems/API/Features/CustomWeapon.cs b/Exiled.CustomItems/API/Features/CustomWeapon.cs index bc16769bcb..7b3ce94054 100644 --- a/Exiled.CustomItems/API/Features/CustomWeapon.cs +++ b/Exiled.CustomItems/API/Features/CustomWeapon.cs @@ -9,7 +9,6 @@ namespace Exiled.CustomItems.API.Features { using System; - using Exiled.API.Enums; using Exiled.API.Extensions; using Exiled.API.Features; using Exiled.API.Features.DamageHandlers; @@ -19,7 +18,6 @@ namespace Exiled.CustomItems.API.Features using InventorySystem.Items.Firearms.Attachments; using InventorySystem.Items.Firearms.Attachments.Components; - using InventorySystem.Items.Firearms.BasicMessages; using UnityEngine; @@ -77,6 +75,7 @@ public override ItemType Type firearm.AddAttachment(Attachments); firearm.Ammo = ClipSize; + firearm.MaxAmmo = ClipSize; Pickup? pickup = firearm.CreatePickup(position); @@ -102,7 +101,9 @@ public override ItemType Type { if (!Attachments.IsEmpty()) firearm.AddAttachment(Attachments); + byte ammo = firearm.Ammo; + firearm.MaxAmmo = ClipSize; Log.Debug($"{nameof(Name)}.{nameof(Spawn)}: Spawning weapon with {ammo} ammo."); Pickup? pickup = firearm.CreatePickup(position); pickup.Scale = Scale; @@ -126,7 +127,9 @@ public override void Give(Player player, bool displayMessage = true) { if (!Attachments.IsEmpty()) firearm.AddAttachment(Attachments); + firearm.Ammo = ClipSize; + firearm.MaxAmmo = ClipSize; } Log.Debug($"{nameof(Give)}: Adding {item.Serial} to tracker."); diff --git a/Exiled.Events/EventArgs/Map/SpawningTeamVehicleEventArgs.cs b/Exiled.Events/EventArgs/Map/SpawningTeamVehicleEventArgs.cs index 439253cc72..c412c6f2ab 100644 --- a/Exiled.Events/EventArgs/Map/SpawningTeamVehicleEventArgs.cs +++ b/Exiled.Events/EventArgs/Map/SpawningTeamVehicleEventArgs.cs @@ -38,6 +38,6 @@ public SpawningTeamVehicleEventArgs(SpawnableTeamType team, bool isAllowed = tru /// /// Gets or sets a value indicating whether or not the vehicle can be spawned. /// - public bool IsAllowed { get; set; } = true; + public bool IsAllowed { get; set; } } } \ No newline at end of file diff --git a/Exiled.Events/EventArgs/Player/ClosingGeneratorEventArgs.cs b/Exiled.Events/EventArgs/Player/ClosingGeneratorEventArgs.cs index c3d0d812ea..a8340f7939 100644 --- a/Exiled.Events/EventArgs/Player/ClosingGeneratorEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/ClosingGeneratorEventArgs.cs @@ -30,18 +30,18 @@ public ClosingGeneratorEventArgs(Player player, Scp079Generator generator, bool } /// - /// Gets or sets a value indicating whether or not the generator door can be opened. + /// Gets or sets a value indicating whether or not the generator door can be closed. /// public bool IsAllowed { get; set; } /// - /// Gets the generator that is opening. + /// Gets the generator that is being closed. /// public Generator Generator { get; } /// - /// Gets the player who's opening the generator door. + /// Gets the player who's closing the generator door. /// public Player Player { get; } } -} \ No newline at end of file +} diff --git a/Exiled.Events/EventArgs/Player/ItemRemovedEventArgs.cs b/Exiled.Events/EventArgs/Player/ItemRemovedEventArgs.cs new file mode 100644 index 0000000000..0ae4c68b95 --- /dev/null +++ b/Exiled.Events/EventArgs/Player/ItemRemovedEventArgs.cs @@ -0,0 +1,50 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Events.EventArgs.Player +{ + using Exiled.API.Features.Items; + using Exiled.API.Features.Pickups; + using Exiled.Events.EventArgs.Interfaces; + + using InventorySystem.Items; + using InventorySystem.Items.Pickups; + + /// + /// Contains all information after removing an item from a player's inventory. + /// + public class ItemRemovedEventArgs : IPlayerEvent, IItemEvent, IPickupEvent + { + /// + /// Initializes a new instance of the class. + /// + /// The the item was removed to. + /// The removed . + /// The the originated from, or if the item was not picked up. + public ItemRemovedEventArgs(ReferenceHub referenceHub, ItemBase itemBase, ItemPickupBase pickupBase) + { + Player = API.Features.Player.Get(referenceHub); + Item = Item.Get(itemBase); + Pickup = Pickup.Get(pickupBase); + } + + /// + /// Gets the player that had the item removed. + /// + public API.Features.Player Player { get; } + + /// + /// Gets the item that was removed. + /// + public Item Item { get; } + + /// + /// Gets the pickup that the item originated from or if the item was not picked up. + /// + public Pickup Pickup { get; } + } +} \ No newline at end of file diff --git a/Exiled.Events/EventArgs/Player/PickingUpItemEventArgs.cs b/Exiled.Events/EventArgs/Player/PickingUpItemEventArgs.cs index 59e496e673..2d7ace6ff3 100644 --- a/Exiled.Events/EventArgs/Player/PickingUpItemEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/PickingUpItemEventArgs.cs @@ -43,13 +43,13 @@ public PickingUpItemEventArgs(Player player, ItemPickupBase pickup, bool isAllow public bool IsAllowed { get; set; } /// - /// Gets the dropped pickup. + /// Gets the pickup that's being picked up. /// public Pickup Pickup { get; } /// - /// Gets the player who dropped the item. + /// Gets the player who's picking up an item. /// public Player Player { get; } } -} \ No newline at end of file +} diff --git a/Exiled.Events/EventArgs/Player/TogglingFlashlightEventArgs.cs b/Exiled.Events/EventArgs/Player/TogglingFlashlightEventArgs.cs index d5dcbcb8bf..167d85c689 100644 --- a/Exiled.Events/EventArgs/Player/TogglingFlashlightEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/TogglingFlashlightEventArgs.cs @@ -11,8 +11,7 @@ namespace Exiled.Events.EventArgs.Player using API.Features.Items; using Interfaces; - - using InventorySystem.Items.ToggleableLights.Flashlight; + using InventorySystem.Items.ToggleableLights; /// /// Contains all information before a player toggles a flashlight. @@ -33,7 +32,7 @@ public class TogglingFlashlightEventArgs : IPlayerEvent, IDeniableEvent, IItemEv /// /// /// - public TogglingFlashlightEventArgs(ReferenceHub hub, FlashlightItem flashlight, bool newState) + public TogglingFlashlightEventArgs(ReferenceHub hub, ToggleableLightItemBase flashlight, bool newState) { Player = Player.Get(hub); Flashlight = (Flashlight)Item.Get(flashlight); diff --git a/Exiled.Events/EventArgs/Scp244/OpeningScp244EventArgs.cs b/Exiled.Events/EventArgs/Scp244/OpeningScp244EventArgs.cs index 133eaf3161..aecdaaa96e 100644 --- a/Exiled.Events/EventArgs/Scp244/OpeningScp244EventArgs.cs +++ b/Exiled.Events/EventArgs/Scp244/OpeningScp244EventArgs.cs @@ -13,7 +13,7 @@ namespace Exiled.Events.EventArgs.Scp244 using InventorySystem.Items.Usables.Scp244; /// - /// Contains all information before a player picks up an SCP-244. + /// Contains all information before a player opens SCP-244. /// public class OpeningScp244EventArgs : IDeniableEvent { @@ -29,13 +29,13 @@ public OpeningScp244EventArgs(Scp244DeployablePickup pickup) } /// - /// Gets a value representing the being picked up. + /// Gets a value representing the being opened. /// public Scp244Pickup Pickup { get; } /// - /// Gets or sets a value indicating whether or not the player can interact with SCP-330. + /// Gets or sets a value indicating whether or not the player can open SCP-244. /// public bool IsAllowed { get; set; } = true; } -} \ No newline at end of file +} diff --git a/Exiled.Events/EventArgs/Scp244/UsingScp244EventArgs.cs b/Exiled.Events/EventArgs/Scp244/UsingScp244EventArgs.cs index af4bdb6856..9277019690 100644 --- a/Exiled.Events/EventArgs/Scp244/UsingScp244EventArgs.cs +++ b/Exiled.Events/EventArgs/Scp244/UsingScp244EventArgs.cs @@ -15,7 +15,7 @@ namespace Exiled.Events.EventArgs.Scp244 using InventorySystem.Items.Usables.Scp244; /// - /// Contains all information before radio battery charge is changed. + /// Contains all information before SCP-244 is used. /// public class UsingScp244EventArgs : IPlayerEvent, IDeniableEvent { @@ -44,13 +44,13 @@ public UsingScp244EventArgs(Scp244Item scp244, Player player, bool isAllowed = t public Scp244 Scp244 { get; } /// - /// Gets or sets a value indicating whether the radio battery charge can be changed or not. + /// Gets or sets a value indicating whether the SCP-244 can be used. /// public bool IsAllowed { get; set; } /// - /// Gets the player who's using the radio. + /// Gets the player who's using the SCP-244. /// public Player Player { get; } } -} \ No newline at end of file +} diff --git a/Exiled.Events/Events.cs b/Exiled.Events/Events.cs index 3db2af8221..af40330c7d 100644 --- a/Exiled.Events/Events.cs +++ b/Exiled.Events/Events.cs @@ -72,6 +72,7 @@ public override void OnEnabled() CharacterClassManager.OnRoundStarted += Handlers.Server.OnRoundStarted; InventorySystem.InventoryExtensions.OnItemAdded += Handlers.Player.OnItemAdded; + InventorySystem.InventoryExtensions.OnItemRemoved += Handlers.Player.OnItemRemoved; RagdollManager.OnRagdollSpawned += Handlers.Internal.RagdollList.OnSpawnedRagdoll; RagdollManager.OnRagdollRemoved += Handlers.Internal.RagdollList.OnRemovedRagdoll; diff --git a/Exiled.Events/Handlers/Player.cs b/Exiled.Events/Handlers/Player.cs index 0a1d5520a6..8830898d29 100644 --- a/Exiled.Events/Handlers/Player.cs +++ b/Exiled.Events/Handlers/Player.cs @@ -477,6 +477,11 @@ public class Player /// public static Event ItemAdded { get; set; } = new(); + /// + /// Invoked after a has an item removed from their inventory. + /// + public static Event ItemRemoved { get; set; } = new(); + /// /// Invoked before KillPlayer is called. /// @@ -927,6 +932,15 @@ public class Player public static void OnItemAdded(ReferenceHub referenceHub, InventorySystem.Items.ItemBase itemBase, InventorySystem.Items.Pickups.ItemPickupBase pickupBase) => ItemAdded.InvokeSafely(new ItemAddedEventArgs(referenceHub, itemBase, pickupBase)); + /// + /// Called after a has an item removed from their inventory. + /// + /// The the item was removed from. + /// The removed . + /// The the originated from, or if the item was not picked up. + public static void OnItemRemoved(ReferenceHub referenceHub, InventorySystem.Items.ItemBase itemBase, InventorySystem.Items.Pickups.ItemPickupBase pickupBase) + => ItemRemoved.InvokeSafely(new ItemRemovedEventArgs(referenceHub, itemBase, pickupBase)); + /// /// Called before a enters in an environmental hazard. /// diff --git a/Exiled.Events/Patches/Events/Map/SpawningTeamVehicle.cs b/Exiled.Events/Patches/Events/Map/SpawningTeamVehicle.cs index 7f31c01bdb..63f0f8fe04 100644 --- a/Exiled.Events/Patches/Events/Map/SpawningTeamVehicle.cs +++ b/Exiled.Events/Patches/Events/Map/SpawningTeamVehicle.cs @@ -7,14 +7,19 @@ namespace Exiled.Events.Patches.Events.Map { - using Exiled.Events.Attributes; + using System.Collections.Generic; + using System.Reflection.Emit; + using Exiled.API.Features.Pools; + using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Map; using HarmonyLib; using Respawning; + using static HarmonyLib.AccessTools; + /// /// Patches . /// Adds the event. @@ -23,15 +28,58 @@ namespace Exiled.Events.Patches.Events.Map [HarmonyPatch(typeof(RespawnEffectsController), nameof(RespawnEffectsController.ExecuteAllEffects))] internal static class SpawningTeamVehicle { - private static bool Prefix(RespawnEffectsController.EffectType type, SpawnableTeamType team) + private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) { - if (type != RespawnEffectsController.EffectType.Selection) - return true; + List newInstructions = ListPool.Pool.Get(instructions); + + Label retLabel = generator.DefineLabel(); + Label continueLabel = generator.DefineLabel(); + + LocalBuilder ev = generator.DeclareLocal(typeof(SpawningTeamVehicleEventArgs)); + + newInstructions.InsertRange(0, new CodeInstruction[] + { + // if (type != RespawnEffectsController.EffectType.Selection) + // goto continueLabel; + new(OpCodes.Ldarg_0), + new(OpCodes.Ldc_I4_0), + new(OpCodes.Ceq), + new(OpCodes.Brfalse_S, continueLabel), + + // team + new(OpCodes.Ldarg_1), + + // true + new(OpCodes.Ldc_I4_1), + + // SpawningTeamVehicleEventArgs ev = new(SpawnableTeamType, bool); + new(OpCodes.Newobj, GetDeclaredConstructors(typeof(SpawningTeamVehicleEventArgs))[0]), + new(OpCodes.Dup), + new(OpCodes.Dup), + new(OpCodes.Stloc_S, ev.LocalIndex), + + // Handlers.Map.OnSpawningTeamVehicle(ev); + new(OpCodes.Call, Method(typeof(Handlers.Map), nameof(Handlers.Map.OnSpawningTeamVehicle))), + + // if (!ev.IsAllowed) + // return; + new(OpCodes.Callvirt, PropertyGetter(typeof(SpawningTeamVehicleEventArgs), nameof(SpawningTeamVehicleEventArgs.IsAllowed))), + new(OpCodes.Brfalse_S, retLabel), + + // team = ev.Team + new(OpCodes.Ldloc_S, ev), + new(OpCodes.Callvirt, PropertyGetter(typeof(SpawningTeamVehicleEventArgs), nameof(SpawningTeamVehicleEventArgs.Team))), + new(OpCodes.Starg_S, 1), + + new CodeInstruction(OpCodes.Nop).WithLabels(continueLabel), + }); + + newInstructions[newInstructions.Count - 1].WithLabels(retLabel); - SpawningTeamVehicleEventArgs ev = new(team); - Handlers.Map.OnSpawningTeamVehicle(ev); + for (int z = 0; z < newInstructions.Count; z++) + yield return newInstructions[z]; - return ev.IsAllowed; + ListPool.Pool.Return(newInstructions); } } } \ No newline at end of file diff --git a/Exiled.Events/Patches/Events/Player/Joined.cs b/Exiled.Events/Patches/Events/Player/Joined.cs index ba27333eb0..8b580bd503 100644 --- a/Exiled.Events/Patches/Events/Player/Joined.cs +++ b/Exiled.Events/Patches/Events/Player/Joined.cs @@ -37,14 +37,14 @@ internal static void CallEvent(ReferenceHub hub, out Player player) Log.Debug($"Object exists {player is not null}"); Log.Debug($"Creating player object for {hub.nicknameSync.Network_displayName}"); #endif + Player.UnverifiedPlayers.Add(hub.gameObject, player); + if (ReferenceHub.HostHub == null) { Server.Host = player; } else { - Player.UnverifiedPlayers.Add(hub.gameObject, player); - Handlers.Player.OnJoined(new JoinedEventArgs(player)); } } diff --git a/Exiled.Events/Patches/Events/Player/TogglingFlashlight.cs b/Exiled.Events/Patches/Events/Player/TogglingFlashlight.cs index 067dc9acc9..9fd1328522 100644 --- a/Exiled.Events/Patches/Events/Player/TogglingFlashlight.cs +++ b/Exiled.Events/Patches/Events/Player/TogglingFlashlight.cs @@ -44,14 +44,14 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } } -} \ No newline at end of file +} From bc32117118c6763000114bb37590682caed6f651 Mon Sep 17 00:00:00 2001 From: Yamato <66829532+louis1706@users.noreply.github.com> Date: Sat, 13 Jan 2024 19:11:51 +0100 Subject: [PATCH 002/141] Update for PostXMAS (#2383) * Update for PostXMAS * WeaponFixFromXMAS * remove var * Fix RegisteringEvent * more var remove --- .editorconfig | 567 +----------------- Exiled.API/Extensions/CommonExtensions.cs | 4 +- Exiled.API/Extensions/ItemExtensions.cs | 9 +- Exiled.API/Extensions/ReflectionExtensions.cs | 4 +- Exiled.API/Features/Doors/CheckpointDoor.cs | 6 +- Exiled.API/Features/Effect.cs | 2 +- Exiled.API/Features/Generator.cs | 2 +- Exiled.API/Features/Items/Scp244.cs | 5 + Exiled.API/Features/Player.cs | 13 +- Exiled.API/Features/Ragdoll.cs | 7 +- Exiled.API/Features/Roles/Scp079Role.cs | 2 +- Exiled.API/Features/Scp3114Ragdoll.cs | 78 +++ .../API/Features/CustomGrenade.cs | 4 +- .../API/Features/CustomWeapon.cs | 44 +- Exiled.Events/Events.cs | 6 +- Exiled.Events/Handlers/Internal/Round.cs | 5 +- .../Patches/Events/Map/ChangingIntoGrenade.cs | 2 +- .../Patches/Events/Player/TogglingRadio.cs | 2 +- .../Patches/Events/Scp0492/Consuming.cs | 2 +- .../Patches/Events/Scp106/Teleporting.cs | 2 +- Exiled.Installer/CommandSettings.cs | 2 +- Exiled.Installer/Program.cs | 42 +- 22 files changed, 194 insertions(+), 616 deletions(-) create mode 100644 Exiled.API/Features/Scp3114Ragdoll.cs diff --git a/.editorconfig b/.editorconfig index 73a9fdec44..3124f1d41f 100644 --- a/.editorconfig +++ b/.editorconfig @@ -15,103 +15,20 @@ ij_smart_tabs = false ij_visual_guides = none ij_wrap_on_typing = false +[*.cs] +csharp_style_var_for_built_in_types = false:error +csharp_style_var_when_type_is_apparent = false:error +csharp_style_var_elsewhere = false:error + # ReSharper properties resharper_csharp_max_line_length = 400 -[*.css] -ij_css_align_closing_brace_with_properties = false -ij_css_blank_lines_around_nested_selector = 1 -ij_css_blank_lines_between_blocks = 1 -ij_css_block_comment_add_space = false -ij_css_brace_placement = end_of_line -ij_css_enforce_quotes_on_format = false -ij_css_hex_color_long_format = false -ij_css_hex_color_lower_case = false -ij_css_hex_color_short_format = false -ij_css_hex_color_upper_case = false -ij_css_keep_blank_lines_in_code = 2 -ij_css_keep_indents_on_empty_lines = false -ij_css_keep_single_line_blocks = false -ij_css_properties_order = font, font-family, font-size, font-weight, font-style, font-variant, font-size-adjust, font-stretch, line-height, position, z-index, top, right, bottom, left, display, visibility, float, clear, overflow, overflow-x, overflow-y, clip, zoom, align-content, align-items, align-self, flex, flex-flow, flex-basis, flex-direction, flex-grow, flex-shrink, flex-wrap, justify-content, order, box-sizing, width, min-width, max-width, height, min-height, max-height, margin, margin-top, margin-right, margin-bottom, margin-left, padding, padding-top, padding-right, padding-bottom, padding-left, table-layout, empty-cells, caption-side, border-spacing, border-collapse, list-style, list-style-position, list-style-type, list-style-image, content, quotes, counter-reset, counter-increment, resize, cursor, user-select, nav-index, nav-up, nav-right, nav-down, nav-left, transition, transition-delay, transition-timing-function, transition-duration, transition-property, transform, transform-origin, animation, animation-name, animation-duration, animation-play-state, animation-timing-function, animation-delay, animation-iteration-count, animation-direction, text-align, text-align-last, vertical-align, white-space, text-decoration, text-emphasis, text-emphasis-color, text-emphasis-style, text-emphasis-position, text-indent, text-justify, letter-spacing, word-spacing, text-outline, text-transform, text-wrap, text-overflow, text-overflow-ellipsis, text-overflow-mode, word-wrap, word-break, tab-size, hyphens, pointer-events, opacity, color, border, border-width, border-style, border-color, border-top, border-top-width, border-top-style, border-top-color, border-right, border-right-width, border-right-style, border-right-color, border-bottom, border-bottom-width, border-bottom-style, border-bottom-color, border-left, border-left-width, border-left-style, border-left-color, border-radius, border-top-left-radius, border-top-right-radius, border-bottom-right-radius, border-bottom-left-radius, border-image, border-image-source, border-image-slice, border-image-width, border-image-outset, border-image-repeat, outline, outline-width, outline-style, outline-color, outline-offset, background, background-color, background-image, background-repeat, background-attachment, background-position, background-position-x, background-position-y, background-clip, background-origin, background-size, box-decoration-break, box-shadow, text-shadow -ij_css_space_after_colon = true -ij_css_space_before_opening_brace = true -ij_css_use_double_quotes = true -ij_css_value_alignment = do_not_align - -[*.less] -indent_size = 2 -ij_less_align_closing_brace_with_properties = false -ij_less_blank_lines_around_nested_selector = 1 -ij_less_blank_lines_between_blocks = 1 -ij_less_block_comment_add_space = false -ij_less_brace_placement = 0 -ij_less_enforce_quotes_on_format = false -ij_less_hex_color_long_format = false -ij_less_hex_color_lower_case = false -ij_less_hex_color_short_format = false -ij_less_hex_color_upper_case = false -ij_less_keep_blank_lines_in_code = 2 -ij_less_keep_indents_on_empty_lines = false -ij_less_keep_single_line_blocks = false -ij_less_line_comment_add_space = false -ij_less_line_comment_at_first_column = false -ij_less_properties_order = font, font-family, font-size, font-weight, font-style, font-variant, font-size-adjust, font-stretch, line-height, position, z-index, top, right, bottom, left, display, visibility, float, clear, overflow, overflow-x, overflow-y, clip, zoom, align-content, align-items, align-self, flex, flex-flow, flex-basis, flex-direction, flex-grow, flex-shrink, flex-wrap, justify-content, order, box-sizing, width, min-width, max-width, height, min-height, max-height, margin, margin-top, margin-right, margin-bottom, margin-left, padding, padding-top, padding-right, padding-bottom, padding-left, table-layout, empty-cells, caption-side, border-spacing, border-collapse, list-style, list-style-position, list-style-type, list-style-image, content, quotes, counter-reset, counter-increment, resize, cursor, user-select, nav-index, nav-up, nav-right, nav-down, nav-left, transition, transition-delay, transition-timing-function, transition-duration, transition-property, transform, transform-origin, animation, animation-name, animation-duration, animation-play-state, animation-timing-function, animation-delay, animation-iteration-count, animation-direction, text-align, text-align-last, vertical-align, white-space, text-decoration, text-emphasis, text-emphasis-color, text-emphasis-style, text-emphasis-position, text-indent, text-justify, letter-spacing, word-spacing, text-outline, text-transform, text-wrap, text-overflow, text-overflow-ellipsis, text-overflow-mode, word-wrap, word-break, tab-size, hyphens, pointer-events, opacity, color, border, border-width, border-style, border-color, border-top, border-top-width, border-top-style, border-top-color, border-right, border-right-width, border-right-style, border-right-color, border-bottom, border-bottom-width, border-bottom-style, border-bottom-color, border-left, border-left-width, border-left-style, border-left-color, border-radius, border-top-left-radius, border-top-right-radius, border-bottom-right-radius, border-bottom-left-radius, border-image, border-image-source, border-image-slice, border-image-width, border-image-outset, border-image-repeat, outline, outline-width, outline-style, outline-color, outline-offset, background, background-color, background-image, background-repeat, background-attachment, background-position, background-position-x, background-position-y, background-clip, background-origin, background-size, box-decoration-break, box-shadow, text-shadow -ij_less_space_after_colon = true -ij_less_space_before_opening_brace = true -ij_less_use_double_quotes = true -ij_less_value_alignment = 0 - [*.properties] ij_properties_align_group_field_declarations = false ij_properties_keep_blank_lines = false ij_properties_key_value_delimiter = equals ij_properties_spaces_around_key_value_delimiter = false -[*.sass] -indent_size = 2 -ij_sass_align_closing_brace_with_properties = false -ij_sass_blank_lines_around_nested_selector = 1 -ij_sass_blank_lines_between_blocks = 1 -ij_sass_brace_placement = 0 -ij_sass_enforce_quotes_on_format = false -ij_sass_hex_color_long_format = false -ij_sass_hex_color_lower_case = false -ij_sass_hex_color_short_format = false -ij_sass_hex_color_upper_case = false -ij_sass_keep_blank_lines_in_code = 2 -ij_sass_keep_indents_on_empty_lines = false -ij_sass_keep_single_line_blocks = false -ij_sass_line_comment_add_space = false -ij_sass_line_comment_at_first_column = false -ij_sass_properties_order = font, font-family, font-size, font-weight, font-style, font-variant, font-size-adjust, font-stretch, line-height, position, z-index, top, right, bottom, left, display, visibility, float, clear, overflow, overflow-x, overflow-y, clip, zoom, align-content, align-items, align-self, flex, flex-flow, flex-basis, flex-direction, flex-grow, flex-shrink, flex-wrap, justify-content, order, box-sizing, width, min-width, max-width, height, min-height, max-height, margin, margin-top, margin-right, margin-bottom, margin-left, padding, padding-top, padding-right, padding-bottom, padding-left, table-layout, empty-cells, caption-side, border-spacing, border-collapse, list-style, list-style-position, list-style-type, list-style-image, content, quotes, counter-reset, counter-increment, resize, cursor, user-select, nav-index, nav-up, nav-right, nav-down, nav-left, transition, transition-delay, transition-timing-function, transition-duration, transition-property, transform, transform-origin, animation, animation-name, animation-duration, animation-play-state, animation-timing-function, animation-delay, animation-iteration-count, animation-direction, text-align, text-align-last, vertical-align, white-space, text-decoration, text-emphasis, text-emphasis-color, text-emphasis-style, text-emphasis-position, text-indent, text-justify, letter-spacing, word-spacing, text-outline, text-transform, text-wrap, text-overflow, text-overflow-ellipsis, text-overflow-mode, word-wrap, word-break, tab-size, hyphens, pointer-events, opacity, color, border, border-width, border-style, border-color, border-top, border-top-width, border-top-style, border-top-color, border-right, border-right-width, border-right-style, border-right-color, border-bottom, border-bottom-width, border-bottom-style, border-bottom-color, border-left, border-left-width, border-left-style, border-left-color, border-radius, border-top-left-radius, border-top-right-radius, border-bottom-right-radius, border-bottom-left-radius, border-image, border-image-source, border-image-slice, border-image-width, border-image-outset, border-image-repeat, outline, outline-width, outline-style, outline-color, outline-offset, background, background-color, background-image, background-repeat, background-attachment, background-position, background-position-x, background-position-y, background-clip, background-origin, background-size, box-decoration-break, box-shadow, text-shadow -ij_sass_space_after_colon = true -ij_sass_space_before_opening_brace = true -ij_sass_use_double_quotes = true -ij_sass_value_alignment = 0 - -[*.scss] -indent_size = 2 -ij_scss_align_closing_brace_with_properties = false -ij_scss_blank_lines_around_nested_selector = 1 -ij_scss_blank_lines_between_blocks = 1 -ij_scss_block_comment_add_space = false -ij_scss_brace_placement = 0 -ij_scss_enforce_quotes_on_format = false -ij_scss_hex_color_long_format = false -ij_scss_hex_color_lower_case = false -ij_scss_hex_color_short_format = false -ij_scss_hex_color_upper_case = false -ij_scss_keep_blank_lines_in_code = 2 -ij_scss_keep_indents_on_empty_lines = false -ij_scss_keep_single_line_blocks = false -ij_scss_line_comment_add_space = false -ij_scss_line_comment_at_first_column = false -ij_scss_properties_order = font, font-family, font-size, font-weight, font-style, font-variant, font-size-adjust, font-stretch, line-height, position, z-index, top, right, bottom, left, display, visibility, float, clear, overflow, overflow-x, overflow-y, clip, zoom, align-content, align-items, align-self, flex, flex-flow, flex-basis, flex-direction, flex-grow, flex-shrink, flex-wrap, justify-content, order, box-sizing, width, min-width, max-width, height, min-height, max-height, margin, margin-top, margin-right, margin-bottom, margin-left, padding, padding-top, padding-right, padding-bottom, padding-left, table-layout, empty-cells, caption-side, border-spacing, border-collapse, list-style, list-style-position, list-style-type, list-style-image, content, quotes, counter-reset, counter-increment, resize, cursor, user-select, nav-index, nav-up, nav-right, nav-down, nav-left, transition, transition-delay, transition-timing-function, transition-duration, transition-property, transform, transform-origin, animation, animation-name, animation-duration, animation-play-state, animation-timing-function, animation-delay, animation-iteration-count, animation-direction, text-align, text-align-last, vertical-align, white-space, text-decoration, text-emphasis, text-emphasis-color, text-emphasis-style, text-emphasis-position, text-indent, text-justify, letter-spacing, word-spacing, text-outline, text-transform, text-wrap, text-overflow, text-overflow-ellipsis, text-overflow-mode, word-wrap, word-break, tab-size, hyphens, pointer-events, opacity, color, border, border-width, border-style, border-color, border-top, border-top-width, border-top-style, border-top-color, border-right, border-right-width, border-right-style, border-right-color, border-bottom, border-bottom-width, border-bottom-style, border-bottom-color, border-left, border-left-width, border-left-style, border-left-color, border-radius, border-top-left-radius, border-top-right-radius, border-bottom-right-radius, border-bottom-left-radius, border-image, border-image-source, border-image-slice, border-image-width, border-image-outset, border-image-repeat, outline, outline-width, outline-style, outline-color, outline-offset, background, background-color, background-image, background-repeat, background-attachment, background-position, background-position-x, background-position-y, background-clip, background-origin, background-size, box-decoration-break, box-shadow, text-shadow -ij_scss_space_after_colon = true -ij_scss_space_before_opening_brace = true -ij_scss_use_double_quotes = true -ij_scss_value_alignment = 0 - [*.styl] indent_size = 2 ij_stylus_align_closing_brace_with_properties = false @@ -132,17 +49,6 @@ ij_stylus_space_before_opening_brace = true ij_stylus_use_double_quotes = true ij_stylus_value_alignment = 0 -[*.vue] -indent_size = 2 -tab_width = 2 -ij_continuation_indent_size = 4 -ij_vue_indent_children_of_top_level = template -ij_vue_interpolation_new_line_after_start_delimiter = true -ij_vue_interpolation_new_line_before_end_delimiter = true -ij_vue_interpolation_wrap = off -ij_vue_keep_indents_on_empty_lines = false -ij_vue_spaces_within_interpolation_expressions = true - [.editorconfig] ij_editorconfig_align_group_field_declarations = false ij_editorconfig_space_after_colon = false @@ -170,177 +76,6 @@ ij_xml_space_around_equals_in_attribute = false ij_xml_space_inside_empty_tag = false ij_xml_text_wrap = normal -[{*.ats,*.cts,*.mts,*.ts}] -ij_continuation_indent_size = 4 -ij_typescript_align_imports = false -ij_typescript_align_multiline_array_initializer_expression = false -ij_typescript_align_multiline_binary_operation = false -ij_typescript_align_multiline_chained_methods = false -ij_typescript_align_multiline_extends_list = false -ij_typescript_align_multiline_for = true -ij_typescript_align_multiline_parameters = true -ij_typescript_align_multiline_parameters_in_calls = false -ij_typescript_align_multiline_ternary_operation = false -ij_typescript_align_object_properties = 0 -ij_typescript_align_union_types = false -ij_typescript_align_var_statements = 0 -ij_typescript_array_initializer_new_line_after_left_brace = false -ij_typescript_array_initializer_right_brace_on_new_line = false -ij_typescript_array_initializer_wrap = off -ij_typescript_assignment_wrap = off -ij_typescript_binary_operation_sign_on_next_line = false -ij_typescript_binary_operation_wrap = off -ij_typescript_blacklist_imports = rxjs/Rx, node_modules/**, **/node_modules/**, @angular/material, @angular/material/typings/** -ij_typescript_blank_lines_after_imports = 1 -ij_typescript_blank_lines_around_class = 1 -ij_typescript_blank_lines_around_field = 0 -ij_typescript_blank_lines_around_field_in_interface = 0 -ij_typescript_blank_lines_around_function = 1 -ij_typescript_blank_lines_around_method = 1 -ij_typescript_blank_lines_around_method_in_interface = 1 -ij_typescript_block_brace_style = end_of_line -ij_typescript_block_comment_add_space = false -ij_typescript_block_comment_at_first_column = true -ij_typescript_call_parameters_new_line_after_left_paren = false -ij_typescript_call_parameters_right_paren_on_new_line = false -ij_typescript_call_parameters_wrap = off -ij_typescript_catch_on_new_line = false -ij_typescript_chained_call_dot_on_new_line = true -ij_typescript_class_brace_style = end_of_line -ij_typescript_comma_on_new_line = false -ij_typescript_do_while_brace_force = never -ij_typescript_else_on_new_line = false -ij_typescript_enforce_trailing_comma = keep -ij_typescript_enum_constants_wrap = on_every_item -ij_typescript_extends_keyword_wrap = off -ij_typescript_extends_list_wrap = off -ij_typescript_field_prefix = _ -ij_typescript_file_name_style = relaxed -ij_typescript_finally_on_new_line = false -ij_typescript_for_brace_force = never -ij_typescript_for_statement_new_line_after_left_paren = false -ij_typescript_for_statement_right_paren_on_new_line = false -ij_typescript_for_statement_wrap = off -ij_typescript_force_quote_style = false -ij_typescript_force_semicolon_style = false -ij_typescript_function_expression_brace_style = end_of_line -ij_typescript_if_brace_force = never -ij_typescript_import_merge_members = global -ij_typescript_import_prefer_absolute_path = global -ij_typescript_import_sort_members = true -ij_typescript_import_sort_module_name = false -ij_typescript_import_use_node_resolution = true -ij_typescript_imports_wrap = on_every_item -ij_typescript_indent_case_from_switch = true -ij_typescript_indent_chained_calls = true -ij_typescript_indent_package_children = 0 -ij_typescript_jsdoc_include_types = false -ij_typescript_jsx_attribute_value = braces -ij_typescript_keep_blank_lines_in_code = 2 -ij_typescript_keep_first_column_comment = true -ij_typescript_keep_indents_on_empty_lines = false -ij_typescript_keep_line_breaks = true -ij_typescript_keep_simple_blocks_in_one_line = false -ij_typescript_keep_simple_methods_in_one_line = false -ij_typescript_line_comment_add_space = true -ij_typescript_line_comment_at_first_column = false -ij_typescript_method_brace_style = end_of_line -ij_typescript_method_call_chain_wrap = off -ij_typescript_method_parameters_new_line_after_left_paren = false -ij_typescript_method_parameters_right_paren_on_new_line = false -ij_typescript_method_parameters_wrap = off -ij_typescript_object_literal_wrap = on_every_item -ij_typescript_parentheses_expression_new_line_after_left_paren = false -ij_typescript_parentheses_expression_right_paren_on_new_line = false -ij_typescript_place_assignment_sign_on_next_line = false -ij_typescript_prefer_as_type_cast = false -ij_typescript_prefer_explicit_types_function_expression_returns = false -ij_typescript_prefer_explicit_types_function_returns = false -ij_typescript_prefer_explicit_types_vars_fields = false -ij_typescript_prefer_parameters_wrap = false -ij_typescript_reformat_c_style_comments = false -ij_typescript_space_after_colon = true -ij_typescript_space_after_comma = true -ij_typescript_space_after_dots_in_rest_parameter = false -ij_typescript_space_after_generator_mult = true -ij_typescript_space_after_property_colon = true -ij_typescript_space_after_quest = true -ij_typescript_space_after_type_colon = true -ij_typescript_space_after_unary_not = false -ij_typescript_space_before_async_arrow_lparen = true -ij_typescript_space_before_catch_keyword = true -ij_typescript_space_before_catch_left_brace = true -ij_typescript_space_before_catch_parentheses = true -ij_typescript_space_before_class_lbrace = true -ij_typescript_space_before_class_left_brace = true -ij_typescript_space_before_colon = true -ij_typescript_space_before_comma = false -ij_typescript_space_before_do_left_brace = true -ij_typescript_space_before_else_keyword = true -ij_typescript_space_before_else_left_brace = true -ij_typescript_space_before_finally_keyword = true -ij_typescript_space_before_finally_left_brace = true -ij_typescript_space_before_for_left_brace = true -ij_typescript_space_before_for_parentheses = true -ij_typescript_space_before_for_semicolon = false -ij_typescript_space_before_function_left_parenth = true -ij_typescript_space_before_generator_mult = false -ij_typescript_space_before_if_left_brace = true -ij_typescript_space_before_if_parentheses = true -ij_typescript_space_before_method_call_parentheses = false -ij_typescript_space_before_method_left_brace = true -ij_typescript_space_before_method_parentheses = false -ij_typescript_space_before_property_colon = false -ij_typescript_space_before_quest = true -ij_typescript_space_before_switch_left_brace = true -ij_typescript_space_before_switch_parentheses = true -ij_typescript_space_before_try_left_brace = true -ij_typescript_space_before_type_colon = false -ij_typescript_space_before_unary_not = false -ij_typescript_space_before_while_keyword = true -ij_typescript_space_before_while_left_brace = true -ij_typescript_space_before_while_parentheses = true -ij_typescript_spaces_around_additive_operators = true -ij_typescript_spaces_around_arrow_function_operator = true -ij_typescript_spaces_around_assignment_operators = true -ij_typescript_spaces_around_bitwise_operators = true -ij_typescript_spaces_around_equality_operators = true -ij_typescript_spaces_around_logical_operators = true -ij_typescript_spaces_around_multiplicative_operators = true -ij_typescript_spaces_around_relational_operators = true -ij_typescript_spaces_around_shift_operators = true -ij_typescript_spaces_around_unary_operator = false -ij_typescript_spaces_within_array_initializer_brackets = false -ij_typescript_spaces_within_brackets = false -ij_typescript_spaces_within_catch_parentheses = false -ij_typescript_spaces_within_for_parentheses = false -ij_typescript_spaces_within_if_parentheses = false -ij_typescript_spaces_within_imports = false -ij_typescript_spaces_within_interpolation_expressions = false -ij_typescript_spaces_within_method_call_parentheses = false -ij_typescript_spaces_within_method_parentheses = false -ij_typescript_spaces_within_object_literal_braces = false -ij_typescript_spaces_within_object_type_braces = true -ij_typescript_spaces_within_parentheses = false -ij_typescript_spaces_within_switch_parentheses = false -ij_typescript_spaces_within_type_assertion = false -ij_typescript_spaces_within_union_types = true -ij_typescript_spaces_within_while_parentheses = false -ij_typescript_special_else_if_treatment = true -ij_typescript_ternary_operation_signs_on_next_line = false -ij_typescript_ternary_operation_wrap = off -ij_typescript_union_types_wrap = on_every_item -ij_typescript_use_chained_calls_group_indents = false -ij_typescript_use_double_quotes = true -ij_typescript_use_explicit_js_extension = auto -ij_typescript_use_path_mapping = always -ij_typescript_use_public_modifier = false -ij_typescript_use_semicolon_after_statement = true -ij_typescript_var_declaration_wrap = normal -ij_typescript_while_brace_force = never -ij_typescript_while_on_new_line = false -ij_typescript_wrap_comments = false - [{*.bash,*.sh,*.zsh}] indent_size = 2 tab_width = 2 @@ -351,270 +86,6 @@ ij_shell_redirect_followed_by_space = false ij_shell_switch_cases_indented = false ij_shell_use_unix_line_separator = true -[{*.cjs,*.js}] -ij_continuation_indent_size = 4 -ij_javascript_align_imports = false -ij_javascript_align_multiline_array_initializer_expression = false -ij_javascript_align_multiline_binary_operation = false -ij_javascript_align_multiline_chained_methods = false -ij_javascript_align_multiline_extends_list = false -ij_javascript_align_multiline_for = true -ij_javascript_align_multiline_parameters = true -ij_javascript_align_multiline_parameters_in_calls = false -ij_javascript_align_multiline_ternary_operation = false -ij_javascript_align_object_properties = 0 -ij_javascript_align_union_types = false -ij_javascript_align_var_statements = 0 -ij_javascript_array_initializer_new_line_after_left_brace = false -ij_javascript_array_initializer_right_brace_on_new_line = false -ij_javascript_array_initializer_wrap = off -ij_javascript_assignment_wrap = off -ij_javascript_binary_operation_sign_on_next_line = false -ij_javascript_binary_operation_wrap = off -ij_javascript_blacklist_imports = rxjs/Rx, node_modules/**, **/node_modules/**, @angular/material, @angular/material/typings/** -ij_javascript_blank_lines_after_imports = 1 -ij_javascript_blank_lines_around_class = 1 -ij_javascript_blank_lines_around_field = 0 -ij_javascript_blank_lines_around_function = 1 -ij_javascript_blank_lines_around_method = 1 -ij_javascript_block_brace_style = end_of_line -ij_javascript_block_comment_add_space = false -ij_javascript_block_comment_at_first_column = true -ij_javascript_call_parameters_new_line_after_left_paren = false -ij_javascript_call_parameters_right_paren_on_new_line = false -ij_javascript_call_parameters_wrap = off -ij_javascript_catch_on_new_line = false -ij_javascript_chained_call_dot_on_new_line = true -ij_javascript_class_brace_style = end_of_line -ij_javascript_comma_on_new_line = false -ij_javascript_do_while_brace_force = never -ij_javascript_else_on_new_line = false -ij_javascript_enforce_trailing_comma = keep -ij_javascript_extends_keyword_wrap = off -ij_javascript_extends_list_wrap = off -ij_javascript_field_prefix = _ -ij_javascript_file_name_style = relaxed -ij_javascript_finally_on_new_line = false -ij_javascript_for_brace_force = never -ij_javascript_for_statement_new_line_after_left_paren = false -ij_javascript_for_statement_right_paren_on_new_line = false -ij_javascript_for_statement_wrap = off -ij_javascript_force_quote_style = false -ij_javascript_force_semicolon_style = false -ij_javascript_function_expression_brace_style = end_of_line -ij_javascript_if_brace_force = never -ij_javascript_import_merge_members = global -ij_javascript_import_prefer_absolute_path = global -ij_javascript_import_sort_members = true -ij_javascript_import_sort_module_name = false -ij_javascript_import_use_node_resolution = true -ij_javascript_imports_wrap = on_every_item -ij_javascript_indent_case_from_switch = true -ij_javascript_indent_chained_calls = true -ij_javascript_indent_package_children = 0 -ij_javascript_jsx_attribute_value = braces -ij_javascript_keep_blank_lines_in_code = 2 -ij_javascript_keep_first_column_comment = true -ij_javascript_keep_indents_on_empty_lines = false -ij_javascript_keep_line_breaks = true -ij_javascript_keep_simple_blocks_in_one_line = false -ij_javascript_keep_simple_methods_in_one_line = false -ij_javascript_line_comment_add_space = true -ij_javascript_line_comment_at_first_column = false -ij_javascript_method_brace_style = end_of_line -ij_javascript_method_call_chain_wrap = off -ij_javascript_method_parameters_new_line_after_left_paren = false -ij_javascript_method_parameters_right_paren_on_new_line = false -ij_javascript_method_parameters_wrap = off -ij_javascript_object_literal_wrap = on_every_item -ij_javascript_parentheses_expression_new_line_after_left_paren = false -ij_javascript_parentheses_expression_right_paren_on_new_line = false -ij_javascript_place_assignment_sign_on_next_line = false -ij_javascript_prefer_as_type_cast = false -ij_javascript_prefer_explicit_types_function_expression_returns = false -ij_javascript_prefer_explicit_types_function_returns = false -ij_javascript_prefer_explicit_types_vars_fields = false -ij_javascript_prefer_parameters_wrap = false -ij_javascript_reformat_c_style_comments = false -ij_javascript_space_after_colon = true -ij_javascript_space_after_comma = true -ij_javascript_space_after_dots_in_rest_parameter = false -ij_javascript_space_after_generator_mult = true -ij_javascript_space_after_property_colon = true -ij_javascript_space_after_quest = true -ij_javascript_space_after_type_colon = true -ij_javascript_space_after_unary_not = false -ij_javascript_space_before_async_arrow_lparen = true -ij_javascript_space_before_catch_keyword = true -ij_javascript_space_before_catch_left_brace = true -ij_javascript_space_before_catch_parentheses = true -ij_javascript_space_before_class_lbrace = true -ij_javascript_space_before_class_left_brace = true -ij_javascript_space_before_colon = true -ij_javascript_space_before_comma = false -ij_javascript_space_before_do_left_brace = true -ij_javascript_space_before_else_keyword = true -ij_javascript_space_before_else_left_brace = true -ij_javascript_space_before_finally_keyword = true -ij_javascript_space_before_finally_left_brace = true -ij_javascript_space_before_for_left_brace = true -ij_javascript_space_before_for_parentheses = true -ij_javascript_space_before_for_semicolon = false -ij_javascript_space_before_function_left_parenth = true -ij_javascript_space_before_generator_mult = false -ij_javascript_space_before_if_left_brace = true -ij_javascript_space_before_if_parentheses = true -ij_javascript_space_before_method_call_parentheses = false -ij_javascript_space_before_method_left_brace = true -ij_javascript_space_before_method_parentheses = false -ij_javascript_space_before_property_colon = false -ij_javascript_space_before_quest = true -ij_javascript_space_before_switch_left_brace = true -ij_javascript_space_before_switch_parentheses = true -ij_javascript_space_before_try_left_brace = true -ij_javascript_space_before_type_colon = false -ij_javascript_space_before_unary_not = false -ij_javascript_space_before_while_keyword = true -ij_javascript_space_before_while_left_brace = true -ij_javascript_space_before_while_parentheses = true -ij_javascript_spaces_around_additive_operators = true -ij_javascript_spaces_around_arrow_function_operator = true -ij_javascript_spaces_around_assignment_operators = true -ij_javascript_spaces_around_bitwise_operators = true -ij_javascript_spaces_around_equality_operators = true -ij_javascript_spaces_around_logical_operators = true -ij_javascript_spaces_around_multiplicative_operators = true -ij_javascript_spaces_around_relational_operators = true -ij_javascript_spaces_around_shift_operators = true -ij_javascript_spaces_around_unary_operator = false -ij_javascript_spaces_within_array_initializer_brackets = false -ij_javascript_spaces_within_brackets = false -ij_javascript_spaces_within_catch_parentheses = false -ij_javascript_spaces_within_for_parentheses = false -ij_javascript_spaces_within_if_parentheses = false -ij_javascript_spaces_within_imports = false -ij_javascript_spaces_within_interpolation_expressions = false -ij_javascript_spaces_within_method_call_parentheses = false -ij_javascript_spaces_within_method_parentheses = false -ij_javascript_spaces_within_object_literal_braces = false -ij_javascript_spaces_within_object_type_braces = true -ij_javascript_spaces_within_parentheses = false -ij_javascript_spaces_within_switch_parentheses = false -ij_javascript_spaces_within_type_assertion = false -ij_javascript_spaces_within_union_types = true -ij_javascript_spaces_within_while_parentheses = false -ij_javascript_special_else_if_treatment = true -ij_javascript_ternary_operation_signs_on_next_line = false -ij_javascript_ternary_operation_wrap = off -ij_javascript_union_types_wrap = on_every_item -ij_javascript_use_chained_calls_group_indents = false -ij_javascript_use_double_quotes = true -ij_javascript_use_explicit_js_extension = auto -ij_javascript_use_path_mapping = always -ij_javascript_use_public_modifier = false -ij_javascript_use_semicolon_after_statement = true -ij_javascript_var_declaration_wrap = normal -ij_javascript_while_brace_force = never -ij_javascript_while_on_new_line = false -ij_javascript_wrap_comments = false - -[{*.cjsx,*.coffee}] -indent_size = 2 -tab_width = 2 -ij_continuation_indent_size = 2 -ij_coffeescript_align_function_body = false -ij_coffeescript_align_imports = false -ij_coffeescript_align_multiline_array_initializer_expression = true -ij_coffeescript_align_multiline_parameters = true -ij_coffeescript_align_multiline_parameters_in_calls = false -ij_coffeescript_align_object_properties = 0 -ij_coffeescript_align_union_types = false -ij_coffeescript_align_var_statements = 0 -ij_coffeescript_array_initializer_new_line_after_left_brace = false -ij_coffeescript_array_initializer_right_brace_on_new_line = false -ij_coffeescript_array_initializer_wrap = normal -ij_coffeescript_blacklist_imports = rxjs/Rx, node_modules/**, **/node_modules/**, @angular/material, @angular/material/typings/** -ij_coffeescript_blank_lines_around_function = 1 -ij_coffeescript_call_parameters_new_line_after_left_paren = false -ij_coffeescript_call_parameters_right_paren_on_new_line = false -ij_coffeescript_call_parameters_wrap = normal -ij_coffeescript_chained_call_dot_on_new_line = true -ij_coffeescript_comma_on_new_line = false -ij_coffeescript_enforce_trailing_comma = keep -ij_coffeescript_field_prefix = _ -ij_coffeescript_file_name_style = relaxed -ij_coffeescript_force_quote_style = false -ij_coffeescript_force_semicolon_style = false -ij_coffeescript_function_expression_brace_style = end_of_line -ij_coffeescript_import_merge_members = global -ij_coffeescript_import_prefer_absolute_path = global -ij_coffeescript_import_sort_members = true -ij_coffeescript_import_sort_module_name = false -ij_coffeescript_import_use_node_resolution = true -ij_coffeescript_imports_wrap = on_every_item -ij_coffeescript_indent_chained_calls = true -ij_coffeescript_indent_package_children = 0 -ij_coffeescript_jsx_attribute_value = braces -ij_coffeescript_keep_blank_lines_in_code = 2 -ij_coffeescript_keep_first_column_comment = true -ij_coffeescript_keep_indents_on_empty_lines = false -ij_coffeescript_keep_line_breaks = true -ij_coffeescript_keep_simple_methods_in_one_line = false -ij_coffeescript_method_parameters_new_line_after_left_paren = false -ij_coffeescript_method_parameters_right_paren_on_new_line = false -ij_coffeescript_method_parameters_wrap = off -ij_coffeescript_object_literal_wrap = on_every_item -ij_coffeescript_prefer_as_type_cast = false -ij_coffeescript_prefer_explicit_types_function_expression_returns = false -ij_coffeescript_prefer_explicit_types_function_returns = false -ij_coffeescript_prefer_explicit_types_vars_fields = false -ij_coffeescript_reformat_c_style_comments = false -ij_coffeescript_space_after_comma = true -ij_coffeescript_space_after_dots_in_rest_parameter = false -ij_coffeescript_space_after_generator_mult = true -ij_coffeescript_space_after_property_colon = true -ij_coffeescript_space_after_type_colon = true -ij_coffeescript_space_after_unary_not = false -ij_coffeescript_space_before_async_arrow_lparen = true -ij_coffeescript_space_before_class_lbrace = true -ij_coffeescript_space_before_comma = false -ij_coffeescript_space_before_function_left_parenth = true -ij_coffeescript_space_before_generator_mult = false -ij_coffeescript_space_before_property_colon = false -ij_coffeescript_space_before_type_colon = false -ij_coffeescript_space_before_unary_not = false -ij_coffeescript_spaces_around_additive_operators = true -ij_coffeescript_spaces_around_arrow_function_operator = true -ij_coffeescript_spaces_around_assignment_operators = true -ij_coffeescript_spaces_around_bitwise_operators = true -ij_coffeescript_spaces_around_equality_operators = true -ij_coffeescript_spaces_around_logical_operators = true -ij_coffeescript_spaces_around_multiplicative_operators = true -ij_coffeescript_spaces_around_relational_operators = true -ij_coffeescript_spaces_around_shift_operators = true -ij_coffeescript_spaces_around_unary_operator = false -ij_coffeescript_spaces_within_array_initializer_braces = false -ij_coffeescript_spaces_within_array_initializer_brackets = false -ij_coffeescript_spaces_within_imports = false -ij_coffeescript_spaces_within_index_brackets = false -ij_coffeescript_spaces_within_interpolation_expressions = false -ij_coffeescript_spaces_within_method_call_parentheses = false -ij_coffeescript_spaces_within_method_parentheses = false -ij_coffeescript_spaces_within_object_braces = false -ij_coffeescript_spaces_within_object_literal_braces = false -ij_coffeescript_spaces_within_object_type_braces = true -ij_coffeescript_spaces_within_range_brackets = false -ij_coffeescript_spaces_within_type_assertion = false -ij_coffeescript_spaces_within_union_types = true -ij_coffeescript_union_types_wrap = on_every_item -ij_coffeescript_use_chained_calls_group_indents = false -ij_coffeescript_use_double_quotes = true -ij_coffeescript_use_explicit_js_extension = auto -ij_coffeescript_use_path_mapping = always -ij_coffeescript_use_public_modifier = false -ij_coffeescript_use_semicolon_after_statement = false -ij_coffeescript_var_declaration_wrap = normal - [{*.har,*.inputactions,*.jsb2,*.jsb3,*.json,.babelrc,.eslintrc,.stylelintrc,bowerrc,jest.config}] indent_size = 2 ij_json_array_wrapping = split_into_lines @@ -632,34 +103,6 @@ ij_json_spaces_within_braces = false ij_json_spaces_within_brackets = false ij_json_wrap_long_lines = false -[{*.htm,*.html,*.ng,*.sht,*.shtm,*.shtml}] -ij_html_add_new_line_before_tags = body, div, p, form, h1, h2, h3 -ij_html_align_attributes = true -ij_html_align_text = false -ij_html_attribute_wrap = normal -ij_html_block_comment_add_space = false -ij_html_block_comment_at_first_column = true -ij_html_do_not_align_children_of_min_lines = 0 -ij_html_do_not_break_if_inline_tags = title, h1, h2, h3, h4, h5, h6, p -ij_html_do_not_indent_children_of_tags = html, body, thead, tbody, tfoot -ij_html_enforce_quotes = false -ij_html_inline_tags = a, abbr, acronym, b, basefont, bdo, big, br, cite, cite, code, dfn, em, font, i, img, input, kbd, label, q, s, samp, select, small, span, strike, strong, sub, sup, textarea, tt, u, var -ij_html_keep_blank_lines = 2 -ij_html_keep_indents_on_empty_lines = false -ij_html_keep_line_breaks = true -ij_html_keep_line_breaks_in_text = true -ij_html_keep_whitespaces = false -ij_html_keep_whitespaces_inside = span, pre, textarea -ij_html_line_comment_at_first_column = true -ij_html_new_line_after_last_attribute = never -ij_html_new_line_before_first_attribute = never -ij_html_quote_style = double -ij_html_remove_new_line_before_tags = br -ij_html_space_after_tag_name = false -ij_html_space_around_equality_in_attribute = false -ij_html_space_inside_empty_tag = false -ij_html_text_wrap = normal - [{*.markdown,*.md}] ij_markdown_force_one_space_after_blockquote_symbol = true ij_markdown_force_one_space_after_header_symbol = true diff --git a/Exiled.API/Extensions/CommonExtensions.cs b/Exiled.API/Extensions/CommonExtensions.cs index 41869e15d2..92d140bd17 100644 --- a/Exiled.API/Extensions/CommonExtensions.cs +++ b/Exiled.API/Extensions/CommonExtensions.cs @@ -42,7 +42,7 @@ public static class CommonExtensions /// The new modfied curve. public static AnimationCurve Multiply(this AnimationCurve curve, float amount) { - for (var i = 0; i < curve.length; i++) + for (int i = 0; i < curve.length; i++) curve.keys[i].value *= amount; return curve; @@ -56,7 +56,7 @@ public static AnimationCurve Multiply(this AnimationCurve curve, float amount) /// The new modfied curve. public static AnimationCurve Add(this AnimationCurve curve, float amount) { - for (var i = 0; i < curve.length; i++) + for (int i = 0; i < curve.length; i++) curve.keys[i].value += amount; return curve; diff --git a/Exiled.API/Extensions/ItemExtensions.cs b/Exiled.API/Extensions/ItemExtensions.cs index 0fda1197e9..2aa7c90fc0 100644 --- a/Exiled.API/Extensions/ItemExtensions.cs +++ b/Exiled.API/Extensions/ItemExtensions.cs @@ -18,7 +18,7 @@ namespace Exiled.API.Extensions using InventorySystem; using InventorySystem.Items; using InventorySystem.Items.Firearms.Attachments; - + using InventorySystem.Items.Pickups; using Structs; /// @@ -96,6 +96,13 @@ public static ItemBase GetItemBase(this ItemType type) return itemBase; } + /// + /// Given an , returns the matching . + /// + /// The . + /// The , or if not found. + public static ItemPickupBase GetPickupBase(this ItemType type) => GetItemBase(type)?.PickupDropModel; + /// /// Given an , returns the matching , casted to . /// diff --git a/Exiled.API/Extensions/ReflectionExtensions.cs b/Exiled.API/Extensions/ReflectionExtensions.cs index a0da60351d..1725f5c9e5 100644 --- a/Exiled.API/Extensions/ReflectionExtensions.cs +++ b/Exiled.API/Extensions/ReflectionExtensions.cs @@ -40,10 +40,10 @@ public static void InvokeStaticMethod(this Type type, string methodName, object[ /// The event arguments. public static void InvokeStaticEvent(this Type type, string eventName, object[] param) { - var eventDelegate = (MulticastDelegate)type.GetField(eventName, AccessTools.all).GetValue(null); + MulticastDelegate eventDelegate = (MulticastDelegate)type.GetField(eventName, AccessTools.all).GetValue(null); if (eventDelegate != null) { - foreach (var handler in eventDelegate.GetInvocationList()) + foreach (Delegate handler in eventDelegate.GetInvocationList()) { handler.Method.Invoke(handler.Target, param); } diff --git a/Exiled.API/Features/Doors/CheckpointDoor.cs b/Exiled.API/Features/Doors/CheckpointDoor.cs index 34b5b91793..1e31e72aef 100644 --- a/Exiled.API/Features/Doors/CheckpointDoor.cs +++ b/Exiled.API/Features/Doors/CheckpointDoor.cs @@ -93,7 +93,7 @@ public float Health { float health = value / Subdoors.Count; - foreach (var door in Subdoors) + foreach (BreakableDoor door in Subdoors) { door.Health = health; } @@ -108,7 +108,7 @@ public float MaxHealth { float health = value / Subdoors.Count; - foreach (var door in Subdoors) + foreach (BreakableDoor door in Subdoors) { door.MaxHealth = health; } @@ -121,7 +121,7 @@ public DoorDamageType IgnoredDamage get => Subdoors.Aggregate(DoorDamageType.None, (current, door) => current | door.IgnoredDamage); set { - foreach (var door in Subdoors) + foreach (BreakableDoor door in Subdoors) { door.IgnoredDamage = value; } diff --git a/Exiled.API/Features/Effect.cs b/Exiled.API/Features/Effect.cs index dc38b21359..0f8474a24e 100644 --- a/Exiled.API/Features/Effect.cs +++ b/Exiled.API/Features/Effect.cs @@ -32,7 +32,7 @@ public Effect() /// Get all the information of the effect>. public Effect(StatusEffectBase statusEffectBase) { - if (statusEffectBase.TryGetEffectType(out EffectType effect)) + if (!statusEffectBase.TryGetEffectType(out EffectType effect)) Log.Error($"EffectType not found please report to Exiled BugReport : {statusEffectBase}"); Type = effect; Duration = statusEffectBase.Duration; diff --git a/Exiled.API/Features/Generator.cs b/Exiled.API/Features/Generator.cs index ca855c2384..b3f5bfb692 100644 --- a/Exiled.API/Features/Generator.cs +++ b/Exiled.API/Features/Generator.cs @@ -116,7 +116,7 @@ public bool IsActivating public bool IsOpen { get => Base.HasFlag(Base.Network_flags, Scp079Generator.GeneratorFlags.Open); - set => Base.ServerSetFlag(Scp079Generator.GeneratorFlags.Unlocked, value); + set => Base.ServerSetFlag(Scp079Generator.GeneratorFlags.Open, value); } /// diff --git a/Exiled.API/Features/Items/Scp244.cs b/Exiled.API/Features/Items/Scp244.cs index af79e9f337..9e88a53758 100644 --- a/Exiled.API/Features/Items/Scp244.cs +++ b/Exiled.API/Features/Items/Scp244.cs @@ -7,6 +7,7 @@ namespace Exiled.API.Features.Items { + using Exiled.API.Extensions; using Exiled.API.Features.Pickups; using Exiled.API.Interfaces; @@ -29,6 +30,10 @@ public Scp244(Scp244Item itemBase) : base(itemBase) { Base = itemBase; + Scp244DeployablePickup scp244Pickup = (Scp244DeployablePickup)Type.GetPickupBase(); + Health = scp244Pickup._health; + ActivationDot = scp244Pickup._activationDot; + MaxDiameter = scp244Pickup.MaxDiameter; } /// diff --git a/Exiled.API/Features/Player.cs b/Exiled.API/Features/Player.cs index f5eaadde53..39926ee2db 100644 --- a/Exiled.API/Features/Player.cs +++ b/Exiled.API/Features/Player.cs @@ -349,7 +349,7 @@ public string CustomInfo // NW Client check. if (value.Contains('<')) { - foreach (var token in value.Split('<')) + foreach (string token in value.Split('<')) { if (token.StartsWith("/", StringComparison.Ordinal) || token.StartsWith("b>", StringComparison.Ordinal) || @@ -736,7 +736,7 @@ public bool IsBypassModeEnabled /// This property will NOT persistently mute and unmute the player. For persistent mutes, see and . public bool IsMuted { - get => VoiceChatMutes.Mutes.Contains(UserId) && (VoiceChatMuteFlags.HasFlag(VcMuteFlags.GlobalRegular) || VoiceChatMuteFlags.HasFlag(VcMuteFlags.LocalRegular)); + get => VoiceChatMutes.QueryLocalMute(UserId, false); set { if (value) @@ -768,7 +768,7 @@ public bool IsGlobalMuted /// This property will NOT persistently mute and unmute the player. For persistent mutes, see and . public bool IsIntercomMuted { - get => VoiceChatMutes.Mutes.Contains(UserId) && (VoiceChatMuteFlags.HasFlag(VcMuteFlags.GlobalIntercom) || VoiceChatMuteFlags.HasFlag(VcMuteFlags.LocalIntercom)); + get => VoiceChatMutes.QueryLocalMute(UserId, true); set { if (value) @@ -2662,7 +2662,7 @@ public bool TryAddCandy(CandyKindID candyType) /// The new items that have to be added to the inventory. public void ResetInventory(IEnumerable newItems) { - ClearInventory(); + ClearItems(); foreach (ItemType item in newItems) AddItem(item); @@ -2674,7 +2674,7 @@ public void ResetInventory(IEnumerable newItems) /// The new items that have to be added to the inventory. public void ResetInventory(IEnumerable newItems) { - ClearInventory(); + ClearItems(); foreach (Item item in newItems) AddItem(item); @@ -2702,6 +2702,9 @@ public void ClearInventory(bool destroy = true) /// public void ClearItems(bool destroy = true) { + if (CurrentArmor is not null) + CurrentArmor.RemoveExcessOnDrop = true; + while (Items.Count > 0) RemoveItem(Items.ElementAt(0), destroy); } diff --git a/Exiled.API/Features/Ragdoll.cs b/Exiled.API/Features/Ragdoll.cs index 47c3e10dc2..9d73104fed 100644 --- a/Exiled.API/Features/Ragdoll.cs +++ b/Exiled.API/Features/Ragdoll.cs @@ -28,6 +28,8 @@ namespace Exiled.API.Features using UnityEngine; + using BaseScp3114Ragdoll = PlayerRoles.PlayableScps.Scp3114.Scp3114Ragdoll; + using Object = UnityEngine.Object; /// @@ -298,11 +300,12 @@ public static bool TryCreate(RagdollData networkInfo, out Ragdoll ragdoll) basicRagdoll.NetworkInfo = networkInfo; - ragdoll = new(basicRagdoll) + ragdoll = basicRagdoll is BaseScp3114Ragdoll scp3114Ragdoll ? new Scp3114Ragdoll(scp3114Ragdoll) : new Ragdoll(basicRagdoll) { Position = networkInfo.StartPosition, Rotation = networkInfo.StartRotation, }; + return true; } @@ -377,7 +380,7 @@ public static Ragdoll CreateAndSpawn(RoleTypeId roleType, string name, string de /// The to get. /// A or if not found. public static Ragdoll Get(BasicRagdoll ragdoll) => ragdoll == null ? null : - BasicRagdollToRagdoll.TryGetValue(ragdoll, out Ragdoll doll) ? doll : new Ragdoll(ragdoll); + BasicRagdollToRagdoll.TryGetValue(ragdoll, out Ragdoll doll) ? doll : ragdoll is BaseScp3114Ragdoll scp3114Ragdoll ? new Scp3114Ragdoll(scp3114Ragdoll) : new Ragdoll(ragdoll); /// /// Gets the of belonging to the , if any. diff --git a/Exiled.API/Features/Roles/Scp079Role.cs b/Exiled.API/Features/Roles/Scp079Role.cs index f97ee97bcc..8782137a7f 100644 --- a/Exiled.API/Features/Roles/Scp079Role.cs +++ b/Exiled.API/Features/Roles/Scp079Role.cs @@ -588,7 +588,7 @@ public void ActivateTesla(bool consumeEnergy = true) Scp079Camera cam = CurrentCameraSync.CurrentCamera; RewardManager.MarkRoom(cam.Room); - if (!TeslaGateController.Singleton.TeslaGates.TryGetFirst(x => RoomIdUtils.IsTheSameRoom(cam.Position, x.transform.position), out var teslaGate)) + if (!TeslaGateController.Singleton.TeslaGates.TryGetFirst(x => RoomIdUtils.IsTheSameRoom(cam.Position, x.transform.position), out global::TeslaGate teslaGate)) return; if (consumeEnergy) diff --git a/Exiled.API/Features/Scp3114Ragdoll.cs b/Exiled.API/Features/Scp3114Ragdoll.cs new file mode 100644 index 0000000000..494ec7cdc7 --- /dev/null +++ b/Exiled.API/Features/Scp3114Ragdoll.cs @@ -0,0 +1,78 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.API.Features +{ + using Exiled.API.Interfaces; + using PlayerRoles; + + using BaseScp3114Ragdoll = PlayerRoles.PlayableScps.Scp3114.Scp3114Ragdoll; + + /// + /// A wrapper for SCP-3114 ragdolls. + /// + public class Scp3114Ragdoll : Ragdoll, IWrapper + { + /// + /// Initializes a new instance of the class. + /// + /// The base ragdoll to wrap. + internal Scp3114Ragdoll(BaseScp3114Ragdoll ragdoll) + : base(ragdoll) + { + Base = ragdoll; + } + + /// + public new BaseScp3114Ragdoll Base { get; } + + /// + /// Gets or sets the role that the corpse is disguised as. + /// + public RoleTypeId DisguiseRole + { + get => Base._disguiseRole; + set => Base.Network_disguiseRole = value; + } + + /// + /// Gets or sets the delay between when SCP-3114 can disguise this corpse. + /// + public float RevealDelay + { + get => Base._revealDelay; + set => Base._revealDelay = value; + } + + /// + /// Gets or sets the time required to reveal this corpse. + /// + public float RevealDuration + { + get => Base._revealDuration; + set => Base._revealDuration = value; + } + + /// + /// Gets or sets the current time of revealing this corpse. + /// + public float RevealElapsed + { + get => Base._revealElapsed; + set => Base._revealElapsed = value; + } + + /// + /// Gets or sets a value indicating whether or not this corpse will trigger animation. + /// + public bool IsPlayingAnimation + { + get => Base._playingAnimation; + set => Base._playingAnimation = value; + } + } +} \ No newline at end of file diff --git a/Exiled.CustomItems/API/Features/CustomGrenade.cs b/Exiled.CustomItems/API/Features/CustomGrenade.cs index 24906352c2..bb818ad7b0 100644 --- a/Exiled.CustomItems/API/Features/CustomGrenade.cs +++ b/Exiled.CustomItems/API/Features/CustomGrenade.cs @@ -74,12 +74,12 @@ public virtual Pickup Throw(Vector3 position, float force, float weight, float f player = Server.Host; player.Role.Is(out FpcRole fpcRole); - var velocity = fpcRole.FirstPersonController.FpcModule.Motor.Velocity; + Vector3 velocity = fpcRole.FirstPersonController.FpcModule.Motor.Velocity; Throwable throwable = (Throwable)Item.Create(grenadeType, player); ThrownProjectile thrownProjectile = Object.Instantiate(throwable.Base.Projectile, position, throwable.Owner.CameraTransform.rotation); - Transform transform = thrownProjectile.transform; + PickupSyncInfo newInfo = new() { ItemId = throwable.Type, diff --git a/Exiled.CustomItems/API/Features/CustomWeapon.cs b/Exiled.CustomItems/API/Features/CustomWeapon.cs index 7b3ce94054..b849701f35 100644 --- a/Exiled.CustomItems/API/Features/CustomWeapon.cs +++ b/Exiled.CustomItems/API/Features/CustomWeapon.cs @@ -9,6 +9,7 @@ namespace Exiled.CustomItems.API.Features { using System; + using Exiled.API.Enums; using Exiled.API.Extensions; using Exiled.API.Features; using Exiled.API.Features.DamageHandlers; @@ -18,7 +19,7 @@ namespace Exiled.CustomItems.API.Features using InventorySystem.Items.Firearms.Attachments; using InventorySystem.Items.Firearms.Attachments.Components; - + using InventorySystem.Items.Firearms.BasicMessages; using UnityEngine; using Firearm = Exiled.API.Features.Items.Firearm; @@ -75,7 +76,6 @@ public override ItemType Type firearm.AddAttachment(Attachments); firearm.Ammo = ClipSize; - firearm.MaxAmmo = ClipSize; Pickup? pickup = firearm.CreatePickup(position); @@ -103,7 +103,6 @@ public override ItemType Type firearm.AddAttachment(Attachments); byte ammo = firearm.Ammo; - firearm.MaxAmmo = ClipSize; Log.Debug($"{nameof(Name)}.{nameof(Spawn)}: Spawning weapon with {ammo} ammo."); Pickup? pickup = firearm.CreatePickup(position); pickup.Scale = Scale; @@ -129,7 +128,6 @@ public override void Give(Player player, bool displayMessage = true) firearm.AddAttachment(Attachments); firearm.Ammo = ClipSize; - firearm.MaxAmmo = ClipSize; } Log.Debug($"{nameof(Give)}: Adding {item.Serial} to tracker."); @@ -196,7 +194,7 @@ protected virtual void OnHurting(HurtingEventArgs ev) private void OnInternalReloading(ReloadingWeaponEventArgs ev) { - if (!Check(ev.Firearm)) + if (!Check(ev.Player.CurrentItem)) return; Log.Debug($"{nameof(Name)}.{nameof(OnInternalReloading)}: Reloading weapon. Calling external reload event.."); @@ -209,7 +207,39 @@ private void OnInternalReloading(ReloadingWeaponEventArgs ev) return; } - ev.Firearm.MaxAmmo = ClipSize; + Log.Debug($"{nameof(Name)}.{nameof(OnInternalReloading)}: Continuing with internal reload.."); + ev.IsAllowed = false; + + byte remainingClip = ((Firearm)ev.Player.CurrentItem).Ammo; + + if (remainingClip >= ClipSize) + return; + + Log.Debug($"{ev.Player.Nickname} ({ev.Player.UserId}) [{ev.Player.Role}] is reloading a {Name} ({Id}) [{Type} ({remainingClip}/{ClipSize})]!"); + + AmmoType ammoType = ev.Firearm.AmmoType; + + if (!ev.Player.Ammo.ContainsKey(ammoType.GetItemType())) + { + Log.Debug($"{nameof(Name)}.{nameof(OnInternalReloading)}: {ev.Player.Nickname} does not have ammo to reload this weapon."); + return; + } + + ev.Player.Connection.Send(new RequestMessage(ev.Firearm.Serial, RequestType.Reload)); + + byte amountToReload = (byte)Math.Min(ClipSize - remainingClip, ev.Player.Ammo[ammoType.GetItemType()]); + + if (amountToReload <= 0) + return; + + ev.Player.ReferenceHub.playerEffectsController.GetEffect().Intensity = 0; + + ev.Player.Ammo[ammoType.GetItemType()] -= amountToReload; + ev.Player.Inventory.SendAmmoNextFrame = true; + + ((Firearm)ev.Player.CurrentItem).Ammo = (byte)(((Firearm)ev.Player.CurrentItem).Ammo + amountToReload); + + Log.Debug($"{ev.Player.Nickname} ({ev.Player.UserId}) [{ev.Player.Role}] reloaded a {Name} ({Id}) [{Type} ({((Firearm)ev.Player.CurrentItem).Ammo}/{ClipSize})]!"); } private void OnInternalShooting(ShootingEventArgs ev) @@ -280,4 +310,4 @@ private void OnInternalHurting(HurtingEventArgs ev) OnHurting(ev); } } -} +} \ No newline at end of file diff --git a/Exiled.Events/Events.cs b/Exiled.Events/Events.cs index af40330c7d..fee31f0c9d 100644 --- a/Exiled.Events/Events.cs +++ b/Exiled.Events/Events.cs @@ -60,7 +60,7 @@ public override void OnEnabled() SceneManager.sceneUnloaded += Handlers.Internal.SceneUnloaded.OnSceneUnloaded; MapGeneration.SeedSynchronizer.OnMapGenerated += Handlers.Internal.MapGenerated.OnMapGenerated; - UsableItemsController.ServerOnUsingCompleted += (hub, usable) => Handlers.Player.OnUsedItem(new(hub, usable)); + UsableItemsController.ServerOnUsingCompleted += Handlers.Internal.Round.OnServerOnUsingCompleted; Handlers.Server.WaitingForPlayers += Handlers.Internal.Round.OnWaitingForPlayers; Handlers.Server.RestartingRound += Handlers.Internal.Round.OnRestartingRound; Handlers.Server.RoundStarted += Handlers.Internal.Round.OnRoundStarted; @@ -91,8 +91,8 @@ public override void OnDisabled() Unpatch(); SceneManager.sceneUnloaded -= Handlers.Internal.SceneUnloaded.OnSceneUnloaded; - MapGeneration.SeedSynchronizer.OnMapGenerated -= Handlers.Map.OnGenerated; - + MapGeneration.SeedSynchronizer.OnMapGenerated -= Handlers.Internal.MapGenerated.OnMapGenerated; + UsableItemsController.ServerOnUsingCompleted -= Handlers.Internal.Round.OnServerOnUsingCompleted; Handlers.Server.WaitingForPlayers -= Handlers.Internal.Round.OnWaitingForPlayers; Handlers.Server.RestartingRound -= Handlers.Internal.Round.OnRestartingRound; Handlers.Server.RoundStarted -= Handlers.Internal.Round.OnRoundStarted; diff --git a/Exiled.Events/Handlers/Internal/Round.cs b/Exiled.Events/Handlers/Internal/Round.cs index 4861c30b64..5409fa67c9 100644 --- a/Exiled.Events/Handlers/Internal/Round.cs +++ b/Exiled.Events/Handlers/Internal/Round.cs @@ -16,7 +16,7 @@ namespace Exiled.Events.Handlers.Internal using Exiled.Loader.Features; using InventorySystem; - + using InventorySystem.Items.Usables; using PlayerRoles; using PlayerRoles.RoleAssign; @@ -25,6 +25,9 @@ namespace Exiled.Events.Handlers.Internal /// internal static class Round { + /// + public static void OnServerOnUsingCompleted(ReferenceHub hub, UsableItem usable) => Handlers.Player.OnUsedItem(new (hub, usable)); + /// public static void OnWaitingForPlayers() { diff --git a/Exiled.Events/Patches/Events/Map/ChangingIntoGrenade.cs b/Exiled.Events/Patches/Events/Map/ChangingIntoGrenade.cs index 5b806d5b10..397fbe7dbc 100644 --- a/Exiled.Events/Patches/Events/Map/ChangingIntoGrenade.cs +++ b/Exiled.Events/Patches/Events/Map/ChangingIntoGrenade.cs @@ -118,7 +118,7 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); diff --git a/Exiled.Events/Patches/Events/Scp0492/Consuming.cs b/Exiled.Events/Patches/Events/Scp0492/Consuming.cs index 2ce3292069..0c41900407 100644 --- a/Exiled.Events/Patches/Events/Scp0492/Consuming.cs +++ b/Exiled.Events/Patches/Events/Scp0492/Consuming.cs @@ -65,7 +65,7 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); diff --git a/Exiled.Events/Patches/Events/Scp106/Teleporting.cs b/Exiled.Events/Patches/Events/Scp106/Teleporting.cs index dafd80ca0f..f5d4aa9a39 100644 --- a/Exiled.Events/Patches/Events/Scp106/Teleporting.cs +++ b/Exiled.Events/Patches/Events/Scp106/Teleporting.cs @@ -82,7 +82,7 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); diff --git a/Exiled.Installer/CommandSettings.cs b/Exiled.Installer/CommandSettings.cs index e65fadde43..f8fae601d4 100644 --- a/Exiled.Installer/CommandSettings.cs +++ b/Exiled.Installer/CommandSettings.cs @@ -168,7 +168,7 @@ internal sealed class CommandSettings /// public bool Exit { get; set; } - public async static Task Parse(string[] args) + public static async Task Parse(string[] args) { RootCommand.Handler = CommandHandler.Create(async args => await Program.MainSafe(args).ConfigureAwait(false)); RootCommand.TreatUnmatchedTokensAsErrors = false; diff --git a/Exiled.Installer/Program.cs b/Exiled.Installer/Program.cs index 1010e2098d..506bce5c4b 100644 --- a/Exiled.Installer/Program.cs +++ b/Exiled.Installer/Program.cs @@ -55,13 +55,13 @@ internal static class Program // Force use of LF because the file uses LF private static readonly Dictionary Markup = Resources.Markup.Trim().Split('\n').ToDictionary(s => s.Split(':')[0], s => s.Split(':', 2)[1]); - private async static Task Main(string[] args) + private static async Task Main(string[] args) { Console.OutputEncoding = new UTF8Encoding(false, false); await CommandSettings.Parse(args).ConfigureAwait(false); } - internal async static Task MainSafe(CommandSettings args) + internal static async Task MainSafe(CommandSettings args) { bool error = false; try @@ -111,10 +111,8 @@ internal async static Task MainSafe(CommandSettings args) Console.WriteLine(Resources.Program_MainSafe_Asset_found_); Console.WriteLine(FormatAsset(exiledAsset)); - using HttpClient httpClient = new() - { - Timeout = TimeSpan.FromSeconds(SecondsWaitForDownload), - }; + using HttpClient httpClient = new(); + httpClient.Timeout = TimeSpan.FromSeconds(SecondsWaitForDownload); httpClient.DefaultRequestHeaders.Add("User-Agent", Header); using HttpResponseMessage downloadResult = await httpClient.GetAsync(exiledAsset.BrowserDownloadUrl).ConfigureAwait(false); @@ -144,12 +142,12 @@ internal async static Task MainSafe(CommandSettings args) Environment.Exit(error ? 1 : 0); } - private async static Task> GetReleases() + private static async Task> GetReleases() { IEnumerable releases = (await GitHubClient.Repository.Release.GetAll(RepoID).ConfigureAwait(false)) .Where( r => Version.TryParse(r.TagName, out Version version) - && (version > VersionLimit)); + && version > VersionLimit); return releases.OrderByDescending(r => r.CreatedAt.Ticks); } @@ -267,7 +265,8 @@ static PathResolution TryParse(string s) { return TryParse(pair.Value); } - else if (!fileInFolder && !isFolder && + + if (!fileInFolder && !isFolder && pair.Key.Equals(fileName, StringComparison.OrdinalIgnoreCase)) { return TryParse(pair.Value); @@ -280,20 +279,27 @@ static PathResolution TryParse(string s) private static Release FindRelease(CommandSettings args, IEnumerable releases) { Console.WriteLine(Resources.Program_TryFindRelease_Trying_to_find_release__); - Version targetVersion = args.TargetVersion is not null ? new Version(args.TargetVersion) : new Version(releases.First().TagName); + Version? targetVersion = args.TargetVersion is not null ? new Version(args.TargetVersion) : null; - foreach (Release r in releases) - { - if (targetVersion != new Version(r.TagName)) - continue; + List enumerable = releases.ToList(); - if (targetVersion.IsPreRelease && !args.PreReleases) - continue; + foreach (Release release in enumerable) + { + if (targetVersion != null) + { + if (targetVersion == new Version(release.TagName)) + return release; + } + else + { + if (release.Prerelease && !args.PreReleases) + continue; - return r; + return release; + } } - return releases.First(); + return enumerable.First(); } } } \ No newline at end of file From 43a10a0bcb2b17aa13dbe2d7ba480df375ab7527 Mon Sep 17 00:00:00 2001 From: louis1706 Date: Sat, 13 Jan 2024 22:44:32 +0100 Subject: [PATCH 003/141] 8.7.0 --- EXILED.props | 2 +- docs/docs/Resources/Intro.md | 24 ++++++++++++------------ 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/EXILED.props b/EXILED.props index 9271862ac3..13849fa582 100644 --- a/EXILED.props +++ b/EXILED.props @@ -15,7 +15,7 @@ - 8.4.3 + 8.7.0 false diff --git a/docs/docs/Resources/Intro.md b/docs/docs/Resources/Intro.md index e75dfa1109..c502cc02a6 100644 --- a/docs/docs/Resources/Intro.md +++ b/docs/docs/Resources/Intro.md @@ -136,7 +136,7 @@ sidebar_position: 1
Ammo -```md title="Latest Updated: 8.4.3.0" +```md title="Latest Updated: 8.7.0.0" [0] None [1] Nato556 [2] Nato762 @@ -151,7 +151,7 @@ sidebar_position: 1
Doors -```md title="Latest Updated: 8.4.3.0" +```md title="Latest Updated: 8.7.0.0" [0] UnknownDoor [1] Scp914Door [2] GR18Inner @@ -220,7 +220,7 @@ sidebar_position: 1
Rooms -```md title="Latest Updated: 8.4.3.0" +```md title="Latest Updated: 8.7.0.0" [0] Unknown [1] LczArmory [2] LczCurve @@ -283,7 +283,7 @@ sidebar_position: 1
Elevators -```md title="Latest Updated: 8.4.3.0" +```md title="Latest Updated: 8.7.0.0" [0] Unknown [1] GateA [2] GateB @@ -299,7 +299,7 @@ sidebar_position: 1
DamageType -```md title="Latest Updated: 8.4.3.0" +```md title="Latest Updated: 8.7.0.0" [0] Unknown [1] Falldown [2] Warhead @@ -381,7 +381,7 @@ PlayerStatsSystem::Scp018DamageHandler : AttackerDamageHandler
Effects -```md title="Latest Updated: 8.4.3.0" +```md title="Latest Updated: 8.7.0.0" [-1] None [0] AmnesiaItems [1] AmnesiaVision @@ -432,7 +432,7 @@ PlayerStatsSystem::Scp018DamageHandler : AttackerDamageHandler
Keycard Perms -```md title="Latest Updated: 8.4.3.0" +```md title="Latest Updated: 8.7.0.0" [0] None [1] Checkpoints [2] ExitGates @@ -453,7 +453,7 @@ PlayerStatsSystem::Scp018DamageHandler : AttackerDamageHandler
Lock Type -```md title="Latest Updated: 8.4.3.0" +```md title="Latest Updated: 8.7.0.0" [0] None [1] Regular079 [2] Lockdown079 @@ -488,7 +488,7 @@ PlayerStatsSystem::Scp018DamageHandler : AttackerDamageHandler
Blood -```md title="Latest Updated: 8.4.3.0" +```md title="Latest Updated: 8.7.0.0" [0] Default [1] Scp106 [2] Spreaded @@ -501,7 +501,7 @@ PlayerStatsSystem::Scp018DamageHandler : AttackerDamageHandler
GeneratorState -```md title="Latest Updated: 8.4.3.0" +```md title="Latest Updated: 8.7.0.0" [1] None [2] Unlocked [4] Open @@ -543,7 +543,7 @@ PlayerStatsSystem::Scp018DamageHandler : AttackerDamageHandler
Attachment Names -```md title="Latest Updated: 8.4.3.0" +```md title="Latest Updated: 8.7.0.0" [0] None [1] IronSights [2] DotSight @@ -598,7 +598,7 @@ PlayerStatsSystem::Scp018DamageHandler : AttackerDamageHandler
Spawn Reasons -```md title="Latest Updated: 8.4.3.0" +```md title="Latest Updated: 8.7.0.0" [0] None [1] RoundStart [2] LateJoin From 63dccddb3c65142197b3bef823bb47ae0c474023 Mon Sep 17 00:00:00 2001 From: 1EnesBaturKaza <156574288+1EnesBaturKaza@users.noreply.github.com> Date: Mon, 15 Jan 2024 19:00:53 +0300 Subject: [PATCH 004/141] TR Localization (#2388) Added Turkish Support for README Localizations --- Localization/README-TR.md | 151 ++++++++++++++++++++++++++++++++++++++ README.md | 1 + 2 files changed, 152 insertions(+) create mode 100644 Localization/README-TR.md diff --git a/Localization/README-TR.md b/Localization/README-TR.md new file mode 100644 index 0000000000..608846fcf1 --- /dev/null +++ b/Localization/README-TR.md @@ -0,0 +1,151 @@ +# EXILED - EXtended In-runtime Library for External Development + +![EXILED CI](https://github.com/Exiled-Team/EXILED/actions/workflows/main.yml/badge.svg?branch=master) + + GitHub Releases + +![Github All Downloads](https://img.shields.io/github/downloads/Exiled-Team/EXILED/total.svg?style=flat) +![Github Commits](https://img.shields.io/github/commit-activity/w/Exiled-Team/EXILED/dev) + + Chat on Discord + + + +EXILED, SCP: Secret Laboratory sunucuları için yüksek düzeyde bir Framework yani bir eklenti çerçevesidir. Geliştiricilere oyun kodunu değiştirmek veya kendi fonksiyonlarını eklemek için kullanabilecekleri bir olay sistemi sunar. Tüm EXILED eventleri(olayları) Harmony kullanılarak oluşturulmuştur, bu da demek oluyor ki eventlerin(olayların) işlevsel olabilmesi için doğrudan sunucu kodunu değiştirmenize gerek yoktur ve bu durum 2 avantaj sağlar: + + - İlk olarak. Framework (Yazılım iskeleti)'nin özgürce yayımlanabilir ve dağıtalabilir, buda geliştiricilere nasıl çalıştığını daha iyi anlama imkanını sunar ve ek olarak fonksiyonları ekleme, değiştirme yapmalarına olanak tanır. + - İkinci olarak, Framework (Yazılım iskeleti) tüm kodun, sunucu kodunun dışına çıktığı için küçük oyun güncellemeleri Framework (Yazılım iskeleti)'ne çok az etki yapar, ve eğer gerek varsa güncelleme yapılması kolaylaşır. + + +# İndirme +EXILED'i indirmek oldukça kolaydır. EXILED kendini Northwood'un Plugin API'si üzerinden yükler, bu nedenle ``Exiled.tar.gz`` dosyasının içinde iki klasör bulunmaktadır. ``SCP Secret Laboratory`` dosyasının içinde, ``EXILED`` klasöründeki eklentileri yüklemek için gerekli dosyalar bulunur. Yapmanız gereken tek şey bu iki dosyayı doğru konuma yerleştirmektir. Bu nasıl yapılacağı aşağıda belirtilmiştir. + +Eğer kurulum programını kullanmayı seçerseniz ve doğru bir şekilde çalıştırırsanız, bütün EXILED özelliklerini yüklemekle ilgili işlemleri otomatik olarak gerçekleştirir. + +# Windows +### Otomatik indirme ([Daha fazla bilgi için bana tıkla](https://github.com/Exiled-Team/EXILED/blob/master/Exiled.Installer/README.md)) +**Not**: Sunucuyu indirdiğin kullanıcıda olduğundan emin ol veya yönetici olduğundan emin ol. + + - **`Exiled.Installer-Win.exe`'i [Buradan indir](https://github.com/Exiled-Team/EXILED/releases)** (Assets'e tıkla -> Installer'ı indir) + - İndirdiğinizde sunucu klasörünüze yerleştirin. (Eğer indirmediyseniz, sunucuyu indirin.) + - **`Exiled.Installer.exe`**'e iki kere tıkla ve aç veya **[bana tıklayarak .bat'ı indir](https://www.dropbox.com/s/xny4xus73ze6mq9/install-prerelease.bat?dl=1)** En son ön yayınını yüklemek için sunucu klasörünün içine koy. + - Eklenti indirmek için [Installing plugins](#Eklenti-İndirme) Kısmına göz gezdir. +**Not:** eğer EXILED'i uzaktan bağlantılı olan bir sunucuya indiriyor iseniz .exeyi Sunucu açtığınız kullanıcı ile aynı olduğundan emin oluyon veya Yönetici izinleri verin. + +### Manuel indirme + - **`Exiled.tar.gz` ['yi buradan indir](https://github.com/Exiled-Team/EXILED/releases)** + - İçeriğini [7Zip](https://www.7-zip.org/) veya [WinRar](https://www.win-rar.com/download.html?&L=6) ile çıkartın. + - **``EXILED``** Klasörünü **`%appdata%`** ya taşıyın *Not: Bu klasör ``C:\Users\(Kullanıcı_ismi)\AppData\Roaming``, ve ``C:\Users\(Kullanıcı_ismi)\AppData\Roaming\SCP Secret Laboratory``**'nin içinde değil!**, ve (...)\AppData\Roaming'**de olması zorunludur**. (...)\AppData*'YA DEĞİL! + - **``SCP Secret Laboratory``**Klasörünü **`%appdata%`**'ya taşı. + - Windows 10 ve 11: + Cortanaya / Arama simgesine veya Windows Explorer çubuğuna `%appdata%` yazın. + - Diğer windows sürümleri + Win + R tuşlarına basın ve `%appdata%` yazın. + +### Eklenti İndirme +Bu kadar, EXILED şimdi sunucunuzda kuruldu ve bir sonraki sunucu başladığında aktif olmalıdır. Unutmayın ki EXILED kendi başına neredeyse hiçbir şey yapmaz, bu yüzden yeni eklentileri **[Discord](https://discord.gg/PyUkWTg)** sunucumuzdan almayı unutmayın. +- Bir Eklenti indirmek için aşağıdaki talimatları okuyun: + - Bir eklentiyi indirmek için [*Onun* releases (yayınlanma) sayfasına gidin](https://i.imgur.com/u34wgPD.jpg) (**`.dll` UZANTILI OLMALIDIR**) + - İndirdiğiniz eklentiyi: ``C:\Users\(Kullanıcı_ismi)\AppData\Roaming\EXILED\Plugins``'dizinine taşıyın (Win + R Tuşlarına basarak `%appdata%` yazarak buraya taşıyabilirsiniz) + +# Linux +### Otomatik indirme ([daha fazla bilgi](https://github.com/Exiled-Team/EXILED/blob/master/Exiled.Installer/README.md)) + +**Not:** EXILED'i uzaktan bağlanılan bir sunucuya indiriyor iseniz, indirme programını sunucuyu kurduğunuz kullanıcı ile açın veya (root) yetkiniz olması gerekir. + + - **`Exiled.Installer-Linux`'i [Buradan indir](https://github.com/Exiled-Team/EXILED/releases)** (Assets'e tıkla -> Installer'ı indir) + - Ya **`./Exiled.Installer-Linux --path /sunucuya/giden/klasor`** Yazarak ya da doğrudan sunucu klasörüne taşıyarak ve ardından terminalde (`cd` kullanarak) şu komutu yazarak yükleyin: **`./Exiled.Installer-Linux`**. + - eğer en yeni ön yayını istiyor iseniz **`--pre-releases`** ekle. Örnek: **`./Exiled.Installer-Linux /sunucuya/giden/klasor --pre-releases`** + - Başka bir örnek: `eğer Exiled.Installer-Linux` dosyası sunucu klasörüne yerleştirdiyseniz `/sunucuya/giden/klasor/Exiled.Installer-Linux --pre-releases` + - Eklenti indirmek için [Bana tıkla ve göz gezdir!](#Eklenti-Indirme) + +### Manuel indirme + - SCP sunucusunu açan kullanıcı olduğundan **Emin** ol + - **`Exiled.tar.gz` ['yi buradan indir](https://github.com/Exiled-Team/EXILED/releases)** (SSH: sağ tık yap ve `Exiled.tar.gz`'nin bağlantısını al, ve **`wget (bağlantı)`** Komudunu yazın.) + - Bulunduğunuz klasöre çıkartmak için **``tar -xzvf EXILED.tar.gz``** Komudunu yazın. + - **`EXILED`** Klasörünü **``~/.config``**'e taşı. *Not: Bu klasör ``~/.config``'e gitmeli, ``~/.config/SCP Secret Laboratory``**'nin içine değil!** (SSH: **`mv EXILED ~/.config/`**) + - **`SCP Secret Laboratory`** Klasörünü **``~/.config``**'e taşı. *Not: Bu klasör ``~/.config``'nin içine gitmelidir, ``~/.config/SCP Secret Laboratory``**'nin içine değil!** (SSH: **`mv SCP Secret Laboratory ~/.config/`**) + +### Eklenti Indirme +Bu kadar, EXILED şimdi sunucunuzda kuruldu ve bir sonraki sunucu başladığında aktif olmalıdır. Unutmayın ki EXILED kendi başına neredeyse hiçbir şey yapmaz, bu yüzden yeni eklentileri **[Discord](https://discord.gg/PyUkWTg)** sunucumuzdan almayı unutmayın. +- Bir Eklenti indirmek için aşağıdaki talimatları okuyun: + - Bir eklentiyi indirmek için [*Onun* releases (yayınlanma) sayfasına gidin](https://i.imgur.com/u34wgPD.jpg) (**`.dll` UZANTILI OLMALIDIR**) + - İndirdiğiniz Eklentiyi: ``~/.config/EXILED/Plugins``'dizininine taşıyın (eğer SSH'yi root olarak kullanıyor iseniz, o zaman doğru `.config`'i `/home/(SCP Server User)` dizininin içinde arayın.) + +# Config +EXILED kendi başına bazı yapılandırma seçenekleri sunar. +Bunların hepsi sunucu açıldığı zaman otomatik olarak yapılır, Bunlar şuradadır Linuxda: ``~/.config/EXILED/Configs/(serverportu)-config.yml`` Windows için: (``%AppData%\EXILED\Configs\(serverportu)-config.yml``). + +Eklenti Configleri(Yapılandırma seçenekleri) ``config_gameplay.txt`` Dosyasında **değildir** Onun yerine eklenti seçeneklieri Linuxda: ``~/.config/EXILED/Configs/(serverportu)-config.yml`` Windows için: (``%AppData%\EXILED\(serverportu)-config.yml``). +Ancak, bazı eklentiler kendi başlarına diğer yerlerden yapılandırma/ayarları alabilir. Bu klasör genellikle eklenti ayarlarının/bağlantılarının bulunduğu yerdir. Hatalar varsa lütfen ilgili eklenti geliştiricisine başvurun. + +# Geliştiriciler içib + +Eğer EXILED için bir eklenti yapmak istiyorsanız, bunu yapmak oldukça basittir [Daha fazla bilgi için bana tıkla!](https://github.com/Exiled-Team/EXILED/blob/master/GettingStarted.md). + +Daha kapsamlı ve sürekli güncellenen öğreticiler için [EXILED websitesine](https://exiled-team.github.io/EXILED/articles/install.html) göz atın. + +Ama pluginlerini halka açık yaparken bu kuralları takip etmen lazım: + + - Eklentiniz ``Exiled.API.Features.Plugin<>`` sınıfından türetilmiş bir sınıf içermelidir; aksi halde EXILED sunucu başladığında eklentinizi yüklemeyecektir. + - Bir eklenti yüklendiğinde, yukarıda bahsedilen sınıfın ``OnEnabled()`` yöntemindeki kod hemen yürütülür; diğer eklentilerin yüklenmesini beklemez. Sunucu başlatma sürecinin tamamlanmasını beklemez. Hiçbir şeyi beklemez. ``OnEnabled()`` yönteminizi yaparken, sunucu henüz başlatılmamış olabilecek şeylere erişim sağlamadığınızdan emin olun, ÖRNEK: ServerConsole.Port veya PlayerManager.localPlayer vb... + - Eğer eklentiniz yüklendiğinde henüz başlatılmamış olan şeylere erişim sağlamanız gerekiyorsa, bunu yapmak için önerilen yol, bu işlemi gerçekleştirmek için ```WaitingForPlayers`` eventini(etkinliğini) beklemektir. Eğer daha erken bazı işlemler yapmanız gerekiyorsa, kodunuzu devam etmeden önce gerekli değişkenin/nesnenin null olmadığını kontrol eden bir ``while(!x)`` döngüsü içine almanız önerilir. + - EXILED, yürütme sırasında eklenti derlemelerini dinamik olarak yeniden yükleme işlemini destekler. Bu, bir eklentiyi güncellemeniz gerektiğinde sunucuyu yeniden başlatmadan yapılabilir. Ancak, yürütme sırasında bir eklentiyi güncelliyorsanız, eklentinin bunu desteklemesi gerekmektedir; aksi halde sorunlarla karşılaşabilirsiniz. Daha fazla bilgi ve takip edilmesi gereken kurallar için ``Dinamik Güncelleme`` bölümüne başvurun. + - EXILED'da OnUpdate, OnFixedUpdate veya OnLateUpdate eventi(etkinliği) ***Bulunmamaktadır!***, Eğer sık sık çalışan bir kod calıştırmanız gerekiyor ise bir MEC coroutine Kullanabilirsiniz ki bu bir frame, 0.01f bekler ya da Timing.FixedUpdate gibi bir Timing katmanı kullanabilirsiniz. + ### MEC Coroutines +If you are unfamiliar with MEC, this will be a very brief and simple primer to get you started. +MEC Coroutines are basically timed methods, that support waiting periods of time before continuing execution, without interrupting/sleeping the main game thread. +MEC coroutines are safe to use with Unity, unlike traditional threading. ***DO NOT try and make new threads to interact with Unity on, they WILL crash the server.*** + +To use MEC, you will need to reference ``Assembly-CSharp-firstpass.dll`` from the server files and include ``using MEC;``. +Example of calling a simple coroutine, that repeats itself with a delay between each loop: +```cs +using MEC; +using Exiled.API.Features; + +public void SomeMethod() +{ + Timing.RunCoroutine(MyCoroutine()); +} + +public IEnumerator MyCoroutine() +{ + for (;;) //aşağıdaki kodu sonsuza kadar çalıştır + { + Log.Info("ben bir döngüyüm!"); //Log.Info yu sunucu konsolunda bir satır yazmak için çağırıldı. + yield return Timing.WaitForSeconds(5f); //Bu coroutine'a 5 saniye beklemesini söyler, çünkü bu döngünün sonunda olduğu için, döngünün tekrarlanmasını etkili bir şekilde 5 saniye boyunca duraklatır. + } +} +``` + +Eğer MEC hakkında bilgi sahibi değilseniz ve daha fazla öğrenmek, tavsiye almak veya yardıma ihtiyacınız varsa, **kesinlikle** biraz Google'da araştırma yapmanız veya Discord'ta soru sormanız tavsiye edilir. Sorular, ne kadar 'saçma' olursa olsun, her zaman mümkün olan en yardımcı ve net şekilde cevaplanacaktır; bu, eklenti geliştiricilerinin daha iyi kod yazmalarına yardımcı olmak içindir. Daha iyi bir kod, herkes için daha iyidir. + +### Dinamik Güncelleme +EXILED, bir sunucu yeniden başlatma işlemine gerek olmadan eklenti derlemelerini dinamik olarak yeniden yükleme işlemini destekleyen bir Framework(Yazılım iskeleti)'dir. +Örneğin, sunucuyu sadece `Exiled.Events` eklentisiyle başlatırsanız ve yeni bir eklenti eklemek istiyorsanız, bu görevi tamamlamak için sunucuyu yeniden başlatmanıza gerek yoktur. Basitçe Remote Admin veya Sunucu Konsolu komutu olan ``reload plugins` komutunu kullanarak, önce yüklenmemiş olan yeni eklentiler dahil olmak üzere tüm EXILED eklentilerini yeniden yükleyebilirsiniz. + +Bu aynı zamanda eklentileri tamamen yeniden başlatmadan *güncelleme* yapmanıza da olanak tanır. Ancak, bunun düzgün bir şekilde gerçekleşmesi için eklenti geliştiricisi tarafından takip edilmesi gereken birkaç kılavuz bulunmaktadır: + +***Sunucu sahipleri için*** + - Eğer bir eklentiyi güncelliyor iseniz emin olunki derlemenin adı şu anda yüklü olan sürüm ile (varsa) aynı değildir. bu işlem eklentiyi yapan Geliştirici tarafından Dinamik Güncelleme özelliği gözetilerek yapılmış olması gerekir, sadece dosya adını değiştirmek işe yaramaz. + - Eğer eklenti dinamik güncellemeleri destekliyorsa, yeni sürümü "Plugins" klasörüne koyarken, aynı zamanda eski sürümü de klasörden kaldırdığınızdan emin olun. EXILED'ı yeniden yüklemeden önce bunu sağlamamak, birçok kötü duruma yol açabilir. + - Dinamik olarak bir eklentiyi güncellemenin ortaya çıkardığı herhangi bir sorun, yalnızca sizin ve ilgili eklentinin geliştiricisinin sorumluluğundadır. EXILED dinamik güncellemeleri tamamen destekler ve teşvik eder; ancak, hata ihtimali, sunucu sahibi veya eklenti geliştiricisi tarafından yanlış bir şeyler yapıldığında ortaya çıkabilir. Dinamik güncellemelerle ilgili bir hata bildirmeden önce, her iki tarafın da işlemi doğru bir şekilde gerçekleştirdiğini doğrulayın. + + ***Geliştiriciler için*** + + - Dinamik güncellemeleri desteklemek isteyen eklentiler, devre dışı bırakıldıklarında veya yeniden yüklendiklerinde bağlı oldukları tüm olaylardan aboneliklerini(Subscribe) iptal etmeye dikkat etmelidir. + - Özel Harmony yamaları(patch)'leri bulunan eklentiler, Harmony örneğinin adında bir değişken kullanmalı ve eklenti devre dışı bırakıldığında veya yeniden yüklendiğinde Harmony örneğini ``UnPatchAll()`` kullanarak iptal etmelidir. + - ``OnEnabled()`` içinde başlatılan herhangi bir coroutine, eklenti devre dışı bırakıldığında veya yeniden yüklendiğinde sonlandırılmalıdır / Bitirilmelidir. + +Bu işlemlerin hepsi, eklenti sınıfındaki ``OnReloaded()`` veya ``OnDisabled()`` yöntemlerinde gerçekleştirilebilir. EXILED eklentileri yeniden yüklediğinde, İlk olarak ``OnDisabled()``, ardından ``OnReloaded()``, daha sonra yeni derlemeleri yükler ve en son olarak ``OnEnabled()`` yöntemini çalıştırır. + + +Unutmayın ki: bu yeni derlemelerin olduğu anlamına gelir. Eğer aynı isimdeki bir derlemeyi başka bir Derleme ile değiştirir iseniz o derleme ***GÜNCELLENMEZ***. Bu, Global Assembly Cache (GAC) nedeniyledir. Eğer Önbellekte zaten var olan bir derlemeyi 'yüklemeye' çalışır iseniz her zaman önbellekteki derlemeyi kullanır + +Bu nedenle, eğer eklentiniz dinamik güncellemeleri destekliyorsa, her sürümü farklı bir derleme adıyla derlemelisiniz (dosyanın adını değiştirmek işe yaramaz). Ayrıca, eski derleme artık gerekli olmadığında "Silinmediği" için, olaylardan abonelik(Subscribe) iptal etmeyi, Harmony örneğinizi iptal etmeyi, coroutine'leri sonlandırmayı vb... unutmazsanız, bu kodun eski sürümü de yeni sürüm koduyla birlikte çalışmaya devam eder. Bu, gerçekleşmesine izin vermek için çok kötü bir fikirdir. + +Bu nedenle, dinamik güncellemeleri destekleyen eklentilerin bu yönergeleri takip etmeleri ***ZORUNLUDUR***; aksi halde potansiyel risk nedeniyle Discord sunucudan kaldırılabilirler. + +Her eklentinin dinamik güncellemeleri desteklemesi gerekmez. Eğer dinamik güncellemeleri desteklemeyi planlamıyorsanız, bu tamamen uygun bir durumdur. Sadece yeni bir sürüm oluştururken eklentinizin derleme adını değiştirmekten kaçının. Bu tür durumlarda, sunucu sahiplerinin eklentinizi güncellemek için sunucularını tamamen yeniden başlatmaları gerektiğini bildirin. + +çeviri: Enes Batur (_funnyman_xdxdxd.rofl.) \ No newline at end of file diff --git a/README.md b/README.md index 3f063ced5f..18e9f75684 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,7 @@ All EXILED events are coded with Harmony, meaning they require no direct editing - [Italiano](https://github.com/Exiled-Team/EXILED/blob/master/Localization/README-IT.md) - [Čeština](https://github.com/Exiled-Team/EXILED/blob/master/Localization/README-CS.md) - [Dansk](https://github.com/Exiled-Team/EXILED/blob/master/Localization/README-DK.md) +- [Türkçe](https://github.com/Exiled-Team/EXILED/blob/master/Localization/README-TR.md) # Installation Installation of EXILED is quite simple. It loads itself through Northwood’s Plugin API. That's why there are two folders inside the ``Exiled.tar.gz`` in release files. ``SCP Secret Laboratory`` contains the necessary files to load EXILED features in ``EXILED`` folder. All you need to do is move these two folders into the appropriate path, which are explained below, and you are done! From f7d9b52de82d83c50ba68f56b1738724e7eb25cd Mon Sep 17 00:00:00 2001 From: 1EnesBaturKaza <156574288+1EnesBaturKaza@users.noreply.github.com> Date: Mon, 15 Jan 2024 23:02:35 +0300 Subject: [PATCH 005/141] forgor to translate MEC (#2391) yes --- Localization/README-TR.md | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Localization/README-TR.md b/Localization/README-TR.md index 608846fcf1..96c6a19c30 100644 --- a/Localization/README-TR.md +++ b/Localization/README-TR.md @@ -92,13 +92,15 @@ Ama pluginlerini halka açık yaparken bu kuralları takip etmen lazım: - Eğer eklentiniz yüklendiğinde henüz başlatılmamış olan şeylere erişim sağlamanız gerekiyorsa, bunu yapmak için önerilen yol, bu işlemi gerçekleştirmek için ```WaitingForPlayers`` eventini(etkinliğini) beklemektir. Eğer daha erken bazı işlemler yapmanız gerekiyorsa, kodunuzu devam etmeden önce gerekli değişkenin/nesnenin null olmadığını kontrol eden bir ``while(!x)`` döngüsü içine almanız önerilir. - EXILED, yürütme sırasında eklenti derlemelerini dinamik olarak yeniden yükleme işlemini destekler. Bu, bir eklentiyi güncellemeniz gerektiğinde sunucuyu yeniden başlatmadan yapılabilir. Ancak, yürütme sırasında bir eklentiyi güncelliyorsanız, eklentinin bunu desteklemesi gerekmektedir; aksi halde sorunlarla karşılaşabilirsiniz. Daha fazla bilgi ve takip edilmesi gereken kurallar için ``Dinamik Güncelleme`` bölümüne başvurun. - EXILED'da OnUpdate, OnFixedUpdate veya OnLateUpdate eventi(etkinliği) ***Bulunmamaktadır!***, Eğer sık sık çalışan bir kod calıştırmanız gerekiyor ise bir MEC coroutine Kullanabilirsiniz ki bu bir frame, 0.01f bekler ya da Timing.FixedUpdate gibi bir Timing katmanı kullanabilirsiniz. - ### MEC Coroutines -If you are unfamiliar with MEC, this will be a very brief and simple primer to get you started. -MEC Coroutines are basically timed methods, that support waiting periods of time before continuing execution, without interrupting/sleeping the main game thread. -MEC coroutines are safe to use with Unity, unlike traditional threading. ***DO NOT try and make new threads to interact with Unity on, they WILL crash the server.*** + ### MEC (More Effective Coroutines) Coroutines (Eş zamanlı iş parçacığı) +Hiç MEC (More Effective Coroutines) kullanmadı iseniz işte size MEC kullanmanız için bir rehber! +MEC Coroutine'leri zamanlanmış yöntemlerdir. ve çalışan bir MEC kodunun kesilmeden / devre dışı bırakmadan önce belirli bir süre beklemenizi destekler +MEC Coroutine'leri Unity ile kullanılmak üzere güvenlidir AMA ***Unity ile etkileşimde bulunmak için yeni Threadler(iş parçacıkları) oluşturmayın!! sunucuyu çökertir.*** + +MEC Kullanmak için ``Assembly-CSharp-firstpass.dll``'yi referans etmeniz ve ``Using MEC;``'yi eklemeniz gerekir. + +HER DÖNGÜ ARASINDA 5 SANİYE BEKLEYEN BİR COROUTINE YAPIMI: -To use MEC, you will need to reference ``Assembly-CSharp-firstpass.dll`` from the server files and include ``using MEC;``. -Example of calling a simple coroutine, that repeats itself with a delay between each loop: ```cs using MEC; using Exiled.API.Features; From d7be79ca42799382babcec9adc794e16cc8aa73e Mon Sep 17 00:00:00 2001 From: Nao <60253860+NaoUnderscore@users.noreply.github.com> Date: Wed, 17 Jan 2024 07:07:29 +0100 Subject: [PATCH 006/141] Update README.md --- README.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 18e9f75684..483dd4e5f0 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,15 @@ -# EXILED - EXtended In-runtime Library for External Development - -![EXILED CI](https://github.com/Exiled-Team/EXILED/actions/workflows/main.yml/badge.svg?branch=master) - - GitHub Releases - -![Github All Downloads](https://img.shields.io/github/downloads/Exiled-Team/EXILED/total.svg?style=flat) -![Github Commits](https://img.shields.io/github/commit-activity/w/Exiled-Team/EXILED/dev) +

EXILED - EXtended In-runtime Library for External Development

+
+ +[CI](https://github.com/Exiled-Team/EXILED/actions/workflows/main.yml/badge.svg?branch=master) +GitHub Releases +Downloads +![Github Commits](https://img.shields.io/github/commit-activity/w/Exiled-Team/EXILED/apis-rework?style=for-the-badge&logo=git) - Chat on Discord - + Chat on Discord + +
EXILED is a high-level plugin framework for SCP: Secret Laboratory servers. It offers an event system for developers to hook into in order to manipulate or change game code or implement their own functions. All EXILED events are coded with Harmony, meaning they require no direct editing of server assemblies to function, which allows for two unique benefits. From f730b89909c332821ecb3bf52b07583dab45b032 Mon Sep 17 00:00:00 2001 From: Nao <60253860+NaoUnderscore@users.noreply.github.com> Date: Wed, 17 Jan 2024 07:08:26 +0100 Subject: [PATCH 007/141] =?UTF-8?q?Update=20README-=D0=A0=D1=83=D1=81?= =?UTF-8?q?=D1=81=D0=BA=D0=B8=D0=B9.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...21\201\321\201\320\272\320\270\320\271.md" | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git "a/Localization/README-\320\240\321\203\321\201\321\201\320\272\320\270\320\271.md" "b/Localization/README-\320\240\321\203\321\201\321\201\320\272\320\270\320\271.md" index 47072a9722..fb05635990 100644 --- "a/Localization/README-\320\240\321\203\321\201\321\201\320\272\320\270\320\271.md" +++ "b/Localization/README-\320\240\321\203\321\201\321\201\320\272\320\270\320\271.md" @@ -1,15 +1,15 @@ -# EXILED - библиотека для разработки плагинов - -![EXILED CI](https://github.com/galaxy119/EXILED/workflows/EXILED%20CI/badge.svg?branch=2.0.0) - -GitHub Releases - -![Github All Downloads](https://img.shields.io/github/downloads/galaxy119/EXILED/total.svg?style=flat) -![Github Commits](https://img.shields.io/github/commit-activity/w/Exiled-Team/EXILED/dev) +

EXILED - EXtended In-runtime Library for External Development

+
+ +[CI](https://github.com/Exiled-Team/EXILED/actions/workflows/main.yml/badge.svg?branch=master) +GitHub Releases +Downloads +![Github Commits](https://img.shields.io/github/commit-activity/w/Exiled-Team/EXILED/apis-rework?style=for-the-badge&logo=git) -Chat on Discord - + Chat on Discord + +
EXILED - низкоуровневый фреймворк для серверов SCP: Secret Laboratory. Он предлагает систему событий, которую разработчики могут использовать для различных манипуляций, изменения кода игры или реализации собственных функций. Все ивенты EXILED сделаны с помощью Harmony, это означает, что для их функционирования не требуется прямого редактирования серверных сборок, что позволяет получить два уникальных преимущества: - Во-первых, весь код фреймворка может быть свободно опубликован и распространен, что позволяет разработчикам лучше понять, *как* он работает, а также предложить свои предложения по дополнению или изменению его функций. From f60001a221d162687ed4d74edda29543a5cc1868 Mon Sep 17 00:00:00 2001 From: Nao <60253860+NaoUnderscore@users.noreply.github.com> Date: Wed, 17 Jan 2024 07:08:40 +0100 Subject: [PATCH 008/141] =?UTF-8?q?Update=20README-=E4=B8=AD=E6=96=87.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../README-\344\270\255\346\226\207.md" | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git "a/Localization/README-\344\270\255\346\226\207.md" "b/Localization/README-\344\270\255\346\226\207.md" index dd0600998e..c65af1c13c 100644 --- "a/Localization/README-\344\270\255\346\226\207.md" +++ "b/Localization/README-\344\270\255\346\226\207.md" @@ -1,14 +1,15 @@ -# EXILED - EXtended In-runtime Library for External Development - -![EXILED CI](https://github.com/Exiled-Team/EXILED/actions/workflows/main.yml/badge.svg?branch=master) - - GitHub Releases - -![Github All Downloads](https://img.shields.io/github/downloads/Exiled-Team/EXILED/total.svg?style=flat) -![Github Commits](https://img.shields.io/github/commit-activity/w/Exiled-Team/EXILED/dev) +

EXILED - EXtended In-runtime Library for External Development

+
+ +[CI](https://github.com/Exiled-Team/EXILED/actions/workflows/main.yml/badge.svg?branch=master) +GitHub Releases +Downloads +![Github Commits](https://img.shields.io/github/commit-activity/w/Exiled-Team/EXILED/apis-rework?style=for-the-badge&logo=git) - Chat on Discord - + Chat on Discord + + +
EXILED是一个用于SCP: 秘密实验室服务器的高级插件框架。 它为开发者提供了一个可以改变游戏代码或实现其自己的功能的事件系统。 From c22dcad2249bb9008229ac343b4b206b29afefe0 Mon Sep 17 00:00:00 2001 From: Nao <60253860+NaoUnderscore@users.noreply.github.com> Date: Wed, 17 Jan 2024 07:08:57 +0100 Subject: [PATCH 009/141] Update README-ES.md --- Localization/README-ES.md | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/Localization/README-ES.md b/Localization/README-ES.md index cbcdef49cb..23a2c09be9 100644 --- a/Localization/README-ES.md +++ b/Localization/README-ES.md @@ -1,14 +1,15 @@ -# EXILED - EXtended In-runtime Library for External Development - -![EXILED CI](https://github.com/galaxy119/EXILED/workflows/EXILED%20CI/badge.svg?branch=2.0.0) - - GitHub Releases - -![Github All Downloads](https://img.shields.io/github/downloads/galaxy119/EXILED/total.svg?style=flat) -![Github Commits](https://img.shields.io/github/commit-activity/w/Exiled-Team/EXILED/dev) +

EXILED - EXtended In-runtime Library for External Development

+
+ +[CI](https://github.com/Exiled-Team/EXILED/actions/workflows/main.yml/badge.svg?branch=master) +GitHub Releases +Downloads +![Github Commits](https://img.shields.io/github/commit-activity/w/Exiled-Team/EXILED/apis-rework?style=for-the-badge&logo=git) - Chat on Discord - + Chat on Discord + + +
EXILED es una plataforma de desarrollo de plugins para servidores de SCP: Secret Laboratory. Ofrece un sistema de eventos para desarrolladores y poder modificar o cambiar código del juego, o implementar sus propias funciones. From 0ced09582672f947760e32b38d40d1f65339607c Mon Sep 17 00:00:00 2001 From: Nao <60253860+NaoUnderscore@users.noreply.github.com> Date: Wed, 17 Jan 2024 07:09:11 +0100 Subject: [PATCH 010/141] Update README-PL.md --- Localization/README-PL.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Localization/README-PL.md b/Localization/README-PL.md index e962ffdcf1..25704480c1 100644 --- a/Localization/README-PL.md +++ b/Localization/README-PL.md @@ -1,15 +1,15 @@ - # EXILED - EXtended In-runtime Library for External Development - -![EXILED CI](https://github.com/Exiled-Team/EXILED/workflows/EXILED%20CI/badge.svg?branch=2.0.0) - - GitHub Releases - -![Github All Downloads](https://img.shields.io/github/downloads/Exiled-Team/EXILED/total.svg?style=flat) -![Github Commits](https://img.shields.io/github/commit-activity/w/Exiled-Team/EXILED/dev) +

EXILED - EXtended In-runtime Library for External Development

+
+ +[CI](https://github.com/Exiled-Team/EXILED/actions/workflows/main.yml/badge.svg?branch=master) +GitHub Releases +Downloads +![Github Commits](https://img.shields.io/github/commit-activity/w/Exiled-Team/EXILED/apis-rework?style=for-the-badge&logo=git) - Chat on Discord - + Chat on Discord + +
EXILED to wysoko poziomowy framework do tworzenia pluginów dla serwerów w grze SCP: Secret Laboratory. Oferuje on system zdarzeń, do którego programiści mogą podpinać swój kod w celu manipulacji bądź zmiany działania gry, lub implementowania własnych funkcji. Wszystkie zdarzenia EXILED'a są zaprogromowane za pomocą Harmony, co oznacza że nie wymagają bezpośredniego modyfikowania serwerowych plików Assembly, co daje dwie wyjątkowe korzyści. From 8f2ce54d52dcc7764229125b3fc891ea4a03a9ed Mon Sep 17 00:00:00 2001 From: Nao <60253860+NaoUnderscore@users.noreply.github.com> Date: Wed, 17 Jan 2024 07:09:27 +0100 Subject: [PATCH 011/141] Update README-BR.md --- Localization/README-BR.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Localization/README-BR.md b/Localization/README-BR.md index 3344a01af2..824b2b055c 100644 --- a/Localization/README-BR.md +++ b/Localization/README-BR.md @@ -1,15 +1,15 @@ -# EXILED - EXtended In-runtime Library for External Development - -![EXILED CI](https://github.com/Exiled-Team/EXILED/workflows/EXILED%20CI/badge.svg?branch=2.0.0) - - GitHub Releases - -![Github All Downloads](https://img.shields.io/github/downloads/Exiled-Team/EXILED/total.svg?style=flat) -![Github Commits](https://img.shields.io/github/commit-activity/w/Exiled-Team/EXILED/dev) +

EXILED - EXtended In-runtime Library for External Development

+
+ +[CI](https://github.com/Exiled-Team/EXILED/actions/workflows/main.yml/badge.svg?branch=master) +GitHub Releases +Downloads +![Github Commits](https://img.shields.io/github/commit-activity/w/Exiled-Team/EXILED/apis-rework?style=for-the-badge&logo=git) - Chat on Discord - + Chat on Discord + +
EXILED é uma estrutura para plug-ins de alto nível aos servidores SCP: Secret Laboratory. Ele oferece um sistema de eventos para os desenvolvedores usarem para manipular ou alterar o código do jogo ou implementar suas próprias funções. Todos os eventos do EXILED são codificados com Harmony, o que significa que não requerem edição direta dos Assemblies do servidor para funcionar, o que permite dois benefícios exclusivos. From 322aff05839f24304010d1d4e7330604c2d48f4d Mon Sep 17 00:00:00 2001 From: Nao <60253860+NaoUnderscore@users.noreply.github.com> Date: Wed, 17 Jan 2024 07:09:45 +0100 Subject: [PATCH 012/141] Update README-IT.md --- Localization/README-IT.md | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/Localization/README-IT.md b/Localization/README-IT.md index 3fc3b085b3..9398aed7c6 100644 --- a/Localization/README-IT.md +++ b/Localization/README-IT.md @@ -1,14 +1,15 @@ -# EXILED - EXtended In-runtime Library for External Development - -![EXILED CI](https://github.com/Exiled-Team/EXILED/workflows/EXILED%20CI/badge.svg?branch=2.0.0) - - GitHub Releases - -![Github All Downloads](https://img.shields.io/github/downloads/Exiled-Team/EXILED/total.svg?style=flat) -![Github Commits](https://img.shields.io/github/commit-activity/w/Exiled-Team/EXILED/dev) +

EXILED - EXtended In-runtime Library for External Development

+
+ +[CI](https://github.com/Exiled-Team/EXILED/actions/workflows/main.yml/badge.svg?branch=master) +GitHub Releases +Downloads +![Github Commits](https://img.shields.io/github/commit-activity/w/Exiled-Team/EXILED/apis-rework?style=for-the-badge&logo=git) - Chat on Discord - + Chat on Discord + + +
EXILED è un framework di alto livello per i server di SCP: Secret Laboratory. Offre un sistema di eventi per gli sviluppatori per modificare il codice di gioco o implementare le proprie funzioni. @@ -158,4 +159,4 @@ Nota che ho detto *nuove* assembly. Se sostituisci un'assembly con un'altra con Pertanto, i plugin che supportano gli Aggiornamenti Dinamici ***DEVONO*** seguire queste linee guida o verranno rimossi dal server Discord a causa del potenziale rischio per gli host del server. -Ma non tutti i plugin devono supportare gli Aggiornamenti Dinamici. Se non hai intenzione di supportare gli Aggiornamenti Dinamici, va benissimo, basta che non cambi il nome dell'Assembly del tuo plugin quando crei una nuova versione e non dovrai preoccuparti di nulla. Assicurati solo che gli host del server siano consapevoli che dovranno riavviare completamente i loro server per aggiornare il tuo plugin. \ No newline at end of file +Ma non tutti i plugin devono supportare gli Aggiornamenti Dinamici. Se non hai intenzione di supportare gli Aggiornamenti Dinamici, va benissimo, basta che non cambi il nome dell'Assembly del tuo plugin quando crei una nuova versione e non dovrai preoccuparti di nulla. Assicurati solo che gli host del server siano consapevoli che dovranno riavviare completamente i loro server per aggiornare il tuo plugin. From 68c36d36ccc0e97be0af113183748955a5489bac Mon Sep 17 00:00:00 2001 From: Nao <60253860+NaoUnderscore@users.noreply.github.com> Date: Wed, 17 Jan 2024 07:09:59 +0100 Subject: [PATCH 013/141] Update README-CS.md --- Localization/README-CS.md | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Localization/README-CS.md b/Localization/README-CS.md index 03cbaa936c..69ea25eecd 100644 --- a/Localization/README-CS.md +++ b/Localization/README-CS.md @@ -1,15 +1,15 @@ -# EXILED - EXtended In-runtime Library for External Development - -![EXILED CI](https://github.com/Exiled-Team/EXILED/workflows/EXILED%20CI/badge.svg?branch=2.0.0) - - GitHub Releases - -![Github All Downloads](https://img.shields.io/github/downloads/Exiled-Team/EXILED/total.svg?style=flat) -![Github Commits](https://img.shields.io/github/commit-activity/w/Exiled-Team/EXILED/dev) +

EXILED - EXtended In-runtime Library for External Development

+
+ +[CI](https://github.com/Exiled-Team/EXILED/actions/workflows/main.yml/badge.svg?branch=master) +GitHub Releases +Downloads +![Github Commits](https://img.shields.io/github/commit-activity/w/Exiled-Team/EXILED/apis-rework?style=for-the-badge&logo=git) - Chat on Discord - + Chat on Discord + +
EXILED je vysokoúrovňové rozhraní pro pluginy na servery hry SCP: Secret Laboratory. Nabízí systém "eventů", tedy událostí, které mohou vývojáři využít k manipulaci nebo změně herního kódu či implementaci vlastních funkcí. Všechny EXILED eventy jsou kódovány pomocí Harmony, což znamená, že ke svému fungování nevyžadují přímé úpravy serverových sestav, což přináší dvě jedinečné výhody. From 0075e5515bfae4ebb4f6f3b95039c47b57020ceb Mon Sep 17 00:00:00 2001 From: Nao <60253860+NaoUnderscore@users.noreply.github.com> Date: Wed, 17 Jan 2024 07:10:08 +0100 Subject: [PATCH 014/141] Update README-DK.md --- Localization/README-DK.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Localization/README-DK.md b/Localization/README-DK.md index 62e0245901..c4a3d05760 100644 --- a/Localization/README-DK.md +++ b/Localization/README-DK.md @@ -1,15 +1,15 @@ -# EXILED - EXtended In-runtime Library for External Development - -![EXILED CI](https://github.com/Exiled-Team/EXILED/workflows/EXILED%20CI/badge.svg?branch=2.0.0) - - GitHub Releases - -![Github Alle Downloads](https://img.shields.io/github/downloads/Exiled-Team/EXILED/total.svg?style=flat) -![Github Commits](https://img.shields.io/github/commit-activity/w/Exiled-Team/EXILED/dev) +

EXILED - EXtended In-runtime Library for External Development

+
+ +[CI](https://github.com/Exiled-Team/EXILED/actions/workflows/main.yml/badge.svg?branch=master) +GitHub Releases +Downloads +![Github Commits](https://img.shields.io/github/commit-activity/w/Exiled-Team/EXILED/apis-rework?style=for-the-badge&logo=git) - Chat on Discord - + Chat on Discord + +
EXILED er et plugin-framework på højt niveau til SCP: Secret Laboratory-servere. Det tilbyder et event-system, som udviklere kan bruge til at manipulere eller ændre spilkoden eller implementere deres egne funktioner. Alle EXILED-hændelser er kodet med Harmony, hvilket betyder, at de ikke kræver direkte redigering af server Assemblies for at fungere, hvilket giver to unikke fordele. @@ -157,4 +157,4 @@ Derfor **SKAL** plugins, der understøtter dynamiske opdateringer, følge disse Men ikke alle plugins behøver at understøtte dynamiske opdateringer. Hvis du ikke har tænkt dig at understøtte dynamiske opdateringer, er det helt fint, du skal bare ikke ændre Assembly Name på dit plugin, når du bygger en ny version, så behøver du ikke bekymre dig om noget af dette, bare sørg for, at serverværterne ved, at de bliver nødt til at genstarte deres servere fuldstændigt for at opdatere dit plugin. -**Translator: @misfiy** \ No newline at end of file +**Translator: @misfiy** From e852bf7c96dc8829d008e458dc0bb84340dd8702 Mon Sep 17 00:00:00 2001 From: Nao <60253860+NaoUnderscore@users.noreply.github.com> Date: Wed, 17 Jan 2024 07:10:21 +0100 Subject: [PATCH 015/141] Update README-TR.md --- Localization/README-TR.md | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Localization/README-TR.md b/Localization/README-TR.md index 96c6a19c30..6eb091ab9f 100644 --- a/Localization/README-TR.md +++ b/Localization/README-TR.md @@ -1,15 +1,15 @@ -# EXILED - EXtended In-runtime Library for External Development - -![EXILED CI](https://github.com/Exiled-Team/EXILED/actions/workflows/main.yml/badge.svg?branch=master) - - GitHub Releases - -![Github All Downloads](https://img.shields.io/github/downloads/Exiled-Team/EXILED/total.svg?style=flat) -![Github Commits](https://img.shields.io/github/commit-activity/w/Exiled-Team/EXILED/dev) +

EXILED - EXtended In-runtime Library for External Development

+
+ +[CI](https://github.com/Exiled-Team/EXILED/actions/workflows/main.yml/badge.svg?branch=master) +GitHub Releases +Downloads +![Github Commits](https://img.shields.io/github/commit-activity/w/Exiled-Team/EXILED/apis-rework?style=for-the-badge&logo=git) - Chat on Discord - + Chat on Discord + +
EXILED, SCP: Secret Laboratory sunucuları için yüksek düzeyde bir Framework yani bir eklenti çerçevesidir. Geliştiricilere oyun kodunu değiştirmek veya kendi fonksiyonlarını eklemek için kullanabilecekleri bir olay sistemi sunar. Tüm EXILED eventleri(olayları) Harmony kullanılarak oluşturulmuştur, bu da demek oluyor ki eventlerin(olayların) işlevsel olabilmesi için doğrudan sunucu kodunu değiştirmenize gerek yoktur ve bu durum 2 avantaj sağlar: @@ -150,4 +150,4 @@ Bu nedenle, dinamik güncellemeleri destekleyen eklentilerin bu yönergeleri tak Her eklentinin dinamik güncellemeleri desteklemesi gerekmez. Eğer dinamik güncellemeleri desteklemeyi planlamıyorsanız, bu tamamen uygun bir durumdur. Sadece yeni bir sürüm oluştururken eklentinizin derleme adını değiştirmekten kaçının. Bu tür durumlarda, sunucu sahiplerinin eklentinizi güncellemek için sunucularını tamamen yeniden başlatmaları gerektiğini bildirin. -çeviri: Enes Batur (_funnyman_xdxdxd.rofl.) \ No newline at end of file +çeviri: Enes Batur (_funnyman_xdxdxd.rofl.) From 157fcb37996abd1063dbc6a7118e073cf44bec84 Mon Sep 17 00:00:00 2001 From: Nameless <85962933+Misfiy@users.noreply.github.com> Date: Sat, 20 Jan 2024 13:36:22 +0100 Subject: [PATCH 016/141] [Exiled.API] (Change) Modify Door.DoorLockType setter (#2392) * i hate this method * DoorLockType --- Exiled.API/Features/Doors/Door.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Exiled.API/Features/Doors/Door.cs b/Exiled.API/Features/Doors/Door.cs index e4a2a6f487..a82e5f2187 100644 --- a/Exiled.API/Features/Doors/Door.cs +++ b/Exiled.API/Features/Doors/Door.cs @@ -220,7 +220,11 @@ public bool AllowsScp106 public DoorLockType DoorLockType { get => (DoorLockType)Base.NetworkActiveLocks; - set => ChangeLock(value); + set + { + Base.NetworkActiveLocks = (ushort)value; + DoorEvents.TriggerAction(Base, IsLocked ? DoorAction.Locked : DoorAction.Unlocked, null); + } } /// From a87e91166c0dee4444220eec8a02edac62612b87 Mon Sep 17 00:00:00 2001 From: Naounderscore Date: Thu, 25 Jan 2024 01:19:47 +0100 Subject: [PATCH 017/141] Added `DefaultPlayerClassAttribute`. Now `Player` derived classes will be automatically used as base `Player` class if marked with `DefaultPlayerClassAttribute` enforcing the type authority, or just by inheriting from `Player` class. --- Exiled.API/Exiled.API.csproj | 1 + .../Attributes/DefaultPlayerClassAttribute.cs | 29 +++++++++++++++++++ Exiled.API/Features/Player.cs | 9 ++++++ .../API/Features/CustomRoles/RoleBehaviour.cs | 10 +++---- Exiled.CustomModules/API/Features/Pawn.cs | 4 +-- Exiled.CustomModules/CustomModules.cs | 4 --- Exiled.Events/Patches/Events/Player/Joined.cs | 19 +----------- Exiled.Loader/Loader.cs | 15 ++++++++-- 8 files changed, 59 insertions(+), 32 deletions(-) create mode 100644 Exiled.API/Features/Attributes/DefaultPlayerClassAttribute.cs diff --git a/Exiled.API/Exiled.API.csproj b/Exiled.API/Exiled.API.csproj index fc7f6f4c95..23089b1fb7 100644 --- a/Exiled.API/Exiled.API.csproj +++ b/Exiled.API/Exiled.API.csproj @@ -13,6 +13,7 @@ <_Parameter1>Exiled.Events + <_Parameter2>Exiled.Loader diff --git a/Exiled.API/Features/Attributes/DefaultPlayerClassAttribute.cs b/Exiled.API/Features/Attributes/DefaultPlayerClassAttribute.cs new file mode 100644 index 0000000000..733f1960fc --- /dev/null +++ b/Exiled.API/Features/Attributes/DefaultPlayerClassAttribute.cs @@ -0,0 +1,29 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.API.Features.Attributes +{ + using System; + + /// + /// This attribute determines whether the class which is being applied to should replace the default class. + /// + [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] + public class DefaultPlayerClassAttribute : Attribute + { + /// + /// Initializes a new instance of the class. + /// + /// A value indicating whether the type should enforce its authority, ignoring all other classes. + public DefaultPlayerClassAttribute(bool enforceAuthority = false) => EnforceAuthority = enforceAuthority; + + /// + /// Gets a value indicating whether the type should enforce its authority, ignoring all other classes. + /// + public bool EnforceAuthority { get; } + } +} \ No newline at end of file diff --git a/Exiled.API/Features/Player.cs b/Exiled.API/Features/Player.cs index c3b6009e84..e457c63f15 100644 --- a/Exiled.API/Features/Player.cs +++ b/Exiled.API/Features/Player.cs @@ -17,6 +17,7 @@ namespace Exiled.API.Features using CustomPlayerEffects; using DamageHandlers; using Enums; + using Exiled.API.Features.Attributes; using Exiled.API.Features.Doors; using Exiled.API.Features.Hazards; using Exiled.API.Features.Items; @@ -73,9 +74,17 @@ namespace Exiled.API.Features /// /// Represents the in-game player, by encapsulating a . /// + [DefaultPlayerClass] public class Player : GameEntity, IWorldSpace { #pragma warning disable SA1401 +#pragma warning disable SA1310 + /// + /// The default player class. + /// + internal static Type DEFAULT_PLAYER_CLASS = typeof(Player); +#pragma warning restore SA1310 + /// /// A list of the player's items. /// diff --git a/Exiled.CustomModules/API/Features/CustomRoles/RoleBehaviour.cs b/Exiled.CustomModules/API/Features/CustomRoles/RoleBehaviour.cs index 8bdedf231e..50bb8f4758 100644 --- a/Exiled.CustomModules/API/Features/CustomRoles/RoleBehaviour.cs +++ b/Exiled.CustomModules/API/Features/CustomRoles/RoleBehaviour.cs @@ -33,8 +33,6 @@ namespace Exiled.CustomModules.API.Features.CustomRoles using UnityEngine; - using static Exiled.API.Extensions.MirrorExtensions; - /// /// Represents the base class for custom role behaviors. /// @@ -86,6 +84,10 @@ public Vector3 SpawnPoint if (Settings.SpawnProperties is null || Settings.SpawnProperties.IsEmpty) return RoleExtensions.GetRandomSpawnLocation(Role).Position; + return Settings.SpawnProperties.StaticSpawnPoints.Count > 0 && EvalSpawnPoint(Settings.SpawnProperties.StaticSpawnPoints, out Vector3 staticPos) ? staticPos : + Settings.SpawnProperties.DynamicSpawnPoints.Count > 0 && EvalSpawnPoint(Settings.SpawnProperties.DynamicSpawnPoints, out Vector3 dynamicPos) ? dynamicPos : + Settings.SpawnProperties.RoleSpawnPoints.Count > 0 && EvalSpawnPoint(Settings.SpawnProperties.RoleSpawnPoints, out Vector3 rolePos) ? rolePos : Vector3.zero; + static bool EvalSpawnPoint(IEnumerable spawnpoints, out Vector3 outPos) { outPos = default; @@ -101,10 +103,6 @@ static bool EvalSpawnPoint(IEnumerable spawnpoints, out Vector3 outP return false; } - - return Settings.SpawnProperties.StaticSpawnPoints.Count > 0 && EvalSpawnPoint(Settings.SpawnProperties.StaticSpawnPoints, out Vector3 staticPos) ? staticPos : - Settings.SpawnProperties.DynamicSpawnPoints.Count > 0 && EvalSpawnPoint(Settings.SpawnProperties.DynamicSpawnPoints, out Vector3 dynamicPos) ? dynamicPos : - Settings.SpawnProperties.RoleSpawnPoints.Count > 0 && EvalSpawnPoint(Settings.SpawnProperties.RoleSpawnPoints, out Vector3 rolePos) ? rolePos : Vector3.zero; } } diff --git a/Exiled.CustomModules/API/Features/Pawn.cs b/Exiled.CustomModules/API/Features/Pawn.cs index 05c1bad146..8fd82193e2 100644 --- a/Exiled.CustomModules/API/Features/Pawn.cs +++ b/Exiled.CustomModules/API/Features/Pawn.cs @@ -14,6 +14,7 @@ namespace Exiled.CustomModules.API.Features using Exiled.API.Enums; using Exiled.API.Extensions; using Exiled.API.Features; + using Exiled.API.Features.Attributes; using Exiled.API.Features.Core; using Exiled.API.Features.Items; using Exiled.API.Features.Roles; @@ -24,9 +25,7 @@ namespace Exiled.CustomModules.API.Features using Exiled.CustomModules.API.Features.CustomRoles; using Exiled.CustomModules.API.Features.PlayerAbilities; using Exiled.CustomModules.Events.EventArgs.CustomAbilities; - using PlayerRoles; - using UnityEngine; /// @@ -41,6 +40,7 @@ namespace Exiled.CustomModules.API.Features ///
It serves as a comprehensive representation of an in-game entity, encapsulating the associated with an expanded set of features.
/// ///
+ [DefaultPlayerClass(enforceAuthority: false)] public class Pawn : Player { private readonly List abilityBehaviours = new(); diff --git a/Exiled.CustomModules/CustomModules.cs b/Exiled.CustomModules/CustomModules.cs index fe489a7dd5..d5478f2807 100644 --- a/Exiled.CustomModules/CustomModules.cs +++ b/Exiled.CustomModules/CustomModules.cs @@ -36,8 +36,6 @@ public override void OnEnabled() { Instance = this; - Exiled.Events.Patches.Events.Player.Joined.BasePlayerType = typeof(Pawn); - SubscribeEvents(); base.OnEnabled(); @@ -48,8 +46,6 @@ public override void OnDisabled() { UnsubscribeEvents(); - Exiled.Events.Patches.Events.Player.Joined.BasePlayerType = typeof(Player); - base.OnDisabled(); } diff --git a/Exiled.Events/Patches/Events/Player/Joined.cs b/Exiled.Events/Patches/Events/Player/Joined.cs index a97a5fe2de..e69b5216a9 100644 --- a/Exiled.Events/Patches/Events/Player/Joined.cs +++ b/Exiled.Events/Patches/Events/Player/Joined.cs @@ -25,23 +25,6 @@ namespace Exiled.Events.Patches.Events.Player [HarmonyPatch(typeof(ReferenceHub), nameof(ReferenceHub.Start))] public static class Joined { - private static Type basePlayerType = typeof(Player); - - /// - /// Gets or sets the base type. - /// - public static Type BasePlayerType - { - get => basePlayerType; - set - { - if (!typeof(Player).IsAssignableFrom(value)) - return; - - basePlayerType = value; - } - } - internal static void CallEvent(ReferenceHub hub, out Player player) { try @@ -49,7 +32,7 @@ internal static void CallEvent(ReferenceHub hub, out Player player) #if DEBUG Log.Debug("Creating new player object"); #endif - player = Activator.CreateInstance(BasePlayerType, false, hub) as Player; + player = Activator.CreateInstance(Player.DEFAULT_PLAYER_CLASS, false, hub) as Player; #if DEBUG Log.Debug($"Object exists {player is not null}"); Log.Debug($"Creating player object for {hub.nicknameSync.Network_displayName}"); diff --git a/Exiled.Loader/Loader.cs b/Exiled.Loader/Loader.cs index 56832a6a71..bff77523c9 100644 --- a/Exiled.Loader/Loader.cs +++ b/Exiled.Loader/Loader.cs @@ -19,10 +19,9 @@ namespace Exiled.Loader using API.Enums; using API.Interfaces; - using CommandSystem.Commands.Shared; - using Exiled.API.Features; + using Exiled.API.Features.Attributes; using Features; /// @@ -148,10 +147,14 @@ public static Assembly LoadAssembly(string path) /// Returns the created plugin instance or . public static IPlugin CreatePlugin(Assembly assembly) { + Type defaultPlayerClass = null; try { foreach (Type type in assembly.GetTypes()) { + if (typeof(Player).IsAssignableFrom(type)) + defaultPlayerClass = type; + if (type.IsAbstract || type.IsInterface) { Log.Debug($"\"{type.FullName}\" is an interface or abstract class, skipping."); @@ -197,6 +200,14 @@ public static IPlugin CreatePlugin(Assembly assembly) if (CheckPluginRequiredExiledVersion(plugin)) continue; + if (defaultPlayerClass is not null) + { + DefaultPlayerClassAttribute dpc = Player.DEFAULT_PLAYER_CLASS.GetCustomAttribute(); + + if (dpc is not null && !dpc.EnforceAuthority) + Player.DEFAULT_PLAYER_CLASS = defaultPlayerClass; + } + return plugin; } } From faff75478c83fc197a24540d82e612884071ab22 Mon Sep 17 00:00:00 2001 From: Yamato <66829532+louis1706@users.noreply.github.com> Date: Thu, 25 Jan 2024 23:49:45 +0100 Subject: [PATCH 018/141] Fix Doc (#2271) --- Exiled.Events/EventArgs/Player/LeftEventArgs.cs | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Exiled.Events/EventArgs/Player/LeftEventArgs.cs b/Exiled.Events/EventArgs/Player/LeftEventArgs.cs index 05fde1f1c2..b4997c2123 100644 --- a/Exiled.Events/EventArgs/Player/LeftEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/LeftEventArgs.cs @@ -8,19 +8,22 @@ namespace Exiled.Events.EventArgs.Player { using API.Features; + using Exiled.Events.EventArgs.Interfaces; /// - /// Contains all information after a disconnects from the server. + /// 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 From 88f1282f5dbf9363f800367dd01d5104f4562388 Mon Sep 17 00:00:00 2001 From: Yamato <66829532+louis1706@users.noreply.github.com> Date: Fri, 26 Jan 2024 00:40:07 +0100 Subject: [PATCH 019/141] Merge dev to api rework (#2398) * Merge * ?? --- Exiled.API/Extensions/ItemExtensions.cs | 14 +++++++------- Exiled.API/Features/Effect.cs | 2 +- Exiled.API/Features/Ragdoll.cs | 1 + .../Patches/Events/Map/ChangingIntoGrenade.cs | 2 +- 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Exiled.API/Extensions/ItemExtensions.cs b/Exiled.API/Extensions/ItemExtensions.cs index 4c2e1dd2ec..2aa7c90fc0 100644 --- a/Exiled.API/Extensions/ItemExtensions.cs +++ b/Exiled.API/Extensions/ItemExtensions.cs @@ -96,6 +96,13 @@ public static ItemBase GetItemBase(this ItemType type) return itemBase; } + /// + /// Given an , returns the matching . + /// + /// The . + /// The , or if not found. + public static ItemPickupBase GetPickupBase(this ItemType type) => GetItemBase(type)?.PickupDropModel; + /// /// Given an , returns the matching , casted to . /// @@ -316,12 +323,5 @@ public static uint GetBaseCode(this FirearmType type) /// The to check. /// of the specified . public static ItemCategory GetCategory(this ItemType type) => GetItemBase(type).Category; - - /// - /// Given an , returns the matching . - /// - /// The . - /// The , or if not found. - public static ItemPickupBase GetPickupBase(this ItemType type) => GetItemBase(type)?.PickupDropModel; } } diff --git a/Exiled.API/Features/Effect.cs b/Exiled.API/Features/Effect.cs index 84d8b4bf04..884ce71d84 100644 --- a/Exiled.API/Features/Effect.cs +++ b/Exiled.API/Features/Effect.cs @@ -32,7 +32,7 @@ public Effect() /// Get all the information of the effect>. public Effect(StatusEffectBase statusEffectBase) { - if (statusEffectBase.TryGetEffectType(out EffectType effect)) + if (!statusEffectBase.TryGetEffectType(out EffectType effect)) Log.Error($"EffectType not found please report to Exiled BugReport : {statusEffectBase}"); Type = effect; diff --git a/Exiled.API/Features/Ragdoll.cs b/Exiled.API/Features/Ragdoll.cs index 34669fd1d9..cf9ab43f5b 100644 --- a/Exiled.API/Features/Ragdoll.cs +++ b/Exiled.API/Features/Ragdoll.cs @@ -307,6 +307,7 @@ public static bool TryCreate(RagdollData networkInfo, out Ragdoll ragdoll) Position = networkInfo.StartPosition, Rotation = networkInfo.StartRotation, }; + return true; } diff --git a/Exiled.Events/Patches/Events/Map/ChangingIntoGrenade.cs b/Exiled.Events/Patches/Events/Map/ChangingIntoGrenade.cs index 5b806d5b10..397fbe7dbc 100644 --- a/Exiled.Events/Patches/Events/Map/ChangingIntoGrenade.cs +++ b/Exiled.Events/Patches/Events/Map/ChangingIntoGrenade.cs @@ -118,7 +118,7 @@ private static IEnumerable Transpiler(IEnumerable Date: Fri, 26 Jan 2024 02:48:23 +0300 Subject: [PATCH 020/141] better turkish (#2393) updated --- Localization/README-TR.md | 56 +++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/Localization/README-TR.md b/Localization/README-TR.md index 6eb091ab9f..dbc09a66e9 100644 --- a/Localization/README-TR.md +++ b/Localization/README-TR.md @@ -11,26 +11,26 @@ -EXILED, SCP: Secret Laboratory sunucuları için yüksek düzeyde bir Framework yani bir eklenti çerçevesidir. Geliştiricilere oyun kodunu değiştirmek veya kendi fonksiyonlarını eklemek için kullanabilecekleri bir olay sistemi sunar. Tüm EXILED eventleri(olayları) Harmony kullanılarak oluşturulmuştur, bu da demek oluyor ki eventlerin(olayların) işlevsel olabilmesi için doğrudan sunucu kodunu değiştirmenize gerek yoktur ve bu durum 2 avantaj sağlar: +EXILED, SCP: Secret Laboratory sunucuları için yüksek düzeyde bir Framework yani bir Yazılım iskeleti'dir. Geliştiricilere oyun kodunu değiştirmek veya kendi fonksiyonlarını eklemek için kullanabilecekleri bir olay sistemi sunar. Tüm EXILED eventleri(olayları) Harmony kullanılarak oluşturulmuştur, bu da demek oluyor ki eventlerin(olayların) işlevsel olabilmesi için doğrudan sunucu kodunu değiştirmenize gerek yoktur ve bu durum 2 avantaj sağlar: - - İlk olarak. Framework (Yazılım iskeleti)'nin özgürce yayımlanabilir ve dağıtalabilir, buda geliştiricilere nasıl çalıştığını daha iyi anlama imkanını sunar ve ek olarak fonksiyonları ekleme, değiştirme yapmalarına olanak tanır. + - İlk olarak. Framework (Yazılım iskeleti)'nin özgürce yayımlanabilir ve dağıtılabilir olmasıdır, buda geliştiricilere nasıl çalıştığını daha iyi anlama imkanını sunar ve ek olarak fonksiyonları ekleme, değiştirme yapmalarına olanak tanır. - İkinci olarak, Framework (Yazılım iskeleti) tüm kodun, sunucu kodunun dışına çıktığı için küçük oyun güncellemeleri Framework (Yazılım iskeleti)'ne çok az etki yapar, ve eğer gerek varsa güncelleme yapılması kolaylaşır. # İndirme -EXILED'i indirmek oldukça kolaydır. EXILED kendini Northwood'un Plugin API'si üzerinden yükler, bu nedenle ``Exiled.tar.gz`` dosyasının içinde iki klasör bulunmaktadır. ``SCP Secret Laboratory`` dosyasının içinde, ``EXILED`` klasöründeki eklentileri yüklemek için gerekli dosyalar bulunur. Yapmanız gereken tek şey bu iki dosyayı doğru konuma yerleştirmektir. Bu nasıl yapılacağı aşağıda belirtilmiştir. +EXILED'ı indirmek oldukça kolaydır. EXILED kendini Northwood'un Plugin API'si üzerinden yükler, bu nedenle ``Exiled.tar.gz`` dosyasının içinde iki klasör bulunmaktadır. ``SCP Secret Laboratory`` dosyasının içinde, ``EXILED`` klasöründeki eklentileri yüklemek için gerekli dosyalar bulunur. Yapmanız gereken tek şey bu iki dosyayı doğru konuma yerleştirmektir. Bu nasıl yapılacağı aşağıda belirtilmiştir. Eğer kurulum programını kullanmayı seçerseniz ve doğru bir şekilde çalıştırırsanız, bütün EXILED özelliklerini yüklemekle ilgili işlemleri otomatik olarak gerçekleştirir. # Windows -### Otomatik indirme ([Daha fazla bilgi için bana tıkla](https://github.com/Exiled-Team/EXILED/blob/master/Exiled.Installer/README.md)) +### Otomatik indirme ([Daha fazla bilgi için tıkla](https://github.com/Exiled-Team/EXILED/blob/master/Exiled.Installer/README.md)) **Not**: Sunucuyu indirdiğin kullanıcıda olduğundan emin ol veya yönetici olduğundan emin ol. - **`Exiled.Installer-Win.exe`'i [Buradan indir](https://github.com/Exiled-Team/EXILED/releases)** (Assets'e tıkla -> Installer'ı indir) - İndirdiğinizde sunucu klasörünüze yerleştirin. (Eğer indirmediyseniz, sunucuyu indirin.) - - **`Exiled.Installer.exe`**'e iki kere tıkla ve aç veya **[bana tıklayarak .bat'ı indir](https://www.dropbox.com/s/xny4xus73ze6mq9/install-prerelease.bat?dl=1)** En son ön yayınını yüklemek için sunucu klasörünün içine koy. - - Eklenti indirmek için [Installing plugins](#Eklenti-İndirme) Kısmına göz gezdir. -**Not:** eğer EXILED'i uzaktan bağlantılı olan bir sunucuya indiriyor iseniz .exeyi Sunucu açtığınız kullanıcı ile aynı olduğundan emin oluyon veya Yönetici izinleri verin. + - **`Exiled.Installer.exe`**'e iki kere tıkla ve aç veya **[tıklayarak .bat'ı indir](https://www.dropbox.com/s/xny4xus73ze6mq9/install-prerelease.bat?dl=1)** En son ön yayınını yüklemek için sunucu klasörünün içine koy. + - Eklenti indirmek için [Eklenti indirme](#Eklenti-İndirme) Kısmına göz gezdir. +**Not:** eğer EXILED'ı uzaktan bağlantılı olan bir sunucuya indiriyor iseniz .exe'yi Sunucu açtığınız kullanıcı ile aynı olduğundan emin oluyon veya Yönetici izinleri verin. ### Manuel indirme - **`Exiled.tar.gz` ['yi buradan indir](https://github.com/Exiled-Team/EXILED/releases)** @@ -49,15 +49,15 @@ Bu kadar, EXILED şimdi sunucunuzda kuruldu ve bir sonraki sunucu başladığın - İndirdiğiniz eklentiyi: ``C:\Users\(Kullanıcı_ismi)\AppData\Roaming\EXILED\Plugins``'dizinine taşıyın (Win + R Tuşlarına basarak `%appdata%` yazarak buraya taşıyabilirsiniz) # Linux -### Otomatik indirme ([daha fazla bilgi](https://github.com/Exiled-Team/EXILED/blob/master/Exiled.Installer/README.md)) +### Otomatik indirme ([Daha fazla bilgi için tıkla](https://github.com/Exiled-Team/EXILED/blob/master/Exiled.Installer/README.md)) -**Not:** EXILED'i uzaktan bağlanılan bir sunucuya indiriyor iseniz, indirme programını sunucuyu kurduğunuz kullanıcı ile açın veya (root) yetkiniz olması gerekir. +**Not:** EXILED'ı uzaktan bağlanılan bir sunucuya indiriyor iseniz, indirme programını sunucuyu kurduğunuz kullanıcı ile açın veya (root) yetkiniz olması gerekir. - - **`Exiled.Installer-Linux`'i [Buradan indir](https://github.com/Exiled-Team/EXILED/releases)** (Assets'e tıkla -> Installer'ı indir) - - Ya **`./Exiled.Installer-Linux --path /sunucuya/giden/klasor`** Yazarak ya da doğrudan sunucu klasörüne taşıyarak ve ardından terminalde (`cd` kullanarak) şu komutu yazarak yükleyin: **`./Exiled.Installer-Linux`**. - - eğer en yeni ön yayını istiyor iseniz **`--pre-releases`** ekle. Örnek: **`./Exiled.Installer-Linux /sunucuya/giden/klasor --pre-releases`** - - Başka bir örnek: `eğer Exiled.Installer-Linux` dosyası sunucu klasörüne yerleştirdiyseniz `/sunucuya/giden/klasor/Exiled.Installer-Linux --pre-releases` - - Eklenti indirmek için [Bana tıkla ve göz gezdir!](#Eklenti-Indirme) + - **`Exiled.Installer-Linux`'u [Buradan indir](https://github.com/Exiled-Team/EXILED/releases)** (Assets'e tıkla -> Installer'ı indir) + - Ya **`./Exiled.Installer-Linux --path /sunucuya/giden/klasör`** Yazarak ya da doğrudan sunucu klasörüne taşıyarak ve ardından terminalde (`cd` kullanarak) şu komutu yazarak yükleyin: **`./Exiled.Installer-Linux`**. + - eğer en yeni ön yayını istiyor iseniz **`--pre-releases`** ekle. Örnek: **`./Exiled.Installer-Linux /sunucuya/giden/klasör --pre-releases`** + - Başka bir örnek: `eğer Exiled.Installer-Linux` dosyası sunucu klasörüne yerleştirdiyseniz `/sunucuya/giden/klasör/Exiled.Installer-Linux --pre-releases` + - Eklenti indirmek için [Tıkla ve göz gezdir!](#Eklenti-Indirme) ### Manuel indirme - SCP sunucusunu açan kullanıcı olduğundan **Emin** ol @@ -67,10 +67,10 @@ Bu kadar, EXILED şimdi sunucunuzda kuruldu ve bir sonraki sunucu başladığın - **`SCP Secret Laboratory`** Klasörünü **``~/.config``**'e taşı. *Not: Bu klasör ``~/.config``'nin içine gitmelidir, ``~/.config/SCP Secret Laboratory``**'nin içine değil!** (SSH: **`mv SCP Secret Laboratory ~/.config/`**) ### Eklenti Indirme -Bu kadar, EXILED şimdi sunucunuzda kuruldu ve bir sonraki sunucu başladığında aktif olmalıdır. Unutmayın ki EXILED kendi başına neredeyse hiçbir şey yapmaz, bu yüzden yeni eklentileri **[Discord](https://discord.gg/PyUkWTg)** sunucumuzdan almayı unutmayın. +Bu kadar, EXILED şimdi sunucunuzda kuruldu ve bir sonraki sunucu başladığında aktif olmalıdır. Unutmayın ki EXILED kendi başına neredeyse hiçbir şey yapamaz, bu yüzden yeni eklentileri **[Discord](https://discord.gg/PyUkWTg)** sunucumuzdan almayı unutmayın. - Bir Eklenti indirmek için aşağıdaki talimatları okuyun: - Bir eklentiyi indirmek için [*Onun* releases (yayınlanma) sayfasına gidin](https://i.imgur.com/u34wgPD.jpg) (**`.dll` UZANTILI OLMALIDIR**) - - İndirdiğiniz Eklentiyi: ``~/.config/EXILED/Plugins``'dizininine taşıyın (eğer SSH'yi root olarak kullanıyor iseniz, o zaman doğru `.config`'i `/home/(SCP Server User)` dizininin içinde arayın.) + - İndirdiğiniz Eklentiyi: ``~/.config/EXILED/Plugins``'dizininine taşıyın (eğer SSH'i root olarak kullanıyor iseniz, o zaman doğru `.config`'i `/home/(SCP Server kullanıcısı)` dizininin içinde arayın.) # Config EXILED kendi başına bazı yapılandırma seçenekleri sunar. @@ -79,20 +79,20 @@ Bunların hepsi sunucu açıldığı zaman otomatik olarak yapılır, Bunlar şu Eklenti Configleri(Yapılandırma seçenekleri) ``config_gameplay.txt`` Dosyasında **değildir** Onun yerine eklenti seçeneklieri Linuxda: ``~/.config/EXILED/Configs/(serverportu)-config.yml`` Windows için: (``%AppData%\EXILED\(serverportu)-config.yml``). Ancak, bazı eklentiler kendi başlarına diğer yerlerden yapılandırma/ayarları alabilir. Bu klasör genellikle eklenti ayarlarının/bağlantılarının bulunduğu yerdir. Hatalar varsa lütfen ilgili eklenti geliştiricisine başvurun. -# Geliştiriciler içib +# Geliştiriciler için -Eğer EXILED için bir eklenti yapmak istiyorsanız, bunu yapmak oldukça basittir [Daha fazla bilgi için bana tıkla!](https://github.com/Exiled-Team/EXILED/blob/master/GettingStarted.md). +Eğer EXILED için bir eklenti yapmak istiyorsanız, bunu yapmak oldukça basittir [Daha fazla bilgi için tıkla!](https://github.com/Exiled-Team/EXILED/blob/master/GettingStarted.md). Daha kapsamlı ve sürekli güncellenen öğreticiler için [EXILED websitesine](https://exiled-team.github.io/EXILED/articles/install.html) göz atın. -Ama pluginlerini halka açık yaparken bu kuralları takip etmen lazım: +Ama pluginlerini herkese açık yaparken bu kuralları takip etmekte fayda var: - Eklentiniz ``Exiled.API.Features.Plugin<>`` sınıfından türetilmiş bir sınıf içermelidir; aksi halde EXILED sunucu başladığında eklentinizi yüklemeyecektir. - - Bir eklenti yüklendiğinde, yukarıda bahsedilen sınıfın ``OnEnabled()`` yöntemindeki kod hemen yürütülür; diğer eklentilerin yüklenmesini beklemez. Sunucu başlatma sürecinin tamamlanmasını beklemez. Hiçbir şeyi beklemez. ``OnEnabled()`` yönteminizi yaparken, sunucu henüz başlatılmamış olabilecek şeylere erişim sağlamadığınızdan emin olun, ÖRNEK: ServerConsole.Port veya PlayerManager.localPlayer vb... - - Eğer eklentiniz yüklendiğinde henüz başlatılmamış olan şeylere erişim sağlamanız gerekiyorsa, bunu yapmak için önerilen yol, bu işlemi gerçekleştirmek için ```WaitingForPlayers`` eventini(etkinliğini) beklemektir. Eğer daha erken bazı işlemler yapmanız gerekiyorsa, kodunuzu devam etmeden önce gerekli değişkenin/nesnenin null olmadığını kontrol eden bir ``while(!x)`` döngüsü içine almanız önerilir. + - Bir eklenti yüklendiğinde, yukarıda bahsedilen sınıfın ``OnEnabled()`` yöntemindeki kod hemen yürütülür; diğer eklentilerin yüklenmesini beklemez. Sunucu başlatma sürecinin tamamlanmasını beklemez. Hiçbir şeyi beklemez. ``OnEnabled()`` yönteminizi yaparken, sunucu henüz başlatılmamış olabilecek şeylere erişim sağlamadığınızdan emin olun, ÖRNEK: ServerConsole.Port veya PlayerManager.localPlayer vs... + - Eğer eklentiniz yüklendiğinde henüz başlatılmamış olan şeylere erişim sağlamanız gerekiyorsa, bunu yapmak için önerilen yol, bu işlemi gerçekleştirmek için ```WaitingForPlayers`` eventini(olayını) beklemektir. Eğer daha erken bazı işlemler yapmanız gerekiyorsa, kodunuzu devam etmeden önce gerekli değişkenin/nesnenin null olmadığını kontrol eden bir ``while(!x)`` döngüsü içine almanız önerilir. - EXILED, yürütme sırasında eklenti derlemelerini dinamik olarak yeniden yükleme işlemini destekler. Bu, bir eklentiyi güncellemeniz gerektiğinde sunucuyu yeniden başlatmadan yapılabilir. Ancak, yürütme sırasında bir eklentiyi güncelliyorsanız, eklentinin bunu desteklemesi gerekmektedir; aksi halde sorunlarla karşılaşabilirsiniz. Daha fazla bilgi ve takip edilmesi gereken kurallar için ``Dinamik Güncelleme`` bölümüne başvurun. - - EXILED'da OnUpdate, OnFixedUpdate veya OnLateUpdate eventi(etkinliği) ***Bulunmamaktadır!***, Eğer sık sık çalışan bir kod calıştırmanız gerekiyor ise bir MEC coroutine Kullanabilirsiniz ki bu bir frame, 0.01f bekler ya da Timing.FixedUpdate gibi bir Timing katmanı kullanabilirsiniz. - ### MEC (More Effective Coroutines) Coroutines (Eş zamanlı iş parçacığı) + - EXILED'da OnUpdate, OnFixedUpdate veya OnLateUpdate eventi(olayı) ***Bulunmamaktadır!***, Eğer sık sık çalışan bir kod calıştırmanız gerekiyor ise bir MEC coroutine Kullanabilirsiniz ki bu bir frame, 0.01f bekler ya da Timing.FixedUpdate gibi bir Timing katmanı kullanabilirsiniz. + ### MEC (More Effective Coroutines) (Eş zamanlı iş parçacığı) Hiç MEC (More Effective Coroutines) kullanmadı iseniz işte size MEC kullanmanız için bir rehber! MEC Coroutine'leri zamanlanmış yöntemlerdir. ve çalışan bir MEC kodunun kesilmeden / devre dışı bırakmadan önce belirli bir süre beklemenizi destekler MEC Coroutine'leri Unity ile kullanılmak üzere güvenlidir AMA ***Unity ile etkileşimde bulunmak için yeni Threadler(iş parçacıkları) oluşturmayın!! sunucuyu çökertir.*** @@ -112,7 +112,7 @@ public void SomeMethod() public IEnumerator MyCoroutine() { - for (;;) //aşağıdaki kodu sonsuza kadar çalıştır + for (;;) //aşağıdaki kodu sonsuza kadar çalıştırır. { Log.Info("ben bir döngüyüm!"); //Log.Info yu sunucu konsolunda bir satır yazmak için çağırıldı. yield return Timing.WaitForSeconds(5f); //Bu coroutine'a 5 saniye beklemesini söyler, çünkü bu döngünün sonunda olduğu için, döngünün tekrarlanmasını etkili bir şekilde 5 saniye boyunca duraklatır. @@ -124,7 +124,7 @@ Eğer MEC hakkında bilgi sahibi değilseniz ve daha fazla öğrenmek, tavsiye a ### Dinamik Güncelleme EXILED, bir sunucu yeniden başlatma işlemine gerek olmadan eklenti derlemelerini dinamik olarak yeniden yükleme işlemini destekleyen bir Framework(Yazılım iskeleti)'dir. -Örneğin, sunucuyu sadece `Exiled.Events` eklentisiyle başlatırsanız ve yeni bir eklenti eklemek istiyorsanız, bu görevi tamamlamak için sunucuyu yeniden başlatmanıza gerek yoktur. Basitçe Remote Admin veya Sunucu Konsolu komutu olan ``reload plugins` komutunu kullanarak, önce yüklenmemiş olan yeni eklentiler dahil olmak üzere tüm EXILED eklentilerini yeniden yükleyebilirsiniz. +Örneğin, sunucuyu sadece `Exiled.Events` eklentisiyle başlatırsanız ve yeni bir eklenti eklemek istiyorsanız, bu görevi tamamlamak için sunucuyu yeniden başlatmanıza gerek yoktur. Basitçe Remote Admin veya Sunucu Konsolu komutu olan ``reload plugins`` komutunu kullanarak, önce yüklenmemiş olan yeni eklentiler dahil olmak üzere tüm EXILED eklentilerini yeniden yükleyebilirsiniz. Bu aynı zamanda eklentileri tamamen yeniden başlatmadan *güncelleme* yapmanıza da olanak tanır. Ancak, bunun düzgün bir şekilde gerçekleşmesi için eklenti geliştiricisi tarafından takip edilmesi gereken birkaç kılavuz bulunmaktadır: @@ -136,7 +136,7 @@ Bu aynı zamanda eklentileri tamamen yeniden başlatmadan *güncelleme* yapmanı ***Geliştiriciler için*** - Dinamik güncellemeleri desteklemek isteyen eklentiler, devre dışı bırakıldıklarında veya yeniden yüklendiklerinde bağlı oldukları tüm olaylardan aboneliklerini(Subscribe) iptal etmeye dikkat etmelidir. - - Özel Harmony yamaları(patch)'leri bulunan eklentiler, Harmony örneğinin adında bir değişken kullanmalı ve eklenti devre dışı bırakıldığında veya yeniden yüklendiğinde Harmony örneğini ``UnPatchAll()`` kullanarak iptal etmelidir. + - Özel Harmony yamaları(patch) bulunan eklentiler, Harmony örneğinin adında bir değişken kullanmalı ve eklenti devre dışı bırakıldığında veya yeniden yüklendiğinde Harmony örneğini ``UnPatchAll()`` kullanarak iptal etmelidir. - ``OnEnabled()`` içinde başlatılan herhangi bir coroutine, eklenti devre dışı bırakıldığında veya yeniden yüklendiğinde sonlandırılmalıdır / Bitirilmelidir. Bu işlemlerin hepsi, eklenti sınıfındaki ``OnReloaded()`` veya ``OnDisabled()`` yöntemlerinde gerçekleştirilebilir. EXILED eklentileri yeniden yüklediğinde, İlk olarak ``OnDisabled()``, ardından ``OnReloaded()``, daha sonra yeni derlemeleri yükler ve en son olarak ``OnEnabled()`` yöntemini çalıştırır. @@ -144,10 +144,10 @@ Bu işlemlerin hepsi, eklenti sınıfındaki ``OnReloaded()`` veya ``OnDisabled( Unutmayın ki: bu yeni derlemelerin olduğu anlamına gelir. Eğer aynı isimdeki bir derlemeyi başka bir Derleme ile değiştirir iseniz o derleme ***GÜNCELLENMEZ***. Bu, Global Assembly Cache (GAC) nedeniyledir. Eğer Önbellekte zaten var olan bir derlemeyi 'yüklemeye' çalışır iseniz her zaman önbellekteki derlemeyi kullanır -Bu nedenle, eğer eklentiniz dinamik güncellemeleri destekliyorsa, her sürümü farklı bir derleme adıyla derlemelisiniz (dosyanın adını değiştirmek işe yaramaz). Ayrıca, eski derleme artık gerekli olmadığında "Silinmediği" için, olaylardan abonelik(Subscribe) iptal etmeyi, Harmony örneğinizi iptal etmeyi, coroutine'leri sonlandırmayı vb... unutmazsanız, bu kodun eski sürümü de yeni sürüm koduyla birlikte çalışmaya devam eder. Bu, gerçekleşmesine izin vermek için çok kötü bir fikirdir. +Bu nedenle, eğer eklentiniz dinamik güncellemeleri destekliyorsa, her sürümü farklı bir derleme adıyla derlemelisiniz (dosyanın adını değiştirmek işe yaramaz). Ayrıca, eski derleme artık gerekli olmadığında "Silinmediği" için, olaylardan abonelik(Subscribe) iptal etmeyi, Harmony örneğinizi iptal etmeyi, coroutine'leri sonlandırmayı vs... unutmazsanız, bu kodun eski sürümü de yeni sürüm koduyla birlikte çalışmaya devam eder. Bu, gerçekleşmesine izin vermek için çok kötü bir fikirdir. Bu nedenle, dinamik güncellemeleri destekleyen eklentilerin bu yönergeleri takip etmeleri ***ZORUNLUDUR***; aksi halde potansiyel risk nedeniyle Discord sunucudan kaldırılabilirler. Her eklentinin dinamik güncellemeleri desteklemesi gerekmez. Eğer dinamik güncellemeleri desteklemeyi planlamıyorsanız, bu tamamen uygun bir durumdur. Sadece yeni bir sürüm oluştururken eklentinizin derleme adını değiştirmekten kaçının. Bu tür durumlarda, sunucu sahiplerinin eklentinizi güncellemek için sunucularını tamamen yeniden başlatmaları gerektiğini bildirin. -çeviri: Enes Batur (_funnyman_xdxdxd.rofl.) +çeviri: Enes Batur (@_funnyman_xdxdxd.rofl.) & Dogy (@.dogy69) From d227409f2c338be2e1b6db494581cd650538dbda Mon Sep 17 00:00:00 2001 From: Yamato <66829532+louis1706@users.noreply.github.com> Date: Fri, 26 Jan 2024 01:05:30 +0100 Subject: [PATCH 021/141] Fix spawning ragdoll event args (#2396) * Update for PostXMAS (#2383) * Update for PostXMAS * WeaponFixFromXMAS * remove var * Fix RegisteringEvent * more var remove * 8.7.0 * Fix SpawningRagdoll - not tested * Not needed Change * Revert useless change --- .../Player/SpawningRagdollEventArgs.cs | 12 ++++++------ .../Patches/Events/Player/SpawningRagdoll.cs | 17 ++++++++++------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/Exiled.Events/EventArgs/Player/SpawningRagdollEventArgs.cs b/Exiled.Events/EventArgs/Player/SpawningRagdollEventArgs.cs index 13e7f25bcf..b486a892f5 100644 --- a/Exiled.Events/EventArgs/Player/SpawningRagdollEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/SpawningRagdollEventArgs.cs @@ -28,16 +28,12 @@ public class SpawningRagdollEventArgs : IPlayerEvent, IDeniableEvent /// /// /// - /// - /// - /// /// /// /// - public SpawningRagdollEventArgs(RagdollData info, DamageHandlerBase damageHandlerBase, bool isAllowed = true) + public SpawningRagdollEventArgs(RagdollData info, bool isAllowed = true) { Info = info; - DamageHandlerBase = damageHandlerBase; Player = Player.Get(info.OwnerHub); Scale = Player.Scale; IsAllowed = isAllowed; @@ -97,7 +93,11 @@ public string Nickname /// /// Gets or sets the ragdoll's . /// - public DamageHandlerBase DamageHandlerBase { get; set; } + public DamageHandlerBase DamageHandlerBase + { + get => Info.Handler; + set => Info = new RagdollData(Player.ReferenceHub, value, Role, Position, Rotation, Nickname, CreationTime); + } /// /// Gets or sets a value indicating whether or not the ragdoll can be spawned. diff --git a/Exiled.Events/Patches/Events/Player/SpawningRagdoll.cs b/Exiled.Events/Patches/Events/Player/SpawningRagdoll.cs index 39f5179cef..d4e60b095f 100644 --- a/Exiled.Events/Patches/Events/Player/SpawningRagdoll.cs +++ b/Exiled.Events/Patches/Events/Player/SpawningRagdoll.cs @@ -47,16 +47,16 @@ private static IEnumerable Transpiler(IEnumerable instruction.opcode == OpCodes.Ldloc_1) + offset; + // remove + // "basicRagdoll.NetworkInfo = new RagdollData(owner, handler, transform.localPosition, transform.localRotation);" newInstructions.RemoveRange(index, 7); - index = newInstructions.FindIndex(instruction => instruction.opcode == OpCodes.Ldloc_1); - newInstructions.InsertRange(index, new[] { - // hub + // hub new CodeInstruction(OpCodes.Ldarg_0), // handler @@ -73,9 +73,6 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable Date: Fri, 26 Jan 2024 15:28:05 +0100 Subject: [PATCH 022/141] Fixed `Error CS1729 : 'InternalsVisibleToAttribute' does not contain a constructor that takes 2 arguments` --- Exiled.API/Exiled.API.csproj | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Exiled.API/Exiled.API.csproj b/Exiled.API/Exiled.API.csproj index 23089b1fb7..8488ce823d 100644 --- a/Exiled.API/Exiled.API.csproj +++ b/Exiled.API/Exiled.API.csproj @@ -13,7 +13,9 @@ <_Parameter1>Exiled.Events - <_Parameter2>Exiled.Loader + + + <_Parameter1>Exiled.Loader From dc9efaea5e0793d84f8d418d9dff7a5e1be2d003 Mon Sep 17 00:00:00 2001 From: Naounderscore Date: Fri, 26 Jan 2024 17:43:49 +0100 Subject: [PATCH 023/141] Fix namespace typo --- Exiled.API/Enums/UEBranchType.cs | 2 +- Exiled.API/Enums/UUKeypressTriggerType.cs | 2 +- Exiled.API/Features/Core/EItemBehaviour.cs | 2 +- Exiled.API/Features/Core/EPickupBehaviour.cs | 2 +- Exiled.API/Features/Core/EPlayerBehaviour.cs | 2 +- Exiled.API/Features/Core/{Generics => Generic}/EBehaviour.cs | 2 +- Exiled.API/Features/Core/{Generics => Generic}/EnumClass.cs | 2 +- Exiled.API/Features/Core/{Generics => Generic}/RepNotify.cs | 2 +- .../Features/Core/{Generics => Generic}/ReplicatedProperty.cs | 2 +- Exiled.API/Features/Core/{Generics => Generic}/ReplicatedRef.cs | 2 +- Exiled.API/Features/Core/{Generics => Generic}/Singleton.cs | 2 +- Exiled.API/Features/Core/{Generics => Generic}/StaticActor.cs | 2 +- .../Core/{Generics => Generic}/UniqueUnmanagedEnumClass.cs | 2 +- .../Features/Core/{Generics => Generic}/UnmanagedEnumClass.cs | 2 +- Exiled.API/Features/VirtualAssemblies/VirtualPlugin.cs | 2 +- Exiled.API/Interfaces/IRepNotify.cs | 2 +- Exiled.CustomModules/API/Enums/UEMatchState.cs | 2 +- Exiled.CustomModules/API/Enums/UUCustomEscapeType.cs | 2 +- Exiled.CustomModules/API/Enums/UUCustomItem.cs | 2 +- Exiled.CustomModules/API/Enums/UUCustomRoleType.cs | 2 +- Exiled.CustomModules/API/Enums/UUCustomTeamType.cs | 2 +- Exiled.CustomModules/API/Enums/UUEscapeScenarioType.cs | 2 +- .../API/Features/CustomAbilities/Types/AbilityBehaviourBase.cs | 2 +- Exiled.CustomModules/API/Features/CustomGamemodes/World.cs | 2 +- .../API/Features/CustomItems/Items/Armors/ArmorBehaviour.cs | 2 +- .../Features/CustomItems/Items/Explosives/GrenadeBehaviour.cs | 2 +- .../API/Features/CustomItems/Items/Firearms/FirearmBehaviour.cs | 2 +- .../CustomItems/Items/Firearms/SemiAutomaticFirearmBehaviour.cs | 2 +- Exiled.CustomModules/API/Features/CustomRoles/RoleBehaviour.cs | 2 +- 29 files changed, 29 insertions(+), 29 deletions(-) rename Exiled.API/Features/Core/{Generics => Generic}/EBehaviour.cs (98%) rename Exiled.API/Features/Core/{Generics => Generic}/EnumClass.cs (99%) rename Exiled.API/Features/Core/{Generics => Generic}/RepNotify.cs (98%) rename Exiled.API/Features/Core/{Generics => Generic}/ReplicatedProperty.cs (98%) rename Exiled.API/Features/Core/{Generics => Generic}/ReplicatedRef.cs (98%) rename Exiled.API/Features/Core/{Generics => Generic}/Singleton.cs (98%) rename Exiled.API/Features/Core/{Generics => Generic}/StaticActor.cs (99%) rename Exiled.API/Features/Core/{Generics => Generic}/UniqueUnmanagedEnumClass.cs (99%) rename Exiled.API/Features/Core/{Generics => Generic}/UnmanagedEnumClass.cs (99%) diff --git a/Exiled.API/Enums/UEBranchType.cs b/Exiled.API/Enums/UEBranchType.cs index 43a4ef7425..5433abd074 100644 --- a/Exiled.API/Enums/UEBranchType.cs +++ b/Exiled.API/Enums/UEBranchType.cs @@ -7,7 +7,7 @@ namespace Exiled.API.Enums { - using Exiled.API.Features.Core.Generics; + using Exiled.API.Features.Core.Generic; /// /// All available branch environments. diff --git a/Exiled.API/Enums/UUKeypressTriggerType.cs b/Exiled.API/Enums/UUKeypressTriggerType.cs index 327c728b2a..6d5db36b61 100644 --- a/Exiled.API/Enums/UUKeypressTriggerType.cs +++ b/Exiled.API/Enums/UUKeypressTriggerType.cs @@ -7,7 +7,7 @@ namespace Exiled.API.Enums { - using Exiled.API.Features.Core.Generics; + using Exiled.API.Features.Core.Generic; #pragma warning disable SA1310 // Field names should not contain underscore diff --git a/Exiled.API/Features/Core/EItemBehaviour.cs b/Exiled.API/Features/Core/EItemBehaviour.cs index 743fb34a1e..6264610a95 100644 --- a/Exiled.API/Features/Core/EItemBehaviour.cs +++ b/Exiled.API/Features/Core/EItemBehaviour.cs @@ -7,7 +7,7 @@ namespace Exiled.API.Features.Core { - using Exiled.API.Features.Core.Generics; + using Exiled.API.Features.Core.Generic; using Exiled.API.Features.Items; /// diff --git a/Exiled.API/Features/Core/EPickupBehaviour.cs b/Exiled.API/Features/Core/EPickupBehaviour.cs index 902905d7d2..a5583a15fc 100644 --- a/Exiled.API/Features/Core/EPickupBehaviour.cs +++ b/Exiled.API/Features/Core/EPickupBehaviour.cs @@ -7,7 +7,7 @@ namespace Exiled.API.Features.Core { - using Exiled.API.Features.Core.Generics; + using Exiled.API.Features.Core.Generic; using Exiled.API.Features.Pickups; /// diff --git a/Exiled.API/Features/Core/EPlayerBehaviour.cs b/Exiled.API/Features/Core/EPlayerBehaviour.cs index 358b07dec7..fa6d36bcaf 100644 --- a/Exiled.API/Features/Core/EPlayerBehaviour.cs +++ b/Exiled.API/Features/Core/EPlayerBehaviour.cs @@ -8,7 +8,7 @@ namespace Exiled.API.Features.Core { using Exiled.API.Features; - using Exiled.API.Features.Core.Generics; + using Exiled.API.Features.Core.Generic; /// /// is a versatile component designed to enhance the functionality of playable characters. diff --git a/Exiled.API/Features/Core/Generics/EBehaviour.cs b/Exiled.API/Features/Core/Generic/EBehaviour.cs similarity index 98% rename from Exiled.API/Features/Core/Generics/EBehaviour.cs rename to Exiled.API/Features/Core/Generic/EBehaviour.cs index 9465ccc711..bc827be49f 100644 --- a/Exiled.API/Features/Core/Generics/EBehaviour.cs +++ b/Exiled.API/Features/Core/Generic/EBehaviour.cs @@ -5,7 +5,7 @@ // // ----------------------------------------------------------------------- -namespace Exiled.API.Features.Core.Generics +namespace Exiled.API.Features.Core.Generic { using Exiled.API.Features.Core; diff --git a/Exiled.API/Features/Core/Generics/EnumClass.cs b/Exiled.API/Features/Core/Generic/EnumClass.cs similarity index 99% rename from Exiled.API/Features/Core/Generics/EnumClass.cs rename to Exiled.API/Features/Core/Generic/EnumClass.cs index 1c95b630b7..e89649d626 100644 --- a/Exiled.API/Features/Core/Generics/EnumClass.cs +++ b/Exiled.API/Features/Core/Generic/EnumClass.cs @@ -5,7 +5,7 @@ // // ----------------------------------------------------------------------- -namespace Exiled.API.Features.Core.Generics +namespace Exiled.API.Features.Core.Generic { using System; using System.Collections.Generic; diff --git a/Exiled.API/Features/Core/Generics/RepNotify.cs b/Exiled.API/Features/Core/Generic/RepNotify.cs similarity index 98% rename from Exiled.API/Features/Core/Generics/RepNotify.cs rename to Exiled.API/Features/Core/Generic/RepNotify.cs index f59bf8fc71..c90b64e15d 100644 --- a/Exiled.API/Features/Core/Generics/RepNotify.cs +++ b/Exiled.API/Features/Core/Generic/RepNotify.cs @@ -5,7 +5,7 @@ // // ----------------------------------------------------------------------- -namespace Exiled.API.Features.Core.Generics +namespace Exiled.API.Features.Core.Generic { using System.Reflection; diff --git a/Exiled.API/Features/Core/Generics/ReplicatedProperty.cs b/Exiled.API/Features/Core/Generic/ReplicatedProperty.cs similarity index 98% rename from Exiled.API/Features/Core/Generics/ReplicatedProperty.cs rename to Exiled.API/Features/Core/Generic/ReplicatedProperty.cs index bc584c1921..8dcbe742b7 100644 --- a/Exiled.API/Features/Core/Generics/ReplicatedProperty.cs +++ b/Exiled.API/Features/Core/Generic/ReplicatedProperty.cs @@ -5,7 +5,7 @@ // // ----------------------------------------------------------------------- -namespace Exiled.API.Features.Core.Generics +namespace Exiled.API.Features.Core.Generic { using System; diff --git a/Exiled.API/Features/Core/Generics/ReplicatedRef.cs b/Exiled.API/Features/Core/Generic/ReplicatedRef.cs similarity index 98% rename from Exiled.API/Features/Core/Generics/ReplicatedRef.cs rename to Exiled.API/Features/Core/Generic/ReplicatedRef.cs index 44c1d90dca..0e58d86389 100644 --- a/Exiled.API/Features/Core/Generics/ReplicatedRef.cs +++ b/Exiled.API/Features/Core/Generic/ReplicatedRef.cs @@ -5,7 +5,7 @@ // // ----------------------------------------------------------------------- -namespace Exiled.API.Features.Core.Generics +namespace Exiled.API.Features.Core.Generic { using Exiled.API.Features.Core.Attributes; using Exiled.API.Features.Core.EventArgs; diff --git a/Exiled.API/Features/Core/Generics/Singleton.cs b/Exiled.API/Features/Core/Generic/Singleton.cs similarity index 98% rename from Exiled.API/Features/Core/Generics/Singleton.cs rename to Exiled.API/Features/Core/Generic/Singleton.cs index 945cb90356..9b4809e653 100644 --- a/Exiled.API/Features/Core/Generics/Singleton.cs +++ b/Exiled.API/Features/Core/Generic/Singleton.cs @@ -5,7 +5,7 @@ // // ----------------------------------------------------------------------- -namespace Exiled.API.Features.Core.Generics +namespace Exiled.API.Features.Core.Generic { using System.Collections.Generic; using System.Linq; diff --git a/Exiled.API/Features/Core/Generics/StaticActor.cs b/Exiled.API/Features/Core/Generic/StaticActor.cs similarity index 99% rename from Exiled.API/Features/Core/Generics/StaticActor.cs rename to Exiled.API/Features/Core/Generic/StaticActor.cs index 62bbbd39b2..90019ede23 100644 --- a/Exiled.API/Features/Core/Generics/StaticActor.cs +++ b/Exiled.API/Features/Core/Generic/StaticActor.cs @@ -5,7 +5,7 @@ // // ----------------------------------------------------------------------- -namespace Exiled.API.Features.Core.Generics +namespace Exiled.API.Features.Core.Generic { using Exiled.API.Features; using Exiled.API.Features.Core; diff --git a/Exiled.API/Features/Core/Generics/UniqueUnmanagedEnumClass.cs b/Exiled.API/Features/Core/Generic/UniqueUnmanagedEnumClass.cs similarity index 99% rename from Exiled.API/Features/Core/Generics/UniqueUnmanagedEnumClass.cs rename to Exiled.API/Features/Core/Generic/UniqueUnmanagedEnumClass.cs index 58ca57b50e..61e27e3f91 100644 --- a/Exiled.API/Features/Core/Generics/UniqueUnmanagedEnumClass.cs +++ b/Exiled.API/Features/Core/Generic/UniqueUnmanagedEnumClass.cs @@ -5,7 +5,7 @@ // // ----------------------------------------------------------------------- -namespace Exiled.API.Features.Core.Generics +namespace Exiled.API.Features.Core.Generic { using System; using System.Collections.Generic; diff --git a/Exiled.API/Features/Core/Generics/UnmanagedEnumClass.cs b/Exiled.API/Features/Core/Generic/UnmanagedEnumClass.cs similarity index 99% rename from Exiled.API/Features/Core/Generics/UnmanagedEnumClass.cs rename to Exiled.API/Features/Core/Generic/UnmanagedEnumClass.cs index d751d0bb9b..2b2270a76e 100644 --- a/Exiled.API/Features/Core/Generics/UnmanagedEnumClass.cs +++ b/Exiled.API/Features/Core/Generic/UnmanagedEnumClass.cs @@ -5,7 +5,7 @@ // // ----------------------------------------------------------------------- -namespace Exiled.API.Features.Core.Generics +namespace Exiled.API.Features.Core.Generic { using System; using System.Collections.Generic; diff --git a/Exiled.API/Features/VirtualAssemblies/VirtualPlugin.cs b/Exiled.API/Features/VirtualAssemblies/VirtualPlugin.cs index 5af54e7db6..686532ac33 100644 --- a/Exiled.API/Features/VirtualAssemblies/VirtualPlugin.cs +++ b/Exiled.API/Features/VirtualAssemblies/VirtualPlugin.cs @@ -17,7 +17,7 @@ namespace Exiled.API.Features.VirtualAssemblies using Exiled.API.Extensions; using Exiled.API.Features; using Exiled.API.Features.Core; - using Exiled.API.Features.Core.Generics; + using Exiled.API.Features.Core.Generic; using Exiled.API.Features.DynamicEvents; using Exiled.API.Features.VirtualAssemblies.EventArgs; using Exiled.API.Interfaces; diff --git a/Exiled.API/Interfaces/IRepNotify.cs b/Exiled.API/Interfaces/IRepNotify.cs index 76d787542f..eaa2a3672a 100644 --- a/Exiled.API/Interfaces/IRepNotify.cs +++ b/Exiled.API/Interfaces/IRepNotify.cs @@ -7,7 +7,7 @@ namespace Exiled.API.Interfaces { - using Exiled.API.Features.Core.Generics; + using Exiled.API.Features.Core.Generic; /// /// Represents an interface for objects that provide replication notifications. diff --git a/Exiled.CustomModules/API/Enums/UEMatchState.cs b/Exiled.CustomModules/API/Enums/UEMatchState.cs index 986172eae1..a5633eae17 100644 --- a/Exiled.CustomModules/API/Enums/UEMatchState.cs +++ b/Exiled.CustomModules/API/Enums/UEMatchState.cs @@ -7,7 +7,7 @@ namespace Exiled.CustomModules.API.Enums { - using Exiled.API.Features.Core.Generics; + using Exiled.API.Features.Core.Generic; /// /// All available match states. diff --git a/Exiled.CustomModules/API/Enums/UUCustomEscapeType.cs b/Exiled.CustomModules/API/Enums/UUCustomEscapeType.cs index 647b03bed2..2f43d48317 100644 --- a/Exiled.CustomModules/API/Enums/UUCustomEscapeType.cs +++ b/Exiled.CustomModules/API/Enums/UUCustomEscapeType.cs @@ -7,7 +7,7 @@ namespace Exiled.CustomModules.API.Enums { - using Exiled.API.Features.Core.Generics; + using Exiled.API.Features.Core.Generic; /// /// Represents the base enum class for all available custom escapes. diff --git a/Exiled.CustomModules/API/Enums/UUCustomItem.cs b/Exiled.CustomModules/API/Enums/UUCustomItem.cs index d620953d0f..6cb72112aa 100644 --- a/Exiled.CustomModules/API/Enums/UUCustomItem.cs +++ b/Exiled.CustomModules/API/Enums/UUCustomItem.cs @@ -7,7 +7,7 @@ namespace Exiled.CustomModules.API.Enums { - using Exiled.API.Features.Core.Generics; + using Exiled.API.Features.Core.Generic; /// /// Represents the base enum class for all available custom items. diff --git a/Exiled.CustomModules/API/Enums/UUCustomRoleType.cs b/Exiled.CustomModules/API/Enums/UUCustomRoleType.cs index 2f43b63e64..f013b890b4 100644 --- a/Exiled.CustomModules/API/Enums/UUCustomRoleType.cs +++ b/Exiled.CustomModules/API/Enums/UUCustomRoleType.cs @@ -7,7 +7,7 @@ namespace Exiled.CustomModules.API.Enums { - using Exiled.API.Features.Core.Generics; + using Exiled.API.Features.Core.Generic; /// /// Represents the base enum class for all available custom roles. diff --git a/Exiled.CustomModules/API/Enums/UUCustomTeamType.cs b/Exiled.CustomModules/API/Enums/UUCustomTeamType.cs index fa4d53d55e..ee4f77594f 100644 --- a/Exiled.CustomModules/API/Enums/UUCustomTeamType.cs +++ b/Exiled.CustomModules/API/Enums/UUCustomTeamType.cs @@ -7,7 +7,7 @@ namespace Exiled.CustomModules.API.Enums { - using Exiled.API.Features.Core.Generics; + using Exiled.API.Features.Core.Generic; /// /// Represents the base enum class for all available custom teams. diff --git a/Exiled.CustomModules/API/Enums/UUEscapeScenarioType.cs b/Exiled.CustomModules/API/Enums/UUEscapeScenarioType.cs index 599b52c7a3..4f7c928195 100644 --- a/Exiled.CustomModules/API/Enums/UUEscapeScenarioType.cs +++ b/Exiled.CustomModules/API/Enums/UUEscapeScenarioType.cs @@ -7,7 +7,7 @@ namespace Exiled.CustomModules.API.Enums { - using Exiled.API.Features.Core.Generics; + using Exiled.API.Features.Core.Generic; /// /// Represents the base enum class for all available escape scenarios. diff --git a/Exiled.CustomModules/API/Features/CustomAbilities/Types/AbilityBehaviourBase.cs b/Exiled.CustomModules/API/Features/CustomAbilities/Types/AbilityBehaviourBase.cs index 2c8f5d0f97..04620bc349 100644 --- a/Exiled.CustomModules/API/Features/CustomAbilities/Types/AbilityBehaviourBase.cs +++ b/Exiled.CustomModules/API/Features/CustomAbilities/Types/AbilityBehaviourBase.cs @@ -10,7 +10,7 @@ namespace Exiled.CustomModules.API.Features.CustomAbilities using System.Reflection; using Exiled.API.Features.Core; - using Exiled.API.Features.Core.Generics; + using Exiled.API.Features.Core.Generic; using Exiled.API.Features.Core.Interfaces; using Exiled.API.Features.DynamicEvents; using Exiled.CustomModules.API.Features.CustomAbilities.Settings; diff --git a/Exiled.CustomModules/API/Features/CustomGamemodes/World.cs b/Exiled.CustomModules/API/Features/CustomGamemodes/World.cs index 73525260e6..19945a9175 100644 --- a/Exiled.CustomModules/API/Features/CustomGamemodes/World.cs +++ b/Exiled.CustomModules/API/Features/CustomGamemodes/World.cs @@ -7,7 +7,7 @@ namespace Exiled.CustomModules.API.Features { - using Exiled.API.Features.Core.Generics; + using Exiled.API.Features.Core.Generic; /// /// The world base. diff --git a/Exiled.CustomModules/API/Features/CustomItems/Items/Armors/ArmorBehaviour.cs b/Exiled.CustomModules/API/Features/CustomItems/Items/Armors/ArmorBehaviour.cs index 563bf63dcf..feeb2833a8 100644 --- a/Exiled.CustomModules/API/Features/CustomItems/Items/Armors/ArmorBehaviour.cs +++ b/Exiled.CustomModules/API/Features/CustomItems/Items/Armors/ArmorBehaviour.cs @@ -8,7 +8,7 @@ namespace Exiled.CustomModules.API.Features.CustomItems.Items.Armors { using Exiled.API.Features; - using Exiled.API.Features.Core.Generics; + using Exiled.API.Features.Core.Generic; using Exiled.API.Features.Items; using Exiled.CustomModules.API.Features.CustomItems.Items; diff --git a/Exiled.CustomModules/API/Features/CustomItems/Items/Explosives/GrenadeBehaviour.cs b/Exiled.CustomModules/API/Features/CustomItems/Items/Explosives/GrenadeBehaviour.cs index 72768c3c33..73091af733 100644 --- a/Exiled.CustomModules/API/Features/CustomItems/Items/Explosives/GrenadeBehaviour.cs +++ b/Exiled.CustomModules/API/Features/CustomItems/Items/Explosives/GrenadeBehaviour.cs @@ -9,7 +9,7 @@ namespace Exiled.CustomModules.API.Features.CustomItems.Items.Explosives { using Exiled.API.Features; using Exiled.API.Features.Components; - using Exiled.API.Features.Core.Generics; + using Exiled.API.Features.Core.Generic; using Exiled.API.Features.Items; using Exiled.API.Features.Pickups; using Exiled.API.Features.Pickups.Projectiles; diff --git a/Exiled.CustomModules/API/Features/CustomItems/Items/Firearms/FirearmBehaviour.cs b/Exiled.CustomModules/API/Features/CustomItems/Items/Firearms/FirearmBehaviour.cs index 215626e71c..82ac5c8445 100644 --- a/Exiled.CustomModules/API/Features/CustomItems/Items/Firearms/FirearmBehaviour.cs +++ b/Exiled.CustomModules/API/Features/CustomItems/Items/Firearms/FirearmBehaviour.cs @@ -13,7 +13,7 @@ namespace Exiled.CustomModules.API.Features.CustomItems.Items.Firearms using Exiled.API.Enums; using Exiled.API.Extensions; using Exiled.API.Features; - using Exiled.API.Features.Core.Generics; + using Exiled.API.Features.Core.Generic; using Exiled.API.Features.Items; using Exiled.CustomModules.API.Features.CustomItems.Items; using Exiled.Events.EventArgs.Item; diff --git a/Exiled.CustomModules/API/Features/CustomItems/Items/Firearms/SemiAutomaticFirearmBehaviour.cs b/Exiled.CustomModules/API/Features/CustomItems/Items/Firearms/SemiAutomaticFirearmBehaviour.cs index d1942167ca..a0a34a8f9e 100644 --- a/Exiled.CustomModules/API/Features/CustomItems/Items/Firearms/SemiAutomaticFirearmBehaviour.cs +++ b/Exiled.CustomModules/API/Features/CustomItems/Items/Firearms/SemiAutomaticFirearmBehaviour.cs @@ -9,7 +9,7 @@ namespace Exiled.CustomModules.API.Features.CustomItems.Items.Firearms { using System.Collections.Generic; - using Exiled.API.Features.Core.Generics; + using Exiled.API.Features.Core.Generic; using Exiled.API.Features.Items; using Exiled.CustomModules.API.Enums; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.CustomModules/API/Features/CustomRoles/RoleBehaviour.cs b/Exiled.CustomModules/API/Features/CustomRoles/RoleBehaviour.cs index 50bb8f4758..e2ac1d8fba 100644 --- a/Exiled.CustomModules/API/Features/CustomRoles/RoleBehaviour.cs +++ b/Exiled.CustomModules/API/Features/CustomRoles/RoleBehaviour.cs @@ -17,7 +17,7 @@ namespace Exiled.CustomModules.API.Features.CustomRoles using Exiled.API.Extensions; using Exiled.API.Features; using Exiled.API.Features.Core; - using Exiled.API.Features.Core.Generics; + using Exiled.API.Features.Core.Generic; using Exiled.API.Features.Core.Interfaces; using Exiled.API.Features.DynamicEvents; using Exiled.API.Features.Pools; From cf73fdb12162cba7a0c12b772905458b990374d8 Mon Sep 17 00:00:00 2001 From: Naounderscore Date: Fri, 26 Jan 2024 17:46:23 +0100 Subject: [PATCH 024/141] Moved `Pools` to `Core::Generic` --- Exiled.API/Extensions/MirrorExtensions.cs | 2 +- Exiled.API/Extensions/QueueExtensions.cs | 2 +- Exiled.API/Extensions/StringExtensions.cs | 2 +- Exiled.API/Features/Cassie.cs | 2 +- Exiled.API/Features/Core/EActor.cs | 2 +- Exiled.API/Features/Core/EObject.cs | 2 +- Exiled.API/Features/Core/Generic/EnumClass.cs | 2 +- .../Features/{ => Core/Generic}/Pools/DictionaryPool.cs | 2 +- Exiled.API/Features/{ => Core/Generic}/Pools/HashSetPool.cs | 2 +- Exiled.API/Features/{ => Core/Generic}/Pools/ListPool.cs | 2 +- Exiled.API/Features/{ => Core/Generic}/Pools/QueuePool.cs | 2 +- .../Features/{ => Core/Generic}/Pools/StringBuilderPool.cs | 2 +- Exiled.API/Features/Core/Generic/UniqueUnmanagedEnumClass.cs | 2 +- Exiled.API/Features/Core/Generic/UnmanagedEnumClass.cs | 2 +- Exiled.API/Features/{Pools => Core/Interfaces}/IPool.cs | 2 +- Exiled.API/Features/Core/TickComponent.cs | 2 +- Exiled.API/Features/Lift.cs | 2 +- Exiled.API/Features/Player.cs | 2 +- Exiled.API/Features/Roles/FpcRole.cs | 2 +- Exiled.API/Features/Roles/Scp939Role.cs | 2 +- Exiled.API/Features/Scp914.cs | 2 +- .../Features/Serialization/CustomConverters/ColorConverter.cs | 2 +- .../Serialization/CustomConverters/VectorsConverter.cs | 2 +- .../API/Features/CustomAbilities/AbilityInputComponent.cs | 2 +- .../API/Features/CustomRoles/RoleBehaviour.cs | 4 +--- .../Patches/CustomItems/PlayerInventorySee.cs | 4 ++-- Exiled.Events/Commands/PluginManager/Show.cs | 2 +- Exiled.Events/EventArgs/Map/ExplodingGrenadeEventArgs.cs | 2 +- Exiled.Events/EventArgs/Player/ChangingRoleEventArgs.cs | 2 +- .../EventArgs/Server/ChoosingStartTeamQueueEventArgs.cs | 2 +- Exiled.Events/Features/Patcher.cs | 2 +- Exiled.Events/Handlers/Internal/MapGenerated.cs | 2 +- Exiled.Events/Patches/Events/Cassie/SendingCassieMessage.cs | 2 +- Exiled.Events/Patches/Events/Item/ChangingAmmo.cs | 2 +- Exiled.Events/Patches/Events/Item/ChangingAttachments.cs | 2 +- Exiled.Events/Patches/Events/Item/KeycardInteracting.cs | 2 +- Exiled.Events/Patches/Events/Item/ReceivingPreference.cs | 2 +- Exiled.Events/Patches/Events/Item/UsingRadioPickupBattery.cs | 2 +- Exiled.Events/Patches/Events/Map/AnnouncingDecontamination.cs | 2 +- Exiled.Events/Patches/Events/Map/AnnouncingNtfEntrance.cs | 2 +- Exiled.Events/Patches/Events/Map/AnnouncingScpTermination.cs | 2 +- Exiled.Events/Patches/Events/Map/BreakingScp2176.cs | 2 +- Exiled.Events/Patches/Events/Map/ChangingIntoGrenade.cs | 2 +- Exiled.Events/Patches/Events/Map/Decontaminating.cs | 2 +- Exiled.Events/Patches/Events/Map/ExplodingFlashGrenade.cs | 2 +- Exiled.Events/Patches/Events/Map/ExplodingFragGrenade.cs | 2 +- Exiled.Events/Patches/Events/Map/FillingLocker.cs | 2 +- Exiled.Events/Patches/Events/Map/GeneratorActivating.cs | 2 +- Exiled.Events/Patches/Events/Map/PlacingBlood.cs | 2 +- Exiled.Events/Patches/Events/Map/PlacingBulletHole.cs | 2 +- Exiled.Events/Patches/Events/Map/SpawningItem.cs | 2 +- Exiled.Events/Patches/Events/Map/SpawningTeamVehicle.cs | 2 +- Exiled.Events/Patches/Events/Map/TurningOffLights.cs | 2 +- Exiled.Events/Patches/Events/Player/ActivatingWarheadPanel.cs | 2 +- Exiled.Events/Patches/Events/Player/ActivatingWorkstation.cs | 2 +- Exiled.Events/Patches/Events/Player/AddingItem.cs | 2 +- Exiled.Events/Patches/Events/Player/Banned.cs | 2 +- Exiled.Events/Patches/Events/Player/Banning.cs | 2 +- Exiled.Events/Patches/Events/Player/ChangedItem.cs | 2 +- Exiled.Events/Patches/Events/Player/ChangingGroup.cs | 2 +- Exiled.Events/Patches/Events/Player/ChangingItem.cs | 2 +- Exiled.Events/Patches/Events/Player/ChangingMicroHIDState.cs | 2 +- Exiled.Events/Patches/Events/Player/ChangingMoveState.cs | 2 +- Exiled.Events/Patches/Events/Player/ChangingNickname.cs | 2 +- Exiled.Events/Patches/Events/Player/ChangingRadioPreset.cs | 2 +- Exiled.Events/Patches/Events/Player/ChangingRoleAndSpawned.cs | 2 +- .../Patches/Events/Player/ChangingSpectatedPlayerPatch.cs | 2 +- Exiled.Events/Patches/Events/Player/DamagingDoor.cs | 2 +- Exiled.Events/Patches/Events/Player/DamagingShootingTarget.cs | 2 +- Exiled.Events/Patches/Events/Player/DamagingWindow.cs | 2 +- .../Patches/Events/Player/DeactivatingWorkstation.cs | 2 +- Exiled.Events/Patches/Events/Player/Destroying.cs | 2 +- Exiled.Events/Patches/Events/Player/DroppingAmmo.cs | 2 +- Exiled.Events/Patches/Events/Player/DroppingItem.cs | 2 +- Exiled.Events/Patches/Events/Player/DyingAndDied.cs | 2 +- Exiled.Events/Patches/Events/Player/EarningAchievement.cs | 2 +- .../Patches/Events/Player/EnteringKillerCollision.cs | 2 +- .../Patches/Events/Player/EnteringPocketDimension.cs | 2 +- .../Events/Player/EnteringSinkholeEnvironmentalHazard.cs | 2 +- .../Events/Player/EnteringTantrumEnvironmentalHazard.cs | 2 +- Exiled.Events/Patches/Events/Player/Escaping.cs | 2 +- .../Patches/Events/Player/EscapingPocketDimension.cs | 2 +- .../Events/Player/ExitingSinkholeEnvironmentalHazard.cs | 2 +- .../Events/Player/ExitingTantrumEnvironmentalHazard.cs | 2 +- .../Patches/Events/Player/FailingEscapePocketDimension.cs | 2 +- Exiled.Events/Patches/Events/Player/FirearmRequestReceived.cs | 2 +- Exiled.Events/Patches/Events/Player/FlippingCoin.cs | 2 +- Exiled.Events/Patches/Events/Player/Hurting.cs | 2 +- Exiled.Events/Patches/Events/Player/Interacted.cs | 2 +- Exiled.Events/Patches/Events/Player/InteractingDoor.cs | 2 +- Exiled.Events/Patches/Events/Player/InteractingElevator.cs | 2 +- Exiled.Events/Patches/Events/Player/InteractingGenerator.cs | 2 +- Exiled.Events/Patches/Events/Player/InteractingLocker.cs | 2 +- .../Patches/Events/Player/InteractingShootingTarget.cs | 2 +- Exiled.Events/Patches/Events/Player/IntercomSpeaking.cs | 2 +- Exiled.Events/Patches/Events/Player/IssuingMute.cs | 2 +- Exiled.Events/Patches/Events/Player/Jumping.cs | 2 +- Exiled.Events/Patches/Events/Player/Kicked.cs | 2 +- Exiled.Events/Patches/Events/Player/Kicking.cs | 2 +- Exiled.Events/Patches/Events/Player/Landing.cs | 2 +- Exiled.Events/Patches/Events/Player/Left.cs | 2 +- Exiled.Events/Patches/Events/Player/MakingNoise.cs | 2 +- Exiled.Events/Patches/Events/Player/PickingUp330.cs | 2 +- Exiled.Events/Patches/Events/Player/PickingUpAmmo.cs | 2 +- Exiled.Events/Patches/Events/Player/PickingUpArmor.cs | 2 +- Exiled.Events/Patches/Events/Player/PickingUpItem.cs | 2 +- Exiled.Events/Patches/Events/Player/PickingUpScp244.cs | 2 +- Exiled.Events/Patches/Events/Player/ProcessDisarmMessage.cs | 2 +- Exiled.Events/Patches/Events/Player/ReceivingStatusEffect.cs | 2 +- Exiled.Events/Patches/Events/Player/RemovingItem.cs | 2 +- Exiled.Events/Patches/Events/Player/ReservedSlotPatch.cs | 2 +- Exiled.Events/Patches/Events/Player/RevokingMute.cs | 2 +- Exiled.Events/Patches/Events/Player/SearchingPickupEvent.cs | 2 +- .../Patches/Events/Player/SendingAdminChatMessage.cs | 2 +- Exiled.Events/Patches/Events/Player/Shooting.cs | 2 +- Exiled.Events/Patches/Events/Player/Shot.cs | 2 +- Exiled.Events/Patches/Events/Player/SpawningRagdoll.cs | 2 +- .../Patches/Events/Player/StayingOnEnvironmentalHazard.cs | 2 +- .../Events/Player/StayingOnSinkholeEnvironmentalHazard.cs | 2 +- .../Events/Player/StayingOnTantrumEnvironmentalHazard.cs | 2 +- Exiled.Events/Patches/Events/Player/ThrowingRequest.cs | 2 +- Exiled.Events/Patches/Events/Player/ThrownProjectile.cs | 2 +- Exiled.Events/Patches/Events/Player/TogglingFlashlight.cs | 2 +- Exiled.Events/Patches/Events/Player/TogglingNoClip.cs | 2 +- Exiled.Events/Patches/Events/Player/TogglingOverwatch.cs | 2 +- Exiled.Events/Patches/Events/Player/TogglingRadio.cs | 2 +- Exiled.Events/Patches/Events/Player/TriggeringTesla.cs | 2 +- .../Patches/Events/Player/UsingAndCancellingItemUse.cs | 2 +- Exiled.Events/Patches/Events/Player/UsingItemCompleted.cs | 2 +- Exiled.Events/Patches/Events/Player/UsingMicroHIDEnergy.cs | 2 +- Exiled.Events/Patches/Events/Player/UsingRadioBattery.cs | 2 +- Exiled.Events/Patches/Events/Player/Verified.cs | 2 +- Exiled.Events/Patches/Events/Player/VoiceChatting.cs | 2 +- Exiled.Events/Patches/Events/Scp049/ActivatingSense.cs | 2 +- Exiled.Events/Patches/Events/Scp049/Attacking.cs | 2 +- Exiled.Events/Patches/Events/Scp049/FinishingRecall.cs | 2 +- Exiled.Events/Patches/Events/Scp049/SendingCall.cs | 2 +- Exiled.Events/Patches/Events/Scp049/StartingRecall.cs | 2 +- Exiled.Events/Patches/Events/Scp0492/Consumed.cs | 2 +- Exiled.Events/Patches/Events/Scp0492/Consuming.cs | 2 +- .../Patches/Events/Scp0492/TriggeringBloodlustEvent.cs | 2 +- Exiled.Events/Patches/Events/Scp079/ChangingCamera.cs | 2 +- .../Events/Scp079/ChangingSpeakerStatusAndVoiceChatting.cs | 2 +- Exiled.Events/Patches/Events/Scp079/ElevatorTeleporting.cs | 2 +- Exiled.Events/Patches/Events/Scp079/GainingExperience.cs | 2 +- Exiled.Events/Patches/Events/Scp079/GainingLevel.cs | 2 +- Exiled.Events/Patches/Events/Scp079/InteractingTesla.cs | 2 +- Exiled.Events/Patches/Events/Scp079/LockingDown.cs | 2 +- Exiled.Events/Patches/Events/Scp079/Pinging.cs | 2 +- Exiled.Events/Patches/Events/Scp079/RoomBlackout.cs | 2 +- Exiled.Events/Patches/Events/Scp079/TriggeringDoor.cs | 2 +- Exiled.Events/Patches/Events/Scp079/ZoneBlackout.cs | 2 +- Exiled.Events/Patches/Events/Scp096/AddingTarget.cs | 2 +- Exiled.Events/Patches/Events/Scp096/CalmingDown.cs | 2 +- Exiled.Events/Patches/Events/Scp096/Charging.cs | 2 +- Exiled.Events/Patches/Events/Scp096/Enraging.cs | 2 +- Exiled.Events/Patches/Events/Scp096/StartPryingGate.cs | 2 +- Exiled.Events/Patches/Events/Scp096/TryingNotToCry.cs | 2 +- Exiled.Events/Patches/Events/Scp106/Attacking.cs | 2 +- Exiled.Events/Patches/Events/Scp106/ExitStalking.cs | 2 +- Exiled.Events/Patches/Events/Scp106/Stalking.cs | 2 +- Exiled.Events/Patches/Events/Scp106/Teleporting.cs | 2 +- Exiled.Events/Patches/Events/Scp173/Blinking.cs | 2 +- Exiled.Events/Patches/Events/Scp173/BlinkingRequest.cs | 2 +- Exiled.Events/Patches/Events/Scp173/PlacingTantrum.cs | 2 +- Exiled.Events/Patches/Events/Scp173/UsingBreakneckSpeeds.cs | 2 +- Exiled.Events/Patches/Events/Scp244/DamagingScp244.cs | 2 +- Exiled.Events/Patches/Events/Scp244/UpdateScp244.cs | 2 +- Exiled.Events/Patches/Events/Scp244/UsingScp244.cs | 2 +- Exiled.Events/Patches/Events/Scp3114/Revealing.cs | 2 +- Exiled.Events/Patches/Events/Scp3114/Strangling.cs | 2 +- Exiled.Events/Patches/Events/Scp3114/TryUseBody.cs | 2 +- Exiled.Events/Patches/Events/Scp3114/VoiceLines.cs | 2 +- Exiled.Events/Patches/Events/Scp330/DroppingCandy.cs | 2 +- Exiled.Events/Patches/Events/Scp330/EatingScp330.cs | 2 +- Exiled.Events/Patches/Events/Scp330/InteractingScp330.cs | 2 +- Exiled.Events/Patches/Events/Scp914/InteractingEvents.cs | 2 +- Exiled.Events/Patches/Events/Scp914/UpgradingItem.cs | 2 +- Exiled.Events/Patches/Events/Scp914/UpgradingPlayer.cs | 2 +- Exiled.Events/Patches/Events/Scp939/Clawed.cs | 2 +- Exiled.Events/Patches/Events/Scp939/Focus.cs | 2 +- Exiled.Events/Patches/Events/Scp939/Lunge.cs | 2 +- Exiled.Events/Patches/Events/Scp939/PlacingAmnesticCloud.cs | 2 +- Exiled.Events/Patches/Events/Scp939/PlayingVoice.cs | 2 +- Exiled.Events/Patches/Events/Scp939/SavingVoice.cs | 2 +- Exiled.Events/Patches/Events/Server/AddingUnitName.cs | 2 +- Exiled.Events/Patches/Events/Server/ChoosingStartTeamQueue.cs | 2 +- Exiled.Events/Patches/Events/Server/Reporting.cs | 2 +- Exiled.Events/Patches/Events/Server/RespawningTeam.cs | 2 +- Exiled.Events/Patches/Events/Server/RestartingRound.cs | 2 +- Exiled.Events/Patches/Events/Server/RoundEnd.cs | 2 +- Exiled.Events/Patches/Events/Server/SelectingRespawnTeam.cs | 2 +- Exiled.Events/Patches/Events/Warhead/ChangingLeverStatus.cs | 2 +- Exiled.Events/Patches/Events/Warhead/Detonation.cs | 2 +- Exiled.Events/Patches/Events/Warhead/Starting.cs | 2 +- Exiled.Events/Patches/Events/Warhead/Stopping.cs | 2 +- Exiled.Events/Patches/Fixes/FixPickupPreviousOwner.cs | 2 +- Exiled.Events/Patches/Fixes/GetAmmoLimitFix.cs | 2 +- Exiled.Events/Patches/Fixes/GrenadePropertiesFix.cs | 2 +- Exiled.Events/Patches/Fixes/HurtingFix.cs | 2 +- Exiled.Events/Patches/Fixes/LockerFixes.cs | 2 +- Exiled.Events/Patches/Fixes/PositionSpawnScp0492Fix.cs | 2 +- Exiled.Events/Patches/Fixes/Scp3114AttackAhpFix.cs | 2 +- Exiled.Events/Patches/Fixes/VoiceChatMutesClear.cs | 2 +- Exiled.Events/Patches/Fixes/WeaponAttachmentDesyncFix.cs | 2 +- Exiled.Events/Patches/Generic/CameraList.cs | 2 +- Exiled.Events/Patches/Generic/CanScp049SenseTutorial.cs | 2 +- Exiled.Events/Patches/Generic/CommandLogging.cs | 2 +- Exiled.Events/Patches/Generic/DestroyRecontainerInstance.cs | 2 +- Exiled.Events/Patches/Generic/GeneratorList.cs | 2 +- Exiled.Events/Patches/Generic/GhostModePatch.cs | 2 +- Exiled.Events/Patches/Generic/IndividualFriendlyFire.cs | 2 +- Exiled.Events/Patches/Generic/InitRecontainerInstance.cs | 2 +- Exiled.Events/Patches/Generic/InventoryControlPatch.cs | 2 +- Exiled.Events/Patches/Generic/LockerList.cs | 2 +- Exiled.Events/Patches/Generic/ParseVisionInformation.cs | 2 +- Exiled.Events/Patches/Generic/PickupControlPatch.cs | 2 +- Exiled.Events/Patches/Generic/RoomList.cs | 2 +- .../Patches/Generic/Scp049API/CallAbilityDuration.cs | 2 +- .../Patches/Generic/Scp049API/SenseAbilityBaseCooldown.cs | 2 +- .../Patches/Generic/Scp049API/SenseAbilityReducedCooldown.cs | 2 +- Exiled.Events/Patches/Generic/Scp079Scan.cs | 2 +- .../Patches/Generic/Scp106API/CooldownReductionReward.cs | 2 +- Exiled.Events/Patches/Generic/Scp106API/CustomAttack.cs | 2 +- .../Patches/Generic/Scp106API/HunterAtlastCostPerMetter.cs | 2 +- .../Patches/Generic/Scp106API/SinkholeAbilityCooldown.cs | 2 +- Exiled.Events/Patches/Generic/Scp106API/StalkVigorUse.cs | 2 +- Exiled.Events/Patches/Generic/Scp106API/VigorRegeneration.cs | 2 +- Exiled.Events/Patches/Generic/Scp173BeingLooked.cs | 2 +- Exiled.Loader/ConfigManager.cs | 2 +- Exiled.Loader/TranslationManager.cs | 2 +- Exiled.Permissions/Commands/Permissions/Group/Group.cs | 2 +- Exiled.Permissions/Commands/Permissions/Permissions.cs | 2 +- Exiled.Permissions/Extensions/Permissions.cs | 2 +- 234 files changed, 235 insertions(+), 237 deletions(-) rename Exiled.API/Features/{ => Core/Generic}/Pools/DictionaryPool.cs (98%) rename Exiled.API/Features/{ => Core/Generic}/Pools/HashSetPool.cs (97%) rename Exiled.API/Features/{ => Core/Generic}/Pools/ListPool.cs (98%) rename Exiled.API/Features/{ => Core/Generic}/Pools/QueuePool.cs (98%) rename Exiled.API/Features/{ => Core/Generic}/Pools/StringBuilderPool.cs (97%) rename Exiled.API/Features/{Pools => Core/Interfaces}/IPool.cs (95%) diff --git a/Exiled.API/Extensions/MirrorExtensions.cs b/Exiled.API/Extensions/MirrorExtensions.cs index 1d25f89592..7baf72eb64 100644 --- a/Exiled.API/Extensions/MirrorExtensions.cs +++ b/Exiled.API/Extensions/MirrorExtensions.cs @@ -16,7 +16,7 @@ namespace Exiled.API.Extensions using System.Text; using Features; - using Features.Pools; + using Features.Core.Generic.Pools; using InventorySystem.Items.Firearms; diff --git a/Exiled.API/Extensions/QueueExtensions.cs b/Exiled.API/Extensions/QueueExtensions.cs index 625a5a7787..8a0382a8b2 100644 --- a/Exiled.API/Extensions/QueueExtensions.cs +++ b/Exiled.API/Extensions/QueueExtensions.cs @@ -10,7 +10,7 @@ namespace Exiled.API.Extensions using System; using System.Collections.Generic; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; /// /// extensions. diff --git a/Exiled.API/Extensions/StringExtensions.cs b/Exiled.API/Extensions/StringExtensions.cs index 69b184bc65..093824c640 100644 --- a/Exiled.API/Extensions/StringExtensions.cs +++ b/Exiled.API/Extensions/StringExtensions.cs @@ -14,7 +14,7 @@ namespace Exiled.API.Extensions using System.Text; using System.Text.RegularExpressions; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; /// /// A set of extensions for . diff --git a/Exiled.API/Features/Cassie.cs b/Exiled.API/Features/Cassie.cs index 1cbb11d75e..06d8481c2f 100644 --- a/Exiled.API/Features/Cassie.cs +++ b/Exiled.API/Features/Cassie.cs @@ -11,7 +11,7 @@ namespace Exiled.API.Features using System.Linq; using System.Text; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using MEC; diff --git a/Exiled.API/Features/Core/EActor.cs b/Exiled.API/Features/Core/EActor.cs index fdb75d5a09..521a537098 100644 --- a/Exiled.API/Features/Core/EActor.cs +++ b/Exiled.API/Features/Core/EActor.cs @@ -13,7 +13,7 @@ namespace Exiled.API.Features.Core using Exiled.API.Features.Core.Interfaces; using Exiled.API.Features.DynamicEvents; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using Exiled.API.Interfaces; using MEC; diff --git a/Exiled.API/Features/Core/EObject.cs b/Exiled.API/Features/Core/EObject.cs index 4256883404..9508bef900 100644 --- a/Exiled.API/Features/Core/EObject.cs +++ b/Exiled.API/Features/Core/EObject.cs @@ -14,7 +14,7 @@ namespace Exiled.API.Features.Core using Exiled.API.Features.Core.Attributes; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using UnityEngine; diff --git a/Exiled.API/Features/Core/Generic/EnumClass.cs b/Exiled.API/Features/Core/Generic/EnumClass.cs index e89649d626..cf9413f66a 100644 --- a/Exiled.API/Features/Core/Generic/EnumClass.cs +++ b/Exiled.API/Features/Core/Generic/EnumClass.cs @@ -12,7 +12,7 @@ namespace Exiled.API.Features.Core.Generic using System.Linq; using System.Reflection; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using LiteNetLib.Utils; diff --git a/Exiled.API/Features/Pools/DictionaryPool.cs b/Exiled.API/Features/Core/Generic/Pools/DictionaryPool.cs similarity index 98% rename from Exiled.API/Features/Pools/DictionaryPool.cs rename to Exiled.API/Features/Core/Generic/Pools/DictionaryPool.cs index 4b5bcbe80a..f6840806ae 100644 --- a/Exiled.API/Features/Pools/DictionaryPool.cs +++ b/Exiled.API/Features/Core/Generic/Pools/DictionaryPool.cs @@ -5,7 +5,7 @@ // // ----------------------------------------------------------------------- -namespace Exiled.API.Features.Pools +namespace Exiled.API.Features.Core.Generic.Pools { using System.Collections.Concurrent; using System.Collections.Generic; diff --git a/Exiled.API/Features/Pools/HashSetPool.cs b/Exiled.API/Features/Core/Generic/Pools/HashSetPool.cs similarity index 97% rename from Exiled.API/Features/Pools/HashSetPool.cs rename to Exiled.API/Features/Core/Generic/Pools/HashSetPool.cs index 605e44ddc4..cd3467e3ea 100644 --- a/Exiled.API/Features/Pools/HashSetPool.cs +++ b/Exiled.API/Features/Core/Generic/Pools/HashSetPool.cs @@ -5,7 +5,7 @@ // // ----------------------------------------------------------------------- -namespace Exiled.API.Features.Pools +namespace Exiled.API.Features.Core.Generic.Pools { using System.Collections.Generic; using System.Linq; diff --git a/Exiled.API/Features/Pools/ListPool.cs b/Exiled.API/Features/Core/Generic/Pools/ListPool.cs similarity index 98% rename from Exiled.API/Features/Pools/ListPool.cs rename to Exiled.API/Features/Core/Generic/Pools/ListPool.cs index ce68e670b5..2f2a764b27 100644 --- a/Exiled.API/Features/Pools/ListPool.cs +++ b/Exiled.API/Features/Core/Generic/Pools/ListPool.cs @@ -5,7 +5,7 @@ // // ----------------------------------------------------------------------- -namespace Exiled.API.Features.Pools +namespace Exiled.API.Features.Core.Generic.Pools { using System.Collections.Generic; diff --git a/Exiled.API/Features/Pools/QueuePool.cs b/Exiled.API/Features/Core/Generic/Pools/QueuePool.cs similarity index 98% rename from Exiled.API/Features/Pools/QueuePool.cs rename to Exiled.API/Features/Core/Generic/Pools/QueuePool.cs index 6b2afae64b..d7b12e7dc5 100644 --- a/Exiled.API/Features/Pools/QueuePool.cs +++ b/Exiled.API/Features/Core/Generic/Pools/QueuePool.cs @@ -5,7 +5,7 @@ // // ----------------------------------------------------------------------- -namespace Exiled.API.Features.Pools +namespace Exiled.API.Features.Core.Generic.Pools { using System.Collections.Concurrent; using System.Collections.Generic; diff --git a/Exiled.API/Features/Pools/StringBuilderPool.cs b/Exiled.API/Features/Core/Generic/Pools/StringBuilderPool.cs similarity index 97% rename from Exiled.API/Features/Pools/StringBuilderPool.cs rename to Exiled.API/Features/Core/Generic/Pools/StringBuilderPool.cs index d36a70b343..5eecbf4d9c 100644 --- a/Exiled.API/Features/Pools/StringBuilderPool.cs +++ b/Exiled.API/Features/Core/Generic/Pools/StringBuilderPool.cs @@ -5,7 +5,7 @@ // // ----------------------------------------------------------------------- -namespace Exiled.API.Features.Pools +namespace Exiled.API.Features.Core.Generic.Pools { using System.Text; diff --git a/Exiled.API/Features/Core/Generic/UniqueUnmanagedEnumClass.cs b/Exiled.API/Features/Core/Generic/UniqueUnmanagedEnumClass.cs index 61e27e3f91..94a91cac48 100644 --- a/Exiled.API/Features/Core/Generic/UniqueUnmanagedEnumClass.cs +++ b/Exiled.API/Features/Core/Generic/UniqueUnmanagedEnumClass.cs @@ -12,7 +12,7 @@ namespace Exiled.API.Features.Core.Generic using System.Linq; using System.Reflection; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using LiteNetLib.Utils; diff --git a/Exiled.API/Features/Core/Generic/UnmanagedEnumClass.cs b/Exiled.API/Features/Core/Generic/UnmanagedEnumClass.cs index 2b2270a76e..63308fa4e1 100644 --- a/Exiled.API/Features/Core/Generic/UnmanagedEnumClass.cs +++ b/Exiled.API/Features/Core/Generic/UnmanagedEnumClass.cs @@ -12,7 +12,7 @@ namespace Exiled.API.Features.Core.Generic using System.Linq; using System.Reflection; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using LiteNetLib.Utils; diff --git a/Exiled.API/Features/Pools/IPool.cs b/Exiled.API/Features/Core/Interfaces/IPool.cs similarity index 95% rename from Exiled.API/Features/Pools/IPool.cs rename to Exiled.API/Features/Core/Interfaces/IPool.cs index 8449ab5ab8..40eac33b4b 100644 --- a/Exiled.API/Features/Pools/IPool.cs +++ b/Exiled.API/Features/Core/Interfaces/IPool.cs @@ -5,7 +5,7 @@ // // ----------------------------------------------------------------------- -namespace Exiled.API.Features.Pools +namespace Exiled.API.Features.Core.Generic.Pools { /// /// Defines the contract for a class that stores and retrieves commonly used objects. diff --git a/Exiled.API/Features/Core/TickComponent.cs b/Exiled.API/Features/Core/TickComponent.cs index c0d0511b9b..362ffd2e12 100644 --- a/Exiled.API/Features/Core/TickComponent.cs +++ b/Exiled.API/Features/Core/TickComponent.cs @@ -11,7 +11,7 @@ namespace Exiled.API.Features.Core using System.Collections.Generic; using System.Linq; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using MEC; diff --git a/Exiled.API/Features/Lift.cs b/Exiled.API/Features/Lift.cs index a456882ee6..0287c37536 100644 --- a/Exiled.API/Features/Lift.cs +++ b/Exiled.API/Features/Lift.cs @@ -15,7 +15,7 @@ namespace Exiled.API.Features using Exiled.API.Extensions; using Exiled.API.Features.Core; using Exiled.API.Features.Doors; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using Exiled.API.Interfaces; using Interactables.Interobjects; using Interactables.Interobjects.DoorUtils; diff --git a/Exiled.API/Features/Player.cs b/Exiled.API/Features/Player.cs index e457c63f15..974bbbe7da 100644 --- a/Exiled.API/Features/Player.cs +++ b/Exiled.API/Features/Player.cs @@ -22,7 +22,7 @@ namespace Exiled.API.Features using Exiled.API.Features.Hazards; using Exiled.API.Features.Items; using Exiled.API.Features.Pickups; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using Exiled.API.Features.Roles; using Exiled.API.Interfaces; using Exiled.API.Structs; diff --git a/Exiled.API/Features/Roles/FpcRole.cs b/Exiled.API/Features/Roles/FpcRole.cs index 27abeded8a..c436dad4e2 100644 --- a/Exiled.API/Features/Roles/FpcRole.cs +++ b/Exiled.API/Features/Roles/FpcRole.cs @@ -9,7 +9,7 @@ namespace Exiled.API.Features.Roles { using System.Collections.Generic; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using PlayerRoles; using PlayerRoles.FirstPersonControl; diff --git a/Exiled.API/Features/Roles/Scp939Role.cs b/Exiled.API/Features/Roles/Scp939Role.cs index b6dca72b82..87135ccfd4 100644 --- a/Exiled.API/Features/Roles/Scp939Role.cs +++ b/Exiled.API/Features/Roles/Scp939Role.cs @@ -10,7 +10,7 @@ namespace Exiled.API.Features.Roles using System.Collections.Generic; using Exiled.API.Enums; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using PlayerRoles; using PlayerRoles.PlayableScps.HumeShield; diff --git a/Exiled.API/Features/Scp914.cs b/Exiled.API/Features/Scp914.cs index 93ef42e37f..f9efc7e2b1 100644 --- a/Exiled.API/Features/Scp914.cs +++ b/Exiled.API/Features/Scp914.cs @@ -12,7 +12,7 @@ namespace Exiled.API.Features using Exiled.API.Features.Doors; using Exiled.API.Features.Pickups; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using global::Scp914; using UnityEngine; diff --git a/Exiled.API/Features/Serialization/CustomConverters/ColorConverter.cs b/Exiled.API/Features/Serialization/CustomConverters/ColorConverter.cs index 8cd3669ab2..24e1b4e965 100644 --- a/Exiled.API/Features/Serialization/CustomConverters/ColorConverter.cs +++ b/Exiled.API/Features/Serialization/CustomConverters/ColorConverter.cs @@ -12,7 +12,7 @@ namespace Exiled.API.Features.Serialization.CustomConverters using System.Globalization; using System.IO; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using UnityEngine; diff --git a/Exiled.API/Features/Serialization/CustomConverters/VectorsConverter.cs b/Exiled.API/Features/Serialization/CustomConverters/VectorsConverter.cs index fa94628339..855f99ac87 100644 --- a/Exiled.API/Features/Serialization/CustomConverters/VectorsConverter.cs +++ b/Exiled.API/Features/Serialization/CustomConverters/VectorsConverter.cs @@ -12,7 +12,7 @@ namespace Exiled.API.Features.Serialization.CustomConverters using System.Globalization; using System.IO; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using UnityEngine; diff --git a/Exiled.CustomModules/API/Features/CustomAbilities/AbilityInputComponent.cs b/Exiled.CustomModules/API/Features/CustomAbilities/AbilityInputComponent.cs index fa4db2eed4..e8319f2e84 100644 --- a/Exiled.CustomModules/API/Features/CustomAbilities/AbilityInputComponent.cs +++ b/Exiled.CustomModules/API/Features/CustomAbilities/AbilityInputComponent.cs @@ -12,8 +12,8 @@ namespace Exiled.CustomModules.API.Features.CustomAbilities using System.Text; using Exiled.API.Features; + using Exiled.API.Features.Core.Generic.Pools; using Exiled.API.Features.Input; - using Exiled.API.Features.Pools; using Exiled.API.Features.Roles; using Exiled.CustomModules.API.Features.CustomAbilities.Settings; using Exiled.CustomModules.API.Features.PlayerAbilities; diff --git a/Exiled.CustomModules/API/Features/CustomRoles/RoleBehaviour.cs b/Exiled.CustomModules/API/Features/CustomRoles/RoleBehaviour.cs index e2ac1d8fba..41baefc1ad 100644 --- a/Exiled.CustomModules/API/Features/CustomRoles/RoleBehaviour.cs +++ b/Exiled.CustomModules/API/Features/CustomRoles/RoleBehaviour.cs @@ -18,9 +18,9 @@ namespace Exiled.CustomModules.API.Features.CustomRoles using Exiled.API.Features; using Exiled.API.Features.Core; using Exiled.API.Features.Core.Generic; + using Exiled.API.Features.Core.Generic.Pools; using Exiled.API.Features.Core.Interfaces; using Exiled.API.Features.DynamicEvents; - using Exiled.API.Features.Pools; using Exiled.API.Features.Roles; using Exiled.API.Features.Spawn; using Exiled.CustomModules.API.Enums; @@ -28,9 +28,7 @@ namespace Exiled.CustomModules.API.Features.CustomRoles using Exiled.CustomModules.API.Features.Inventory; using Exiled.Events.EventArgs.Map; using Exiled.Events.EventArgs.Player; - using PlayerRoles; - using UnityEngine; /// diff --git a/Exiled.CustomModules/Patches/CustomItems/PlayerInventorySee.cs b/Exiled.CustomModules/Patches/CustomItems/PlayerInventorySee.cs index cbea214e09..0ece532bc1 100644 --- a/Exiled.CustomModules/Patches/CustomItems/PlayerInventorySee.cs +++ b/Exiled.CustomModules/Patches/CustomItems/PlayerInventorySee.cs @@ -13,11 +13,11 @@ namespace Exiled.CustomModules.Patches.CustomItems using CommandSystem.Commands.RemoteAdmin; + using Exiled.API.Features.Core.Generic.Pools; using Exiled.API.Features.Items; - using Exiled.API.Features.Pools; using Exiled.CustomModules.API.Features.CustomItems; - using HarmonyLib; + using HarmonyLib; using InventorySystem.Items; using static HarmonyLib.AccessTools; diff --git a/Exiled.Events/Commands/PluginManager/Show.cs b/Exiled.Events/Commands/PluginManager/Show.cs index b703d44fcd..02b8a9e1d8 100644 --- a/Exiled.Events/Commands/PluginManager/Show.cs +++ b/Exiled.Events/Commands/PluginManager/Show.cs @@ -12,7 +12,7 @@ namespace Exiled.Events.Commands.PluginManager using System.Linq; using System.Text; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using API.Interfaces; using CommandSystem; diff --git a/Exiled.Events/EventArgs/Map/ExplodingGrenadeEventArgs.cs b/Exiled.Events/EventArgs/Map/ExplodingGrenadeEventArgs.cs index 7fadaccfbe..9ea0d801de 100644 --- a/Exiled.Events/EventArgs/Map/ExplodingGrenadeEventArgs.cs +++ b/Exiled.Events/EventArgs/Map/ExplodingGrenadeEventArgs.cs @@ -12,7 +12,7 @@ namespace Exiled.Events.EventArgs.Map using Exiled.API.Features; using Exiled.API.Features.Pickups; using Exiled.API.Features.Pickups.Projectiles; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using Exiled.Events.EventArgs.Interfaces; using Exiled.Events.Patches.Generic; diff --git a/Exiled.Events/EventArgs/Player/ChangingRoleEventArgs.cs b/Exiled.Events/EventArgs/Player/ChangingRoleEventArgs.cs index 552d70a73b..278fee05a2 100644 --- a/Exiled.Events/EventArgs/Player/ChangingRoleEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/ChangingRoleEventArgs.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.EventArgs.Player using API.Enums; using API.Features; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using Interfaces; using InventorySystem.Configs; diff --git a/Exiled.Events/EventArgs/Server/ChoosingStartTeamQueueEventArgs.cs b/Exiled.Events/EventArgs/Server/ChoosingStartTeamQueueEventArgs.cs index 47d0180c8e..41f1028732 100644 --- a/Exiled.Events/EventArgs/Server/ChoosingStartTeamQueueEventArgs.cs +++ b/Exiled.Events/EventArgs/Server/ChoosingStartTeamQueueEventArgs.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.EventArgs.Server using System.Collections.Generic; using System.Text; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using Interfaces; using PlayerRoles; diff --git a/Exiled.Events/Features/Patcher.cs b/Exiled.Events/Features/Patcher.cs index d22c29c7c1..b2a7eed04e 100644 --- a/Exiled.Events/Features/Patcher.cs +++ b/Exiled.Events/Features/Patcher.cs @@ -13,7 +13,7 @@ namespace Exiled.Events.Features using System.Reflection; using Exiled.API.Features; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Interfaces; using HarmonyLib; diff --git a/Exiled.Events/Handlers/Internal/MapGenerated.cs b/Exiled.Events/Handlers/Internal/MapGenerated.cs index d4bd8d037a..48c6f6523b 100644 --- a/Exiled.Events/Handlers/Internal/MapGenerated.cs +++ b/Exiled.Events/Handlers/Internal/MapGenerated.cs @@ -13,7 +13,7 @@ namespace Exiled.Events.Handlers.Internal using API.Features; using API.Features.Items; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using API.Structs; using Exiled.API.Enums; diff --git a/Exiled.Events/Patches/Events/Cassie/SendingCassieMessage.cs b/Exiled.Events/Patches/Events/Cassie/SendingCassieMessage.cs index 9c49d44972..379810aec6 100644 --- a/Exiled.Events/Patches/Events/Cassie/SendingCassieMessage.cs +++ b/Exiled.Events/Patches/Events/Cassie/SendingCassieMessage.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Cassie using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Cassie; diff --git a/Exiled.Events/Patches/Events/Item/ChangingAmmo.cs b/Exiled.Events/Patches/Events/Item/ChangingAmmo.cs index e90d812c2e..2baf3ca022 100644 --- a/Exiled.Events/Patches/Events/Item/ChangingAmmo.cs +++ b/Exiled.Events/Patches/Events/Item/ChangingAmmo.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Item using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Item; diff --git a/Exiled.Events/Patches/Events/Item/ChangingAttachments.cs b/Exiled.Events/Patches/Events/Item/ChangingAttachments.cs index 3e49274a00..2b457fabb6 100644 --- a/Exiled.Events/Patches/Events/Item/ChangingAttachments.cs +++ b/Exiled.Events/Patches/Events/Item/ChangingAttachments.cs @@ -12,7 +12,7 @@ namespace Exiled.Events.Patches.Events.Item using API.Features; using API.Features.Items; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Item; diff --git a/Exiled.Events/Patches/Events/Item/KeycardInteracting.cs b/Exiled.Events/Patches/Events/Item/KeycardInteracting.cs index 97c4f4d23f..e5a9291e9e 100644 --- a/Exiled.Events/Patches/Events/Item/KeycardInteracting.cs +++ b/Exiled.Events/Patches/Events/Item/KeycardInteracting.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Item using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events; using Exiled.Events.Attributes; diff --git a/Exiled.Events/Patches/Events/Item/ReceivingPreference.cs b/Exiled.Events/Patches/Events/Item/ReceivingPreference.cs index 6d845fffa3..fda3a6380f 100644 --- a/Exiled.Events/Patches/Events/Item/ReceivingPreference.cs +++ b/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 API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Item; diff --git a/Exiled.Events/Patches/Events/Item/UsingRadioPickupBattery.cs b/Exiled.Events/Patches/Events/Item/UsingRadioPickupBattery.cs index d257ff9738..2ffa5b7a6e 100644 --- a/Exiled.Events/Patches/Events/Item/UsingRadioPickupBattery.cs +++ b/Exiled.Events/Patches/Events/Item/UsingRadioPickupBattery.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Item using System.Collections.Generic; using System.Reflection.Emit; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using Exiled.Events.EventArgs.Item; using HarmonyLib; using InventorySystem.Items.Radio; diff --git a/Exiled.Events/Patches/Events/Map/AnnouncingDecontamination.cs b/Exiled.Events/Patches/Events/Map/AnnouncingDecontamination.cs index 14a78a7676..786feec93b 100644 --- a/Exiled.Events/Patches/Events/Map/AnnouncingDecontamination.cs +++ b/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 API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Map; diff --git a/Exiled.Events/Patches/Events/Map/AnnouncingNtfEntrance.cs b/Exiled.Events/Patches/Events/Map/AnnouncingNtfEntrance.cs index 484516c7f7..5d9c3070c9 100644 --- a/Exiled.Events/Patches/Events/Map/AnnouncingNtfEntrance.cs +++ b/Exiled.Events/Patches/Events/Map/AnnouncingNtfEntrance.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Map using System.Reflection.Emit; using System.Text.RegularExpressions; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Map; diff --git a/Exiled.Events/Patches/Events/Map/AnnouncingScpTermination.cs b/Exiled.Events/Patches/Events/Map/AnnouncingScpTermination.cs index b442452a37..9f1479b159 100644 --- a/Exiled.Events/Patches/Events/Map/AnnouncingScpTermination.cs +++ b/Exiled.Events/Patches/Events/Map/AnnouncingScpTermination.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Map using System.Reflection.Emit; using API.Features.DamageHandlers; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Map; using Exiled.Events.Handlers; diff --git a/Exiled.Events/Patches/Events/Map/BreakingScp2176.cs b/Exiled.Events/Patches/Events/Map/BreakingScp2176.cs index 9b0c2cb5c5..683f803fa2 100644 --- a/Exiled.Events/Patches/Events/Map/BreakingScp2176.cs +++ b/Exiled.Events/Patches/Events/Map/BreakingScp2176.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Map using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Map; using Footprinting; diff --git a/Exiled.Events/Patches/Events/Map/ChangingIntoGrenade.cs b/Exiled.Events/Patches/Events/Map/ChangingIntoGrenade.cs index 397fbe7dbc..3bb943e08d 100644 --- a/Exiled.Events/Patches/Events/Map/ChangingIntoGrenade.cs +++ b/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 API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Map; diff --git a/Exiled.Events/Patches/Events/Map/Decontaminating.cs b/Exiled.Events/Patches/Events/Map/Decontaminating.cs index ccea1a251e..83fe7e947d 100644 --- a/Exiled.Events/Patches/Events/Map/Decontaminating.cs +++ b/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 API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Map; diff --git a/Exiled.Events/Patches/Events/Map/ExplodingFlashGrenade.cs b/Exiled.Events/Patches/Events/Map/ExplodingFlashGrenade.cs index 96b9a0ca6e..2ae1a4216e 100644 --- a/Exiled.Events/Patches/Events/Map/ExplodingFlashGrenade.cs +++ b/Exiled.Events/Patches/Events/Map/ExplodingFlashGrenade.cs @@ -12,7 +12,7 @@ namespace Exiled.Events.Patches.Events.Map using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.EventArgs.Map; using Exiled.Events.Patches.Generic; using HarmonyLib; diff --git a/Exiled.Events/Patches/Events/Map/ExplodingFragGrenade.cs b/Exiled.Events/Patches/Events/Map/ExplodingFragGrenade.cs index c4df40bc27..2ef6e17001 100644 --- a/Exiled.Events/Patches/Events/Map/ExplodingFragGrenade.cs +++ b/Exiled.Events/Patches/Events/Map/ExplodingFragGrenade.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Map using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Map; diff --git a/Exiled.Events/Patches/Events/Map/FillingLocker.cs b/Exiled.Events/Patches/Events/Map/FillingLocker.cs index 8d3a53ace7..7ba2e811a0 100644 --- a/Exiled.Events/Patches/Events/Map/FillingLocker.cs +++ b/Exiled.Events/Patches/Events/Map/FillingLocker.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Map using System.Collections.Generic; using System.Reflection.Emit; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Map; diff --git a/Exiled.Events/Patches/Events/Map/GeneratorActivating.cs b/Exiled.Events/Patches/Events/Map/GeneratorActivating.cs index e483353adb..1b29bcc7ee 100644 --- a/Exiled.Events/Patches/Events/Map/GeneratorActivating.cs +++ b/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 API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Map; diff --git a/Exiled.Events/Patches/Events/Map/PlacingBlood.cs b/Exiled.Events/Patches/Events/Map/PlacingBlood.cs index 2c492ed38b..f26d5fa238 100644 --- a/Exiled.Events/Patches/Events/Map/PlacingBlood.cs +++ b/Exiled.Events/Patches/Events/Map/PlacingBlood.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Map using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Map; diff --git a/Exiled.Events/Patches/Events/Map/PlacingBulletHole.cs b/Exiled.Events/Patches/Events/Map/PlacingBulletHole.cs index 9431ddb4df..772916b751 100644 --- a/Exiled.Events/Patches/Events/Map/PlacingBulletHole.cs +++ b/Exiled.Events/Patches/Events/Map/PlacingBulletHole.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Map using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Map; diff --git a/Exiled.Events/Patches/Events/Map/SpawningItem.cs b/Exiled.Events/Patches/Events/Map/SpawningItem.cs index 2d154875ea..d8c554c774 100644 --- a/Exiled.Events/Patches/Events/Map/SpawningItem.cs +++ b/Exiled.Events/Patches/Events/Map/SpawningItem.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Map using System.Reflection.Emit; using API.Features.Doors; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Map; diff --git a/Exiled.Events/Patches/Events/Map/SpawningTeamVehicle.cs b/Exiled.Events/Patches/Events/Map/SpawningTeamVehicle.cs index 63f0f8fe04..c26d066b39 100644 --- a/Exiled.Events/Patches/Events/Map/SpawningTeamVehicle.cs +++ b/Exiled.Events/Patches/Events/Map/SpawningTeamVehicle.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Map using System.Collections.Generic; using System.Reflection.Emit; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Map; diff --git a/Exiled.Events/Patches/Events/Map/TurningOffLights.cs b/Exiled.Events/Patches/Events/Map/TurningOffLights.cs index f8dbb2f634..438dcc8f4c 100644 --- a/Exiled.Events/Patches/Events/Map/TurningOffLights.cs +++ b/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 API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Map; diff --git a/Exiled.Events/Patches/Events/Player/ActivatingWarheadPanel.cs b/Exiled.Events/Patches/Events/Player/ActivatingWarheadPanel.cs index 4a3d790b19..37d710493d 100644 --- a/Exiled.Events/Patches/Events/Player/ActivatingWarheadPanel.cs +++ b/Exiled.Events/Patches/Events/Player/ActivatingWarheadPanel.cs @@ -12,7 +12,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.API.Enums; using Exiled.API.Features.Items; using Exiled.Events.Attributes; diff --git a/Exiled.Events/Patches/Events/Player/ActivatingWorkstation.cs b/Exiled.Events/Patches/Events/Player/ActivatingWorkstation.cs index 4ee58f8ecd..5f56acf146 100644 --- a/Exiled.Events/Patches/Events/Player/ActivatingWorkstation.cs +++ b/Exiled.Events/Patches/Events/Player/ActivatingWorkstation.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/AddingItem.cs b/Exiled.Events/Patches/Events/Player/AddingItem.cs index fb9f3457c1..f6b1914322 100644 --- a/Exiled.Events/Patches/Events/Player/AddingItem.cs +++ b/Exiled.Events/Patches/Events/Player/AddingItem.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.API.Features; using Exiled.API.Features.Items; using Exiled.API.Features.Pickups; diff --git a/Exiled.Events/Patches/Events/Player/Banned.cs b/Exiled.Events/Patches/Events/Player/Banned.cs index d06cdcf2f2..c2934279f2 100644 --- a/Exiled.Events/Patches/Events/Player/Banned.cs +++ b/Exiled.Events/Patches/Events/Player/Banned.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/Banning.cs b/Exiled.Events/Patches/Events/Player/Banning.cs index 9873b079bb..088780662a 100644 --- a/Exiled.Events/Patches/Events/Player/Banning.cs +++ b/Exiled.Events/Patches/Events/Player/Banning.cs @@ -12,7 +12,7 @@ namespace Exiled.Events.Patches.Events.Player using API.Features; using CommandSystem; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; using Footprinting; diff --git a/Exiled.Events/Patches/Events/Player/ChangedItem.cs b/Exiled.Events/Patches/Events/Player/ChangedItem.cs index 1fe58b8765..0556fe8ff3 100644 --- a/Exiled.Events/Patches/Events/Player/ChangedItem.cs +++ b/Exiled.Events/Patches/Events/Player/ChangedItem.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/ChangingGroup.cs b/Exiled.Events/Patches/Events/Player/ChangingGroup.cs index cf179dfc5d..92acc81494 100644 --- a/Exiled.Events/Patches/Events/Player/ChangingGroup.cs +++ b/Exiled.Events/Patches/Events/Player/ChangingGroup.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/ChangingItem.cs b/Exiled.Events/Patches/Events/Player/ChangingItem.cs index 323c7c1b17..f6913fb3a9 100644 --- a/Exiled.Events/Patches/Events/Player/ChangingItem.cs +++ b/Exiled.Events/Patches/Events/Player/ChangingItem.cs @@ -12,7 +12,7 @@ namespace Exiled.Events.Patches.Events.Player using API.Features; using API.Features.Items; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/ChangingMicroHIDState.cs b/Exiled.Events/Patches/Events/Player/ChangingMicroHIDState.cs index e476e2da95..38ce84e884 100644 --- a/Exiled.Events/Patches/Events/Player/ChangingMicroHIDState.cs +++ b/Exiled.Events/Patches/Events/Player/ChangingMicroHIDState.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/ChangingMoveState.cs b/Exiled.Events/Patches/Events/Player/ChangingMoveState.cs index 61d05c0aa7..1c11ad5332 100644 --- a/Exiled.Events/Patches/Events/Player/ChangingMoveState.cs +++ b/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 API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; using Exiled.Events.Handlers; diff --git a/Exiled.Events/Patches/Events/Player/ChangingNickname.cs b/Exiled.Events/Patches/Events/Player/ChangingNickname.cs index 3af9b86337..6e4e16468f 100644 --- a/Exiled.Events/Patches/Events/Player/ChangingNickname.cs +++ b/Exiled.Events/Patches/Events/Player/ChangingNickname.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using Exiled.API.Features; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/ChangingRadioPreset.cs b/Exiled.Events/Patches/Events/Player/ChangingRadioPreset.cs index 1199215c81..bf9ab3da62 100644 --- a/Exiled.Events/Patches/Events/Player/ChangingRadioPreset.cs +++ b/Exiled.Events/Patches/Events/Player/ChangingRadioPreset.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/ChangingRoleAndSpawned.cs b/Exiled.Events/Patches/Events/Player/ChangingRoleAndSpawned.cs index 786842b5bc..c4e52dec3d 100644 --- a/Exiled.Events/Patches/Events/Player/ChangingRoleAndSpawned.cs +++ b/Exiled.Events/Patches/Events/Player/ChangingRoleAndSpawned.cs @@ -13,7 +13,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using API.Features.Roles; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/ChangingSpectatedPlayerPatch.cs b/Exiled.Events/Patches/Events/Player/ChangingSpectatedPlayerPatch.cs index c7f14f9553..028b35fec8 100644 --- a/Exiled.Events/Patches/Events/Player/ChangingSpectatedPlayerPatch.cs +++ b/Exiled.Events/Patches/Events/Player/ChangingSpectatedPlayerPatch.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/DamagingDoor.cs b/Exiled.Events/Patches/Events/Player/DamagingDoor.cs index 9fb8aa9364..9427ffe58c 100644 --- a/Exiled.Events/Patches/Events/Player/DamagingDoor.cs +++ b/Exiled.Events/Patches/Events/Player/DamagingDoor.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/DamagingShootingTarget.cs b/Exiled.Events/Patches/Events/Player/DamagingShootingTarget.cs index 9b73611eb9..40d6f7a455 100644 --- a/Exiled.Events/Patches/Events/Player/DamagingShootingTarget.cs +++ b/Exiled.Events/Patches/Events/Player/DamagingShootingTarget.cs @@ -13,7 +13,7 @@ namespace Exiled.Events.Patches.Events.Player using AdminToys; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/DamagingWindow.cs b/Exiled.Events/Patches/Events/Player/DamagingWindow.cs index fe342e84c3..b22d61909e 100644 --- a/Exiled.Events/Patches/Events/Player/DamagingWindow.cs +++ b/Exiled.Events/Patches/Events/Player/DamagingWindow.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using API.Features.DamageHandlers; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/DeactivatingWorkstation.cs b/Exiled.Events/Patches/Events/Player/DeactivatingWorkstation.cs index eee14bf646..76d3804a11 100644 --- a/Exiled.Events/Patches/Events/Player/DeactivatingWorkstation.cs +++ b/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 API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/Destroying.cs b/Exiled.Events/Patches/Events/Player/Destroying.cs index ad1d84480c..2109a62370 100644 --- a/Exiled.Events/Patches/Events/Player/Destroying.cs +++ b/Exiled.Events/Patches/Events/Player/Destroying.cs @@ -12,7 +12,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Runtime.CompilerServices; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.EventArgs.Player; using HarmonyLib; diff --git a/Exiled.Events/Patches/Events/Player/DroppingAmmo.cs b/Exiled.Events/Patches/Events/Player/DroppingAmmo.cs index c67b70d030..f0da4139ca 100644 --- a/Exiled.Events/Patches/Events/Player/DroppingAmmo.cs +++ b/Exiled.Events/Patches/Events/Player/DroppingAmmo.cs @@ -12,7 +12,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/DroppingItem.cs b/Exiled.Events/Patches/Events/Player/DroppingItem.cs index 0e03115329..fed2a45d27 100644 --- a/Exiled.Events/Patches/Events/Player/DroppingItem.cs +++ b/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 API.Features.Core.Generic.Pools; using Exiled.API.Features.Pickups; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/DyingAndDied.cs b/Exiled.Events/Patches/Events/Player/DyingAndDied.cs index ea11377759..ed98eb79e6 100644 --- a/Exiled.Events/Patches/Events/Player/DyingAndDied.cs +++ b/Exiled.Events/Patches/Events/Player/DyingAndDied.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using API.Features.Roles; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/EarningAchievement.cs b/Exiled.Events/Patches/Events/Player/EarningAchievement.cs index a818a39863..b0e622a234 100644 --- a/Exiled.Events/Patches/Events/Player/EarningAchievement.cs +++ b/Exiled.Events/Patches/Events/Player/EarningAchievement.cs @@ -13,7 +13,7 @@ namespace Exiled.Events.Patches.Events.Player using Achievements; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/EnteringKillerCollision.cs b/Exiled.Events/Patches/Events/Player/EnteringKillerCollision.cs index 3f277f3ad2..842e3890cd 100644 --- a/Exiled.Events/Patches/Events/Player/EnteringKillerCollision.cs +++ b/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 API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/EnteringPocketDimension.cs b/Exiled.Events/Patches/Events/Player/EnteringPocketDimension.cs index 1dabf6e26e..18ef52fe23 100644 --- a/Exiled.Events/Patches/Events/Player/EnteringPocketDimension.cs +++ b/Exiled.Events/Patches/Events/Player/EnteringPocketDimension.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/EnteringSinkholeEnvironmentalHazard.cs b/Exiled.Events/Patches/Events/Player/EnteringSinkholeEnvironmentalHazard.cs index 2bccead6f4..a231697fbb 100644 --- a/Exiled.Events/Patches/Events/Player/EnteringSinkholeEnvironmentalHazard.cs +++ b/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 API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/EnteringTantrumEnvironmentalHazard.cs b/Exiled.Events/Patches/Events/Player/EnteringTantrumEnvironmentalHazard.cs index faea5e7787..2325836032 100644 --- a/Exiled.Events/Patches/Events/Player/EnteringTantrumEnvironmentalHazard.cs +++ b/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 API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/Escaping.cs b/Exiled.Events/Patches/Events/Player/Escaping.cs index ca6213cddb..120d4ce7a8 100644 --- a/Exiled.Events/Patches/Events/Player/Escaping.cs +++ b/Exiled.Events/Patches/Events/Player/Escaping.cs @@ -17,7 +17,7 @@ namespace Exiled.Events.Patches.Events.Player using API.Enums; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using EventArgs.Player; using Exiled.Events.Attributes; diff --git a/Exiled.Events/Patches/Events/Player/EscapingPocketDimension.cs b/Exiled.Events/Patches/Events/Player/EscapingPocketDimension.cs index b1db281b4d..401faf6651 100644 --- a/Exiled.Events/Patches/Events/Player/EscapingPocketDimension.cs +++ b/Exiled.Events/Patches/Events/Player/EscapingPocketDimension.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/ExitingSinkholeEnvironmentalHazard.cs b/Exiled.Events/Patches/Events/Player/ExitingSinkholeEnvironmentalHazard.cs index 6c8099277d..a77133d850 100644 --- a/Exiled.Events/Patches/Events/Player/ExitingSinkholeEnvironmentalHazard.cs +++ b/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 API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/ExitingTantrumEnvironmentalHazard.cs b/Exiled.Events/Patches/Events/Player/ExitingTantrumEnvironmentalHazard.cs index d7d0e13af3..0756a3f545 100644 --- a/Exiled.Events/Patches/Events/Player/ExitingTantrumEnvironmentalHazard.cs +++ b/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 API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/FailingEscapePocketDimension.cs b/Exiled.Events/Patches/Events/Player/FailingEscapePocketDimension.cs index f8b08b74a3..a183bed216 100644 --- a/Exiled.Events/Patches/Events/Player/FailingEscapePocketDimension.cs +++ b/Exiled.Events/Patches/Events/Player/FailingEscapePocketDimension.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/FirearmRequestReceived.cs b/Exiled.Events/Patches/Events/Player/FirearmRequestReceived.cs index 6ebd931f4e..5a6b90e439 100644 --- a/Exiled.Events/Patches/Events/Player/FirearmRequestReceived.cs +++ b/Exiled.Events/Patches/Events/Player/FirearmRequestReceived.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.API.Features.Items; using Exiled.Events.Attributes; diff --git a/Exiled.Events/Patches/Events/Player/FlippingCoin.cs b/Exiled.Events/Patches/Events/Player/FlippingCoin.cs index 96756f3545..de297a71a8 100644 --- a/Exiled.Events/Patches/Events/Player/FlippingCoin.cs +++ b/Exiled.Events/Patches/Events/Player/FlippingCoin.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; using HarmonyLib; diff --git a/Exiled.Events/Patches/Events/Player/Hurting.cs b/Exiled.Events/Patches/Events/Player/Hurting.cs index 73e8ea4a45..1a8464f490 100644 --- a/Exiled.Events/Patches/Events/Player/Hurting.cs +++ b/Exiled.Events/Patches/Events/Player/Hurting.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using API.Features.Roles; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/Interacted.cs b/Exiled.Events/Patches/Events/Player/Interacted.cs index d6e0d637ef..dee8e4c1db 100644 --- a/Exiled.Events/Patches/Events/Player/Interacted.cs +++ b/Exiled.Events/Patches/Events/Player/Interacted.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/InteractingDoor.cs b/Exiled.Events/Patches/Events/Player/InteractingDoor.cs index 6f491b8118..10ecb78c3f 100644 --- a/Exiled.Events/Patches/Events/Player/InteractingDoor.cs +++ b/Exiled.Events/Patches/Events/Player/InteractingDoor.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using API.Features; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/InteractingElevator.cs b/Exiled.Events/Patches/Events/Player/InteractingElevator.cs index 1889f29dca..801cdfbad7 100644 --- a/Exiled.Events/Patches/Events/Player/InteractingElevator.cs +++ b/Exiled.Events/Patches/Events/Player/InteractingElevator.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/InteractingGenerator.cs b/Exiled.Events/Patches/Events/Player/InteractingGenerator.cs index 92ccee4cc3..4706c66824 100644 --- a/Exiled.Events/Patches/Events/Player/InteractingGenerator.cs +++ b/Exiled.Events/Patches/Events/Player/InteractingGenerator.cs @@ -12,7 +12,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/InteractingLocker.cs b/Exiled.Events/Patches/Events/Player/InteractingLocker.cs index b706f067f9..e615eb98fc 100644 --- a/Exiled.Events/Patches/Events/Player/InteractingLocker.cs +++ b/Exiled.Events/Patches/Events/Player/InteractingLocker.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/InteractingShootingTarget.cs b/Exiled.Events/Patches/Events/Player/InteractingShootingTarget.cs index e2cc9661ab..472319f246 100644 --- a/Exiled.Events/Patches/Events/Player/InteractingShootingTarget.cs +++ b/Exiled.Events/Patches/Events/Player/InteractingShootingTarget.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/IntercomSpeaking.cs b/Exiled.Events/Patches/Events/Player/IntercomSpeaking.cs index 5079a776c1..c13d1aa4d9 100644 --- a/Exiled.Events/Patches/Events/Player/IntercomSpeaking.cs +++ b/Exiled.Events/Patches/Events/Player/IntercomSpeaking.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Diagnostics; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/IssuingMute.cs b/Exiled.Events/Patches/Events/Player/IssuingMute.cs index 7fd44db040..5a7f39fdbc 100644 --- a/Exiled.Events/Patches/Events/Player/IssuingMute.cs +++ b/Exiled.Events/Patches/Events/Player/IssuingMute.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/Jumping.cs b/Exiled.Events/Patches/Events/Player/Jumping.cs index 460867460e..52eeecaec0 100644 --- a/Exiled.Events/Patches/Events/Player/Jumping.cs +++ b/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 API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; using Exiled.Events.Handlers; diff --git a/Exiled.Events/Patches/Events/Player/Kicked.cs b/Exiled.Events/Patches/Events/Player/Kicked.cs index b3934543ca..072e47c74e 100644 --- a/Exiled.Events/Patches/Events/Player/Kicked.cs +++ b/Exiled.Events/Patches/Events/Player/Kicked.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/Kicking.cs b/Exiled.Events/Patches/Events/Player/Kicking.cs index 0a9286933b..8dcfd2c00a 100644 --- a/Exiled.Events/Patches/Events/Player/Kicking.cs +++ b/Exiled.Events/Patches/Events/Player/Kicking.cs @@ -12,7 +12,7 @@ namespace Exiled.Events.Patches.Events.Player using CommandSystem; using Exiled.API.Features; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/Landing.cs b/Exiled.Events/Patches/Events/Player/Landing.cs index 37c745a316..b51d667c58 100644 --- a/Exiled.Events/Patches/Events/Player/Landing.cs +++ b/Exiled.Events/Patches/Events/Player/Landing.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; using Exiled.Events.Handlers; diff --git a/Exiled.Events/Patches/Events/Player/Left.cs b/Exiled.Events/Patches/Events/Player/Left.cs index 2e808334db..fde95dbaae 100644 --- a/Exiled.Events/Patches/Events/Player/Left.cs +++ b/Exiled.Events/Patches/Events/Player/Left.cs @@ -12,7 +12,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.EventArgs.Player; using HarmonyLib; diff --git a/Exiled.Events/Patches/Events/Player/MakingNoise.cs b/Exiled.Events/Patches/Events/Player/MakingNoise.cs index eb525afa58..912c7498db 100644 --- a/Exiled.Events/Patches/Events/Player/MakingNoise.cs +++ b/Exiled.Events/Patches/Events/Player/MakingNoise.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using Exiled.API.Features; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; using HarmonyLib; diff --git a/Exiled.Events/Patches/Events/Player/PickingUp330.cs b/Exiled.Events/Patches/Events/Player/PickingUp330.cs index ab6dd6bab2..bbc1a725fe 100644 --- a/Exiled.Events/Patches/Events/Player/PickingUp330.cs +++ b/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 API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/PickingUpAmmo.cs b/Exiled.Events/Patches/Events/Player/PickingUpAmmo.cs index c548bdd6d5..47d91bb7ea 100644 --- a/Exiled.Events/Patches/Events/Player/PickingUpAmmo.cs +++ b/Exiled.Events/Patches/Events/Player/PickingUpAmmo.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/PickingUpArmor.cs b/Exiled.Events/Patches/Events/Player/PickingUpArmor.cs index baccd89d6c..2518e04a96 100644 --- a/Exiled.Events/Patches/Events/Player/PickingUpArmor.cs +++ b/Exiled.Events/Patches/Events/Player/PickingUpArmor.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/PickingUpItem.cs b/Exiled.Events/Patches/Events/Player/PickingUpItem.cs index 78e3611591..160fb7ad6d 100644 --- a/Exiled.Events/Patches/Events/Player/PickingUpItem.cs +++ b/Exiled.Events/Patches/Events/Player/PickingUpItem.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/PickingUpScp244.cs b/Exiled.Events/Patches/Events/Player/PickingUpScp244.cs index 13f634563c..57161773bf 100644 --- a/Exiled.Events/Patches/Events/Player/PickingUpScp244.cs +++ b/Exiled.Events/Patches/Events/Player/PickingUpScp244.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/ProcessDisarmMessage.cs b/Exiled.Events/Patches/Events/Player/ProcessDisarmMessage.cs index bd83c19e9e..7ad35ff1d2 100644 --- a/Exiled.Events/Patches/Events/Player/ProcessDisarmMessage.cs +++ b/Exiled.Events/Patches/Events/Player/ProcessDisarmMessage.cs @@ -12,7 +12,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/ReceivingStatusEffect.cs b/Exiled.Events/Patches/Events/Player/ReceivingStatusEffect.cs index 3689272e8d..b1b5d9c783 100644 --- a/Exiled.Events/Patches/Events/Player/ReceivingStatusEffect.cs +++ b/Exiled.Events/Patches/Events/Player/ReceivingStatusEffect.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using CustomPlayerEffects; using Exiled.Events.Attributes; diff --git a/Exiled.Events/Patches/Events/Player/RemovingItem.cs b/Exiled.Events/Patches/Events/Player/RemovingItem.cs index 31bfeb119e..f4292067b1 100644 --- a/Exiled.Events/Patches/Events/Player/RemovingItem.cs +++ b/Exiled.Events/Patches/Events/Player/RemovingItem.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.API.Features; using Exiled.API.Features.Items; using Exiled.API.Features.Pickups; diff --git a/Exiled.Events/Patches/Events/Player/ReservedSlotPatch.cs b/Exiled.Events/Patches/Events/Player/ReservedSlotPatch.cs index 4eeba0e171..79157aa880 100644 --- a/Exiled.Events/Patches/Events/Player/ReservedSlotPatch.cs +++ b/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 API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/RevokingMute.cs b/Exiled.Events/Patches/Events/Player/RevokingMute.cs index 1fcf9855e1..5f370f0f13 100644 --- a/Exiled.Events/Patches/Events/Player/RevokingMute.cs +++ b/Exiled.Events/Patches/Events/Player/RevokingMute.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/SearchingPickupEvent.cs b/Exiled.Events/Patches/Events/Player/SearchingPickupEvent.cs index 9973366af4..1f3e66447d 100644 --- a/Exiled.Events/Patches/Events/Player/SearchingPickupEvent.cs +++ b/Exiled.Events/Patches/Events/Player/SearchingPickupEvent.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/SendingAdminChatMessage.cs b/Exiled.Events/Patches/Events/Player/SendingAdminChatMessage.cs index d05cf48019..1a1eaf9714 100644 --- a/Exiled.Events/Patches/Events/Player/SendingAdminChatMessage.cs +++ b/Exiled.Events/Patches/Events/Player/SendingAdminChatMessage.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/Shooting.cs b/Exiled.Events/Patches/Events/Player/Shooting.cs index cc54f72fa7..e36c96f037 100644 --- a/Exiled.Events/Patches/Events/Player/Shooting.cs +++ b/Exiled.Events/Patches/Events/Player/Shooting.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/Shot.cs b/Exiled.Events/Patches/Events/Player/Shot.cs index ff34d42a39..ac684b6325 100644 --- a/Exiled.Events/Patches/Events/Player/Shot.cs +++ b/Exiled.Events/Patches/Events/Player/Shot.cs @@ -13,7 +13,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using EventArgs.Player; using Exiled.Events.Attributes; diff --git a/Exiled.Events/Patches/Events/Player/SpawningRagdoll.cs b/Exiled.Events/Patches/Events/Player/SpawningRagdoll.cs index d4e60b095f..4e3c885ec7 100644 --- a/Exiled.Events/Patches/Events/Player/SpawningRagdoll.cs +++ b/Exiled.Events/Patches/Events/Player/SpawningRagdoll.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.API.Features; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/StayingOnEnvironmentalHazard.cs b/Exiled.Events/Patches/Events/Player/StayingOnEnvironmentalHazard.cs index 93cf67e745..75aed57a16 100644 --- a/Exiled.Events/Patches/Events/Player/StayingOnEnvironmentalHazard.cs +++ b/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 API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/StayingOnSinkholeEnvironmentalHazard.cs b/Exiled.Events/Patches/Events/Player/StayingOnSinkholeEnvironmentalHazard.cs index 5121f9ed2f..35f426088f 100644 --- a/Exiled.Events/Patches/Events/Player/StayingOnSinkholeEnvironmentalHazard.cs +++ b/Exiled.Events/Patches/Events/Player/StayingOnSinkholeEnvironmentalHazard.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using HarmonyLib; diff --git a/Exiled.Events/Patches/Events/Player/StayingOnTantrumEnvironmentalHazard.cs b/Exiled.Events/Patches/Events/Player/StayingOnTantrumEnvironmentalHazard.cs index a4a85368df..5daa893df2 100644 --- a/Exiled.Events/Patches/Events/Player/StayingOnTantrumEnvironmentalHazard.cs +++ b/Exiled.Events/Patches/Events/Player/StayingOnTantrumEnvironmentalHazard.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using HarmonyLib; diff --git a/Exiled.Events/Patches/Events/Player/ThrowingRequest.cs b/Exiled.Events/Patches/Events/Player/ThrowingRequest.cs index 2d882562fc..018ec41c80 100644 --- a/Exiled.Events/Patches/Events/Player/ThrowingRequest.cs +++ b/Exiled.Events/Patches/Events/Player/ThrowingRequest.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/ThrownProjectile.cs b/Exiled.Events/Patches/Events/Player/ThrownProjectile.cs index bb90b5789f..d54ff06ba6 100644 --- a/Exiled.Events/Patches/Events/Player/ThrownProjectile.cs +++ b/Exiled.Events/Patches/Events/Player/ThrownProjectile.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/TogglingFlashlight.cs b/Exiled.Events/Patches/Events/Player/TogglingFlashlight.cs index becb70fc98..a24d82175c 100644 --- a/Exiled.Events/Patches/Events/Player/TogglingFlashlight.cs +++ b/Exiled.Events/Patches/Events/Player/TogglingFlashlight.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/TogglingNoClip.cs b/Exiled.Events/Patches/Events/Player/TogglingNoClip.cs index 6af54c2c0b..f929cff3e8 100644 --- a/Exiled.Events/Patches/Events/Player/TogglingNoClip.cs +++ b/Exiled.Events/Patches/Events/Player/TogglingNoClip.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.API.Features.Roles; using Exiled.Events.Attributes; diff --git a/Exiled.Events/Patches/Events/Player/TogglingOverwatch.cs b/Exiled.Events/Patches/Events/Player/TogglingOverwatch.cs index a77e03790b..b1bdf3b8df 100644 --- a/Exiled.Events/Patches/Events/Player/TogglingOverwatch.cs +++ b/Exiled.Events/Patches/Events/Player/TogglingOverwatch.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using CommandSystem.Commands.RemoteAdmin; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/TogglingRadio.cs b/Exiled.Events/Patches/Events/Player/TogglingRadio.cs index 5760dbfadc..e7bf18f921 100644 --- a/Exiled.Events/Patches/Events/Player/TogglingRadio.cs +++ b/Exiled.Events/Patches/Events/Player/TogglingRadio.cs @@ -12,7 +12,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection; using System.Reflection.Emit; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/TriggeringTesla.cs b/Exiled.Events/Patches/Events/Player/TriggeringTesla.cs index 16f948a96f..53ddc9afcd 100644 --- a/Exiled.Events/Patches/Events/Player/TriggeringTesla.cs +++ b/Exiled.Events/Patches/Events/Player/TriggeringTesla.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using API.Features; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using Exiled.Events.EventArgs.Player; using HarmonyLib; diff --git a/Exiled.Events/Patches/Events/Player/UsingAndCancellingItemUse.cs b/Exiled.Events/Patches/Events/Player/UsingAndCancellingItemUse.cs index 9004441dc8..97fea96cd0 100644 --- a/Exiled.Events/Patches/Events/Player/UsingAndCancellingItemUse.cs +++ b/Exiled.Events/Patches/Events/Player/UsingAndCancellingItemUse.cs @@ -12,7 +12,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/UsingItemCompleted.cs b/Exiled.Events/Patches/Events/Player/UsingItemCompleted.cs index c884e213c3..f60d781aa2 100644 --- a/Exiled.Events/Patches/Events/Player/UsingItemCompleted.cs +++ b/Exiled.Events/Patches/Events/Player/UsingItemCompleted.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/UsingMicroHIDEnergy.cs b/Exiled.Events/Patches/Events/Player/UsingMicroHIDEnergy.cs index c7ca375c0b..45dea2866b 100644 --- a/Exiled.Events/Patches/Events/Player/UsingMicroHIDEnergy.cs +++ b/Exiled.Events/Patches/Events/Player/UsingMicroHIDEnergy.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/UsingRadioBattery.cs b/Exiled.Events/Patches/Events/Player/UsingRadioBattery.cs index b4a52b2ebe..4b4f35ee32 100644 --- a/Exiled.Events/Patches/Events/Player/UsingRadioBattery.cs +++ b/Exiled.Events/Patches/Events/Player/UsingRadioBattery.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/Verified.cs b/Exiled.Events/Patches/Events/Player/Verified.cs index 4e08050805..e2f20948d8 100644 --- a/Exiled.Events/Patches/Events/Player/Verified.cs +++ b/Exiled.Events/Patches/Events/Player/Verified.cs @@ -14,7 +14,7 @@ namespace Exiled.Events.Patches.Events.Player using API.Features; using CentralAuth; using Exiled.API.Extensions; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using Exiled.Events.EventArgs.Player; using HarmonyLib; diff --git a/Exiled.Events/Patches/Events/Player/VoiceChatting.cs b/Exiled.Events/Patches/Events/Player/VoiceChatting.cs index 875e099b00..055539d9c5 100644 --- a/Exiled.Events/Patches/Events/Player/VoiceChatting.cs +++ b/Exiled.Events/Patches/Events/Player/VoiceChatting.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using API.Features.Roles; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Scp049/ActivatingSense.cs b/Exiled.Events/Patches/Events/Scp049/ActivatingSense.cs index 1dced2fa34..f5c799da63 100644 --- a/Exiled.Events/Patches/Events/Scp049/ActivatingSense.cs +++ b/Exiled.Events/Patches/Events/Scp049/ActivatingSense.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Scp049 using System.Reflection.Emit; using Exiled.API.Features; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using Exiled.Events.EventArgs.Scp049; using HarmonyLib; using PlayerRoles.PlayableScps.Scp049; diff --git a/Exiled.Events/Patches/Events/Scp049/Attacking.cs b/Exiled.Events/Patches/Events/Scp049/Attacking.cs index 9e822c8af2..b57d465b2e 100644 --- a/Exiled.Events/Patches/Events/Scp049/Attacking.cs +++ b/Exiled.Events/Patches/Events/Scp049/Attacking.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Scp049 using System.Reflection.Emit; using Exiled.API.Features; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp049; using HarmonyLib; diff --git a/Exiled.Events/Patches/Events/Scp049/FinishingRecall.cs b/Exiled.Events/Patches/Events/Scp049/FinishingRecall.cs index 2eab40acc5..491369d90c 100644 --- a/Exiled.Events/Patches/Events/Scp049/FinishingRecall.cs +++ b/Exiled.Events/Patches/Events/Scp049/FinishingRecall.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Scp049 using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp049; diff --git a/Exiled.Events/Patches/Events/Scp049/SendingCall.cs b/Exiled.Events/Patches/Events/Scp049/SendingCall.cs index dac154409f..fed6c607b8 100644 --- a/Exiled.Events/Patches/Events/Scp049/SendingCall.cs +++ b/Exiled.Events/Patches/Events/Scp049/SendingCall.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Scp049 using System.Reflection.Emit; using Exiled.API.Features; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using Exiled.Events.EventArgs.Scp049; using HarmonyLib; diff --git a/Exiled.Events/Patches/Events/Scp049/StartingRecall.cs b/Exiled.Events/Patches/Events/Scp049/StartingRecall.cs index 99d1fad8f4..05e44699fb 100644 --- a/Exiled.Events/Patches/Events/Scp049/StartingRecall.cs +++ b/Exiled.Events/Patches/Events/Scp049/StartingRecall.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Scp049 using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp049; using HarmonyLib; diff --git a/Exiled.Events/Patches/Events/Scp0492/Consumed.cs b/Exiled.Events/Patches/Events/Scp0492/Consumed.cs index 3eb7ddb7c6..69655c45f6 100644 --- a/Exiled.Events/Patches/Events/Scp0492/Consumed.cs +++ b/Exiled.Events/Patches/Events/Scp0492/Consumed.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Scp0492 using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp0492; using HarmonyLib; diff --git a/Exiled.Events/Patches/Events/Scp0492/Consuming.cs b/Exiled.Events/Patches/Events/Scp0492/Consuming.cs index 1216208f92..fcc91617a3 100644 --- a/Exiled.Events/Patches/Events/Scp0492/Consuming.cs +++ b/Exiled.Events/Patches/Events/Scp0492/Consuming.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Scp0492 using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp0492; using HarmonyLib; diff --git a/Exiled.Events/Patches/Events/Scp0492/TriggeringBloodlustEvent.cs b/Exiled.Events/Patches/Events/Scp0492/TriggeringBloodlustEvent.cs index 596ae1a64a..3ea31ddf6d 100644 --- a/Exiled.Events/Patches/Events/Scp0492/TriggeringBloodlustEvent.cs +++ b/Exiled.Events/Patches/Events/Scp0492/TriggeringBloodlustEvent.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Scp0492 using System.Reflection.Emit; using Exiled.API.Features; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp0492; diff --git a/Exiled.Events/Patches/Events/Scp079/ChangingCamera.cs b/Exiled.Events/Patches/Events/Scp079/ChangingCamera.cs index a1c83f6e04..56f41bcf2e 100644 --- a/Exiled.Events/Patches/Events/Scp079/ChangingCamera.cs +++ b/Exiled.Events/Patches/Events/Scp079/ChangingCamera.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Scp079 using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp079; using Exiled.Events.Handlers; diff --git a/Exiled.Events/Patches/Events/Scp079/ChangingSpeakerStatusAndVoiceChatting.cs b/Exiled.Events/Patches/Events/Scp079/ChangingSpeakerStatusAndVoiceChatting.cs index 15223b800c..0e229dc725 100644 --- a/Exiled.Events/Patches/Events/Scp079/ChangingSpeakerStatusAndVoiceChatting.cs +++ b/Exiled.Events/Patches/Events/Scp079/ChangingSpeakerStatusAndVoiceChatting.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Scp079 using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp079; using Exiled.Events.Handlers; diff --git a/Exiled.Events/Patches/Events/Scp079/ElevatorTeleporting.cs b/Exiled.Events/Patches/Events/Scp079/ElevatorTeleporting.cs index d461dbed9a..d2dd6cb36d 100644 --- a/Exiled.Events/Patches/Events/Scp079/ElevatorTeleporting.cs +++ b/Exiled.Events/Patches/Events/Scp079/ElevatorTeleporting.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Scp079 using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp079; using Exiled.Events.Handlers; diff --git a/Exiled.Events/Patches/Events/Scp079/GainingExperience.cs b/Exiled.Events/Patches/Events/Scp079/GainingExperience.cs index fd212ee6fe..076be28659 100644 --- a/Exiled.Events/Patches/Events/Scp079/GainingExperience.cs +++ b/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 API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp079; using Exiled.Events.Handlers; diff --git a/Exiled.Events/Patches/Events/Scp079/GainingLevel.cs b/Exiled.Events/Patches/Events/Scp079/GainingLevel.cs index 7721bc0035..1385eb3f25 100644 --- a/Exiled.Events/Patches/Events/Scp079/GainingLevel.cs +++ b/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 API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp079; using Exiled.Events.Handlers; diff --git a/Exiled.Events/Patches/Events/Scp079/InteractingTesla.cs b/Exiled.Events/Patches/Events/Scp079/InteractingTesla.cs index bc44248311..6a0c56e6e1 100644 --- a/Exiled.Events/Patches/Events/Scp079/InteractingTesla.cs +++ b/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 API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp079; using Exiled.Events.Handlers; diff --git a/Exiled.Events/Patches/Events/Scp079/LockingDown.cs b/Exiled.Events/Patches/Events/Scp079/LockingDown.cs index ad5c1d86ed..f4c6b8ebc7 100644 --- a/Exiled.Events/Patches/Events/Scp079/LockingDown.cs +++ b/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 API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp079; using Exiled.Events.Handlers; diff --git a/Exiled.Events/Patches/Events/Scp079/Pinging.cs b/Exiled.Events/Patches/Events/Scp079/Pinging.cs index fb8bed7509..59382aa462 100644 --- a/Exiled.Events/Patches/Events/Scp079/Pinging.cs +++ b/Exiled.Events/Patches/Events/Scp079/Pinging.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Scp079 using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp079; using HarmonyLib; diff --git a/Exiled.Events/Patches/Events/Scp079/RoomBlackout.cs b/Exiled.Events/Patches/Events/Scp079/RoomBlackout.cs index 615110735a..ad645139f0 100644 --- a/Exiled.Events/Patches/Events/Scp079/RoomBlackout.cs +++ b/Exiled.Events/Patches/Events/Scp079/RoomBlackout.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Scp079 using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp079; using HarmonyLib; diff --git a/Exiled.Events/Patches/Events/Scp079/TriggeringDoor.cs b/Exiled.Events/Patches/Events/Scp079/TriggeringDoor.cs index aa9beb8249..b21f02d8f8 100644 --- a/Exiled.Events/Patches/Events/Scp079/TriggeringDoor.cs +++ b/Exiled.Events/Patches/Events/Scp079/TriggeringDoor.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Scp079 using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.API.Features.Doors; using Exiled.Events.Attributes; diff --git a/Exiled.Events/Patches/Events/Scp079/ZoneBlackout.cs b/Exiled.Events/Patches/Events/Scp079/ZoneBlackout.cs index 5cc8cbd10d..bfcf5934e0 100644 --- a/Exiled.Events/Patches/Events/Scp079/ZoneBlackout.cs +++ b/Exiled.Events/Patches/Events/Scp079/ZoneBlackout.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Scp079 using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.API.Extensions; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp079; diff --git a/Exiled.Events/Patches/Events/Scp096/AddingTarget.cs b/Exiled.Events/Patches/Events/Scp096/AddingTarget.cs index 408de36295..77b74ef6d1 100644 --- a/Exiled.Events/Patches/Events/Scp096/AddingTarget.cs +++ b/Exiled.Events/Patches/Events/Scp096/AddingTarget.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Scp096 using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp096; diff --git a/Exiled.Events/Patches/Events/Scp096/CalmingDown.cs b/Exiled.Events/Patches/Events/Scp096/CalmingDown.cs index 484190a49e..202ff64e95 100644 --- a/Exiled.Events/Patches/Events/Scp096/CalmingDown.cs +++ b/Exiled.Events/Patches/Events/Scp096/CalmingDown.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Scp096 using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp096; diff --git a/Exiled.Events/Patches/Events/Scp096/Charging.cs b/Exiled.Events/Patches/Events/Scp096/Charging.cs index 85e799977c..aa515abfa8 100644 --- a/Exiled.Events/Patches/Events/Scp096/Charging.cs +++ b/Exiled.Events/Patches/Events/Scp096/Charging.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Scp096 using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp096; diff --git a/Exiled.Events/Patches/Events/Scp096/Enraging.cs b/Exiled.Events/Patches/Events/Scp096/Enraging.cs index 5e0154629d..457545edf9 100644 --- a/Exiled.Events/Patches/Events/Scp096/Enraging.cs +++ b/Exiled.Events/Patches/Events/Scp096/Enraging.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Scp096 using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp096; diff --git a/Exiled.Events/Patches/Events/Scp096/StartPryingGate.cs b/Exiled.Events/Patches/Events/Scp096/StartPryingGate.cs index 420ef8c44f..304a712547 100644 --- a/Exiled.Events/Patches/Events/Scp096/StartPryingGate.cs +++ b/Exiled.Events/Patches/Events/Scp096/StartPryingGate.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Scp096 using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp096; diff --git a/Exiled.Events/Patches/Events/Scp096/TryingNotToCry.cs b/Exiled.Events/Patches/Events/Scp096/TryingNotToCry.cs index 63c40350fe..0cca7abcdf 100644 --- a/Exiled.Events/Patches/Events/Scp096/TryingNotToCry.cs +++ b/Exiled.Events/Patches/Events/Scp096/TryingNotToCry.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Scp096 using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp096; diff --git a/Exiled.Events/Patches/Events/Scp106/Attacking.cs b/Exiled.Events/Patches/Events/Scp106/Attacking.cs index 244d6447e4..6c02409a2a 100644 --- a/Exiled.Events/Patches/Events/Scp106/Attacking.cs +++ b/Exiled.Events/Patches/Events/Scp106/Attacking.cs @@ -12,7 +12,7 @@ namespace Exiled.Events.Patches.Events.Scp106 using System.Reflection.Emit; using Exiled.API.Features; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp106; using HarmonyLib; diff --git a/Exiled.Events/Patches/Events/Scp106/ExitStalking.cs b/Exiled.Events/Patches/Events/Scp106/ExitStalking.cs index ac93ec10f4..85f9c4e4ec 100644 --- a/Exiled.Events/Patches/Events/Scp106/ExitStalking.cs +++ b/Exiled.Events/Patches/Events/Scp106/ExitStalking.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Scp106 using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp106; using HarmonyLib; diff --git a/Exiled.Events/Patches/Events/Scp106/Stalking.cs b/Exiled.Events/Patches/Events/Scp106/Stalking.cs index a59523f7fa..9098fd65e3 100644 --- a/Exiled.Events/Patches/Events/Scp106/Stalking.cs +++ b/Exiled.Events/Patches/Events/Scp106/Stalking.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Scp106 using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp106; using HarmonyLib; diff --git a/Exiled.Events/Patches/Events/Scp106/Teleporting.cs b/Exiled.Events/Patches/Events/Scp106/Teleporting.cs index f5d4aa9a39..44f18c04d4 100644 --- a/Exiled.Events/Patches/Events/Scp106/Teleporting.cs +++ b/Exiled.Events/Patches/Events/Scp106/Teleporting.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Scp106 using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp106; using Exiled.Events.Handlers; diff --git a/Exiled.Events/Patches/Events/Scp173/Blinking.cs b/Exiled.Events/Patches/Events/Scp173/Blinking.cs index bb2f1ab61a..c0589fa48f 100644 --- a/Exiled.Events/Patches/Events/Scp173/Blinking.cs +++ b/Exiled.Events/Patches/Events/Scp173/Blinking.cs @@ -12,7 +12,7 @@ namespace Exiled.Events.Patches.Events.Scp173 using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp173; diff --git a/Exiled.Events/Patches/Events/Scp173/BlinkingRequest.cs b/Exiled.Events/Patches/Events/Scp173/BlinkingRequest.cs index 0671b9e0ea..674b794e4d 100644 --- a/Exiled.Events/Patches/Events/Scp173/BlinkingRequest.cs +++ b/Exiled.Events/Patches/Events/Scp173/BlinkingRequest.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Scp173 using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp173; diff --git a/Exiled.Events/Patches/Events/Scp173/PlacingTantrum.cs b/Exiled.Events/Patches/Events/Scp173/PlacingTantrum.cs index 91db1826cc..122235dce5 100644 --- a/Exiled.Events/Patches/Events/Scp173/PlacingTantrum.cs +++ b/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 API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp173; diff --git a/Exiled.Events/Patches/Events/Scp173/UsingBreakneckSpeeds.cs b/Exiled.Events/Patches/Events/Scp173/UsingBreakneckSpeeds.cs index 8acf3f6f94..b914670e42 100644 --- a/Exiled.Events/Patches/Events/Scp173/UsingBreakneckSpeeds.cs +++ b/Exiled.Events/Patches/Events/Scp173/UsingBreakneckSpeeds.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Scp173 using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp173; diff --git a/Exiled.Events/Patches/Events/Scp244/DamagingScp244.cs b/Exiled.Events/Patches/Events/Scp244/DamagingScp244.cs index 7bb4a51603..f7d82d8d2d 100644 --- a/Exiled.Events/Patches/Events/Scp244/DamagingScp244.cs +++ b/Exiled.Events/Patches/Events/Scp244/DamagingScp244.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Scp244 using System.Reflection.Emit; using API.Features.DamageHandlers; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp244; diff --git a/Exiled.Events/Patches/Events/Scp244/UpdateScp244.cs b/Exiled.Events/Patches/Events/Scp244/UpdateScp244.cs index 2443644675..832fb0f6b0 100644 --- a/Exiled.Events/Patches/Events/Scp244/UpdateScp244.cs +++ b/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 API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp244; diff --git a/Exiled.Events/Patches/Events/Scp244/UsingScp244.cs b/Exiled.Events/Patches/Events/Scp244/UsingScp244.cs index 586d1d4302..a1ed1fa8f9 100644 --- a/Exiled.Events/Patches/Events/Scp244/UsingScp244.cs +++ b/Exiled.Events/Patches/Events/Scp244/UsingScp244.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Scp244 using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp244; diff --git a/Exiled.Events/Patches/Events/Scp3114/Revealing.cs b/Exiled.Events/Patches/Events/Scp3114/Revealing.cs index ca8d6988a8..47804ba0e0 100644 --- a/Exiled.Events/Patches/Events/Scp3114/Revealing.cs +++ b/Exiled.Events/Patches/Events/Scp3114/Revealing.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Scp3114 using System.Collections.Generic; using System.Reflection.Emit; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp3114; using Exiled.Events.Handlers; diff --git a/Exiled.Events/Patches/Events/Scp3114/Strangling.cs b/Exiled.Events/Patches/Events/Scp3114/Strangling.cs index 459c0b0a0d..eeec25b659 100644 --- a/Exiled.Events/Patches/Events/Scp3114/Strangling.cs +++ b/Exiled.Events/Patches/Events/Scp3114/Strangling.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Scp3114 using System.Collections.Generic; using System.Reflection.Emit; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp3114; using Exiled.Events.Handlers; diff --git a/Exiled.Events/Patches/Events/Scp3114/TryUseBody.cs b/Exiled.Events/Patches/Events/Scp3114/TryUseBody.cs index d3b9bc87a7..fb6106e2e5 100644 --- a/Exiled.Events/Patches/Events/Scp3114/TryUseBody.cs +++ b/Exiled.Events/Patches/Events/Scp3114/TryUseBody.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Scp3114 using System.Collections.Generic; using System.Reflection.Emit; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp3114; using Exiled.Events.Handlers; diff --git a/Exiled.Events/Patches/Events/Scp3114/VoiceLines.cs b/Exiled.Events/Patches/Events/Scp3114/VoiceLines.cs index 59983bb993..dac4b785c6 100644 --- a/Exiled.Events/Patches/Events/Scp3114/VoiceLines.cs +++ b/Exiled.Events/Patches/Events/Scp3114/VoiceLines.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Scp3114 using System.Collections.Generic; using System.Reflection.Emit; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp3114; using Exiled.Events.Handlers; diff --git a/Exiled.Events/Patches/Events/Scp330/DroppingCandy.cs b/Exiled.Events/Patches/Events/Scp330/DroppingCandy.cs index 5d61a10acd..072c669482 100644 --- a/Exiled.Events/Patches/Events/Scp330/DroppingCandy.cs +++ b/Exiled.Events/Patches/Events/Scp330/DroppingCandy.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Scp330 using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp330; diff --git a/Exiled.Events/Patches/Events/Scp330/EatingScp330.cs b/Exiled.Events/Patches/Events/Scp330/EatingScp330.cs index 1ad59414d4..63cffa7358 100644 --- a/Exiled.Events/Patches/Events/Scp330/EatingScp330.cs +++ b/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 API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp330; diff --git a/Exiled.Events/Patches/Events/Scp330/InteractingScp330.cs b/Exiled.Events/Patches/Events/Scp330/InteractingScp330.cs index 0c43bbadd7..be109fe67f 100644 --- a/Exiled.Events/Patches/Events/Scp330/InteractingScp330.cs +++ b/Exiled.Events/Patches/Events/Scp330/InteractingScp330.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Scp330 using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using CustomPlayerEffects; using Exiled.Events.Attributes; diff --git a/Exiled.Events/Patches/Events/Scp914/InteractingEvents.cs b/Exiled.Events/Patches/Events/Scp914/InteractingEvents.cs index da157c1e86..9c9208c7ca 100644 --- a/Exiled.Events/Patches/Events/Scp914/InteractingEvents.cs +++ b/Exiled.Events/Patches/Events/Scp914/InteractingEvents.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Scp914 using System.Reflection.Emit; using API.Features; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp914; diff --git a/Exiled.Events/Patches/Events/Scp914/UpgradingItem.cs b/Exiled.Events/Patches/Events/Scp914/UpgradingItem.cs index 300952c334..969be09191 100644 --- a/Exiled.Events/Patches/Events/Scp914/UpgradingItem.cs +++ b/Exiled.Events/Patches/Events/Scp914/UpgradingItem.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Scp914 using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp914; diff --git a/Exiled.Events/Patches/Events/Scp914/UpgradingPlayer.cs b/Exiled.Events/Patches/Events/Scp914/UpgradingPlayer.cs index a58a4d2a43..e7777b3e67 100644 --- a/Exiled.Events/Patches/Events/Scp914/UpgradingPlayer.cs +++ b/Exiled.Events/Patches/Events/Scp914/UpgradingPlayer.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Scp914 using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp914; using global::Scp914; diff --git a/Exiled.Events/Patches/Events/Scp939/Clawed.cs b/Exiled.Events/Patches/Events/Scp939/Clawed.cs index 263181ab88..2502f67037 100644 --- a/Exiled.Events/Patches/Events/Scp939/Clawed.cs +++ b/Exiled.Events/Patches/Events/Scp939/Clawed.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Scp939 using System.Reflection.Emit; using Exiled.API.Features; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp939; using HarmonyLib; diff --git a/Exiled.Events/Patches/Events/Scp939/Focus.cs b/Exiled.Events/Patches/Events/Scp939/Focus.cs index a4992f2a83..8fb584d3e0 100644 --- a/Exiled.Events/Patches/Events/Scp939/Focus.cs +++ b/Exiled.Events/Patches/Events/Scp939/Focus.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Scp939 using System.Collections.Generic; using System.Reflection.Emit; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp939; using Exiled.Events.Handlers; diff --git a/Exiled.Events/Patches/Events/Scp939/Lunge.cs b/Exiled.Events/Patches/Events/Scp939/Lunge.cs index c9f1019af7..90387e53f6 100644 --- a/Exiled.Events/Patches/Events/Scp939/Lunge.cs +++ b/Exiled.Events/Patches/Events/Scp939/Lunge.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Scp939 using System.Collections.Generic; using System.Reflection.Emit; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp939; using Exiled.Events.Handlers; diff --git a/Exiled.Events/Patches/Events/Scp939/PlacingAmnesticCloud.cs b/Exiled.Events/Patches/Events/Scp939/PlacingAmnesticCloud.cs index e4b8dadaa1..58fa9967e7 100644 --- a/Exiled.Events/Patches/Events/Scp939/PlacingAmnesticCloud.cs +++ b/Exiled.Events/Patches/Events/Scp939/PlacingAmnesticCloud.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Scp939 using System.Collections.Generic; using System.Reflection.Emit; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp939; using Exiled.Events.Handlers; diff --git a/Exiled.Events/Patches/Events/Scp939/PlayingVoice.cs b/Exiled.Events/Patches/Events/Scp939/PlayingVoice.cs index 84372d0dbb..ac177c11b8 100644 --- a/Exiled.Events/Patches/Events/Scp939/PlayingVoice.cs +++ b/Exiled.Events/Patches/Events/Scp939/PlayingVoice.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Scp939 using System.Collections.Generic; using System.Reflection.Emit; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp939; using Exiled.Events.Handlers; diff --git a/Exiled.Events/Patches/Events/Scp939/SavingVoice.cs b/Exiled.Events/Patches/Events/Scp939/SavingVoice.cs index d0bafe5d0e..825ec75d53 100644 --- a/Exiled.Events/Patches/Events/Scp939/SavingVoice.cs +++ b/Exiled.Events/Patches/Events/Scp939/SavingVoice.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Scp939 using System.Collections.Generic; using System.Reflection.Emit; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp939; using Exiled.Events.Handlers; diff --git a/Exiled.Events/Patches/Events/Server/AddingUnitName.cs b/Exiled.Events/Patches/Events/Server/AddingUnitName.cs index e8fab3b4aa..9f4b238c2e 100644 --- a/Exiled.Events/Patches/Events/Server/AddingUnitName.cs +++ b/Exiled.Events/Patches/Events/Server/AddingUnitName.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Server using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Server; diff --git a/Exiled.Events/Patches/Events/Server/ChoosingStartTeamQueue.cs b/Exiled.Events/Patches/Events/Server/ChoosingStartTeamQueue.cs index 0bbc59c2c7..7ad55db235 100644 --- a/Exiled.Events/Patches/Events/Server/ChoosingStartTeamQueue.cs +++ b/Exiled.Events/Patches/Events/Server/ChoosingStartTeamQueue.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Server using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Server; using HarmonyLib; diff --git a/Exiled.Events/Patches/Events/Server/Reporting.cs b/Exiled.Events/Patches/Events/Server/Reporting.cs index bba54c92ed..f7fd265e7b 100644 --- a/Exiled.Events/Patches/Events/Server/Reporting.cs +++ b/Exiled.Events/Patches/Events/Server/Reporting.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Server using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; using Exiled.Events.EventArgs.Server; diff --git a/Exiled.Events/Patches/Events/Server/RespawningTeam.cs b/Exiled.Events/Patches/Events/Server/RespawningTeam.cs index a81b42a1eb..e27f1325e2 100644 --- a/Exiled.Events/Patches/Events/Server/RespawningTeam.cs +++ b/Exiled.Events/Patches/Events/Server/RespawningTeam.cs @@ -12,7 +12,7 @@ namespace Exiled.Events.Patches.Events.Server using System.Reflection; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Server; using Exiled.Events.Handlers; diff --git a/Exiled.Events/Patches/Events/Server/RestartingRound.cs b/Exiled.Events/Patches/Events/Server/RestartingRound.cs index 99c3a5e06c..5e9548a076 100644 --- a/Exiled.Events/Patches/Events/Server/RestartingRound.cs +++ b/Exiled.Events/Patches/Events/Server/RestartingRound.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Server using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using GameCore; diff --git a/Exiled.Events/Patches/Events/Server/RoundEnd.cs b/Exiled.Events/Patches/Events/Server/RoundEnd.cs index 5ca5102b9f..da033dddf0 100644 --- a/Exiled.Events/Patches/Events/Server/RoundEnd.cs +++ b/Exiled.Events/Patches/Events/Server/RoundEnd.cs @@ -13,7 +13,7 @@ namespace Exiled.Events.Patches.Events.Server using System.Reflection.Emit; using Exiled.API.Features; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using Exiled.Events.EventArgs.Server; using HarmonyLib; diff --git a/Exiled.Events/Patches/Events/Server/SelectingRespawnTeam.cs b/Exiled.Events/Patches/Events/Server/SelectingRespawnTeam.cs index 3418332acc..8272e10c1a 100644 --- a/Exiled.Events/Patches/Events/Server/SelectingRespawnTeam.cs +++ b/Exiled.Events/Patches/Events/Server/SelectingRespawnTeam.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Server using System.Collections.Generic; using System.Reflection.Emit; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Server; diff --git a/Exiled.Events/Patches/Events/Warhead/ChangingLeverStatus.cs b/Exiled.Events/Patches/Events/Warhead/ChangingLeverStatus.cs index b03e488692..ba3020ac9b 100644 --- a/Exiled.Events/Patches/Events/Warhead/ChangingLeverStatus.cs +++ b/Exiled.Events/Patches/Events/Warhead/ChangingLeverStatus.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Warhead using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Warhead; diff --git a/Exiled.Events/Patches/Events/Warhead/Detonation.cs b/Exiled.Events/Patches/Events/Warhead/Detonation.cs index 016d530872..1b39f95456 100644 --- a/Exiled.Events/Patches/Events/Warhead/Detonation.cs +++ b/Exiled.Events/Patches/Events/Warhead/Detonation.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Events.Warhead using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Warhead; using Handlers; diff --git a/Exiled.Events/Patches/Events/Warhead/Starting.cs b/Exiled.Events/Patches/Events/Warhead/Starting.cs index 42563ae54a..ebffe08f37 100644 --- a/Exiled.Events/Patches/Events/Warhead/Starting.cs +++ b/Exiled.Events/Patches/Events/Warhead/Starting.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Warhead using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Warhead; diff --git a/Exiled.Events/Patches/Events/Warhead/Stopping.cs b/Exiled.Events/Patches/Events/Warhead/Stopping.cs index a9efe02cb0..e9ca2cba44 100644 --- a/Exiled.Events/Patches/Events/Warhead/Stopping.cs +++ b/Exiled.Events/Patches/Events/Warhead/Stopping.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Warhead using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Warhead; diff --git a/Exiled.Events/Patches/Fixes/FixPickupPreviousOwner.cs b/Exiled.Events/Patches/Fixes/FixPickupPreviousOwner.cs index 22f5a2db78..4e6ceecb96 100644 --- a/Exiled.Events/Patches/Fixes/FixPickupPreviousOwner.cs +++ b/Exiled.Events/Patches/Fixes/FixPickupPreviousOwner.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Fixes using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Footprinting; using HarmonyLib; using InventorySystem; diff --git a/Exiled.Events/Patches/Fixes/GetAmmoLimitFix.cs b/Exiled.Events/Patches/Fixes/GetAmmoLimitFix.cs index 54465f361d..6d18cadd4a 100644 --- a/Exiled.Events/Patches/Fixes/GetAmmoLimitFix.cs +++ b/Exiled.Events/Patches/Fixes/GetAmmoLimitFix.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Fixes using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using HarmonyLib; using InventorySystem.Configs; diff --git a/Exiled.Events/Patches/Fixes/GrenadePropertiesFix.cs b/Exiled.Events/Patches/Fixes/GrenadePropertiesFix.cs index bb42e350a2..57889af5ef 100644 --- a/Exiled.Events/Patches/Fixes/GrenadePropertiesFix.cs +++ b/Exiled.Events/Patches/Fixes/GrenadePropertiesFix.cs @@ -12,7 +12,7 @@ namespace Exiled.Events.Patches.Fixes using API.Features.Items; using API.Features.Pickups.Projectiles; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using HarmonyLib; diff --git a/Exiled.Events/Patches/Fixes/HurtingFix.cs b/Exiled.Events/Patches/Fixes/HurtingFix.cs index 56f5f2cf09..31c22bdbe8 100644 --- a/Exiled.Events/Patches/Fixes/HurtingFix.cs +++ b/Exiled.Events/Patches/Fixes/HurtingFix.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using HarmonyLib; diff --git a/Exiled.Events/Patches/Fixes/LockerFixes.cs b/Exiled.Events/Patches/Fixes/LockerFixes.cs index ca5577a46c..5a75e20ef6 100644 --- a/Exiled.Events/Patches/Fixes/LockerFixes.cs +++ b/Exiled.Events/Patches/Fixes/LockerFixes.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Fixes using System.Collections.Generic; using System.Reflection.Emit; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using HarmonyLib; diff --git a/Exiled.Events/Patches/Fixes/PositionSpawnScp0492Fix.cs b/Exiled.Events/Patches/Fixes/PositionSpawnScp0492Fix.cs index 624dc88af6..e7a33157f1 100644 --- a/Exiled.Events/Patches/Fixes/PositionSpawnScp0492Fix.cs +++ b/Exiled.Events/Patches/Fixes/PositionSpawnScp0492Fix.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Fixes using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.Events.EventArgs.Player; using HarmonyLib; diff --git a/Exiled.Events/Patches/Fixes/Scp3114AttackAhpFix.cs b/Exiled.Events/Patches/Fixes/Scp3114AttackAhpFix.cs index 2722c59e10..ea6fdd606f 100644 --- a/Exiled.Events/Patches/Fixes/Scp3114AttackAhpFix.cs +++ b/Exiled.Events/Patches/Fixes/Scp3114AttackAhpFix.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Fixes using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using HarmonyLib; using PlayerRoles.PlayableScps.Scp3114; using PlayerRoles.PlayableScps.Subroutines; diff --git a/Exiled.Events/Patches/Fixes/VoiceChatMutesClear.cs b/Exiled.Events/Patches/Fixes/VoiceChatMutesClear.cs index 6e933e8bcf..f0fc6009bb 100644 --- a/Exiled.Events/Patches/Fixes/VoiceChatMutesClear.cs +++ b/Exiled.Events/Patches/Fixes/VoiceChatMutesClear.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Fixes using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using HarmonyLib; diff --git a/Exiled.Events/Patches/Fixes/WeaponAttachmentDesyncFix.cs b/Exiled.Events/Patches/Fixes/WeaponAttachmentDesyncFix.cs index 5a2c4884f8..dfd304d2a5 100644 --- a/Exiled.Events/Patches/Fixes/WeaponAttachmentDesyncFix.cs +++ b/Exiled.Events/Patches/Fixes/WeaponAttachmentDesyncFix.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Fixes using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using HarmonyLib; diff --git a/Exiled.Events/Patches/Generic/CameraList.cs b/Exiled.Events/Patches/Generic/CameraList.cs index fbcb76e863..22f697d809 100644 --- a/Exiled.Events/Patches/Generic/CameraList.cs +++ b/Exiled.Events/Patches/Generic/CameraList.cs @@ -13,7 +13,7 @@ namespace Exiled.Events.Patches.Generic using API.Features; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using HarmonyLib; diff --git a/Exiled.Events/Patches/Generic/CanScp049SenseTutorial.cs b/Exiled.Events/Patches/Generic/CanScp049SenseTutorial.cs index 8f0f815ac0..0f9e3d49a2 100644 --- a/Exiled.Events/Patches/Generic/CanScp049SenseTutorial.cs +++ b/Exiled.Events/Patches/Generic/CanScp049SenseTutorial.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Generic using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using HarmonyLib; diff --git a/Exiled.Events/Patches/Generic/CommandLogging.cs b/Exiled.Events/Patches/Generic/CommandLogging.cs index ec8b0d157c..d06cc60758 100644 --- a/Exiled.Events/Patches/Generic/CommandLogging.cs +++ b/Exiled.Events/Patches/Generic/CommandLogging.cs @@ -13,7 +13,7 @@ namespace Exiled.Events.Patches.Generic using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using HarmonyLib; diff --git a/Exiled.Events/Patches/Generic/DestroyRecontainerInstance.cs b/Exiled.Events/Patches/Generic/DestroyRecontainerInstance.cs index 7b62568eb4..c778933d13 100644 --- a/Exiled.Events/Patches/Generic/DestroyRecontainerInstance.cs +++ b/Exiled.Events/Patches/Generic/DestroyRecontainerInstance.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Generic using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using HarmonyLib; diff --git a/Exiled.Events/Patches/Generic/GeneratorList.cs b/Exiled.Events/Patches/Generic/GeneratorList.cs index eec846d6c3..248501613e 100644 --- a/Exiled.Events/Patches/Generic/GeneratorList.cs +++ b/Exiled.Events/Patches/Generic/GeneratorList.cs @@ -12,7 +12,7 @@ namespace Exiled.Events.Patches.Generic using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using HarmonyLib; diff --git a/Exiled.Events/Patches/Generic/GhostModePatch.cs b/Exiled.Events/Patches/Generic/GhostModePatch.cs index 51401de0da..d6898e88ce 100644 --- a/Exiled.Events/Patches/Generic/GhostModePatch.cs +++ b/Exiled.Events/Patches/Generic/GhostModePatch.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Generic using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using API.Features.Roles; using HarmonyLib; diff --git a/Exiled.Events/Patches/Generic/IndividualFriendlyFire.cs b/Exiled.Events/Patches/Generic/IndividualFriendlyFire.cs index addee3ea8f..9000a24fc4 100644 --- a/Exiled.Events/Patches/Generic/IndividualFriendlyFire.cs +++ b/Exiled.Events/Patches/Generic/IndividualFriendlyFire.cs @@ -13,7 +13,7 @@ namespace Exiled.Events.Patches.Generic using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Footprinting; diff --git a/Exiled.Events/Patches/Generic/InitRecontainerInstance.cs b/Exiled.Events/Patches/Generic/InitRecontainerInstance.cs index eb6d3533d4..6e32ca1393 100644 --- a/Exiled.Events/Patches/Generic/InitRecontainerInstance.cs +++ b/Exiled.Events/Patches/Generic/InitRecontainerInstance.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Generic using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using HarmonyLib; diff --git a/Exiled.Events/Patches/Generic/InventoryControlPatch.cs b/Exiled.Events/Patches/Generic/InventoryControlPatch.cs index 6651d46dd4..b1aa80a2b1 100644 --- a/Exiled.Events/Patches/Generic/InventoryControlPatch.cs +++ b/Exiled.Events/Patches/Generic/InventoryControlPatch.cs @@ -15,7 +15,7 @@ namespace Exiled.Events.Patches.Generic using API.Features; using API.Features.Items; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.API.Features.Pickups; using HarmonyLib; diff --git a/Exiled.Events/Patches/Generic/LockerList.cs b/Exiled.Events/Patches/Generic/LockerList.cs index 26b0732abe..bd616a847c 100644 --- a/Exiled.Events/Patches/Generic/LockerList.cs +++ b/Exiled.Events/Patches/Generic/LockerList.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Generic using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using HarmonyLib; diff --git a/Exiled.Events/Patches/Generic/ParseVisionInformation.cs b/Exiled.Events/Patches/Generic/ParseVisionInformation.cs index 5698191921..a6dec99557 100644 --- a/Exiled.Events/Patches/Generic/ParseVisionInformation.cs +++ b/Exiled.Events/Patches/Generic/ParseVisionInformation.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Generic using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using HarmonyLib; diff --git a/Exiled.Events/Patches/Generic/PickupControlPatch.cs b/Exiled.Events/Patches/Generic/PickupControlPatch.cs index ab8ba592f7..6f00b5d0bb 100644 --- a/Exiled.Events/Patches/Generic/PickupControlPatch.cs +++ b/Exiled.Events/Patches/Generic/PickupControlPatch.cs @@ -12,7 +12,7 @@ namespace Exiled.Events.Patches.Generic using System.Reflection.Emit; using API.Features.Pickups; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.API.Features.Items; diff --git a/Exiled.Events/Patches/Generic/RoomList.cs b/Exiled.Events/Patches/Generic/RoomList.cs index 112410ceaf..1bfed91b91 100644 --- a/Exiled.Events/Patches/Generic/RoomList.cs +++ b/Exiled.Events/Patches/Generic/RoomList.cs @@ -14,7 +14,7 @@ namespace Exiled.Events.Patches.Generic using API.Features; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using HarmonyLib; diff --git a/Exiled.Events/Patches/Generic/Scp049API/CallAbilityDuration.cs b/Exiled.Events/Patches/Generic/Scp049API/CallAbilityDuration.cs index ddfb45adbe..c4d30be1f5 100644 --- a/Exiled.Events/Patches/Generic/Scp049API/CallAbilityDuration.cs +++ b/Exiled.Events/Patches/Generic/Scp049API/CallAbilityDuration.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Generic.Scp079API using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.API.Features; using HarmonyLib; using PlayerRoles.PlayableScps.Scp049; diff --git a/Exiled.Events/Patches/Generic/Scp049API/SenseAbilityBaseCooldown.cs b/Exiled.Events/Patches/Generic/Scp049API/SenseAbilityBaseCooldown.cs index a70583b5fd..d2edaefe0e 100644 --- a/Exiled.Events/Patches/Generic/Scp049API/SenseAbilityBaseCooldown.cs +++ b/Exiled.Events/Patches/Generic/Scp049API/SenseAbilityBaseCooldown.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Generic.Scp079API using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.API.Features; using HarmonyLib; diff --git a/Exiled.Events/Patches/Generic/Scp049API/SenseAbilityReducedCooldown.cs b/Exiled.Events/Patches/Generic/Scp049API/SenseAbilityReducedCooldown.cs index 88c8333a1e..6cbc4e34fd 100644 --- a/Exiled.Events/Patches/Generic/Scp049API/SenseAbilityReducedCooldown.cs +++ b/Exiled.Events/Patches/Generic/Scp049API/SenseAbilityReducedCooldown.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Generic.Scp079API using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.API.Features; using HarmonyLib; diff --git a/Exiled.Events/Patches/Generic/Scp079Scan.cs b/Exiled.Events/Patches/Generic/Scp079Scan.cs index 4660d1923c..057a62782b 100644 --- a/Exiled.Events/Patches/Generic/Scp079Scan.cs +++ b/Exiled.Events/Patches/Generic/Scp079Scan.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Generic using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using HarmonyLib; diff --git a/Exiled.Events/Patches/Generic/Scp106API/CooldownReductionReward.cs b/Exiled.Events/Patches/Generic/Scp106API/CooldownReductionReward.cs index 53517ee51a..c90c8f4e88 100644 --- a/Exiled.Events/Patches/Generic/Scp106API/CooldownReductionReward.cs +++ b/Exiled.Events/Patches/Generic/Scp106API/CooldownReductionReward.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Generic.Scp106API using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.API.Features; using HarmonyLib; using PlayerRoles.PlayableScps.Scp106; diff --git a/Exiled.Events/Patches/Generic/Scp106API/CustomAttack.cs b/Exiled.Events/Patches/Generic/Scp106API/CustomAttack.cs index 5bf4649584..3d90052792 100644 --- a/Exiled.Events/Patches/Generic/Scp106API/CustomAttack.cs +++ b/Exiled.Events/Patches/Generic/Scp106API/CustomAttack.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Generic.Scp106API using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.API.Features; using HarmonyLib; using PlayerRoles.PlayableScps.Scp106; diff --git a/Exiled.Events/Patches/Generic/Scp106API/HunterAtlastCostPerMetter.cs b/Exiled.Events/Patches/Generic/Scp106API/HunterAtlastCostPerMetter.cs index 8cd89c0b1b..a839e342a7 100644 --- a/Exiled.Events/Patches/Generic/Scp106API/HunterAtlastCostPerMetter.cs +++ b/Exiled.Events/Patches/Generic/Scp106API/HunterAtlastCostPerMetter.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Generic.Scp106API using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.API.Features; using HarmonyLib; using PlayerRoles.PlayableScps.Scp106; diff --git a/Exiled.Events/Patches/Generic/Scp106API/SinkholeAbilityCooldown.cs b/Exiled.Events/Patches/Generic/Scp106API/SinkholeAbilityCooldown.cs index cdb02f42ae..1ac1fbc145 100644 --- a/Exiled.Events/Patches/Generic/Scp106API/SinkholeAbilityCooldown.cs +++ b/Exiled.Events/Patches/Generic/Scp106API/SinkholeAbilityCooldown.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Generic.Scp106API using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.API.Features; using HarmonyLib; using PlayerRoles.PlayableScps.Scp106; diff --git a/Exiled.Events/Patches/Generic/Scp106API/StalkVigorUse.cs b/Exiled.Events/Patches/Generic/Scp106API/StalkVigorUse.cs index 38b7a9e53b..98392850e1 100644 --- a/Exiled.Events/Patches/Generic/Scp106API/StalkVigorUse.cs +++ b/Exiled.Events/Patches/Generic/Scp106API/StalkVigorUse.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Generic.Scp106API using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.API.Features; using HarmonyLib; using PlayerRoles.PlayableScps.Scp106; diff --git a/Exiled.Events/Patches/Generic/Scp106API/VigorRegeneration.cs b/Exiled.Events/Patches/Generic/Scp106API/VigorRegeneration.cs index f14fd51d15..54ebf3bb5f 100644 --- a/Exiled.Events/Patches/Generic/Scp106API/VigorRegeneration.cs +++ b/Exiled.Events/Patches/Generic/Scp106API/VigorRegeneration.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Generic.Scp106API using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using Exiled.API.Features; using HarmonyLib; using PlayerRoles.PlayableScps.Scp106; diff --git a/Exiled.Events/Patches/Generic/Scp173BeingLooked.cs b/Exiled.Events/Patches/Generic/Scp173BeingLooked.cs index 6e0e0d0be5..6c097cf7e7 100644 --- a/Exiled.Events/Patches/Generic/Scp173BeingLooked.cs +++ b/Exiled.Events/Patches/Generic/Scp173BeingLooked.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Generic using System.Reflection.Emit; using API.Features; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using HarmonyLib; diff --git a/Exiled.Loader/ConfigManager.cs b/Exiled.Loader/ConfigManager.cs index 17a351c9ee..4cfd46e192 100644 --- a/Exiled.Loader/ConfigManager.cs +++ b/Exiled.Loader/ConfigManager.cs @@ -19,7 +19,7 @@ namespace Exiled.Loader using Exiled.API.Features; using Exiled.API.Features.Attributes; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using YamlDotNet.Core; using Serialization = API.Features.EConfig; diff --git a/Exiled.Loader/TranslationManager.cs b/Exiled.Loader/TranslationManager.cs index 06fffb153b..d5873bebee 100644 --- a/Exiled.Loader/TranslationManager.cs +++ b/Exiled.Loader/TranslationManager.cs @@ -17,7 +17,7 @@ namespace Exiled.Loader using API.Interfaces; using Exiled.API.Features; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using YamlDotNet.Core; diff --git a/Exiled.Permissions/Commands/Permissions/Group/Group.cs b/Exiled.Permissions/Commands/Permissions/Group/Group.cs index 0e91dbeb94..8d6474c14d 100644 --- a/Exiled.Permissions/Commands/Permissions/Group/Group.cs +++ b/Exiled.Permissions/Commands/Permissions/Group/Group.cs @@ -12,7 +12,7 @@ namespace Exiled.Permissions.Commands.Permissions.Group using CommandSystem; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using Extensions; diff --git a/Exiled.Permissions/Commands/Permissions/Permissions.cs b/Exiled.Permissions/Commands/Permissions/Permissions.cs index 3bb84e73ee..6ee878cf7b 100644 --- a/Exiled.Permissions/Commands/Permissions/Permissions.cs +++ b/Exiled.Permissions/Commands/Permissions/Permissions.cs @@ -12,7 +12,7 @@ namespace Exiled.Permissions.Commands.Permissions using CommandSystem; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; /// /// Handles commands about permissions. diff --git a/Exiled.Permissions/Extensions/Permissions.cs b/Exiled.Permissions/Extensions/Permissions.cs index fba930746f..7bbce8617a 100644 --- a/Exiled.Permissions/Extensions/Permissions.cs +++ b/Exiled.Permissions/Extensions/Permissions.cs @@ -17,7 +17,7 @@ namespace Exiled.Permissions.Extensions using Exiled.API.Extensions; using Exiled.API.Features; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using Features; using Properties; From ec792faa4d8a12d30974648c43ecb086f691a090 Mon Sep 17 00:00:00 2001 From: Naounderscore Date: Fri, 26 Jan 2024 17:57:32 +0100 Subject: [PATCH 025/141] Fixed `DictionaryPool` --- .../Core/Generic/Pools/DictionaryPool.cs | 22 +++++++++++-------- .../Core/Generic/Pools/HashSetPool.cs | 2 -- .../Features/Core/Generic/Pools/ListPool.cs | 2 -- .../Features/Core/Generic/Pools/QueuePool.cs | 2 -- .../Core/Generic/Pools/StringBuilderPool.cs | 2 -- .../Map/ExplodingGrenadeEventArgs.cs | 2 +- .../Handlers/Internal/MapGenerated.cs | 2 +- .../Events/Item/ChangingAttachments.cs | 2 +- .../Events/Map/AnnouncingScpTermination.cs | 2 +- .../Patches/Events/Map/SpawningItem.cs | 2 +- .../Patches/Events/Player/ChangingItem.cs | 2 +- .../Patches/Events/Player/DamagingWindow.cs | 2 +- .../Patches/Events/Scp244/DamagingScp244.cs | 2 +- .../Patches/Fixes/GrenadePropertiesFix.cs | 2 +- .../Patches/Generic/InventoryControlPatch.cs | 2 +- .../Patches/Generic/PickupControlPatch.cs | 2 +- 16 files changed, 24 insertions(+), 28 deletions(-) diff --git a/Exiled.API/Features/Core/Generic/Pools/DictionaryPool.cs b/Exiled.API/Features/Core/Generic/Pools/DictionaryPool.cs index f6840806ae..aa6919b302 100644 --- a/Exiled.API/Features/Core/Generic/Pools/DictionaryPool.cs +++ b/Exiled.API/Features/Core/Generic/Pools/DictionaryPool.cs @@ -37,10 +37,17 @@ private DictionaryPool() /// The . public Dictionary Get() { - /*if (pool.TryDequeue(out Dictionary result)) - return result;*/ + if (pool.TryDequeue(out Dictionary result)) + { + pool.Enqueue(new Dictionary()); + result.Clear(); + } + else + { + result = new Dictionary(); + } - return new(); + return result; } /// @@ -50,8 +57,7 @@ public Dictionary Get() /// The . public Dictionary Get(IEnumerable> pairs) { - // if (!pool.TryDequeue(out Dictionary dict)) - Dictionary dict = new(); + Dictionary dict = Get(); foreach (KeyValuePair pair in pairs) dict.Add(pair.Key, pair.Value); @@ -65,8 +71,8 @@ public Dictionary Get(IEnumerable> pair /// The to return. public void Return(Dictionary obj) { - // obj.Clear(); - // pool.Enqueue(obj); + obj.Clear(); + pool.Enqueue(obj); } /// @@ -77,9 +83,7 @@ public void Return(Dictionary obj) public KeyValuePair[] ToArrayReturn(Dictionary obj) { KeyValuePair[] array = obj.ToArray(); - Return(obj); - return array; } } diff --git a/Exiled.API/Features/Core/Generic/Pools/HashSetPool.cs b/Exiled.API/Features/Core/Generic/Pools/HashSetPool.cs index cd3467e3ea..fe9b9cbd38 100644 --- a/Exiled.API/Features/Core/Generic/Pools/HashSetPool.cs +++ b/Exiled.API/Features/Core/Generic/Pools/HashSetPool.cs @@ -50,9 +50,7 @@ private HashSetPool() public T[] ToArrayReturn(HashSet obj) { T[] array = obj.ToArray(); - Return(obj); - return array; } } diff --git a/Exiled.API/Features/Core/Generic/Pools/ListPool.cs b/Exiled.API/Features/Core/Generic/Pools/ListPool.cs index 2f2a764b27..537c953f31 100644 --- a/Exiled.API/Features/Core/Generic/Pools/ListPool.cs +++ b/Exiled.API/Features/Core/Generic/Pools/ListPool.cs @@ -56,9 +56,7 @@ private ListPool() public T[] ToArrayReturn(List obj) { T[] array = obj.ToArray(); - Return(obj); - return array; } } diff --git a/Exiled.API/Features/Core/Generic/Pools/QueuePool.cs b/Exiled.API/Features/Core/Generic/Pools/QueuePool.cs index d7b12e7dc5..a4d7fe1cb2 100644 --- a/Exiled.API/Features/Core/Generic/Pools/QueuePool.cs +++ b/Exiled.API/Features/Core/Generic/Pools/QueuePool.cs @@ -71,9 +71,7 @@ public void Return(Queue obj) public T[] ToArrayReturn(Queue obj) { T[] array = obj.ToArray(); - Return(obj); - return array; } } diff --git a/Exiled.API/Features/Core/Generic/Pools/StringBuilderPool.cs b/Exiled.API/Features/Core/Generic/Pools/StringBuilderPool.cs index 5eecbf4d9c..35cb20a828 100644 --- a/Exiled.API/Features/Core/Generic/Pools/StringBuilderPool.cs +++ b/Exiled.API/Features/Core/Generic/Pools/StringBuilderPool.cs @@ -46,9 +46,7 @@ private StringBuilderPool() public string ToStringReturn(StringBuilder obj) { string s = obj.ToString(); - Return(obj); - return s; } } diff --git a/Exiled.Events/EventArgs/Map/ExplodingGrenadeEventArgs.cs b/Exiled.Events/EventArgs/Map/ExplodingGrenadeEventArgs.cs index 9ea0d801de..4bbb253b31 100644 --- a/Exiled.Events/EventArgs/Map/ExplodingGrenadeEventArgs.cs +++ b/Exiled.Events/EventArgs/Map/ExplodingGrenadeEventArgs.cs @@ -10,9 +10,9 @@ namespace Exiled.Events.EventArgs.Map using System.Collections.Generic; using Exiled.API.Features; + using Exiled.API.Features.Core.Generic.Pools; using Exiled.API.Features.Pickups; using Exiled.API.Features.Pickups.Projectiles; - using Exiled.API.Features.Core.Generic.Pools; using Exiled.Events.EventArgs.Interfaces; using Exiled.Events.Patches.Generic; diff --git a/Exiled.Events/Handlers/Internal/MapGenerated.cs b/Exiled.Events/Handlers/Internal/MapGenerated.cs index 48c6f6523b..5f059963dc 100644 --- a/Exiled.Events/Handlers/Internal/MapGenerated.cs +++ b/Exiled.Events/Handlers/Internal/MapGenerated.cs @@ -12,8 +12,8 @@ namespace Exiled.Events.Handlers.Internal using System.Linq; using API.Features; - using API.Features.Items; using API.Features.Core.Generic.Pools; + using API.Features.Items; using API.Structs; using Exiled.API.Enums; diff --git a/Exiled.Events/Patches/Events/Item/ChangingAttachments.cs b/Exiled.Events/Patches/Events/Item/ChangingAttachments.cs index 2b457fabb6..afb30191c2 100644 --- a/Exiled.Events/Patches/Events/Item/ChangingAttachments.cs +++ b/Exiled.Events/Patches/Events/Item/ChangingAttachments.cs @@ -11,8 +11,8 @@ namespace Exiled.Events.Patches.Events.Item using System.Reflection.Emit; using API.Features; - using API.Features.Items; using API.Features.Core.Generic.Pools; + using API.Features.Items; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Item; diff --git a/Exiled.Events/Patches/Events/Map/AnnouncingScpTermination.cs b/Exiled.Events/Patches/Events/Map/AnnouncingScpTermination.cs index 9f1479b159..33a077fed3 100644 --- a/Exiled.Events/Patches/Events/Map/AnnouncingScpTermination.cs +++ b/Exiled.Events/Patches/Events/Map/AnnouncingScpTermination.cs @@ -10,8 +10,8 @@ namespace Exiled.Events.Patches.Events.Map using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.DamageHandlers; using API.Features.Core.Generic.Pools; + using API.Features.DamageHandlers; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Map; using Exiled.Events.Handlers; diff --git a/Exiled.Events/Patches/Events/Map/SpawningItem.cs b/Exiled.Events/Patches/Events/Map/SpawningItem.cs index d8c554c774..e385cc674c 100644 --- a/Exiled.Events/Patches/Events/Map/SpawningItem.cs +++ b/Exiled.Events/Patches/Events/Map/SpawningItem.cs @@ -10,8 +10,8 @@ namespace Exiled.Events.Patches.Events.Map using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Doors; using API.Features.Core.Generic.Pools; + using API.Features.Doors; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Map; diff --git a/Exiled.Events/Patches/Events/Player/ChangingItem.cs b/Exiled.Events/Patches/Events/Player/ChangingItem.cs index f6913fb3a9..527eea22cc 100644 --- a/Exiled.Events/Patches/Events/Player/ChangingItem.cs +++ b/Exiled.Events/Patches/Events/Player/ChangingItem.cs @@ -11,8 +11,8 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using API.Features; - using API.Features.Items; using API.Features.Core.Generic.Pools; + using API.Features.Items; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Player/DamagingWindow.cs b/Exiled.Events/Patches/Events/Player/DamagingWindow.cs index b22d61909e..ea5a3d457b 100644 --- a/Exiled.Events/Patches/Events/Player/DamagingWindow.cs +++ b/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.Core.Generic.Pools; + using API.Features.DamageHandlers; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; diff --git a/Exiled.Events/Patches/Events/Scp244/DamagingScp244.cs b/Exiled.Events/Patches/Events/Scp244/DamagingScp244.cs index f7d82d8d2d..22426c5d1a 100644 --- a/Exiled.Events/Patches/Events/Scp244/DamagingScp244.cs +++ b/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.Core.Generic.Pools; + using API.Features.DamageHandlers; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp244; diff --git a/Exiled.Events/Patches/Fixes/GrenadePropertiesFix.cs b/Exiled.Events/Patches/Fixes/GrenadePropertiesFix.cs index 57889af5ef..f6949c7400 100644 --- a/Exiled.Events/Patches/Fixes/GrenadePropertiesFix.cs +++ b/Exiled.Events/Patches/Fixes/GrenadePropertiesFix.cs @@ -10,9 +10,9 @@ namespace Exiled.Events.Patches.Fixes using System.Collections.Generic; using System.Reflection.Emit; + using API.Features.Core.Generic.Pools; using API.Features.Items; using API.Features.Pickups.Projectiles; - using API.Features.Core.Generic.Pools; using HarmonyLib; diff --git a/Exiled.Events/Patches/Generic/InventoryControlPatch.cs b/Exiled.Events/Patches/Generic/InventoryControlPatch.cs index b1aa80a2b1..212ec2518c 100644 --- a/Exiled.Events/Patches/Generic/InventoryControlPatch.cs +++ b/Exiled.Events/Patches/Generic/InventoryControlPatch.cs @@ -14,8 +14,8 @@ namespace Exiled.Events.Patches.Generic using System.Reflection.Emit; using API.Features; - using API.Features.Items; using API.Features.Core.Generic.Pools; + using API.Features.Items; using Exiled.API.Features.Pickups; using HarmonyLib; diff --git a/Exiled.Events/Patches/Generic/PickupControlPatch.cs b/Exiled.Events/Patches/Generic/PickupControlPatch.cs index 6f00b5d0bb..bcb689f8ab 100644 --- a/Exiled.Events/Patches/Generic/PickupControlPatch.cs +++ b/Exiled.Events/Patches/Generic/PickupControlPatch.cs @@ -11,8 +11,8 @@ namespace Exiled.Events.Patches.Generic using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pickups; using API.Features.Core.Generic.Pools; + using API.Features.Pickups; using Exiled.API.Features.Items; From 02917f3a8fe00bd15d560ab13e76744152cd5786 Mon Sep 17 00:00:00 2001 From: Naounderscore Date: Fri, 26 Jan 2024 17:59:13 +0100 Subject: [PATCH 026/141] Moved `IPool` to `Core::Generic::Pools` --- Exiled.API/Features/Core/{Interfaces => Generic/Pools}/IPool.cs | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Exiled.API/Features/Core/{Interfaces => Generic/Pools}/IPool.cs (100%) diff --git a/Exiled.API/Features/Core/Interfaces/IPool.cs b/Exiled.API/Features/Core/Generic/Pools/IPool.cs similarity index 100% rename from Exiled.API/Features/Core/Interfaces/IPool.cs rename to Exiled.API/Features/Core/Generic/Pools/IPool.cs From fa603db76107bae4c1cc2ac24dde19d6d31e8f25 Mon Sep 17 00:00:00 2001 From: Naounderscore Date: Fri, 26 Jan 2024 18:08:48 +0100 Subject: [PATCH 027/141] Namespace adjustments --- Exiled.API/Features/Core/{ => Behaviours}/EItemBehaviour.cs | 2 +- .../Features/Core/{ => Behaviours}/EPickupBehaviour.cs | 2 +- .../Features/Core/{ => Behaviours}/EPlayerBehaviour.cs | 2 +- Exiled.API/Features/Core/{ => Components}/TickComponent.cs | 2 +- Exiled.API/Features/Core/EActor.cs | 6 ++++-- Exiled.API/Features/Input/InputActionComponent.cs | 1 + .../API/Features/Attributes/CustomAbilityAttribute.cs | 2 +- .../API/Features/Attributes/CustomEscapeAttribute.cs | 2 +- .../API/Features/Attributes/CustomGameModeAttribute.cs | 4 +++- .../API/Features/Attributes/CustomItemAttribute.cs | 2 +- .../API/Features/Attributes/CustomRoleAttribute.cs | 2 +- .../API/Features/Attributes/CustomTeamAttribute.cs | 2 +- .../API/Features/CustomAbilities/CustomAbility.cs | 3 +-- .../API/Features/CustomEscapes/CustomEscape.cs | 3 +-- .../API/Features/CustomEscapes/EscapeBehaviour.cs | 1 + .../API/Features/CustomGamemodes/CustomGameMode.cs | 3 ++- .../API/Features/CustomGamemodes/GameModeSettings.cs | 2 +- .../API/Features/CustomGamemodes/GameState.cs | 4 ++-- .../API/Features/CustomGamemodes/PlayerState.cs | 3 ++- Exiled.CustomModules/API/Features/CustomGamemodes/World.cs | 4 ++-- Exiled.CustomModules/API/Features/CustomItems/CustomItem.cs | 2 +- .../Items/Firearms/SemiAutomaticFirearmBehaviour.cs | 1 + .../API/Features/CustomItems/Items/ItemBehaviour.cs | 1 + .../API/Features/CustomItems/Pickups/PickupBehaviour.cs | 1 + Exiled.CustomModules/API/Features/CustomRoles/CustomRole.cs | 3 +-- Exiled.CustomModules/API/Features/CustomRoles/CustomTeam.cs | 2 +- .../API/Features/CustomRoles/RoleBehaviour.cs | 1 + Exiled.CustomModules/API/Features/Pawn.cs | 1 + 28 files changed, 37 insertions(+), 27 deletions(-) rename Exiled.API/Features/Core/{ => Behaviours}/EItemBehaviour.cs (96%) rename Exiled.API/Features/Core/{ => Behaviours}/EPickupBehaviour.cs (96%) rename Exiled.API/Features/Core/{ => Behaviours}/EPlayerBehaviour.cs (96%) rename Exiled.API/Features/Core/{ => Components}/TickComponent.cs (99%) diff --git a/Exiled.API/Features/Core/EItemBehaviour.cs b/Exiled.API/Features/Core/Behaviours/EItemBehaviour.cs similarity index 96% rename from Exiled.API/Features/Core/EItemBehaviour.cs rename to Exiled.API/Features/Core/Behaviours/EItemBehaviour.cs index 6264610a95..de1a1b4aa8 100644 --- a/Exiled.API/Features/Core/EItemBehaviour.cs +++ b/Exiled.API/Features/Core/Behaviours/EItemBehaviour.cs @@ -5,7 +5,7 @@ // // ----------------------------------------------------------------------- -namespace Exiled.API.Features.Core +namespace Exiled.API.Features.Core.Behaviours { using Exiled.API.Features.Core.Generic; using Exiled.API.Features.Items; diff --git a/Exiled.API/Features/Core/EPickupBehaviour.cs b/Exiled.API/Features/Core/Behaviours/EPickupBehaviour.cs similarity index 96% rename from Exiled.API/Features/Core/EPickupBehaviour.cs rename to Exiled.API/Features/Core/Behaviours/EPickupBehaviour.cs index a5583a15fc..7848f84aeb 100644 --- a/Exiled.API/Features/Core/EPickupBehaviour.cs +++ b/Exiled.API/Features/Core/Behaviours/EPickupBehaviour.cs @@ -5,7 +5,7 @@ // // ----------------------------------------------------------------------- -namespace Exiled.API.Features.Core +namespace Exiled.API.Features.Core.Behaviours { using Exiled.API.Features.Core.Generic; using Exiled.API.Features.Pickups; diff --git a/Exiled.API/Features/Core/EPlayerBehaviour.cs b/Exiled.API/Features/Core/Behaviours/EPlayerBehaviour.cs similarity index 96% rename from Exiled.API/Features/Core/EPlayerBehaviour.cs rename to Exiled.API/Features/Core/Behaviours/EPlayerBehaviour.cs index fa6d36bcaf..115e85d12e 100644 --- a/Exiled.API/Features/Core/EPlayerBehaviour.cs +++ b/Exiled.API/Features/Core/Behaviours/EPlayerBehaviour.cs @@ -5,7 +5,7 @@ // // ----------------------------------------------------------------------- -namespace Exiled.API.Features.Core +namespace Exiled.API.Features.Core.Behaviours { using Exiled.API.Features; using Exiled.API.Features.Core.Generic; diff --git a/Exiled.API/Features/Core/TickComponent.cs b/Exiled.API/Features/Core/Components/TickComponent.cs similarity index 99% rename from Exiled.API/Features/Core/TickComponent.cs rename to Exiled.API/Features/Core/Components/TickComponent.cs index 362ffd2e12..d84a1f3d83 100644 --- a/Exiled.API/Features/Core/TickComponent.cs +++ b/Exiled.API/Features/Core/Components/TickComponent.cs @@ -5,7 +5,7 @@ // // ----------------------------------------------------------------------- -namespace Exiled.API.Features.Core +namespace Exiled.API.Features.Core.Components { using System; using System.Collections.Generic; diff --git a/Exiled.API/Features/Core/EActor.cs b/Exiled.API/Features/Core/EActor.cs index 521a537098..df3e59cfa0 100644 --- a/Exiled.API/Features/Core/EActor.cs +++ b/Exiled.API/Features/Core/EActor.cs @@ -5,18 +5,20 @@ // // ----------------------------------------------------------------------- + namespace Exiled.API.Features.Core { using System; using System.Collections.Generic; using System.Linq; + using Exiled.API.Features.Core.Components; + using Exiled.API.Features.Core.Generic.Pools; using Exiled.API.Features.Core.Interfaces; using Exiled.API.Features.DynamicEvents; - using Exiled.API.Features.Core.Generic.Pools; using Exiled.API.Interfaces; - using MEC; + using MEC; using UnityEngine; /// diff --git a/Exiled.API/Features/Input/InputActionComponent.cs b/Exiled.API/Features/Input/InputActionComponent.cs index 787ad72996..60e8f2f980 100644 --- a/Exiled.API/Features/Input/InputActionComponent.cs +++ b/Exiled.API/Features/Input/InputActionComponent.cs @@ -14,6 +14,7 @@ namespace Exiled.API.Features.Input using Exiled.API.Enums; using Exiled.API.Features.Attributes; using Exiled.API.Features.Core; + using Exiled.API.Features.Core.Behaviours; using Exiled.API.Features.DynamicEvents; using Exiled.API.Features.Input.EventArgs; diff --git a/Exiled.CustomModules/API/Features/Attributes/CustomAbilityAttribute.cs b/Exiled.CustomModules/API/Features/Attributes/CustomAbilityAttribute.cs index aef71637e0..ebc15219d4 100644 --- a/Exiled.CustomModules/API/Features/Attributes/CustomAbilityAttribute.cs +++ b/Exiled.CustomModules/API/Features/Attributes/CustomAbilityAttribute.cs @@ -5,7 +5,7 @@ // // ----------------------------------------------------------------------- -namespace Exiled.CustomModules.API.Features +namespace Exiled.CustomModules.API.Features.Attributes { using System; diff --git a/Exiled.CustomModules/API/Features/Attributes/CustomEscapeAttribute.cs b/Exiled.CustomModules/API/Features/Attributes/CustomEscapeAttribute.cs index a1926b68b4..50ff23a9b9 100644 --- a/Exiled.CustomModules/API/Features/Attributes/CustomEscapeAttribute.cs +++ b/Exiled.CustomModules/API/Features/Attributes/CustomEscapeAttribute.cs @@ -5,7 +5,7 @@ // // ----------------------------------------------------------------------- -namespace Exiled.CustomModules.API.Features +namespace Exiled.CustomModules.API.Features.Attributes { using System; diff --git a/Exiled.CustomModules/API/Features/Attributes/CustomGameModeAttribute.cs b/Exiled.CustomModules/API/Features/Attributes/CustomGameModeAttribute.cs index f81556e02a..4486068be1 100644 --- a/Exiled.CustomModules/API/Features/Attributes/CustomGameModeAttribute.cs +++ b/Exiled.CustomModules/API/Features/Attributes/CustomGameModeAttribute.cs @@ -5,10 +5,12 @@ // // ----------------------------------------------------------------------- -namespace Exiled.CustomModules.API.Features +namespace Exiled.CustomModules.API.Features.Attributes { using System; + using Exiled.CustomModules.API.Features.CustomGameModes; + /// /// This attribute determines whether the class which is being applied to should be treated as . /// diff --git a/Exiled.CustomModules/API/Features/Attributes/CustomItemAttribute.cs b/Exiled.CustomModules/API/Features/Attributes/CustomItemAttribute.cs index eae3d80cd0..d8312f4f86 100644 --- a/Exiled.CustomModules/API/Features/Attributes/CustomItemAttribute.cs +++ b/Exiled.CustomModules/API/Features/Attributes/CustomItemAttribute.cs @@ -5,7 +5,7 @@ // // ----------------------------------------------------------------------- -namespace Exiled.CustomModules.API.Features +namespace Exiled.CustomModules.API.Features.Attributes { using System; diff --git a/Exiled.CustomModules/API/Features/Attributes/CustomRoleAttribute.cs b/Exiled.CustomModules/API/Features/Attributes/CustomRoleAttribute.cs index d6dfa91836..df9359813e 100644 --- a/Exiled.CustomModules/API/Features/Attributes/CustomRoleAttribute.cs +++ b/Exiled.CustomModules/API/Features/Attributes/CustomRoleAttribute.cs @@ -5,7 +5,7 @@ // // ----------------------------------------------------------------------- -namespace Exiled.CustomModules.API.Features +namespace Exiled.CustomModules.API.Features.Attributes { using System; diff --git a/Exiled.CustomModules/API/Features/Attributes/CustomTeamAttribute.cs b/Exiled.CustomModules/API/Features/Attributes/CustomTeamAttribute.cs index 68a2718cff..fec2ab236f 100644 --- a/Exiled.CustomModules/API/Features/Attributes/CustomTeamAttribute.cs +++ b/Exiled.CustomModules/API/Features/Attributes/CustomTeamAttribute.cs @@ -5,7 +5,7 @@ // // ----------------------------------------------------------------------- -namespace Exiled.CustomModules.API.Features +namespace Exiled.CustomModules.API.Features.Attributes { using System; diff --git a/Exiled.CustomModules/API/Features/CustomAbilities/CustomAbility.cs b/Exiled.CustomModules/API/Features/CustomAbilities/CustomAbility.cs index 3e1d42dd82..e5d43b551f 100644 --- a/Exiled.CustomModules/API/Features/CustomAbilities/CustomAbility.cs +++ b/Exiled.CustomModules/API/Features/CustomAbilities/CustomAbility.cs @@ -8,7 +8,6 @@ namespace Exiled.CustomModules.API.Features.CustomAbilities { using System; - using System.Collections.Generic; using System.Linq; using System.Reflection; @@ -19,11 +18,11 @@ namespace Exiled.CustomModules.API.Features.CustomAbilities using Exiled.API.Features.Core; using Exiled.API.Features.Core.Interfaces; using Exiled.API.Features.DynamicEvents; + using Exiled.CustomModules.API.Features.Attributes; using Exiled.CustomModules.API.Features.CustomAbilities.Settings; using Exiled.CustomModules.API.Features.CustomEscapes; using Exiled.CustomModules.Events.EventArgs.CustomAbilities; using HarmonyLib; - using Utils.NonAllocLINQ; /// diff --git a/Exiled.CustomModules/API/Features/CustomEscapes/CustomEscape.cs b/Exiled.CustomModules/API/Features/CustomEscapes/CustomEscape.cs index de8b594a9b..39c93a1483 100644 --- a/Exiled.CustomModules/API/Features/CustomEscapes/CustomEscape.cs +++ b/Exiled.CustomModules/API/Features/CustomEscapes/CustomEscape.cs @@ -8,7 +8,6 @@ namespace Exiled.CustomModules.API.Features.CustomEscapes { using System; - using System.Collections.Generic; using System.Linq; using System.Reflection; @@ -18,8 +17,8 @@ namespace Exiled.CustomModules.API.Features.CustomEscapes using Exiled.API.Features.Core; using Exiled.API.Features.Core.Interfaces; using Exiled.CustomModules.API.Enums; + using Exiled.CustomModules.API.Features.Attributes; using MonoMod.Utils; - using Utils.NonAllocLINQ; /// diff --git a/Exiled.CustomModules/API/Features/CustomEscapes/EscapeBehaviour.cs b/Exiled.CustomModules/API/Features/CustomEscapes/EscapeBehaviour.cs index 9ac86ffca3..fb1a93af35 100644 --- a/Exiled.CustomModules/API/Features/CustomEscapes/EscapeBehaviour.cs +++ b/Exiled.CustomModules/API/Features/CustomEscapes/EscapeBehaviour.cs @@ -13,6 +13,7 @@ namespace Exiled.CustomModules.API.Features.CustomEscapes using Exiled.API.Features; using Exiled.API.Features.Attributes; using Exiled.API.Features.Core; + using Exiled.API.Features.Core.Behaviours; using Exiled.API.Features.Core.Interfaces; using Exiled.API.Features.DynamicEvents; using Exiled.CustomModules.API.Enums; diff --git a/Exiled.CustomModules/API/Features/CustomGamemodes/CustomGameMode.cs b/Exiled.CustomModules/API/Features/CustomGamemodes/CustomGameMode.cs index 1580b459c0..3cbbcb80de 100644 --- a/Exiled.CustomModules/API/Features/CustomGamemodes/CustomGameMode.cs +++ b/Exiled.CustomModules/API/Features/CustomGamemodes/CustomGameMode.cs @@ -5,7 +5,7 @@ // // ----------------------------------------------------------------------- -namespace Exiled.CustomModules.API.Features +namespace Exiled.CustomModules.API.Features.CustomGameModes { using System; using System.Collections.Generic; @@ -16,6 +16,7 @@ namespace Exiled.CustomModules.API.Features using Exiled.API.Features; using Exiled.API.Features.Core; using Exiled.API.Features.Core.Interfaces; + using Exiled.CustomModules.API.Features.Attributes; /// /// Represents a custom game mode in the system, derived from and implementing . diff --git a/Exiled.CustomModules/API/Features/CustomGamemodes/GameModeSettings.cs b/Exiled.CustomModules/API/Features/CustomGamemodes/GameModeSettings.cs index 209994361f..fe2ce23d5c 100644 --- a/Exiled.CustomModules/API/Features/CustomGamemodes/GameModeSettings.cs +++ b/Exiled.CustomModules/API/Features/CustomGamemodes/GameModeSettings.cs @@ -5,7 +5,7 @@ // // ----------------------------------------------------------------------- -namespace Exiled.CustomModules.API.Features +namespace Exiled.CustomModules.API.Features.CustomGameModes { using Exiled.API.Features.Core; using Exiled.API.Features.Core.Interfaces; diff --git a/Exiled.CustomModules/API/Features/CustomGamemodes/GameState.cs b/Exiled.CustomModules/API/Features/CustomGamemodes/GameState.cs index 8fb8ddcc2e..ee57486060 100644 --- a/Exiled.CustomModules/API/Features/CustomGamemodes/GameState.cs +++ b/Exiled.CustomModules/API/Features/CustomGamemodes/GameState.cs @@ -5,7 +5,7 @@ // // ----------------------------------------------------------------------- -namespace Exiled.CustomModules.API.Features +namespace Exiled.CustomModules.API.Features.CustomGameModes { using System; using System.Collections.Generic; @@ -35,7 +35,7 @@ public abstract class GameState : EActor, IAdditiveSettings private Type cachedPlayerStateType; /// - /// Gets the relative . + /// Gets the relative . /// public CustomGameMode CustomGameMode { get; private set; } diff --git a/Exiled.CustomModules/API/Features/CustomGamemodes/PlayerState.cs b/Exiled.CustomModules/API/Features/CustomGamemodes/PlayerState.cs index 6b87a23d92..aaca3387f7 100644 --- a/Exiled.CustomModules/API/Features/CustomGamemodes/PlayerState.cs +++ b/Exiled.CustomModules/API/Features/CustomGamemodes/PlayerState.cs @@ -5,13 +5,14 @@ // // ----------------------------------------------------------------------- -namespace Exiled.CustomModules.API.Features +namespace Exiled.CustomModules.API.Features.CustomGameModes { using System; using System.Diagnostics; using Exiled.API.Features.Attributes; using Exiled.API.Features.Core; + using Exiled.API.Features.Core.Behaviours; using Exiled.API.Features.DynamicEvents; /// diff --git a/Exiled.CustomModules/API/Features/CustomGamemodes/World.cs b/Exiled.CustomModules/API/Features/CustomGamemodes/World.cs index 19945a9175..62ae02a180 100644 --- a/Exiled.CustomModules/API/Features/CustomGamemodes/World.cs +++ b/Exiled.CustomModules/API/Features/CustomGamemodes/World.cs @@ -5,7 +5,7 @@ // // ----------------------------------------------------------------------- -namespace Exiled.CustomModules.API.Features +namespace Exiled.CustomModules.API.Features.CustomGameModes { using Exiled.API.Features.Core.Generic; @@ -17,7 +17,7 @@ public class World : StaticActor private GameState gameState; /// - /// Gets the . + /// Gets the . /// public GameState GameState => gameState ??= GetComponent(); } diff --git a/Exiled.CustomModules/API/Features/CustomItems/CustomItem.cs b/Exiled.CustomModules/API/Features/CustomItems/CustomItem.cs index 807c81621c..929781c4e0 100644 --- a/Exiled.CustomModules/API/Features/CustomItems/CustomItem.cs +++ b/Exiled.CustomModules/API/Features/CustomItems/CustomItem.cs @@ -20,10 +20,10 @@ namespace Exiled.CustomModules.API.Features.CustomItems using Exiled.API.Features.Items; using Exiled.API.Features.Pickups; using Exiled.API.Features.Spawn; + using Exiled.CustomModules.API.Features.Attributes; using Exiled.CustomModules.API.Features.CustomEscapes; using Exiled.CustomModules.API.Features.CustomItems.Items; using MapGeneration.Distributors; - using UnityEngine; /// diff --git a/Exiled.CustomModules/API/Features/CustomItems/Items/Firearms/SemiAutomaticFirearmBehaviour.cs b/Exiled.CustomModules/API/Features/CustomItems/Items/Firearms/SemiAutomaticFirearmBehaviour.cs index a0a34a8f9e..9e425981a7 100644 --- a/Exiled.CustomModules/API/Features/CustomItems/Items/Firearms/SemiAutomaticFirearmBehaviour.cs +++ b/Exiled.CustomModules/API/Features/CustomItems/Items/Firearms/SemiAutomaticFirearmBehaviour.cs @@ -9,6 +9,7 @@ namespace Exiled.CustomModules.API.Features.CustomItems.Items.Firearms { using System.Collections.Generic; + using Exiled.API.Features.Core.Behaviours; using Exiled.API.Features.Core.Generic; using Exiled.API.Features.Items; using Exiled.CustomModules.API.Enums; diff --git a/Exiled.CustomModules/API/Features/CustomItems/Items/ItemBehaviour.cs b/Exiled.CustomModules/API/Features/CustomItems/Items/ItemBehaviour.cs index cc399dcb54..f97508312f 100644 --- a/Exiled.CustomModules/API/Features/CustomItems/Items/ItemBehaviour.cs +++ b/Exiled.CustomModules/API/Features/CustomItems/Items/ItemBehaviour.cs @@ -15,6 +15,7 @@ namespace Exiled.CustomModules.API.Features.CustomItems.Items using Exiled.API.Features; using Exiled.API.Features.Attributes; using Exiled.API.Features.Core; + using Exiled.API.Features.Core.Behaviours; using Exiled.API.Features.Core.Interfaces; using Exiled.API.Features.DynamicEvents; using Exiled.API.Features.Items; diff --git a/Exiled.CustomModules/API/Features/CustomItems/Pickups/PickupBehaviour.cs b/Exiled.CustomModules/API/Features/CustomItems/Pickups/PickupBehaviour.cs index c083a55e90..e65ce86d37 100644 --- a/Exiled.CustomModules/API/Features/CustomItems/Pickups/PickupBehaviour.cs +++ b/Exiled.CustomModules/API/Features/CustomItems/Pickups/PickupBehaviour.cs @@ -14,6 +14,7 @@ namespace Exiled.CustomModules.API.Features.CustomItems.Pickups using Exiled.API.Features; using Exiled.API.Features.Attributes; using Exiled.API.Features.Core; + using Exiled.API.Features.Core.Behaviours; using Exiled.API.Features.Core.Interfaces; using Exiled.API.Features.DynamicEvents; using Exiled.API.Features.Pickups; diff --git a/Exiled.CustomModules/API/Features/CustomRoles/CustomRole.cs b/Exiled.CustomModules/API/Features/CustomRoles/CustomRole.cs index f754df82e4..b528b082fe 100644 --- a/Exiled.CustomModules/API/Features/CustomRoles/CustomRole.cs +++ b/Exiled.CustomModules/API/Features/CustomRoles/CustomRole.cs @@ -17,10 +17,9 @@ namespace Exiled.CustomModules.API.Features.CustomRoles using Exiled.API.Features; using Exiled.API.Features.Core; using Exiled.API.Features.Core.Interfaces; + using Exiled.CustomModules.API.Features.Attributes; using Exiled.CustomModules.API.Features.CustomEscapes; - using MEC; - using PlayerRoles; using Respawning; diff --git a/Exiled.CustomModules/API/Features/CustomRoles/CustomTeam.cs b/Exiled.CustomModules/API/Features/CustomRoles/CustomTeam.cs index 4083ab04cb..228dc6b753 100644 --- a/Exiled.CustomModules/API/Features/CustomRoles/CustomTeam.cs +++ b/Exiled.CustomModules/API/Features/CustomRoles/CustomTeam.cs @@ -15,7 +15,7 @@ namespace Exiled.CustomModules.API.Features.CustomRoles using Exiled.API.Extensions; using Exiled.API.Features; using Exiled.API.Features.Core; - + using Exiled.CustomModules.API.Features.Attributes; using PlayerRoles; using Respawning; using Respawning.NamingRules; diff --git a/Exiled.CustomModules/API/Features/CustomRoles/RoleBehaviour.cs b/Exiled.CustomModules/API/Features/CustomRoles/RoleBehaviour.cs index 41baefc1ad..d575f9a2f2 100644 --- a/Exiled.CustomModules/API/Features/CustomRoles/RoleBehaviour.cs +++ b/Exiled.CustomModules/API/Features/CustomRoles/RoleBehaviour.cs @@ -17,6 +17,7 @@ namespace Exiled.CustomModules.API.Features.CustomRoles using Exiled.API.Extensions; using Exiled.API.Features; using Exiled.API.Features.Core; + using Exiled.API.Features.Core.Behaviours; using Exiled.API.Features.Core.Generic; using Exiled.API.Features.Core.Generic.Pools; using Exiled.API.Features.Core.Interfaces; diff --git a/Exiled.CustomModules/API/Features/Pawn.cs b/Exiled.CustomModules/API/Features/Pawn.cs index 8fd82193e2..f404870312 100644 --- a/Exiled.CustomModules/API/Features/Pawn.cs +++ b/Exiled.CustomModules/API/Features/Pawn.cs @@ -16,6 +16,7 @@ namespace Exiled.CustomModules.API.Features using Exiled.API.Features; using Exiled.API.Features.Attributes; using Exiled.API.Features.Core; + using Exiled.API.Features.Core.Behaviours; using Exiled.API.Features.Items; using Exiled.API.Features.Roles; using Exiled.CustomModules.API.Features.CustomAbilities; From abc6ee3202b87354b3c07bdc2245aa778aa0cceb Mon Sep 17 00:00:00 2001 From: Yamato Date: Fri, 26 Jan 2024 20:51:23 +0100 Subject: [PATCH 028/141] Fix NAO Build Error --- Exiled.API/Features/Core/EActor.cs | 1 - Exiled.API/Features/Core/Interfaces/IAdditiveSettings.cs | 2 ++ .../Features/Core/Interfaces/IAdditiveSettingsCollection.cs | 2 ++ Exiled.API/Features/Lift.cs | 2 +- Exiled.API/Features/Player.cs | 2 +- Exiled.API/Features/Scp914.cs | 2 +- 6 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Exiled.API/Features/Core/EActor.cs b/Exiled.API/Features/Core/EActor.cs index df3e59cfa0..8f76c999ef 100644 --- a/Exiled.API/Features/Core/EActor.cs +++ b/Exiled.API/Features/Core/EActor.cs @@ -5,7 +5,6 @@ // // ----------------------------------------------------------------------- - namespace Exiled.API.Features.Core { using System; diff --git a/Exiled.API/Features/Core/Interfaces/IAdditiveSettings.cs b/Exiled.API/Features/Core/Interfaces/IAdditiveSettings.cs index 6b8726ca65..6213484f39 100644 --- a/Exiled.API/Features/Core/Interfaces/IAdditiveSettings.cs +++ b/Exiled.API/Features/Core/Interfaces/IAdditiveSettings.cs @@ -7,6 +7,8 @@ namespace Exiled.API.Features.Core.Interfaces { + using Exiled.API.Features.Core.Behaviours; + /// /// Defines additive settings set up through user-defined properties. /// diff --git a/Exiled.API/Features/Core/Interfaces/IAdditiveSettingsCollection.cs b/Exiled.API/Features/Core/Interfaces/IAdditiveSettingsCollection.cs index 0f778f4bd9..28314c9089 100644 --- a/Exiled.API/Features/Core/Interfaces/IAdditiveSettingsCollection.cs +++ b/Exiled.API/Features/Core/Interfaces/IAdditiveSettingsCollection.cs @@ -9,6 +9,8 @@ namespace Exiled.API.Features.Core.Interfaces { using System.Collections.Generic; + using Exiled.API.Features.Core.Behaviours; + /// /// Defines a collection of additive settings set up through user-defined properties. /// diff --git a/Exiled.API/Features/Lift.cs b/Exiled.API/Features/Lift.cs index 0287c37536..e6eeb0e3bc 100644 --- a/Exiled.API/Features/Lift.cs +++ b/Exiled.API/Features/Lift.cs @@ -14,8 +14,8 @@ namespace Exiled.API.Features using Exiled.API.Enums; using Exiled.API.Extensions; using Exiled.API.Features.Core; - using Exiled.API.Features.Doors; using Exiled.API.Features.Core.Generic.Pools; + using Exiled.API.Features.Doors; using Exiled.API.Interfaces; using Interactables.Interobjects; using Interactables.Interobjects.DoorUtils; diff --git a/Exiled.API/Features/Player.cs b/Exiled.API/Features/Player.cs index 974bbbe7da..93eeec0f4d 100644 --- a/Exiled.API/Features/Player.cs +++ b/Exiled.API/Features/Player.cs @@ -18,11 +18,11 @@ namespace Exiled.API.Features using DamageHandlers; using Enums; using Exiled.API.Features.Attributes; + using Exiled.API.Features.Core.Generic.Pools; using Exiled.API.Features.Doors; using Exiled.API.Features.Hazards; using Exiled.API.Features.Items; using Exiled.API.Features.Pickups; - using Exiled.API.Features.Core.Generic.Pools; using Exiled.API.Features.Roles; using Exiled.API.Interfaces; using Exiled.API.Structs; diff --git a/Exiled.API/Features/Scp914.cs b/Exiled.API/Features/Scp914.cs index f9efc7e2b1..c344f397e3 100644 --- a/Exiled.API/Features/Scp914.cs +++ b/Exiled.API/Features/Scp914.cs @@ -10,9 +10,9 @@ namespace Exiled.API.Features using System.Collections.Generic; using System.Linq; + using Exiled.API.Features.Core.Generic.Pools; using Exiled.API.Features.Doors; using Exiled.API.Features.Pickups; - using Exiled.API.Features.Core.Generic.Pools; using global::Scp914; using UnityEngine; From 46192ac49ef2d60f874deb09745adb3d4f57cfe7 Mon Sep 17 00:00:00 2001 From: Naounderscore Date: Sat, 27 Jan 2024 03:55:15 +0100 Subject: [PATCH 029/141] Fixed `ChoosingStartTeamQueue` event docs. --- .../Server/ChoosingStartTeamQueueEventArgs.cs | 14 ++++++-------- Exiled.Events/Handlers/Server.cs | 4 ++-- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/Exiled.Events/EventArgs/Server/ChoosingStartTeamQueueEventArgs.cs b/Exiled.Events/EventArgs/Server/ChoosingStartTeamQueueEventArgs.cs index 41f1028732..f216315bc1 100644 --- a/Exiled.Events/EventArgs/Server/ChoosingStartTeamQueueEventArgs.cs +++ b/Exiled.Events/EventArgs/Server/ChoosingStartTeamQueueEventArgs.cs @@ -16,16 +16,14 @@ namespace Exiled.Events.EventArgs.Server using PlayerRoles; /// - /// Contains all information before a spectator changes the spectated player. + /// Contains all information choosing the team to be assigned to a player. /// public class ChoosingStartTeamQueueEventArgs : IDeniableEvent { /// /// Initializes a new instance of the class. /// - /// - /// - /// + /// public ChoosingStartTeamQueueEventArgs(string teamRespawnQueue) { TeamRespawnQueue = new(); @@ -38,19 +36,19 @@ public ChoosingStartTeamQueueEventArgs(string teamRespawnQueue) } /// - /// Gets the TeamRespawnQueue. + /// Gets the team respawn queue. /// public List TeamRespawnQueue { get; } /// - /// Gets or sets a value indicating whether the event can continue. + /// Gets or sets a value indicating whether the team can be assigned. /// public bool IsAllowed { get; set; } = true; /// - /// Gets the TeamRespawnQueue in a string value. + /// Gets the team respawn queue in a string value. /// - /// The actual modified TeamRespawnQueue. + /// The actual modified team respawn queue. internal string GetTeamRespawnQueue() { StringBuilder teamRespawnQueue = StringBuilderPool.Pool.Get(); diff --git a/Exiled.Events/Handlers/Server.cs b/Exiled.Events/Handlers/Server.cs index 6e71bf2672..36f122d858 100644 --- a/Exiled.Events/Handlers/Server.cs +++ b/Exiled.Events/Handlers/Server.cs @@ -68,7 +68,7 @@ public static class Server public static Event LocalReporting { get; set; } = new(); /// - /// Invoked before choosing the Team than player will get. + /// Invoked before choosing the team to be assigned to a player. /// public static Event ChoosingStartTeamQueue { get; set; } = new(); @@ -164,7 +164,7 @@ public static class Server public static void OnLocalReporting(LocalReportingEventArgs ev) => LocalReporting.InvokeSafely(ev); /// - /// Called before a 's custom display name is changed. + /// Called before choosing the team to be assigned to a player. /// /// The instance. public static void OnChoosingStartTeam(ChoosingStartTeamQueueEventArgs ev) => ChoosingStartTeamQueue.InvokeSafely(ev); From 123cfedb466e5f7b0405e7091fd7e39caca25851 Mon Sep 17 00:00:00 2001 From: Naounderscore Date: Sat, 27 Jan 2024 03:55:52 +0100 Subject: [PATCH 030/141] Added new Lock/Unlock methods to `Door` and `Lift`. --- Exiled.API/Features/Doors/Door.cs | 267 ++++++++++++++++++++++-------- Exiled.API/Features/Lift.cs | 187 +++++++++++++++++---- 2 files changed, 358 insertions(+), 96 deletions(-) diff --git a/Exiled.API/Features/Doors/Door.cs b/Exiled.API/Features/Doors/Door.cs index a82e5f2187..d298d7c76a 100644 --- a/Exiled.API/Features/Doors/Door.cs +++ b/Exiled.API/Features/Doors/Door.cs @@ -282,7 +282,7 @@ public Vector3 Scale /// /// Gets the door's . /// - public ZoneType Zone => Room?.Zone ?? ZoneType.Unspecified; + public ZoneType Zone => Room ? Room.Zone : ZoneType.Unspecified; /// /// Gets a containing all 's that are connected with . @@ -296,13 +296,11 @@ public Vector3 Scale /// A wrapper object. public static Door Get(DoorVariant doorVariant) { - if (doorVariant == null) + if (!doorVariant) return null; - if (doorVariant.Rooms == null) - { + if (doorVariant.Rooms is null) doorVariant.RegisterRooms(); - } // Exiled door must be created after the `RegisterRooms` call return DoorVariantToDoor[doorVariant]; @@ -327,10 +325,68 @@ public static Door Get(string name) public static Door Get(GameObject gameObject) => gameObject is null ? null : Get(gameObject.GetComponentInChildren()); /// - /// Gets a of filtered based on a predicate. + /// Gets a of containing all doors present in the specified . + /// + /// The zone from which looking for doors. + /// A of containing all doors present in the specified . + public static IEnumerable Get(ZoneType zoneType) => Get(door => door.Zone == zoneType); + + /// + /// Gets a of containing all doors present in the specified zones. + /// + /// The zones to retrieve the doors from. + /// A of containing all doors present in the specified zones. + public static IEnumerable Get(params ZoneType[] zoneTypes) => Get(door => zoneTypes.Contains(door.Zone)); + + /// + /// Gets a of containing all doors present in the specified zones. + /// + /// The zones to retrieve the doors from. + /// A of containing all doors present in the specified zones. + public static IEnumerable Get(IEnumerable zoneTypes) => Get(door => zoneTypes.Contains(door.Zone)); + + /// + /// Gets a of containing all doors present in the specified . + /// + /// The room to retrieve the doors from. + /// A of containing all doors present in the specified . + public static IEnumerable Get(Room room) => room.Doors; + + /// + /// Gets a of containing all doors present in the specified rooms. + /// + /// The rooms to retrieve the doors from. + /// A of containing all doors present in the specified rooms. + public static IEnumerable Get(params Room[] rooms) + { + HashSet result = new(); + + foreach (Room room in rooms) + result.AddRange(room.Doors); + + return result; + } + + /// + /// Gets a of containing all doors present in the specified rooms. + /// + /// The rooms to retrieve the doors from. + /// A of containing all doors present in the specified rooms. + public static IEnumerable Get(IEnumerable rooms) + { + HashSet result = new(); + + foreach (Room room in rooms) + result.AddRange(room.Doors); + + return result; + } + + /// + /// Gets a of filtered given a predicate. /// - /// The condition to satify. - /// A of which contains elements that satify the condition. + /// The condition to satisfy. + /// A of which contains elements that satisfy the condition. public static IEnumerable Get(Func predicate) => List.Where(predicate); /// @@ -338,7 +394,21 @@ public static Door Get(string name) /// /// The to search for. /// The with the given or if not found. - public static Door Get(DoorType doorType) => List.FirstOrDefault(x => x.Type == doorType); + public static Door Get(DoorType doorType) => List.FirstOrDefault(door => door.Type == doorType); + + /// + /// Gets a of containing all corresponding doors. + /// + /// The types to retrieve the doors from. + /// A of containing all corresponding doors. + public static IEnumerable Get(params DoorType[] types) => Get(door => types.Contains(door.Type)); + + /// + /// Gets a of containing all corresponding doors. + /// + /// The types to retrieve the doors from. + /// A of containing all corresponding doors. + public static IEnumerable Get(IEnumerable types) => Get(door => types.Contains(door.Type)); /// /// Returns the closest to the given . @@ -349,7 +419,6 @@ public static Door Get(string name) public static Door GetClosest(Vector3 position, out float distance) { Door doorToReturn = List.OrderBy(door => Vector3.Distance(position, door.Position)).FirstOrDefault(); - distance = Vector3.Distance(position, doorToReturn.Position); return doorToReturn; } @@ -362,78 +431,128 @@ public static Door GetClosest(Vector3 position, out float distance) /// object. public static Door Random(ZoneType type = ZoneType.Unspecified, bool onlyUnbroken = false) { - List doors = onlyUnbroken || type is not ZoneType.Unspecified ? Get(x => (x.Room is null || x.Room.Zone.HasFlag(type) || type == ZoneType.Unspecified) && (x is Breakable { IsDestroyed: true } || !onlyUnbroken)).ToList() : DoorVariantToDoor.Values.ToList(); + List doors = onlyUnbroken || type is not ZoneType.Unspecified ? Get(x => + (x.Room is null || x.Room.Zone.HasFlag(type) || type == ZoneType.Unspecified) && (x is Breakable { IsDestroyed: true } || !onlyUnbroken)). + ToList() : + DoorVariantToDoor.Values.ToList(); + return doors[UnityEngine.Random.Range(0, doors.Count)]; } /// - /// Locks all doors given the specified . + /// Permanently locks a corresponding to the given type. + /// + /// The door to affect. + /// The specified . + public static void Lock(DoorType type, DoorLockType lockType = DoorLockType.Regular079) => Get(type)?.Lock(lockType); + + /// + /// Temporary locks a corresponding to the given type. /// + /// The door to affect. /// The duration of the lockdown. - /// The to affect. /// The specified . - public static void LockAll(float duration, ZoneType zoneType = ZoneType.Unspecified, DoorLockType lockType = DoorLockType.Regular079) - { - foreach (Door door in Get(door => zoneType is not ZoneType.Unspecified && door.Zone.HasFlag(zoneType))) - { - door.IsOpen = false; - door.ChangeLock(lockType); - Timing.CallDelayed(duration, () => door.Unlock()); - } - } + public static void Lock(DoorType type, float duration, DoorLockType lockType = DoorLockType.Regular079) => Get(type)?.Lock(duration, lockType); /// - /// Locks all doors given the specified . + /// Unlocks a corresponding to the specified type. /// + /// The . + public static void Unlock(DoorType type) => Get(type)?.Unlock(); + + /// + /// Locks a doors corresponding to the given type. + /// + /// The door to affect. /// The duration of the lockdown. - /// The s to affect. /// The specified . - public static void LockAll(float duration, IEnumerable zoneTypes, DoorLockType lockType = DoorLockType.Regular079) - { - foreach (ZoneType zone in zoneTypes) - LockAll(duration, zone, lockType); - } + public static void LockAll(DoorType type, float duration, DoorLockType lockType = DoorLockType.Regular079) => Get(type)?.Lock(duration, lockType); + + /// + /// Permanently locks all doors in the facility. + /// + /// The specified . + public static void LockAll(DoorLockType lockType = DoorLockType.Regular079) => List.ForEach(door => door.Lock(lockType)); /// /// Locks all doors in the facility. /// /// The duration of the lockdown. /// The specified . - public static void LockAll(float duration, DoorLockType lockType = DoorLockType.Regular079) - { - foreach (Door door in List) - { - door.IsOpen = false; - door.ChangeLock(lockType); - Timing.CallDelayed(duration, () => door.Unlock()); - } - } + public static void LockAll(float duration, DoorLockType lockType = DoorLockType.Regular079) => List.ForEach(door => door.Lock(duration, lockType, true)); + + /// + /// Permanently locks all doors given the specified . + /// + /// The to affect. + /// The specified . + public static void LockAll(ZoneType type, DoorLockType lockType = DoorLockType.Regular079) => Get(type).ForEach(door => door.Lock(lockType, true)); + + /// + /// Permanently locks all doors given the specified zones. + /// + /// The zones to affect. + /// The specified . + public static void LockAll(IEnumerable types, DoorLockType lockType = DoorLockType.Regular079) => Get(types).ForEach(door => door.Lock(lockType, true)); + + /// + /// Temporary locks all doors given the specified . + /// + /// The to affect. + /// The duration of the lockdown. + /// The specified . + public static void LockAll(ZoneType type, float duration, DoorLockType lockType = DoorLockType.Regular079) => Get(type).ForEach(door => door.Lock(lockType, true)); + + /// + /// Temporary locks all doors given the specified zones. + /// + /// The zones to affect. + /// The duration of the lockdown. + /// The specified . + public static void LockAll(IEnumerable types, float duration, DoorLockType lockType = DoorLockType.Regular079) => types.ForEach(t => LockAll(t, duration, lockType)); + + /// + /// Permanently locks all doors corresponding to the given types. + /// + /// The doors to affect. + /// The specified . + public static void LockAll(IEnumerable types, DoorLockType lockType = DoorLockType.Regular079) => Get(types).ForEach(door => door.Lock(lockType, true)); + + /// + /// Temporary locks all doors corresponding to the given types. + /// + /// The doors to affect. + /// The duration of the lockdown. + /// The specified . + public static void LockAll(IEnumerable types, float duration, DoorLockType lockType = DoorLockType.Regular079) => types.ForEach(t => LockAll(t, duration, lockType)); /// /// Unlocks all doors in the facility. /// - public static void UnlockAll() - { - foreach (Door door in List) - door.Unlock(); - } + public static void UnlockAll() => List.ForEach(door => door.Unlock()); /// /// Unlocks all doors in the facility. /// - /// The to affect. - public static void UnlockAll(ZoneType zoneType) => UnlockAll(door => door.Zone.HasFlag(zoneType)); + /// The zones to affect. + public static void UnlockAll(ZoneType type) => UnlockAll(door => door.Zone.HasFlag(type)); /// /// Unlocks all doors in the facility. /// - /// The s to affect. - public static void UnlockAll(IEnumerable zoneTypes) => UnlockAll(door => zoneTypes.Contains(door.Zone)); + /// The zones to affect. + public static void UnlockAll(params ZoneType[] types) => UnlockAll(door => types.Contains(door.Zone)); /// /// Unlocks all doors in the facility. /// - /// The condition to satify. + /// The zones to affect. + public static void UnlockAll(IEnumerable types) => UnlockAll(door => types.Contains(door.Zone)); + + /// + /// Unlocks all doors in the facility. + /// + /// The condition to satisfy. public static void UnlockAll(Func predicate) { foreach (Door door in Get(predicate)) @@ -482,13 +601,27 @@ public void ChangeLock(DoorLockType lockType) } /// - /// Locks all active locks on the door, and then reverts back any changes after a specified length of time. + /// Permanently locks all active locks on the door, and then reverts back any changes after a specified length of time. /// - /// The amount of time that must pass before unlocking the door. /// The of the lockdown. - public void Lock(float time, DoorLockType lockType) + /// A value indicating whether the door should be closed. + public void Lock(DoorLockType lockType = DoorLockType.Regular079, bool shouldBeClosed = false) { + if (shouldBeClosed) + IsOpen = false; + ChangeLock(lockType); + } + + /// + /// Temporary locks all active locks on the door, and then reverts back any changes after a specified length of time. + /// + /// The amount of time that must pass before unlocking the door. + /// The of the lockdown. + /// A value indicating whether the door should be closed. + public void Lock(float time, DoorLockType lockType = DoorLockType.Regular079, bool shouldBeClosed = false) + { + Lock(lockType, shouldBeClosed); Unlock(time, lockType); } @@ -526,9 +659,7 @@ public void Lock(float time, DoorLockType lockType) internal static Door Create(DoorVariant doorVariant, List rooms) { if (doorVariant == null) - { return null; - } return doorVariant switch { @@ -549,35 +680,35 @@ private DoorType GetDoorType() string doorName = GameObject.name.GetBefore(' '); return doorName switch { - "LCZ" => Room?.Type switch + "LCZ" => Room switch { - RoomType.LczAirlock => (Base.GetComponentInParent() != null) ? DoorType.Airlock : DoorType.LightContainmentDoor, + { Type: RoomType.LczAirlock } => (Base.GetComponentInParent() != null) ? DoorType.Airlock : DoorType.LightContainmentDoor, _ => DoorType.LightContainmentDoor, }, "HCZ" => DoorType.HeavyContainmentDoor, "EZ" => DoorType.EntranceDoor, "Prison" => DoorType.PrisonDoor, "914" => DoorType.Scp914Door, - "Intercom" => Room?.Type switch + "Intercom" => Room switch { - RoomType.HczEzCheckpointA => DoorType.CheckpointArmoryA, - RoomType.HczEzCheckpointB => DoorType.CheckpointArmoryB, + { Type: RoomType.HczEzCheckpointA } => DoorType.CheckpointArmoryA, + { Type: RoomType.HczEzCheckpointB } => DoorType.CheckpointArmoryB, _ => DoorType.UnknownDoor, }, - "Unsecured" => Room?.Type switch + "Unsecured" => Room switch { - RoomType.EzCheckpointHallway => DoorType.CheckpointGate, - RoomType.Hcz049 => Position.y < -805 ? DoorType.Scp049Gate : DoorType.Scp173NewGate, + { Type: RoomType.EzCheckpointHallway } => DoorType.CheckpointGate, + { Type: RoomType.Hcz049 } => Position.y < -805 ? DoorType.Scp049Gate : DoorType.Scp173NewGate, _ => DoorType.UnknownGate, }, - "Elevator" => (Base as Interactables.Interobjects.ElevatorDoor)?.Group switch + "Elevator" => (Base as Interactables.Interobjects.ElevatorDoor) switch { - ElevatorGroup.Nuke => DoorType.ElevatorNuke, - ElevatorGroup.Scp049 => DoorType.ElevatorScp049, - ElevatorGroup.GateB => DoorType.ElevatorGateB, - ElevatorGroup.GateA => DoorType.ElevatorGateA, - ElevatorGroup.LczA01 or ElevatorGroup.LczA02 => DoorType.ElevatorLczA, - ElevatorGroup.LczB01 or ElevatorGroup.LczB02 => DoorType.ElevatorLczB, + { Group: ElevatorGroup.Nuke } => DoorType.ElevatorNuke, + { Group: ElevatorGroup.Scp049 } => DoorType.ElevatorScp049, + { Group: ElevatorGroup.GateB } => DoorType.ElevatorGateB, + { Group: ElevatorGroup.GateA } => DoorType.ElevatorGateA, + { Group: ElevatorGroup.LczA01 or ElevatorGroup.LczA02 } => DoorType.ElevatorLczA, + { Group: ElevatorGroup.LczB01 or ElevatorGroup.LczB02 } => DoorType.ElevatorLczB, _ => DoorType.UnknownElevator, }, _ => DoorType.UnknownDoor, diff --git a/Exiled.API/Features/Lift.cs b/Exiled.API/Features/Lift.cs index e6eeb0e3bc..91c70877ea 100644 --- a/Exiled.API/Features/Lift.cs +++ b/Exiled.API/Features/Lift.cs @@ -19,6 +19,7 @@ namespace Exiled.API.Features using Exiled.API.Interfaces; using Interactables.Interobjects; using Interactables.Interobjects.DoorUtils; + using MEC; using UnityEngine; using static Interactables.Interobjects.ElevatorChamber; @@ -69,11 +70,6 @@ internal Lift(ElevatorChamber elevator) /// object. public static Lift Random => List.Random(); - /// - /// Gets the base . - /// - public ElevatorChamber Base { get; } - /// /// Gets a value of the internal doors list. /// @@ -99,24 +95,6 @@ internal Lift(ElevatorChamber elevator) /// public Transform Transform => Base.transform; - /// - /// Gets or sets the lift's position. - /// - public Vector3 Position - { - get => Base.transform.position; - set => Base.transform.position = value; - } - - /// - /// Gets or sets the lift's rotation. - /// - public Quaternion Rotation - { - get => Base.transform.rotation; - set => Base.transform.rotation = value; - } - /// /// Gets or sets the lift's status. /// @@ -204,6 +182,29 @@ public float AnimationTime /// public Doors.ElevatorDoor CurrentDestination => Door.Get(Base.CurrentDestination).As(); + /// + /// Gets or sets the lift's position. + /// + public Vector3 Position + { + get => Base.transform.position; + set => Base.transform.position = value; + } + + /// + /// Gets or sets the lift's rotation. + /// + public Quaternion Rotation + { + get => Base.transform.rotation; + set => Base.transform.rotation = value; + } + + /// + /// Gets the base . + /// + public ElevatorChamber Base { get; } + /// /// Gets a of which contains all the instances from the specified . /// @@ -223,7 +224,21 @@ public float AnimationTime /// /// The . /// A or if not found. - public static Lift Get(ElevatorType type) => Get(lift => lift.Type == type).FirstOrDefault(); + public static Lift Get(ElevatorType type) => List.FirstOrDefault(lift => lift.Type == type); + + /// + /// Gets all lifts corresponding to the specified types, if any. + /// + /// The types. + /// All corresponding lifts. + public static IEnumerable Get(params ElevatorType[] types) => Get(lift => types.Contains(lift.Type)); + + /// + /// Gets all lifts corresponding to the specified types, if any. + /// + /// The types. + /// All corresponding lifts. + public static IEnumerable Get(IEnumerable types) => Get(lift => types.Contains(lift.Type)); /// /// Gets the corresponding to the specified name, if any. @@ -249,10 +264,94 @@ public float AnimationTime /// /// Gets a of filtered based on a predicate. /// - /// The condition to satify. - /// A of which contains elements that satify the condition. + /// The condition to satisfy. + /// A of which contains elements that satisfy the condition. public static IEnumerable Get(Func predicate) => List.Where(predicate); + /// + /// Permanently locks an elevator corresponding to the given type. + /// + /// The elevator to affect. + /// The specified . + public static void Lock(ElevatorType type, DoorLockReason lockReason = DoorLockReason.Isolation) => Get(type)?.Lock(lockReason); + + /// + /// Temporary locks an elevator corresponding to the given type. + /// + /// The elevator to affect. + /// The duration of the lockdown. + /// The specified . + public static void Lock(ElevatorType type, float duration, DoorLockReason lockReason = DoorLockReason.Isolation) => Get(type)?.Lock(duration, lockReason); + + /// + /// Unlocks a lift corresponding to the specified type. + /// + /// The . + public static void Unlock(ElevatorType type) => Get(type)?.Unlock(); + + /// + /// Permanently locks all elevators in the facility. + /// + /// The specified . + public static void LockAll(DoorLockReason lockReason = DoorLockReason.Isolation) => List.ForEach(lift => lift.Lock(lockReason)); + + /// + /// Temporary locks all elevators in the facility. + /// + /// The duration of the lockdown. + /// The specified . + public static void LockAll(float duration, DoorLockReason lockReason = DoorLockReason.Isolation) => List.ForEach(lift => lift.Lock(duration, lockReason)); + + /// + /// Permanently locks all elevators corresponding to the given types. + /// + /// The doors to affect. + /// The specified . + public static void LockAll(IEnumerable types, DoorLockReason lockReason = DoorLockReason.Isolation) => types.ForEach(t => Lock(t, lockReason)); + + /// + /// Temporary locks all elevators corresponding to the given types. + /// + /// The doors to affect. + /// The duration of the lockdown. + /// The specified . + public static void LockAll(IEnumerable types, float duration, DoorLockReason lockReason = DoorLockReason.Isolation) => types.ForEach(t => Lock(t, lockReason)); + + /// + /// Unlocks all lifts in the facility. + /// + public static void UnlockAll() => List.ForEach(lift => lift.Unlock()); + + /// + /// Unlocks all lifts in the facility. + /// + /// The zones to affect. + public static void UnlockAll(ZoneType type) => List.ForEach(lift => lift.Doors.Where(door => door.Zone == type).ForEach(door => door.Unlock())); + + /// + /// Unlocks all lifts in the facility. + /// + /// The zones to affect. + public static void UnlockAll(params ZoneType[] types) => List.ForEach(lift => lift.Doors.Where(door => types.Contains(door.Zone)).ForEach(door => door.Unlock())); + + /// + /// Unlocks all lifts in the facility. + /// + /// The zones to affect. + public static void UnlockAll(IEnumerable types) => List.ForEach(lift => lift.Doors.Where(door => types.Contains(door.Zone)).ForEach(door => door.Unlock())); + + /// + /// Unlocks all lifts in the facility. + /// + /// The types to affect. + public static void UnlockAll(params ElevatorType[] types) => Get(types).ForEach(lift => lift.Unlock()); + + /// + /// Unlocks all lifts in the facility. + /// + /// The types to affect. + public static void UnlockAll(IEnumerable types) => Get(types).ForEach(lift => lift.Unlock()); + /// /// Tries to melt a . /// @@ -277,10 +376,42 @@ public static bool TryMeltPlayer(Player player) /// if the lift was started successfully; otherwise, . public bool TryStart(int level, bool isForced = false) => TrySetDestination(Group, level, isForced); + /// + /// Locks the lift. + /// + /// The . + public void Lock(DoorLockReason lockReason = DoorLockReason.Isolation) + { + Status = ElevatorSequence.DoorClosing; + ChangeLock(lockReason); + } + + /// + /// Locks the lift. + /// + /// The duration of the lockdown. + /// The . + public void Lock(float duration, DoorLockReason lockReason = DoorLockReason.Isolation) + { + Status = ElevatorSequence.DoorClosing; + ChangeLock(lockReason); + } + + /// + /// Unlocks the lift. + /// + public void Unlock() => ChangeLock(DoorLockReason.None); + + /// + /// Unlocks the lift. + /// + /// The delay after which the lift should be unlocked. + public void Unlock(float delay) => Timing.CallDelayed(delay, () => ChangeLock(DoorLockReason.None)); + /// /// Changes lock of the lift. /// - /// Type of lift lockdown. + /// The . public void ChangeLock(DoorLockReason lockReason) { bool forceLock = lockReason != DoorLockReason.None; @@ -318,4 +449,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 From ddaa5b5b66df8855f2644444cd4e4edb40a5b5c5 Mon Sep 17 00:00:00 2001 From: Naounderscore Date: Sat, 27 Jan 2024 04:36:16 +0100 Subject: [PATCH 031/141] Removed `EndingRoundEventArgs::IsRoundEnded`. --- .../EventArgs/Server/EndingRoundEventArgs.cs | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/Exiled.Events/EventArgs/Server/EndingRoundEventArgs.cs b/Exiled.Events/EventArgs/Server/EndingRoundEventArgs.cs index 03e4a538e4..27bff4b441 100644 --- a/Exiled.Events/EventArgs/Server/EndingRoundEventArgs.cs +++ b/Exiled.Events/EventArgs/Server/EndingRoundEventArgs.cs @@ -34,7 +34,6 @@ public EndingRoundEventArgs(RoundSummary.LeadingTeam leadingTeam, RoundSummary.S { ClassList = classList; LeadingTeam = (LeadingTeam)leadingTeam; - IsRoundEnded = isAllowed; IsForceEnded = isForceEnded; } @@ -48,11 +47,6 @@ public EndingRoundEventArgs(RoundSummary.LeadingTeam leadingTeam, RoundSummary.S /// public LeadingTeam LeadingTeam { get; set; } - /// - /// Gets or sets a value indicating whether the round is going to finish or not. - /// - public bool IsRoundEnded { get; set; } // TODO: Obsolete this in Exiled 10 - /// /// Gets or Sets a value indicating whether the round is ended by API call. /// @@ -61,10 +55,6 @@ public EndingRoundEventArgs(RoundSummary.LeadingTeam leadingTeam, RoundSummary.S /// /// Gets or sets a value indicating whether the event can be executed or not. /// - public bool IsAllowed - { - get => IsRoundEnded; - set => IsRoundEnded = value; - } -} + public bool IsAllowed { get; set; } + } } \ No newline at end of file From 4ba7ca402a7cdab9751752342f8f2998d38f3048 Mon Sep 17 00:00:00 2001 From: Naounderscore Date: Sat, 27 Jan 2024 04:38:10 +0100 Subject: [PATCH 032/141] Fix some yaml typos --- Exiled.API/Features/Camera.cs | 10 +++++----- Exiled.API/Features/Core/EObject.cs | 14 +++++++------- Exiled.API/Features/TeslaGate.cs | 8 ++++---- Exiled.API/Features/Window.cs | 8 ++++---- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/Exiled.API/Features/Camera.cs b/Exiled.API/Features/Camera.cs index 1e04e75acf..89a7ca6964 100644 --- a/Exiled.API/Features/Camera.cs +++ b/Exiled.API/Features/Camera.cs @@ -188,7 +188,7 @@ internal Camera(Scp079Camera camera079) /// /// Gets the camera's . /// - public ZoneType Zone => Room?.Zone ?? ZoneType.Unspecified; + public ZoneType Zone => Room ? Room.Zone : ZoneType.Unspecified; /// /// Gets the camera's . @@ -261,8 +261,8 @@ public bool IsBeingUsed /// /// Gets a of filtered based on a predicate. /// - /// The condition to satify. - /// A of which contains elements that satify the condition. + /// The condition to satisfy. + /// A of which contains elements that satisfy the condition. public static IEnumerable Get(Func predicate) => List.Where(predicate); /// @@ -308,8 +308,8 @@ public bool IsBeingUsed /// /// Gets a of filtered based on a predicate. /// - /// The condition to satify. - /// A of which contains elements that satify the condition. + /// The condition to satisfy. + /// A of which contains elements that satisfy the condition. /// if is not , or if is . public static bool TryGet(Func predicate, out IEnumerable result) => (result = Get(predicate)).Any(); diff --git a/Exiled.API/Features/Core/EObject.cs b/Exiled.API/Features/Core/EObject.cs index 9508bef900..526809890e 100644 --- a/Exiled.API/Features/Core/EObject.cs +++ b/Exiled.API/Features/Core/EObject.cs @@ -518,7 +518,7 @@ public static void DestroyAllObjectsOfType() /// Finds the active instances of type filtered based on a predicate. /// /// The type to look for. - /// The condition to satify. + /// The condition to satisfy. /// The corresponding active . public static T FindActiveObjectOfType(Func predicate) where T : EObject @@ -536,7 +536,7 @@ public static T FindActiveObjectOfType(Func predicate) /// Finds all the active instances of type filtered based on a predicate. /// /// The type to look for. - /// The condition to satify. + /// The condition to satisfy. /// A [] containing all the matching results. public static T[] FindActiveObjectsOfType(Func predicate) where T : EObject @@ -612,7 +612,7 @@ public static T[] FindActiveObjectsOfType(Type type) /// /// The type to look for. /// The type. - /// The condition to satify. + /// The condition to satisfy. /// A [] containing all the matching results. public static T[] FindActiveObjectsOfType(Type type, Func predicate) where T : EObject @@ -652,8 +652,8 @@ public static T[] FindActiveObjectsWithTagOfType(string tag) /// Finds all the active instances of type . /// /// The type to look for. - /// The condition to satify. - /// A [] containing all the elements that satify the condition. + /// The condition to satisfy. + /// A [] containing all the elements that satisfy the condition. public static T[] FindActiveObjectsOfType(Func predicate) where T : EObject { @@ -671,8 +671,8 @@ public static T[] FindActiveObjectsOfType(Func predicate) /// Finds all the active instances of type . /// /// The type to look for. - /// The condition to satify. - /// A [] containing all the elements that satify the condition. + /// The condition to satisfy. + /// A [] containing all the elements that satisfy the condition. public static T[] FindActiveObjectsOfType(Func predicate) where T : EObject { diff --git a/Exiled.API/Features/TeslaGate.cs b/Exiled.API/Features/TeslaGate.cs index 20d234568f..222d9b6760 100644 --- a/Exiled.API/Features/TeslaGate.cs +++ b/Exiled.API/Features/TeslaGate.cs @@ -212,8 +212,8 @@ public static TeslaGate Get(BaseTeslaGate baseTeslaGate) => BaseTeslaGateToTesla /// /// Gets a of filtered based on a predicate. /// - /// The condition to satify. - /// A of which contains elements that satify the condition. + /// The condition to satisfy. + /// A of which contains elements that satisfy the condition. public static IEnumerable Get(Func predicate) => List.Where(predicate); /// @@ -231,8 +231,8 @@ public static bool TryGet(BaseTeslaGate baseTeslaGate, out TeslaGate gate) /// /// Try-get a of filtered based on a predicate. /// - /// The condition to satify. - /// A of which contains elements that satify the condition. + /// The condition to satisfy. + /// A of which contains elements that satisfy the condition. /// Whether or not at least one tesla gate was found. public static bool TryGet(Func predicate, out IEnumerable gates) { diff --git a/Exiled.API/Features/Window.cs b/Exiled.API/Features/Window.cs index 7ca533090e..e4ebdaa097 100644 --- a/Exiled.API/Features/Window.cs +++ b/Exiled.API/Features/Window.cs @@ -160,8 +160,8 @@ public static Window Get(BreakableWindow breakableWindow) => BreakableWindowToWi /// /// Gets a of filtered based on a predicate. /// - /// The condition to satify. - /// A of which contains elements that satify the condition. + /// The condition to satisfy. + /// A of which contains elements that satisfy the condition. public static IEnumerable Get(Func predicate) => List.Where(predicate); /// @@ -179,8 +179,8 @@ public static bool TryGet(BreakableWindow breakableWindow, out Window window) /// /// Try-get a of filtered based on a predicate. /// - /// The condition to satify. - /// A of which contains elements that satify the condition. + /// The condition to satisfy. + /// A of which contains elements that satisfy the condition. /// Whether or not at least one window was found. public static bool TryGet(Func predicate, out IEnumerable windows) { From e17e9a66aa1ee9ffa71d958ec52d6f4b583825fb Mon Sep 17 00:00:00 2001 From: Naounderscore Date: Sat, 27 Jan 2024 04:39:24 +0100 Subject: [PATCH 033/141] And more typos --- Exiled.API/Features/Generator.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Exiled.API/Features/Generator.cs b/Exiled.API/Features/Generator.cs index 60581d1740..d9fbc76fa8 100644 --- a/Exiled.API/Features/Generator.cs +++ b/Exiled.API/Features/Generator.cs @@ -239,8 +239,8 @@ public static IEnumerable Get(GeneratorState state) /// /// Gets a of filtered based on a predicate. /// - /// The condition to satify. - /// A of which contains elements that satify the condition. + /// The condition to satisfy. + /// A of which contains elements that satisfy the condition. public static IEnumerable Get(Func predicate) => List.Where(predicate); /// @@ -270,8 +270,8 @@ public static bool TryGet(GeneratorState state, out IEnumerable gener /// /// Try-get a of filtered based on a predicate. /// - /// The condition to satify. - /// A of which contains elements that satify the condition. + /// The condition to satisfy. + /// A of which contains elements that satisfy the condition. /// Whether or not at least one generator was found. public static bool TryGet(Func predicate, out IEnumerable generators) { From a9832fda08dac1649e8dfb691416dbe7b1c5192f Mon Sep 17 00:00:00 2001 From: Naounderscore Date: Sat, 27 Jan 2024 04:40:00 +0100 Subject: [PATCH 034/141] And yaml typos --- Exiled.API/Features/Room.cs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Exiled.API/Features/Room.cs b/Exiled.API/Features/Room.cs index b3b112b642..0a26b8d559 100644 --- a/Exiled.API/Features/Room.cs +++ b/Exiled.API/Features/Room.cs @@ -246,8 +246,8 @@ public static Room Get(RoomIdentifier roomIdentifier) => roomIdentifier == null /// /// Gets a of filtered based on a predicate. /// - /// The condition to satify. - /// A of which contains elements that satify the condition. + /// The condition to satisfy. + /// A of which contains elements that satisfy the condition. public static IEnumerable Get(Func predicate) => List.Where(predicate); /// @@ -334,8 +334,6 @@ public void TurnOffLights(float duration = -1) /// /// Duration in seconds, or -1 for permanent lockdown. /// DoorLockType of the lockdown. - /// - /// public void LockDown(float duration, DoorLockType lockType = DoorLockType.Regular079) { foreach (Door door in Doors) From ef39bf4e54734d96973a214d464cf68e43852715 Mon Sep 17 00:00:00 2001 From: Naounderscore Date: Sat, 27 Jan 2024 04:40:36 +0100 Subject: [PATCH 035/141] Added `Warhead::AutoDetonateTime` --- Exiled.API/Features/Warhead.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Exiled.API/Features/Warhead.cs b/Exiled.API/Features/Warhead.cs index 241d94c735..2438f223a7 100644 --- a/Exiled.API/Features/Warhead.cs +++ b/Exiled.API/Features/Warhead.cs @@ -51,6 +51,15 @@ public static bool AutoDetonate set => Controller._autoDetonate = value; } + /// + /// Gets or sets the auto detonation time. + /// + public static float AutoDetonateTime + { + get => Controller._autoDetonateTime; + set => Controller._autoDetonateTime = value; + } + /// /// Gets or sets a value indicating whether or not doors will be opened when the warhead activates. /// @@ -135,7 +144,7 @@ public static float DetonationTimer public static float RealDetonationTimer => Controller.CurScenario.TimeToDetonate; /// - /// Gets or sets a value indicating whether or not the warhead can be disabled. + /// Gets or sets a value indicating whether the warhead should be disabled. /// public static bool IsLocked { From 35ca525b65fe121002576f48381bed76c46f19e1 Mon Sep 17 00:00:00 2001 From: Naounderscore Date: Sat, 27 Jan 2024 04:41:18 +0100 Subject: [PATCH 036/141] Added some `GameModeSettings` values. --- .../CustomGamemodes/GameModeSettings.cs | 169 ++++++++++++++++++ 1 file changed, 169 insertions(+) diff --git a/Exiled.CustomModules/API/Features/CustomGamemodes/GameModeSettings.cs b/Exiled.CustomModules/API/Features/CustomGamemodes/GameModeSettings.cs index fe2ce23d5c..3ee846de45 100644 --- a/Exiled.CustomModules/API/Features/CustomGamemodes/GameModeSettings.cs +++ b/Exiled.CustomModules/API/Features/CustomGamemodes/GameModeSettings.cs @@ -7,13 +7,182 @@ namespace Exiled.CustomModules.API.Features.CustomGameModes { + using System; + + using Exiled.API.Enums; using Exiled.API.Features.Core; using Exiled.API.Features.Core.Interfaces; + using Exiled.CustomModules.API.Enums; + using PlayerRoles; + using Respawning; /// /// A tool to easily setup game modes. /// public class GameModeSettings : TypeCastObject, IAdditiveProperty { + /// + /// Gets or sets the minimum amount of players to start the game mode. + /// + public virtual uint MinimumPlayers { get; set; } + + /// + /// Gets or sets the maximum allowed amount of players managed by the game mode. + /// + public virtual uint MaximumPlayers { get; set; } + + /// + /// Gets or sets a value indicating whether the exceeding players should be rejected. + /// + public virtual bool RejectExceedingPlayers { get; set; } + + /// + /// Gets or sets the message to be displayed when a player is rejected due to exceeding amount of players. + /// + public virtual string RejectExceedingMessage { get; set; } + + /// + /// Gets or sets a value indicating whether the players can respawn. + /// + public virtual bool IsRespawnEnabled { get; set; } + + /// + /// Gets or sets the respawn time for individual players. + /// + public virtual float RespawnTime { get; set; } + + /// + /// Gets or sets a value indicating whether teams can regularly respawn. + /// + public virtual bool IsTeamRespawnEnabled { get; set; } + + /// + /// Gets or sets the respawn time for individual teams. + /// + public virtual int TeamRespawnTime { get; set; } + + /// + /// Gets or sets a value indicating whether custom ending conditions should be used over predefined conditions. + /// + public virtual bool UseCustomEndingConditions { get; set; } + + /// + /// Gets or sets a value indicating whether server should be restarted when the game mode ends. + /// + public virtual bool RestartRoundOnEnd { get; set; } + + /// + /// Gets or sets the amount of time to await before restarting the server. + /// + public virtual float RestartWindupTime { get; set; } + + /// + /// Gets or sets a [] containing all zones that should be permanently locked. + /// + public virtual ZoneType[] LockedZones { get; set; } + + /// + /// Gets or sets a [] containing all doors that should be permanently locked. + /// + public virtual DoorType[] LockedDoors { get; set; } + + /// + /// Gets or sets a [] containing all elevators that should be permanently locked. + /// + public virtual ElevatorType[] LockedElevators { get; set; } + + /// + /// Gets or sets a value indicating whether the decontamination should be enabled. + /// + public virtual bool IsDecontaminationEnabled { get; set; } + + /// + /// Gets or sets a value indicating whether the Alpha Warhead is enabled. + /// + public virtual bool IsWarheadEnabled { get; set; } + + /// + /// Gets or sets a value indicating whether the Alpha Warhead interactions are allowed. + /// + public virtual bool IsWarheadInteractable { get; set; } + + /// + /// Gets or sets the amount of time, expressed in seconds, after which the Alpha Warhead will be automatically started. + /// + /// must be set to . + /// + public virtual float AutoWarheadTime { get; set; } + + /// + /// Gets or sets a [] containing all spawnable roles. + /// + /// If not empty, all undefined roles won't be able to spawn. + ///
+ /// It's highly recommended to not use it along with . + ///
+ public virtual RoleTypeId[] SpawnableRoles { get; set; } + + /// + /// Gets or sets a [] containing all spawnable custom roles. + /// + /// If not empty, all undefined custom roles won't be able to spawn. + ///
+ /// It's highly recommended to not use it along with . + ///
+ public virtual UUCustomRoleType[] SpawnableCustomRoles { get; set; } + + /// + /// Gets or sets a [] containing all spawnable teams. + /// + /// If not empty, all undefined teams won't be able to spawn. + ///
+ /// It's highly recommended to not use it along with . + ///
+ public virtual SpawnableTeamType[] SpawnableTeams { get; set; } + + /// + /// Gets or sets a [] containing all spawnable custom teams. + /// + /// If not empty, all undefined custom teams won't be able to spawn. + ///
+ /// It's highly recommended to not use it along with . + ///
+ public virtual UUCustomTeamType[] SpawnableCustomTeams { get; set; } + + /// + /// Gets or sets a [] containing all non spawnable roles. + /// + /// If not empty, all undefined roles will be able to spawn. + ///
+ /// It's highly recommended to not use it along with . + ///
+ public virtual RoleTypeId[] NonSpawnableRoles { get; set; } + + /// + /// Gets or sets a [] containing all non spawnable custom roles. + /// + /// If not empty, all undefined custom roles will be able to spawn. + ///
+ /// It's highly recommended to not use it along with . + ///
+ public virtual UUCustomRoleType[] NonSpawnableCustomRoles { get; set; } + + /// + /// Gets or sets a [] containing all non spawnable custom teams. + /// + /// If not empty, all undefined teams will be able to spawn. + ///
+ /// It's highly recommended to not use it along with . + ///
+ public virtual SpawnableTeamType[] NonSpawnableTeams { get; set; } + + /// + /// Gets or sets a [] containing all non spawnable custom teams. + /// + /// If not empty, all undefined custom teams will be able to spawn. + ///
+ /// It's highly recommended to not use it along with . + ///
+ public virtual UUCustomTeamType[] NonSpawnableCustomTeams { get; set; } } } \ No newline at end of file From 4c36a7cd9db2619e2412371569d8ea95fc084a90 Mon Sep 17 00:00:00 2001 From: Naounderscore Date: Sat, 27 Jan 2024 04:48:22 +0100 Subject: [PATCH 037/141] `CustomGameModes` additions and improvements. --- .../API/Features/CustomGamemodes/GameState.cs | 98 +++++++++- .../Features/CustomGamemodes/PlayerState.cs | 168 +++++++++++++++++- .../API/Features/CustomGamemodes/World.cs | 19 ++ 3 files changed, 281 insertions(+), 4 deletions(-) diff --git a/Exiled.CustomModules/API/Features/CustomGamemodes/GameState.cs b/Exiled.CustomModules/API/Features/CustomGamemodes/GameState.cs index ee57486060..09b9e60123 100644 --- a/Exiled.CustomModules/API/Features/CustomGamemodes/GameState.cs +++ b/Exiled.CustomModules/API/Features/CustomGamemodes/GameState.cs @@ -12,11 +12,21 @@ namespace Exiled.CustomModules.API.Features.CustomGameModes using System.Linq; using System.Reflection; + using Exiled.API.Enums; using Exiled.API.Features; using Exiled.API.Features.Core; using Exiled.API.Features.Core.Interfaces; + using Exiled.API.Features.Doors; using Exiled.CustomModules.API.Enums; using Exiled.Events.EventArgs.Player; + using Exiled.Events.EventArgs.Server; + + using GameCore; + using Interactables.Interobjects.DoorUtils; + using LightContainmentZoneDecontamination; + using Respawning; + using UnityStandardAssets.CinematicEffects; + using Utils.Networking; /// /// Represents the state of the game on the server within the custom game mode, derived from and implementing . @@ -74,6 +84,11 @@ public abstract class GameState : EActor, IAdditiveSettings /// public bool CanBeEnded => EvaluateEndingConditions(); + /// + /// Gets the current player count. + /// + public int PlayerCount => playerStates.Count; + /// public virtual void AdjustAdditivePipe() { @@ -110,12 +125,29 @@ public virtual void AdjustAdditivePipe() /// /// Starts the . /// - public virtual void Start() + /// A value indicating whether the should be started regardless any conditions. + public virtual void Start(bool isForced = false) { + if (!isForced && PlayerCount < Settings.MinimumPlayers) + return; + foreach (PlayerState ps in PlayerStates) ps.Deploy(); } + /// + /// Ends the . + /// + /// A value indicating whether the should be ended regardless any conditions. + public virtual void End(bool isForced = false) + { + if (isForced || CanBeEnded) + { + foreach (PlayerState ps in PlayerStates) + ps.Destroy(); + } + } + /// /// Defines and evaluates the ending conditions. /// @@ -127,6 +159,18 @@ protected override void PostInitialize() { base.PostInitialize(); + RespawnManager.Singleton._started = Settings.IsTeamRespawnEnabled; + + if (Settings.TeamRespawnTime > 0f) + RespawnManager.Singleton.TimeTillRespawn = Settings.TeamRespawnTime; + + if (!Settings.IsDecontaminationEnabled) + DecontaminationController.Singleton.NetworkDecontaminationOverride = DecontaminationController.DecontaminationStatus.Disabled; + + Warhead.IsLocked = Settings.IsWarheadEnabled; + Warhead.AutoDetonate = Settings.AutoWarheadTime > 0f; + Warhead.AutoDetonateTime = Settings.AutoWarheadTime; + foreach (Player player in Player.List) { if (player.HasComponent(PlayerStateComponent, true)) @@ -136,11 +180,26 @@ protected override void PostInitialize() } } + /// + protected override void OnBeginPlay() + { + base.OnBeginPlay(); + + Door.LockAll(Settings.LockedZones); + Door.LockAll(Settings.LockedDoors); + Lift.LockAll(Settings.LockedElevators); + } + /// protected override void SubscribeEvents() { base.SubscribeEvents(); + Exiled.Events.Handlers.Server.EndingRound += OnEndingRound; + Exiled.Events.Handlers.Server.RespawningTeam += OnRespawningTeamInternal; + Exiled.Events.Handlers.Server.RespawnedTeam += OnRespawnedTeamInternal; + + Exiled.Events.Handlers.Player.PreAuthenticating += OnPreAuthenticatingInternal; Exiled.Events.Handlers.Player.Verified += OnVerifiedInternal; Exiled.Events.Handlers.Player.Destroying += OnDestroyingInternal; } @@ -150,16 +209,51 @@ protected override void UnsubscribeEvents() { base.UnsubscribeEvents(); + Exiled.Events.Handlers.Server.EndingRound -= OnEndingRound; + Exiled.Events.Handlers.Server.RespawningTeam -= OnRespawningTeamInternal; + Exiled.Events.Handlers.Server.RespawnedTeam -= OnRespawnedTeamInternal; + + Exiled.Events.Handlers.Player.PreAuthenticating -= OnPreAuthenticatingInternal; Exiled.Events.Handlers.Player.Verified -= OnVerifiedInternal; Exiled.Events.Handlers.Player.Destroying -= OnDestroyingInternal; } + private void OnEndingRound(EndingRoundEventArgs ev) + { + if (!Settings.UseCustomEndingConditions || !EvaluateEndingConditions()) + return; + + ev.IsAllowed = true; + } + + private void OnRespawningTeamInternal(RespawningTeamEventArgs ev) + { + ev.IsAllowed = (!Settings.SpawnableTeams.IsEmpty() && !Settings.SpawnableTeams.Contains(ev.NextKnownTeam)) || + (!Settings.NonSpawnableTeams.IsEmpty() && Settings.NonSpawnableTeams.Contains(ev.NextKnownTeam)); + } + + private void OnRespawnedTeamInternal(RespawnedTeamEventArgs ev) + { + RespawnManager.Singleton.TimeTillRespawn = Settings.TeamRespawnTime; + } + + private void OnPreAuthenticatingInternal(PreAuthenticatingEventArgs ev) + { + if (PlayerCount == Settings.MaximumPlayers && Settings.RejectExceedingPlayers) + ev.Reject(Settings.RejectExceedingMessage, true); + } + private void OnVerifiedInternal(VerifiedEventArgs ev) { if (ev.Player.HasComponent(PlayerStateComponent, true)) return; - ev.Player.AddComponent(PlayerStateComponent); + EActor component = EObject.CreateDefaultSubobject(PlayerStateComponent, ev.Player.GameObject).Cast(); + + if(PlayerCount == Settings.MaximumPlayers) + component.As().IsRespawnable = false; + + ev.Player.AddComponent(component); } private void OnDestroyingInternal(DestroyingEventArgs ev) diff --git a/Exiled.CustomModules/API/Features/CustomGamemodes/PlayerState.cs b/Exiled.CustomModules/API/Features/CustomGamemodes/PlayerState.cs index aaca3387f7..e502985dae 100644 --- a/Exiled.CustomModules/API/Features/CustomGamemodes/PlayerState.cs +++ b/Exiled.CustomModules/API/Features/CustomGamemodes/PlayerState.cs @@ -14,6 +14,12 @@ namespace Exiled.CustomModules.API.Features.CustomGameModes using Exiled.API.Features.Core; using Exiled.API.Features.Core.Behaviours; using Exiled.API.Features.DynamicEvents; + using Exiled.Events.EventArgs.Player; + using Exiled.Events.EventArgs.Warhead; + using MEC; + using PlayerRoles; + using UnityStandardAssets.CinematicEffects; + using Utf8Json.Resolvers.Internal; /// /// Represents the state of an individual player within the custom game mode, derived from . @@ -28,21 +34,112 @@ namespace Exiled.CustomModules.API.Features.CustomGameModes /// public abstract class PlayerState : EPlayerBehaviour { + private bool isActive; + private CoroutineHandle onReadyHandle; + /// /// Gets the which handles all delegates to be fired after the has been deployed. /// [DynamicEventDispatcher] public static TDynamicEventDispatcher DeployedDispatcher { get; private set; } + /// + /// Gets the which handles all delegates to be fired after the has been activated. + /// + [DynamicEventDispatcher] + public static TDynamicEventDispatcher ActivatedDispatcher { get; private set; } + + /// + /// Gets the which handles all delegates to be fired after the has been deactivated. + /// + [DynamicEventDispatcher] + public static TDynamicEventDispatcher DeactivatedDispatcher { get; private set; } + + /// + /// Gets or sets a value indicating whether the can behave regularly. + /// + public virtual bool IsActive + { + get => isActive; + set + { + if (value == isActive) + return; + + if (value) + { + isActive = value; + ActivatedDispatcher.InvokeAll(this); + return; + } + + isActive = false; + DeactivatedDispatcher.InvokeAll(this); + } + } + + /// + /// Gets or sets a value indicating whether the is respawnable. + /// + public virtual bool IsRespawnable { get; set; } + + /// + /// Gets the respawn time for individual players. + /// + public float RespawnTime => World.Get().GameState.Settings.RespawnTime; + /// /// Gets or sets the score. /// public int Score { get; protected set; } /// - /// Gets or sets a value indicating whether the is respawnable. + /// Gets or sets the last time the player died. + /// + public DateTime LastDeath { get; protected set; } + + /// + /// Gets a value indicating whether the player is ready to respawn. /// - public bool IsRespawnable { get; set; } + public virtual bool CanRespawn => DateTime.Now > LastDeath + TimeSpan.FromSeconds(RespawnTime); + + /// + /// Gets or sets the remaining respawn time. + /// + public virtual float RemainingRespawnTime + { + get => (float)Math.Max(0f, (LastDeath + TimeSpan.FromSeconds(RespawnTime) - DateTime.Now).TotalSeconds); + set => LastDeath = LastDeath.AddSeconds(value); + } + + /// + /// Forces the respawn procedure. + /// + /// The new value, representing the updated death timestamp. + public virtual DateTime ForceRespawn() + { + Respawn(); + LastDeath = DateTime.Now - TimeSpan.FromSeconds(RespawnTime + 1); + return LastDeath; + } + + /// + /// Resets the respawn procedure. + /// + /// The new value, representing the updated death timestamp. + public virtual DateTime ResetRespawn() + { + if (onReadyHandle.IsRunning) + Timing.KillCoroutines(onReadyHandle); + + onReadyHandle = Timing.CallDelayed((DateTime.Now + TimeSpan.FromSeconds(RespawnTime)).Second + 1, () => + { + if (CanRespawn) + Respawn(); + }); + + return LastDeath = DateTime.Now; + } /// /// Deploys the in game. @@ -83,6 +180,24 @@ protected override void OnEndPlay() World.Get().GameState.RemovePlayerState(this); } + /// + protected override void SubscribeEvents() + { + base.SubscribeEvents(); + + Exiled.Events.Handlers.Player.Died += OnDiedInternal; + Exiled.Events.Handlers.Player.InteractingElevator += OnInteractingElevatorInternal; + } + + /// + protected override void UnsubscribeEvents() + { + base.UnsubscribeEvents(); + + Exiled.Events.Handlers.Player.Died -= OnDiedInternal; + Exiled.Events.Handlers.Player.InteractingElevator -= OnInteractingElevatorInternal; + } + /// /// Fired after a has been deployed. /// @@ -91,6 +206,31 @@ protected override void OnEndPlay() protected virtual void OnDeployed() { DeployedDispatcher.InvokeAll(this); + + if (IsActive) + OnDeployed_Active(); + else + OnDeployed_Inactive(); + } + + /// + /// Fired after a has been deployed and is active. + /// + /// It defines the initial state of the . + /// + protected virtual void OnDeployed_Active() + { + IsRespawnable = World.Get().GameState.Settings.IsRespawnEnabled; + } + + /// + /// Fired after a has been deployed and is not active. + /// + /// It defines the initial state of the . + /// + protected virtual void OnDeployed_Inactive() + { + Owner.Role.Set(RoleTypeId.Spectator); } /// @@ -101,5 +241,29 @@ protected virtual void Respawn() if (!IsRespawnable) return; } + + private void OnDiedInternal(DiedEventArgs ev) + { + if (!Check(ev.Player) || !IsRespawnable) + return; + + ResetRespawn(); + } + + private void OnInteractingElevatorInternal(InteractingElevatorEventArgs ev) + { + if (!Check(ev.Player)) + return; + + ev.IsAllowed = !ev.Lift.IsLocked && !World.Get().GameState.Settings.LockedElevators.Contains(ev.Lift.Type); + } + + private void OnInteractingWarhead(ChangingLeverStatusEventArgs ev) + { + GameModeSettings settings = World.Get().GameState.Settings; + + if (!settings.IsWarheadEnabled || !settings.IsWarheadInteractable) + ev.IsAllowed = false; + } } } \ No newline at end of file diff --git a/Exiled.CustomModules/API/Features/CustomGamemodes/World.cs b/Exiled.CustomModules/API/Features/CustomGamemodes/World.cs index 62ae02a180..d4f52b9440 100644 --- a/Exiled.CustomModules/API/Features/CustomGamemodes/World.cs +++ b/Exiled.CustomModules/API/Features/CustomGamemodes/World.cs @@ -8,6 +8,11 @@ namespace Exiled.CustomModules.API.Features.CustomGameModes { using Exiled.API.Features.Core.Generic; + using Exiled.CustomModules.API.Enums; + using MEC; + using PluginAPI.Core; + + using Server = Exiled.API.Features.Server; /// /// The world base. @@ -20,5 +25,19 @@ public class World : StaticActor /// Gets the . /// public GameState GameState => gameState ??= GetComponent(); + + /// + protected override void Tick() + { + base.Tick(); + + if (GameState.MatchState != UEMatchState.Terminated) + return; + + if (GameState.Settings.RestartRoundOnEnd) + Timing.CallDelayed(GameState.Settings.RestartWindupTime, Server.Restart); + + CanEverTick = false; + } } } \ No newline at end of file From 77ab7e8f02c35af7ef866e0747a0ecdc608a81b7 Mon Sep 17 00:00:00 2001 From: Naounderscore Date: Sun, 28 Jan 2024 02:24:22 +0100 Subject: [PATCH 038/141] Added `PreAssigningHumanRoles`, `AssigningHumanRoles`, `DeployingHumanRole`, `PreAssigningScpRoles`, `AssigningScpRoles`, `DeployingScpRole` events. Added `Player::Get(IEnumerable)` overload to `Player::Get` method. --- Exiled.API/Features/Player.cs | 7 ++ .../Server/AssigningHumanRolesEventArgs.cs | 32 +++++++ .../Server/AssigningScpRolesEventArgs.cs | 51 ++++++++++ .../Server/DeployingHumanRoleEventArgs.cs | 80 ++++++++++++++++ .../Server/DeployingScpRoleEventArgs.cs | 94 +++++++++++++++++++ .../EventArgs/Server/EndingRoundEventArgs.cs | 16 +--- .../Server/PreAssigningHumanRolesEventArgs.cs | 42 +++++++++ .../Server/PreAssigningScpRolesEventArgs.cs | 32 +++++++ Exiled.Events/Handlers/Server.cs | 66 +++++++++++++ .../Patches/Events/Server/HumanSpawner.cs | 87 +++++++++++++++++ .../Patches/Events/Server/ScpSpawner.cs | 92 ++++++++++++++++++ 11 files changed, 587 insertions(+), 12 deletions(-) create mode 100644 Exiled.Events/EventArgs/Server/AssigningHumanRolesEventArgs.cs create mode 100644 Exiled.Events/EventArgs/Server/AssigningScpRolesEventArgs.cs create mode 100644 Exiled.Events/EventArgs/Server/DeployingHumanRoleEventArgs.cs create mode 100644 Exiled.Events/EventArgs/Server/DeployingScpRoleEventArgs.cs create mode 100644 Exiled.Events/EventArgs/Server/PreAssigningHumanRolesEventArgs.cs create mode 100644 Exiled.Events/EventArgs/Server/PreAssigningScpRolesEventArgs.cs create mode 100644 Exiled.Events/Patches/Events/Server/HumanSpawner.cs create mode 100644 Exiled.Events/Patches/Events/Server/ScpSpawner.cs diff --git a/Exiled.API/Features/Player.cs b/Exiled.API/Features/Player.cs index 93eeec0f4d..8b52105cca 100644 --- a/Exiled.API/Features/Player.cs +++ b/Exiled.API/Features/Player.cs @@ -1204,6 +1204,13 @@ public static Player Get(ReferenceHub referenceHub) } } + /// + /// Gets the all instances belonging to the given instances, if any. + /// + /// The reference hubs to retrieve the players from. + /// All instances belonging to the given instances. + public static IEnumerable Get(IEnumerable hubs) => hubs.Select(hub => Get(hub)); + /// /// Gets the belonging to the , if any. /// diff --git a/Exiled.Events/EventArgs/Server/AssigningHumanRolesEventArgs.cs b/Exiled.Events/EventArgs/Server/AssigningHumanRolesEventArgs.cs new file mode 100644 index 0000000000..dc61481a5f --- /dev/null +++ b/Exiled.Events/EventArgs/Server/AssigningHumanRolesEventArgs.cs @@ -0,0 +1,32 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Events.EventArgs.Server +{ + using API.Enums; + + using Interfaces; + + using PlayerRoles; + + /// + /// Contains all information before assigning human roles. + /// + public class AssigningHumanRolesEventArgs : IExiledEvent + { + /// + /// Initializes a new instance of the class. + /// + /// + public AssigningHumanRolesEventArgs(RoleTypeId[] roles) => Roles = roles; + + /// + /// Gets or sets all roles to be assigned. + /// + public RoleTypeId[] Roles { get; set; } + } +} \ No newline at end of file diff --git a/Exiled.Events/EventArgs/Server/AssigningScpRolesEventArgs.cs b/Exiled.Events/EventArgs/Server/AssigningScpRolesEventArgs.cs new file mode 100644 index 0000000000..7d9d6c0a06 --- /dev/null +++ b/Exiled.Events/EventArgs/Server/AssigningScpRolesEventArgs.cs @@ -0,0 +1,51 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Events.EventArgs.Server +{ + using System.Collections.Generic; + using System.Linq; + + using API.Enums; + using API.Features; + + using Interfaces; + + using PlayerRoles; + + /// + /// Contains all information before assigning SCP roles. + /// + public class AssigningScpRolesEventArgs : IExiledEvent + { + /// + /// Initializes a new instance of the class. + /// + /// + /// + public AssigningScpRolesEventArgs(List chosenPlayers, List enqueuedScps) + { + Players = Player.Get(chosenPlayers).ToList(); + Roles = enqueuedScps; + } + + /// + /// Gets or sets the players to be spawned. + /// + public List Players { get; set; } + + /// + /// Gets or sets all roles to be assigned. + /// + public List Roles { get; set; } + + /// + /// Gets all chosen player's reference hubs. + /// + internal List ChosenPlayers => Players.Select(player => player.ReferenceHub).ToList(); + } +} \ No newline at end of file diff --git a/Exiled.Events/EventArgs/Server/DeployingHumanRoleEventArgs.cs b/Exiled.Events/EventArgs/Server/DeployingHumanRoleEventArgs.cs new file mode 100644 index 0000000000..f2f12ece53 --- /dev/null +++ b/Exiled.Events/EventArgs/Server/DeployingHumanRoleEventArgs.cs @@ -0,0 +1,80 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Events.EventArgs.Server +{ + using System; + using System.Collections.Generic; + using System.Linq; + + using API.Enums; + using API.Features; + + using Interfaces; + + using PlayerRoles; + using PlayerRoles.RoleAssign; + + /// + /// Contains all information before deploying a human role. + /// + public class DeployingHumanRoleEventArgs : IExiledEvent + { + private RoleTypeId role; + private bool delegateHasChanged; + private Action @delegate; + + /// + /// Initializes a new instance of the class. + /// + /// + public DeployingHumanRoleEventArgs(RoleTypeId selectedRole) + { + Role = selectedRole; + @delegate = () => HumanSpawner.AssignHumanRoleToRandomPlayer(selectedRole); + OriginalDelegate = @delegate; + } + + /// + /// Gets or sets the to be fired to deploy the role. + /// + public Action Delegate + { + get => @delegate; + set + { + @delegate = value; + delegateHasChanged = true; + } + } + + /// + /// Gets the original to be fired to deploy the role. + /// + public Action OriginalDelegate { get; } + + /// + /// Gets or sets the role to be deployed. + /// + public RoleTypeId Role + { + get => role; + set + { + if (role == value) + return; + + role = value; + + if (delegateHasChanged) + return; + + @delegate = () => HumanSpawner.AssignHumanRoleToRandomPlayer(role); + } + } + } +} \ No newline at end of file diff --git a/Exiled.Events/EventArgs/Server/DeployingScpRoleEventArgs.cs b/Exiled.Events/EventArgs/Server/DeployingScpRoleEventArgs.cs new file mode 100644 index 0000000000..2452fedaf7 --- /dev/null +++ b/Exiled.Events/EventArgs/Server/DeployingScpRoleEventArgs.cs @@ -0,0 +1,94 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Events.EventArgs.Server +{ + using System; + using System.Collections.Generic; + using System.Linq; + + using API.Enums; + using API.Features; + + using Interfaces; + + using PlayerRoles; + using PlayerRoles.RoleAssign; + + /// + /// Contains all information before deploying a SCP role. + /// + public class DeployingScpRoleEventArgs : IExiledEvent + { + private RoleTypeId role; + private bool delegateHasChanged; + private Action @delegate; + + /// + /// Initializes a new instance of the class. + /// + /// The players from which retrieve the player to be spawned from. + /// + /// All enqueued SCPs. + public DeployingScpRoleEventArgs(List chosenPlayers, RoleTypeId selectedRole, List enqueuedScps) + { + ChosenPlayers = chosenPlayers; + Roles = enqueuedScps; + Role = role; + @delegate = () => ScpSpawner.AssignScp(chosenPlayers, selectedRole, enqueuedScps); + OriginalDelegate = @delegate; + } + + /// + /// Gets or sets the to be fired to deploy the role. + /// + public Action Delegate + { + get => @delegate; + set + { + @delegate = value; + delegateHasChanged = true; + } + } + + /// + /// Gets the original to be fired to deploy the role. + /// + public Action OriginalDelegate { get; } + + /// + /// Gets or sets the role to be deployed. + /// + public RoleTypeId Role + { + get => role; + set + { + if (role == value) + return; + + role = value; + + if (delegateHasChanged) + return; + + @delegate = () => ScpSpawner.AssignScp(ChosenPlayers, role, Roles); + } + } + + /// + /// Gets all roles to be assigned. + /// + public List Roles { get; } + + /// + /// Gets all chosen player's reference hubs. + /// + internal List ChosenPlayers { get; } + } +} \ No newline at end of file diff --git a/Exiled.Events/EventArgs/Server/EndingRoundEventArgs.cs b/Exiled.Events/EventArgs/Server/EndingRoundEventArgs.cs index 27bff4b441..3c6b117b31 100644 --- a/Exiled.Events/EventArgs/Server/EndingRoundEventArgs.cs +++ b/Exiled.Events/EventArgs/Server/EndingRoundEventArgs.cs @@ -18,18 +18,10 @@ public class EndingRoundEventArgs : IDeniableEvent /// /// Initializes a new instance of the class. /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// + /// + /// + /// + /// public EndingRoundEventArgs(RoundSummary.LeadingTeam leadingTeam, RoundSummary.SumInfo_ClassList classList, bool isAllowed, bool isForceEnded) { ClassList = classList; diff --git a/Exiled.Events/EventArgs/Server/PreAssigningHumanRolesEventArgs.cs b/Exiled.Events/EventArgs/Server/PreAssigningHumanRolesEventArgs.cs new file mode 100644 index 0000000000..a41e74a5f0 --- /dev/null +++ b/Exiled.Events/EventArgs/Server/PreAssigningHumanRolesEventArgs.cs @@ -0,0 +1,42 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Events.EventArgs.Server +{ + using API.Enums; + + using Interfaces; + + using PlayerRoles; + + /// + /// Contains all information before setting up the environment for the assignment of human roles. + /// + public class PreAssigningHumanRolesEventArgs : IExiledEvent + { + /// + /// Initializes a new instance of the class. + /// + /// + /// + public PreAssigningHumanRolesEventArgs(Team[] queue, int queueLength) + { + Queue = queue; + QueueLength = queueLength; + } + + /// + /// Gets or sets the human queue. + /// + public Team[] Queue { get; set; } + + /// + /// Gets or sets the human queue length. + /// + public int QueueLength { get; set; } + } +} \ No newline at end of file diff --git a/Exiled.Events/EventArgs/Server/PreAssigningScpRolesEventArgs.cs b/Exiled.Events/EventArgs/Server/PreAssigningScpRolesEventArgs.cs new file mode 100644 index 0000000000..7300affe18 --- /dev/null +++ b/Exiled.Events/EventArgs/Server/PreAssigningScpRolesEventArgs.cs @@ -0,0 +1,32 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Events.EventArgs.Server +{ + using API.Enums; + + using Interfaces; + + using PlayerRoles; + + /// + /// Contains all information before setting up the environment for the assignment of SCP roles. + /// + public class PreAssigningScpRolesEventArgs : IExiledEvent + { + /// + /// Initializes a new instance of the class. + /// + /// + public PreAssigningScpRolesEventArgs(int targetScpNumber) => Amount = targetScpNumber; + + /// + /// Gets or sets the amount of SCPs to be spawned. + /// + public int Amount { get; set; } + } +} \ No newline at end of file diff --git a/Exiled.Events/Handlers/Server.cs b/Exiled.Events/Handlers/Server.cs index 36f122d858..cf9d6e54da 100644 --- a/Exiled.Events/Handlers/Server.cs +++ b/Exiled.Events/Handlers/Server.cs @@ -112,6 +112,36 @@ public static class Server /// public static Event RespawnedTeam { get; set; } = new(); + /// + /// Invoked before setting up the environment for the assignment of human roles. + /// + public static Event PreAssigningHumanRoles { get; set; } = new(); + + /// + /// Invoked before setting up the environment for the assignment of SCP roles. + /// + public static Event PreAssigningScpRoles { get; set; } = new(); + + /// + /// Invoked before assigning human roles. + /// + public static Event AssigningHumanRoles { get; set; } = new(); + + /// + /// Invoked before assigning SCP roles. + /// + public static Event AssigningScpRoles { get; set; } = new(); + + /// + /// Invoked before deploying a SCP role. + /// + public static Event DeployingScpRole { get; set; } = new(); + + /// + /// Invoked before deploying a human role. + /// + public static Event DeployingHumanRole { get; set; } = new(); + /// /// Called before waiting for players. /// @@ -211,5 +241,41 @@ public static class Server /// /// public static void OnRespawnedTeam(SpawnableTeamType teamType, List hubs) => RespawnedTeam.InvokeSafely(new RespawnedTeamEventArgs(teamType, hubs)); + + /// + /// Called before setting up the environment for the assignment of human roles. + /// + /// The instance. + public static void OnPreAssigningHumanRoles(PreAssigningHumanRolesEventArgs ev) => PreAssigningHumanRoles.InvokeSafely(ev); + + /// + /// Called before setting up the environment for the assignment of SCP roles. + /// + /// The instance. + public static void OnPreAssigningScpRoles(PreAssigningScpRolesEventArgs ev) => PreAssigningScpRoles.InvokeSafely(ev); + + /// + /// Called before assigning human roles. + /// + /// The instance. + public static void OnAssigningHumanRoles(AssigningHumanRolesEventArgs ev) => AssigningHumanRoles.InvokeSafely(ev); + + /// + /// Called before assigning SCP roles. + /// + /// The instance. + public static void OnAssigningScpRoles(AssigningScpRolesEventArgs ev) => AssigningScpRoles.InvokeSafely(ev); + + /// + /// Called before deploying a SCP role. + /// + /// The instance. + public static void OnDeployingScpRole(DeployingScpRoleEventArgs ev) => DeployingScpRole.InvokeSafely(ev); + + /// + /// Called before deploying a human role. + /// + /// The instance. + public static void OnDeployingHumanRole(DeployingHumanRoleEventArgs ev) => DeployingHumanRole.InvokeSafely(ev); } } \ No newline at end of file diff --git a/Exiled.Events/Patches/Events/Server/HumanSpawner.cs b/Exiled.Events/Patches/Events/Server/HumanSpawner.cs new file mode 100644 index 0000000000..be4cde1902 --- /dev/null +++ b/Exiled.Events/Patches/Events/Server/HumanSpawner.cs @@ -0,0 +1,87 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled 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.Reflection.Emit; + + using Exiled.API.Features.Core.Generic.Pools; + using Exiled.Events.Attributes; + using Exiled.Events.EventArgs.Server; + using HarmonyLib; + using Respawning; + + using static HarmonyLib.AccessTools; + + /// + /// Patches to add + /// , and events. + /// + [EventPatch(typeof(Handlers.Server), nameof(Handlers.Server.PreAssigningHumanRoles))] + [EventPatch(typeof(Handlers.Server), nameof(Handlers.Server.AssigningHumanRoles))] + [HarmonyPatch(typeof(PlayerRoles.RoleAssign.HumanSpawner), nameof(PlayerRoles.RoleAssign.HumanSpawner.SpawnHumans))] + internal static class HumanSpawner + { + private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) + { + List newInstructions = ListPool.Pool.Get(instructions); + + LocalBuilder ev = generator.DeclareLocal(typeof(PreAssigningHumanRolesEventArgs)); + + int offset = 1; + int index = newInstructions.FindIndex(i => i.opcode == OpCodes.Stloc_1) + offset; + + newInstructions.InsertRange(0, new CodeInstruction[] + { + new(OpCodes.Ldarg_0), + new(OpCodes.Ldarg_1), + new(OpCodes.Newobj, GetDeclaredConstructors(typeof(PreAssigningHumanRolesEventArgs))[0]), + new(OpCodes.Dup), + new(OpCodes.Dup), + new(OpCodes.Call, Method(typeof(Handlers.Server), nameof(Handlers.Server.OnPreAssigningHumanRoles))), + new(OpCodes.Stloc_S, ev.LocalIndex), + new(OpCodes.Callvirt, PropertyGetter(typeof(PreAssigningHumanRolesEventArgs), nameof(PreAssigningHumanRolesEventArgs.Queue))), + new(OpCodes.Starg_S, 0), + new(OpCodes.Ldloc_S, ev.LocalIndex), + new(OpCodes.Callvirt, PropertyGetter(typeof(PreAssigningHumanRolesEventArgs), nameof(PreAssigningHumanRolesEventArgs.QueueLength))), + new(OpCodes.Starg_S, 0), + }); + + newInstructions.InsertRange(index, new CodeInstruction[] + { + new(OpCodes.Ldloc_1), + new(OpCodes.Newobj, GetDeclaredConstructors(typeof(AssigningHumanRolesEventArgs))[0]), + new(OpCodes.Dup), + new(OpCodes.Call, Method(typeof(Handlers.Server), nameof(Handlers.Server.OnAssigningHumanRoles))), + new(OpCodes.Callvirt, PropertyGetter(typeof(AssigningHumanRolesEventArgs), nameof(AssigningHumanRolesEventArgs.Roles))), + new(OpCodes.Stloc_1), + }); + + index = newInstructions.FindLastIndex(i => i.opcode == OpCodes.Call); + newInstructions.RemoveAt(index); + + offset = 1; + index = newInstructions.FindLastIndex(i => i.opcode == OpCodes.Ldelem_I1) + offset; + + newInstructions.InsertRange(index, new CodeInstruction[] + { + new(OpCodes.Newobj, GetDeclaredConstructors(typeof(DeployingHumanRoleEventArgs))[0]), + new(OpCodes.Dup), + new(OpCodes.Call, Method(typeof(Handlers.Server), nameof(Handlers.Server.OnDeployingHumanRole))), + new(OpCodes.Callvirt, PropertyGetter(typeof(DeployingHumanRoleEventArgs), nameof(DeployingHumanRoleEventArgs.Delegate))), + new(OpCodes.Callvirt, Method(typeof(Action), nameof(Action.Invoke))), + }); + + for (int z = 0; z < newInstructions.Count; z++) + yield return newInstructions[z]; + + ListPool.Pool.Return(newInstructions); + } + } +} \ No newline at end of file diff --git a/Exiled.Events/Patches/Events/Server/ScpSpawner.cs b/Exiled.Events/Patches/Events/Server/ScpSpawner.cs new file mode 100644 index 0000000000..5212804a57 --- /dev/null +++ b/Exiled.Events/Patches/Events/Server/ScpSpawner.cs @@ -0,0 +1,92 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled 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.Reflection.Emit; + + using Exiled.API.Features.Core.Generic.Pools; + using Exiled.Events.Attributes; + using Exiled.Events.EventArgs.Server; + + using HarmonyLib; + + using Respawning; + + using static HarmonyLib.AccessTools; + + /// + /// Patches to add + /// , and events. + /// + [EventPatch(typeof(Handlers.Server), nameof(Handlers.Server.PreAssigningScpRoles))] + [EventPatch(typeof(Handlers.Server), nameof(Handlers.Server.AssigningScpRoles))] + [EventPatch(typeof(Handlers.Server), nameof(Handlers.Server.DeployingScpRole))] + [HarmonyPatch(typeof(PlayerRoles.RoleAssign.ScpSpawner), nameof(PlayerRoles.RoleAssign.ScpSpawner.SpawnScps))] + internal static class ScpSpawner + { + private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) + { + List newInstructions = ListPool.Pool.Get(instructions); + + LocalBuilder ev = generator.DeclareLocal(typeof(AssigningScpRolesEventArgs)); + + int offset = 1; + int index = newInstructions.FindIndex(i => i.opcode == OpCodes.Stloc_0) + offset; + + newInstructions.InsertRange(0, new CodeInstruction[] + { + new(OpCodes.Ldarg_0), + new(OpCodes.Newobj, GetDeclaredConstructors(typeof(PreAssigningScpRolesEventArgs))[0]), + new(OpCodes.Dup), + new(OpCodes.Call, Method(typeof(Handlers.Server), nameof(Handlers.Server.OnPreAssigningScpRoles))), + new(OpCodes.Callvirt, PropertyGetter(typeof(PreAssigningScpRolesEventArgs), nameof(PreAssigningScpRolesEventArgs.Amount))), + new(OpCodes.Starg_S, 0), + }); + + newInstructions.InsertRange(index, new CodeInstruction[] + { + new(OpCodes.Ldloc_0), + new(OpCodes.Ldsfld, Field(typeof(PlayerRoles.RoleAssign.ScpSpawner), nameof(PlayerRoles.RoleAssign.ScpSpawner.EnqueuedScps))), + new(OpCodes.Newobj, GetDeclaredConstructors(typeof(AssigningScpRolesEventArgs))[0]), + new(OpCodes.Dup), + new(OpCodes.Dup), + new(OpCodes.Call, Method(typeof(Handlers.Server), nameof(Handlers.Server.OnAssigningScpRoles))), + new(OpCodes.Stloc_S, ev.LocalIndex), + new(OpCodes.Callvirt, PropertyGetter(typeof(AssigningScpRolesEventArgs), nameof(AssigningScpRolesEventArgs.ChosenPlayers))), + new(OpCodes.Stloc_0), + new(OpCodes.Ldloc_S, ev.LocalIndex), + new(OpCodes.Callvirt, PropertyGetter(typeof(AssigningScpRolesEventArgs), nameof(AssigningScpRolesEventArgs.Roles))), + new(OpCodes.Stsfld, Field(typeof(PlayerRoles.RoleAssign.ScpSpawner), nameof(PlayerRoles.RoleAssign.ScpSpawner.EnqueuedScps))), + }); + + index = newInstructions.FindLastIndex(i => i.opcode == OpCodes.Ldloc_0); + newInstructions.RemoveRange(index, 4); + + index = newInstructions.FindLastIndex(i => i.opcode == OpCodes.Ldsfld); + + newInstructions.InsertRange(index, new CodeInstruction[] + { + new(OpCodes.Ldloc_0), + new(OpCodes.Ldloc_2), + new(OpCodes.Ldsfld, Field(typeof(PlayerRoles.RoleAssign.ScpSpawner), nameof(PlayerRoles.RoleAssign.ScpSpawner.EnqueuedScps))), + new(OpCodes.Newobj, GetDeclaredConstructors(typeof(DeployingScpRoleEventArgs))[0]), + new(OpCodes.Dup), + new(OpCodes.Call, Method(typeof(Handlers.Server), nameof(Handlers.Server.OnDeployingScpRole))), + new(OpCodes.Callvirt, PropertyGetter(typeof(DeployingScpRoleEventArgs), nameof(DeployingScpRoleEventArgs.Delegate))), + new(OpCodes.Callvirt, Method(typeof(Action), nameof(Action.Invoke))), + }); + + for (int z = 0; z < newInstructions.Count; z++) + yield return newInstructions[z]; + + ListPool.Pool.Return(newInstructions); + } + } +} \ No newline at end of file From 5ed957fa26c24857c3ddd627f71e90252d729365 Mon Sep 17 00:00:00 2001 From: Naounderscore Date: Sun, 28 Jan 2024 02:28:32 +0100 Subject: [PATCH 039/141] typo --- Exiled.Events/EventArgs/Server/EndingRoundEventArgs.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Exiled.Events/EventArgs/Server/EndingRoundEventArgs.cs b/Exiled.Events/EventArgs/Server/EndingRoundEventArgs.cs index 3c6b117b31..e0937dd8ae 100644 --- a/Exiled.Events/EventArgs/Server/EndingRoundEventArgs.cs +++ b/Exiled.Events/EventArgs/Server/EndingRoundEventArgs.cs @@ -40,7 +40,7 @@ public EndingRoundEventArgs(RoundSummary.LeadingTeam leadingTeam, RoundSummary.S public LeadingTeam LeadingTeam { get; set; } /// - /// Gets or Sets a value indicating whether the round is ended by API call. + /// Gets or sets a value indicating whether the round is ended by API call. /// public bool IsForceEnded { get; set; } From ffd6a43dfddf483c8334b8936ef0cc9adb797696 Mon Sep 17 00:00:00 2001 From: Naounderscore Date: Sun, 28 Jan 2024 21:44:00 +0100 Subject: [PATCH 040/141] Refactor damage handlers to support multiple damage types, add handling for previously unhandled damage types, fix any potential bugs, and improve overall cleanliness and efficiency. --- Exiled.API/Features/Cassie.cs | 20 +- .../DamageHandlers/AttackerDamageHandler.cs | 19 +- .../DamageHandlers/CustomDamageHandler.cs | 72 ++++-- .../Features/DamageHandlers/DamageHandler.cs | 24 +- .../DamageHandlers/DamageHandlerBase.cs | 137 ++++-------- .../DamageHandlers/FirearmDamageHandler.cs | 21 +- .../DamageHandlers/GenericDamageHandler.cs | 210 ++++++++---------- .../DamageHandlers/ScpDamageHandler.cs | 17 +- Exiled.API/Features/Pickups/Scp244Pickup.cs | 4 +- Exiled.API/Features/Player.cs | 6 + .../Map/AnnouncingScpTerminationEventArgs.cs | 2 +- .../EventArgs/Player/DiedEventArgs.cs | 2 +- .../EventArgs/Player/DyingEventArgs.cs | 13 +- .../EventArgs/Player/HurtEventArgs.cs | 2 +- .../EventArgs/Player/HurtingEventArgs.cs | 2 +- 15 files changed, 245 insertions(+), 306 deletions(-) diff --git a/Exiled.API/Features/Cassie.cs b/Exiled.API/Features/Cassie.cs index 06d8481c2f..b9de21e545 100644 --- a/Exiled.API/Features/Cassie.cs +++ b/Exiled.API/Features/Cassie.cs @@ -147,18 +147,14 @@ public static void ScpTermination(Player scp, DamageHandlerBase info) public static void CustomScpTermination(string scpName, CustomHandlerBase info) { string result = scpName; - if (info.Is(out MicroHidDamageHandler _)) - result += " SUCCESSFULLY TERMINATED BY AUTOMATIC SECURITY SYSTEM"; - else if (info.Is(out WarheadDamageHandler _)) - result += " SUCCESSFULLY TERMINATED BY ALPHA WARHEAD"; - else if (info.Is(out UniversalDamageHandler _)) - result += " LOST IN DECONTAMINATION SEQUENCE"; - else if (info.BaseIs(out CustomFirearmHandler firearmDamageHandler) && firearmDamageHandler.Attacker is Player attacker) - result += " CONTAINEDSUCCESSFULLY " + ConvertTeam(attacker.Role.Team, attacker.UnitName); - - // result += "To be changed"; - else - result += " SUCCESSFULLY TERMINATED . TERMINATION CAUSE UNSPECIFIED"; + result += info.Base switch + { + MicroHidDamageHandler => " SUCCESSFULLY TERMINATED BY AUTOMATIC SECURITY SYSTEM", + WarheadDamageHandler => " SUCCESSFULLY TERMINATED BY ALPHA WARHEAD", + UniversalDamageHandler => " LOST IN DECONTAMINATION SEQUENCE", + _ => info.Is(out CustomFirearmHandler firearmDamageHandler) && firearmDamageHandler.Attacker is Player attacker ? + " CONTAINEDSUCCESSFULLY " + ConvertTeam(attacker.Role.Team, attacker.UnitName) : " SUCCESSFULLY TERMINATED . TERMINATION CAUSE UNSPECIFIED" + }; float num = AlphaWarheadController.TimeUntilDetonation <= 0f ? 3.5f : 1f; GlitchyMessage(result, UnityEngine.Random.Range(0.1f, 0.14f) * num, UnityEngine.Random.Range(0.07f, 0.08f) * num); diff --git a/Exiled.API/Features/DamageHandlers/AttackerDamageHandler.cs b/Exiled.API/Features/DamageHandlers/AttackerDamageHandler.cs index 0750c9d5be..83ec78ebff 100644 --- a/Exiled.API/Features/DamageHandlers/AttackerDamageHandler.cs +++ b/Exiled.API/Features/DamageHandlers/AttackerDamageHandler.cs @@ -41,10 +41,10 @@ protected AttackerDamageHandler(Player target, BaseHandler baseHandler) /// public bool ForceFullFriendlyFire { - get => Is(out PlayerStatsSystem.AttackerDamageHandler handler) && handler.ForceFullFriendlyFire; + get => Base is PlayerStatsSystem.AttackerDamageHandler handler && handler.ForceFullFriendlyFire; set { - if (Is(out PlayerStatsSystem.AttackerDamageHandler handler)) + if (Base is PlayerStatsSystem.AttackerDamageHandler handler) handler.ForceFullFriendlyFire = value; } } @@ -54,10 +54,10 @@ public bool ForceFullFriendlyFire /// public bool IsSuicide { - get => Is(out PlayerStatsSystem.AttackerDamageHandler handler) && handler.IsSuicide; + get => Base is PlayerStatsSystem.AttackerDamageHandler handler && handler.IsSuicide; set { - if (Is(out PlayerStatsSystem.AttackerDamageHandler handler)) + if (Base is PlayerStatsSystem.AttackerDamageHandler handler) handler.IsSuicide = value; } } @@ -65,17 +65,17 @@ public bool IsSuicide /// /// Gets a value indicating whether the self damage is allowed. /// - public bool AllowSelfDamage => Is(out PlayerStatsSystem.AttackerDamageHandler handler) && handler.AllowSelfDamage; + public bool AllowSelfDamage => Base is PlayerStatsSystem.AttackerDamageHandler handler && handler.AllowSelfDamage; /// /// Gets or sets a value indicating whether the damage is friendly fire. /// public bool IsFriendlyFire { - get => Is(out PlayerStatsSystem.AttackerDamageHandler handler) && handler.IsFriendlyFire; + get => Base is PlayerStatsSystem.AttackerDamageHandler handler && handler.IsFriendlyFire; set { - if (Is(out PlayerStatsSystem.AttackerDamageHandler handler)) + if (Base is PlayerStatsSystem.AttackerDamageHandler handler) handler.IsFriendlyFire = value; } } @@ -86,12 +86,11 @@ public bool IsFriendlyFire /// The to damage. public override void ProcessDamage(Player player) { - if (!Is(out PlayerStatsSystem.AttackerDamageHandler _)) + if (Base is not PlayerStatsSystem.AttackerDamageHandler) return; if ((player.IsSpawnProtected && (player != Attacker)) || - (!SpawnProtected.PreventAllDamage && - Attacker is not null && Attacker.IsSpawnProtected)) + (!SpawnProtected.PreventAllDamage && Attacker is not null && Attacker.IsSpawnProtected)) { Damage = 0f; return; diff --git a/Exiled.API/Features/DamageHandlers/CustomDamageHandler.cs b/Exiled.API/Features/DamageHandlers/CustomDamageHandler.cs index 47aa8f4f13..42533031f0 100644 --- a/Exiled.API/Features/DamageHandlers/CustomDamageHandler.cs +++ b/Exiled.API/Features/DamageHandlers/CustomDamageHandler.cs @@ -7,16 +7,13 @@ namespace Exiled.API.Features.DamageHandlers { - using CustomPlayerEffects; + using System.Collections.Generic; + using CustomPlayerEffects; using Enums; - using Exiled.API.Extensions; - using Items; - using PlayerStatsSystem; - using UnityEngine; using BaseFirearmHandler = PlayerStatsSystem.FirearmDamageHandler; @@ -28,6 +25,22 @@ namespace Exiled.API.Features.DamageHandlers /// public sealed class CustomDamageHandler : AttackerDamageHandler { + private static readonly Dictionary ItemTypeToDamage = new() + { + [ItemType.GunCrossvec] = DamageType.Crossvec, + [ItemType.GunLogicer] = DamageType.Logicer, + [ItemType.GunRevolver] = DamageType.Revolver, + [ItemType.GunShotgun] = DamageType.Shotgun, + [ItemType.GunCOM15] = DamageType.Com15, + [ItemType.GunCOM18] = DamageType.Com18, + [ItemType.GunFSP9] = DamageType.Fsp9, + [ItemType.GunE11SR] = DamageType.E11Sr, + [ItemType.GunCom45] = DamageType.Com45, + [ItemType.GunFRMG0] = DamageType.Frmg0, + [ItemType.GunA7] = DamageType.A7, + [ItemType.GunAK] = DamageType.AK, + }; + /// /// Initializes a new instance of the class. /// @@ -36,7 +49,7 @@ public sealed class CustomDamageHandler : AttackerDamageHandler public CustomDamageHandler(Player target, BaseHandler baseHandler) : base(target, baseHandler) { - if (Attacker is not null) + if (Attacker) { if (baseHandler is BaseScpDamageHandler) CustomBase = new ScpDamageHandler(target, baseHandler); @@ -74,6 +87,25 @@ public CustomDamageHandler(Player target, Player attacker, float damage, DamageT CustomBase = new FirearmDamageHandler(firearm, target, new BaseFirearmHandler(firearm.Base, damage)); } + /// + /// Initializes a new instance of the class. + /// + /// The target to be set. + /// The attacker to be set. + /// The amount of damage to be set. + /// The to be used. + public CustomDamageHandler(Player target, Player attacker, float damage, Firearm firearm) + : base(target, attacker) + { + Damage = damage; + Type = ItemTypeToDamage[firearm.Type]; + + if (firearm.Owner != attacker) + firearm.ChangeOwner(firearm.Owner, attacker); + + CustomBase = new FirearmDamageHandler(firearm, target, new BaseFirearmHandler(firearm.Base, damage)); + } + /// /// Initializes a new instance of the class. /// @@ -83,10 +115,7 @@ public CustomDamageHandler(Player target, Player attacker, float damage, DamageT /// The to be set. /// The to be set. public CustomDamageHandler(Player target, Player attacker, float damage, DamageType damageType, CassieAnnouncement cassieAnnouncement) - : this(target, attacker, damage, damageType) - { - CassieDeathAnnouncement = cassieAnnouncement; - } + : this(target, attacker, damage, damageType) => CassieDeathAnnouncement = cassieAnnouncement; /// /// Initializes a new instance of the class. @@ -97,10 +126,7 @@ public CustomDamageHandler(Player target, Player attacker, float damage, DamageT /// The to be set. /// The to be set. public CustomDamageHandler(Player target, Player attacker, float damage, DamageType damageType, string cassieAnnouncement) - : this(target, attacker, damage, damageType) - { - CassieDeathAnnouncement = new CassieAnnouncement(cassieAnnouncement); - } + : this(target, attacker, damage, damageType) => CassieDeathAnnouncement = new CassieAnnouncement(cassieAnnouncement); /// /// Gets the base . @@ -115,7 +141,14 @@ public override Action ApplyDamage(Player player) StartVelocity = player.Velocity; - As().StartVelocity.y = Mathf.Max(As().StartVelocity.y, 0f); + BaseFirearmHandler baseFirearmHandler = null; + + if (Base is BaseFirearmHandler) + baseFirearmHandler = Base as BaseFirearmHandler; + + if (baseFirearmHandler is not null) + baseFirearmHandler.StartVelocity.y = Mathf.Max(baseFirearmHandler.StartVelocity.y, 0f); + AhpStat ahpModule = player.GetModule(); HealthStat healthModule = player.GetModule(); @@ -124,10 +157,13 @@ public override Action ApplyDamage(Player player) ProcessDamage(player); - foreach (StatusEffectBase statusEffect in player.ActiveEffects) + if (baseFirearmHandler is not null) { - if (statusEffect is IDamageModifierEffect damageModifierEffect) - Damage *= damageModifierEffect.GetDamageModifier(Damage, CustomBase, As().Hitbox); + foreach (StatusEffectBase statusEffect in player.ActiveEffects) + { + if (statusEffect is IDamageModifierEffect damageModifierEffect) + Damage *= damageModifierEffect.GetDamageModifier(Damage, CustomBase, baseFirearmHandler.Hitbox); + } } DealtHealthDamage = ahpModule.ServerProcessDamage(Damage); diff --git a/Exiled.API/Features/DamageHandlers/DamageHandler.cs b/Exiled.API/Features/DamageHandlers/DamageHandler.cs index 41be3a34bd..4cb7158b3c 100644 --- a/Exiled.API/Features/DamageHandlers/DamageHandler.cs +++ b/Exiled.API/Features/DamageHandlers/DamageHandler.cs @@ -80,10 +80,10 @@ public DamageHandler(Player target, BaseHandler baseHandler) /// public virtual float Damage { - get => Is(out StandardDamageHandler handler) ? handler.Damage : 0f; + get => Base is StandardDamageHandler handler ? handler.Damage : 0f; set { - if (Is(out StandardDamageHandler handler)) + if (Base is StandardDamageHandler handler) handler.Damage = value; } } @@ -93,10 +93,10 @@ public virtual float Damage /// public Vector3 StartVelocity { - get => Is(out StandardDamageHandler handler) ? handler.StartVelocity : Vector3.zero; + get => Base is StandardDamageHandler handler ? handler.StartVelocity : Vector3.zero; set { - if (Is(out StandardDamageHandler handler)) + if (Base is StandardDamageHandler handler) handler.StartVelocity = value; } } @@ -106,10 +106,10 @@ public Vector3 StartVelocity ///
public float DealtHealthDamage { - get => Is(out StandardDamageHandler handler) ? handler.DealtHealthDamage : 0f; + get => Base is StandardDamageHandler handler ? handler.DealtHealthDamage : 0f; set { - if (Is(out StandardDamageHandler handler)) + if (Base is StandardDamageHandler handler) handler.DealtHealthDamage = value; } } @@ -119,10 +119,10 @@ public float DealtHealthDamage ///
public float AbsorbedAhpDamage { - get => Is(out StandardDamageHandler handler) ? handler.AbsorbedAhpDamage : 0f; + get => Base is StandardDamageHandler handler ? handler.AbsorbedAhpDamage : 0f; set { - if (Is(out StandardDamageHandler handler)) + if (Base is StandardDamageHandler handler) handler.AbsorbedAhpDamage = value; } } @@ -130,16 +130,16 @@ public float AbsorbedAhpDamage /// public override Action ApplyDamage(Player player) { - if (!Is(out StandardDamageHandler damageHandler)) + if (Base is not StandardDamageHandler handler) return player.GetModule().CurValue > 0f ? Action.Damage : Action.Death; if (Damage <= 0f) return Action.None; - damageHandler.ApplyDamage(player.ReferenceHub); + handler.ApplyDamage(player.ReferenceHub); StartVelocity = player.Velocity; - As().StartVelocity.y = Mathf.Max(damageHandler.StartVelocity.y, 0f); + handler.StartVelocity.y = Mathf.Max(handler.StartVelocity.y, 0f); AhpStat ahpModule = player.GetModule(); HealthStat healthModule = player.GetModule(); @@ -155,7 +155,7 @@ public override Action ApplyDamage(Player player) foreach (StatusEffectBase effect in player.ActiveEffects) { if (effect is IDamageModifierEffect damageModifierEffect) - Damage *= damageModifierEffect.GetDamageModifier(Damage, damageHandler, damageHandler.Hitbox); + Damage *= damageModifierEffect.GetDamageModifier(Damage, handler, handler.Hitbox); } // DealtHealthDamage = ahpModule.ServerProcessDamage(Damage); diff --git a/Exiled.API/Features/DamageHandlers/DamageHandlerBase.cs b/Exiled.API/Features/DamageHandlers/DamageHandlerBase.cs index c4eed3f055..55db916ed0 100644 --- a/Exiled.API/Features/DamageHandlers/DamageHandlerBase.cs +++ b/Exiled.API/Features/DamageHandlers/DamageHandlerBase.cs @@ -13,6 +13,7 @@ namespace Exiled.API.Features.DamageHandlers using System.Linq; using Enums; + using Exiled.API.Features.Core; using Extensions; using PlayerRoles.PlayableScps.Scp3114; @@ -25,7 +26,7 @@ namespace Exiled.API.Features.DamageHandlers /// /// A wrapper to easily manipulate the behavior of . /// - public abstract class DamageHandlerBase + public abstract class DamageHandlerBase : TypeCastObject { private DamageType damageType; private CassieAnnouncement cassieAnnouncement; @@ -96,55 +97,45 @@ public virtual DamageType Type if (damageType != DamageType.Unknown) return damageType; - switch (Base) + if (Base is UniversalDamageHandler handler) { - 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 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; - } + DeathTranslation translation = DeathTranslations.TranslationsById[handler.TranslationId]; + + if (DamageTypeExtensions.TranslationIdConversion.ContainsKey(translation.Id)) + return damageType = 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."); } - return DamageType.Unknown; + return damageType = Base switch + { + CustomReasonDamageHandler => DamageType.Custom, + WarheadDamageHandler => DamageType.Warhead, + ExplosionDamageHandler => DamageType.Explosion, + Scp018DamageHandler => DamageType.Scp018, + RecontainmentDamageHandler => DamageType.Recontainment, + MicroHidDamageHandler => DamageType.MicroHid, + DisruptorDamageHandler => DamageType.ParticleDisruptor, + Scp939DamageHandler => DamageType.Scp939, + JailbirdDamageHandler => DamageType.Jailbird, + Scp3114DamageHandler scp3114DamageHandler => scp3114DamageHandler.Subtype switch + { + Scp3114DamageHandler.HandlerType.Strangulation => DamageType.Strangled, + Scp3114DamageHandler.HandlerType.SkinSteal => DamageType.Scp3114, + Scp3114DamageHandler.HandlerType.Slap => DamageType.Scp3114, + _ => DamageType.Unknown, + }, + Scp049DamageHandler scp049DamageHandler => scp049DamageHandler.DamageSubType switch + { + Scp049DamageHandler.AttackType.CardiacArrest => DamageType.CardiacArrest, + Scp049DamageHandler.AttackType.Instakill => DamageType.Scp049, + Scp049DamageHandler.AttackType.Scp0492 => DamageType.Scp0492, + _ => DamageType.Unknown, + }, + _ => throw new InvalidOperationException("Unknown damage type."), + }; } protected set @@ -182,58 +173,6 @@ public virtual void ProcessDamage(Player player) { } - /// - /// Unsafely casts the damage handler to the specified type. - /// - /// The specified type. - /// A object. - public T As() - where T : BaseHandler => Base as T; - - /// - /// Unsafely casts the damage handler to the specified type. - /// - /// The specified type. - /// A object. - public T BaseAs() - where T : DamageHandlerBase => this as T; - - /// - /// Safely casts the damage handler to the specified type. - /// - /// The specified type. - /// The casted . - /// A object. - public bool Is(out T param) - where T : BaseHandler - { - param = default; - - if (Base is not T cast) - return false; - - param = cast; - return true; - } - - /// - /// Safely casts the damage handler to the specified type. - /// - /// The specified type. - /// The casted . - /// A object. - public bool BaseIs(out T param) - where T : DamageHandlerBase - { - param = default; - - if (this is not T cast) - return false; - - param = cast; - return true; - } - /// /// A wrapper to easily manipulate the behavior of . /// diff --git a/Exiled.API/Features/DamageHandlers/FirearmDamageHandler.cs b/Exiled.API/Features/DamageHandlers/FirearmDamageHandler.cs index bef0599005..e404cef570 100644 --- a/Exiled.API/Features/DamageHandlers/FirearmDamageHandler.cs +++ b/Exiled.API/Features/DamageHandlers/FirearmDamageHandler.cs @@ -53,27 +53,32 @@ Firearm _ when DamageTypeExtensions.ItemConversion.ContainsKey(Item.Type) => Dam ///
public HitboxType Hitbox { - get => As().Hitbox; - set => As().Hitbox = value; + get => (Base as BaseFirearmHandler).Hitbox; + set => (Base as BaseFirearmHandler).Hitbox = value; } /// /// Gets the penetration. /// - public float Penetration => As()._penetration; + public float Penetration => (Base as BaseFirearmHandler)._penetration; /// /// Gets a value indicating whether the human hitboxes should be used. /// - public bool UseHumanHitboxes => As()._useHumanHitboxes; + public bool UseHumanHitboxes => (Base as BaseFirearmHandler)._useHumanHitboxes; /// public override void ProcessDamage(Player player) { - if (Is(out BaseFirearmHandler firearmHandler)) - firearmHandler.ProcessDamage(player.ReferenceHub); - else if (Is(out MicroHidDamageHandler microHidHandler)) - microHidHandler.ProcessDamage(player.ReferenceHub); + switch (Base) + { + case BaseFirearmHandler firearmDamageHandler: + firearmDamageHandler.ProcessDamage(player.ReferenceHub); + break; + case MicroHidDamageHandler microHidHandler: + microHidHandler.ProcessDamage(player.ReferenceHub); + break; + } } /// diff --git a/Exiled.API/Features/DamageHandlers/GenericDamageHandler.cs b/Exiled.API/Features/DamageHandlers/GenericDamageHandler.cs index 56c6ad2822..5bd7a967a1 100644 --- a/Exiled.API/Features/DamageHandlers/GenericDamageHandler.cs +++ b/Exiled.API/Features/DamageHandlers/GenericDamageHandler.cs @@ -7,17 +7,19 @@ namespace Exiled.API.Features.DamageHandlers { - using Enums; + using System.Collections.Generic; + using Enums; + using Exiled.API.Extensions; + using Exiled.API.Features.Pickups; using Footprinting; - + using InventorySystem.Items.MicroHID; + using InventorySystem.Items.ThrowableProjectiles; using Items; - using PlayerRoles.PlayableScps.Scp096; + using PlayerRoles.PlayableScps.Scp3114; using PlayerRoles.PlayableScps.Scp939; - using PlayerStatsSystem; - using UnityEngine; /// @@ -26,6 +28,48 @@ namespace Exiled.API.Features.DamageHandlers public class GenericDamageHandler : CustomReasonDamageHandler { private const string DamageTextDefault = "You were damaged by Unknown Cause"; + + private static readonly Dictionary DamageToTranslations = new() + { + [DamageType.Falldown] = DeathTranslations.Falldown, + [DamageType.CardiacArrest] = DeathTranslations.CardiacArrest, + [DamageType.Hypothermia] = DeathTranslations.Hypothermia, + [DamageType.Asphyxiation] = DeathTranslations.Asphyxiated, + [DamageType.Poison] = DeathTranslations.Poisoned, + [DamageType.Bleeding] = DeathTranslations.Bleeding, + [DamageType.Crushed] = DeathTranslations.Crushed, + [DamageType.FemurBreaker] = DeathTranslations.UsedAs106Bait, + [DamageType.PocketDimension] = DeathTranslations.PocketDecay, + [DamageType.FriendlyFireDetector] = DeathTranslations.FriendlyFireDetector, + [DamageType.SeveredHands] = DeathTranslations.SeveredHands, + [DamageType.Decontamination] = DeathTranslations.Decontamination, + [DamageType.Tesla] = DeathTranslations.Tesla, + [DamageType.Scp] = DeathTranslations.Unknown, + [DamageType.Scp207] = DeathTranslations.Scp207, + [DamageType.Scp049] = DeathTranslations.Scp049, + [DamageType.Scp173] = DeathTranslations.Scp173, + [DamageType.Scp0492] = DeathTranslations.Zombie, + [DamageType.Scp106] = DeathTranslations.PocketDecay, + [DamageType.Scp3114] = DeathTranslations.Scp3114Slap, + }; + + private static readonly Dictionary DamageToItemType = new() + { + [DamageType.Crossvec] = ItemType.GunCrossvec, + [DamageType.Logicer] = ItemType.GunLogicer, + [DamageType.Revolver] = ItemType.GunRevolver, + [DamageType.Shotgun] = ItemType.GunShotgun, + [DamageType.Com15] = ItemType.GunCOM15, + [DamageType.Com18] = ItemType.GunCOM18, + [DamageType.Fsp9] = ItemType.GunFSP9, + [DamageType.E11Sr] = ItemType.GunE11SR, + [DamageType.Com45] = ItemType.GunCom45, + [DamageType.Frmg0] = ItemType.GunFRMG0, + [DamageType.A7] = ItemType.GunA7, + [DamageType.AK] = ItemType.GunAK, + [DamageType.Firearm] = ItemType.GunAK, + }; + private string genericDamageText; private string genericEnvironmentDamageText; private Player player; @@ -36,12 +80,12 @@ public class GenericDamageHandler : CustomReasonDamageHandler /// Initializes a new instance of the class. /// Transform input data to custom generic handler. /// - /// Current player (Target). - /// Attacker. - /// Damage quantity. - /// Damage type. - /// Custom cassie announcment. - /// Text to provide to player death screen. + /// Current player (Target). + /// Attacker. + /// Damage amount. + /// Damage type. + /// Custom cassie announcement. + /// Text to provide for player death screen. public GenericDamageHandler(Player player, Player attacker, float damage, DamageType damageType, DamageHandlerBase.CassieAnnouncement cassieAnnouncement, string damageText = null) : base(DamageTextDefault) { @@ -58,48 +102,25 @@ public GenericDamageHandler(Player player, Player attacker, float damage, Damage Damage = damage; ServerLogsText = $"GenericDamageHandler damage processing"; genericDamageText = $"You were damaged by {damageType}"; - genericEnvironmentDamageText = $"Environemntal damage of type {damageType}"; + genericEnvironmentDamageText = $"Environmental damage of type {damageType}"; + + if (DamageToTranslations.TryGetValue(damageType, out DeathTranslation translation)) + { + Base = damageType.IsScp() ? + new PlayerStatsSystem.ScpDamageHandler(attacker.ReferenceHub, damage, translation) : + new UniversalDamageHandler(damage, translation, cassieAnnouncement); + } + + if (Base is null && DamageToItemType.TryGetValue(damageType, out ItemType itemType)) + GenericFirearm(player, attacker, damage, damageType, itemType); switch (damageType) { - case DamageType.Falldown: - Base = new UniversalDamageHandler(damage, DeathTranslations.Falldown, cassieAnnouncement); - break; - case DamageType.Hypothermia: - Base = new UniversalDamageHandler(damage, DeathTranslations.Hypothermia, cassieAnnouncement); - break; - case DamageType.Asphyxiation: - Base = new UniversalDamageHandler(damage, DeathTranslations.Asphyxiated, cassieAnnouncement); - break; - case DamageType.Poison: - Base = new UniversalDamageHandler(damage, DeathTranslations.Poisoned, cassieAnnouncement); - break; - case DamageType.Bleeding: - Base = new UniversalDamageHandler(damage, DeathTranslations.Bleeding, cassieAnnouncement); - break; - case DamageType.Crushed: - Base = new UniversalDamageHandler(damage, DeathTranslations.Crushed, cassieAnnouncement); - break; - case DamageType.FemurBreaker: - Base = new UniversalDamageHandler(damage, DeathTranslations.UsedAs106Bait, cassieAnnouncement); - break; - case DamageType.PocketDimension: - Base = new UniversalDamageHandler(damage, DeathTranslations.PocketDecay, cassieAnnouncement); - break; - case DamageType.FriendlyFireDetector: - Base = new UniversalDamageHandler(damage, DeathTranslations.FriendlyFireDetector, cassieAnnouncement); - break; - case DamageType.SeveredHands: - Base = new UniversalDamageHandler(damage, DeathTranslations.SeveredHands, cassieAnnouncement); - break; case DamageType.Warhead: Base = new WarheadDamageHandler(); break; - case DamageType.Decontamination: - Base = new UniversalDamageHandler(damage, DeathTranslations.Decontamination, cassieAnnouncement); - break; - case DamageType.Tesla: - Base = new UniversalDamageHandler(damage, DeathTranslations.Tesla, cassieAnnouncement); + case DamageType.Scp018: + Base = new Scp018DamageHandler(Pickup.Create(ItemType.SCP018).Cast().Base, damage, IgnoreFriendlyFire); break; case DamageType.Recontainment: Base = new RecontainmentDamageHandler(Attacker); @@ -108,92 +129,30 @@ public GenericDamageHandler(Player player, Player attacker, float damage, Damage Base = new JailbirdDamageHandler(Attacker.Hub, damage, Vector3.zero); break; case DamageType.MicroHid: - InventorySystem.Items.MicroHID.MicroHIDItem microHidOwner = new(); + MicroHIDItem microHidOwner = new GameObject().AddComponent(); microHidOwner.Owner = attacker.ReferenceHub; Base = new MicroHidDamageHandler(microHidOwner, damage); break; case DamageType.Explosion: Base = new ExplosionDamageHandler(attacker.Footprint, UnityEngine.Vector3.zero, damage, 0); break; - case DamageType.Firearm: - GenericFirearm(player, attacker, damage, damageType, ItemType.GunAK); - break; - case DamageType.Crossvec: - GenericFirearm(player, attacker, damage, damageType, ItemType.GunCrossvec); - break; - case DamageType.Logicer: - GenericFirearm(player, attacker, damage, damageType, ItemType.GunLogicer); - break; - case DamageType.Revolver: - GenericFirearm(player, attacker, damage, damageType, ItemType.GunRevolver); - break; - case DamageType.Shotgun: - GenericFirearm(player, attacker, damage, damageType, ItemType.GunShotgun); - break; - case DamageType.AK: - GenericFirearm(player, attacker, damage, damageType, ItemType.GunAK); - break; - case DamageType.Com15: - GenericFirearm(player, attacker, damage, damageType, ItemType.GunCOM15); - break; - case DamageType.Com18: - GenericFirearm(player, attacker, damage, damageType, ItemType.GunCOM18); - break; - case DamageType.Fsp9: - GenericFirearm(player, attacker, damage, damageType, ItemType.GunFSP9); - break; - case DamageType.E11Sr: - GenericFirearm(player, attacker, damage, damageType, ItemType.GunE11SR); - break; - case DamageType.Com45: - GenericFirearm(player, attacker, damage, damageType, ItemType.GunCom45); - break; - case DamageType.Frmg0: - GenericFirearm(player, attacker, damage, damageType, ItemType.GunFRMG0); - break; - case DamageType.A7: - GenericFirearm(player, attacker, damage, damageType, ItemType.GunA7); - break; case DamageType.ParticleDisruptor: Base = new DisruptorDamageHandler(Attacker, damage); break; case DamageType.Scp096: - Scp096Role curr096 = attacker.ReferenceHub.roleManager.CurrentRole as Scp096Role ?? new Scp096Role(); - - if (curr096 != null) - curr096._lastOwner = attacker.ReferenceHub; - - Base = new Scp096DamageHandler(curr096, damage, Scp096DamageHandler.AttackType.SlapRight); + Scp096Role curr096 = attacker.Role.Is(out Roles.Scp096Role scp096) ? scp096.Base : new GameObject().AddComponent(); + curr096._lastOwner = attacker.ReferenceHub; + Base = new Scp096DamageHandler(scp096.Base, damage, Scp096DamageHandler.AttackType.GateKill); break; case DamageType.Scp939: - Scp939Role curr939 = attacker.ReferenceHub.roleManager.CurrentRole as Scp939Role ?? new Scp939Role(); - - if (curr939 != null) - curr939._lastOwner = attacker.ReferenceHub; - + Scp939Role curr939 = attacker.Role.Is(out Roles.Scp939Role scp939) ? scp939.Base : new GameObject().AddComponent(); + curr939._lastOwner = attacker.ReferenceHub; Base = new Scp939DamageHandler(curr939, damage, Scp939DamageType.LungeTarget); break; - case DamageType.Scp: - Base = new PlayerStatsSystem.ScpDamageHandler(attacker.ReferenceHub, damage, DeathTranslations.Unknown); - break; - case DamageType.Scp018: - Base = new PlayerStatsSystem.ScpDamageHandler(attacker.ReferenceHub, damage, DeathTranslations.Unknown); - break; - case DamageType.Scp207: - Base = new PlayerStatsSystem.ScpDamageHandler(attacker.ReferenceHub, damage, DeathTranslations.Scp207); - break; - case DamageType.Scp049: - Base = new PlayerStatsSystem.ScpDamageHandler(attacker.ReferenceHub, damage, DeathTranslations.Scp049); - break; - case DamageType.Scp173: - Base = new PlayerStatsSystem.ScpDamageHandler(attacker.ReferenceHub, damage, DeathTranslations.Scp173); - break; - case DamageType.Scp0492: - Base = new PlayerStatsSystem.ScpDamageHandler(attacker.ReferenceHub, damage, DeathTranslations.Zombie); - break; - case DamageType.Scp106: - Base = new PlayerStatsSystem.ScpDamageHandler(attacker.ReferenceHub, damage, DeathTranslations.PocketDecay); + case DamageType.Strangled: + new Scp3114DamageHandler(attacker.ReferenceHub, damage, Scp3114DamageHandler.HandlerType.Strangulation); break; + case DamageType.Marshmallow: case DamageType.Custom: case DamageType.Unknown: default: @@ -217,6 +176,11 @@ public GenericDamageHandler(Player player, Player attacker, float damage, Damage ///
public bool AllowSelfDamage { get; } + /// + /// Gets or sets a value indicating whether the friendly fire rules should be ignored. + /// + public bool IgnoreFriendlyFire { get; set; } + /// public override float Damage { get; set; } @@ -245,11 +209,11 @@ public override HandlerOutput ApplyDamage(ReferenceHub ply) /// /// Generic firearm path for handle type. /// - /// Current player. - /// Current attacker. - /// Damage amount. - /// Damage type. - /// ItemType. + /// Current player. + /// Current attacker. + /// Damage amount. + /// Damage type. + /// ItemType. private void GenericFirearm(Player player, Player attacker, float amount, DamageType damageType, ItemType itemType) { Firearm firearm = new(itemType) diff --git a/Exiled.API/Features/DamageHandlers/ScpDamageHandler.cs b/Exiled.API/Features/DamageHandlers/ScpDamageHandler.cs index ebeeedf616..688e1c81f4 100644 --- a/Exiled.API/Features/DamageHandlers/ScpDamageHandler.cs +++ b/Exiled.API/Features/DamageHandlers/ScpDamageHandler.cs @@ -8,9 +8,8 @@ namespace Exiled.API.Features.DamageHandlers { using Enums; - using Extensions; - + using PlayerRoles.PlayableScps.Scp939; using PlayerStatsSystem; using BaseHandler = PlayerStatsSystem.DamageHandlerBase; @@ -46,13 +45,15 @@ public override DamageType Type Scp049DamageHandler.AttackType.Scp0492 => DamageType.Scp0492, _ => DamageType.Scp049, }; + case Scp939DamageHandler: + return DamageType.Scp939; 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; - } + { + DeathTranslation translation = DeathTranslations.TranslationsById[scp._translationId]; + return translation.Id == DeathTranslations.PocketDecay.Id ? DamageType.Scp106 : + DamageTypeExtensions.TranslationIdConversion.ContainsKey(translation.Id) ? + DamageTypeExtensions.TranslationIdConversion[translation.Id] : DamageType.Scp; + } default: return base.Type; diff --git a/Exiled.API/Features/Pickups/Scp244Pickup.cs b/Exiled.API/Features/Pickups/Scp244Pickup.cs index f852fcc3ae..082d63f248 100644 --- a/Exiled.API/Features/Pickups/Scp244Pickup.cs +++ b/Exiled.API/Features/Pickups/Scp244Pickup.cs @@ -124,10 +124,10 @@ public float ActivationDot } /// - /// Damages the Scp244Pickup. + /// Damages the . /// /// The used to deal damage. - /// if the the damage has been deal; otherwise, . + /// if the the damage has been dealt; otherwise, . public bool Damage(DamageHandler handler) => Base.Damage(handler.Damage, handler, Vector3.zero); /// diff --git a/Exiled.API/Features/Player.cs b/Exiled.API/Features/Player.cs index 8b52105cca..cf985a1376 100644 --- a/Exiled.API/Features/Player.cs +++ b/Exiled.API/Features/Player.cs @@ -2053,6 +2053,12 @@ public int GetScpPreference(RoleTypeId roleType) /// The used to deal damage. public void Hurt(DamageHandlerBase damageHandlerBase) => ReferenceHub.playerStats.DealDamage(damageHandlerBase); + /// + /// Hurts the player. + /// + /// The used to deal damage. + public void Hurt(DamageHandlers.DamageHandlerBase damageHandlerBase) => ReferenceHub.playerStats.DealDamage(damageHandlerBase.Base); + /// /// Hurts the player. /// diff --git a/Exiled.Events/EventArgs/Map/AnnouncingScpTerminationEventArgs.cs b/Exiled.Events/EventArgs/Map/AnnouncingScpTerminationEventArgs.cs index 2636eb26fd..9029d442a5 100644 --- a/Exiled.Events/EventArgs/Map/AnnouncingScpTerminationEventArgs.cs +++ b/Exiled.Events/EventArgs/Map/AnnouncingScpTerminationEventArgs.cs @@ -38,7 +38,7 @@ public AnnouncingScpTerminationEventArgs(Player scp, DamageHandlerBase damageHan Player = scp; Role = scp.Role; DamageHandler = new CustomDamageHandler(scp, damageHandlerBase); - Attacker = DamageHandler.BaseIs(out CustomAttackerHandler customAttackerHandler) ? customAttackerHandler.Attacker : null; + Attacker = DamageHandler.Is(out CustomAttackerHandler customAttackerHandler) ? customAttackerHandler.Attacker : null; TerminationCause = damageHandlerBase.CassieDeathAnnouncement.Announcement; IsAllowed = isAllowed; } diff --git a/Exiled.Events/EventArgs/Player/DiedEventArgs.cs b/Exiled.Events/EventArgs/Player/DiedEventArgs.cs index c6606c9b7a..32f1c49093 100644 --- a/Exiled.Events/EventArgs/Player/DiedEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/DiedEventArgs.cs @@ -35,7 +35,7 @@ public class DiedEventArgs : IPlayerEvent, IAttackerEvent public DiedEventArgs(Player target, RoleTypeId targetOldRole, DamageHandlerBase damageHandler) { DamageHandler = new CustomDamageHandler(target, damageHandler); - Attacker = DamageHandler.BaseIs(out CustomAttackerHandler attackerDamageHandler) ? attackerDamageHandler.Attacker : null; + Attacker = DamageHandler.Is(out CustomAttackerHandler attackerDamageHandler) ? attackerDamageHandler.Attacker : null; Player = target; TargetOldRole = targetOldRole; } diff --git a/Exiled.Events/EventArgs/Player/DyingEventArgs.cs b/Exiled.Events/EventArgs/Player/DyingEventArgs.cs index 1a96627e78..fae5d10ffe 100644 --- a/Exiled.Events/EventArgs/Player/DyingEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/DyingEventArgs.cs @@ -38,21 +38,14 @@ 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; + Attacker = DamageHandler.Is(out CustomAttackerHandler attackerDamageHandler) ? attackerDamageHandler.Attacker : null; } /// - /// Gets or sets the list of items to be dropped. + /// Gets the list of items to be dropped. /// - public List ItemsToDrop - { - get; - [Obsolete("This setter has been deprecated")] - set; - } + public List ItemsToDrop { get; } /// /// Gets the dying player. diff --git a/Exiled.Events/EventArgs/Player/HurtEventArgs.cs b/Exiled.Events/EventArgs/Player/HurtEventArgs.cs index 80cff1c51b..24158d95cf 100644 --- a/Exiled.Events/EventArgs/Player/HurtEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/HurtEventArgs.cs @@ -35,7 +35,7 @@ public class HurtEventArgs : IAttackerEvent public HurtEventArgs(Player target, DamageHandlerBase damageHandler, DamageHandlerBase.HandlerOutput handlerOutput) { DamageHandler = new CustomDamageHandler(target, damageHandler); - Attacker = DamageHandler.BaseIs(out CustomAttackerHandler attackerDamageHandler) ? attackerDamageHandler.Attacker : null; + Attacker = DamageHandler.Is(out CustomAttackerHandler attackerDamageHandler) ? attackerDamageHandler.Attacker : null; Player = target; HandlerOutput = handlerOutput; } diff --git a/Exiled.Events/EventArgs/Player/HurtingEventArgs.cs b/Exiled.Events/EventArgs/Player/HurtingEventArgs.cs index b5b8912ac3..794c3eadcf 100644 --- a/Exiled.Events/EventArgs/Player/HurtingEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/HurtingEventArgs.cs @@ -33,7 +33,7 @@ public HurtingEventArgs(Player target, DamageHandlerBase damageHandler) { DamageHandler = new CustomDamageHandler(target, damageHandler); - Attacker = DamageHandler.BaseIs(out CustomAttackerHandler attackerDamageHandler) ? attackerDamageHandler.Attacker : null; + Attacker = DamageHandler.Is(out CustomAttackerHandler attackerDamageHandler) ? attackerDamageHandler.Attacker : null; Player = target; } From d6176c345f0892a2d3956e5c45c71f0468bdb3b2 Mon Sep 17 00:00:00 2001 From: Naounderscore Date: Sun, 28 Jan 2024 23:28:26 +0100 Subject: [PATCH 041/141] Added `DeployingTeamRole` and `RestartedRespawnSequence` events. --- Exiled.API/Features/Cassie.cs | 1 + Exiled.API/Features/Respawn.cs | 27 +-- .../Server/DeployingScpRoleEventArgs.cs | 2 +- .../Server/DeployingTeamRoleEventArgs.cs | 110 ++++++++++++ .../Server/RespawningTeamEventArgs.cs | 34 ++-- .../RestartedRespawnSequenceEventArgs.cs | 65 +++++++ Exiled.Events/Handlers/Server.cs | 22 +++ .../Patches/Events/Server/RespawningTeam.cs | 160 +++++++++++------- .../Events/Server/RestartedRespawnSequence.cs | 59 +++++++ 9 files changed, 382 insertions(+), 98 deletions(-) create mode 100644 Exiled.Events/EventArgs/Server/DeployingTeamRoleEventArgs.cs create mode 100644 Exiled.Events/EventArgs/Server/RestartedRespawnSequenceEventArgs.cs create mode 100644 Exiled.Events/Patches/Events/Server/RestartedRespawnSequence.cs diff --git a/Exiled.API/Features/Cassie.cs b/Exiled.API/Features/Cassie.cs index b9de21e545..19e358b7ad 100644 --- a/Exiled.API/Features/Cassie.cs +++ b/Exiled.API/Features/Cassie.cs @@ -147,6 +147,7 @@ public static void ScpTermination(Player scp, DamageHandlerBase info) public static void CustomScpTermination(string scpName, CustomHandlerBase info) { string result = scpName; + result += info.Base switch { MicroHidDamageHandler => " SUCCESSFULLY TERMINATED BY AUTOMATIC SECURITY SYSTEM", diff --git a/Exiled.API/Features/Respawn.cs b/Exiled.API/Features/Respawn.cs index 3367de9c3b..674eb4f2f6 100644 --- a/Exiled.API/Features/Respawn.cs +++ b/Exiled.API/Features/Respawn.cs @@ -157,7 +157,12 @@ public static bool ProtectedCanShoot public static void PlayEffects(byte[] effects) { foreach (RespawnEffectsController controller in RespawnEffectsController.AllControllers) - controller?.RpcPlayEffects(effects); + { + if (!controller) + continue; + + controller.RpcPlayEffects(effects); + } } /// @@ -177,17 +182,15 @@ public static void PlayEffects(byte[] effects) /// Whether or not to play the Chaos Insurgency spawn music. public static void SummonChaosInsurgencyVan(bool playMusic = true) { - PlayEffects( - playMusic - ? new[] - { - RespawnEffectType.PlayChaosInsurgencyMusic, - RespawnEffectType.SummonChaosInsurgencyVan, - } - : new[] - { - RespawnEffectType.SummonChaosInsurgencyVan, - }); + PlayEffects(playMusic ? new[] + { + RespawnEffectType.PlayChaosInsurgencyMusic, + RespawnEffectType.SummonChaosInsurgencyVan, + } + : new[] + { + RespawnEffectType.SummonChaosInsurgencyVan, + }); } /// diff --git a/Exiled.Events/EventArgs/Server/DeployingScpRoleEventArgs.cs b/Exiled.Events/EventArgs/Server/DeployingScpRoleEventArgs.cs index 2452fedaf7..0976e53532 100644 --- a/Exiled.Events/EventArgs/Server/DeployingScpRoleEventArgs.cs +++ b/Exiled.Events/EventArgs/Server/DeployingScpRoleEventArgs.cs @@ -29,7 +29,7 @@ public class DeployingScpRoleEventArgs : IExiledEvent private Action @delegate; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The players from which retrieve the player to be spawned from. /// diff --git a/Exiled.Events/EventArgs/Server/DeployingTeamRoleEventArgs.cs b/Exiled.Events/EventArgs/Server/DeployingTeamRoleEventArgs.cs new file mode 100644 index 0000000000..2de36df982 --- /dev/null +++ b/Exiled.Events/EventArgs/Server/DeployingTeamRoleEventArgs.cs @@ -0,0 +1,110 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Events.EventArgs.Server +{ + using System; + using System.Collections.Generic; + using System.Linq; + + using API.Enums; + using API.Features; + + using Interfaces; + + using PlayerRoles; + using PlayerRoles.RoleAssign; + + /// + /// Contains all information before deploying a team role. + /// + public class DeployingTeamRoleEventArgs : IExiledEvent, IPlayerEvent + { + private RoleTypeId role; + private bool delegateHasChanged; + private Action @delegate; + private Player player; + + /// + /// Initializes a new instance of the class. + /// + /// + /// + public DeployingTeamRoleEventArgs(ReferenceHub hub, RoleTypeId selectedRole) + { + Player = Player.Get(hub); + Role = selectedRole; + @delegate = () => hub.roleManager.ServerSetRole(selectedRole, RoleChangeReason.Respawn); + OriginalDelegate = @delegate; + } + + /// + /// Gets or sets the to be fired to deploy the role. + /// + public Action Delegate + { + get => @delegate; + set + { + @delegate = value; + delegateHasChanged = true; + } + } + + /// + /// Gets the original to be fired to deploy the role. + /// + public Action OriginalDelegate { get; } + + /// + /// Gets or sets the player to be deployed. + /// + public Player Player + { + get => player; + set + { + if (player == value) + return; + + player = value; + + if (delegateHasChanged) + return; + + @delegate = () => Player.ReferenceHub.roleManager.ServerSetRole(role, RoleChangeReason.Respawn); + } + } + + /// + /// Gets or sets a value indicating whether the role's deployment is reliable. + /// + /// When set to , the will not be counted among respawned players. + /// + public bool IsReliable { get; set; } = true; + + /// + /// Gets or sets the role to be deployed. + /// + public RoleTypeId Role + { + get => role; + set + { + if (role == value) + return; + + role = value; + + if (delegateHasChanged) + return; + + @delegate = () => Player.ReferenceHub.roleManager.ServerSetRole(role, RoleChangeReason.Respawn); + } + } + } +} \ No newline at end of file diff --git a/Exiled.Events/EventArgs/Server/RespawningTeamEventArgs.cs b/Exiled.Events/EventArgs/Server/RespawningTeamEventArgs.cs index 0ea3641b53..d07c02b305 100644 --- a/Exiled.Events/EventArgs/Server/RespawningTeamEventArgs.cs +++ b/Exiled.Events/EventArgs/Server/RespawningTeamEventArgs.cs @@ -23,27 +23,19 @@ namespace Exiled.Events.EventArgs.Server public class RespawningTeamEventArgs : IDeniableEvent { private SpawnableTeamType nextKnownTeam; - private int maximumRespawnAmount; + private int maxWaveSize; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// - /// + /// + /// + /// + /// public RespawningTeamEventArgs(List players, int maxRespawn, SpawnableTeamType nextKnownTeam, bool isAllowed = true) { Players = players; - MaximumRespawnAmount = maxRespawn; + MaxWaveSize = maxRespawn; this.nextKnownTeam = nextKnownTeam; SpawnQueue = new(); @@ -59,18 +51,18 @@ public RespawningTeamEventArgs(List players, int maxRespawn, SpawnableTe /// /// Gets or sets the maximum amount of respawnable players. /// - public int MaximumRespawnAmount + public int MaxWaveSize { - get => maximumRespawnAmount; + get => maxWaveSize; set { - if (value < maximumRespawnAmount) + if (value < maxWaveSize) { if (Players.Count > value) Players.RemoveRange(value, Players.Count - value); } - maximumRespawnAmount = value; + maxWaveSize = value; } } @@ -86,11 +78,11 @@ public SpawnableTeamType NextKnownTeam if (!RespawnManager.SpawnableTeams.TryGetValue(value, out SpawnableTeamHandlerBase spawnableTeam)) { - MaximumRespawnAmount = 0; + MaxWaveSize = 0; return; } - MaximumRespawnAmount = spawnableTeam.MaxWaveSize; + MaxWaveSize = spawnableTeam.MaxWaveSize; if (RespawnManager.SpawnableTeams.TryGetValue(nextKnownTeam, out SpawnableTeamHandlerBase @base)) @base.GenerateQueue(SpawnQueue, Players.Count); } diff --git a/Exiled.Events/EventArgs/Server/RestartedRespawnSequenceEventArgs.cs b/Exiled.Events/EventArgs/Server/RestartedRespawnSequenceEventArgs.cs new file mode 100644 index 0000000000..afb52115aa --- /dev/null +++ b/Exiled.Events/EventArgs/Server/RestartedRespawnSequenceEventArgs.cs @@ -0,0 +1,65 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Events.EventArgs.Server +{ + using System; + using System.Collections.Generic; + using System.Diagnostics; + using System.Linq; + + using API.Enums; + using API.Features; + using Interfaces; + using PlayerRoles; + using PlayerRoles.RoleAssign; + using Respawning; + + /// + /// Contains all information after a new respawn sequence has been restarted. + /// + public class RestartedRespawnSequenceEventArgs : IExiledEvent + { + /// + /// Initializes a new instance of the class. + /// + /// + public RestartedRespawnSequenceEventArgs(RespawnManager respawnManager) => RespawnManager = respawnManager; + + /// + /// Gets the instance. + /// + public RespawnManager RespawnManager { get; } + + /// + /// Gets the sequence's timer. + /// + public Stopwatch Timer => RespawnManager._stopwatch; + + /// + /// Gets or sets the current . + /// + public RespawnManager.RespawnSequencePhase CurrentRespawnSequencePhase + { + get => RespawnManager._curSequence; + set => RespawnManager._curSequence = value; + } + + /// + /// Gets or sets the time for the next sequence. + /// + public float TimeForNextSequence + { + get => RespawnManager.TimeTillRespawn; + set + { + RespawnManager._timeForNextSequence = value; + Timer.Restart(); + } + } + } +} \ No newline at end of file diff --git a/Exiled.Events/Handlers/Server.cs b/Exiled.Events/Handlers/Server.cs index cf9d6e54da..9ee1729aae 100644 --- a/Exiled.Events/Handlers/Server.cs +++ b/Exiled.Events/Handlers/Server.cs @@ -142,6 +142,16 @@ public static class Server /// public static Event DeployingHumanRole { get; set; } = new(); + /// + /// Invoked before deploying a team role. + /// + public static Event DeployingTeamRole { get; set; } = new(); + + /// + /// Invoked after a new respawn sequence has been restarted. + /// + public static Event RestartedRespawnSequence { get; set; } = new(); + /// /// Called before waiting for players. /// @@ -277,5 +287,17 @@ public static class Server /// /// The instance. public static void OnDeployingHumanRole(DeployingHumanRoleEventArgs ev) => DeployingHumanRole.InvokeSafely(ev); + + /// + /// Called before deploying a team role. + /// + /// The instance. + public static void OnDeployingTeamRole(DeployingTeamRoleEventArgs ev) => DeployingTeamRole.InvokeSafely(ev); + + /// + /// Called after a new respawn sequence has been restarted. + /// + /// The instance. + public static void OnRestartedRespawnSequence(RestartedRespawnSequenceEventArgs ev) => RestartedRespawnSequence.InvokeSafely(ev); } } \ No newline at end of file diff --git a/Exiled.Events/Patches/Events/Server/RespawningTeam.cs b/Exiled.Events/Patches/Events/Server/RespawningTeam.cs index e27f1325e2..f86b1d1bcf 100644 --- a/Exiled.Events/Patches/Events/Server/RespawningTeam.cs +++ b/Exiled.Events/Patches/Events/Server/RespawningTeam.cs @@ -7,6 +7,7 @@ namespace Exiled.Events.Patches.Events.Server { + using System; using System.Collections.Generic; using System.Linq; using System.Reflection; @@ -25,10 +26,11 @@ namespace Exiled.Events.Patches.Events.Server using Player = API.Features.Player; /// - /// Patch the . - /// Adds the event. + /// Patch the . + /// Adds and events. /// [EventPatch(typeof(Server), nameof(Server.RespawningTeam))] + [EventPatch(typeof(Server), nameof(Server.DeployingTeamRole))] [HarmonyPatch(typeof(RespawnManager), nameof(RespawnManager.Spawn))] internal static class RespawningTeam { @@ -43,72 +45,102 @@ private static IEnumerable Transpiler(IEnumerable i.opcode == OpCodes.Callvirt && (MethodInfo)i.operand == Method(typeof(SpawnableTeamHandlerBase), nameof(SpawnableTeamHandlerBase.GenerateQueue))) + offset, 7); + offset = -3; + index = newInstructions.FindIndex(i => i.opcode == OpCodes.Ldc_I4_M1) + offset; + + LocalBuilder deployingEv = generator.DeclareLocal(typeof(DeployingTeamRoleEventArgs)); + Label jne = generator.DefineLabel(); + + newInstructions.InsertRange(index, new CodeInstruction[] + { + new(OpCodes.Ldloc_S, 10), + new(OpCodes.Newobj, GetDeclaredConstructors(typeof(DeployingTeamRoleEventArgs))[0]), + new(OpCodes.Dup), + new(OpCodes.Dup), + new(OpCodes.Call, Method(typeof(Handlers.Server), nameof(Handlers.Server.OnDeployingTeamRole))), + new(OpCodes.Stloc_S, deployingEv.LocalIndex), + new(OpCodes.Callvirt, PropertyGetter(typeof(DeployingTeamRoleEventArgs), nameof(DeployingTeamRoleEventArgs.Role))), + new(OpCodes.Ldloc_S, deployingEv.LocalIndex), + new(OpCodes.Callvirt, PropertyGetter(typeof(DeployingTeamRoleEventArgs), nameof(DeployingTeamRoleEventArgs.Delegate))), + new(OpCodes.Callvirt, Method(typeof(Action), nameof(Action.Invoke))), + new(OpCodes.Ldloc_S, deployingEv.LocalIndex), + new(OpCodes.Callvirt, PropertyGetter(typeof(DeployingTeamRoleEventArgs), nameof(DeployingTeamRoleEventArgs.IsReliable))), + new(OpCodes.Brfalse_S, jne), + }); + + offset = 5; + index = newInstructions.FindIndex(i => i.opcode == OpCodes.Ldc_I4_M1) + offset; + newInstructions[index].labels.Add(jne); + + offset = -3; + index = newInstructions.FindIndex(i => i.opcode == OpCodes.Ldc_I4_M1) + offset; + + newInstructions.RemoveRange(index, 5); + for (int z = 0; z < newInstructions.Count; z++) yield return newInstructions[z]; diff --git a/Exiled.Events/Patches/Events/Server/RestartedRespawnSequence.cs b/Exiled.Events/Patches/Events/Server/RestartedRespawnSequence.cs new file mode 100644 index 0000000000..d23e3096c4 --- /dev/null +++ b/Exiled.Events/Patches/Events/Server/RestartedRespawnSequence.cs @@ -0,0 +1,59 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled 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 API.Features.Core.Generic.Pools; + using Exiled.Events.Attributes; + using Exiled.Events.EventArgs.Server; + using Exiled.Events.Handlers; + using HarmonyLib; + using Respawning; + using Respawning.NamingRules; + + using static HarmonyLib.AccessTools; + + using Player = API.Features.Player; + + /// + /// Patch the . + /// Adds the event. + /// + [EventPatch(typeof(Server), nameof(Server.RestartedRespawnSequence))] + [HarmonyPatch(typeof(RespawnManager), nameof(RespawnManager.RestartSequence))] + internal static class RestartedRespawnSequence + { + private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) + { + List newInstructions = ListPool.Pool.Get(instructions); + + CodeInstruction[] toInsert = new CodeInstruction[] + { + new(OpCodes.Ldarg_0), + new(OpCodes.Newobj, GetDeclaredConstructors(typeof(RestartedRespawnSequenceEventArgs))[0]), + new(OpCodes.Call, Method(typeof(Handlers.Server), nameof(Handlers.Server.OnRestartedRespawnSequence))), + }; + + int index = newInstructions.FindIndex(i => i.opcode == OpCodes.Ret); + newInstructions.InsertRange(index, toInsert); + + index = newInstructions.FindLastIndex(i => i.opcode == OpCodes.Ret); + newInstructions.InsertRange(index, toInsert); + + for (int z = 0; z < newInstructions.Count; z++) + yield return newInstructions[z]; + + ListPool.Pool.Return(newInstructions); + } + } +} \ No newline at end of file From fced7a0775beedcc24391b2915d7f52e03ac16ca Mon Sep 17 00:00:00 2001 From: Yamato Date: Sun, 28 Jan 2024 23:39:43 +0100 Subject: [PATCH 042/141] Fix CustomScpTermination --- Exiled.API/Features/Cassie.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Exiled.API/Features/Cassie.cs b/Exiled.API/Features/Cassie.cs index b9de21e545..bb0dc159c6 100644 --- a/Exiled.API/Features/Cassie.cs +++ b/Exiled.API/Features/Cassie.cs @@ -149,9 +149,10 @@ public static void CustomScpTermination(string scpName, CustomHandlerBase info) string result = scpName; result += info.Base switch { - MicroHidDamageHandler => " SUCCESSFULLY TERMINATED BY AUTOMATIC SECURITY SYSTEM", + UniversalDamageHandler universalDamageHandler when universalDamageHandler.TranslationId == DeathTranslations.Tesla.Id => " SUCCESSFULLY TERMINATED BY AUTOMATIC SECURITY SYSTEM", + UniversalDamageHandler universalDamageHandler when universalDamageHandler.TranslationId == DeathTranslations.Decontamination.Id => " LOST IN DECONTAMINATION SEQUENCE", + UniversalDamageHandler universalDamageHandler when universalDamageHandler.TranslationId == DeathTranslations.MarshmallowMan.Id => " TERMINATED BY MARSHMALLOW MAN", WarheadDamageHandler => " SUCCESSFULLY TERMINATED BY ALPHA WARHEAD", - UniversalDamageHandler => " LOST IN DECONTAMINATION SEQUENCE", _ => info.Is(out CustomFirearmHandler firearmDamageHandler) && firearmDamageHandler.Attacker is Player attacker ? " CONTAINEDSUCCESSFULLY " + ConvertTeam(attacker.Role.Team, attacker.UnitName) : " SUCCESSFULLY TERMINATED . TERMINATION CAUSE UNSPECIFIED" }; From 6fe764b5d299e2ddd28f50ef9414ecca006da397 Mon Sep 17 00:00:00 2001 From: Yamato Date: Sun, 28 Jan 2024 23:49:09 +0100 Subject: [PATCH 043/141] Add SubtitleMessage --- Exiled.API/Features/Cassie.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Exiled.API/Features/Cassie.cs b/Exiled.API/Features/Cassie.cs index f385ec0a36..1e545161b8 100644 --- a/Exiled.API/Features/Cassie.cs +++ b/Exiled.API/Features/Cassie.cs @@ -11,6 +11,7 @@ namespace Exiled.API.Features using System.Linq; using System.Text; + using Exiled.API.Extensions; using Exiled.API.Features.Core.Generic.Pools; using MEC; @@ -20,6 +21,8 @@ namespace Exiled.API.Features using PlayerStatsSystem; using Respawning; + using Subtitles; + using Utils.Networking; using CustomFirearmHandler = DamageHandlers.FirearmDamageHandler; using CustomHandlerBase = DamageHandlers.DamageHandlerBase; @@ -158,8 +161,9 @@ public static void CustomScpTermination(string scpName, CustomHandlerBase info) " CONTAINEDSUCCESSFULLY " + ConvertTeam(attacker.Role.Team, attacker.UnitName) : " SUCCESSFULLY TERMINATED . TERMINATION CAUSE UNSPECIFIED" }; - float num = AlphaWarheadController.TimeUntilDetonation <= 0f ? 3.5f : 1f; + float num = AlphaWarheadController.Detonated ? 3.5f : 1f; GlitchyMessage(result, UnityEngine.Random.Range(0.1f, 0.14f) * num, UnityEngine.Random.Range(0.07f, 0.08f) * num); + new SubtitleMessage(new SubtitlePart(SubtitleType.SCP, new string[] { scpName.RemoveSpaces() })).SendToAuthenticated(0); } /// From 682df5cfb2a571a59c838036460d14ca827c3929 Mon Sep 17 00:00:00 2001 From: Yamato Date: Mon, 29 Jan 2024 00:11:11 +0100 Subject: [PATCH 044/141] Simplify DamageTypeExtensions --- Exiled.API/Extensions/DamageTypeExtensions.cs | 54 ++++--------------- 1 file changed, 11 insertions(+), 43 deletions(-) diff --git a/Exiled.API/Extensions/DamageTypeExtensions.cs b/Exiled.API/Extensions/DamageTypeExtensions.cs index c8f0975aca..8d9985f966 100644 --- a/Exiled.API/Extensions/DamageTypeExtensions.cs +++ b/Exiled.API/Extensions/DamageTypeExtensions.cs @@ -8,6 +8,7 @@ namespace Exiled.API.Extensions { using System.Collections.Generic; + using System.Linq; using Enums; @@ -20,37 +21,6 @@ namespace Exiled.API.Extensions /// public static class DamageTypeExtensions { - private static readonly Dictionary TranslationIdConversionInternal = new() - { - { DeathTranslations.Asphyxiated.Id, DamageType.Asphyxiation }, - { DeathTranslations.Bleeding.Id, DamageType.Bleeding }, - { DeathTranslations.Crushed.Id, DamageType.Crushed }, - { DeathTranslations.Decontamination.Id, DamageType.Decontamination }, - { DeathTranslations.Explosion.Id, DamageType.Explosion }, - { DeathTranslations.Falldown.Id, DamageType.Falldown }, - { DeathTranslations.Poisoned.Id, DamageType.Poison }, - { DeathTranslations.Recontained.Id, DamageType.Recontainment }, - { DeathTranslations.Scp049.Id, DamageType.Scp049 }, - { DeathTranslations.Scp096.Id, DamageType.Scp096 }, - { DeathTranslations.Scp173.Id, DamageType.Scp173 }, - { DeathTranslations.Scp207.Id, DamageType.Scp207 }, - { DeathTranslations.Scp939Lunge.Id, DamageType.Scp939 }, - { DeathTranslations.Scp939Other.Id, DamageType.Scp939 }, - { DeathTranslations.Scp3114Slap.Id, DamageType.Scp3114 }, - { DeathTranslations.Tesla.Id, DamageType.Tesla }, - { DeathTranslations.Unknown.Id, DamageType.Unknown }, - { DeathTranslations.Warhead.Id, DamageType.Warhead }, - { DeathTranslations.Zombie.Id, DamageType.Scp0492 }, - { DeathTranslations.BulletWounds.Id, DamageType.Firearm }, - { DeathTranslations.PocketDecay.Id, DamageType.PocketDimension }, - { DeathTranslations.SeveredHands.Id, DamageType.SeveredHands }, - { DeathTranslations.FriendlyFireDetector.Id, DamageType.FriendlyFireDetector }, - { DeathTranslations.UsedAs106Bait.Id, DamageType.FemurBreaker }, - { DeathTranslations.MicroHID.Id, DamageType.MicroHid }, - { DeathTranslations.Hypothermia.Id, DamageType.Hypothermia }, - { DeathTranslations.MarshmallowMan.Id, DamageType.Marshmallow }, - }; - private static readonly Dictionary TranslationConversionInternal = new() { { DeathTranslations.Asphyxiated, DamageType.Asphyxiation }, @@ -104,7 +74,7 @@ public static class DamageTypeExtensions /// /// Gets conversion information between s and s. /// - public static IReadOnlyDictionary TranslationIdConversion => TranslationIdConversionInternal; + public static IReadOnlyDictionary TranslationIdConversion { get; } = TranslationConversionInternal.ToDictionary(x => x.Key.Id, y => y.Value); /// /// Gets conversion information between s and s. @@ -199,28 +169,26 @@ public static DamageType GetDamageType(DamageHandlerBase damageHandlerBase) 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] + return TranslationIdConversion.ContainsKey(scpDamageHandler._translationId) + ? TranslationIdConversion[scpDamageHandler._translationId] : DamageType.Scp; } case UniversalDamageHandler universal: { - DeathTranslation translation = DeathTranslations.TranslationsById[universal.TranslationId]; + if (TranslationIdConversion.ContainsKey(universal.TranslationId)) + return TranslationIdConversion[universal.TranslationId]; - 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."); + Log.Warn($"{nameof(DamageTypeExtensions)}.{nameof(damageHandlerBase)}: No matching {nameof(DamageType)} for {nameof(UniversalDamageHandler)} with ID {universal.TranslationId}, type will be reported as {DamageType.Unknown}. Report this to EXILED Devs."); return DamageType.Unknown; } - } - return DamageType.Unknown; + default: + return DamageType.Unknown; + } } } } From 662d910342506c7af5e942d8b504a6c6222d14e6 Mon Sep 17 00:00:00 2001 From: VALERA771 <72030575+VALERA771@users.noreply.github.com> Date: Mon, 29 Jan 2024 02:50:41 +0300 Subject: [PATCH 045/141] `[Exiled::Events]` Adding `Player::ShowingHitMarker` event (#2395) * new ev * Update ShowingHitMarkerEventArgs.cs Co-authored-by: Nao <60253860+NaoUnderscore@users.noreply.github.com> * Update ShowingHitMarkerEventArgs.cs Co-authored-by: Nao <60253860+NaoUnderscore@users.noreply.github.com> * Update Player.cs Co-authored-by: Nao <60253860+NaoUnderscore@users.noreply.github.com> * Update Player.cs Co-authored-by: Nao <60253860+NaoUnderscore@users.noreply.github.com> * name fix * period fix --------- Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> Co-authored-by: Nao <60253860+NaoUnderscore@users.noreply.github.com> --- .../Player/DisplayingHitmarkerEventArgs.cs | 42 ++++++++++ Exiled.Events/Handlers/Player.cs | 11 +++ .../Patches/Events/Player/ShowingHitMarker.cs | 81 +++++++++++++++++++ 3 files changed, 134 insertions(+) create mode 100644 Exiled.Events/EventArgs/Player/DisplayingHitmarkerEventArgs.cs create mode 100644 Exiled.Events/Patches/Events/Player/ShowingHitMarker.cs diff --git a/Exiled.Events/EventArgs/Player/DisplayingHitmarkerEventArgs.cs b/Exiled.Events/EventArgs/Player/DisplayingHitmarkerEventArgs.cs new file mode 100644 index 0000000000..0fbee673d1 --- /dev/null +++ b/Exiled.Events/EventArgs/Player/DisplayingHitmarkerEventArgs.cs @@ -0,0 +1,42 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Events.EventArgs.Player +{ + using Exiled.API.Features; + using Exiled.Events.EventArgs.Interfaces; + + /// + /// Contains all information before displaying the hitmarker to the player. + /// + public class DisplayingHitmarkerEventArgs : IDeniableEvent, IPlayerEvent + { + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// + public DisplayingHitmarkerEventArgs(Player player, float size, bool isAllowed = true) + { + Player = player; + Size = size; + IsAllowed = isAllowed; + } + + /// + public bool IsAllowed { get; set; } + + /// + public Player Player { get; } + + /// + /// Gets or sets the hitmarker's size. + /// + public float Size { get; set; } + } +} \ No newline at end of file diff --git a/Exiled.Events/Handlers/Player.cs b/Exiled.Events/Handlers/Player.cs index 5d2c161068..bd66fa0798 100644 --- a/Exiled.Events/Handlers/Player.cs +++ b/Exiled.Events/Handlers/Player.cs @@ -522,6 +522,11 @@ public class Player /// public static Event ChangingNickname { get; set; } = new(); + /// + /// Invoked before displaying the hitmarker to the player. + /// + public static Event ShowingHitMarker { get; set; } = new(); + /// /// Called before reserved slot is resolved for a . /// @@ -1112,6 +1117,12 @@ public static void OnItemRemoved(ReferenceHub referenceHub, InventorySystem.Item /// The instance. public static void OnChangingNickname(ChangingNicknameEventArgs ev) => ChangingNickname.InvokeSafely(ev); + /// + /// Called before displaying the hitmarker to the player. + /// + /// The instance. + public static void OnShowingHitMarker(DisplayingHitmarkerEventArgs ev) => ShowingHitMarker.InvokeSafely(ev); + /// /// Called before pre-authenticating a . /// diff --git a/Exiled.Events/Patches/Events/Player/ShowingHitMarker.cs b/Exiled.Events/Patches/Events/Player/ShowingHitMarker.cs new file mode 100644 index 0000000000..4b5dba79d2 --- /dev/null +++ b/Exiled.Events/Patches/Events/Player/ShowingHitMarker.cs @@ -0,0 +1,81 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Events.Patches.Events.Player +{ + 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.Player; + using HarmonyLib; + + using static HarmonyLib.AccessTools; + + /// + /// Patches + /// to add event. + /// + [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.OnShowingHitMarker))] + [HarmonyPatch(typeof(Hitmarker), nameof(Hitmarker.SendHitmarkerDirectly), typeof(ReferenceHub), typeof(float))] + internal class ShowingHitMarker + { + private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) + { + List newInstructions = ListPool.Pool.Get(instructions); + + int index = newInstructions.FindIndex(x => x.opcode == OpCodes.Ldarg_1); + + Label continueLabel = generator.DefineLabel(); + + LocalBuilder ev = generator.DeclareLocal(typeof(DisplayingHitmarkerEventArgs)); + + newInstructions.InsertRange( + index, + new[] + { + // Player.Get(hub); + new CodeInstruction(OpCodes.Ldarg_0).MoveLabelsFrom(newInstructions[index]), + new(OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new[] { typeof(ReferenceHub) })), + + // size + new(OpCodes.Ldarg_1), + + // true + new(OpCodes.Ldc_I4_1), + + // DisplayingHitmarkerEventArgs ev = new(Player, float, true); + new(OpCodes.Newobj, GetDeclaredConstructors(typeof(DisplayingHitmarkerEventArgs))[0]), + new(OpCodes.Dup), + new(OpCodes.Dup), + new(OpCodes.Stloc_S, ev.LocalIndex), + + // Handlers.Player.OnShowingHitMarker(ev); + new(OpCodes.Call, Method(typeof(Handlers.Player), nameof(Handlers.Player.OnShowingHitMarker))), + + // if (!ev.IsAllowed) + // return; + new(OpCodes.Callvirt, PropertyGetter(typeof(DisplayingHitmarkerEventArgs), nameof(DisplayingHitmarkerEventArgs.IsAllowed))), + new(OpCodes.Brtrue_S, continueLabel), + + new(OpCodes.Ret), + + // size = ev.Size; + new CodeInstruction(OpCodes.Ldloc_S, ev.LocalIndex).WithLabels(continueLabel), + new(OpCodes.Callvirt, PropertyGetter(typeof(DisplayingHitmarkerEventArgs), nameof(DisplayingHitmarkerEventArgs.Size))), + new(OpCodes.Starg_S, 1), + }); + + for (int z = 0; z < newInstructions.Count; z++) + yield return newInstructions[z]; + + ListPool.Pool.Return(newInstructions); + } + } +} \ No newline at end of file From 355fa648ecba75f54000668a4fa94a00e0f8b3a0 Mon Sep 17 00:00:00 2001 From: Yamato <66829532+louis1706@users.noreply.github.com> Date: Mon, 29 Jan 2024 00:55:33 +0100 Subject: [PATCH 046/141] Fixed a bug with `SearchingPickup` event caused by NWAPI (#2311) * . * Last * Fully modify transpiler * miss retLabel * MoreInfo * . * Update for PostXMAS (#2383) * Update for PostXMAS * WeaponFixFromXMAS * remove var * Fix RegisteringEvent * more var remove * 8.7.0 * Fix * Dumb * Update SearchingPickupEvent.cs * Update SearchingPickupEvent.cs --- .../Player/SearchingPickupEventArgs.cs | 3 +- .../Events/Player/SearchingPickupEvent.cs | 40 ++++++++----------- 2 files changed, 17 insertions(+), 26 deletions(-) diff --git a/Exiled.Events/EventArgs/Player/SearchingPickupEventArgs.cs b/Exiled.Events/EventArgs/Player/SearchingPickupEventArgs.cs index 6d2366364d..58e9f47628 100644 --- a/Exiled.Events/EventArgs/Player/SearchingPickupEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/SearchingPickupEventArgs.cs @@ -44,7 +44,6 @@ public SearchingPickupEventArgs(Player player, ItemPickupBase pickup, SearchSess SearchSession = searchSession; SearchCompletor = searchCompletor; SearchTime = searchTime; - IsAllowed = searchCompletor.ValidateStart(); } /// @@ -65,7 +64,7 @@ public SearchingPickupEventArgs(Player player, ItemPickupBase pickup, SearchSess /// /// Gets or sets a value indicating whether the Pickup can be searched. /// - public bool IsAllowed { get; set; } + public bool IsAllowed { get; set; } = true; /// /// Gets the Pickup that is being searched. diff --git a/Exiled.Events/Patches/Events/Player/SearchingPickupEvent.cs b/Exiled.Events/Patches/Events/Player/SearchingPickupEvent.cs index 1f3e66447d..cb1de74567 100644 --- a/Exiled.Events/Patches/Events/Player/SearchingPickupEvent.cs +++ b/Exiled.Events/Patches/Events/Player/SearchingPickupEvent.cs @@ -34,22 +34,24 @@ private static IEnumerable Transpiler(IEnumerable newInstructions = ListPool.Pool.Get(instructions); - Label allowLabel = generator.DefineLabel(); + Label retLabel = generator.DefineLabel(); LocalBuilder ev = generator.DeclareLocal(typeof(SearchingPickupEventArgs)); int offset = 1; - int index = newInstructions.FindIndex(instruction => instruction.opcode == OpCodes.Stind_Ref) + offset; + int index = newInstructions.FindIndex(instruction => instruction.opcode == OpCodes.Brtrue_S) + offset; - // remove base-game check and `SearchSession body` setter - newInstructions.RemoveRange(index, 14); + newInstructions[index].labels.Add(retLabel); + + offset = 1; + index = newInstructions.FindIndex(instruction => instruction.opcode == OpCodes.Ret) + offset; newInstructions.InsertRange( index, new[] { // Player.Get(Hub) - new(OpCodes.Ldarg_0), + new CodeInstruction(OpCodes.Ldarg_0).MoveLabelsFrom(newInstructions[index]), new(OpCodes.Callvirt, PropertyGetter(typeof(SearchCoordinator), nameof(SearchCoordinator.Hub))), new(OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new[] { typeof(ReferenceHub) })), @@ -82,27 +84,16 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable i.opcode == OpCodes.Stloc_S && i.operand is LocalBuilder { LocalIndex: 4 }) + offset; + // replace "request.Target.SearchTimeForPlayer(this.Hub);" with ev.SearchTime // remove base-game SearchTime setter newInstructions.RemoveRange(index, 5); @@ -134,4 +126,4 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } } -} \ No newline at end of file +} From cb4577ac661e959acbb3718eed5842623b1ccedc Mon Sep 17 00:00:00 2001 From: Panikorovskii Vladislav <68610520+bladuk@users.noreply.github.com> Date: Mon, 29 Jan 2024 03:39:51 +0300 Subject: [PATCH 047/141] Introduce Radio::IsTransmitting property (#2410) --- Exiled.API/Features/Items/Radio.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Exiled.API/Features/Items/Radio.cs b/Exiled.API/Features/Items/Radio.cs index 3207e085ff..ba1994120b 100644 --- a/Exiled.API/Features/Items/Radio.cs +++ b/Exiled.API/Features/Items/Radio.cs @@ -14,6 +14,8 @@ namespace Exiled.API.Features.Items using Structs; + using VoiceChat.Playbacks; + /// /// A wrapper class for . /// @@ -90,6 +92,11 @@ public bool IsEnabled set => Base._enabled = value; } + /// + /// Gets a value indicating whether or not the radio is transmitting. + /// + public bool IsTransmitting => PersonalRadioPlayback.IsTransmitting(Owner.ReferenceHub); + /// /// Sets the of the given . /// From 9d14934f665ab5df1b5ff1a1f4eee91fd5ae289b Mon Sep 17 00:00:00 2001 From: Naounderscore Date: Mon, 29 Jan 2024 01:45:43 +0100 Subject: [PATCH 048/141] Update ShowingHitMarker.cs --- Exiled.Events/Patches/Events/Player/ShowingHitMarker.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Exiled.Events/Patches/Events/Player/ShowingHitMarker.cs b/Exiled.Events/Patches/Events/Player/ShowingHitMarker.cs index 4b5dba79d2..81c30ffa48 100644 --- a/Exiled.Events/Patches/Events/Player/ShowingHitMarker.cs +++ b/Exiled.Events/Patches/Events/Player/ShowingHitMarker.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using Exiled.API.Features; - using Exiled.API.Features.Pools; + using Exiled.API.Features.Core.Generic.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; using HarmonyLib; From d5cd00f939da557bc42b6d30b314905923357a19 Mon Sep 17 00:00:00 2001 From: Nao <60253860+NaoUnderscore@users.noreply.github.com> Date: Mon, 29 Jan 2024 01:48:05 +0100 Subject: [PATCH 049/141] Add Resonance workflow --- .github/workflows/Resonance.yml | 69 +++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 .github/workflows/Resonance.yml diff --git a/.github/workflows/Resonance.yml b/.github/workflows/Resonance.yml new file mode 100644 index 0000000000..b6adfc4a30 --- /dev/null +++ b/.github/workflows/Resonance.yml @@ -0,0 +1,69 @@ +name: Exiled Resonance CI + +on: + push: + branches: + - apis-rework + pull_request: + branches: + - apis-rework + workflow_dispatch: + +env: + EXILED_REFERENCES_URL: https://misaka-zerotwo.github.io/SL-References/Dev.zip + EXILED_REFERENCES_PATH: ${{ github.workspace }}/References + EXILED_DLL_ARCHIVER_URL: https://github.com/Exiled-Team/EXILED-DLL-Archiver/releases/latest/download/EXILED-DLL-Archiver.exe + +jobs: + + build: + + runs-on: windows-latest + # Prevent double running for push & pull_request events from the main repo + if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != 'Exiled-Team/Exiled' + + steps: + + - name: Setup .NET Core SDK + uses: actions/setup-dotnet@v1.7.2 + + - name: Setup Nuget + uses: iRebbok/setup-nuget@master + + - uses: actions/checkout@v2.3.4 + + - name: Get references + shell: pwsh + run: | + Invoke-WebRequest -Uri ${{ env.EXILED_REFERENCES_URL }} -OutFile ${{ github.workspace }}/References.zip + Expand-Archive -Path References.zip -DestinationPath ${{ env.EXILED_REFERENCES_PATH }} + + - name: Build + env: + EXILED_REFERENCES: ${{ env.EXILED_REFERENCES_PATH }} + shell: pwsh + run: | + ./build.ps1 -BuildNuGet + $File = (Get-ChildItem -Path . -Include 'EXILED.*.nupkg' -Recurse).Name + Out-File -FilePath ${{ github.env }} -InputObject "PackageFile=$File" -Encoding utf-8 -Append + + - name: Upload nuget package + uses: actions/upload-artifact@v2 + with: + name: ${{ env.PackageFile }} + path: ${{ env.PackageFile }} + + - name: Get references + shell: pwsh + run: | + Invoke-WebRequest -Uri ${{ env.EXILED_DLL_ARCHIVER_URL }} -OutFile ${{ github.workspace }}/EXILED-DLL-Archiver.exe + + - name: Packaging results as tar.gz + shell: pwsh + run: ./packaging.ps1 + + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: Build Result + path: bin/Release/Exiled.tar.gz From 699f72c84cf17fc26bdbb635d0eec23a2489b752 Mon Sep 17 00:00:00 2001 From: Nameless <85962933+Misfiy@users.noreply.github.com> Date: Mon, 29 Jan 2024 15:29:18 +0100 Subject: [PATCH 050/141] Player::GetProcessed (#2382) * ye * docs * remove this * index param change * 2nd method * Update Exiled.API/Features/Player.cs Co-authored-by: Nao <60253860+NaoUnderscore@users.noreply.github.com> * Update Exiled.API/Features/Player.cs Co-authored-by: Nao <60253860+NaoUnderscore@users.noreply.github.com> * fix that --------- Co-authored-by: Nao <60253860+NaoUnderscore@users.noreply.github.com> --- Exiled.API/Features/Player.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Exiled.API/Features/Player.cs b/Exiled.API/Features/Player.cs index cf985a1376..7611490e44 100644 --- a/Exiled.API/Features/Player.cs +++ b/Exiled.API/Features/Player.cs @@ -1431,6 +1431,24 @@ public static Player Get(string args) /// A boolean indicating whether or not a player was found. public static bool TryGet(Collider collider, out Player player) => (player = Get(collider)) is not null; + /// + /// Gets an containing all players processed based on the arguments specified. + /// + /// The array segment of strings representing the input arguments to be processed. + /// The starting index within the array segment. + /// 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)); + + /// + /// Gets an containing all players processed based on the arguments specified. + /// + /// The array segment of strings representing the input arguments to be processed. + /// The starting index within the array segment. + /// An representing the processed players. + public static IEnumerable GetProcessedData(ArraySegment args, int startIndex = 0) => GetProcessedData(args, startIndex, out string[] _); + /// /// Adds a player's UserId to the list of reserved slots. /// From da126fee5b23b164d271145481be199e888da6aa Mon Sep 17 00:00:00 2001 From: Nao <60253860+NaoUnderscore@users.noreply.github.com> Date: Mon, 29 Jan 2024 15:29:55 +0100 Subject: [PATCH 051/141] Update Exiled.nuspec --- Exiled/Exiled.nuspec | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Exiled/Exiled.nuspec b/Exiled/Exiled.nuspec index 77d8ad872d..04c0e2cd99 100644 --- a/Exiled/Exiled.nuspec +++ b/Exiled/Exiled.nuspec @@ -43,11 +43,8 @@ - - - - - + + From 252627a3b2a67a5251309b8847bd95ce505d421b Mon Sep 17 00:00:00 2001 From: Naounderscore Date: Wed, 31 Jan 2024 00:46:04 +0100 Subject: [PATCH 052/141] Fixed all typos --- Exiled.API/Features/Input/KeypressInputComponent.cs | 8 ++++---- .../API/Features/CustomAbilities/AbilityInputComponent.cs | 8 ++++---- .../API/Features/CustomRoles/CustomRole.cs | 2 +- Exiled.Events/Patches/Fixes/LockerFixes.cs | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Exiled.API/Features/Input/KeypressInputComponent.cs b/Exiled.API/Features/Input/KeypressInputComponent.cs index ffabacffa5..3d48d2ddb4 100644 --- a/Exiled.API/Features/Input/KeypressInputComponent.cs +++ b/Exiled.API/Features/Input/KeypressInputComponent.cs @@ -56,25 +56,25 @@ protected virtual void BindInputActions() /// /// The input condition, paired to , to be evaluated. /// - /// if the condition was satified; otherwise, . + /// if the condition was satisfied; otherwise, . protected virtual bool InputCondition_KT0() => false; /// /// The input condition, paired to , to be evaluated. /// - /// if the condition was satified; otherwise, . + /// if the condition was satisfied; otherwise, . protected virtual bool InputCondition_KT1() => false; /// /// The input condition, paired to , to be evaluated. /// - /// if the condition was satified; otherwise, . + /// if the condition was satisfied; otherwise, . protected virtual bool InputCondition_KT2() => false; /// /// The input condition, paired to , to be evaluated. /// - /// if the condition was satified; otherwise, . + /// if the condition was satisfied; otherwise, . protected virtual bool InputCondition_KT3() => false; /// diff --git a/Exiled.CustomModules/API/Features/CustomAbilities/AbilityInputComponent.cs b/Exiled.CustomModules/API/Features/CustomAbilities/AbilityInputComponent.cs index e8319f2e84..b7905ee86c 100644 --- a/Exiled.CustomModules/API/Features/CustomAbilities/AbilityInputComponent.cs +++ b/Exiled.CustomModules/API/Features/CustomAbilities/AbilityInputComponent.cs @@ -54,7 +54,7 @@ protected override void UnsubscribeEvents() /// /// defines an action which displays information about the ability. /// - /// if the condition was satified; otherwise, . + /// if the condition was satisfied; otherwise, . protected override bool InputCondition_KT0() => PressCount == 1 && Owner.Role is FpcRole { MoveState: PlayerMovementState.Sneaking }; /// @@ -62,7 +62,7 @@ protected override void UnsubscribeEvents() /// /// defines an action which activates the ability. /// - /// if the condition was satified; otherwise, . + /// if the condition was satisfied; otherwise, . protected override bool InputCondition_KT1() => PressCount == 1; /// @@ -70,7 +70,7 @@ protected override void UnsubscribeEvents() /// /// defines an action which switches backward. /// - /// if the condition was satified; otherwise, . + /// if the condition was satisfied; otherwise, . protected override bool InputCondition_KT2() => PressCount == 2 && Owner.Role is FpcRole { MoveState: PlayerMovementState.Sneaking }; /// @@ -78,7 +78,7 @@ protected override void UnsubscribeEvents() /// /// defines an action which switches forward. /// - /// if the condition was satified; otherwise, . + /// if the condition was satisfied; otherwise, . protected override bool InputCondition_KT3() => PressCount == 2; /// diff --git a/Exiled.CustomModules/API/Features/CustomRoles/CustomRole.cs b/Exiled.CustomModules/API/Features/CustomRoles/CustomRole.cs index b528b082fe..45a7d3068e 100644 --- a/Exiled.CustomModules/API/Features/CustomRoles/CustomRole.cs +++ b/Exiled.CustomModules/API/Features/CustomRoles/CustomRole.cs @@ -80,7 +80,7 @@ public abstract class CustomRole : CustomModule, IAdditiveBehaviour /// /// Gets a value indicating whether a player can spawn as this based on its assigned probability. /// - /// if the probability condition was satified; otherwise, . + /// if the probability condition was satisfied; otherwise, . public bool CanSpawnByProbability => UnityEngine.Random.Range(0, 101) <= Chance; /// diff --git a/Exiled.Events/Patches/Fixes/LockerFixes.cs b/Exiled.Events/Patches/Fixes/LockerFixes.cs index 5a75e20ef6..1dc9dc1f35 100644 --- a/Exiled.Events/Patches/Fixes/LockerFixes.cs +++ b/Exiled.Events/Patches/Fixes/LockerFixes.cs @@ -36,7 +36,7 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } - private static void Hepler(LockerChamber chamber) + private static void Helper(LockerChamber chamber) { chamber._content.Clear(); From 0bdeb1abfd70d3ed63aeb32f8ef40082fa32048c Mon Sep 17 00:00:00 2001 From: Naounderscore Date: Wed, 31 Jan 2024 01:13:26 +0100 Subject: [PATCH 053/141] Fixed some typos and added `Pawn::GlobalRole`, `Pawn::GlobalItems` and `Pawn::GlobalCurrentItem`. --- Exiled.API/Features/Player.cs | 5 ++ Exiled.CustomModules/API/Features/Pawn.cs | 63 +++++++++++++++++-- .../CustomAbilities/AddedAbilityEventArgs.cs | 2 +- 3 files changed, 65 insertions(+), 5 deletions(-) diff --git a/Exiled.API/Features/Player.cs b/Exiled.API/Features/Player.cs index cf985a1376..fa6207d969 100644 --- a/Exiled.API/Features/Player.cs +++ b/Exiled.API/Features/Player.cs @@ -928,7 +928,12 @@ public Item CurrentItem } if (!Inventory.UserInventory.Items.TryGetValue(value.Serial, out _)) + { + if (IsInventoryFull) + return; + AddItem(value.Base); + } Inventory.ServerSelectItem(value.Serial); } diff --git a/Exiled.CustomModules/API/Features/Pawn.cs b/Exiled.CustomModules/API/Features/Pawn.cs index f404870312..7b228d4902 100644 --- a/Exiled.CustomModules/API/Features/Pawn.cs +++ b/Exiled.CustomModules/API/Features/Pawn.cs @@ -5,6 +5,8 @@ // // ----------------------------------------------------------------------- +using Exiled.CustomModules.API.Features.CustomItems.Items; + namespace Exiled.CustomModules.API.Features { using System; @@ -165,10 +167,63 @@ public Pawn(GameObject gameObject) } } + /// + /// Gets the global role of the pawn. + /// + /// It will return a if available, or the if null. + /// + public object GlobalRole => CustomRole ? CustomRole : Role; + + /// + /// Gets the global items associated with the pawn. + /// + /// It will return a combination of standard s and s. + /// + public IEnumerable GlobalItems => Items.Cast().Concat(CustomItems); + + /// + /// Gets or sets the global current item of the pawn. + /// + /// If a is equipped, it returns the ; otherwise, it returns the regular . + /// + public object GlobalCurrentItem + { + get => CurrentCustomItem ? CurrentCustomItem : CurrentItem; + set + { + if (value is null) + { + Inventory.ServerSelectItem(0); + return; + } + + bool isCustomItem = typeof(CustomItem).IsAssignableFrom(value.GetType()); + if (isCustomItem) + { + if (!CustomItems.Any(customItem => customItem.GetType() == value.GetType())) + { + if (IsInventoryFull) + return; + + AddItem(value); + } + + Item customItem = Items.LastOrDefault(i => i.TryGetComponent(out ItemBehaviour behaviour) && behaviour.GetType() == (value as CustomItem).BehaviourComponent); + Inventory.ServerSelectItem(customItem.Serial); + return; + } + + if (value is not Item item) + return; + + CurrentItem = value as Item; + } + } + /// /// Gets a value indicating whether the pawn is any custom SCP. /// - public bool IsCustomScp => CustomRole is not null && CustomRole.IsScp; + public bool IsCustomScp => CustomRole && CustomRole.IsScp; /// /// Gets a of containing all custom items in the pawn's inventory. @@ -219,7 +274,7 @@ public bool HasCustomItem() /// /// The type of the . /// if a of the specified type was found; otherwise, . - public bool HasCustomAbilty() + public bool HasCustomAbility() where T : PlayerAbility => CustomItems.Any(item => item.GetType() == typeof(T)); /// @@ -327,7 +382,7 @@ public void SafeDropItem(Item item) public ushort GetAmmo(uint customAmmoType) => (ushort)(customAmmoBox.TryGetValue(customAmmoType, out ushort amount) ? amount : 0); /// - /// Adds an amount of custom ammos to the pawn's ammo box. + /// Adds an amount of custom ammo to the pawn's ammo box. /// /// The type of the custom ammo. /// The amount to be added. @@ -364,7 +419,7 @@ public bool AddAmmo(uint id, ushort amount) } /// - /// Removes an amount of custom ammos from the pawn's ammo box. + /// Removes an amount of custom ammo from the pawn's ammo box. /// /// The type of the custom ammo. /// The amount to be removed. diff --git a/Exiled.CustomModules/Events/EventArgs/CustomAbilities/AddedAbilityEventArgs.cs b/Exiled.CustomModules/Events/EventArgs/CustomAbilities/AddedAbilityEventArgs.cs index 2991bcd637..5a155f7b56 100644 --- a/Exiled.CustomModules/Events/EventArgs/CustomAbilities/AddedAbilityEventArgs.cs +++ b/Exiled.CustomModules/Events/EventArgs/CustomAbilities/AddedAbilityEventArgs.cs @@ -12,7 +12,7 @@ namespace Exiled.CustomModules.Events.EventArgs.CustomAbilities using Exiled.Events.EventArgs.Interfaces; /// - /// Contains all informations after adding an ability. + /// Contains all information after adding an ability. /// /// The type of the . public class AddedAbilityEventArgs From 7ea502e8bdd7ce0b9ebc53a23f50fe59a5ee7a95 Mon Sep 17 00:00:00 2001 From: Naounderscore Date: Wed, 31 Jan 2024 03:38:53 +0100 Subject: [PATCH 054/141] Added custom `RoleAssigner`. Added `Config::UseDefaultRoleAssigner`. Added `CustomModules::Events::EventArgs::CustomRoles::AssigningHumanRolesEventArgs` and `CustomModules::Events::EventArgs::CustomRoles::AssigningScpRolesEventArgs` events. Added `PreAssigningHumanRolesEventArgs::IsAllowed` and `PreAssigningScpRolesEventArgs::IsAllowed`properties. Fixed some typos. --- .../EventArgs/ProcessingActionEventArgs.cs | 2 +- .../API/Features/CustomRoles/CustomRole.cs | 40 +++- .../API/Features/RoleAssigner.cs | 208 ++++++++++++++++++ Exiled.CustomModules/Config.cs | 6 + Exiled.CustomModules/CustomModules.cs | 7 + .../CustomAbilities/AddingAbilityEventArgs.cs | 2 +- .../RemovedAbilityEventArgs.cs | 2 +- .../RemovingAbilityEventArgs.cs | 2 +- .../CustomEscapes/EscapingEventArgs.cs | 2 +- .../AssigningHumanRolesEventArgs.cs | 32 +++ .../CustomRoles/AssigningScpRolesEventArgs.cs | 45 ++++ .../Tracking/ItemTrackingModifiedEventArgs.cs | 2 +- .../PickupTrackingModifiedEventArgs.cs | 2 +- .../Tracking/TrackingModifiedEventArgs.cs | 2 +- .../Server/PreAssigningHumanRolesEventArgs.cs | 5 +- .../Server/PreAssigningScpRolesEventArgs.cs | 5 +- 16 files changed, 348 insertions(+), 16 deletions(-) create mode 100644 Exiled.CustomModules/API/Features/RoleAssigner.cs create mode 100644 Exiled.CustomModules/Events/EventArgs/CustomRoles/AssigningHumanRolesEventArgs.cs create mode 100644 Exiled.CustomModules/Events/EventArgs/CustomRoles/AssigningScpRolesEventArgs.cs diff --git a/Exiled.API/Features/Input/EventArgs/ProcessingActionEventArgs.cs b/Exiled.API/Features/Input/EventArgs/ProcessingActionEventArgs.cs index 5cb82de53b..b8fcd33614 100644 --- a/Exiled.API/Features/Input/EventArgs/ProcessingActionEventArgs.cs +++ b/Exiled.API/Features/Input/EventArgs/ProcessingActionEventArgs.cs @@ -13,7 +13,7 @@ namespace Exiled.API.Features.Input.EventArgs using Exiled.API.Features.Input; /// - /// Contains all informations before processing an action. + /// Contains all information before processing an action. /// public class ProcessingActionEventArgs : EventArgs { diff --git a/Exiled.CustomModules/API/Features/CustomRoles/CustomRole.cs b/Exiled.CustomModules/API/Features/CustomRoles/CustomRole.cs index 45a7d3068e..f07f4c8d01 100644 --- a/Exiled.CustomModules/API/Features/CustomRoles/CustomRole.cs +++ b/Exiled.CustomModules/API/Features/CustomRoles/CustomRole.cs @@ -83,6 +83,11 @@ public abstract class CustomRole : CustomModule, IAdditiveBehaviour /// if the probability condition was satisfied; otherwise, . public bool CanSpawnByProbability => UnityEngine.Random.Range(0, 101) <= Chance; + /// + /// Gets all instances of this . + /// + public int Instances { get; private set; } + /// /// Gets the 's description. /// @@ -171,6 +176,27 @@ public static CustomRole Get(Type type) => typeof(CustomRole).IsAssignableFrom(type) ? TypeLookupTable[type] : typeof(RoleBehaviour).IsAssignableFrom(type) ? BehaviourLookupTable[type] : null; + /// + /// Gets all instances belonging to the specified . + /// + /// The specified . + /// All instances belonging to the specified . + public static IEnumerable Get(Team team) => List.Where(customRole => RoleExtensions.GetTeam(customRole.Role) == team); + + /// + /// Gets all instances belonging to the specified teams. + /// + /// The specified teams. + /// All instances belonging to the specified teams. + public static IEnumerable Get(IEnumerable teams) => List.Where(customRole => teams.Contains(RoleExtensions.GetTeam(customRole.Role))); + + /// + /// Gets all instances belonging to the specified teams. + /// + /// The specified teams. + /// All instances belonging to the specified teams. + public static IEnumerable Get(params Team[] teams) => List.Where(customRole => teams.Contains(RoleExtensions.GetTeam(customRole.Role))); + /// /// Gets a given the specified . /// @@ -486,6 +512,7 @@ public bool Spawn(Pawn player) player.AddComponent(BehaviourComponent); PlayersValue.Remove(player); PlayersValue.Add(player, this); + Instances += 1; return true; } @@ -518,12 +545,12 @@ public void ForceSpawn(Pawn player) if (!player.IsAlive) { - ForceSpawn_Internal(player); + ForceSpawn_Internal(player, false); return; } player.Role.Set(RoleTypeId.Spectator, SpawnReason.Respawn); - Timing.CallDelayed(0.1f, () => ForceSpawn_Internal(player)); + Timing.CallDelayed(0.1f, () => ForceSpawn_Internal(player, false)); } /// @@ -588,6 +615,7 @@ public void ForceSpawn(Pawn player, bool preservePosition) public bool Eject(Pawn player) { PlayersValue.Remove(player); + Instances -= 1; if (CustomTeam.TryGet(player, out CustomTeam customTeam)) { @@ -677,10 +705,10 @@ internal bool TryUnregister() return true; } - private void ForceSpawn_Internal(Pawn player) => - player.AddComponent(BehaviourComponent, $"ECS-{Name}"); - - private void ForceSpawn_Internal(Pawn player, bool preservePosition) => + private void ForceSpawn_Internal(Pawn player, bool preservePosition) + { + Instances += 1; player.AddComponent(BehaviourComponent, $"ECS-{Name}").Cast().Settings.PreservePosition = preservePosition; + } } } diff --git a/Exiled.CustomModules/API/Features/RoleAssigner.cs b/Exiled.CustomModules/API/Features/RoleAssigner.cs new file mode 100644 index 0000000000..e76f53ecf4 --- /dev/null +++ b/Exiled.CustomModules/API/Features/RoleAssigner.cs @@ -0,0 +1,208 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.CustomModules.API.Features +{ + using System; + using System.Collections.Generic; + using System.Linq; + + using Exiled.API.Extensions; + using Exiled.API.Features; + using Exiled.API.Features.Attributes; + using Exiled.API.Features.Core; + using Exiled.API.Features.DynamicEvents; + using Exiled.API.Features.Items; + using Exiled.API.Features.Pickups; + using Exiled.CustomModules.API.Features.CustomRoles; + using Exiled.CustomModules.API.Interfaces; + using Exiled.CustomModules.Events.EventArgs.CustomItems; + using Exiled.CustomModules.Events.EventArgs.Tracking; + using Exiled.Events.EventArgs.Map; + using Exiled.Events.EventArgs.Player; + using Exiled.Events.EventArgs.Server; + using HarmonyLib; + using PlayerRoles; + using PlayerRoles.RoleAssign; + + using AssigningHumanRolesEventArgs = Exiled.CustomModules.Events.EventArgs.CustomRoles.AssigningHumanRolesEventArgs; + + /// + /// The actor which handles all tracking-related tasks for items. + /// + /// The type of the . + public class RoleAssigner : StaticActor + { + /// + /// Gets the which handles all the delegates fired before assigning human roles. + /// + [DynamicEventDispatcher] + public TDynamicEventDispatcher AssigningHumanRolesDispatcher { get; private set; } + + /// + /// Gets the which handles all the delegates fired before assigning SCP roles. + /// + [DynamicEventDispatcher] + public TDynamicEventDispatcher AssigningScpRolesDispatcher { get; private set; } + + /// + /// Gets or sets all enqueued SCPs. + /// + public List EnqueuedScps { get; protected set; } = new(); + + /// + /// Gets or sets all enqueued humans. + /// + public List EnqueuedHumans { get; protected set; } = new(); + + /// + /// Spawns human players based on the provided queue of teams and the length of the queue. + /// + /// An array of teams representing the queue of teams to spawn. + /// The length of the queue. + public virtual void SpawnHumans(Team[] queue, int queueLength) + { + EnqueuedHumans.Clear(); + + IEnumerable customRoles = CustomRole.Get(queue); + List toSpawn = new(); + + foreach (CustomRole role in customRoles) + { + for (int i = 0; i == role.MaxInstances; i++) + { + if (role.AssignFromRole is RoleTypeId.None || !role.CanSpawnByProbability) + continue; + + toSpawn.AddItem(role.Id); + } + } + + toSpawn.ShuffleList(); + EnqueuedHumans.AddRange(toSpawn.Cast()); + + IEnumerable hubs = ReferenceHub.AllHubs.Where(PlayerRoles.RoleAssign.RoleAssigner.CheckPlayer); + int num = hubs.Count() - toSpawn.Count; + RoleTypeId[] array = num > 0 ? new RoleTypeId[num] : null; + + if (array is not null) + { + for (int i = 0; i < num; i++) + array[i] = HumanSpawner.NextHumanRoleToSpawn; + + array.ShuffleList(); + EnqueuedHumans.AddRange(array.Cast()); + } + + Events.EventArgs.CustomRoles.AssigningHumanRolesEventArgs ev = new(EnqueuedHumans); + AssigningHumanRolesDispatcher.InvokeAll(ev); + EnqueuedHumans = ev.Roles; + + EnqueuedHumans.Where(o => o is uint).ForEach(id => CustomRole.Get((uint)id).Spawn(Player.Get(hubs.Random()).Cast())); + EnqueuedHumans.RemoveAll(o => o is uint); + + for (int j = 0; j < num; j++) + HumanSpawner.AssignHumanRoleToRandomPlayer((RoleTypeId)EnqueuedHumans[j]); + } + + /// RoleTypeId + /// Spawns SCPs based on the target SCP number. + /// + /// The target number of SCPs to spawn. + public virtual void SpawnScps(int targetScpNumber) + { + EnqueuedScps.Clear(); + + IEnumerable customScps = CustomRole.Get(Team.SCPs); + List spawnable = new(); + + foreach (CustomRole scp in customScps) + { + for (int i = 0; i == scp.MaxInstances; i++) + { + if (scp.AssignFromRole is RoleTypeId.None || !scp.CanSpawnByProbability) + continue; + + spawnable.AddItem(scp.Id); + } + } + + spawnable.ShuffleList(); + + if (spawnable.Count > targetScpNumber) + spawnable.RemoveRange(0, spawnable.Count - targetScpNumber); + + EnqueuedScps.AddRange(customScps); + + if (spawnable.Count < targetScpNumber) + { + for (int i = 0; i < targetScpNumber - spawnable.Count; i++) + EnqueuedScps.Add(ScpSpawner.NextScp); + } + + int index = 0; + List chosenPlayers = ScpPlayerPicker.ChoosePlayers(targetScpNumber); + + Events.EventArgs.CustomRoles.AssigningScpRolesEventArgs ev = new(chosenPlayers, EnqueuedScps); + AssigningScpRolesDispatcher.InvokeAll(ev); + EnqueuedScps = ev.Roles; + + foreach (object role in EnqueuedScps.ToList()) + { + if (role is not uint id) + continue; + + ReferenceHub chosenPlayer = chosenPlayers[0]; + Pawn pawn = Player.Get(chosenPlayer).Cast(); + CustomRole.Get(id).Spawn(pawn); + EnqueuedScps.Remove(role); + chosenPlayers.RemoveAt(0); + ++index; + } + + EnqueuedScps.RemoveAll(o => o is uint); + + List enqueuedScps = EnqueuedScps.Cast().ToList(); + while (enqueuedScps.Count > 0 && chosenPlayers.Count > 0) + { + RoleTypeId scp = enqueuedScps[0]; + enqueuedScps.RemoveAt(0); + ScpSpawner.AssignScp(chosenPlayers, scp, enqueuedScps); + } + } + + /// + protected override void SubscribeEvents() + { + base.SubscribeEvents(); + + Exiled.Events.Handlers.Server.PreAssigningHumanRoles += OnPreAssigningHumanRoles; + Exiled.Events.Handlers.Server.PreAssigningScpRoles += OnPreAssigningScpRoles; + } + + /// + protected override void UnsubscribeEvents() + { + base.UnsubscribeEvents(); + + Exiled.Events.Handlers.Server.PreAssigningHumanRoles -= OnPreAssigningHumanRoles; + Exiled.Events.Handlers.Server.PreAssigningScpRoles -= OnPreAssigningScpRoles; + } + + private void OnPreAssigningHumanRoles(PreAssigningHumanRolesEventArgs ev) + { + SpawnHumans(ev.Queue, ev.QueueLength); + ev.IsAllowed = false; + } + + private void OnPreAssigningScpRoles(PreAssigningScpRolesEventArgs ev) + { + SpawnScps(ev.Amount); + ev.IsAllowed = false; + } + } +} \ No newline at end of file diff --git a/Exiled.CustomModules/Config.cs b/Exiled.CustomModules/Config.cs index 3262dbd57d..fa602310dd 100644 --- a/Exiled.CustomModules/Config.cs +++ b/Exiled.CustomModules/Config.cs @@ -26,5 +26,11 @@ public class Config : IConfig /// . [Description("Whether or not debug messages should be shown.")] public bool Debug { get; set; } = false; + + /// + /// Gets or sets a value indicating whether the built-in role assigner should be used over the base game one. + /// + [Description("Whether the built-in role assigner should be used over the base game one.")] + public bool UseDefaultRoleAssigner { get; set; } } } \ No newline at end of file diff --git a/Exiled.CustomModules/CustomModules.cs b/Exiled.CustomModules/CustomModules.cs index d5478f2807..f0878fb582 100644 --- a/Exiled.CustomModules/CustomModules.cs +++ b/Exiled.CustomModules/CustomModules.cs @@ -8,6 +8,8 @@ namespace Exiled.CustomModules { using Exiled.API.Features; + using Exiled.API.Features.Core; + using Exiled.API.Features.Core.Generic; using Exiled.CustomModules.API.Features; using Exiled.CustomModules.EventHandlers; @@ -36,6 +38,9 @@ public override void OnEnabled() { Instance = this; + if (Config.UseDefaultRoleAssigner) + StaticActor.CreateNewInstance(); + SubscribeEvents(); base.OnEnabled(); @@ -44,6 +49,8 @@ public override void OnEnabled() /// public override void OnDisabled() { + StaticActor.Get()?.Destroy(); + UnsubscribeEvents(); base.OnDisabled(); diff --git a/Exiled.CustomModules/Events/EventArgs/CustomAbilities/AddingAbilityEventArgs.cs b/Exiled.CustomModules/Events/EventArgs/CustomAbilities/AddingAbilityEventArgs.cs index 3e97a035ee..4b2b5b19e9 100644 --- a/Exiled.CustomModules/Events/EventArgs/CustomAbilities/AddingAbilityEventArgs.cs +++ b/Exiled.CustomModules/Events/EventArgs/CustomAbilities/AddingAbilityEventArgs.cs @@ -12,7 +12,7 @@ namespace Exiled.CustomModules.Events.EventArgs.CustomAbilities using Exiled.Events.EventArgs.Interfaces; /// - /// Contains all informations before adding an ability. + /// Contains all information before adding an ability. /// /// The type of the . public class AddingAbilityEventArgs : IDeniableEvent diff --git a/Exiled.CustomModules/Events/EventArgs/CustomAbilities/RemovedAbilityEventArgs.cs b/Exiled.CustomModules/Events/EventArgs/CustomAbilities/RemovedAbilityEventArgs.cs index 02335306e0..743d9b43b5 100644 --- a/Exiled.CustomModules/Events/EventArgs/CustomAbilities/RemovedAbilityEventArgs.cs +++ b/Exiled.CustomModules/Events/EventArgs/CustomAbilities/RemovedAbilityEventArgs.cs @@ -12,7 +12,7 @@ namespace Exiled.CustomModules.Events.EventArgs.CustomAbilities using Exiled.Events.EventArgs.Interfaces; /// - /// Contains all informations after removing an ability. + /// Contains all information after removing an ability. /// /// The type of the . public class RemovedAbilityEventArgs diff --git a/Exiled.CustomModules/Events/EventArgs/CustomAbilities/RemovingAbilityEventArgs.cs b/Exiled.CustomModules/Events/EventArgs/CustomAbilities/RemovingAbilityEventArgs.cs index d057fca5cb..48dddb5594 100644 --- a/Exiled.CustomModules/Events/EventArgs/CustomAbilities/RemovingAbilityEventArgs.cs +++ b/Exiled.CustomModules/Events/EventArgs/CustomAbilities/RemovingAbilityEventArgs.cs @@ -12,7 +12,7 @@ namespace Exiled.CustomModules.Events.EventArgs.CustomAbilities using Exiled.Events.EventArgs.Interfaces; /// - /// Contains all informations before removing an ability. + /// Contains all information before removing an ability. /// /// The type of the . public class RemovingAbilityEventArgs : IDeniableEvent diff --git a/Exiled.CustomModules/Events/EventArgs/CustomEscapes/EscapingEventArgs.cs b/Exiled.CustomModules/Events/EventArgs/CustomEscapes/EscapingEventArgs.cs index 8733e45adc..8e83207e8e 100644 --- a/Exiled.CustomModules/Events/EventArgs/CustomEscapes/EscapingEventArgs.cs +++ b/Exiled.CustomModules/Events/EventArgs/CustomEscapes/EscapingEventArgs.cs @@ -14,7 +14,7 @@ namespace Exiled.CustomModules.Events.EventArgs.CustomEscapes using PlayerRoles; /// - /// Contains all informations before escaping. + /// Contains all information before escaping. /// public class EscapingEventArgs : IPlayerEvent, IDeniableEvent { diff --git a/Exiled.CustomModules/Events/EventArgs/CustomRoles/AssigningHumanRolesEventArgs.cs b/Exiled.CustomModules/Events/EventArgs/CustomRoles/AssigningHumanRolesEventArgs.cs new file mode 100644 index 0000000000..aea680502f --- /dev/null +++ b/Exiled.CustomModules/Events/EventArgs/CustomRoles/AssigningHumanRolesEventArgs.cs @@ -0,0 +1,32 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.CustomModules.Events.EventArgs.CustomRoles +{ + using System.Collections.Generic; + + using API.Enums; + using Exiled.Events.EventArgs.Interfaces; + using PlayerRoles; + + /// + /// Contains all information before assigning human roles. + /// + public class AssigningHumanRolesEventArgs : IExiledEvent + { + /// + /// Initializes a new instance of the class. + /// + /// + public AssigningHumanRolesEventArgs(List roles) => Roles = roles; + + /// + /// Gets or sets all roles to be assigned. + /// + public List Roles { get; set; } + } +} \ No newline at end of file diff --git a/Exiled.CustomModules/Events/EventArgs/CustomRoles/AssigningScpRolesEventArgs.cs b/Exiled.CustomModules/Events/EventArgs/CustomRoles/AssigningScpRolesEventArgs.cs new file mode 100644 index 0000000000..68a0c8c925 --- /dev/null +++ b/Exiled.CustomModules/Events/EventArgs/CustomRoles/AssigningScpRolesEventArgs.cs @@ -0,0 +1,45 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.CustomModules.Events.EventArgs.CustomRoles +{ + using System.Collections.Generic; + using System.Linq; + + using API.Enums; + using API.Features; + using Exiled.API.Features; + using Exiled.Events.EventArgs.Interfaces; + using PlayerRoles; + + /// + /// Contains all information before assigning SCP roles. + /// + public class AssigningScpRolesEventArgs : IExiledEvent + { + /// + /// Initializes a new instance of the class. + /// + /// + /// + public AssigningScpRolesEventArgs(List chosenPlayers, List enqueuedScps) + { + Players = Player.Get(chosenPlayers).ToList(); + Roles = enqueuedScps; + } + + /// + /// Gets or sets the players to be spawned. + /// + public List Players { get; set; } + + /// + /// Gets or sets all roles to be assigned. + /// + public List Roles { get; set; } + } +} \ No newline at end of file diff --git a/Exiled.CustomModules/Events/EventArgs/Tracking/ItemTrackingModifiedEventArgs.cs b/Exiled.CustomModules/Events/EventArgs/Tracking/ItemTrackingModifiedEventArgs.cs index e1d7a1026a..81e38ad053 100644 --- a/Exiled.CustomModules/Events/EventArgs/Tracking/ItemTrackingModifiedEventArgs.cs +++ b/Exiled.CustomModules/Events/EventArgs/Tracking/ItemTrackingModifiedEventArgs.cs @@ -17,7 +17,7 @@ namespace Exiled.CustomModules.Events.EventArgs.Tracking using Exiled.Events.EventArgs.Interfaces; /// - /// Contains all informations after modifying an item tracking. + /// Contains all information after modifying an item tracking. /// public class ItemTrackingModifiedEventArgs : TrackingModifiedEventArgs, IItemEvent { diff --git a/Exiled.CustomModules/Events/EventArgs/Tracking/PickupTrackingModifiedEventArgs.cs b/Exiled.CustomModules/Events/EventArgs/Tracking/PickupTrackingModifiedEventArgs.cs index e7922df2eb..1dbbcc2df3 100644 --- a/Exiled.CustomModules/Events/EventArgs/Tracking/PickupTrackingModifiedEventArgs.cs +++ b/Exiled.CustomModules/Events/EventArgs/Tracking/PickupTrackingModifiedEventArgs.cs @@ -15,7 +15,7 @@ namespace Exiled.CustomModules.Events.EventArgs.Tracking using Exiled.Events.EventArgs.Interfaces; /// - /// Contains all informations after modifying a pickup tracking. + /// Contains all information after modifying a pickup tracking. /// public class PickupTrackingModifiedEventArgs : TrackingModifiedEventArgs, IPickupEvent { diff --git a/Exiled.CustomModules/Events/EventArgs/Tracking/TrackingModifiedEventArgs.cs b/Exiled.CustomModules/Events/EventArgs/Tracking/TrackingModifiedEventArgs.cs index c76a029cf7..0631f83061 100644 --- a/Exiled.CustomModules/Events/EventArgs/Tracking/TrackingModifiedEventArgs.cs +++ b/Exiled.CustomModules/Events/EventArgs/Tracking/TrackingModifiedEventArgs.cs @@ -14,7 +14,7 @@ namespace Exiled.CustomModules.Events.EventArgs.Tracking using Exiled.Events.EventArgs.Interfaces; /// - /// Contains all informations after modifying a tracking. + /// Contains all information after modifying a tracking. /// public class TrackingModifiedEventArgs : IExiledEvent { diff --git a/Exiled.Events/EventArgs/Server/PreAssigningHumanRolesEventArgs.cs b/Exiled.Events/EventArgs/Server/PreAssigningHumanRolesEventArgs.cs index a41e74a5f0..a2a5b706c0 100644 --- a/Exiled.Events/EventArgs/Server/PreAssigningHumanRolesEventArgs.cs +++ b/Exiled.Events/EventArgs/Server/PreAssigningHumanRolesEventArgs.cs @@ -16,7 +16,7 @@ namespace Exiled.Events.EventArgs.Server /// /// Contains all information before setting up the environment for the assignment of human roles. /// - public class PreAssigningHumanRolesEventArgs : IExiledEvent + public class PreAssigningHumanRolesEventArgs : IExiledEvent, IDeniableEvent { /// /// Initializes a new instance of the class. @@ -38,5 +38,8 @@ public PreAssigningHumanRolesEventArgs(Team[] queue, int queueLength) /// Gets or sets the human queue length. /// public int QueueLength { get; set; } + + /// + public bool IsAllowed { get; set; } = true; } } \ No newline at end of file diff --git a/Exiled.Events/EventArgs/Server/PreAssigningScpRolesEventArgs.cs b/Exiled.Events/EventArgs/Server/PreAssigningScpRolesEventArgs.cs index 7300affe18..eb5dbccf29 100644 --- a/Exiled.Events/EventArgs/Server/PreAssigningScpRolesEventArgs.cs +++ b/Exiled.Events/EventArgs/Server/PreAssigningScpRolesEventArgs.cs @@ -16,7 +16,7 @@ namespace Exiled.Events.EventArgs.Server /// /// Contains all information before setting up the environment for the assignment of SCP roles. /// - public class PreAssigningScpRolesEventArgs : IExiledEvent + public class PreAssigningScpRolesEventArgs : IExiledEvent, IDeniableEvent { /// /// Initializes a new instance of the class. @@ -28,5 +28,8 @@ public class PreAssigningScpRolesEventArgs : IExiledEvent /// Gets or sets the amount of SCPs to be spawned. /// public int Amount { get; set; } + + /// + public bool IsAllowed { get; set; } = true; } } \ No newline at end of file From 28865a05dcc718c07198a7445fc7d424ae0ac6d4 Mon Sep 17 00:00:00 2001 From: Naounderscore Date: Wed, 31 Jan 2024 03:40:20 +0100 Subject: [PATCH 055/141] Removed useless `using` --- Exiled.CustomModules/API/Features/RoleAssigner.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/Exiled.CustomModules/API/Features/RoleAssigner.cs b/Exiled.CustomModules/API/Features/RoleAssigner.cs index e76f53ecf4..4d03fbfef3 100644 --- a/Exiled.CustomModules/API/Features/RoleAssigner.cs +++ b/Exiled.CustomModules/API/Features/RoleAssigner.cs @@ -29,8 +29,6 @@ namespace Exiled.CustomModules.API.Features using PlayerRoles; using PlayerRoles.RoleAssign; - using AssigningHumanRolesEventArgs = Exiled.CustomModules.Events.EventArgs.CustomRoles.AssigningHumanRolesEventArgs; - /// /// The actor which handles all tracking-related tasks for items. /// From de436643cf77cdae19beb5d2672cafaa52c2d64e Mon Sep 17 00:00:00 2001 From: Yamato Date: Wed, 31 Jan 2024 17:26:37 +0100 Subject: [PATCH 056/141] 8.7.1 --- EXILED.props | 2 +- .../DamageHandlers/AttackerDamageHandler.cs | 2 +- Exiled.API/Features/Toys/AdminToy.cs | 28 ++++++++++++++++++ Exiled.API/Structs/PrimitiveSettings.cs | 29 ++++++++++++++++++- .../Map/ExplodingGrenadeEventArgs.cs | 2 +- .../Patches/Generic/IndividualFriendlyFire.cs | 10 +++---- 6 files changed, 64 insertions(+), 9 deletions(-) diff --git a/EXILED.props b/EXILED.props index 13849fa582..b33a703792 100644 --- a/EXILED.props +++ b/EXILED.props @@ -15,7 +15,7 @@ - 8.7.0 + 8.7.1 false diff --git a/Exiled.API/Features/DamageHandlers/AttackerDamageHandler.cs b/Exiled.API/Features/DamageHandlers/AttackerDamageHandler.cs index 0750c9d5be..b7d51716a2 100644 --- a/Exiled.API/Features/DamageHandlers/AttackerDamageHandler.cs +++ b/Exiled.API/Features/DamageHandlers/AttackerDamageHandler.cs @@ -99,7 +99,7 @@ public override void ProcessDamage(Player player) if ((player != Attacker) && !ForceFullFriendlyFire) { - if (HitboxIdentity.CheckFriendlyFire(AttackerFootprint.Role, player.Role, true)) + if (HitboxIdentity.IsEnemy(AttackerFootprint.Role, player.Role)) return; Damage *= PlayerStatsSystem.AttackerDamageHandler._ffMultiplier; diff --git a/Exiled.API/Features/Toys/AdminToy.cs b/Exiled.API/Features/Toys/AdminToy.cs index 090605b46b..4e506c632d 100644 --- a/Exiled.API/Features/Toys/AdminToy.cs +++ b/Exiled.API/Features/Toys/AdminToy.cs @@ -13,6 +13,7 @@ namespace Exiled.API.Features.Toys using Enums; using Exiled.API.Interfaces; + using Footprinting; using Mirror; using UnityEngine; @@ -45,6 +46,24 @@ internal AdminToy(AdminToyBase toyAdminToyBase, AdminToyType type) /// public AdminToyType ToyType { get; } + /// + /// Gets or sets who spawn the Primitive AdminToy. + /// + public Player Player + { + get => Player.Get(Footprint); + set => Footprint = value.Footprint; + } + + /// + /// Gets or sets the Footprint of the player who spawned the AdminToy. + /// + public Footprint Footprint + { + get => AdminToyBase.SpawnerFootprint; + set => AdminToyBase.SpawnerFootprint = value; + } + /// /// Gets or sets the position of the toy. /// @@ -85,6 +104,15 @@ public byte MovementSmoothing set => AdminToyBase.NetworkMovementSmoothing = value; } + /// + /// Gets or sets a value indicating whether IsStatic. + /// + public bool IsStatic + { + get => AdminToyBase.IsStatic; + set => AdminToyBase.IsStatic = value; + } + /// /// Gets the belonging to the . /// diff --git a/Exiled.API/Structs/PrimitiveSettings.cs b/Exiled.API/Structs/PrimitiveSettings.cs index bfc8032da8..933b0c81d6 100644 --- a/Exiled.API/Structs/PrimitiveSettings.cs +++ b/Exiled.API/Structs/PrimitiveSettings.cs @@ -23,7 +23,8 @@ public struct PrimitiveSettings /// The rotation of the primitive. /// The scale of the primitive. /// Whether or not the primitive should be spawned. - public PrimitiveSettings(PrimitiveType primitiveType, Color color, Vector3 position, Vector3 rotation, Vector3 scale, bool spawn) + /// Whether or not the primitive should be static. + public PrimitiveSettings(PrimitiveType primitiveType, Color color, Vector3 position, Vector3 rotation, Vector3 scale, bool spawn, bool isStatic) { PrimitiveType = primitiveType; Color = color; @@ -31,6 +32,27 @@ public PrimitiveSettings(PrimitiveType primitiveType, Color color, Vector3 posit Rotation = rotation; Scale = scale; Spawn = spawn; + IsStatic = isStatic; + } + + /// + /// Initializes a new instance of the struct. + /// + /// The type of the primitive. + /// The color of the primitive. + /// The position of the primitive. + /// The rotation of the primitive. + /// The scale of the primitive. + /// Whether or not the primitive should be spawned. + public PrimitiveSettings(PrimitiveType primitiveType, Color color, Vector3 position, Vector3 rotation, Vector3 scale, bool spawn) + { + PrimitiveType = primitiveType; + Color = color; + Position = position; + Rotation = rotation; + Scale = scale; + Spawn = spawn; + IsStatic = false; } /// @@ -58,6 +80,11 @@ public PrimitiveSettings(PrimitiveType primitiveType, Color color, Vector3 posit /// public Vector3 Scale { get; } + /// + /// Gets a value indicating whether or not the primitive should be spawned. + /// + public bool IsStatic { get; } + /// /// Gets a value indicating whether or not the primitive should be spawned. /// diff --git a/Exiled.Events/EventArgs/Map/ExplodingGrenadeEventArgs.cs b/Exiled.Events/EventArgs/Map/ExplodingGrenadeEventArgs.cs index 7fadaccfbe..b8e1fec768 100644 --- a/Exiled.Events/EventArgs/Map/ExplodingGrenadeEventArgs.cs +++ b/Exiled.Events/EventArgs/Map/ExplodingGrenadeEventArgs.cs @@ -67,7 +67,7 @@ public ExplodingGrenadeEventArgs(Footprint thrower, Vector3 position, ExplosionG break; case true: { - if (Server.FriendlyFire || thrower.Hub == Server.Host.ReferenceHub || HitboxIdentity.CheckFriendlyFire(thrower.Role, hub.roleManager.CurrentRole.RoleTypeId)) + if (Server.FriendlyFire || thrower.Hub == Server.Host.ReferenceHub || HitboxIdentity.IsEnemy(thrower.Role, hub.roleManager.CurrentRole.RoleTypeId)) { if (!TargetsToAffect.Contains(player)) TargetsToAffect.Add(player); diff --git a/Exiled.Events/Patches/Generic/IndividualFriendlyFire.cs b/Exiled.Events/Patches/Generic/IndividualFriendlyFire.cs index addee3ea8f..1100d39ca1 100644 --- a/Exiled.Events/Patches/Generic/IndividualFriendlyFire.cs +++ b/Exiled.Events/Patches/Generic/IndividualFriendlyFire.cs @@ -89,7 +89,7 @@ public static bool CheckFriendlyFirePlayerRules(Footprint attackerFootprint, Ref // Return false, no custom friendly fire allowed, default to NW logic for FF. No point in processing if FF is enabled across the board. if (Server.FriendlyFire) - return HitboxIdentity.CheckFriendlyFire(attackerFootprint.Role, victimHub.roleManager.CurrentRole.RoleTypeId); + return HitboxIdentity.IsEnemy(attackerFootprint.Role, victimHub.roleManager.CurrentRole.RoleTypeId); // always allow damage from Server.Host if (attackerFootprint.Hub == Server.Host.ReferenceHub) @@ -98,7 +98,7 @@ public static bool CheckFriendlyFirePlayerRules(Footprint attackerFootprint, Ref // Only check friendlyFire if the FootPrint hasn't changed (Fix for Grenade not dealing damage because it's from a dead player) // TODO rework FriendlyFireRule to make it compatible with Footprint if (!attackerFootprint.SameLife(new(attackerFootprint.Hub))) - return HitboxIdentity.CheckFriendlyFire(attackerFootprint.Role, victimHub.roleManager.CurrentRole.RoleTypeId); + return HitboxIdentity.IsEnemy(attackerFootprint.Role, victimHub.roleManager.CurrentRole.RoleTypeId); if (attackerFootprint.Hub is null || victimHub is null) { @@ -170,14 +170,14 @@ public static bool CheckFriendlyFirePlayerRules(Footprint attackerFootprint, Ref Log.Error($"CheckFriendlyFirePlayerRules failed to handle friendly fire because: {ex}"); } - return HitboxIdentity.CheckFriendlyFire(attackerFootprint.Role, victimHub.roleManager.CurrentRole.RoleTypeId); + return HitboxIdentity.IsEnemy(attackerFootprint.Role, victimHub.roleManager.CurrentRole.RoleTypeId); } } /// - /// Patches . + /// Patches . /// - [HarmonyPatch(typeof(HitboxIdentity), nameof(HitboxIdentity.CheckFriendlyFire), typeof(ReferenceHub), typeof(ReferenceHub), typeof(bool))] + [HarmonyPatch(typeof(HitboxIdentity), nameof(HitboxIdentity.IsDamageable), typeof(ReferenceHub), typeof(ReferenceHub))] internal static class HitboxIdentityCheckFriendlyFire { private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) From 3110db2056423063f3ddbc27b7a4b9f5893ef8f5 Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Wed, 31 Jan 2024 18:04:15 +0100 Subject: [PATCH 057/141] Fix build errors and docs. --- Exiled.CustomModules/API/Features/Pawn.cs | 3 +- .../API/Features/RoleAssigner.cs | 3 +- .../Player/DisplayingHitmarkerEventArgs.cs | 9 ++- .../Patches/Events/Player/ShowingHitMarker.cs | 79 ++++++++++--------- 4 files changed, 52 insertions(+), 42 deletions(-) diff --git a/Exiled.CustomModules/API/Features/Pawn.cs b/Exiled.CustomModules/API/Features/Pawn.cs index 7b228d4902..0a1704d8d1 100644 --- a/Exiled.CustomModules/API/Features/Pawn.cs +++ b/Exiled.CustomModules/API/Features/Pawn.cs @@ -5,8 +5,6 @@ // // ----------------------------------------------------------------------- -using Exiled.CustomModules.API.Features.CustomItems.Items; - namespace Exiled.CustomModules.API.Features { using System; @@ -24,6 +22,7 @@ namespace Exiled.CustomModules.API.Features using Exiled.CustomModules.API.Features.CustomAbilities; using Exiled.CustomModules.API.Features.CustomEscapes; using Exiled.CustomModules.API.Features.CustomItems; + using Exiled.CustomModules.API.Features.CustomItems.Items; using Exiled.CustomModules.API.Features.CustomItems.Pickups.Ammos; using Exiled.CustomModules.API.Features.CustomRoles; using Exiled.CustomModules.API.Features.PlayerAbilities; diff --git a/Exiled.CustomModules/API/Features/RoleAssigner.cs b/Exiled.CustomModules/API/Features/RoleAssigner.cs index 4d03fbfef3..c863473f84 100644 --- a/Exiled.CustomModules/API/Features/RoleAssigner.cs +++ b/Exiled.CustomModules/API/Features/RoleAssigner.cs @@ -30,9 +30,8 @@ namespace Exiled.CustomModules.API.Features using PlayerRoles.RoleAssign; /// - /// The actor which handles all tracking-related tasks for items. + /// The actor which handles all role assignment tasks for roles. /// - /// The type of the . public class RoleAssigner : StaticActor { /// diff --git a/Exiled.Events/EventArgs/Player/DisplayingHitmarkerEventArgs.cs b/Exiled.Events/EventArgs/Player/DisplayingHitmarkerEventArgs.cs index 0fbee673d1..f210101890 100644 --- a/Exiled.Events/EventArgs/Player/DisplayingHitmarkerEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/DisplayingHitmarkerEventArgs.cs @@ -20,11 +20,13 @@ public class DisplayingHitmarkerEventArgs : IDeniableEvent, IPlayerEvent /// /// /// + /// /// - public DisplayingHitmarkerEventArgs(Player player, float size, bool isAllowed = true) + public DisplayingHitmarkerEventArgs(Player player, float size, bool playAudio, bool isAllowed = true) { Player = player; Size = size; + PlayAudio = playAudio; IsAllowed = isAllowed; } @@ -34,6 +36,11 @@ public DisplayingHitmarkerEventArgs(Player player, float size, bool isAllowed = /// public Player Player { get; } + /// + /// Gets or sets a value indicating whether audio should be played. + /// + public bool PlayAudio { get; set; } + /// /// Gets or sets the hitmarker's size. /// diff --git a/Exiled.Events/Patches/Events/Player/ShowingHitMarker.cs b/Exiled.Events/Patches/Events/Player/ShowingHitMarker.cs index 81c30ffa48..79945d183d 100644 --- a/Exiled.Events/Patches/Events/Player/ShowingHitMarker.cs +++ b/Exiled.Events/Patches/Events/Player/ShowingHitMarker.cs @@ -19,11 +19,11 @@ namespace Exiled.Events.Patches.Events.Player using static HarmonyLib.AccessTools; /// - /// Patches + /// Patches /// to add event. /// [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.OnShowingHitMarker))] - [HarmonyPatch(typeof(Hitmarker), nameof(Hitmarker.SendHitmarkerDirectly), typeof(ReferenceHub), typeof(float))] + [HarmonyPatch(typeof(Hitmarker), nameof(Hitmarker.SendHitmarkerDirectly), typeof(ReferenceHub), typeof(float), typeof(bool))] internal class ShowingHitMarker { private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) @@ -36,41 +36,46 @@ private static IEnumerable Transpiler(IEnumerable Date: Wed, 31 Jan 2024 18:47:25 +0100 Subject: [PATCH 058/141] Removed `Exiled::CustomItems` --- Exiled.CustomItems/API/Extensions.cs | 89 -- .../API/Features/CustomArmor.cs | 111 -- .../API/Features/CustomGrenade.cs | 212 --- Exiled.CustomItems/API/Features/CustomItem.cs | 1153 ----------------- .../API/Features/CustomWeapon.cs | 313 ----- Exiled.CustomItems/Commands/Give.cs | 123 -- Exiled.CustomItems/Commands/Info.cs | 83 -- Exiled.CustomItems/Commands/List/List.cs | 52 - .../Commands/List/Registered.cs | 73 -- Exiled.CustomItems/Commands/List/Tracked.cs | 96 -- Exiled.CustomItems/Commands/Main.cs | 54 - Exiled.CustomItems/Commands/Spawn.cs | 107 -- Exiled.CustomItems/Config.cs | 40 - Exiled.CustomItems/CustomItems.cs | 62 - Exiled.CustomItems/Exiled.CustomItems.csproj | 52 - 15 files changed, 2620 deletions(-) delete mode 100644 Exiled.CustomItems/API/Extensions.cs delete mode 100644 Exiled.CustomItems/API/Features/CustomArmor.cs delete mode 100644 Exiled.CustomItems/API/Features/CustomGrenade.cs delete mode 100644 Exiled.CustomItems/API/Features/CustomItem.cs delete mode 100644 Exiled.CustomItems/API/Features/CustomWeapon.cs delete mode 100644 Exiled.CustomItems/Commands/Give.cs delete mode 100644 Exiled.CustomItems/Commands/Info.cs delete mode 100644 Exiled.CustomItems/Commands/List/List.cs delete mode 100644 Exiled.CustomItems/Commands/List/Registered.cs delete mode 100644 Exiled.CustomItems/Commands/List/Tracked.cs delete mode 100644 Exiled.CustomItems/Commands/Main.cs delete mode 100644 Exiled.CustomItems/Commands/Spawn.cs delete mode 100644 Exiled.CustomItems/Config.cs delete mode 100644 Exiled.CustomItems/CustomItems.cs delete mode 100644 Exiled.CustomItems/Exiled.CustomItems.csproj diff --git a/Exiled.CustomItems/API/Extensions.cs b/Exiled.CustomItems/API/Extensions.cs deleted file mode 100644 index 07f6ed2ef0..0000000000 --- a/Exiled.CustomItems/API/Extensions.cs +++ /dev/null @@ -1,89 +0,0 @@ -// ----------------------------------------------------------------------- -// -// Copyright (c) Exiled Team. All rights reserved. -// Licensed under the CC BY-SA 3.0 license. -// -// ----------------------------------------------------------------------- - -namespace Exiled.CustomItems.API -{ - using System; - using System.Collections.Generic; - - using Exiled.API.Features; - using Exiled.API.Features.Items; - using Exiled.CustomItems.API.Features; - - /// - /// A collection of API methods. - /// - public static class Extensions - { - /// - /// Resets the player's inventory to the provided list of items and/or customitems names, clearing any items it already possess. - /// - /// The player to which items will be given. - /// The new items that have to be added to the inventory. - /// Indicates a value whether will be called when the player receives the or not. - public static void ResetInventory(this Player player, IEnumerable newItems, bool displayMessage = false) - { - foreach (Item item in player.Items) - { - if (CustomItem.TryGet(item, out CustomItem? customItem)) - customItem?.TrackedSerials.Remove(item.Serial); - } - - player.ClearInventory(); - - foreach (string item in newItems) - { - if (Enum.TryParse(item, true, out ItemType parsedItem)) - { - player.AddItem(parsedItem); - } - else if (!CustomItem.TryGive(player, item, displayMessage)) - { - Log.Debug($"\"{item}\" is not a valid item name, nor a custom item name."); - } - } - } - - /// - /// Registers an of s. - /// - /// s to be registered. - public static void Register(this IEnumerable customItems) - { - if (customItems is null) - throw new ArgumentNullException("customItems"); - - foreach (CustomItem customItem in customItems) - customItem.TryRegister(); - } - - /// - /// Registers a . - /// - /// The to be registered. - public static void Register(this CustomItem item) => item.TryRegister(); - - /// - /// Unregisters an of s. - /// - /// s to be unregistered. - public static void Unregister(this IEnumerable customItems) - { - if (customItems is null) - throw new ArgumentNullException("customItems"); - - foreach (CustomItem customItem in customItems) - customItem.TryUnregister(); - } - - /// - /// Unregisters a . - /// - /// The to be unregistered. - public static void Unregister(this CustomItem item) => item.TryUnregister(); - } -} \ No newline at end of file diff --git a/Exiled.CustomItems/API/Features/CustomArmor.cs b/Exiled.CustomItems/API/Features/CustomArmor.cs deleted file mode 100644 index b41051f12e..0000000000 --- a/Exiled.CustomItems/API/Features/CustomArmor.cs +++ /dev/null @@ -1,111 +0,0 @@ -// ----------------------------------------------------------------------- -// -// Copyright (c) Exiled Team. All rights reserved. -// Licensed under the CC BY-SA 3.0 license. -// -// ----------------------------------------------------------------------- - -namespace Exiled.CustomItems.API.Features -{ - using System; - using System.ComponentModel; - - using Exiled.API.Extensions; - using Exiled.API.Features; - using Exiled.API.Features.Items; - using Exiled.Events.EventArgs.Player; - - using MEC; - - /// - /// The Custom Armor base class. - /// - public abstract class CustomArmor : CustomItem - { - /// - /// Gets or sets the to use for this armor. - /// - public override ItemType Type - { - get => base.Type; - set - { - if (!value.IsArmor() && (value != ItemType.None)) - throw new ArgumentOutOfRangeException("Type", value, "Invalid armor type."); - - base.Type = value; - } - } - - /// - /// Gets or sets how much faster stamina will drain when wearing this armor. - /// - [Description("The value must be above 1 and below 2")] - public virtual float StaminaUseMultiplier { get; set; } = 1.15f; - - /// - /// Gets or sets how strong the helmet on the armor is. - /// - [Description("The value must be above 0 and below 100")] - public virtual int HelmetEfficacy { get; set; } = 80; - - /// - /// Gets or sets how strong the vest on the armor is. - /// - [Description("The value must be above 0 and below 100")] - public virtual int VestEfficacy { get; set; } = 80; - - /// - public override void Give(Player player, bool displayMessage = true) - { - Armor armor = (Armor)Item.Create(Type); - - armor.Weight = Weight; - armor.StaminaUseMultiplier = StaminaUseMultiplier; - - armor.VestEfficacy = VestEfficacy; - armor.HelmetEfficacy = HelmetEfficacy; - - player.AddItem(armor); - - TrackedSerials.Add(armor.Serial); - - Timing.CallDelayed(0.05f, () => OnAcquired(player, armor, displayMessage)); - - if (displayMessage) - ShowPickedUpMessage(player); - } - - /// - protected override void SubscribeEvents() - { - Exiled.Events.Handlers.Player.PickingUpItem += OnInternalPickingUpItem; - base.SubscribeEvents(); - } - - /// - protected override void UnsubscribeEvents() - { - Exiled.Events.Handlers.Player.PickingUpItem -= OnInternalPickingUpItem; - base.UnsubscribeEvents(); - } - - private void OnInternalPickingUpItem(PickingUpItemEventArgs ev) - { - if (!Check(ev.Pickup) || ev.Player.Items.Count >= 8 || ev.Pickup is Exiled.API.Features.Pickups.BodyArmorPickup) - return; - - OnPickingUp(ev); - - if (!ev.IsAllowed) - return; - - ev.IsAllowed = false; - - TrackedSerials.Remove(ev.Pickup.Serial); - ev.Pickup.Destroy(); - - Give(ev.Player); - } - } -} \ No newline at end of file diff --git a/Exiled.CustomItems/API/Features/CustomGrenade.cs b/Exiled.CustomItems/API/Features/CustomGrenade.cs deleted file mode 100644 index bb818ad7b0..0000000000 --- a/Exiled.CustomItems/API/Features/CustomGrenade.cs +++ /dev/null @@ -1,212 +0,0 @@ -// ----------------------------------------------------------------------- -// -// Copyright (c) Exiled Team. All rights reserved. -// Licensed under the CC BY-SA 3.0 license. -// -// ----------------------------------------------------------------------- - -namespace Exiled.CustomItems.API.Features -{ - using System; - - 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.Items; - using InventorySystem.Items.Pickups; - using InventorySystem.Items.ThrowableProjectiles; - using Mirror; - using UnityEngine; - - using Object = UnityEngine.Object; - using Server = Exiled.API.Features.Server; - - /// - /// The Custom Grenade base class. - /// - public abstract class CustomGrenade : CustomItem - { - /// - /// Gets or sets the to use for this item. - /// - public override ItemType Type - { - get => base.Type; - set - { - if (!value.IsThrowable() && value != ItemType.None) - throw new ArgumentOutOfRangeException("Type", value, "Invalid grenade type."); - - base.Type = value; - } - } - - /// - /// Gets or sets a value indicating whether gets or sets a value that determines if the grenade should explode immediately when contacting any surface. - /// - public abstract bool ExplodeOnCollision { get; set; } - - /// - /// Gets or sets a value indicating how long the grenade's fuse time should be. - /// - public abstract float FuseTime { get; set; } - - /// - /// Throw the CustomGrenade object. - /// - /// The position to throw at. - /// The amount of force to throw with. - /// The Weight of the Grenade. - /// The FuseTime of the grenade. - /// The of the grenade to spawn. - /// The to count as the thrower of the grenade. - /// 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.Role.Is(out FpcRole fpcRole); - Vector3 velocity = fpcRole.FirstPersonController.FpcModule.Motor.Velocity; - - Throwable throwable = (Throwable)Item.Create(grenadeType, player); - - ThrownProjectile thrownProjectile = Object.Instantiate(throwable.Base.Projectile, position, throwable.Owner.CameraTransform.rotation); - - PickupSyncInfo newInfo = new() - { - ItemId = throwable.Type, - Locked = !throwable.Base._repickupable, - Serial = ItemSerialGenerator.GenerateNext(), - WeightKg = weight, - }; - if (thrownProjectile is TimeGrenade time) - time._fuseTime = fuseTime; - thrownProjectile.NetworkInfo = newInfo; - thrownProjectile.PreviousOwner = new Footprint(throwable.Owner.ReferenceHub); - 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), force, throwable.Base.FullThrowSettings.UpwardsFactor); - thrownProjectile.ServerActivate(); - - return Pickup.Get(thrownProjectile); - } - - /// - /// Checks to see if the grenade is a custom grenade. - /// - /// The grenade to check. - /// True if it is a custom grenade. - public virtual bool Check(Projectile grenade) => grenade is not null && TrackedSerials.Contains(grenade.Serial); - - /// - protected override void SubscribeEvents() - { - Exiled.Events.Handlers.Player.ThrowingRequest += OnInternalThrowingRequest; - Exiled.Events.Handlers.Player.ThrownProjectile += OnInternalThrownProjectile; - Exiled.Events.Handlers.Map.ExplodingGrenade += OnInternalExplodingGrenade; - Exiled.Events.Handlers.Map.ChangedIntoGrenade += OnInternalChangedIntoGrenade; - - base.SubscribeEvents(); - } - - /// - protected override void UnsubscribeEvents() - { - Exiled.Events.Handlers.Player.ThrowingRequest -= OnInternalThrowingRequest; - Exiled.Events.Handlers.Player.ThrownProjectile -= OnInternalThrownProjectile; - Exiled.Events.Handlers.Map.ExplodingGrenade -= OnInternalExplodingGrenade; - Exiled.Events.Handlers.Map.ChangedIntoGrenade -= OnInternalChangedIntoGrenade; - - base.UnsubscribeEvents(); - } - - /// - /// Handles tracking thrown requests by custom grenades. - /// - /// . - protected virtual void OnThrowingRequest(ThrowingRequestEventArgs ev) - { - } - - /// - /// Handles tracking thrown custom grenades. - /// - /// . - protected virtual void OnThrownProjectile(ThrownProjectileEventArgs ev) - { - } - - /// - /// Handles tracking exploded custom grenades. - /// - /// . - protected virtual void OnExploding(ExplodingGrenadeEventArgs ev) - { - } - - /// - /// Handles the tracking of custom grenade pickups that are changed into live grenades by a frag grenade explosion. - /// - /// . - protected virtual void OnChangedIntoGrenade(ChangedIntoGrenadeEventArgs ev) - { - } - - private void OnInternalThrowingRequest(ThrowingRequestEventArgs ev) - { - if (!Check(ev.Player.CurrentItem)) - return; - - Log.Debug($"{ev.Player.Nickname} has thrown a {Name}!"); - - OnThrowingRequest(ev); - return; - } - - private void OnInternalThrownProjectile(ThrownProjectileEventArgs ev) - { - if (!Check(ev.Throwable)) - return; - - OnThrownProjectile(ev); - - if (ev.Projectile is TimeGrenadeProjectile timeGrenade) - timeGrenade.FuseTime = FuseTime; - - if (ExplodeOnCollision) - ev.Projectile.GameObject.AddComponent().Init((ev.Player ?? Server.Host).GameObject, ev.Projectile.Base); - } - - private void OnInternalExplodingGrenade(ExplodingGrenadeEventArgs ev) - { - if (Check(ev.Projectile)) - { - Log.Debug($"A {Name} is exploding!!"); - OnExploding(ev); - } - } - - private void OnInternalChangedIntoGrenade(ChangedIntoGrenadeEventArgs ev) - { - if (!Check(ev.Pickup)) - return; - - if (ev.Projectile is TimeGrenadeProjectile timedGrenade) - timedGrenade.FuseTime = FuseTime; - - OnChangedIntoGrenade(ev); - - if (ExplodeOnCollision) - ev.Projectile.GameObject.AddComponent().Init((ev.Pickup.PreviousOwner ?? Server.Host).GameObject, ev.Projectile.Base); - } - } -} diff --git a/Exiled.CustomItems/API/Features/CustomItem.cs b/Exiled.CustomItems/API/Features/CustomItem.cs deleted file mode 100644 index b31271dfba..0000000000 --- a/Exiled.CustomItems/API/Features/CustomItem.cs +++ /dev/null @@ -1,1153 +0,0 @@ -// ----------------------------------------------------------------------- -// -// Copyright (c) Exiled Team. All rights reserved. -// Licensed under the CC BY-SA 3.0 license. -// -// ----------------------------------------------------------------------- - -namespace Exiled.CustomItems.API.Features -{ - using System; - using System.Collections; - using System.Collections.Generic; - using System.Linq; - using System.Reflection; - - using Exiled.API.Enums; - using Exiled.API.Extensions; - using Exiled.API.Features; - using Exiled.API.Features.Attributes; - using Exiled.API.Features.Pickups; - using Exiled.API.Features.Pools; - using Exiled.API.Features.Spawn; - using Exiled.API.Interfaces; - using Exiled.CustomItems.API.EventArgs; - using Exiled.Events.EventArgs.Player; - using Exiled.Events.EventArgs.Scp914; - using Exiled.Loader; - - using InventorySystem.Items.Firearms; - using InventorySystem.Items.Pickups; - - using MapGeneration.Distributors; - - 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; - - /// - /// The Custom Item base class. - /// - public abstract class CustomItem - { - private static Dictionary typeLookupTable = new(); - private static Dictionary stringLookupTable = new(); - private static Dictionary idLookupTable = new(); - - private ItemType type = ItemType.None; - - /// - /// Gets the list of current Item Managers. - /// - public static HashSet Registered { get; } = new(); - - /// - /// Gets or sets the custom ItemID of the item. - /// - public abstract uint Id { get; set; } - - /// - /// Gets or sets the name of the item. - /// - public abstract string Name { get; set; } - - /// - /// Gets or sets the description of the item. - /// - public abstract string Description { get; set; } - - /// - /// Gets or sets the weight of the item. - /// - public abstract float Weight { get; set; } - - /// - /// Gets or sets the list of spawn locations and chances for each one. - /// - public abstract SpawnProperties SpawnProperties { get; set; } - - /// - /// Gets or sets the scale of the item. - /// - public virtual Vector3 Scale { get; set; } = Vector3.one; - - /// - /// Gets or sets the ItemType to use for this item. - /// - public virtual ItemType Type - { - get => type; - set - { - if (!Enum.IsDefined(typeof(ItemType), value)) - throw new ArgumentOutOfRangeException("Type", value, "Invalid Item type."); - - type = value; - } - } - - /// - /// Gets the list of custom items inside players' inventory being tracked as the current item. - /// - [YamlIgnore] - public HashSet TrackedSerials { get; } = new(); - - /// - /// Gets a value indicating whether or not this item causes things to happen that may be considered hacks, and thus be shown to global moderators as being present in a player's inventory when they gban them. - /// - [YamlIgnore] - public virtual bool ShouldMessageOnGban { get; } = false; - - /// - /// Gets a with a specific ID. - /// - /// The ID. - /// The matching the search, if not registered. - [Obsolete("Use Get(uint) instead.", true)] - public static CustomItem Get(int id) - { - if (!idLookupTable.ContainsKey((uint)id)) - idLookupTable.Add((uint)id, Registered.FirstOrDefault(i => i.Id == id)); - return idLookupTable[(uint)id]; - } - - /// - /// Gets a with a specific ID. - /// - /// The ID. - /// The matching the search, if not registered. - public static CustomItem Get(uint id) - { - if (!idLookupTable.ContainsKey(id)) - idLookupTable.Add(id, Registered.FirstOrDefault(i => i.Id == id)); - return idLookupTable[id]; - } - - /// - /// Gets a with a specific name. - /// - /// The name. - /// The matching the search, if not registered. - public static CustomItem Get(string name) - { - if (!stringLookupTable.ContainsKey(name)) - stringLookupTable.Add(name, Registered.FirstOrDefault(i => i.Name == name)); - return stringLookupTable[name]; - } - - /// - /// Gets a with a specific type. - /// - /// The type. - /// The matching the search, if not registered. - public static CustomItem Get(Type t) - { - if (!typeLookupTable.ContainsKey(t)) - typeLookupTable.Add(t, Registered.FirstOrDefault(i => i.GetType() == t)); - return typeLookupTable[t]; - } - - /// - /// Tries to get a with a specific ID. - /// - /// The ID to look for. - /// The found , if not registered. - /// Returns a value indicating whether the was found or not. - public static bool TryGet(uint id, out CustomItem customItem) - { - customItem = Get(id); - - return customItem is not null; - } - - /// - /// Tries to get a with a specific name. - /// - /// The name to look for. - /// The found , if not registered. - /// Returns a value indicating whether the was found or not. - public static bool TryGet(string name, out CustomItem customItem) - { - customItem = null; - if (string.IsNullOrEmpty(name)) - return false; - - customItem = uint.TryParse(name, out uint id) ? Get(id) : Get(name); - - return customItem is not null; - } - - /// - /// Tries to get a with a specific type. - /// - /// The of the item to look for. - /// The found , if not registered. - /// Returns a value indicating whether the was found or not. - public static bool TryGet(Type t, out CustomItem customItem) - { - customItem = Get(t); - - return customItem is not null; - } - - /// - /// Tries to get the player's current in their hand. - /// - /// The to check. - /// The in their hand. - /// Returns a value indicating whether the has a in their hand or not. - public static bool TryGet(Player player, out CustomItem customItem) - { - customItem = null; - if (player is null) - return false; - - customItem = Registered?.FirstOrDefault(tempCustomItem => tempCustomItem.Check(player.CurrentItem)); - - return customItem is not null; - } - - /// - /// Tries to get the player's of . - /// - /// The to check. - /// The player's of . - /// Returns a value indicating whether the has a in their hand or not. - public static bool TryGet(Player player, out IEnumerable customItems) - { - customItems = Enumerable.Empty(); - if (player is null) - return false; - - customItems = Registered.Where(tempCustomItem => player.Items.Any(tempCustomItem.Check)); - - return customItems.Any(); - } - - /// - /// Checks to see if this item is a custom item. - /// - /// The to check. - /// The this item is. - /// True if the item is a custom item. - public static bool TryGet(Item item, out CustomItem customItem) - { - customItem = item == null ? null : Registered?.FirstOrDefault(tempCustomItem => tempCustomItem.TrackedSerials.Contains(item.Serial)); - - return customItem is not null; - } - - /// - /// Checks if this pickup is a custom item. - /// - /// The to check. - /// The this pickup is. - /// True if the pickup is a custom item. - public static bool TryGet(Pickup pickup, out CustomItem customItem) - { - customItem = Registered?.FirstOrDefault(tempCustomItem => tempCustomItem.TrackedSerials.Contains(pickup.Serial)); - - return customItem is not null; - } - - /// - /// Tries to spawn a specific at a specific position. - /// - /// The ID of the to spawn. - /// The location to spawn the item. - /// The instance of the . - /// Returns a value indicating whether the was spawned or not. - public static bool TrySpawn(uint id, Vector3 position, out Pickup pickup) - { - pickup = default; - - if (!TryGet(id, out CustomItem item)) - return false; - - pickup = item?.Spawn(position); - - return true; - } - - /// - /// Tries to spawn a specific at a specific position. - /// - /// The name of the to spawn. - /// The location to spawn the item. - /// The instance of the . - /// Returns a value indicating whether the was spawned or not. - public static bool TrySpawn(string name, Vector3 position, out Pickup pickup) - { - pickup = default; - - if (!TryGet(name, out CustomItem item)) - return false; - - pickup = item?.Spawn(position, null); - - return true; - } - - /// - /// Gives to a specific a specic . - /// - /// The to give the item to. - /// The name of the to give. - /// Indicates a value whether will be called when the player receives the or not. - /// Returns a value indicating if the player was given the or not. - public static bool TryGive(Player player, string name, bool displayMessage = true) - { - if (!TryGet(name, out CustomItem item)) - return false; - - item?.Give(player, displayMessage); - - return true; - } - - /// - /// Gives to a specific a specic . - /// - /// The to give the item to. - /// The IDs of the to give. - /// Indicates a value whether will be called when the player receives the or not. - /// Returns a value indicating if the player was given the or not. - public static bool TryGive(Player player, uint id, bool displayMessage = true) - { - if (!TryGet(id, out CustomItem item)) - return false; - - item?.Give(player, displayMessage); - - return true; - } - - /// - /// Gives to a specific a specic . - /// - /// The to give the item to. - /// The of the item to give. - /// Indicates a value whether will be called when the player receives the or not. - /// Returns a value indicating if the player was given the or not. - public static bool TryGive(Player player, Type t, bool displayMessage = true) - { - if (!TryGet(t, out CustomItem item)) - return false; - - item?.Give(player, displayMessage); - - return true; - } - - /// - /// Registers all the 's present in the current assembly. - /// - /// Whether or not reflection is skipped (more efficient if you are not using your custom item classes as config objects). - /// The class to search properties for, if different from the plugin's config class. - /// A of which contains all registered 's. - public static IEnumerable RegisterItems(bool skipReflection = false, object overrideClass = null) - { - List items = new(); - Assembly assembly = Assembly.GetCallingAssembly(); - foreach (Type type in assembly.GetTypes()) - { - if ((type.BaseType != typeof(CustomItem) && !type.IsSubclassOf(typeof(CustomItem))) || type.GetCustomAttribute(typeof(CustomItemAttribute)) is null) - continue; - - foreach (Attribute attribute in type.GetCustomAttributes(typeof(CustomItemAttribute), true).Cast()) - { - CustomItem customItem = null; - bool flag = false; - - if (!skipReflection && Server.PluginAssemblies.ContainsKey(assembly)) - { - IPlugin plugin = Server.PluginAssemblies[assembly]; - foreach (PropertyInfo property in overrideClass?.GetType().GetProperties() ?? plugin.Config.GetType().GetProperties()) - { - if (property.PropertyType != type) - { - if (property.GetValue(overrideClass ?? plugin.Config) is IEnumerable enumerable) - { - List list = ListPool.Pool.Get(); - foreach (object item in enumerable) - { - if (item is CustomItem ci) - list.Add(ci); - } - - foreach (CustomItem item in list) - { - if (item.GetType() != type) - break; - - if (item.Type == ItemType.None) - item.Type = ((CustomItemAttribute)attribute).ItemType; - - if (!item.TryRegister()) - continue; - - flag = true; - items.Add(item); - } - - ListPool.Pool.Return(list); - } - - continue; - } - - customItem = property.GetValue(overrideClass ?? plugin.Config) as CustomItem; - } - } - - if (flag) - continue; - - customItem ??= (CustomItem)Activator.CreateInstance(type); - - if (customItem.Type == ItemType.None) - customItem.Type = ((CustomItemAttribute)attribute).ItemType; - - if (customItem.TryRegister()) - items.Add(customItem); - } - } - - return items; - } - - /// - /// Registers all the 's present in the current assembly. - /// - /// The of containing the target types. - /// A value indicating whether the target types should be ignored. - /// Whether or not reflection is skipped (more efficient if you are not using your custom item classes as config objects). - /// The class to search properties for, if different from the plugin's config class. - /// A of which contains all registered 's. - public static IEnumerable RegisterItems(IEnumerable targetTypes, bool isIgnored = false, bool skipReflection = false, object overrideClass = null) - { - List items = new(); - Assembly assembly = Assembly.GetCallingAssembly(); - foreach (Type type in assembly.GetTypes()) - { - if ((type.BaseType != typeof(CustomItem) && !type.IsSubclassOf(typeof(CustomItem))) || type.GetCustomAttribute(typeof(CustomItemAttribute)) is null || - (isIgnored && targetTypes.Contains(type)) || (!isIgnored && !targetTypes.Contains(type))) - continue; - - foreach (Attribute attribute in type.GetCustomAttributes(typeof(CustomItemAttribute), true).Cast()) - { - CustomItem customItem = null; - - if (!skipReflection && Server.PluginAssemblies.ContainsKey(assembly)) - { - IPlugin plugin = Server.PluginAssemblies[assembly]; - - foreach (PropertyInfo property in overrideClass?.GetType().GetProperties() ?? plugin.Config.GetType().GetProperties()) - { - if (property.PropertyType != type) - continue; - - customItem = property.GetValue(overrideClass ?? plugin.Config) as CustomItem; - break; - } - } - - customItem ??= (CustomItem)Activator.CreateInstance(type); - - if (customItem.Type == ItemType.None) - customItem.Type = ((CustomItemAttribute)attribute).ItemType; - - if (customItem.TryRegister()) - items.Add(customItem); - } - } - - return items; - } - - /// - /// Unregisters all the 's present in the current assembly. - /// - /// A of which contains all unregistered 's. - public static IEnumerable UnregisterItems() - { - List unregisteredItems = new(); - - foreach (CustomItem customItem in Registered) - { - customItem.TryUnregister(); - unregisteredItems.Add(customItem); - } - - return unregisteredItems; - } - - /// - /// Unregisters all the 's present in the current assembly. - /// - /// The of containing the target types. - /// A value indicating whether the target types should be ignored. - /// A of which contains all unregistered 's. - public static IEnumerable UnregisterItems(IEnumerable targetTypes, bool isIgnored = false) - { - List unregisteredItems = new(); - - foreach (CustomItem customItem in Registered) - { - if ((targetTypes.Contains(customItem.GetType()) && isIgnored) || (!targetTypes.Contains(customItem.GetType()) && !isIgnored)) - continue; - - customItem.TryUnregister(); - unregisteredItems.Add(customItem); - } - - return unregisteredItems; - } - - /// - /// Unregisters all the 's present in the current assembly. - /// - /// The of containing the target items. - /// A value indicating whether the target items should be ignored. - /// A of which contains all unregistered 's. - public static IEnumerable UnregisterItems(IEnumerable targetItems, bool isIgnored = false) => UnregisterItems(targetItems.Select(x => x.GetType()), isIgnored); - - /// - /// Spawns the in a specific location. - /// - /// The x coordinate. - /// The y coordinate. - /// The z coordinate. - /// The wrapper of the spawned . - public virtual Pickup Spawn(float x, float y, float z) => Spawn(new Vector3(x, y, z)); - - /// - /// Spawns a as a in a specific location. - /// - /// The x coordinate. - /// The y coordinate. - /// The z coordinate. - /// The to be spawned as a . - /// The wrapper of the spawned . - public virtual Pickup Spawn(float x, float y, float z, Item item) => Spawn(new Vector3(x, y, z), item); - - /// - /// Spawns the where a specific is, and optionally sets the previous owner. - /// - /// The position where the will be spawned. - /// The previous owner of the pickup, can be null. - /// The of the spawned . - public virtual Pickup Spawn(Player player, Player previousOwner = null) => Spawn(player.Position, previousOwner); - - /// - /// Spawns a as a where a specific is, and optionally sets the previous owner. - /// - /// The position where the will be spawned. - /// The to be spawned as a . - /// The previous owner of the pickup, can be null. - /// The of the spawned . - public virtual Pickup Spawn(Player player, Item item, Player previousOwner = null) => Spawn(player.Position, item, previousOwner); - - /// - /// Spawns the in a specific position. - /// - /// The where the will be spawned. - /// The of the item. Can be null. - /// The of the spawned . - public virtual Pickup Spawn(Vector3 position, Player previousOwner = null) => Spawn(position, Item.Create(Type), previousOwner); - - /// - /// Spawns the in a specific position. - /// - /// The where the will be spawned. - /// The to be spawned as a . - /// The of the item. Can be null. - /// The of the spawned . - public virtual Pickup Spawn(Vector3 position, Item item, Player previousOwner = null) - { - Pickup pickup = item.CreatePickup(position); - pickup.Scale = Scale; - pickup.Weight = Weight; - - if (previousOwner is not null) - pickup.PreviousOwner = previousOwner; - - TrackedSerials.Add(pickup.Serial); - - return pickup; - } - - /// - /// Spawns s inside . - /// - /// The spawn points . - /// The spawn limit. - /// Returns the number of spawned items. - public virtual uint Spawn(IEnumerable spawnPoints, uint limit) - { - uint spawned = 0; - - foreach (SpawnPoint spawnPoint in spawnPoints) - { - Log.Debug($"Attempting to spawn {Name} at {spawnPoint.Position}."); - - if (Loader.Random.NextDouble() * 100 >= spawnPoint.Chance || (limit > 0 && spawned >= limit)) - continue; - - spawned++; - - if (spawnPoint is DynamicSpawnPoint dynamicSpawnPoint && dynamicSpawnPoint.Location == SpawnLocationType.InsideLocker) - { - for (int i = 0; i < 50; i++) - { - if (Map.Lockers is null) - { - Log.Debug($"{nameof(Spawn)}: Locker list is null."); - continue; - } - - Locker locker = - Map.Lockers[ - Loader.Random.Next(Map.Lockers.Count)]; - - if (locker is null) - { - Log.Debug($"{nameof(Spawn)}: Selected locker is null."); - continue; - } - - if (locker.Loot is null) - { - Log.Debug($"{nameof(Spawn)}: Invalid locker location. Attempting to find a new one.."); - continue; - } - - if (locker.Chambers is null) - { - Log.Debug($"{nameof(Spawn)}: Locker chambers is null"); - continue; - } - - LockerChamber chamber = locker.Chambers[Loader.Random.Next(Mathf.Max(0, locker.Chambers.Length - 1))]; - - if (chamber is null) - { - Log.Debug($"{nameof(Spawn)}: chamber is null"); - continue; - } - - Vector3 position = chamber._spawnpoint.transform.position; - Spawn(position, null); - Log.Debug($"Spawned {Name} at {position} ({spawnPoint.Name})"); - - break; - } - } - else if (spawnPoint is RoleSpawnPoint roleSpawnPoint) - { - Spawn(roleSpawnPoint.Role.GetRandomSpawnLocation().Position, null); - } - else - { - Pickup pickup = Spawn(spawnPoint.Position, null); - if (pickup.Base is BaseFirearmPickup firearmPickup && this is CustomWeapon customWeapon) - { - firearmPickup.Status = new FirearmStatus(customWeapon.ClipSize, firearmPickup.Status.Flags, firearmPickup.Status.Attachments); - firearmPickup.NetworkStatus = firearmPickup.Status; - } - - Log.Debug($"Spawned {Name} at {spawnPoint.Position} ({spawnPoint.Name})"); - } - } - - return spawned; - } - - /// - /// Spawns all items at their dynamic and static positions. - /// - public virtual void SpawnAll() - { - if (SpawnProperties is null) - return; - - // This will go over each spawn property type (static, dynamic and role) to try and spawn the item. - // It will attempt to spawn in role-based locations, and then dynamic ones, and finally static. - // Math.Min is used here to ensure that our recursive Spawn() calls do not result in exceeding the spawn limit config. - // This is the same as: - // int spawned = 0; - // spawned += Spawn(SpawnProperties.RoleSpawnPoints, SpawnProperties.Limit); - // if (spawned < SpawnProperties.Limit) - // spawned += Spawn(SpawnProperties.DynamicSpawnPoints, SpawnProperties.Limit - spawned); - // if (spawned < SpawnProperties.Limit) - // Spawn(SpawnProperties.StaticSpawnPoints, SpawnProperties.Limit - spawned); - Spawn(SpawnProperties.StaticSpawnPoints, Math.Min(0, SpawnProperties.Limit - Math.Min(0, Spawn(SpawnProperties.DynamicSpawnPoints, SpawnProperties.Limit) - Spawn(SpawnProperties.RoleSpawnPoints, SpawnProperties.Limit)))); - } - - /// - /// Gives an as a to a . - /// - /// The who will receive the item. - /// The to be given. - /// Indicates whether or not will be called when the player receives the item. - public virtual void Give(Player player, Item item, bool displayMessage = true) - { - try - { - Log.Debug($"{Name}.{nameof(Give)}: Item Serial: {item.Serial} Ammo: {(item is Firearm firearm ? firearm.Ammo : -1)}"); - - player.AddItem(item); - - Log.Debug($"{nameof(Give)}: Adding {item.Serial} to tracker."); - if (!TrackedSerials.Contains(item.Serial)) - TrackedSerials.Add(item.Serial); - - Timing.CallDelayed(0.05f, () => OnAcquired(player, item, displayMessage)); - } - catch (Exception e) - { - Log.Error($"{nameof(Give)}: {e}"); - } - } - - /// - /// Gives a as a to a . - /// - /// The who will receive the item. - /// The to be given. - /// Indicates whether or not will be called when the player receives the item. - public virtual void Give(Player player, Pickup pickup, bool displayMessage = true) => Give(player, player.AddItem(pickup), displayMessage); - - /// - /// Gives the to a player. - /// - /// The who will receive the item. - /// Indicates whether or not will be called when the player receives the item. - public virtual void Give(Player player, bool displayMessage = true) => Give(player, Item.Create(Type), displayMessage); - - /// - /// Called when the item is registered. - /// - public virtual void Init() - { - typeLookupTable.Add(GetType(), this); - stringLookupTable.Add(Name, this); - idLookupTable.Add(Id, this); - - SubscribeEvents(); - } - - /// - /// Called when the item is unregistered. - /// - public virtual void Destroy() - { - UnsubscribeEvents(); - - typeLookupTable.Remove(GetType()); - stringLookupTable.Remove(Name); - idLookupTable.Remove(Id); - } - - /// - /// Checks the specified pickup to see if it is a custom item. - /// - /// The to check. - /// True if it is a custom item. - public virtual bool Check(Pickup pickup) => pickup is not null && TrackedSerials.Contains(pickup.Serial); - - /// - /// Checks the specified inventory item to see if it is a custom item. - /// - /// The to check. - /// True if it is a custom item. - public virtual bool Check(Item item) => item is not null && TrackedSerials.Contains(item.Serial); - - /// - /// Checks the specified player's current item to see if it is a custom item. - /// - /// The who's current item should be checked. - /// True if it is a custom item. - public virtual bool Check(Player player) => Check(player?.CurrentItem); - - /// - public override string ToString() => $"[{Name} ({Type}) | {Id}] {Description}"; - - /// - /// Registers a . - /// - /// Returns a value indicating whether the was registered or not. - internal bool TryRegister() - { - if (!Instance?.Config.IsEnabled ?? false) - return false; - - Log.Debug($"Trying to register {Name} ({Id})."); - if (!Registered.Contains(this)) - { - Log.Debug("Registered items doesn't contain this item yet.."); - if (Registered.Any(customItem => customItem.Id == Id)) - { - Log.Warn($"{Name} has tried to register with the same custom item ID as another item: {Id}. It will not be registered."); - - return false; - } - - Log.Debug("Adding item to registered list.."); - Registered.Add(this); - - Init(); - - Log.Debug($"{Name} ({Id}) [{Type}] has been successfully registered."); - - return true; - } - - Log.Warn($"Couldn't register {Name} ({Id}) [{Type}] as it already exists."); - - return false; - } - - /// - /// Tries to unregister a . - /// - /// Returns a value indicating whether the was unregistered or not. - internal bool TryUnregister() - { - Destroy(); - - if (!Registered.Remove(this)) - { - Log.Warn($"Cannot unregister {Name} ({Id}) [{Type}], it hasn't been registered yet."); - - return false; - } - - return true; - } - - /// - /// Called after the manager is initialized, to allow loading of special event handlers. - /// - protected virtual void SubscribeEvents() - { - Exiled.Events.Handlers.Player.Dying += OnInternalOwnerDying; - Exiled.Events.Handlers.Player.DroppingItem += OnInternalDropping; - Exiled.Events.Handlers.Player.ChangingItem += OnInternalChanging; - Exiled.Events.Handlers.Player.Escaping += OnInternalOwnerEscaping; - Exiled.Events.Handlers.Player.PickingUpItem += OnInternalPickingUp; - Exiled.Events.Handlers.Player.ItemAdded += OnInternalItemAdded; - Exiled.Events.Handlers.Scp914.UpgradingPickup += OnInternalUpgradingPickup; - Exiled.Events.Handlers.Server.WaitingForPlayers += OnWaitingForPlayers; - Exiled.Events.Handlers.Player.Handcuffing += OnInternalOwnerHandcuffing; - Exiled.Events.Handlers.Player.ChangingRole += OnInternalOwnerChangingRole; - Exiled.Events.Handlers.Scp914.UpgradingInventoryItem += OnInternalUpgradingInventoryItem; - } - - /// - /// Called when the manager is being destroyed, to allow unloading of special event handlers. - /// - protected virtual void UnsubscribeEvents() - { - Exiled.Events.Handlers.Player.Dying -= OnInternalOwnerDying; - Exiled.Events.Handlers.Player.DroppingItem -= OnInternalDropping; - Exiled.Events.Handlers.Player.ChangingItem -= OnInternalChanging; - Exiled.Events.Handlers.Player.Escaping -= OnInternalOwnerEscaping; - Exiled.Events.Handlers.Player.PickingUpItem -= OnInternalPickingUp; - Exiled.Events.Handlers.Player.ItemAdded -= OnInternalItemAdded; - Exiled.Events.Handlers.Scp914.UpgradingPickup -= OnInternalUpgradingPickup; - Exiled.Events.Handlers.Server.WaitingForPlayers -= OnWaitingForPlayers; - Exiled.Events.Handlers.Player.Handcuffing -= OnInternalOwnerHandcuffing; - Exiled.Events.Handlers.Player.ChangingRole -= OnInternalOwnerChangingRole; - Exiled.Events.Handlers.Scp914.UpgradingInventoryItem -= OnInternalUpgradingInventoryItem; - } - - /// - /// Handles tracking items when they a player changes their role. - /// - /// . - protected virtual void OnOwnerChangingRole(OwnerChangingRoleEventArgs ev) - { - } - - /// - /// Handles making sure custom items are not "lost" when a player dies. - /// - /// . - protected virtual void OnOwnerDying(OwnerDyingEventArgs ev) - { - } - - /// - /// Handles making sure custom items are not "lost" when a player escapes. - /// - /// . - protected virtual void OnOwnerEscaping(OwnerEscapingEventArgs ev) - { - } - - /// - /// Handles making sure custom items are not "lost" when being handcuffed. - /// - /// . - protected virtual void OnOwnerHandcuffing(OwnerHandcuffingEventArgs ev) - { - } - - /// - /// Handles tracking items when they are dropped by a player. - /// - /// . - protected virtual void OnDropping(DroppingItemEventArgs ev) - { - } - - /// - /// Handles tracking items when they are picked up by a player. - /// - /// . - protected virtual void OnPickingUp(PickingUpItemEventArgs ev) - { - } - - /// - /// Handles tracking items when they are selected in the player's inventory. - /// - /// . - protected virtual void OnChanging(ChangingItemEventArgs ev) => ShowSelectedMessage(ev.Player); - - /// - /// Handles making sure custom items are not affected by SCP-914. - /// - /// . - protected virtual void OnUpgrading(UpgradingEventArgs ev) - { - } - - /// - protected virtual void OnUpgrading(UpgradingItemEventArgs ev) - { - } - - /// - /// Called anytime the item enters a player's inventory by any means. - /// - /// The acquiring the item. - /// The being acquired. - /// Whether or not the Pickup hint should be displayed. - protected virtual void OnAcquired(Player player, Item item, bool displayMessage) - { - if (displayMessage) - ShowPickedUpMessage(player); - } - - /// - /// Clears the lists of item uniqIDs and Pickups since any still in the list will be invalid. - /// - protected virtual void OnWaitingForPlayers() - { - TrackedSerials.Clear(); - } - - /// - /// Shows a message to the player upon picking up a custom item. - /// - /// The who will be shown the message. - protected virtual void ShowPickedUpMessage(Player player) - { - if (Instance!.Config.PickedUpHint.Show) - player.ShowHint(string.Format(Instance.Config.PickedUpHint.Content, Name, Description), Instance.Config.PickedUpHint.Duration); - } - - /// - /// Shows a message to the player upon selecting a custom item. - /// - /// The who will be shown the message. - protected virtual void ShowSelectedMessage(Player player) - { - if (Instance!.Config.SelectedHint.Show) - player.ShowHint(string.Format(Instance.Config.SelectedHint.Content, Name, Description), Instance.Config.SelectedHint.Duration); - } - - private void OnInternalOwnerChangingRole(ChangingRoleEventArgs ev) - { - if (ev.Reason == SpawnReason.Escaped) - return; - - foreach (Item item in ev.Player.Items.ToList()) - { - if (!Check(item)) - continue; - - OnOwnerChangingRole(new OwnerChangingRoleEventArgs(item.Base, ev)); - - TrackedSerials.Remove(item.Serial); - - ev.Player.RemoveItem(item); - - Spawn(ev.Player, item, ev.Player); - } - - MirrorExtensions.ResyncSyncVar(ev.Player.ReferenceHub.networkIdentity, typeof(NicknameSync), nameof(NicknameSync.Network_myNickSync)); - } - - private void OnInternalOwnerDying(DyingEventArgs ev) - { - foreach (Item item in ev.Player.Items.ToList()) - { - if (!Check(item)) - continue; - - OnOwnerDying(new OwnerDyingEventArgs(item, ev)); - - if (!ev.IsAllowed) - continue; - - ev.Player.RemoveItem(item); - - TrackedSerials.Remove(item.Serial); - - Spawn(ev.Player, item, ev.Player); - - MirrorExtensions.ResyncSyncVar(ev.Player.ReferenceHub.networkIdentity, typeof(NicknameSync), nameof(NicknameSync.Network_myNickSync)); - } - - MirrorExtensions.ResyncSyncVar(ev.Player.ReferenceHub.networkIdentity, typeof(NicknameSync), nameof(NicknameSync.Network_myNickSync)); - } - - private void OnInternalOwnerEscaping(EscapingEventArgs ev) - { - foreach (Item item in ev.Player.Items.ToList()) - { - if (!Check(item)) - continue; - - OnOwnerEscaping(new OwnerEscapingEventArgs(item, ev)); - - if (!ev.IsAllowed) - continue; - - ev.Player.RemoveItem(item); - - TrackedSerials.Remove(item.Serial); - - Timing.CallDelayed(1.5f, () => Spawn(ev.Player.Position, item, null)); - - MirrorExtensions.ResyncSyncVar(ev.Player.ReferenceHub.networkIdentity, typeof(NicknameSync), nameof(NicknameSync.Network_myNickSync)); - } - - MirrorExtensions.ResyncSyncVar(ev.Player.ReferenceHub.networkIdentity, typeof(NicknameSync), nameof(NicknameSync.Network_myNickSync)); - } - - private void OnInternalOwnerHandcuffing(HandcuffingEventArgs ev) - { - foreach (Item item in ev.Target.Items.ToList()) - { - if (!Check(item)) - continue; - - OnOwnerHandcuffing(new OwnerHandcuffingEventArgs(item, ev)); - - if (!ev.IsAllowed) - continue; - - ev.Target.RemoveItem(item); - - TrackedSerials.Remove(item.Serial); - - Spawn(ev.Target, item, ev.Target); - } - } - - private void OnInternalDropping(DroppingItemEventArgs ev) - { - if (!Check(ev.Item)) - return; - - OnDropping(ev); - } - - private void OnInternalPickingUp(PickingUpItemEventArgs ev) - { - if (!Check(ev.Pickup) || ev.Player.Items.Count >= 8) - return; - - OnPickingUp(ev); - - if (!ev.IsAllowed) - return; - } - - private void OnInternalItemAdded(ItemAddedEventArgs ev) - { - if (!Check(ev.Pickup)) - return; - - OnAcquired(ev.Player, ev.Item, true); - } - - private void OnInternalChanging(ChangingItemEventArgs ev) - { - if (!Check(ev.Item)) - { - MirrorExtensions.ResyncSyncVar(ev.Player.ReferenceHub.networkIdentity, typeof(NicknameSync), nameof(NicknameSync.Network_displayName)); - return; - } - - if (ShouldMessageOnGban) - { - foreach (Player player in Player.Get(RoleTypeId.Spectator)) - Timing.CallDelayed(0.5f, () => player.SendFakeSyncVar(ev.Player.ReferenceHub.networkIdentity, typeof(NicknameSync), nameof(NicknameSync.Network_displayName), $"{ev.Player.Nickname} (CustomItem: {Name})")); - } - - OnChanging(ev); - } - - private void OnInternalUpgradingInventoryItem(UpgradingInventoryItemEventArgs ev) - { - if (!Check(ev.Item)) - return; - - ev.IsAllowed = false; - - OnUpgrading(new UpgradingItemEventArgs(ev.Player, ev.Item.Base, ev.KnobSetting)); - } - - private void OnInternalUpgradingPickup(UpgradingPickupEventArgs ev) - { - if (!Check(ev.Pickup)) - return; - - ev.IsAllowed = false; - - Timing.CallDelayed(3.5f, () => - { - ev.Pickup.Position = ev.OutputPosition; - OnUpgrading(new UpgradingEventArgs(ev.Pickup.Base, ev.OutputPosition, ev.KnobSetting)); - }); - } - } -} diff --git a/Exiled.CustomItems/API/Features/CustomWeapon.cs b/Exiled.CustomItems/API/Features/CustomWeapon.cs deleted file mode 100644 index b849701f35..0000000000 --- a/Exiled.CustomItems/API/Features/CustomWeapon.cs +++ /dev/null @@ -1,313 +0,0 @@ -// ----------------------------------------------------------------------- -// -// Copyright (c) Exiled Team. All rights reserved. -// Licensed under the CC BY-SA 3.0 license. -// -// ----------------------------------------------------------------------- - -namespace Exiled.CustomItems.API.Features -{ - using System; - - using Exiled.API.Enums; - using Exiled.API.Extensions; - using Exiled.API.Features; - using Exiled.API.Features.DamageHandlers; - using Exiled.API.Features.Items; - using Exiled.API.Features.Pickups; - using Exiled.Events.EventArgs.Player; - - using InventorySystem.Items.Firearms.Attachments; - using InventorySystem.Items.Firearms.Attachments.Components; - using InventorySystem.Items.Firearms.BasicMessages; - using UnityEngine; - - using Firearm = Exiled.API.Features.Items.Firearm; - using Player = Exiled.API.Features.Player; - - /// - /// The Custom Weapon base class. - /// - public abstract class CustomWeapon : CustomItem - { - /// - /// Gets or sets value indicating what s the weapon will have. - /// - public virtual AttachmentName[] Attachments { get; set; } = { }; - - /// - public override ItemType Type - { - get => base.Type; - set - { - if (!value.IsWeapon(false) && value != ItemType.None) - throw new ArgumentOutOfRangeException($"{nameof(Type)}", value, "Invalid weapon type."); - - base.Type = value; - } - } - - /// - /// Gets or sets the weapon damage. - /// - public abstract float Damage { get; set; } - - /// - /// Gets or sets a value indicating how big of a clip the weapon will have. - /// - public virtual byte ClipSize { get; set; } - - /// - /// Gets or sets a value indicating whether or not to allow friendly fire with this weapon on FF-enabled servers. - /// - public virtual bool FriendlyFire { get; set; } - - /// - public override Pickup? Spawn(Vector3 position, Player? previousOwner = null) - { - if (Item.Create(Type) is not Firearm firearm) - { - Log.Debug($"{nameof(Spawn)}: Item is not Firearm."); - return null; - } - - if (!Attachments.IsEmpty()) - firearm.AddAttachment(Attachments); - - firearm.Ammo = ClipSize; - - Pickup? pickup = firearm.CreatePickup(position); - - if (pickup is null) - { - Log.Debug($"{nameof(Spawn)}: Pickup is null."); - return null; - } - - pickup.Weight = Weight; - pickup.Scale = Scale; - if (previousOwner is not null) - pickup.PreviousOwner = previousOwner; - - TrackedSerials.Add(pickup.Serial); - return pickup; - } - - /// - public override Pickup? Spawn(Vector3 position, Item item, Player? previousOwner = null) - { - if (item is Firearm firearm) - { - if (!Attachments.IsEmpty()) - firearm.AddAttachment(Attachments); - - byte ammo = firearm.Ammo; - Log.Debug($"{nameof(Name)}.{nameof(Spawn)}: Spawning weapon with {ammo} ammo."); - Pickup? pickup = firearm.CreatePickup(position); - pickup.Scale = Scale; - - if (previousOwner is not null) - pickup.PreviousOwner = previousOwner; - - TrackedSerials.Add(pickup.Serial); - return pickup; - } - - return base.Spawn(position, item, previousOwner); - } - - /// - public override void Give(Player player, bool displayMessage = true) - { - Item item = player.AddItem(Type); - - if (item is Firearm firearm) - { - if (!Attachments.IsEmpty()) - firearm.AddAttachment(Attachments); - - firearm.Ammo = ClipSize; - } - - Log.Debug($"{nameof(Give)}: Adding {item.Serial} to tracker."); - TrackedSerials.Add(item.Serial); - - OnAcquired(player, item, displayMessage); - } - - /// - protected override void SubscribeEvents() - { - Exiled.Events.Handlers.Player.ReloadingWeapon += OnInternalReloading; - Exiled.Events.Handlers.Player.Shooting += OnInternalShooting; - Exiled.Events.Handlers.Player.Shot += OnInternalShot; - Exiled.Events.Handlers.Player.Hurting += OnInternalHurting; - - base.SubscribeEvents(); - } - - /// - protected override void UnsubscribeEvents() - { - Exiled.Events.Handlers.Player.ReloadingWeapon -= OnInternalReloading; - Exiled.Events.Handlers.Player.Shooting -= OnInternalShooting; - Exiled.Events.Handlers.Player.Shot -= OnInternalShot; - Exiled.Events.Handlers.Player.Hurting -= OnInternalHurting; - - base.UnsubscribeEvents(); - } - - /// - /// Handles reloading for custom weapons. - /// - /// . - protected virtual void OnReloading(ReloadingWeaponEventArgs ev) - { - } - - /// - /// Handles shooting for custom weapons. - /// - /// . - protected virtual void OnShooting(ShootingEventArgs ev) - { - } - - /// - /// Handles shot for custom weapons. - /// - /// . - protected virtual void OnShot(ShotEventArgs ev) - { - } - - /// - /// Handles hurting for custom weapons. - /// - /// . - protected virtual void OnHurting(HurtingEventArgs ev) - { - if (ev.IsAllowed && Damage > 0f) - ev.Amount = Damage; - } - - private void OnInternalReloading(ReloadingWeaponEventArgs ev) - { - if (!Check(ev.Player.CurrentItem)) - return; - - Log.Debug($"{nameof(Name)}.{nameof(OnInternalReloading)}: Reloading weapon. Calling external reload event.."); - OnReloading(ev); - - Log.Debug($"{nameof(Name)}.{nameof(OnInternalReloading)}: External event ended. {ev.IsAllowed}"); - if (!ev.IsAllowed) - { - Log.Debug($"{nameof(Name)}.{nameof(OnInternalReloading)}: External event turned is allowed to false, returning."); - return; - } - - Log.Debug($"{nameof(Name)}.{nameof(OnInternalReloading)}: Continuing with internal reload.."); - ev.IsAllowed = false; - - byte remainingClip = ((Firearm)ev.Player.CurrentItem).Ammo; - - if (remainingClip >= ClipSize) - return; - - Log.Debug($"{ev.Player.Nickname} ({ev.Player.UserId}) [{ev.Player.Role}] is reloading a {Name} ({Id}) [{Type} ({remainingClip}/{ClipSize})]!"); - - AmmoType ammoType = ev.Firearm.AmmoType; - - if (!ev.Player.Ammo.ContainsKey(ammoType.GetItemType())) - { - Log.Debug($"{nameof(Name)}.{nameof(OnInternalReloading)}: {ev.Player.Nickname} does not have ammo to reload this weapon."); - return; - } - - ev.Player.Connection.Send(new RequestMessage(ev.Firearm.Serial, RequestType.Reload)); - - byte amountToReload = (byte)Math.Min(ClipSize - remainingClip, ev.Player.Ammo[ammoType.GetItemType()]); - - if (amountToReload <= 0) - return; - - ev.Player.ReferenceHub.playerEffectsController.GetEffect().Intensity = 0; - - ev.Player.Ammo[ammoType.GetItemType()] -= amountToReload; - ev.Player.Inventory.SendAmmoNextFrame = true; - - ((Firearm)ev.Player.CurrentItem).Ammo = (byte)(((Firearm)ev.Player.CurrentItem).Ammo + amountToReload); - - Log.Debug($"{ev.Player.Nickname} ({ev.Player.UserId}) [{ev.Player.Role}] reloaded a {Name} ({Id}) [{Type} ({((Firearm)ev.Player.CurrentItem).Ammo}/{ClipSize})]!"); - } - - private void OnInternalShooting(ShootingEventArgs ev) - { - if (!Check(ev.Player.CurrentItem)) - return; - - OnShooting(ev); - } - - private void OnInternalShot(ShotEventArgs ev) - { - if (!Check(ev.Player.CurrentItem)) - return; - - OnShot(ev); - } - - private void OnInternalHurting(HurtingEventArgs ev) - { - if (ev.Attacker is null) - { - return; - } - - if (ev.Player is null) - { - Log.Debug($"{Name}: {nameof(OnInternalHurting)}: target null"); - return; - } - - if (!Check(ev.Attacker.CurrentItem)) - { - Log.Debug($"{Name}: {nameof(OnInternalHurting)}: !Check()"); - return; - } - - if (ev.Attacker == ev.Player) - { - Log.Debug($"{Name}: {nameof(OnInternalHurting)}: attacker == target"); - return; - } - - if (ev.DamageHandler is null) - { - Log.Debug($"{Name}: {nameof(OnInternalHurting)}: Handler null"); - return; - } - - if (!ev.DamageHandler.CustomBase.BaseIs(out FirearmDamageHandler firearmDamageHandler)) - { - Log.Debug($"{Name}: {nameof(OnInternalHurting)}: Handler not firearm"); - return; - } - - if (!Check(firearmDamageHandler.Item)) - { - Log.Debug($"{Name}: {nameof(OnInternalHurting)}: type != type"); - return; - } - - if (!FriendlyFire && (ev.Attacker.Role.Team == ev.Player.Role.Team)) - { - Log.Debug($"{Name}: {nameof(OnInternalHurting)}: FF is disabled for this weapon!"); - return; - } - - OnHurting(ev); - } - } -} \ No newline at end of file diff --git a/Exiled.CustomItems/Commands/Give.cs b/Exiled.CustomItems/Commands/Give.cs deleted file mode 100644 index cf228ca56c..0000000000 --- a/Exiled.CustomItems/Commands/Give.cs +++ /dev/null @@ -1,123 +0,0 @@ -// ----------------------------------------------------------------------- -// -// Copyright (c) Exiled Team. All rights reserved. -// Licensed under the CC BY-SA 3.0 license. -// -// ----------------------------------------------------------------------- - -namespace Exiled.CustomItems.Commands -{ - using System; - using System.Collections.Generic; - using System.Linq; - - using CommandSystem; - - using Exiled.API.Features; - using Exiled.CustomItems.API.Features; - using Exiled.Permissions.Extensions; - - using RemoteAdmin; - - /// - /// The command to give a player an item. - /// - internal sealed class Give : ICommand - { - private Give() - { - } - - /// - /// Gets the instance. - /// - public static Give Instance { get; } = new(); - - /// - public string Command { get; } = "give"; - - /// - public string[] Aliases { get; } = { "g" }; - - /// - public string Description { get; } = "Gives a custom item."; - - /// - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - if (!sender.CheckPermission("customitems.give")) - { - response = "Permission Denied, required: customitems.give"; - return false; - } - - if (arguments.Count == 0) - { - response = "give [Nickname/PlayerID/UserID/all/*]"; - return false; - } - - if (!CustomItem.TryGet(arguments.At(0), out CustomItem? item)) - { - response = $"Custom item {arguments.At(0)} not found!"; - return false; - } - - if (arguments.Count == 1) - { - if (sender is PlayerCommandSender playerCommandSender) - { - Player player = Player.Get(playerCommandSender.SenderId); - - if (!CheckEligible(player)) - { - response = "You cannot receive custom items!"; - return false; - } - - item?.Give(player); - response = $"{item?.Name} given to {player.Nickname} ({player.UserId})"; - return true; - } - - response = "Failed to provide a valid player, please follow the syntax."; - return false; - } - - string identifier = string.Join(" ", arguments.Skip(1)); - - switch (identifier) - { - case "*": - case "all": - List eligiblePlayers = Player.List.Where(CheckEligible).ToList(); - foreach (Player ply in eligiblePlayers) - item?.Give(ply); - - response = $"Custom item {item?.Name} given to all players who can receive them ({eligiblePlayers.Count} players)"; - return true; - default: - if (Player.Get(identifier) is not { } player) - { - response = $"Unable to find player: {identifier}."; - return false; - } - - if (!CheckEligible(player)) - { - response = "Player cannot receive custom items!"; - return false; - } - - item?.Give(player); - response = $"{item?.Name} given to {player.Nickname} ({player.UserId})"; - return true; - } - } - - /// - /// Checks if the player is eligible to receive custom items. - /// - private bool CheckEligible(Player player) => player.IsAlive && !player.IsCuffed && (player.Items.Count < 8); - } -} \ No newline at end of file diff --git a/Exiled.CustomItems/Commands/Info.cs b/Exiled.CustomItems/Commands/Info.cs deleted file mode 100644 index f0de9f1a99..0000000000 --- a/Exiled.CustomItems/Commands/Info.cs +++ /dev/null @@ -1,83 +0,0 @@ -// ----------------------------------------------------------------------- -// -// Copyright (c) Exiled Team. All rights reserved. -// Licensed under the CC BY-SA 3.0 license. -// -// ----------------------------------------------------------------------- - -namespace Exiled.CustomItems.Commands -{ - using System; - using System.Text; - - using CommandSystem; - - using Exiled.API.Features.Pools; - using Exiled.API.Features.Spawn; - using Exiled.CustomItems.API.Features; - using Exiled.Permissions.Extensions; - - /// - /// The command to view info about a specific item. - /// - internal sealed class Info : ICommand - { - private Info() - { - } - - /// - /// Gets the instance. - /// - public static Info Instance { get; } = new(); - - /// - public string Command { get; } = "info"; - - /// - public string[] Aliases { get; } = { "i" }; - - /// - public string Description { get; } = "Gets more information about the specified custom item."; - - /// - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - if (!sender.CheckPermission("customitems.info")) - { - response = "Permission Denied, required: customitems.info"; - return false; - } - - if (arguments.Count < 1) - { - response = "info [Custom item name/Custom item ID]"; - return false; - } - - if (!(uint.TryParse(arguments.At(0), out uint id) && CustomItem.TryGet(id, out CustomItem? item)) && - !CustomItem.TryGet(arguments.At(0), out item)) - { - response = $"{arguments.At(0)} is not a valid custom item."; - return false; - } - - StringBuilder message = StringBuilderPool.Pool.Get().AppendLine(); - - message.Append("- ").Append(item?.Name).Append(" (").Append(item?.Id).AppendLine(")") - .Append("- ").AppendLine(item?.Description) - .AppendLine(item?.Type.ToString()) - .Append("- Spawn Limit: ").AppendLine(item?.SpawnProperties?.Limit.ToString()).AppendLine() - .Append("[Spawn Locations (").Append(item?.SpawnProperties?.DynamicSpawnPoints.Count + item?.SpawnProperties?.StaticSpawnPoints.Count).AppendLine(")]"); - - foreach (DynamicSpawnPoint spawnPoint in item?.SpawnProperties?.DynamicSpawnPoints!) - message.Append(spawnPoint.Name).Append(' ').Append(spawnPoint.Position).Append(" Chance: ").Append(spawnPoint.Chance).AppendLine("%"); - - foreach (StaticSpawnPoint spawnPoint in item.SpawnProperties.StaticSpawnPoints) - message.Append(spawnPoint.Name).Append(' ').Append(spawnPoint.Position).Append(" Chance: ").Append(spawnPoint.Chance).AppendLine("%"); - - response = StringBuilderPool.Pool.ToStringReturn(message); - return true; - } - } -} \ No newline at end of file diff --git a/Exiled.CustomItems/Commands/List/List.cs b/Exiled.CustomItems/Commands/List/List.cs deleted file mode 100644 index 9ee1bcf628..0000000000 --- a/Exiled.CustomItems/Commands/List/List.cs +++ /dev/null @@ -1,52 +0,0 @@ -// ----------------------------------------------------------------------- -// -// Copyright (c) Exiled Team. All rights reserved. -// Licensed under the CC BY-SA 3.0 license. -// -// ----------------------------------------------------------------------- - -namespace Exiled.CustomItems.Commands.List -{ - using System; - - using CommandSystem; - - /// - /// The command to list all installed items. - /// - internal sealed class List : ParentCommand - { - private List() - { - LoadGeneratedCommands(); - } - - /// - /// Gets the instance. - /// - public static List Instance { get; } = new(); - - /// - public override string Command { get; } = "list"; - - /// - public override string[] Aliases { get; } = { "s", "l", "show", "sh" }; - - /// - public override string Description { get; } = "Gets a list of all currently registered custom items."; - - /// - public override void LoadGeneratedCommands() - { - RegisterCommand(Registered.Instance); - RegisterCommand(Tracked.Instance); - } - - /// - protected override bool ExecuteParent(ArraySegment arguments, ICommandSender sender, out string response) - { - response = $"Invalid subcommand! Available: registered, insideinventories"; - return false; - } - } -} \ No newline at end of file diff --git a/Exiled.CustomItems/Commands/List/Registered.cs b/Exiled.CustomItems/Commands/List/Registered.cs deleted file mode 100644 index d10bc0f0e9..0000000000 --- a/Exiled.CustomItems/Commands/List/Registered.cs +++ /dev/null @@ -1,73 +0,0 @@ -// ----------------------------------------------------------------------- -// -// Copyright (c) Exiled Team. All rights reserved. -// Licensed under the CC BY-SA 3.0 license. -// -// ----------------------------------------------------------------------- - -namespace Exiled.CustomItems.Commands.List -{ - using System; - using System.Linq; - using System.Text; - - using CommandSystem; - - using Exiled.API.Features.Pools; - using Exiled.CustomItems.API.Features; - using Exiled.Permissions.Extensions; - - /// - internal sealed class Registered : ICommand - { - private Registered() - { - } - - /// - /// Gets the command instance. - /// - public static Registered Instance { get; } = new(); - - /// - public string Command { get; } = "registered"; - - /// - public string[] Aliases { get; } = { "r", "reg" }; - - /// - public string Description { get; } = "Gets a list of registered custom items."; - - /// - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - if (!sender.CheckPermission("customitems.list.registered")) - { - response = "Permission Denied, required: customitems.list.registered"; - return false; - } - - if (arguments.Count != 0) - { - response = "list registered"; - return false; - } - - if (CustomItem.Registered.Count == 0) - { - response = "There are no custom items currently on this server."; - return false; - } - - StringBuilder message = StringBuilderPool.Pool.Get().AppendLine(); - - message.Append("[Registered custom items (").Append(CustomItem.Registered.Count).AppendLine(")]"); - - foreach (CustomItem customItem in CustomItem.Registered.OrderBy(item => item.Id)) - message.Append('[').Append(customItem.Id).Append(". ").Append(customItem.Name).Append(" (").Append(customItem.Type).Append(')').AppendLine("]"); - - response = StringBuilderPool.Pool.ToStringReturn(message); - return true; - } - } -} \ No newline at end of file diff --git a/Exiled.CustomItems/Commands/List/Tracked.cs b/Exiled.CustomItems/Commands/List/Tracked.cs deleted file mode 100644 index ed826f463e..0000000000 --- a/Exiled.CustomItems/Commands/List/Tracked.cs +++ /dev/null @@ -1,96 +0,0 @@ -// ----------------------------------------------------------------------- -// -// Copyright (c) Exiled Team. All rights reserved. -// Licensed under the CC BY-SA 3.0 license. -// -// ----------------------------------------------------------------------- - -namespace Exiled.CustomItems.Commands.List -{ - using System; - using System.Linq; - using System.Text; - - using CommandSystem; - - using Exiled.API.Features; - using Exiled.API.Features.Pools; - using Exiled.CustomItems.API.Features; - using Exiled.Permissions.Extensions; - - using RemoteAdmin; - - /// - internal sealed class Tracked : ICommand - { - private Tracked() - { - } - - /// - /// Gets the command instance. - /// - public static Tracked Instance { get; } = new(); - - /// - public string Command { get; } = "insideinventories"; - - /// - public string[] Aliases { get; } = { "ii", "inside", "inv", "inventories" }; - - /// - public string Description { get; } = "Gets a list of custom items actually inside of players' inventories."; - - /// - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - if (!sender.CheckPermission("customitems.list.insideinventories") && sender is PlayerCommandSender playerSender && !playerSender.FullPermissions) - { - response = "Permission Denied, required: customitems.list.insideinventories"; - return false; - } - - if (arguments.Count != 0) - { - response = "list insideinventories"; - return false; - } - - StringBuilder message = StringBuilderPool.Pool.Get(); - - int count = 0; - - foreach (CustomItem customItem in CustomItem.Registered) - { - if (customItem.TrackedSerials.Count == 0) - continue; - - message.AppendLine() - .Append('[').Append(customItem.Id).Append(". ").Append(customItem.Name).Append(" (").Append(customItem.Type).Append(')') - .Append(" {").Append(customItem.TrackedSerials.Count).AppendLine("}]").AppendLine(); - - count += customItem.TrackedSerials.Count; - - foreach (int insideInventory in customItem.TrackedSerials) - { - Player owner = Player.List.FirstOrDefault(player => player.Inventory.UserInventory.Items.Any(item => item.Key == insideInventory)); - - message.Append(insideInventory).Append(". "); - - if (owner is null) - message.AppendLine("Nobody"); - else - message.Append(owner.Nickname).Append(" (").Append(owner.UserId).Append(") (").Append(owner.Id).Append(") [").Append(owner.Role).AppendLine("]"); - } - } - - if (message.Length == 0) - message.Append("There are no custom items inside inventories."); - else - message.Insert(0, Environment.NewLine + "[Custom items inside inventories (" + count + ")]" + Environment.NewLine); - - response = StringBuilderPool.Pool.ToStringReturn(message); - return true; - } - } -} \ No newline at end of file diff --git a/Exiled.CustomItems/Commands/Main.cs b/Exiled.CustomItems/Commands/Main.cs deleted file mode 100644 index 46c9573d49..0000000000 --- a/Exiled.CustomItems/Commands/Main.cs +++ /dev/null @@ -1,54 +0,0 @@ -// ----------------------------------------------------------------------- -// -// Copyright (c) Exiled Team. All rights reserved. -// Licensed under the CC BY-SA 3.0 license. -// -// ----------------------------------------------------------------------- - -namespace Exiled.CustomItems.Commands -{ - using System; - - using CommandSystem; - - /// - /// The main command. - /// - [CommandHandler(typeof(RemoteAdminCommandHandler))] - [CommandHandler(typeof(GameConsoleCommandHandler))] - internal sealed class Main : ParentCommand - { - /// - /// Initializes a new instance of the class. - /// - public Main() - { - LoadGeneratedCommands(); - } - - /// - public override string Command { get; } = "customitems"; - - /// - public override string[] Aliases { get; } = { "ci", "cis" }; - - /// - public override string Description { get; } = string.Empty; - - /// - public override void LoadGeneratedCommands() - { - RegisterCommand(Give.Instance); - RegisterCommand(Spawn.Instance); - RegisterCommand(Info.Instance); - RegisterCommand(List.List.Instance); - } - - /// - protected override bool ExecuteParent(ArraySegment arguments, ICommandSender sender, out string response) - { - response = "Invalid subcommand! Available: give, spawn, info, list"; - return false; - } - } -} \ No newline at end of file diff --git a/Exiled.CustomItems/Commands/Spawn.cs b/Exiled.CustomItems/Commands/Spawn.cs deleted file mode 100644 index 99f438e436..0000000000 --- a/Exiled.CustomItems/Commands/Spawn.cs +++ /dev/null @@ -1,107 +0,0 @@ -// ----------------------------------------------------------------------- -// -// Copyright (c) Exiled Team. All rights reserved. -// Licensed under the CC BY-SA 3.0 license. -// -// ----------------------------------------------------------------------- - -namespace Exiled.CustomItems.Commands -{ - using System; - - using CommandSystem; - - using Exiled.API.Enums; - using Exiled.API.Extensions; - using Exiled.API.Features; - using Exiled.CustomItems.API.Features; - using Exiled.Permissions.Extensions; - - using UnityEngine; - - /// - /// The command to spawn a specific item. - /// - internal sealed class Spawn : ICommand - { - private Spawn() - { - } - - /// - /// Gets the instance. - /// - public static Spawn Instance { get; } = new(); - - /// - public string Command { get; } = "spawn"; - - /// - public string[] Aliases { get; } = { "sp" }; - - /// - public string Description { get; } = "Spawn an item at the specified Spawn Location, coordinates, or at the designated player's feet."; - - /// - public bool Execute(ArraySegment arguments, ICommandSender sender, out string response) - { - if (!sender.CheckPermission("customitems.spawn")) - { - response = "Permission Denied, required: customitems.spawn"; - return false; - } - - if (arguments.Count < 2) - { - response = "spawn [Custom item name] [Location name]\nspawn [Custom item name] [Nickname/PlayerID/UserID]\nspawn [Custom item name] [X] [Y] [Z]"; - return false; - } - - if (!CustomItem.TryGet(arguments.At(0), out CustomItem? item)) - { - response = $" {arguments.At(0)} is not a valid custom item."; - return false; - } - - Vector3 position; - - if (Enum.TryParse(arguments.At(1), out SpawnLocationType location)) - { - position = location.GetPosition(); - } - else - { - if (Player.Get(arguments.At(1)) is Player player) - { - if (player.IsDead) - { - response = $"Cannot spawn custom items under dead players!"; - return false; - } - - position = player.Position; - } - else if (arguments.Count > 3) - { - if (!float.TryParse(arguments.At(1), out float x) || !float.TryParse(arguments.At(2), out float y) || !float.TryParse(arguments.At(3), out float z)) - { - response = "Invalid coordinates selected."; - return false; - } - - position = new Vector3(x, y, z); - } - else - { - response = $"Unable to find spawn location: {arguments.At(1)}."; - return false; - } - } - - item?.Spawn(position); - - response = $"{item?.Name} ({item?.Type}) has been spawned at {position}."; - return true; - } - } -} \ No newline at end of file diff --git a/Exiled.CustomItems/Config.cs b/Exiled.CustomItems/Config.cs deleted file mode 100644 index ffb59c2746..0000000000 --- a/Exiled.CustomItems/Config.cs +++ /dev/null @@ -1,40 +0,0 @@ -// ----------------------------------------------------------------------- -// -// Copyright (c) Exiled Team. All rights reserved. -// Licensed under the CC BY-SA 3.0 license. -// -// ----------------------------------------------------------------------- - -namespace Exiled.CustomItems -{ - using System.ComponentModel; - - using Exiled.API.Features; - using Exiled.API.Interfaces; - using Exiled.CustomItems.API.Features; - - /// - /// The plugin's config class. - /// - public class Config : IConfig - { - /// - [Description("Indicates whether this plugin is enabled or not.")] - public bool IsEnabled { get; set; } = true; - - /// - public bool Debug { get; set; } = false; - - /// - /// Gets the hint that is shown when someone pickups a . - /// - [Description("The hint that is shown when someone pickups a custom item.")] - public Broadcast PickedUpHint { get; private set; } = new("You have picked up a {0}\n{1}"); - - /// - /// Gets the hint that is shown when someone pickups a . - /// - [Description("The hint that is shown when someone selects a custom item.")] - public Broadcast SelectedHint { get; private set; } = new("You have selected a {0}\n{1}", 5); - } -} \ No newline at end of file diff --git a/Exiled.CustomItems/CustomItems.cs b/Exiled.CustomItems/CustomItems.cs deleted file mode 100644 index 8a8e15b368..0000000000 --- a/Exiled.CustomItems/CustomItems.cs +++ /dev/null @@ -1,62 +0,0 @@ -// ----------------------------------------------------------------------- -// -// Copyright (c) Exiled Team. All rights reserved. -// Licensed under the CC BY-SA 3.0 license. -// -// ----------------------------------------------------------------------- - -namespace Exiled.CustomItems -{ - using System; - - using Exiled.API.Features; - using Exiled.CustomItems.Events; - - using HarmonyLib; - - /// - /// Handles all CustomItem API. - /// - public class CustomItems : Plugin - { - private RoundHandler? roundHandler; - private PlayerHandler? playerHandler; - private Harmony? harmony; - - /// - /// Gets the static reference to this class. - /// - public static CustomItems? Instance { get; private set; } - - /// - public override void OnEnabled() - { - Instance = this; - roundHandler = new RoundHandler(); - playerHandler = new PlayerHandler(); - - Exiled.Events.Handlers.Server.RoundStarted += roundHandler.OnRoundStarted; - - Exiled.Events.Handlers.Player.ChangingItem += playerHandler.OnChangingItem; - - harmony = new Harmony($"com.{nameof(CustomItems)}.ExiledTeam-{DateTime.Now.Ticks}"); - GlobalPatchProcessor.PatchAll(harmony, out int failedPatch); - if (failedPatch != 0) - Log.Error($"Patching failed! There are {failedPatch} broken patches."); - - base.OnEnabled(); - } - - /// - public override void OnDisabled() - { - Exiled.Events.Handlers.Server.RoundStarted -= roundHandler!.OnRoundStarted; - - Exiled.Events.Handlers.Player.ChangingItem -= playerHandler!.OnChangingItem; - - harmony?.UnpatchAll(); - - base.OnDisabled(); - } - } -} \ No newline at end of file diff --git a/Exiled.CustomItems/Exiled.CustomItems.csproj b/Exiled.CustomItems/Exiled.CustomItems.csproj deleted file mode 100644 index 8bbba33f4d..0000000000 --- a/Exiled.CustomItems/Exiled.CustomItems.csproj +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - Library - Exiled.CustomItems - true - Debug;Release;Installer - AnyCPU - enable - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - if not "$(EXILED_DEV_REFERENCES)"=="" copy /y "$(OutputPath)$(AssemblyName).dll" "$(EXILED_DEV_REFERENCES)\Plugins\" - - - if [[ ! -z "$EXILED_DEV_REFERENCES" ]]; then cp "$(OutputPath)$(AssemblyName).dll" "$EXILED_DEV_REFERENCES/Plugins/"; fi - - From eb2d717ace77f578b7eb04a296de2a5394804249 Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Wed, 31 Jan 2024 18:57:11 +0100 Subject: [PATCH 059/141] Fixed CI --- build.ps1 | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/build.ps1 b/build.ps1 index 2b4f5a54c8..24385b7400 100644 --- a/build.ps1 +++ b/build.ps1 @@ -11,8 +11,7 @@ $Projects = @( 'Exiled.Events', 'Exiled.CreditTags', 'Exiled.Example', - 'Exiled.CustomItems', - 'Exiled.CustomRoles' + 'Exiled.CustomModules' ) function Execute { From f15f6fed94b97005bdc3ab933f5a4c2c6fdcf736 Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Wed, 31 Jan 2024 18:59:40 +0100 Subject: [PATCH 060/141] Fix build errors --- Exiled.CustomItems/API/Features/CustomWeapon.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Exiled.CustomItems/API/Features/CustomWeapon.cs b/Exiled.CustomItems/API/Features/CustomWeapon.cs index acc3666790..6b051a7614 100644 --- a/Exiled.CustomItems/API/Features/CustomWeapon.cs +++ b/Exiled.CustomItems/API/Features/CustomWeapon.cs @@ -9,6 +9,7 @@ namespace Exiled.CustomItems.API.Features { using System; + using Exiled.API.Enums; using Exiled.API.Extensions; using Exiled.API.Features; using Exiled.API.Features.DamageHandlers; From 471b4bbe598ccdeae374afb3032ca3438cad7523 Mon Sep 17 00:00:00 2001 From: Nao <60253860+NaoUnderscore@users.noreply.github.com> Date: Wed, 31 Jan 2024 19:05:50 +0100 Subject: [PATCH 061/141] Merge dev to master (#2416) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix CI * Added PrimitiveSettings + 3 overloads to Primitive::Create method * Light::Create overload + Signature fix * Ops * Make `Server.RunCommand` return response (#2105) * Make `Server.RunCommand` return response * Make obsolute * Fix * Update Exiled.API/Features/Toys/Light.cs Co-authored-by: Thunder * Update Exiled.API/Features/Toys/Primitive.cs Co-authored-by: Thunder * Update Primitive.cs * Changes for Shooting and Shot events (#2101) * fixed event for buckshot and railgun and added firearm in args * Added firearm * Update Shot.cs * Use .Cast() in Shot.cs * ShotEventArgs extends IFirearmEvent, added Item and changed order of properties * Changed order of CanHurt in ShotEventArgs * Make ShootingEventArgs extends IFirearmEvent instead of IItemEvent * Fix Nao Skill Issue (#2112) Co-authored-by: Nao <60253860+NaoUnderscore@users.noreply.github.com> * AnimationCurve (#2098) * AnimationCurve * Bad documentation * Removing 'Exiled.Updater', * Revert "Removing 'Exiled.Updater'," This reverts commit b8d4e7c4d9307b731bbc15636b9a0919945ec6aa. * Fix dumb door (#2111) Co-authored-by: Nao <60253860+NaoUnderscore@users.noreply.github.com> * SpawningTeamVehicle event addition (#2108) * Ability use hint changes (#2113) * Make these better. * Remove this * Fix dev build errors * Make it non-breaking * Mark obsolete * Smol fucky wucky * yes * Erm, Am I dumb? * Better responses * Exiled Component System Overhaul, DynamicEvents & StateMachine APIs, `Exiled::Updater` rework. (#2085) * `Exiled.Updater` rework * Removed old `Exiled.Updater` * Fix `nuspec` build * Prevent Exiled from being loaded if out to date and no releases are available yet. * Added `StateMachine` API. Added `DynamicEvents` API. Added `EBehaviour` component. Fixed docs in `ManagedObjectTypeAttribute`. Fixed typos in `CustomRoles::API::Extensions`. * Fix typo * Not finish * Some fixes to `Exiled::Updater`. Now it actually runs on a different thread without blocking the normal server exec/startup. * Don't care * Updater's logs are now debugs * Fix typo Co-authored-by: VALERA771 <72030575+VALERA771@users.noreply.github.com> * Fix Exiled.nuspec * use ternary op Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> * Fix Yamato's commit * Fixed `StaticActor` structure --------- Co-authored-by: Nao Co-authored-by: louis1706 Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> Co-authored-by: VALERA771 <72030575+VALERA771@users.noreply.github.com> * Fix Error GetBefore() (#2121) * Fix MessageTranslated (#2122) * Keep dev branch up to date (#2125) * Add ChangeLightsColor and ResetLightsColor (#2126) * ChangeLightsColor and ResetLightsColor addition. * Fix for player being null (skipping this null check causes Npc.Destroy() to throw exceptions) (#2129) * Someone didn't know how unity works. (#2132) * Small change to CustomRole.KeepInventoryOnSpawn (#2130) * Yes * Yamato fix * There * Switches are better * Add RotationTime, DoorOpenTime, DoorCloseTime and MoveTime to Lift.cs (#2117) * Add RotationTime, DoorOpenTime, DoorCloseTime and MoveTime * Update Lift.cs --------- Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> * Fixed crashing issue caused by changing appearance of a disconnected … (#2139) * Fixed crashing issue caused by changing appearance of a disconnected player * Update MirrorExtensions.cs --------- Co-authored-by: Nao <60253860+NaoUnderscore@users.noreply.github.com> * Fix SetAmmo(AmmoType.None) crash (#2138) * Fix SetAmmo(AmmoType.None) crash * 100% sure no error with this * EventList (#2137) * EventList * Update Event.cs * FixPickupPreviousOwner (#2141) * Deprecated the setter of ItemsToDrop (#2144) * EndRoundTranspiler (#2120) * EndRoundTranspiler * not needed * SCPSL-experimental Update (#2152) * experimental * Prevent breakingChange * Error * last fix * Update Doc * Haven't found a better way to make it * FUCK Version * StaminaUsage Patch now use Postfix instead of Transpiler & KickingEvent Transpiler (#2143) * StaminaUsage * Kicking Patch * Fix error * Fix for Experymental * Fix stupidity * Optimise --------- Co-authored-by: Nao <60253860+NaoUnderscore@users.noreply.github.com> Co-authored-by: Misaka-ZeroTwo <45165615+Misaka-ZeroTwo@users.noreply.github.com> * Respawn::TimeUntilNextPhase (#2150) * Respawn::TimeUntilNextPhase * . * is or * Update dependencies URL * Unnecessary set accessor * Update dep link * Fix UserId (#2158) * Fix IL ERROR (#2166) * Fix ILError * Fix Skill Issue from someone else - /* */ will need to be removed when the other method will be deleted * Fix round end transpiler (#2167) * Update RoundEnd.cs * Update RoundEnd.cs * Update RoundEnd.cs * Full Fix * Fix UsedItem event not being called (#2163) * UsedItemFixNotCall * In case it's don't work * Update UsedItemFixNotCall.cs --------- Co-authored-by: Nao <60253860+NaoUnderscore@users.noreply.github.com> * Fix `Scp0492.ConsumingCorpse` event was called with `Scp049` (#2142) * bruh * better patch method * L bracing --------- Co-authored-by: Nao <60253860+NaoUnderscore@users.noreply.github.com> Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> * Fix SpawingEventArgs::HorizontalRotation (#2162) * Fix Crash null string (#2161) * Add Whitelist && update ReservedSlot extensions (#2160) * Make `Server.RunCommand` return response * Make obsolute * Fix * Add WhiteList extension * Add `isPermanent` argument * Update `ReservedSlot` * Update docs * Fixes * Make better * Always true * SendingAdminChatMessageEvent (#2159) * SendingAdminChatMessage * oh 'lol Co-authored-by: VALERA771 <72030575+VALERA771@users.noreply.github.com> * Update SendingAdminChatMessageEventsArgs.cs --------- Co-authored-by: VALERA771 <72030575+VALERA771@users.noreply.github.com> Co-authored-by: Nao <60253860+NaoUnderscore@users.noreply.github.com> * Fix ClearInventory (#2140) * Fix ClearInventory * Update Exiled.API/Features/Player.cs Co-authored-by: IRacle <79921583+IRacle1@users.noreply.github.com> * Apply suggestions from code review Co-authored-by: Thunder --------- Co-authored-by: IRacle <79921583+IRacle1@users.noreply.github.com> Co-authored-by: Thunder Co-authored-by: Nao <60253860+NaoUnderscore@users.noreply.github.com> * We are not going to miss this (Remove Old Exiled.Updater) (#2151) * We are not going to miss this * Update Loader.cs * Fix Yamato's skill issue --------- Co-authored-by: Nao <60253860+NaoUnderscore@users.noreply.github.com> * ModifyToken (#2148) * ModifyToken * PreventException * New * modify * Tickets * Some Scp914 QoL additions (#2149) * Scp914 * Update Exiled.API/Features/Scp914.cs Co-authored-by: Thunder * Update Exiled.API/Features/Scp914.cs Co-authored-by: Thunder * Update Exiled.API/Features/Scp914.cs Co-authored-by: Thunder * Update Scp914.cs * Update Scp914.cs --------- Co-authored-by: Thunder * Update dev.yml workflow (#2170) * Update main.yml (#2169) * GetAmmoLimitFix (#2157) * GetAmmoLimitFix * look nicer * . * Update GetAmmoLimitFix.cs --------- Co-authored-by: Nao <60253860+NaoUnderscore@users.noreply.github.com> * Add Player.AdminChatAccess * Revert "Fix UsedItem event not being called (#2163)" (#2173) This reverts commit 58007bc4a737a0c68ec7bef31387b5c7d354dfd3. * `Scp173::BlinkingRequest` event (#2077) * test * у * e --------- Co-authored-by: Nao <60253860+NaoUnderscore@users.noreply.github.com> Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> * NullCheck (#2175) * SCP:SL 13.3 (#2178) Co-authored-by: Thunder * ChaosTargetCounter (#2179) * ChaosTargetCounter * Network_chaosTargetCount --------- Co-authored-by: Thunder * merge Master To Dev (#2203) * Fix CI * Added ChaosTargetCount (#2106) * Added ChaosTargetCount * a * Updated * Fix build errors --------- Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> Co-authored-by: Nao <60253860+NaoUnderscore@users.noreply.github.com> * Revert "Added ChaosTargetCount (#2106)" (#2110) This reverts commit c3612c9d59a31be94cf6fba25a136e1155b91946. * Woah more proper English (#2196) Grammar fixes. This includes fixing multiple it's to its, removal of unnecessary commas, and removal of redundancies. --------- Co-authored-by: Nao <60253860+NaoUnderscore@users.noreply.github.com> Co-authored-by: Nameless <85962933+Misfiy@users.noreply.github.com> Co-authored-by: Thunder Co-authored-by: Snivy FIlms <120346554+NikkiGardiner1@users.noreply.github.com> * Update RoundEnd.cs (#2193) Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> * Fix Rpc and WriterExtensions dict (#2198) * Fix Rpc and WriterExtensions dict * stylecop * Intercom.DisplayText fix (#2209) * Update CommentsObjectGraphVisitor.cs (#2210) * EnableEffect should have intensity argument (#2134) * EnableEffect should have intensity argument * Preventing Error + add a new ctor for Effect class * Fix NW * FUCK that so dumb * Fix typos * Fix doc --------- Co-authored-by: Nao <60253860+NaoUnderscore@users.noreply.github.com> * Add two item props: IsLightEmitter, IsDisarmer * DecontaminationFeatures (#2145) * DecontaminationFeatures * it's also global when final * Fix * Update DecontaminationState.cs * . * Add Warhead.Kills * same to dev (#2206) * fix `IAcquisitionConfirmationTrigger` logic * final 330 fix * Stupid manual bool fix (#2211) * all candies (#2214) * Add Broadcast.Show check to CustomItems (#2212) * Add Broadcast.Show check to CustomItems * Random optimization * Revert "Random optimization" This reverts commit 6c7f910fa89f874ac8175590610e6d50751bcd46. --------- Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> * Rework EffectType (#2190) * Rework * Update EffectTypeExtension.cs * Update EffectTypeExtension.cs * Update dev.yml (#2227) * Updating EXILED to 13.3.1 (#2223) * Item fix (#2228) * Fix doc version (#2230) * Simplification * Patch fix (#2229) * Update ChangingGroup.cs (#2232) * Fix transpiler (#2234) * Fix CancelledItemUse::Item always being null (#2174) * Fix Item always being null * . * Is it a flashlight? (#2225) * is it a flashlight? * new logic * edit xml * another xml update * no more breaking changes * huh * get and create methods fix * fuux * New Hurt Event (#2176) Co-authored-by: IRacle <79921583+IRacle1@users.noreply.github.com> * Reworking Scp079Transpiller (#2017) * Scp106ReworkTranspiller (#1984) * Rework Scp049 Event (#1978) * Send staff message (#2172) * SendStaffMessage * Idk if this is needed * . --------- Co-authored-by: Misaka-ZeroTwo <45165615+Misaka-ZeroTwo@users.noreply.github.com> * Scp079Role method fix (#1983) * Fix Bug than Grenade do not make damage correctly (#2119) * Fix Various Transpiler and Update StatModule (#2171) * Big PickupAPI changes (Breaking) (#2147) * Updated a LOT of summaries. (#2231) * Added proper grammar or some more details P1 (Contains Exiled.API to Exiled.CustomRoles * Up to Exiled Events Patches for working on the summaries * The last of the summary fixes and modifications * Reverted the /// changes * Im not perfect with grammar * Added Thundermaker's suggested changes * Part 2 * Part 3 * Said hasta la pasta to a comment --------- Co-authored-by: Nikki Gardiner Co-authored-by: Misaka-ZeroTwo <45165615+Misaka-ZeroTwo@users.noreply.github.com> * stylecop some women * oh good heavens * New effects (#2224) * new effect * same as flashlight? * Revert "same as flashlight?" This reverts commit ffa76c781374e6cbb619def1da81cef23529a0d6. * new effects * typo fix * xml update * fix * forgor * Update Exiled.API/Enums/EffectType.cs Co-authored-by: Thunder * Update Exiled.API/Extensions/EffectTypeExtension.cs Co-authored-by: Thunder * Update Exiled.API/Enums/EffectType.cs Co-authored-by: Thunder * basically what Yamato is saying is * Update Exiled.API/Enums/EffectType.cs * Update Exiled.API/Enums/EffectType.cs * Add using statement --------- Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> Co-authored-by: Thunder Co-authored-by: Misaka-ZeroTwo <45165615+Misaka-ZeroTwo@users.noreply.github.com> * stop complaining * the skeleton lives on (#2233) * Add 3114 * Add 3114 * Add 3114 * Squashed commit of the following: commit ef803b03e1fc077d7d91dd34f85909a335a8abb8 Author: VALERA771 <72030575+VALERA771@users.noreply.github.com> Date: Mon Nov 13 05:57:25 2023 +0300 New effects (#2224) * new effect * same as flashlight? * Revert "same as flashlight?" This reverts commit ffa76c781374e6cbb619def1da81cef23529a0d6. * new effects * typo fix * xml update * fix * forgor * Update Exiled.API/Enums/EffectType.cs Co-authored-by: Thunder * Update Exiled.API/Extensions/EffectTypeExtension.cs Co-authored-by: Thunder * Update Exiled.API/Enums/EffectType.cs Co-authored-by: Thunder * basically what Yamato is saying is * Update Exiled.API/Enums/EffectType.cs * Update Exiled.API/Enums/EffectType.cs * Add using statement --------- Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> Co-authored-by: Thunder Co-authored-by: Misaka-ZeroTwo <45165615+Misaka-ZeroTwo@users.noreply.github.com> * Squashed commit of the following: commit f35fdf96c217ffb75d95c0e7a6e08d6ce197926c Author: Thunder Date: Sun Nov 12 22:00:20 2023 -0500 stop complaining commit ef803b03e1fc077d7d91dd34f85909a335a8abb8 Author: VALERA771 <72030575+VALERA771@users.noreply.github.com> Date: Mon Nov 13 05:57:25 2023 +0300 New effects (#2224) * new effect * same as flashlight? * Revert "same as flashlight?" This reverts commit ffa76c781374e6cbb619def1da81cef23529a0d6. * new effects * typo fix * xml update * fix * forgor * Update Exiled.API/Enums/EffectType.cs Co-authored-by: Thunder * Update Exiled.API/Extensions/EffectTypeExtension.cs Co-authored-by: Thunder * Update Exiled.API/Enums/EffectType.cs Co-authored-by: Thunder * basically what Yamato is saying is * Update Exiled.API/Enums/EffectType.cs * Update Exiled.API/Enums/EffectType.cs * Add using statement --------- Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> Co-authored-by: Thunder Co-authored-by: Misaka-ZeroTwo <45165615+Misaka-ZeroTwo@users.noreply.github.com> * Fixes * Add 3114 * Fixed Event StartingRecallEventArgs's IsAllowed issue. (#2235) * Fix Ctor (#2240) * Lazy fix (#2146) Co-authored-by: Misaka-ZeroTwo <45165615+Misaka-ZeroTwo@users.noreply.github.com> * More Fix (#2244) Co-authored-by: Misaka-ZeroTwo <45165615+Misaka-ZeroTwo@users.noreply.github.com> * Version bump to 8.4.0 * FastFix (#2251) * Update push_nuget.yml * FixInfiniteSprint (#2255) * Version bump to 8.4.1 * Workflow (#2258) * Create moveFile.ps1 * Update dev.yml * Update dev.yml * Update dev.yml * Update dev.yml * Update dev.yml * Update dev.yml * Update dev.yml * Update moveFile.ps1 * Update dev.yml * Update dev.yml * Update dev.yml * Update dev.yml * Rename moveFile.ps1 to packaging.ps1 * Update dev.yml * Update dev.yml * Revert "Workflow (#2258)" This reverts commit d757764012248bcbe60e4a3fc55c9d346a78205f. * Change default value of flashbang affect thrower * Better workflow (#2259) * Create moveFile.ps1 * Update dev.yml * Update moveFile.ps1 * Update dev.yml * Rename moveFile.ps1 to packaging.ps1 * Update dev.yml * fix (#2262) Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> * Improved Stamina API (#2237) Co-authored-by: Thunder Co-authored-by: Misaka-ZeroTwo <45165615+Misaka-ZeroTwo@users.noreply.github.com> * Update DestroyingEventArgs.cs (#2272) * FixRoundEnd (#2278) * Remove Breaking Change from #2237 (#2283) * MaxAmmo Setter && NightVision should also be true when NightVision (#2164) Co-authored-by: Thunder Co-authored-by: Misaka-ZeroTwo <45165615+Misaka-ZeroTwo@users.noreply.github.com> * Ending round event fix (#2280) Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> * CanScp049SenseTutorial Fix bool logic (#2275) Co-authored-by: Bolton <48883340+BoltonDev@users.noreply.github.com> * Version bump to 8.4.2 * Fix TogglingFlashlightEventArgs Cast (#2295) Co-authored-by: Misaka-ZeroTwo <45165615+Misaka-ZeroTwo@users.noreply.github.com> * Fix Player.Get(ServerHostPlayer) (#1863) * Added ItemRemoved Event (#2263) Co-authored-by: Misaka-ZeroTwo <45165615+Misaka-ZeroTwo@users.noreply.github.com> * who wrote this? (#2298) * Fix MaxAmmo and CustomItem Weapon (#2302) * Update EXILED.props * Update EXILED.props * SpawningTeamVehicle Transpiler (#2265) * Spawning transpiler (#2241) * Add to DropItem(Item item, bool isThrown) (#2268) * Bump to 8.4.3-rc.2 * Revert "Spawning transpiler (#2241)" (#2306) This reverts commit caaa732385a2252283680e1084e8f9ee186c3308. * EffectType.None + More TryGet method for EffectType extension (#2292) * Rework and Fix Shooting Transpiler (#2309) * is that a new ev of 87? (#2308) * Inroducing... "Async" events (#2303) * huh? * oops * another one * Revert "another one" This reverts commit 0bae3adbdf03e3d941aef9a8f005f1b05897261b. * y've never seen last commit * Update Exiled.Events/Features/Event{T}.cs * fux --------- Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> * ValidatingVisibility Event (#2299) * ValidatingVisibility Event * text * fix again * build error fixes * docs fix * Update Exiled.Events/EventArgs/Scp939/ValidatingVisibilityEventArgs.cs Co-authored-by: Misaka-ZeroTwo <45165615+Misaka-ZeroTwo@users.noreply.github.com> * Update Exiled.Events/Handlers/Scp939.cs * Update Exiled.Events/Handlers/Scp939.cs * Update Exiled.Events/EventArgs/Scp939/ValidatingVisibilityEventArgs.cs * Update Exiled.Events/EventArgs/Scp939/ValidatingVisibilityEventArgs.cs --------- Co-authored-by: Misaka-ZeroTwo <45165615+Misaka-ZeroTwo@users.noreply.github.com> Co-authored-by: Nao <60253860+NaoUnderscore@users.noreply.github.com> * Patch Rework DoorList (#2270) * Patch Rework * Update Exiled.Events/Patches/Generic/DoorList.cs * uhmmmm * Add voicelines SCP-3114 (#2269) * Add Door EVent * Add to DropItem isThrown * Door * Add voicelines SCP-3114 * Update Player.cs * Oops * Oops v3 * Convert bool Prefix to Transpiler * Update Exiled.Events/Handlers/Scp3114.cs * Update Exiled.Events/Handlers/Scp3114.cs --------- Co-authored-by: BoltonII Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> Co-authored-by: Nao <60253860+NaoUnderscore@users.noreply.github.com> * Add ```ChangeItemOwner``` (#2249) * Add files via upload Added a public method for change item's owner. By encapsulating ChangeOwner method. * Fixed issue about extra tab * Fixed reference issue. * Update Exiled.API/Features/Items/Item.cs --------- Co-authored-by: Misaka-ZeroTwo <45165615+Misaka-ZeroTwo@users.noreply.github.com> Co-authored-by: Nao <60253860+NaoUnderscore@users.noreply.github.com> * Fixing up spelling errors and XML formatting. (#2317) * v8.4.3 (#2305) * Fixed SCP-3114 spelling errors and stylecop XML formatting. --------- Co-authored-by: Misaka-ZeroTwo <45165615+Misaka-ZeroTwo@users.noreply.github.com> Co-authored-by: Nao * rawr (#2322) * Fixed Room.Blackout not turning off lights (#2319) Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> Co-authored-by: Misaka-ZeroTwo <45165615+Misaka-ZeroTwo@users.noreply.github.com> * Some Scp914 changes (#2290) * Documentation about async events (#2332) * Update Events.md * Update Events.md * Update docs/docs/Plugins/Events.md Co-authored-by: Nao <60253860+NaoUnderscore@users.noreply.github.com> * Update docs/docs/Plugins/Events.md Co-authored-by: Nao <60253860+NaoUnderscore@users.noreply.github.com> --------- Co-authored-by: Nao <60253860+NaoUnderscore@users.noreply.github.com> * Scp244MoreAPI (#2323) * Scp244MoreAPI * Apply suggestions from code review Co-authored-by: Misaka-ZeroTwo <45165615+Misaka-ZeroTwo@users.noreply.github.com> --------- Co-authored-by: Misaka-ZeroTwo <45165615+Misaka-ZeroTwo@users.noreply.github.com> * Fix UsingBreakneckSpeeds not being call (#2318) * Round.IgnoredPlayers fix (#2307) * Round.IgnoredPlayers fix * Update Exiled.Events/Patches/Events/Server/RoundEnd.cs * Update Exiled.Events/Patches/Events/Server/RoundEnd.cs * Update Exiled.Events/Patches/Events/Server/RoundEnd.cs * Update Exiled.Events/Patches/Events/Server/RoundEnd.cs --------- Co-authored-by: Nao <60253860+NaoUnderscore@users.noreply.github.com> * SelectingRespawnTeamEventArgs (#2315) * SelectingRespawnTeamEventArgs * Apply suggestions from code review Co-authored-by: Nao <60253860+NaoUnderscore@users.noreply.github.com> * Update Exiled.Events/Patches/Events/Server/SelectingRespawnTeam.cs --------- Co-authored-by: Nao <60253860+NaoUnderscore@users.noreply.github.com> * Landing Fix + few doc change (#2314) * Update Documentation (#2336) * Update Documentation * Spacing * Scp3114 Transpiler (#2266) * TryUseBody Transpiler + fix * Disguising Transpiler * Revealing + RevealingKey Transpiler * Fix * Edit doc --------- Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> * Fix Transmitting event (#2273) * Fix TransmittingEvent * :) * Prevent breaking plugin * :) * Remove warning * I'm dumb * Fixing up XML Formatting --------- Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> * Scp173BeingLooked Transpiler (#2276) * Scp173BeingLooked Transpiler * Fix --------- Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> * Scp3114AttackAhpFix (#2320) * Scp3114AttackAhpFix * Update Scp3114AttackAhpFix.cs * Update Scp3114AttackAhpFix.cs * Adding event TogglingRadio(Player, RadioItem, bool, bool) (#2329) * Add Door EVent * Add Door Event * Add Door Event * Fix * Oops * Oops v2 * Oops * Delete Door Event * Create DamagingDoorEventArgs.cs * Create DamagingDoor.cs * Adding event Toggling Radio * Delete DamagingDoorEventArgs.cs * Create DamagingDoorEventArgs.cs * Convert prefix to transpiler + fix docs * Update TogglingRadio.cs * Update TogglingRadioEventArgs.cs * Update Exiled.Events/Patches/Events/Player/TogglingRadio.cs Co-authored-by: Bolton <48883340+BoltonDev@users.noreply.github.com> --------- Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> Co-authored-by: BoltonDev Co-authored-by: Nao <60253860+NaoUnderscore@users.noreply.github.com> Co-authored-by: Bolton <48883340+BoltonDev@users.noreply.github.com> * Fix Gate IsFullyOpen and IsFullyClosed (#2337) * Update Player.cs (#2347) * Update for PostXMAS (#2383) * Update for PostXMAS * WeaponFixFromXMAS * remove var * Fix RegisteringEvent * more var remove * 8.7.0 * 8.7.1 * Fix build errors --------- Co-authored-by: SmusiJarviss <84509587+SmusiJarviss@users.noreply.github.com> Co-authored-by: Artem Košilinskis <46756889+ITeMbI4@users.noreply.github.com> Co-authored-by: Thunder Co-authored-by: Ika <36999341+SiphoxR@users.noreply.github.com> Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> Co-authored-by: warden161 <118567564+warden161@users.noreply.github.com> Co-authored-by: joker-119 Co-authored-by: Nao Co-authored-by: louis1706 Co-authored-by: VALERA771 <72030575+VALERA771@users.noreply.github.com> Co-authored-by: Bolton <48883340+BoltonDev@users.noreply.github.com> Co-authored-by: Claudio <72409092+ClaudioPanConQueso@users.noreply.github.com> Co-authored-by: TtroubleTT <121741230+TtroubleTT@users.noreply.github.com> Co-authored-by: Misaka-ZeroTwo <45165615+Misaka-ZeroTwo@users.noreply.github.com> Co-authored-by: IRacle <79921583+IRacle1@users.noreply.github.com> Co-authored-by: Nameless <85962933+Misfiy@users.noreply.github.com> Co-authored-by: Snivy FIlms <120346554+NikkiGardiner1@users.noreply.github.com> Co-authored-by: sanyae2439 <30918724+sanyae2439@users.noreply.github.com> Co-authored-by: FUTURE <69786695+FUTURE-SL@users.noreply.github.com> Co-authored-by: Rue <135553058+Ruemena@users.noreply.github.com> Co-authored-by: NotIntense Co-authored-by: Nikki Gardiner Co-authored-by: 白泽 <96401952+XKaguya@users.noreply.github.com> Co-authored-by: BoltonII Co-authored-by: Artyomus1337 <92204916+Artyomus1337@users.noreply.github.com> Co-authored-by: Rysik5318 <72207886+Rysik5318@users.noreply.github.com> Co-authored-by: 白泽 Co-authored-by: Miki_hero <100715076+Mikihero@users.noreply.github.com> --- .editorconfig | 567 +----------------- EXILED.props | 2 +- Exiled.API/Enums/EffectType.cs | 8 +- Exiled.API/Enums/Side.cs | 2 +- Exiled.API/Extensions/CommonExtensions.cs | 4 +- Exiled.API/Extensions/EffectTypeExtension.cs | 32 +- Exiled.API/Extensions/ItemExtensions.cs | 9 +- Exiled.API/Extensions/ReflectionExtensions.cs | 4 +- .../DamageHandlers/AttackerDamageHandler.cs | 2 +- Exiled.API/Features/Doors/CheckpointDoor.cs | 6 +- Exiled.API/Features/Doors/Gate.cs | 6 +- Exiled.API/Features/Effect.cs | 4 +- Exiled.API/Features/Generator.cs | 2 +- Exiled.API/Features/Items/Item.cs | 13 + Exiled.API/Features/Items/Scp244.cs | 36 ++ Exiled.API/Features/Log.cs | 4 +- Exiled.API/Features/Pickups/Scp244Pickup.cs | 25 +- Exiled.API/Features/Player.cs | 28 +- Exiled.API/Features/Ragdoll.cs | 7 +- Exiled.API/Features/Roles/Scp079Role.cs | 2 +- Exiled.API/Features/Room.cs | 14 +- Exiled.API/Features/Round.cs | 2 +- Exiled.API/Features/Scp3114Ragdoll.cs | 78 +++ Exiled.API/Features/Scp914.cs | 11 + Exiled.API/Features/Toys/AdminToy.cs | 28 + Exiled.API/Structs/ArmorAmmoLimit.cs | 4 +- Exiled.API/Structs/PrimitiveSettings.cs | 143 +++-- .../API/Features/CustomGrenade.cs | 4 +- .../API/Features/CustomWeapon.cs | 40 +- .../Commands/PluginManager/PluginManager.cs | 2 +- .../Cassie/SendingCassieMessageEventArgs.cs | 18 +- .../EventArgs/Interfaces/IAttackerEvent.cs | 6 +- .../EventArgs/Interfaces/ICameraEvent.cs | 4 +- .../EventArgs/Interfaces/IDeniableEvent.cs | 4 +- .../EventArgs/Interfaces/IDoorEvent.cs | 4 +- .../EventArgs/Interfaces/IExiledEvent.cs | 2 +- .../EventArgs/Interfaces/IFirearmEvent.cs | 4 +- .../EventArgs/Interfaces/IGeneratorEvent.cs | 4 +- .../EventArgs/Interfaces/IItemEvent.cs | 4 +- .../EventArgs/Interfaces/IPickupEvent.cs | 4 +- .../EventArgs/Interfaces/IPlayerEvent.cs | 4 +- .../EventArgs/Interfaces/IRagdollEvent.cs | 4 +- .../EventArgs/Interfaces/IRoomEvent.cs | 4 +- .../EventArgs/Interfaces/IScp0492Event.cs | 4 +- .../EventArgs/Interfaces/IScp049Event.cs | 4 +- .../EventArgs/Interfaces/IScp079Event.cs | 4 +- .../EventArgs/Interfaces/IScp096Event.cs | 4 +- .../EventArgs/Interfaces/IScp106Event.cs | 4 +- .../EventArgs/Interfaces/IScp173Event.cs | 4 +- .../EventArgs/Interfaces/IScp3114Event.cs | 4 +- .../EventArgs/Interfaces/IScp939Event.cs | 4 +- .../EventArgs/Interfaces/ITeslaEvent.cs | 4 +- .../EventArgs/Interfaces/IUsableEvent.cs | 4 +- .../Item/ChangingAttachmentsEventArgs.cs | 24 +- .../Item/ReceivingPreferenceEventArgs.cs | 28 +- .../Item/UsingRadioPickupBatteryEventArgs.cs | 45 ++ .../Map/AnnouncingDecontaminationEventArgs.cs | 16 +- .../Map/AnnouncingNtfEntranceEventArgs.cs | 20 +- .../Map/AnnouncingScpTerminationEventArgs.cs | 22 +- .../Map/ChangingIntoGrenadeEventArgs.cs | 6 +- .../EventArgs/Map/DecontaminatingEventArgs.cs | 8 +- .../Map/ExplodingGrenadeEventArgs.cs | 18 +- .../EventArgs/Map/FillingLockerEventArgs.cs | 14 +- .../Map/GeneratorActivatingEventArgs.cs | 12 +- .../EventArgs/Map/PickupAddedEventArgs.cs | 8 +- .../EventArgs/Map/PickupDestroyedEventArgs.cs | 8 +- .../EventArgs/Map/PlacingBloodEventArgs.cs | 20 +- .../Map/PlacingBulletHoleEventArgs.cs | 16 +- .../EventArgs/Map/SpawningItemEventArgs.cs | 22 +- .../Map/SpawningTeamVehicleEventArgs.cs | 12 +- .../Player/ActivatingGeneratorEventArgs.cs | 16 +- .../Player/ActivatingWarheadPanelEventArgs.cs | 12 +- .../Player/ActivatingWorkstationEventArgs.cs | 18 +- .../Player/AimingDownSightEventArgs.cs | 20 +- .../EventArgs/Player/BannedEventArgs.cs | 14 +- .../EventArgs/Player/BanningEventArgs.cs | 6 +- .../Player/CancelledItemUseEventArgs.cs | 10 +- .../Player/CancellingItemUseEventArgs.cs | 12 +- .../EventArgs/Player/ChangedItemEventArgs.cs | 16 +- .../Player/ChangingGroupEventArgs.cs | 14 +- .../ChangingIntercomMuteStatusEventArgs.cs | 16 +- .../EventArgs/Player/ChangingItemEventArgs.cs | 14 +- .../Player/ChangingMicroHIDStateEventArgs.cs | 24 +- .../Player/ChangingMoveStateEventArgs.cs | 20 +- .../Player/ChangingMuteStatusEventArgs.cs | 16 +- .../Player/ChangingRadioPresetEventArgs.cs | 24 +- .../EventArgs/Player/ChangingRoleEventArgs.cs | 28 +- .../ChangingSpectatedPlayerEventArgs.cs | 16 +- .../Player/ClosingGeneratorEventArgs.cs | 10 +- .../EventArgs/Player/DamagingDoorEventArgs.cs | 16 +- .../Player/DamagingShootingTargetEventArgs.cs | 34 +- .../Player/DamagingWindowEventArgs.cs | 16 +- .../DeactivatingWorkstationEventArgs.cs | 16 +- .../EventArgs/Player/DestroyingEventArgs.cs | 8 +- .../EventArgs/Player/DiedEventArgs.cs | 16 +- .../EventArgs/Player/DroppedAmmoEventArgs.cs | 20 +- .../EventArgs/Player/DroppedItemEventArgs.cs | 12 +- .../EventArgs/Player/DroppingAmmoEventArgs.cs | 20 +- .../EventArgs/Player/DroppingItemEventArgs.cs | 20 +- .../Player/DroppingNothingEventArgs.cs | 8 +- .../Player/DryfiringWeaponEventArgs.cs | 16 +- .../EventArgs/Player/DyingEventArgs.cs | 18 +- .../Player/EarningAchievementEventArgs.cs | 16 +- .../EnteringPocketDimensionEventArgs.cs | 16 +- .../EventArgs/Player/EscapingEventArgs.cs | 42 +- .../EscapingPocketDimensionEventArgs.cs | 14 +- .../FailingEscapePocketDimensionEventArgs.cs | 16 +- .../EventArgs/Player/FlippingCoinEventArgs.cs | 16 +- .../EventArgs/Player/HandcuffingEventArgs.cs | 16 +- .../EventArgs/Player/HurtEventArgs.cs | 14 +- .../EventArgs/Player/HurtingEventArgs.cs | 10 +- .../EventArgs/Player/InteractedEventArgs.cs | 8 +- .../Player/InteractingDoorEventArgs.cs | 16 +- .../Player/InteractingElevatorEventArgs.cs | 18 +- .../Player/InteractingLockerEventArgs.cs | 24 +- .../InteractingShootingTargetEventArgs.cs | 28 +- .../Player/IntercomSpeakingEventArgs.cs | 12 +- .../EventArgs/Player/IssuingMuteEventArgs.cs | 16 +- .../EventArgs/Player/JoinedEventArgs.cs | 8 +- .../EventArgs/Player/JumpingEventArgs.cs | 18 +- .../EventArgs/Player/KickedEventArgs.cs | 12 +- .../EventArgs/Player/KickingEventArgs.cs | 26 +- .../EventArgs/Player/LandingEventArgs.cs | 8 +- .../Player/LocalReportingEventArgs.cs | 20 +- .../EventArgs/Player/MakingNoiseEventArgs.cs | 6 +- .../Player/OpeningGeneratorEventArgs.cs | 16 +- .../Player/PickingUpItemEventArgs.cs | 16 +- .../Player/PreAuthenticatingEventArgs.cs | 38 +- .../Player/ReceivingEffectEventArgs.cs | 18 +- .../Player/ReloadingWeaponEventArgs.cs | 16 +- .../Player/RemovingHandcuffsEventArgs.cs | 10 +- .../Player/ReservedSlotsCheckEventArgs.cs | 14 +- .../EventArgs/Player/RevokingMuteEventArgs.cs | 4 +- .../Player/SearchingPickupEventArgs.cs | 26 +- .../SendingAdminChatMessageEventsArgs.cs | 16 +- .../EventArgs/Player/ShootingEventArgs.cs | 28 +- .../EventArgs/Player/ShotEventArgs.cs | 30 +- .../EventArgs/Player/SpawnedEventArgs.cs | 12 +- .../Player/SpawnedRagdollEventArgs.cs | 30 +- .../EventArgs/Player/SpawningEventArgs.cs | 24 +- .../Player/SpawningRagdollEventArgs.cs | 30 +- .../Player/StoppingGeneratorEventArgs.cs | 10 +- .../Player/TogglingFlashlightEventArgs.cs | 18 +- .../Player/TogglingNoClipEventArgs.cs | 16 +- .../Player/TogglingRadioEventArgs.cs | 67 +++ .../TogglingWeaponFlashlightEventArgs.cs | 20 +- .../EventArgs/Player/TransmittingEventArgs.cs | 32 +- .../Player/TriggeringTeslaEventArgs.cs | 22 +- .../Player/UnloadingWeaponEventArgs.cs | 16 +- .../Player/UnlockingGeneratorEventArgs.cs | 16 +- .../EventArgs/Player/UsedItemEventArgs.cs | 12 +- .../Player/UsingItemCompletedEventArgs.cs | 12 +- .../EventArgs/Player/UsingItemEventArgs.cs | 16 +- .../Player/UsingMicroHIDEnergyEventArgs.cs | 24 +- .../Player/UsingRadioBatteryEventArgs.cs | 20 +- .../EventArgs/Player/VerifiedEventArgs.cs | 8 +- .../Player/VoiceChattingEventArgs.cs | 20 +- .../Scp049/ActivatingSenseEventArgs.cs | 2 +- .../Scp049/FinishingRecallEventArgs.cs | 20 +- .../Scp0492/ConsumedCorpseEventArgs.cs | 8 +- .../Scp0492/ConsumingCorpseEventArgs.cs | 8 +- .../Scp079/ChangingCameraEventArgs.cs | 22 +- .../Scp079/ChangingSpeakerStatusEventArgs.cs | 14 +- .../Scp079/ElevatorTeleportingEventArgs.cs | 24 +- .../Scp079/GainingExperienceEventArgs.cs | 26 +- .../EventArgs/Scp079/GainingLevelEventArgs.cs | 16 +- .../Scp079/InteractingTeslaEventArgs.cs | 18 +- .../EventArgs/Scp079/LockingDownEventArgs.cs | 18 +- .../EventArgs/Scp079/PingingEventArgs.cs | 26 +- .../EventArgs/Scp079/RecontainedEventArgs.cs | 8 +- .../EventArgs/Scp079/RoomBlackoutEventArgs.cs | 28 +- .../Scp079/StartingSpeakerEventArgs.cs | 20 +- .../Scp079/StoppingSpeakerEventArgs.cs | 16 +- .../Scp079/TriggeringDoorEventArgs.cs | 18 +- .../EventArgs/Scp079/ZoneBlackoutEventArgs.cs | 28 +- .../EventArgs/Scp096/AddingTargetEventArgs.cs | 20 +- .../EventArgs/Scp096/CalmingDownEventArgs.cs | 10 +- .../EventArgs/Scp096/ChargingEventArgs.cs | 12 +- .../EventArgs/Scp096/EnragingEventArgs.cs | 16 +- .../Scp096/StartPryingGateEventArgs.cs | 18 +- .../Scp096/TryingNotToCryEventArgs.cs | 18 +- .../EventArgs/Scp106/ExitStalkingEventArgs.cs | 2 +- .../EventArgs/Scp106/StalkingEventArgs.cs | 2 +- .../EventArgs/Scp106/TeleportingEventArgs.cs | 16 +- .../EventArgs/Scp173/BlinkingEventArgs.cs | 20 +- .../Scp173/BlinkingRequestEventArgs.cs | 14 +- .../Scp173/PlacingTantrumEventArgs.cs | 22 +- .../Scp173/UsingBreakneckSpeedsEventArgs.cs | 12 +- .../Scp244/DamagingScp244EventArgs.cs | 14 +- .../Scp244/OpeningScp244EventArgs.cs | 8 +- .../EventArgs/Scp244/UsingScp244EventArgs.cs | 16 +- .../EventArgs/Scp3114/DisguisedEventArgs.cs | 16 +- .../EventArgs/Scp3114/DisguisingEventArgs.cs | 22 +- .../EventArgs/Scp3114/RevealedEventArgs.cs | 19 +- .../EventArgs/Scp3114/RevealingEventArgs.cs | 21 +- .../EventArgs/Scp3114/TryUseBodyEventArgs.cs | 17 +- .../EventArgs/Scp3114/VoiceLinesEventArgs.cs | 55 ++ .../Scp330/DroppingScp330EventArgs.cs | 18 +- .../EventArgs/Scp330/EatenScp330EventArgs.cs | 8 +- .../EventArgs/Scp330/EatingScp330EventArgs.cs | 10 +- .../Scp330/InteractingScp330EventArgs.cs | 16 +- .../EventArgs/Scp914/ActivatingEventArgs.cs | 12 +- .../Scp914/ChangingKnobSettingEventArgs.cs | 16 +- .../Scp914/UpgradingInventoryItemEventArgs.cs | 31 +- .../Scp914/UpgradingPickupEventArgs.cs | 29 +- .../Scp914/UpgradingPlayerEventArgs.cs | 22 +- .../Scp939/ChangingFocusEventArgs.cs | 16 +- .../EventArgs/Scp939/LungingEventArgs.cs | 8 +- .../Scp939/PlacingAmnesticCloudEventArgs.cs | 24 +- .../EventArgs/Scp939/PlayingSoundEventArgs.cs | 24 +- .../EventArgs/Scp939/PlayingVoiceEventArgs.cs | 14 +- .../EventArgs/Scp939/SavingVoiceEventArgs.cs | 16 +- .../Scp939/ValidatingVisibilityEventArgs.cs | 57 ++ .../Server/ChoosingStartTeamQueueEventArgs.cs | 12 +- .../EventArgs/Server/EndingRoundEventArgs.cs | 22 +- .../Server/ReportingCheaterEventArgs.cs | 24 +- .../Server/RespawningTeamEventArgs.cs | 24 +- .../EventArgs/Server/RoundEndedEventArgs.cs | 16 +- .../Server/SelectingRespawnTeamEventArgs.cs | 35 ++ .../Warhead/ChangingLeverStatusEventArgs.cs | 16 +- .../EventArgs/Warhead/DetonatingEventArgs.cs | 2 +- .../EventArgs/Warhead/StartingEventArgs.cs | 6 +- .../EventArgs/Warhead/StoppingEventArgs.cs | 12 +- Exiled.Events/Events.cs | 6 +- Exiled.Events/Features/Event.cs | 85 +++ Exiled.Events/Features/Event{T}.cs | 87 +++ Exiled.Events/Handlers/Cassie.cs | 4 +- Exiled.Events/Handlers/Internal/Round.cs | 7 +- .../Handlers/Internal/SceneUnloaded.cs | 18 +- Exiled.Events/Handlers/Item.cs | 23 +- Exiled.Events/Handlers/Player.cs | 11 + Exiled.Events/Handlers/Scp049.cs | 18 +- Exiled.Events/Handlers/Scp079.cs | 50 +- Exiled.Events/Handlers/Scp096.cs | 26 +- Exiled.Events/Handlers/Scp106.cs | 18 +- Exiled.Events/Handlers/Scp173.cs | 18 +- Exiled.Events/Handlers/Scp244.cs | 14 +- Exiled.Events/Handlers/Scp3114.cs | 33 +- Exiled.Events/Handlers/Scp330.cs | 18 +- Exiled.Events/Handlers/Scp914.cs | 22 +- Exiled.Events/Handlers/Scp939.cs | 37 +- Exiled.Events/Handlers/Server.cs | 11 + Exiled.Events/Handlers/Warhead.cs | 22 +- .../Events/Cassie/SendingCassieMessage.cs | 4 +- .../Patches/Events/Item/ChangingAmmo.cs | 4 +- .../Events/Item/ChangingAttachments.cs | 6 +- .../Patches/Events/Item/JailbirdPatch.cs | 6 +- .../Events/Item/ReceivingPreference.cs | 6 +- .../Events/Item/UsingRadioPickupBattery.cs | 79 +++ .../Events/Map/AnnouncingDecontamination.cs | 4 +- .../Events/Map/AnnouncingNtfEntrance.cs | 4 +- .../Events/Map/AnnouncingScpTermination.cs | 6 +- .../Patches/Events/Map/BreakingScp2176.cs | 4 +- .../Patches/Events/Map/ChangingIntoGrenade.cs | 6 +- .../Patches/Events/Map/Decontaminating.cs | 4 +- .../Patches/Events/Map/FillingLocker.cs | 4 +- .../Patches/Events/Map/GeneratorActivating.cs | 4 +- .../Patches/Events/Map/PlacingBulletHole.cs | 4 +- .../Patches/Events/Map/SpawningItem.cs | 4 +- .../Events/Player/ActivatingWarheadPanel.cs | 4 +- .../Events/Player/ActivatingWorkstation.cs | 4 +- Exiled.Events/Patches/Events/Player/Banned.cs | 4 +- .../Patches/Events/Player/Banning.cs | 4 +- .../Patches/Events/Player/ChangedItem.cs | 4 +- .../Patches/Events/Player/ChangingGroup.cs | 4 +- .../Patches/Events/Player/ChangingItem.cs | 4 +- .../Events/Player/ChangingMoveState.cs | 4 +- .../Events/Player/ChangingRadioPreset.cs | 4 +- .../Events/Player/ChangingRoleAndSpawned.cs | 4 +- .../Player/ChangingSpectatedPlayerPatch.cs | 4 +- .../Patches/Events/Player/DamagingDoor.cs | 4 +- .../Events/Player/DamagingShootingTarget.cs | 4 +- .../Patches/Events/Player/DamagingWindow.cs | 4 +- .../Events/Player/DeactivatingWorkstation.cs | 4 +- .../Patches/Events/Player/Destroying.cs | 4 +- .../Patches/Events/Player/DroppingAmmo.cs | 4 +- .../Patches/Events/Player/DroppingItem.cs | 4 +- .../Patches/Events/Player/DyingAndDied.cs | 4 +- .../Events/Player/EarningAchievement.cs | 4 +- .../Events/Player/EnteringPocketDimension.cs | 4 +- .../Player/FailingEscapePocketDimension.cs | 4 +- .../Events/Player/FirearmRequestReceived.cs | 8 +- .../Patches/Events/Player/FlippingCoin.cs | 6 +- .../Patches/Events/Player/Hurting.cs | 4 +- .../Patches/Events/Player/Interacted.cs | 4 +- .../Patches/Events/Player/InteractingDoor.cs | 4 +- .../Events/Player/InteractingElevator.cs | 4 +- .../Events/Player/InteractingLocker.cs | 4 +- .../Player/InteractingShootingTarget.cs | 4 +- .../Patches/Events/Player/IntercomSpeaking.cs | 4 +- .../Patches/Events/Player/IssuingMute.cs | 4 +- Exiled.Events/Patches/Events/Player/Joined.cs | 4 +- .../Patches/Events/Player/Jumping.cs | 4 +- Exiled.Events/Patches/Events/Player/Kicked.cs | 4 +- .../Patches/Events/Player/Kicking.cs | 4 +- .../Patches/Events/Player/Landing.cs | 10 +- Exiled.Events/Patches/Events/Player/Left.cs | 4 +- .../Patches/Events/Player/PickingUp330.cs | 4 +- .../Patches/Events/Player/PickingUpAmmo.cs | 2 +- .../Patches/Events/Player/PickingUpArmor.cs | 4 +- .../Patches/Events/Player/PickingUpItem.cs | 4 +- .../Patches/Events/Player/PickingUpScp244.cs | 4 +- .../Events/Player/ProcessDisarmMessage.cs | 4 +- .../Events/Player/ReservedSlotPatch.cs | 4 +- .../Patches/Events/Player/RevokingMute.cs | 4 +- .../Events/Player/SearchingPickupEvent.cs | 4 +- .../Events/Player/SendingAdminChatMessage.cs | 4 +- .../Patches/Events/Player/Shooting.cs | 51 +- Exiled.Events/Patches/Events/Player/Shot.cs | 12 +- .../Patches/Events/Player/SpawningRagdoll.cs | 4 +- .../Patches/Events/Player/ThrowingRequest.cs | 4 +- .../Events/Player/TogglingFlashlight.cs | 4 +- .../Patches/Events/Player/TogglingNoClip.cs | 4 +- .../Patches/Events/Player/TogglingRadio.cs | 115 ++++ .../Patches/Events/Player/Transmitting.cs | 80 --- .../Patches/Events/Player/TriggeringTesla.cs | 4 +- .../Player/UsingAndCancellingItemUse.cs | 8 +- .../Events/Player/UsingItemCompleted.cs | 4 +- .../Events/Player/UsingMicroHIDEnergy.cs | 4 +- .../Events/Player/UsingRadioBattery.cs | 4 +- .../Patches/Events/Player/Verified.cs | 4 +- .../Patches/Events/Player/VoiceChatting.cs | 41 +- .../Patches/Events/Scp049/ActivatingSense.cs | 4 +- .../Patches/Events/Scp049/FinishingRecall.cs | 4 +- .../Patches/Events/Scp049/SendingCall.cs | 4 +- .../Patches/Events/Scp0492/Consumed.cs | 4 +- .../Patches/Events/Scp0492/Consuming.cs | 6 +- .../Patches/Events/Scp079/ChangingCamera.cs | 4 +- .../ChangingSpeakerStatusAndVoiceChatting.cs | 4 +- .../Events/Scp079/ElevatorTeleporting.cs | 4 +- .../Events/Scp079/GainingExperience.cs | 4 +- .../Patches/Events/Scp079/GainingLevel.cs | 4 +- .../Patches/Events/Scp079/InteractingTesla.cs | 4 +- .../Patches/Events/Scp079/LockingDown.cs | 4 +- .../Patches/Events/Scp079/Pinging.cs | 4 +- .../Patches/Events/Scp079/RoomBlackout.cs | 4 +- .../Patches/Events/Scp079/TriggeringDoor.cs | 4 +- .../Patches/Events/Scp079/ZoneBlackout.cs | 4 +- .../Patches/Events/Scp096/AddingTarget.cs | 4 +- .../Patches/Events/Scp096/CalmingDown.cs | 4 +- .../Patches/Events/Scp096/Charging.cs | 4 +- .../Patches/Events/Scp096/Enraging.cs | 4 +- .../Patches/Events/Scp096/StartPryingGate.cs | 4 +- .../Patches/Events/Scp096/TryingNotToCry.cs | 4 +- .../Patches/Events/Scp106/Teleporting.cs | 6 +- .../Patches/Events/Scp173/Blinking.cs | 4 +- .../Patches/Events/Scp173/BlinkingRequest.cs | 4 +- .../Events/Scp173/UsingBreakneckSpeeds.cs | 6 +- .../Patches/Events/Scp244/DamagingScp244.cs | 4 +- .../Patches/Events/Scp244/UpdateScp244.cs | 4 +- .../Patches/Events/Scp244/UsingScp244.cs | 4 +- .../Patches/Events/Scp3114/Disguising.cs | 86 ++- .../Patches/Events/Scp3114/Revealing.cs | 182 ++++-- .../Patches/Events/Scp3114/TryUseBody.cs | 76 ++- .../Patches/Events/Scp3114/VoiceLines.cs | 83 +++ .../Patches/Events/Scp330/DroppingCandy.cs | 4 +- .../Patches/Events/Scp330/EatingScp330.cs | 4 +- .../Events/Scp330/InteractingScp330.cs | 4 +- .../Events/Scp914/InteractingEvents.cs | 4 +- .../Patches/Events/Scp914/UpgradingItem.cs | 4 +- .../Patches/Events/Scp914/UpgradingPlayer.cs | 4 +- Exiled.Events/Patches/Events/Scp939/Focus.cs | 4 +- Exiled.Events/Patches/Events/Scp939/Lunge.cs | 4 +- .../Events/Scp939/PlacingAmnesticCloud.cs | 4 +- .../Patches/Events/Scp939/PlayingSound.cs | 4 +- .../Patches/Events/Scp939/PlayingVoice.cs | 4 +- .../Patches/Events/Scp939/SavingVoice.cs | 4 +- .../Events/Scp939/ValidatingVisibility.cs | 32 + .../Events/Server/ChoosingStartTeamQueue.cs | 4 +- .../Patches/Events/Server/Reporting.cs | 4 +- .../Patches/Events/Server/RespawningTeam.cs | 4 +- .../Patches/Events/Server/RestartingRound.cs | 4 +- .../Patches/Events/Server/RoundEnd.cs | 41 +- .../Events/Server/SelectingRespawnTeam.cs | 64 ++ .../Events/Warhead/ChangingLeverStatus.cs | 4 +- .../Patches/Events/Warhead/Detonation.cs | 4 +- .../Patches/Events/Warhead/Starting.cs | 4 +- .../Patches/Events/Warhead/Stopping.cs | 4 +- Exiled.Events/Patches/Fixes/HurtingFix.cs | 2 +- .../Patches/Fixes/Scp3114AttackAhpFix.cs | 44 ++ Exiled.Events/Patches/Generic/DoorList.cs | 55 +- .../Patches/Generic/IndividualFriendlyFire.cs | 10 +- Exiled.Events/Patches/Generic/Scp079Scan.cs | 5 +- .../Patches/Generic/Scp173BeingLooked.cs | 55 +- Exiled.Installer/CommandSettings.cs | 2 +- Exiled.Installer/Program.cs | 46 +- docs/docs/Plugins/Events.md | 30 +- docs/docs/Resources/Intro.md | 34 +- 388 files changed, 3666 insertions(+), 2842 deletions(-) create mode 100644 Exiled.API/Features/Scp3114Ragdoll.cs create mode 100644 Exiled.Events/EventArgs/Item/UsingRadioPickupBatteryEventArgs.cs create mode 100644 Exiled.Events/EventArgs/Player/TogglingRadioEventArgs.cs create mode 100644 Exiled.Events/EventArgs/Scp3114/VoiceLinesEventArgs.cs create mode 100644 Exiled.Events/EventArgs/Scp939/ValidatingVisibilityEventArgs.cs create mode 100644 Exiled.Events/EventArgs/Server/SelectingRespawnTeamEventArgs.cs create mode 100644 Exiled.Events/Patches/Events/Item/UsingRadioPickupBattery.cs create mode 100644 Exiled.Events/Patches/Events/Player/TogglingRadio.cs delete mode 100644 Exiled.Events/Patches/Events/Player/Transmitting.cs create mode 100644 Exiled.Events/Patches/Events/Scp3114/VoiceLines.cs create mode 100644 Exiled.Events/Patches/Events/Scp939/ValidatingVisibility.cs create mode 100644 Exiled.Events/Patches/Events/Server/SelectingRespawnTeam.cs create mode 100644 Exiled.Events/Patches/Fixes/Scp3114AttackAhpFix.cs diff --git a/.editorconfig b/.editorconfig index 73a9fdec44..3124f1d41f 100644 --- a/.editorconfig +++ b/.editorconfig @@ -15,103 +15,20 @@ ij_smart_tabs = false ij_visual_guides = none ij_wrap_on_typing = false +[*.cs] +csharp_style_var_for_built_in_types = false:error +csharp_style_var_when_type_is_apparent = false:error +csharp_style_var_elsewhere = false:error + # ReSharper properties resharper_csharp_max_line_length = 400 -[*.css] -ij_css_align_closing_brace_with_properties = false -ij_css_blank_lines_around_nested_selector = 1 -ij_css_blank_lines_between_blocks = 1 -ij_css_block_comment_add_space = false -ij_css_brace_placement = end_of_line -ij_css_enforce_quotes_on_format = false -ij_css_hex_color_long_format = false -ij_css_hex_color_lower_case = false -ij_css_hex_color_short_format = false -ij_css_hex_color_upper_case = false -ij_css_keep_blank_lines_in_code = 2 -ij_css_keep_indents_on_empty_lines = false -ij_css_keep_single_line_blocks = false -ij_css_properties_order = font, font-family, font-size, font-weight, font-style, font-variant, font-size-adjust, font-stretch, line-height, position, z-index, top, right, bottom, left, display, visibility, float, clear, overflow, overflow-x, overflow-y, clip, zoom, align-content, align-items, align-self, flex, flex-flow, flex-basis, flex-direction, flex-grow, flex-shrink, flex-wrap, justify-content, order, box-sizing, width, min-width, max-width, height, min-height, max-height, margin, margin-top, margin-right, margin-bottom, margin-left, padding, padding-top, padding-right, padding-bottom, padding-left, table-layout, empty-cells, caption-side, border-spacing, border-collapse, list-style, list-style-position, list-style-type, list-style-image, content, quotes, counter-reset, counter-increment, resize, cursor, user-select, nav-index, nav-up, nav-right, nav-down, nav-left, transition, transition-delay, transition-timing-function, transition-duration, transition-property, transform, transform-origin, animation, animation-name, animation-duration, animation-play-state, animation-timing-function, animation-delay, animation-iteration-count, animation-direction, text-align, text-align-last, vertical-align, white-space, text-decoration, text-emphasis, text-emphasis-color, text-emphasis-style, text-emphasis-position, text-indent, text-justify, letter-spacing, word-spacing, text-outline, text-transform, text-wrap, text-overflow, text-overflow-ellipsis, text-overflow-mode, word-wrap, word-break, tab-size, hyphens, pointer-events, opacity, color, border, border-width, border-style, border-color, border-top, border-top-width, border-top-style, border-top-color, border-right, border-right-width, border-right-style, border-right-color, border-bottom, border-bottom-width, border-bottom-style, border-bottom-color, border-left, border-left-width, border-left-style, border-left-color, border-radius, border-top-left-radius, border-top-right-radius, border-bottom-right-radius, border-bottom-left-radius, border-image, border-image-source, border-image-slice, border-image-width, border-image-outset, border-image-repeat, outline, outline-width, outline-style, outline-color, outline-offset, background, background-color, background-image, background-repeat, background-attachment, background-position, background-position-x, background-position-y, background-clip, background-origin, background-size, box-decoration-break, box-shadow, text-shadow -ij_css_space_after_colon = true -ij_css_space_before_opening_brace = true -ij_css_use_double_quotes = true -ij_css_value_alignment = do_not_align - -[*.less] -indent_size = 2 -ij_less_align_closing_brace_with_properties = false -ij_less_blank_lines_around_nested_selector = 1 -ij_less_blank_lines_between_blocks = 1 -ij_less_block_comment_add_space = false -ij_less_brace_placement = 0 -ij_less_enforce_quotes_on_format = false -ij_less_hex_color_long_format = false -ij_less_hex_color_lower_case = false -ij_less_hex_color_short_format = false -ij_less_hex_color_upper_case = false -ij_less_keep_blank_lines_in_code = 2 -ij_less_keep_indents_on_empty_lines = false -ij_less_keep_single_line_blocks = false -ij_less_line_comment_add_space = false -ij_less_line_comment_at_first_column = false -ij_less_properties_order = font, font-family, font-size, font-weight, font-style, font-variant, font-size-adjust, font-stretch, line-height, position, z-index, top, right, bottom, left, display, visibility, float, clear, overflow, overflow-x, overflow-y, clip, zoom, align-content, align-items, align-self, flex, flex-flow, flex-basis, flex-direction, flex-grow, flex-shrink, flex-wrap, justify-content, order, box-sizing, width, min-width, max-width, height, min-height, max-height, margin, margin-top, margin-right, margin-bottom, margin-left, padding, padding-top, padding-right, padding-bottom, padding-left, table-layout, empty-cells, caption-side, border-spacing, border-collapse, list-style, list-style-position, list-style-type, list-style-image, content, quotes, counter-reset, counter-increment, resize, cursor, user-select, nav-index, nav-up, nav-right, nav-down, nav-left, transition, transition-delay, transition-timing-function, transition-duration, transition-property, transform, transform-origin, animation, animation-name, animation-duration, animation-play-state, animation-timing-function, animation-delay, animation-iteration-count, animation-direction, text-align, text-align-last, vertical-align, white-space, text-decoration, text-emphasis, text-emphasis-color, text-emphasis-style, text-emphasis-position, text-indent, text-justify, letter-spacing, word-spacing, text-outline, text-transform, text-wrap, text-overflow, text-overflow-ellipsis, text-overflow-mode, word-wrap, word-break, tab-size, hyphens, pointer-events, opacity, color, border, border-width, border-style, border-color, border-top, border-top-width, border-top-style, border-top-color, border-right, border-right-width, border-right-style, border-right-color, border-bottom, border-bottom-width, border-bottom-style, border-bottom-color, border-left, border-left-width, border-left-style, border-left-color, border-radius, border-top-left-radius, border-top-right-radius, border-bottom-right-radius, border-bottom-left-radius, border-image, border-image-source, border-image-slice, border-image-width, border-image-outset, border-image-repeat, outline, outline-width, outline-style, outline-color, outline-offset, background, background-color, background-image, background-repeat, background-attachment, background-position, background-position-x, background-position-y, background-clip, background-origin, background-size, box-decoration-break, box-shadow, text-shadow -ij_less_space_after_colon = true -ij_less_space_before_opening_brace = true -ij_less_use_double_quotes = true -ij_less_value_alignment = 0 - [*.properties] ij_properties_align_group_field_declarations = false ij_properties_keep_blank_lines = false ij_properties_key_value_delimiter = equals ij_properties_spaces_around_key_value_delimiter = false -[*.sass] -indent_size = 2 -ij_sass_align_closing_brace_with_properties = false -ij_sass_blank_lines_around_nested_selector = 1 -ij_sass_blank_lines_between_blocks = 1 -ij_sass_brace_placement = 0 -ij_sass_enforce_quotes_on_format = false -ij_sass_hex_color_long_format = false -ij_sass_hex_color_lower_case = false -ij_sass_hex_color_short_format = false -ij_sass_hex_color_upper_case = false -ij_sass_keep_blank_lines_in_code = 2 -ij_sass_keep_indents_on_empty_lines = false -ij_sass_keep_single_line_blocks = false -ij_sass_line_comment_add_space = false -ij_sass_line_comment_at_first_column = false -ij_sass_properties_order = font, font-family, font-size, font-weight, font-style, font-variant, font-size-adjust, font-stretch, line-height, position, z-index, top, right, bottom, left, display, visibility, float, clear, overflow, overflow-x, overflow-y, clip, zoom, align-content, align-items, align-self, flex, flex-flow, flex-basis, flex-direction, flex-grow, flex-shrink, flex-wrap, justify-content, order, box-sizing, width, min-width, max-width, height, min-height, max-height, margin, margin-top, margin-right, margin-bottom, margin-left, padding, padding-top, padding-right, padding-bottom, padding-left, table-layout, empty-cells, caption-side, border-spacing, border-collapse, list-style, list-style-position, list-style-type, list-style-image, content, quotes, counter-reset, counter-increment, resize, cursor, user-select, nav-index, nav-up, nav-right, nav-down, nav-left, transition, transition-delay, transition-timing-function, transition-duration, transition-property, transform, transform-origin, animation, animation-name, animation-duration, animation-play-state, animation-timing-function, animation-delay, animation-iteration-count, animation-direction, text-align, text-align-last, vertical-align, white-space, text-decoration, text-emphasis, text-emphasis-color, text-emphasis-style, text-emphasis-position, text-indent, text-justify, letter-spacing, word-spacing, text-outline, text-transform, text-wrap, text-overflow, text-overflow-ellipsis, text-overflow-mode, word-wrap, word-break, tab-size, hyphens, pointer-events, opacity, color, border, border-width, border-style, border-color, border-top, border-top-width, border-top-style, border-top-color, border-right, border-right-width, border-right-style, border-right-color, border-bottom, border-bottom-width, border-bottom-style, border-bottom-color, border-left, border-left-width, border-left-style, border-left-color, border-radius, border-top-left-radius, border-top-right-radius, border-bottom-right-radius, border-bottom-left-radius, border-image, border-image-source, border-image-slice, border-image-width, border-image-outset, border-image-repeat, outline, outline-width, outline-style, outline-color, outline-offset, background, background-color, background-image, background-repeat, background-attachment, background-position, background-position-x, background-position-y, background-clip, background-origin, background-size, box-decoration-break, box-shadow, text-shadow -ij_sass_space_after_colon = true -ij_sass_space_before_opening_brace = true -ij_sass_use_double_quotes = true -ij_sass_value_alignment = 0 - -[*.scss] -indent_size = 2 -ij_scss_align_closing_brace_with_properties = false -ij_scss_blank_lines_around_nested_selector = 1 -ij_scss_blank_lines_between_blocks = 1 -ij_scss_block_comment_add_space = false -ij_scss_brace_placement = 0 -ij_scss_enforce_quotes_on_format = false -ij_scss_hex_color_long_format = false -ij_scss_hex_color_lower_case = false -ij_scss_hex_color_short_format = false -ij_scss_hex_color_upper_case = false -ij_scss_keep_blank_lines_in_code = 2 -ij_scss_keep_indents_on_empty_lines = false -ij_scss_keep_single_line_blocks = false -ij_scss_line_comment_add_space = false -ij_scss_line_comment_at_first_column = false -ij_scss_properties_order = font, font-family, font-size, font-weight, font-style, font-variant, font-size-adjust, font-stretch, line-height, position, z-index, top, right, bottom, left, display, visibility, float, clear, overflow, overflow-x, overflow-y, clip, zoom, align-content, align-items, align-self, flex, flex-flow, flex-basis, flex-direction, flex-grow, flex-shrink, flex-wrap, justify-content, order, box-sizing, width, min-width, max-width, height, min-height, max-height, margin, margin-top, margin-right, margin-bottom, margin-left, padding, padding-top, padding-right, padding-bottom, padding-left, table-layout, empty-cells, caption-side, border-spacing, border-collapse, list-style, list-style-position, list-style-type, list-style-image, content, quotes, counter-reset, counter-increment, resize, cursor, user-select, nav-index, nav-up, nav-right, nav-down, nav-left, transition, transition-delay, transition-timing-function, transition-duration, transition-property, transform, transform-origin, animation, animation-name, animation-duration, animation-play-state, animation-timing-function, animation-delay, animation-iteration-count, animation-direction, text-align, text-align-last, vertical-align, white-space, text-decoration, text-emphasis, text-emphasis-color, text-emphasis-style, text-emphasis-position, text-indent, text-justify, letter-spacing, word-spacing, text-outline, text-transform, text-wrap, text-overflow, text-overflow-ellipsis, text-overflow-mode, word-wrap, word-break, tab-size, hyphens, pointer-events, opacity, color, border, border-width, border-style, border-color, border-top, border-top-width, border-top-style, border-top-color, border-right, border-right-width, border-right-style, border-right-color, border-bottom, border-bottom-width, border-bottom-style, border-bottom-color, border-left, border-left-width, border-left-style, border-left-color, border-radius, border-top-left-radius, border-top-right-radius, border-bottom-right-radius, border-bottom-left-radius, border-image, border-image-source, border-image-slice, border-image-width, border-image-outset, border-image-repeat, outline, outline-width, outline-style, outline-color, outline-offset, background, background-color, background-image, background-repeat, background-attachment, background-position, background-position-x, background-position-y, background-clip, background-origin, background-size, box-decoration-break, box-shadow, text-shadow -ij_scss_space_after_colon = true -ij_scss_space_before_opening_brace = true -ij_scss_use_double_quotes = true -ij_scss_value_alignment = 0 - [*.styl] indent_size = 2 ij_stylus_align_closing_brace_with_properties = false @@ -132,17 +49,6 @@ ij_stylus_space_before_opening_brace = true ij_stylus_use_double_quotes = true ij_stylus_value_alignment = 0 -[*.vue] -indent_size = 2 -tab_width = 2 -ij_continuation_indent_size = 4 -ij_vue_indent_children_of_top_level = template -ij_vue_interpolation_new_line_after_start_delimiter = true -ij_vue_interpolation_new_line_before_end_delimiter = true -ij_vue_interpolation_wrap = off -ij_vue_keep_indents_on_empty_lines = false -ij_vue_spaces_within_interpolation_expressions = true - [.editorconfig] ij_editorconfig_align_group_field_declarations = false ij_editorconfig_space_after_colon = false @@ -170,177 +76,6 @@ ij_xml_space_around_equals_in_attribute = false ij_xml_space_inside_empty_tag = false ij_xml_text_wrap = normal -[{*.ats,*.cts,*.mts,*.ts}] -ij_continuation_indent_size = 4 -ij_typescript_align_imports = false -ij_typescript_align_multiline_array_initializer_expression = false -ij_typescript_align_multiline_binary_operation = false -ij_typescript_align_multiline_chained_methods = false -ij_typescript_align_multiline_extends_list = false -ij_typescript_align_multiline_for = true -ij_typescript_align_multiline_parameters = true -ij_typescript_align_multiline_parameters_in_calls = false -ij_typescript_align_multiline_ternary_operation = false -ij_typescript_align_object_properties = 0 -ij_typescript_align_union_types = false -ij_typescript_align_var_statements = 0 -ij_typescript_array_initializer_new_line_after_left_brace = false -ij_typescript_array_initializer_right_brace_on_new_line = false -ij_typescript_array_initializer_wrap = off -ij_typescript_assignment_wrap = off -ij_typescript_binary_operation_sign_on_next_line = false -ij_typescript_binary_operation_wrap = off -ij_typescript_blacklist_imports = rxjs/Rx, node_modules/**, **/node_modules/**, @angular/material, @angular/material/typings/** -ij_typescript_blank_lines_after_imports = 1 -ij_typescript_blank_lines_around_class = 1 -ij_typescript_blank_lines_around_field = 0 -ij_typescript_blank_lines_around_field_in_interface = 0 -ij_typescript_blank_lines_around_function = 1 -ij_typescript_blank_lines_around_method = 1 -ij_typescript_blank_lines_around_method_in_interface = 1 -ij_typescript_block_brace_style = end_of_line -ij_typescript_block_comment_add_space = false -ij_typescript_block_comment_at_first_column = true -ij_typescript_call_parameters_new_line_after_left_paren = false -ij_typescript_call_parameters_right_paren_on_new_line = false -ij_typescript_call_parameters_wrap = off -ij_typescript_catch_on_new_line = false -ij_typescript_chained_call_dot_on_new_line = true -ij_typescript_class_brace_style = end_of_line -ij_typescript_comma_on_new_line = false -ij_typescript_do_while_brace_force = never -ij_typescript_else_on_new_line = false -ij_typescript_enforce_trailing_comma = keep -ij_typescript_enum_constants_wrap = on_every_item -ij_typescript_extends_keyword_wrap = off -ij_typescript_extends_list_wrap = off -ij_typescript_field_prefix = _ -ij_typescript_file_name_style = relaxed -ij_typescript_finally_on_new_line = false -ij_typescript_for_brace_force = never -ij_typescript_for_statement_new_line_after_left_paren = false -ij_typescript_for_statement_right_paren_on_new_line = false -ij_typescript_for_statement_wrap = off -ij_typescript_force_quote_style = false -ij_typescript_force_semicolon_style = false -ij_typescript_function_expression_brace_style = end_of_line -ij_typescript_if_brace_force = never -ij_typescript_import_merge_members = global -ij_typescript_import_prefer_absolute_path = global -ij_typescript_import_sort_members = true -ij_typescript_import_sort_module_name = false -ij_typescript_import_use_node_resolution = true -ij_typescript_imports_wrap = on_every_item -ij_typescript_indent_case_from_switch = true -ij_typescript_indent_chained_calls = true -ij_typescript_indent_package_children = 0 -ij_typescript_jsdoc_include_types = false -ij_typescript_jsx_attribute_value = braces -ij_typescript_keep_blank_lines_in_code = 2 -ij_typescript_keep_first_column_comment = true -ij_typescript_keep_indents_on_empty_lines = false -ij_typescript_keep_line_breaks = true -ij_typescript_keep_simple_blocks_in_one_line = false -ij_typescript_keep_simple_methods_in_one_line = false -ij_typescript_line_comment_add_space = true -ij_typescript_line_comment_at_first_column = false -ij_typescript_method_brace_style = end_of_line -ij_typescript_method_call_chain_wrap = off -ij_typescript_method_parameters_new_line_after_left_paren = false -ij_typescript_method_parameters_right_paren_on_new_line = false -ij_typescript_method_parameters_wrap = off -ij_typescript_object_literal_wrap = on_every_item -ij_typescript_parentheses_expression_new_line_after_left_paren = false -ij_typescript_parentheses_expression_right_paren_on_new_line = false -ij_typescript_place_assignment_sign_on_next_line = false -ij_typescript_prefer_as_type_cast = false -ij_typescript_prefer_explicit_types_function_expression_returns = false -ij_typescript_prefer_explicit_types_function_returns = false -ij_typescript_prefer_explicit_types_vars_fields = false -ij_typescript_prefer_parameters_wrap = false -ij_typescript_reformat_c_style_comments = false -ij_typescript_space_after_colon = true -ij_typescript_space_after_comma = true -ij_typescript_space_after_dots_in_rest_parameter = false -ij_typescript_space_after_generator_mult = true -ij_typescript_space_after_property_colon = true -ij_typescript_space_after_quest = true -ij_typescript_space_after_type_colon = true -ij_typescript_space_after_unary_not = false -ij_typescript_space_before_async_arrow_lparen = true -ij_typescript_space_before_catch_keyword = true -ij_typescript_space_before_catch_left_brace = true -ij_typescript_space_before_catch_parentheses = true -ij_typescript_space_before_class_lbrace = true -ij_typescript_space_before_class_left_brace = true -ij_typescript_space_before_colon = true -ij_typescript_space_before_comma = false -ij_typescript_space_before_do_left_brace = true -ij_typescript_space_before_else_keyword = true -ij_typescript_space_before_else_left_brace = true -ij_typescript_space_before_finally_keyword = true -ij_typescript_space_before_finally_left_brace = true -ij_typescript_space_before_for_left_brace = true -ij_typescript_space_before_for_parentheses = true -ij_typescript_space_before_for_semicolon = false -ij_typescript_space_before_function_left_parenth = true -ij_typescript_space_before_generator_mult = false -ij_typescript_space_before_if_left_brace = true -ij_typescript_space_before_if_parentheses = true -ij_typescript_space_before_method_call_parentheses = false -ij_typescript_space_before_method_left_brace = true -ij_typescript_space_before_method_parentheses = false -ij_typescript_space_before_property_colon = false -ij_typescript_space_before_quest = true -ij_typescript_space_before_switch_left_brace = true -ij_typescript_space_before_switch_parentheses = true -ij_typescript_space_before_try_left_brace = true -ij_typescript_space_before_type_colon = false -ij_typescript_space_before_unary_not = false -ij_typescript_space_before_while_keyword = true -ij_typescript_space_before_while_left_brace = true -ij_typescript_space_before_while_parentheses = true -ij_typescript_spaces_around_additive_operators = true -ij_typescript_spaces_around_arrow_function_operator = true -ij_typescript_spaces_around_assignment_operators = true -ij_typescript_spaces_around_bitwise_operators = true -ij_typescript_spaces_around_equality_operators = true -ij_typescript_spaces_around_logical_operators = true -ij_typescript_spaces_around_multiplicative_operators = true -ij_typescript_spaces_around_relational_operators = true -ij_typescript_spaces_around_shift_operators = true -ij_typescript_spaces_around_unary_operator = false -ij_typescript_spaces_within_array_initializer_brackets = false -ij_typescript_spaces_within_brackets = false -ij_typescript_spaces_within_catch_parentheses = false -ij_typescript_spaces_within_for_parentheses = false -ij_typescript_spaces_within_if_parentheses = false -ij_typescript_spaces_within_imports = false -ij_typescript_spaces_within_interpolation_expressions = false -ij_typescript_spaces_within_method_call_parentheses = false -ij_typescript_spaces_within_method_parentheses = false -ij_typescript_spaces_within_object_literal_braces = false -ij_typescript_spaces_within_object_type_braces = true -ij_typescript_spaces_within_parentheses = false -ij_typescript_spaces_within_switch_parentheses = false -ij_typescript_spaces_within_type_assertion = false -ij_typescript_spaces_within_union_types = true -ij_typescript_spaces_within_while_parentheses = false -ij_typescript_special_else_if_treatment = true -ij_typescript_ternary_operation_signs_on_next_line = false -ij_typescript_ternary_operation_wrap = off -ij_typescript_union_types_wrap = on_every_item -ij_typescript_use_chained_calls_group_indents = false -ij_typescript_use_double_quotes = true -ij_typescript_use_explicit_js_extension = auto -ij_typescript_use_path_mapping = always -ij_typescript_use_public_modifier = false -ij_typescript_use_semicolon_after_statement = true -ij_typescript_var_declaration_wrap = normal -ij_typescript_while_brace_force = never -ij_typescript_while_on_new_line = false -ij_typescript_wrap_comments = false - [{*.bash,*.sh,*.zsh}] indent_size = 2 tab_width = 2 @@ -351,270 +86,6 @@ ij_shell_redirect_followed_by_space = false ij_shell_switch_cases_indented = false ij_shell_use_unix_line_separator = true -[{*.cjs,*.js}] -ij_continuation_indent_size = 4 -ij_javascript_align_imports = false -ij_javascript_align_multiline_array_initializer_expression = false -ij_javascript_align_multiline_binary_operation = false -ij_javascript_align_multiline_chained_methods = false -ij_javascript_align_multiline_extends_list = false -ij_javascript_align_multiline_for = true -ij_javascript_align_multiline_parameters = true -ij_javascript_align_multiline_parameters_in_calls = false -ij_javascript_align_multiline_ternary_operation = false -ij_javascript_align_object_properties = 0 -ij_javascript_align_union_types = false -ij_javascript_align_var_statements = 0 -ij_javascript_array_initializer_new_line_after_left_brace = false -ij_javascript_array_initializer_right_brace_on_new_line = false -ij_javascript_array_initializer_wrap = off -ij_javascript_assignment_wrap = off -ij_javascript_binary_operation_sign_on_next_line = false -ij_javascript_binary_operation_wrap = off -ij_javascript_blacklist_imports = rxjs/Rx, node_modules/**, **/node_modules/**, @angular/material, @angular/material/typings/** -ij_javascript_blank_lines_after_imports = 1 -ij_javascript_blank_lines_around_class = 1 -ij_javascript_blank_lines_around_field = 0 -ij_javascript_blank_lines_around_function = 1 -ij_javascript_blank_lines_around_method = 1 -ij_javascript_block_brace_style = end_of_line -ij_javascript_block_comment_add_space = false -ij_javascript_block_comment_at_first_column = true -ij_javascript_call_parameters_new_line_after_left_paren = false -ij_javascript_call_parameters_right_paren_on_new_line = false -ij_javascript_call_parameters_wrap = off -ij_javascript_catch_on_new_line = false -ij_javascript_chained_call_dot_on_new_line = true -ij_javascript_class_brace_style = end_of_line -ij_javascript_comma_on_new_line = false -ij_javascript_do_while_brace_force = never -ij_javascript_else_on_new_line = false -ij_javascript_enforce_trailing_comma = keep -ij_javascript_extends_keyword_wrap = off -ij_javascript_extends_list_wrap = off -ij_javascript_field_prefix = _ -ij_javascript_file_name_style = relaxed -ij_javascript_finally_on_new_line = false -ij_javascript_for_brace_force = never -ij_javascript_for_statement_new_line_after_left_paren = false -ij_javascript_for_statement_right_paren_on_new_line = false -ij_javascript_for_statement_wrap = off -ij_javascript_force_quote_style = false -ij_javascript_force_semicolon_style = false -ij_javascript_function_expression_brace_style = end_of_line -ij_javascript_if_brace_force = never -ij_javascript_import_merge_members = global -ij_javascript_import_prefer_absolute_path = global -ij_javascript_import_sort_members = true -ij_javascript_import_sort_module_name = false -ij_javascript_import_use_node_resolution = true -ij_javascript_imports_wrap = on_every_item -ij_javascript_indent_case_from_switch = true -ij_javascript_indent_chained_calls = true -ij_javascript_indent_package_children = 0 -ij_javascript_jsx_attribute_value = braces -ij_javascript_keep_blank_lines_in_code = 2 -ij_javascript_keep_first_column_comment = true -ij_javascript_keep_indents_on_empty_lines = false -ij_javascript_keep_line_breaks = true -ij_javascript_keep_simple_blocks_in_one_line = false -ij_javascript_keep_simple_methods_in_one_line = false -ij_javascript_line_comment_add_space = true -ij_javascript_line_comment_at_first_column = false -ij_javascript_method_brace_style = end_of_line -ij_javascript_method_call_chain_wrap = off -ij_javascript_method_parameters_new_line_after_left_paren = false -ij_javascript_method_parameters_right_paren_on_new_line = false -ij_javascript_method_parameters_wrap = off -ij_javascript_object_literal_wrap = on_every_item -ij_javascript_parentheses_expression_new_line_after_left_paren = false -ij_javascript_parentheses_expression_right_paren_on_new_line = false -ij_javascript_place_assignment_sign_on_next_line = false -ij_javascript_prefer_as_type_cast = false -ij_javascript_prefer_explicit_types_function_expression_returns = false -ij_javascript_prefer_explicit_types_function_returns = false -ij_javascript_prefer_explicit_types_vars_fields = false -ij_javascript_prefer_parameters_wrap = false -ij_javascript_reformat_c_style_comments = false -ij_javascript_space_after_colon = true -ij_javascript_space_after_comma = true -ij_javascript_space_after_dots_in_rest_parameter = false -ij_javascript_space_after_generator_mult = true -ij_javascript_space_after_property_colon = true -ij_javascript_space_after_quest = true -ij_javascript_space_after_type_colon = true -ij_javascript_space_after_unary_not = false -ij_javascript_space_before_async_arrow_lparen = true -ij_javascript_space_before_catch_keyword = true -ij_javascript_space_before_catch_left_brace = true -ij_javascript_space_before_catch_parentheses = true -ij_javascript_space_before_class_lbrace = true -ij_javascript_space_before_class_left_brace = true -ij_javascript_space_before_colon = true -ij_javascript_space_before_comma = false -ij_javascript_space_before_do_left_brace = true -ij_javascript_space_before_else_keyword = true -ij_javascript_space_before_else_left_brace = true -ij_javascript_space_before_finally_keyword = true -ij_javascript_space_before_finally_left_brace = true -ij_javascript_space_before_for_left_brace = true -ij_javascript_space_before_for_parentheses = true -ij_javascript_space_before_for_semicolon = false -ij_javascript_space_before_function_left_parenth = true -ij_javascript_space_before_generator_mult = false -ij_javascript_space_before_if_left_brace = true -ij_javascript_space_before_if_parentheses = true -ij_javascript_space_before_method_call_parentheses = false -ij_javascript_space_before_method_left_brace = true -ij_javascript_space_before_method_parentheses = false -ij_javascript_space_before_property_colon = false -ij_javascript_space_before_quest = true -ij_javascript_space_before_switch_left_brace = true -ij_javascript_space_before_switch_parentheses = true -ij_javascript_space_before_try_left_brace = true -ij_javascript_space_before_type_colon = false -ij_javascript_space_before_unary_not = false -ij_javascript_space_before_while_keyword = true -ij_javascript_space_before_while_left_brace = true -ij_javascript_space_before_while_parentheses = true -ij_javascript_spaces_around_additive_operators = true -ij_javascript_spaces_around_arrow_function_operator = true -ij_javascript_spaces_around_assignment_operators = true -ij_javascript_spaces_around_bitwise_operators = true -ij_javascript_spaces_around_equality_operators = true -ij_javascript_spaces_around_logical_operators = true -ij_javascript_spaces_around_multiplicative_operators = true -ij_javascript_spaces_around_relational_operators = true -ij_javascript_spaces_around_shift_operators = true -ij_javascript_spaces_around_unary_operator = false -ij_javascript_spaces_within_array_initializer_brackets = false -ij_javascript_spaces_within_brackets = false -ij_javascript_spaces_within_catch_parentheses = false -ij_javascript_spaces_within_for_parentheses = false -ij_javascript_spaces_within_if_parentheses = false -ij_javascript_spaces_within_imports = false -ij_javascript_spaces_within_interpolation_expressions = false -ij_javascript_spaces_within_method_call_parentheses = false -ij_javascript_spaces_within_method_parentheses = false -ij_javascript_spaces_within_object_literal_braces = false -ij_javascript_spaces_within_object_type_braces = true -ij_javascript_spaces_within_parentheses = false -ij_javascript_spaces_within_switch_parentheses = false -ij_javascript_spaces_within_type_assertion = false -ij_javascript_spaces_within_union_types = true -ij_javascript_spaces_within_while_parentheses = false -ij_javascript_special_else_if_treatment = true -ij_javascript_ternary_operation_signs_on_next_line = false -ij_javascript_ternary_operation_wrap = off -ij_javascript_union_types_wrap = on_every_item -ij_javascript_use_chained_calls_group_indents = false -ij_javascript_use_double_quotes = true -ij_javascript_use_explicit_js_extension = auto -ij_javascript_use_path_mapping = always -ij_javascript_use_public_modifier = false -ij_javascript_use_semicolon_after_statement = true -ij_javascript_var_declaration_wrap = normal -ij_javascript_while_brace_force = never -ij_javascript_while_on_new_line = false -ij_javascript_wrap_comments = false - -[{*.cjsx,*.coffee}] -indent_size = 2 -tab_width = 2 -ij_continuation_indent_size = 2 -ij_coffeescript_align_function_body = false -ij_coffeescript_align_imports = false -ij_coffeescript_align_multiline_array_initializer_expression = true -ij_coffeescript_align_multiline_parameters = true -ij_coffeescript_align_multiline_parameters_in_calls = false -ij_coffeescript_align_object_properties = 0 -ij_coffeescript_align_union_types = false -ij_coffeescript_align_var_statements = 0 -ij_coffeescript_array_initializer_new_line_after_left_brace = false -ij_coffeescript_array_initializer_right_brace_on_new_line = false -ij_coffeescript_array_initializer_wrap = normal -ij_coffeescript_blacklist_imports = rxjs/Rx, node_modules/**, **/node_modules/**, @angular/material, @angular/material/typings/** -ij_coffeescript_blank_lines_around_function = 1 -ij_coffeescript_call_parameters_new_line_after_left_paren = false -ij_coffeescript_call_parameters_right_paren_on_new_line = false -ij_coffeescript_call_parameters_wrap = normal -ij_coffeescript_chained_call_dot_on_new_line = true -ij_coffeescript_comma_on_new_line = false -ij_coffeescript_enforce_trailing_comma = keep -ij_coffeescript_field_prefix = _ -ij_coffeescript_file_name_style = relaxed -ij_coffeescript_force_quote_style = false -ij_coffeescript_force_semicolon_style = false -ij_coffeescript_function_expression_brace_style = end_of_line -ij_coffeescript_import_merge_members = global -ij_coffeescript_import_prefer_absolute_path = global -ij_coffeescript_import_sort_members = true -ij_coffeescript_import_sort_module_name = false -ij_coffeescript_import_use_node_resolution = true -ij_coffeescript_imports_wrap = on_every_item -ij_coffeescript_indent_chained_calls = true -ij_coffeescript_indent_package_children = 0 -ij_coffeescript_jsx_attribute_value = braces -ij_coffeescript_keep_blank_lines_in_code = 2 -ij_coffeescript_keep_first_column_comment = true -ij_coffeescript_keep_indents_on_empty_lines = false -ij_coffeescript_keep_line_breaks = true -ij_coffeescript_keep_simple_methods_in_one_line = false -ij_coffeescript_method_parameters_new_line_after_left_paren = false -ij_coffeescript_method_parameters_right_paren_on_new_line = false -ij_coffeescript_method_parameters_wrap = off -ij_coffeescript_object_literal_wrap = on_every_item -ij_coffeescript_prefer_as_type_cast = false -ij_coffeescript_prefer_explicit_types_function_expression_returns = false -ij_coffeescript_prefer_explicit_types_function_returns = false -ij_coffeescript_prefer_explicit_types_vars_fields = false -ij_coffeescript_reformat_c_style_comments = false -ij_coffeescript_space_after_comma = true -ij_coffeescript_space_after_dots_in_rest_parameter = false -ij_coffeescript_space_after_generator_mult = true -ij_coffeescript_space_after_property_colon = true -ij_coffeescript_space_after_type_colon = true -ij_coffeescript_space_after_unary_not = false -ij_coffeescript_space_before_async_arrow_lparen = true -ij_coffeescript_space_before_class_lbrace = true -ij_coffeescript_space_before_comma = false -ij_coffeescript_space_before_function_left_parenth = true -ij_coffeescript_space_before_generator_mult = false -ij_coffeescript_space_before_property_colon = false -ij_coffeescript_space_before_type_colon = false -ij_coffeescript_space_before_unary_not = false -ij_coffeescript_spaces_around_additive_operators = true -ij_coffeescript_spaces_around_arrow_function_operator = true -ij_coffeescript_spaces_around_assignment_operators = true -ij_coffeescript_spaces_around_bitwise_operators = true -ij_coffeescript_spaces_around_equality_operators = true -ij_coffeescript_spaces_around_logical_operators = true -ij_coffeescript_spaces_around_multiplicative_operators = true -ij_coffeescript_spaces_around_relational_operators = true -ij_coffeescript_spaces_around_shift_operators = true -ij_coffeescript_spaces_around_unary_operator = false -ij_coffeescript_spaces_within_array_initializer_braces = false -ij_coffeescript_spaces_within_array_initializer_brackets = false -ij_coffeescript_spaces_within_imports = false -ij_coffeescript_spaces_within_index_brackets = false -ij_coffeescript_spaces_within_interpolation_expressions = false -ij_coffeescript_spaces_within_method_call_parentheses = false -ij_coffeescript_spaces_within_method_parentheses = false -ij_coffeescript_spaces_within_object_braces = false -ij_coffeescript_spaces_within_object_literal_braces = false -ij_coffeescript_spaces_within_object_type_braces = true -ij_coffeescript_spaces_within_range_brackets = false -ij_coffeescript_spaces_within_type_assertion = false -ij_coffeescript_spaces_within_union_types = true -ij_coffeescript_union_types_wrap = on_every_item -ij_coffeescript_use_chained_calls_group_indents = false -ij_coffeescript_use_double_quotes = true -ij_coffeescript_use_explicit_js_extension = auto -ij_coffeescript_use_path_mapping = always -ij_coffeescript_use_public_modifier = false -ij_coffeescript_use_semicolon_after_statement = false -ij_coffeescript_var_declaration_wrap = normal - [{*.har,*.inputactions,*.jsb2,*.jsb3,*.json,.babelrc,.eslintrc,.stylelintrc,bowerrc,jest.config}] indent_size = 2 ij_json_array_wrapping = split_into_lines @@ -632,34 +103,6 @@ ij_json_spaces_within_braces = false ij_json_spaces_within_brackets = false ij_json_wrap_long_lines = false -[{*.htm,*.html,*.ng,*.sht,*.shtm,*.shtml}] -ij_html_add_new_line_before_tags = body, div, p, form, h1, h2, h3 -ij_html_align_attributes = true -ij_html_align_text = false -ij_html_attribute_wrap = normal -ij_html_block_comment_add_space = false -ij_html_block_comment_at_first_column = true -ij_html_do_not_align_children_of_min_lines = 0 -ij_html_do_not_break_if_inline_tags = title, h1, h2, h3, h4, h5, h6, p -ij_html_do_not_indent_children_of_tags = html, body, thead, tbody, tfoot -ij_html_enforce_quotes = false -ij_html_inline_tags = a, abbr, acronym, b, basefont, bdo, big, br, cite, cite, code, dfn, em, font, i, img, input, kbd, label, q, s, samp, select, small, span, strike, strong, sub, sup, textarea, tt, u, var -ij_html_keep_blank_lines = 2 -ij_html_keep_indents_on_empty_lines = false -ij_html_keep_line_breaks = true -ij_html_keep_line_breaks_in_text = true -ij_html_keep_whitespaces = false -ij_html_keep_whitespaces_inside = span, pre, textarea -ij_html_line_comment_at_first_column = true -ij_html_new_line_after_last_attribute = never -ij_html_new_line_before_first_attribute = never -ij_html_quote_style = double -ij_html_remove_new_line_before_tags = br -ij_html_space_after_tag_name = false -ij_html_space_around_equality_in_attribute = false -ij_html_space_inside_empty_tag = false -ij_html_text_wrap = normal - [{*.markdown,*.md}] ij_markdown_force_one_space_after_blockquote_symbol = true ij_markdown_force_one_space_after_header_symbol = true diff --git a/EXILED.props b/EXILED.props index 9271862ac3..b33a703792 100644 --- a/EXILED.props +++ b/EXILED.props @@ -15,7 +15,7 @@ - 8.4.3 + 8.7.1 false diff --git a/Exiled.API/Enums/EffectType.cs b/Exiled.API/Enums/EffectType.cs index 28b4b401e4..665f481632 100644 --- a/Exiled.API/Enums/EffectType.cs +++ b/Exiled.API/Enums/EffectType.cs @@ -14,9 +14,15 @@ namespace Exiled.API.Enums /// /// Status effects as enum. /// - /// + /// + /// public enum EffectType { + /// + /// This EffectType do not exist it's only use when not found or error. + /// + None = -1, // TODO: remove = -1 + /// /// The player isn't able to open their inventory or reload a weapon. /// diff --git a/Exiled.API/Enums/Side.cs b/Exiled.API/Enums/Side.cs index 3a8b1346d6..fdc329c90c 100644 --- a/Exiled.API/Enums/Side.cs +++ b/Exiled.API/Enums/Side.cs @@ -26,7 +26,7 @@ public enum Side /// /// SCP team. Same as . /// Contains all SCP-related roles: , , , , - /// , , and . + /// , , , and . /// Scp, diff --git a/Exiled.API/Extensions/CommonExtensions.cs b/Exiled.API/Extensions/CommonExtensions.cs index 41869e15d2..92d140bd17 100644 --- a/Exiled.API/Extensions/CommonExtensions.cs +++ b/Exiled.API/Extensions/CommonExtensions.cs @@ -42,7 +42,7 @@ public static class CommonExtensions /// The new modfied curve. public static AnimationCurve Multiply(this AnimationCurve curve, float amount) { - for (var i = 0; i < curve.length; i++) + for (int i = 0; i < curve.length; i++) curve.keys[i].value *= amount; return curve; @@ -56,7 +56,7 @@ public static AnimationCurve Multiply(this AnimationCurve curve, float amount) /// The new modfied curve. public static AnimationCurve Add(this AnimationCurve curve, float amount) { - for (var i = 0; i < curve.length; i++) + for (int i = 0; i < curve.length; i++) curve.keys[i].value += amount; return curve; diff --git a/Exiled.API/Extensions/EffectTypeExtension.cs b/Exiled.API/Extensions/EffectTypeExtension.cs index c9ff2f7285..6edd5542d5 100644 --- a/Exiled.API/Extensions/EffectTypeExtension.cs +++ b/Exiled.API/Extensions/EffectTypeExtension.cs @@ -85,6 +85,15 @@ public static class EffectTypeExtension public static Type Type(this EffectType effect) => EffectTypeToType.TryGetValue(effect, out Type type) ? type : throw new InvalidOperationException("Invalid effect enum provided"); + /// + /// Gets an instance of points to an effect. + /// + /// The enum. + /// The type found with the corresponding EffecType. + /// Whether or not the effectType has been found. + public static bool TryGetType(this EffectType effect, out Type type) + => EffectTypeToType.TryGetValue(effect, out type); + /// /// Gets the of the specified . /// @@ -93,6 +102,23 @@ public static Type Type(this EffectType effect) public static EffectType GetEffectType(this StatusEffectBase statusEffectBase) => TypeToEffectType.TryGetValue(statusEffectBase.GetType(), out EffectType effect) ? effect : throw new InvalidOperationException("Invalid effect status base provided"); + /// + /// Gets the of the specified . + /// + /// The enum. + /// The effect found. + /// Whether or not the effect has been found. + public static bool TryGetEffectType(this StatusEffectBase statusEffectBase, out EffectType effect) + { + if (statusEffectBase == null || !TypeToEffectType.TryGetValue(statusEffectBase.GetType(), out effect)) + { + effect = EffectType.None; + return false; + } + + return true; + } + /// /// Returns whether or not the provided drains health over time. /// @@ -109,7 +135,7 @@ or EffectType.Corroding or EffectType.Decontaminating or EffectType.Hemorrhage o /// The . /// Whether or not the effect heals. /// - public static bool IsHealing(this EffectType effect) => typeof(IHealablePlayerEffect).IsAssignableFrom(effect.Type()); + public static bool IsHealing(this EffectType effect) => effect.TryGetType(out Type type) && typeof(IHealablePlayerEffect).IsAssignableFrom(type); /// /// Returns whether or not the provided is a negative effect. @@ -137,14 +163,14 @@ or EffectType.Invigorated or EffectType.Invisible or EffectType.MovementBoost or /// /// The . /// Whether or not the effect modifies the player's movement speed. - public static bool IsMovement(this EffectType effect) => typeof(IMovementSpeedModifier).IsAssignableFrom(effect.Type()); + public static bool IsMovement(this EffectType effect) => effect.TryGetType(out Type type) && typeof(IMovementSpeedModifier).IsAssignableFrom(type); /// /// Returns whether or not the provided is displayed to spectators as text. /// /// The . /// Whether or not the effect is displayed to spectators as text. - public static bool IsDisplayed(this EffectType effect) => typeof(ISpectatorDataPlayerEffect).IsAssignableFrom(effect.Type()); + public static bool IsDisplayed(this EffectType effect) => effect.TryGetType(out Type type) && typeof(ISpectatorDataPlayerEffect).IsAssignableFrom(type); /// /// Returns the of the given . diff --git a/Exiled.API/Extensions/ItemExtensions.cs b/Exiled.API/Extensions/ItemExtensions.cs index 0fda1197e9..2aa7c90fc0 100644 --- a/Exiled.API/Extensions/ItemExtensions.cs +++ b/Exiled.API/Extensions/ItemExtensions.cs @@ -18,7 +18,7 @@ namespace Exiled.API.Extensions using InventorySystem; using InventorySystem.Items; using InventorySystem.Items.Firearms.Attachments; - + using InventorySystem.Items.Pickups; using Structs; /// @@ -96,6 +96,13 @@ public static ItemBase GetItemBase(this ItemType type) return itemBase; } + /// + /// Given an , returns the matching . + /// + /// The . + /// The , or if not found. + public static ItemPickupBase GetPickupBase(this ItemType type) => GetItemBase(type)?.PickupDropModel; + /// /// Given an , returns the matching , casted to . /// diff --git a/Exiled.API/Extensions/ReflectionExtensions.cs b/Exiled.API/Extensions/ReflectionExtensions.cs index a0da60351d..1725f5c9e5 100644 --- a/Exiled.API/Extensions/ReflectionExtensions.cs +++ b/Exiled.API/Extensions/ReflectionExtensions.cs @@ -40,10 +40,10 @@ public static void InvokeStaticMethod(this Type type, string methodName, object[ /// The event arguments. public static void InvokeStaticEvent(this Type type, string eventName, object[] param) { - var eventDelegate = (MulticastDelegate)type.GetField(eventName, AccessTools.all).GetValue(null); + MulticastDelegate eventDelegate = (MulticastDelegate)type.GetField(eventName, AccessTools.all).GetValue(null); if (eventDelegate != null) { - foreach (var handler in eventDelegate.GetInvocationList()) + foreach (Delegate handler in eventDelegate.GetInvocationList()) { handler.Method.Invoke(handler.Target, param); } diff --git a/Exiled.API/Features/DamageHandlers/AttackerDamageHandler.cs b/Exiled.API/Features/DamageHandlers/AttackerDamageHandler.cs index 0750c9d5be..b7d51716a2 100644 --- a/Exiled.API/Features/DamageHandlers/AttackerDamageHandler.cs +++ b/Exiled.API/Features/DamageHandlers/AttackerDamageHandler.cs @@ -99,7 +99,7 @@ public override void ProcessDamage(Player player) if ((player != Attacker) && !ForceFullFriendlyFire) { - if (HitboxIdentity.CheckFriendlyFire(AttackerFootprint.Role, player.Role, true)) + if (HitboxIdentity.IsEnemy(AttackerFootprint.Role, player.Role)) return; Damage *= PlayerStatsSystem.AttackerDamageHandler._ffMultiplier; diff --git a/Exiled.API/Features/Doors/CheckpointDoor.cs b/Exiled.API/Features/Doors/CheckpointDoor.cs index 34b5b91793..1e31e72aef 100644 --- a/Exiled.API/Features/Doors/CheckpointDoor.cs +++ b/Exiled.API/Features/Doors/CheckpointDoor.cs @@ -93,7 +93,7 @@ public float Health { float health = value / Subdoors.Count; - foreach (var door in Subdoors) + foreach (BreakableDoor door in Subdoors) { door.Health = health; } @@ -108,7 +108,7 @@ public float MaxHealth { float health = value / Subdoors.Count; - foreach (var door in Subdoors) + foreach (BreakableDoor door in Subdoors) { door.MaxHealth = health; } @@ -121,7 +121,7 @@ public DoorDamageType IgnoredDamage get => Subdoors.Aggregate(DoorDamageType.None, (current, door) => current | door.IgnoredDamage); set { - foreach (var door in Subdoors) + foreach (BreakableDoor door in Subdoors) { door.IgnoredDamage = value; } diff --git a/Exiled.API/Features/Doors/Gate.cs b/Exiled.API/Features/Doors/Gate.cs index 95c84599b7..43d42e03d8 100644 --- a/Exiled.API/Features/Doors/Gate.cs +++ b/Exiled.API/Features/Doors/Gate.cs @@ -43,17 +43,17 @@ public Gate(PryableDoor door, List room) /// /// Gets a value indicating whether or not the door is fully closed. /// - public override bool IsFullyClosed => base.IsFullyClosed && RemainingPryCooldown > 0; + public override bool IsFullyClosed => base.IsFullyClosed && RemainingPryCooldown <= 0; /// /// Gets a value indicating whether the door is fully open. /// - public override bool IsFullyOpen => base.IsFullyOpen && RemainingPryCooldown <= 0; + public override bool IsFullyOpen => base.IsFullyOpen; /// /// Gets a value indicating whether or not the door is currently moving. /// - public override bool IsMoving => base.IsMoving && RemainingPryCooldown > 0; + public override bool IsMoving => base.IsMoving || RemainingPryCooldown > 0; /// /// Gets or sets remaining cooldown for prying. diff --git a/Exiled.API/Features/Effect.cs b/Exiled.API/Features/Effect.cs index 98dab03276..0f8474a24e 100644 --- a/Exiled.API/Features/Effect.cs +++ b/Exiled.API/Features/Effect.cs @@ -32,7 +32,9 @@ public Effect() /// Get all the information of the effect>. public Effect(StatusEffectBase statusEffectBase) { - Type = statusEffectBase.GetEffectType(); + if (!statusEffectBase.TryGetEffectType(out EffectType effect)) + Log.Error($"EffectType not found please report to Exiled BugReport : {statusEffectBase}"); + Type = effect; Duration = statusEffectBase.Duration; Intensity = statusEffectBase.Intensity; IsEnabled = statusEffectBase.IsEnabled; diff --git a/Exiled.API/Features/Generator.cs b/Exiled.API/Features/Generator.cs index ca855c2384..b3f5bfb692 100644 --- a/Exiled.API/Features/Generator.cs +++ b/Exiled.API/Features/Generator.cs @@ -116,7 +116,7 @@ public bool IsActivating public bool IsOpen { get => Base.HasFlag(Base.Network_flags, Scp079Generator.GeneratorFlags.Open); - set => Base.ServerSetFlag(Scp079Generator.GeneratorFlags.Unlocked, value); + set => Base.ServerSetFlag(Scp079Generator.GeneratorFlags.Open, value); } /// diff --git a/Exiled.API/Features/Items/Item.cs b/Exiled.API/Features/Items/Item.cs index 801b6ec785..0a9bf69f98 100644 --- a/Exiled.API/Features/Items/Item.cs +++ b/Exiled.API/Features/Items/Item.cs @@ -325,6 +325,19 @@ public virtual Pickup CreatePickup(Vector3 position, Quaternion rotation = defau /// A string containing Item-related data. public override string ToString() => $"{Type} ({Serial}) [{Weight}] *{Scale}* ={Owner}="; + /// + /// Changes the owner of the . + /// + /// Old owner. + /// New owner. + public void ChangeItemOwner(Player oldOwner, Player newOwner) + { + if (oldOwner != null && newOwner != null) + { + ChangeOwner(oldOwner, newOwner); + } + } + /// /// Change the owner of the . /// diff --git a/Exiled.API/Features/Items/Scp244.cs b/Exiled.API/Features/Items/Scp244.cs index 2d41dce073..9e88a53758 100644 --- a/Exiled.API/Features/Items/Scp244.cs +++ b/Exiled.API/Features/Items/Scp244.cs @@ -7,6 +7,7 @@ namespace Exiled.API.Features.Items { + using Exiled.API.Extensions; using Exiled.API.Features.Pickups; using Exiled.API.Interfaces; @@ -29,6 +30,10 @@ public Scp244(Scp244Item itemBase) : base(itemBase) { Base = itemBase; + Scp244DeployablePickup scp244Pickup = (Scp244DeployablePickup)Type.GetPickupBase(); + Health = scp244Pickup._health; + ActivationDot = scp244Pickup._activationDot; + MaxDiameter = scp244Pickup.MaxDiameter; } /// @@ -54,6 +59,22 @@ public bool Primed set => Base._primed = value; } + /// + /// Gets or sets the Scp244's remaining health. + /// + public float Health { get; set; } + + /// + /// Gets or sets the activation angle, where 1 is the minimum and -1 is the maximum activation angle. + /// + public float ActivationDot { get; set; } + + /// + /// Gets or sets the maximum diameter within which SCP-244's hypothermia effect is dealt. + /// + /// This does not prevent visual effects. + public float MaxDiameter { get; set; } + /// /// Creates the that based on this . /// @@ -86,6 +107,9 @@ public override Pickup CreatePickup(Vector3 position, Quaternion rotation = defa public override Item Clone() => new Scp244(Type) { Primed = Primed, + MaxDiameter = MaxDiameter, + Health = Health, + ActivationDot = ActivationDot, }; /// @@ -93,5 +117,17 @@ public override Pickup CreatePickup(Vector3 position, Quaternion rotation = defa /// /// A string containing SCP-244 related data. public override string ToString() => $"{Type} ({Serial}) [{Weight}] *{Scale}* -{Primed}-"; + + /// + internal override void ReadPickupInfo(Pickup pickup) + { + base.ReadPickupInfo(pickup); + if (pickup is Scp244Pickup scp244) + { + Health = scp244.Health; + ActivationDot = scp244.ActivationDot; + MaxDiameter = scp244.MaxDiameter; + } + } } } \ No newline at end of file diff --git a/Exiled.API/Features/Log.cs b/Exiled.API/Features/Log.cs index b5dfa57138..caf9cf3317 100644 --- a/Exiled.API/Features/Log.cs +++ b/Exiled.API/Features/Log.cs @@ -156,8 +156,8 @@ public static void Send(string message, Discord.LogLevel level, ConsoleColor col /// Sends an with the provided message if the condition is false and stops the execution. /// For example: /// - /// Player ply = Player.Get(2); - /// Log.Assert(ply is not null, "The player with the id 2 is null"); + /// Player ply = Player.Get(2); + /// Log.Assert(ply is not null, "The player with the id 2 is null"); /// /// results in it logging an error if the player is null and not continuing. /// diff --git a/Exiled.API/Features/Pickups/Scp244Pickup.cs b/Exiled.API/Features/Pickups/Scp244Pickup.cs index 7064807ff6..f852fcc3ae 100644 --- a/Exiled.API/Features/Pickups/Scp244Pickup.cs +++ b/Exiled.API/Features/Pickups/Scp244Pickup.cs @@ -10,8 +10,9 @@ namespace Exiled.API.Features.Pickups using System; using Exiled.API.Features.DamageHandlers; + using Exiled.API.Features.Items; using Exiled.API.Interfaces; - + using InventorySystem.Items; using InventorySystem.Items.Usables.Scp244; using UnityEngine; @@ -75,6 +76,16 @@ public float CurrentSizePercent set => Base.CurrentSizePercent = value; } + /// + /// Gets or sets the maximum diameter within which SCP-244's hypothermia effect is dealt. + /// + /// This does not prevent visual effects. + public float MaxDiameter + { + get => Base.MaxDiameter; + set => Base.MaxDiameter = value; + } + /// /// Gets or sets the Scp244's remaining health. /// @@ -124,5 +135,17 @@ public float ActivationDot /// /// A string containing Scp244Pickup related data. public override string ToString() => $"{Type} ({Serial}) [{Weight}] *{Scale}* |{Health}| -{State}- ={CurrentSizePercent}="; + + /// + internal override void ReadItemInfo(Item item) + { + base.ReadItemInfo(item); + if (item is Scp244 scp244) + { + ActivationDot = scp244.ActivationDot; + MaxDiameter = scp244.MaxDiameter; + Health = scp244.Health; + } + } } } diff --git a/Exiled.API/Features/Player.cs b/Exiled.API/Features/Player.cs index 2febc7e6a2..39926ee2db 100644 --- a/Exiled.API/Features/Player.cs +++ b/Exiled.API/Features/Player.cs @@ -349,7 +349,7 @@ public string CustomInfo // NW Client check. if (value.Contains('<')) { - foreach (var token in value.Split('<')) + foreach (string token in value.Split('<')) { if (token.StartsWith("/", StringComparison.Ordinal) || token.StartsWith("b>", StringComparison.Ordinal) || @@ -619,7 +619,7 @@ public ScpSpawnPreferences.SpawnPreferences ScpPreferences /// /// Gets a value indicating whether or not the player is jumping. /// - public bool IsJumping { get; internal set; } + public bool IsJumping => Role is FpcRole fpc && fpc.FirstPersonController.FpcModule.Motor.IsJumping; /// /// Gets the player's IP address. @@ -736,7 +736,7 @@ public bool IsBypassModeEnabled /// This property will NOT persistently mute and unmute the player. For persistent mutes, see and . public bool IsMuted { - get => VoiceChatMutes.Mutes.Contains(UserId) && (VoiceChatMuteFlags.HasFlag(VcMuteFlags.GlobalRegular) || VoiceChatMuteFlags.HasFlag(VcMuteFlags.LocalRegular)); + get => VoiceChatMutes.QueryLocalMute(UserId, false); set { if (value) @@ -768,7 +768,7 @@ public bool IsGlobalMuted /// This property will NOT persistently mute and unmute the player. For persistent mutes, see and . public bool IsIntercomMuted { - get => VoiceChatMutes.Mutes.Contains(UserId) && (VoiceChatMuteFlags.HasFlag(VcMuteFlags.GlobalIntercom) || VoiceChatMuteFlags.HasFlag(VcMuteFlags.LocalIntercom)); + get => VoiceChatMutes.QueryLocalMute(UserId, true); set { if (value) @@ -1164,7 +1164,7 @@ public bool IsSpawnProtected /// Gets a of filtered based on a predicate. /// /// The condition to satisfy. - /// A of which contains elements that satify the condition. + /// A of which contains elements that satisfy the condition. public static IEnumerable Get(Func predicate) => List.Where(predicate); /// @@ -2662,7 +2662,7 @@ public bool TryAddCandy(CandyKindID candyType) /// The new items that have to be added to the inventory. public void ResetInventory(IEnumerable newItems) { - ClearInventory(); + ClearItems(); foreach (ItemType item in newItems) AddItem(item); @@ -2674,7 +2674,7 @@ public void ResetInventory(IEnumerable newItems) /// The new items that have to be added to the inventory. public void ResetInventory(IEnumerable newItems) { - ClearInventory(); + ClearItems(); foreach (Item item in newItems) AddItem(item); @@ -2702,6 +2702,9 @@ public void ClearInventory(bool destroy = true) /// public void ClearItems(bool destroy = true) { + if (CurrentArmor is not null) + CurrentArmor.RemoveExcessOnDrop = true; + while (Items.Count > 0) RemoveItem(Items.ElementAt(0), destroy); } @@ -3061,12 +3064,13 @@ public void SyncEffects(IEnumerable effects) /// /// Gets an instance of by . /// - /// The . + /// The . /// The . - public StatusEffectBase GetEffect(EffectType type) + public StatusEffectBase GetEffect(EffectType effectType) { - ReferenceHub.playerEffectsController._effectsByType.TryGetValue(type.Type(), out StatusEffectBase playerEffect); - + if (!effectType.TryGetType(out Type type)) + return null; + ReferenceHub.playerEffectsController._effectsByType.TryGetValue(type, out StatusEffectBase playerEffect); return playerEffect; } @@ -3135,7 +3139,7 @@ public void ChangeEffectIntensity(EffectType type, byte intensity, float duratio if (TryGetEffect(type, out StatusEffectBase statusEffect)) { statusEffect.Intensity = intensity; - statusEffect.ServerChangeDuration(duration, true); + statusEffect.ServerChangeDuration(duration, false); } } diff --git a/Exiled.API/Features/Ragdoll.cs b/Exiled.API/Features/Ragdoll.cs index 47c3e10dc2..9d73104fed 100644 --- a/Exiled.API/Features/Ragdoll.cs +++ b/Exiled.API/Features/Ragdoll.cs @@ -28,6 +28,8 @@ namespace Exiled.API.Features using UnityEngine; + using BaseScp3114Ragdoll = PlayerRoles.PlayableScps.Scp3114.Scp3114Ragdoll; + using Object = UnityEngine.Object; /// @@ -298,11 +300,12 @@ public static bool TryCreate(RagdollData networkInfo, out Ragdoll ragdoll) basicRagdoll.NetworkInfo = networkInfo; - ragdoll = new(basicRagdoll) + ragdoll = basicRagdoll is BaseScp3114Ragdoll scp3114Ragdoll ? new Scp3114Ragdoll(scp3114Ragdoll) : new Ragdoll(basicRagdoll) { Position = networkInfo.StartPosition, Rotation = networkInfo.StartRotation, }; + return true; } @@ -377,7 +380,7 @@ public static Ragdoll CreateAndSpawn(RoleTypeId roleType, string name, string de /// The to get. /// A or if not found. public static Ragdoll Get(BasicRagdoll ragdoll) => ragdoll == null ? null : - BasicRagdollToRagdoll.TryGetValue(ragdoll, out Ragdoll doll) ? doll : new Ragdoll(ragdoll); + BasicRagdollToRagdoll.TryGetValue(ragdoll, out Ragdoll doll) ? doll : ragdoll is BaseScp3114Ragdoll scp3114Ragdoll ? new Scp3114Ragdoll(scp3114Ragdoll) : new Ragdoll(ragdoll); /// /// Gets the of belonging to the , if any. diff --git a/Exiled.API/Features/Roles/Scp079Role.cs b/Exiled.API/Features/Roles/Scp079Role.cs index f97ee97bcc..8782137a7f 100644 --- a/Exiled.API/Features/Roles/Scp079Role.cs +++ b/Exiled.API/Features/Roles/Scp079Role.cs @@ -588,7 +588,7 @@ public void ActivateTesla(bool consumeEnergy = true) Scp079Camera cam = CurrentCameraSync.CurrentCamera; RewardManager.MarkRoom(cam.Room); - if (!TeslaGateController.Singleton.TeslaGates.TryGetFirst(x => RoomIdUtils.IsTheSameRoom(cam.Position, x.transform.position), out var teslaGate)) + if (!TeslaGateController.Singleton.TeslaGates.TryGetFirst(x => RoomIdUtils.IsTheSameRoom(cam.Position, x.transform.position), out global::TeslaGate teslaGate)) return; if (consumeEnergy) diff --git a/Exiled.API/Features/Room.cs b/Exiled.API/Features/Room.cs index d5961683c4..b8613d1cbc 100644 --- a/Exiled.API/Features/Room.cs +++ b/Exiled.API/Features/Room.cs @@ -310,9 +310,19 @@ public static Room FindParentRoom(GameObject objectInRoom) /// /// Flickers the room's lights off for a duration. /// - /// Duration in seconds. - public void TurnOffLights(float duration) + /// Duration in seconds, or -1 for an indefinite duration. + public void TurnOffLights(float duration = -1) { + if (duration == -1) + { + foreach (RoomLightController light in RoomLightControllers) + { + light.SetLights(false); + } + + return; + } + foreach (RoomLightController light in RoomLightControllers) { light.ServerFlickerLights(duration); diff --git a/Exiled.API/Features/Round.cs b/Exiled.API/Features/Round.cs index f7ea6e8e9b..e2a424d4d0 100644 --- a/Exiled.API/Features/Round.cs +++ b/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); + public static HashSet IgnoredPlayers { get; } = new(20); // TODO: Replace ReferenceHub to Player remind to change RoundEnd transpiler /// /// Gets the time elapsed from the start of the round. diff --git a/Exiled.API/Features/Scp3114Ragdoll.cs b/Exiled.API/Features/Scp3114Ragdoll.cs new file mode 100644 index 0000000000..494ec7cdc7 --- /dev/null +++ b/Exiled.API/Features/Scp3114Ragdoll.cs @@ -0,0 +1,78 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.API.Features +{ + using Exiled.API.Interfaces; + using PlayerRoles; + + using BaseScp3114Ragdoll = PlayerRoles.PlayableScps.Scp3114.Scp3114Ragdoll; + + /// + /// A wrapper for SCP-3114 ragdolls. + /// + public class Scp3114Ragdoll : Ragdoll, IWrapper + { + /// + /// Initializes a new instance of the class. + /// + /// The base ragdoll to wrap. + internal Scp3114Ragdoll(BaseScp3114Ragdoll ragdoll) + : base(ragdoll) + { + Base = ragdoll; + } + + /// + public new BaseScp3114Ragdoll Base { get; } + + /// + /// Gets or sets the role that the corpse is disguised as. + /// + public RoleTypeId DisguiseRole + { + get => Base._disguiseRole; + set => Base.Network_disguiseRole = value; + } + + /// + /// Gets or sets the delay between when SCP-3114 can disguise this corpse. + /// + public float RevealDelay + { + get => Base._revealDelay; + set => Base._revealDelay = value; + } + + /// + /// Gets or sets the time required to reveal this corpse. + /// + public float RevealDuration + { + get => Base._revealDuration; + set => Base._revealDuration = value; + } + + /// + /// Gets or sets the current time of revealing this corpse. + /// + public float RevealElapsed + { + get => Base._revealElapsed; + set => Base._revealElapsed = value; + } + + /// + /// Gets or sets a value indicating whether or not this corpse will trigger animation. + /// + public bool IsPlayingAnimation + { + get => Base._playingAnimation; + set => Base._playingAnimation = value; + } + } +} \ No newline at end of file diff --git a/Exiled.API/Features/Scp914.cs b/Exiled.API/Features/Scp914.cs index 3b07f549dc..93ef42e37f 100644 --- a/Exiled.API/Features/Scp914.cs +++ b/Exiled.API/Features/Scp914.cs @@ -10,6 +10,7 @@ namespace Exiled.API.Features using System.Collections.Generic; using System.Linq; + using Exiled.API.Features.Doors; using Exiled.API.Features.Pickups; using Exiled.API.Features.Pools; using global::Scp914; @@ -63,6 +64,11 @@ public static Scp914Mode ConfigMode /// public static Vector3 OutputPosition => Scp914Controller.OutputChamber.localPosition; + /// + /// Gets the position offset in which item is moving. + /// + public static Vector3 MovingVector => OutputPosition - IntakePosition; + /// /// Gets a value indicating whether SCP-914 is active and currently processing items. /// @@ -83,6 +89,11 @@ public static Scp914Mode ConfigMode /// public static Transform OutputBooth => Scp914Controller.OutputChamber; + /// + /// Gets the list with which SCP-914 has. + /// + public static IReadOnlyCollection Doors => Scp914Controller._doors.Select(Door.Get).ToList(); + /// /// Filters all GameObjects inside SCP-914's intake chamber into players and items. /// diff --git a/Exiled.API/Features/Toys/AdminToy.cs b/Exiled.API/Features/Toys/AdminToy.cs index 090605b46b..4e506c632d 100644 --- a/Exiled.API/Features/Toys/AdminToy.cs +++ b/Exiled.API/Features/Toys/AdminToy.cs @@ -13,6 +13,7 @@ namespace Exiled.API.Features.Toys using Enums; using Exiled.API.Interfaces; + using Footprinting; using Mirror; using UnityEngine; @@ -45,6 +46,24 @@ internal AdminToy(AdminToyBase toyAdminToyBase, AdminToyType type) /// public AdminToyType ToyType { get; } + /// + /// Gets or sets who spawn the Primitive AdminToy. + /// + public Player Player + { + get => Player.Get(Footprint); + set => Footprint = value.Footprint; + } + + /// + /// Gets or sets the Footprint of the player who spawned the AdminToy. + /// + public Footprint Footprint + { + get => AdminToyBase.SpawnerFootprint; + set => AdminToyBase.SpawnerFootprint = value; + } + /// /// Gets or sets the position of the toy. /// @@ -85,6 +104,15 @@ public byte MovementSmoothing set => AdminToyBase.NetworkMovementSmoothing = value; } + /// + /// Gets or sets a value indicating whether IsStatic. + /// + public bool IsStatic + { + get => AdminToyBase.IsStatic; + set => AdminToyBase.IsStatic = value; + } + /// /// Gets the belonging to the . /// diff --git a/Exiled.API/Structs/ArmorAmmoLimit.cs b/Exiled.API/Structs/ArmorAmmoLimit.cs index c94718bab6..86046d71ec 100644 --- a/Exiled.API/Structs/ArmorAmmoLimit.cs +++ b/Exiled.API/Structs/ArmorAmmoLimit.cs @@ -50,8 +50,6 @@ public static implicit operator ArmorAmmoLimit(BodyArmor.ArmorAmmoLimit armorLim /// Converts a to its appropriate base game . /// /// armor limit. - public static explicit operator BodyArmor.ArmorAmmoLimit(ArmorAmmoLimit armorLimit) => - new() - { AmmoType = armorLimit.AmmoType.GetItemType(), Limit = armorLimit.Limit }; + public static explicit operator BodyArmor.ArmorAmmoLimit(ArmorAmmoLimit armorLimit) => new() { AmmoType = armorLimit.AmmoType.GetItemType(), Limit = armorLimit.Limit }; } } \ No newline at end of file diff --git a/Exiled.API/Structs/PrimitiveSettings.cs b/Exiled.API/Structs/PrimitiveSettings.cs index 2abae14390..933b0c81d6 100644 --- a/Exiled.API/Structs/PrimitiveSettings.cs +++ b/Exiled.API/Structs/PrimitiveSettings.cs @@ -3,64 +3,91 @@ // Copyright (c) Exiled Team. All rights reserved. // Licensed under the CC BY-SA 3.0 license. // -// ----------------------------------------------------------------------- - -namespace Exiled.API.Structs -{ - using UnityEngine; +// ----------------------------------------------------------------------- + +namespace Exiled.API.Structs +{ + using UnityEngine; + + /// + /// Settings for primitives. + /// + public struct PrimitiveSettings + { + /// + /// Initializes a new instance of the struct. + /// + /// The type of the primitive. + /// The color of the primitive. + /// The position of the primitive. + /// The rotation of the primitive. + /// The scale of the primitive. + /// Whether or not the primitive should be spawned. + /// Whether or not the primitive should be static. + public PrimitiveSettings(PrimitiveType primitiveType, Color color, Vector3 position, Vector3 rotation, Vector3 scale, bool spawn, bool isStatic) + { + PrimitiveType = primitiveType; + Color = color; + Position = position; + Rotation = rotation; + Scale = scale; + Spawn = spawn; + IsStatic = isStatic; + } - /// - /// Settings for primitives. - /// - public struct PrimitiveSettings - { - /// - /// Initializes a new instance of the struct. - /// - /// The type of the primitive. - /// The color of the primitive. - /// The position of the primitive. - /// The rotation of the primitive. - /// The scale of the primitive. - /// Whether or not the primitive should be spawned. - public PrimitiveSettings(PrimitiveType primitiveType, Color color, Vector3 position, Vector3 rotation, Vector3 scale, bool spawn) - { - PrimitiveType = primitiveType; - Color = color; - Position = position; - Rotation = rotation; - Scale = scale; + /// + /// Initializes a new instance of the struct. + /// + /// The type of the primitive. + /// The color of the primitive. + /// The position of the primitive. + /// The rotation of the primitive. + /// The scale of the primitive. + /// Whether or not the primitive should be spawned. + public PrimitiveSettings(PrimitiveType primitiveType, Color color, Vector3 position, Vector3 rotation, Vector3 scale, bool spawn) + { + PrimitiveType = primitiveType; + Color = color; + Position = position; + Rotation = rotation; + Scale = scale; Spawn = spawn; - } - - /// - /// Gets the primitive type. - /// - public PrimitiveType PrimitiveType { get; } - - /// - /// Gets the primitive color. - /// - public Color Color { get; } - - /// - /// Gets the primitive position. - /// - public Vector3 Position { get; } - - /// - /// Gets the primitive rotation. - /// - public Vector3 Rotation { get; } - - /// - /// Gets the primitive scale. - /// - public Vector3 Scale { get; } - - /// - /// Gets a value indicating whether or not the primitive should be spawned. - /// - public bool Spawn { get; } - } + IsStatic = false; + } + + /// + /// Gets the primitive type. + /// + public PrimitiveType PrimitiveType { get; } + + /// + /// Gets the primitive color. + /// + public Color Color { get; } + + /// + /// Gets the primitive position. + /// + public Vector3 Position { get; } + + /// + /// Gets the primitive rotation. + /// + public Vector3 Rotation { get; } + + /// + /// Gets the primitive scale. + /// + public Vector3 Scale { get; } + + /// + /// Gets a value indicating whether or not the primitive should be spawned. + /// + public bool IsStatic { get; } + + /// + /// Gets a value indicating whether or not the primitive should be spawned. + /// + public bool Spawn { get; } + } } \ No newline at end of file diff --git a/Exiled.CustomItems/API/Features/CustomGrenade.cs b/Exiled.CustomItems/API/Features/CustomGrenade.cs index 24906352c2..bb818ad7b0 100644 --- a/Exiled.CustomItems/API/Features/CustomGrenade.cs +++ b/Exiled.CustomItems/API/Features/CustomGrenade.cs @@ -74,12 +74,12 @@ public virtual Pickup Throw(Vector3 position, float force, float weight, float f player = Server.Host; player.Role.Is(out FpcRole fpcRole); - var velocity = fpcRole.FirstPersonController.FpcModule.Motor.Velocity; + Vector3 velocity = fpcRole.FirstPersonController.FpcModule.Motor.Velocity; Throwable throwable = (Throwable)Item.Create(grenadeType, player); ThrownProjectile thrownProjectile = Object.Instantiate(throwable.Base.Projectile, position, throwable.Owner.CameraTransform.rotation); - Transform transform = thrownProjectile.transform; + PickupSyncInfo newInfo = new() { ItemId = throwable.Type, diff --git a/Exiled.CustomItems/API/Features/CustomWeapon.cs b/Exiled.CustomItems/API/Features/CustomWeapon.cs index 7b3ce94054..6b051a7614 100644 --- a/Exiled.CustomItems/API/Features/CustomWeapon.cs +++ b/Exiled.CustomItems/API/Features/CustomWeapon.cs @@ -9,6 +9,7 @@ namespace Exiled.CustomItems.API.Features { using System; + using Exiled.API.Enums; using Exiled.API.Extensions; using Exiled.API.Features; using Exiled.API.Features.DamageHandlers; @@ -18,6 +19,7 @@ namespace Exiled.CustomItems.API.Features using InventorySystem.Items.Firearms.Attachments; using InventorySystem.Items.Firearms.Attachments.Components; + using InventorySystem.Items.Firearms.BasicMessages; using UnityEngine; @@ -196,7 +198,7 @@ protected virtual void OnHurting(HurtingEventArgs ev) private void OnInternalReloading(ReloadingWeaponEventArgs ev) { - if (!Check(ev.Firearm)) + if (!Check(ev.Player.CurrentItem)) return; Log.Debug($"{nameof(Name)}.{nameof(OnInternalReloading)}: Reloading weapon. Calling external reload event.."); @@ -209,7 +211,39 @@ private void OnInternalReloading(ReloadingWeaponEventArgs ev) return; } - ev.Firearm.MaxAmmo = ClipSize; + Log.Debug($"{nameof(Name)}.{nameof(OnInternalReloading)}: Continuing with internal reload.."); + ev.IsAllowed = false; + + byte remainingClip = ((Firearm)ev.Player.CurrentItem).Ammo; + + if (remainingClip >= ClipSize) + return; + + Log.Debug($"{ev.Player.Nickname} ({ev.Player.UserId}) [{ev.Player.Role}] is reloading a {Name} ({Id}) [{Type} ({remainingClip}/{ClipSize})]!"); + + AmmoType ammoType = ev.Firearm.AmmoType; + + if (!ev.Player.Ammo.ContainsKey(ammoType.GetItemType())) + { + Log.Debug($"{nameof(Name)}.{nameof(OnInternalReloading)}: {ev.Player.Nickname} does not have ammo to reload this weapon."); + return; + } + + ev.Player.Connection.Send(new RequestMessage(ev.Firearm.Serial, RequestType.Reload)); + + byte amountToReload = (byte)Math.Min(ClipSize - remainingClip, ev.Player.Ammo[ammoType.GetItemType()]); + + if (amountToReload <= 0) + return; + + ev.Player.ReferenceHub.playerEffectsController.GetEffect().Intensity = 0; + + ev.Player.Ammo[ammoType.GetItemType()] -= amountToReload; + ev.Player.Inventory.SendAmmoNextFrame = true; + + ((Firearm)ev.Player.CurrentItem).Ammo = (byte)(((Firearm)ev.Player.CurrentItem).Ammo + amountToReload); + + Log.Debug($"{ev.Player.Nickname} ({ev.Player.UserId}) [{ev.Player.Role}] reloaded a {Name} ({Id}) [{Type} ({((Firearm)ev.Player.CurrentItem).Ammo}/{ClipSize})]!"); } private void OnInternalShooting(ShootingEventArgs ev) @@ -280,4 +314,4 @@ private void OnInternalHurting(HurtingEventArgs ev) OnHurting(ev); } } -} +} \ No newline at end of file diff --git a/Exiled.Events/Commands/PluginManager/PluginManager.cs b/Exiled.Events/Commands/PluginManager/PluginManager.cs index fb26f66583..ba778d5f43 100644 --- a/Exiled.Events/Commands/PluginManager/PluginManager.cs +++ b/Exiled.Events/Commands/PluginManager/PluginManager.cs @@ -47,7 +47,7 @@ public override void LoadGeneratedCommands() /// protected override bool ExecuteParent(ArraySegment arguments, ICommandSender sender, out string response) { - response = "Please, specify a valid subcommand! Available ones: enable, disable, show"; + response = "Please, specify a valid subcommand! Available ones: enable, disable, show, patches"; return false; } } diff --git a/Exiled.Events/EventArgs/Cassie/SendingCassieMessageEventArgs.cs b/Exiled.Events/EventArgs/Cassie/SendingCassieMessageEventArgs.cs index acbeb7eb3d..c21f7c9f6b 100644 --- a/Exiled.Events/EventArgs/Cassie/SendingCassieMessageEventArgs.cs +++ b/Exiled.Events/EventArgs/Cassie/SendingCassieMessageEventArgs.cs @@ -10,21 +10,21 @@ namespace Exiled.Events.EventArgs.Cassie using Interfaces; /// - /// Contains all the information after sending a C.A.S.S.I.E. message. + /// Contains all the information after sending a C.A.S.S.I.E. message. /// public class SendingCassieMessageEventArgs : IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// Indicates whether the event can be executed or not. public SendingCassieMessageEventArgs(string words, bool makeHold, bool makeNoise, bool isAllowed = true) @@ -36,22 +36,22 @@ public SendingCassieMessageEventArgs(string words, bool makeHold, bool makeNoise } /// - /// Gets or sets the message. + /// Gets or sets the message. /// public string Words { get; set; } /// - /// Gets or sets a value indicating whether or not the message should be held. + /// Gets or sets a value indicating whether or not the message should be held. /// public bool MakeHold { get; set; } /// - /// Gets or sets a value indicating whether or not the message should make noise. + /// Gets or sets a value indicating whether or not the message should make noise. /// public bool MakeNoise { get; set; } /// - /// Gets or sets a value indicating whether or not the message can be sent. + /// Gets or sets a value indicating whether or not the message can be sent. /// public bool IsAllowed { get; set; } } diff --git a/Exiled.Events/EventArgs/Interfaces/IAttackerEvent.cs b/Exiled.Events/EventArgs/Interfaces/IAttackerEvent.cs index 9c0e008028..f69b43cadd 100644 --- a/Exiled.Events/EventArgs/Interfaces/IAttackerEvent.cs +++ b/Exiled.Events/EventArgs/Interfaces/IAttackerEvent.cs @@ -11,17 +11,17 @@ namespace Exiled.Events.EventArgs.Interfaces using API.Features.DamageHandlers; /// - /// Event args for when a player is taking damage. + /// Event args for when a player is taking damage. /// public interface IAttackerEvent : IPlayerEvent { /// - /// Gets the attacker . + /// Gets the attacker . /// public Player Attacker { get; } /// - /// Gets or sets the managing the damage to the target. + /// Gets or sets the managing the damage to the target. /// public CustomDamageHandler DamageHandler { get; set; } } diff --git a/Exiled.Events/EventArgs/Interfaces/ICameraEvent.cs b/Exiled.Events/EventArgs/Interfaces/ICameraEvent.cs index ad837509d5..53aadf762a 100644 --- a/Exiled.Events/EventArgs/Interfaces/ICameraEvent.cs +++ b/Exiled.Events/EventArgs/Interfaces/ICameraEvent.cs @@ -10,12 +10,12 @@ namespace Exiled.Events.EventArgs.Interfaces using API.Features; /// - /// Event args used for all related events. + /// Event args used for all related events. /// public interface ICameraEvent : IExiledEvent { /// - /// Gets or sets the triggering the event. + /// Gets or sets the triggering the event. /// public Camera Camera { get; set; } } diff --git a/Exiled.Events/EventArgs/Interfaces/IDeniableEvent.cs b/Exiled.Events/EventArgs/Interfaces/IDeniableEvent.cs index 2747b45d12..41a4e78eac 100644 --- a/Exiled.Events/EventArgs/Interfaces/IDeniableEvent.cs +++ b/Exiled.Events/EventArgs/Interfaces/IDeniableEvent.cs @@ -8,12 +8,12 @@ namespace Exiled.Events.EventArgs.Interfaces { /// - /// Event args for events that can be allowed or denied. + /// Event args for events that can be allowed or denied. /// public interface IDeniableEvent : IExiledEvent { /// - /// Gets or sets a value indicating whether or not the event is allowed to continue. + /// Gets or sets a value indicating whether or not the event is allowed to continue. /// public bool IsAllowed { get; set; } } diff --git a/Exiled.Events/EventArgs/Interfaces/IDoorEvent.cs b/Exiled.Events/EventArgs/Interfaces/IDoorEvent.cs index b1060d6033..34a02f036d 100644 --- a/Exiled.Events/EventArgs/Interfaces/IDoorEvent.cs +++ b/Exiled.Events/EventArgs/Interfaces/IDoorEvent.cs @@ -10,12 +10,12 @@ namespace Exiled.Events.EventArgs.Interfaces using Exiled.API.Features.Doors; /// - /// Event args used for all related events. + /// Event args used for all related events. /// public interface IDoorEvent : IExiledEvent { /// - /// Gets the triggering the event. + /// Gets the triggering the event. /// public Door Door { get; } } diff --git a/Exiled.Events/EventArgs/Interfaces/IExiledEvent.cs b/Exiled.Events/EventArgs/Interfaces/IExiledEvent.cs index 05e651f50c..1e1c55bfc6 100644 --- a/Exiled.Events/EventArgs/Interfaces/IExiledEvent.cs +++ b/Exiled.Events/EventArgs/Interfaces/IExiledEvent.cs @@ -8,7 +8,7 @@ namespace Exiled.Events.EventArgs.Interfaces { /// - /// The base Exiled Event Args interface to be used by all other event arg interfaces/classes. + /// The base Exiled Event Args interface to be used by all other event arg interfaces/classes. /// public interface IExiledEvent { diff --git a/Exiled.Events/EventArgs/Interfaces/IFirearmEvent.cs b/Exiled.Events/EventArgs/Interfaces/IFirearmEvent.cs index 0fdb3f4a4f..9f73249a04 100644 --- a/Exiled.Events/EventArgs/Interfaces/IFirearmEvent.cs +++ b/Exiled.Events/EventArgs/Interfaces/IFirearmEvent.cs @@ -10,12 +10,12 @@ namespace Exiled.Events.EventArgs.Interfaces using API.Features.Items; /// - /// Event args used for all related events. + /// Event args used for all related events. /// public interface IFirearmEvent : IItemEvent { /// - /// Gets the triggering the event. + /// Gets the triggering the event. /// public Firearm Firearm { get; } } diff --git a/Exiled.Events/EventArgs/Interfaces/IGeneratorEvent.cs b/Exiled.Events/EventArgs/Interfaces/IGeneratorEvent.cs index b5afc3cc90..479636f7ac 100644 --- a/Exiled.Events/EventArgs/Interfaces/IGeneratorEvent.cs +++ b/Exiled.Events/EventArgs/Interfaces/IGeneratorEvent.cs @@ -10,12 +10,12 @@ namespace Exiled.Events.EventArgs.Interfaces using API.Features; /// - /// Event args used for all related events. + /// Event args used for all related events. /// public interface IGeneratorEvent : IExiledEvent { /// - /// Gets the triggering the event. + /// Gets the triggering the event. /// public Generator Generator { get; } } diff --git a/Exiled.Events/EventArgs/Interfaces/IItemEvent.cs b/Exiled.Events/EventArgs/Interfaces/IItemEvent.cs index 603aa2c937..978cb2bc79 100644 --- a/Exiled.Events/EventArgs/Interfaces/IItemEvent.cs +++ b/Exiled.Events/EventArgs/Interfaces/IItemEvent.cs @@ -10,12 +10,12 @@ namespace Exiled.Events.EventArgs.Interfaces using API.Features.Items; /// - /// Event args used for all related events. + /// Event args used for all related events. /// public interface IItemEvent : IExiledEvent { /// - /// Gets the triggering the event. + /// Gets the triggering the event. /// public Item Item { get; } } diff --git a/Exiled.Events/EventArgs/Interfaces/IPickupEvent.cs b/Exiled.Events/EventArgs/Interfaces/IPickupEvent.cs index 6ce4463685..d1defc0936 100644 --- a/Exiled.Events/EventArgs/Interfaces/IPickupEvent.cs +++ b/Exiled.Events/EventArgs/Interfaces/IPickupEvent.cs @@ -10,12 +10,12 @@ namespace Exiled.Events.EventArgs.Interfaces using Exiled.API.Features.Pickups; /// - /// Event args used for all related events. + /// Event args used for all related events. /// public interface IPickupEvent : IExiledEvent { /// - /// Gets the triggering the event. + /// Gets the triggering the event. /// public Pickup Pickup { get; } } diff --git a/Exiled.Events/EventArgs/Interfaces/IPlayerEvent.cs b/Exiled.Events/EventArgs/Interfaces/IPlayerEvent.cs index 62d064bf1b..46c7e2aaf2 100644 --- a/Exiled.Events/EventArgs/Interfaces/IPlayerEvent.cs +++ b/Exiled.Events/EventArgs/Interfaces/IPlayerEvent.cs @@ -10,12 +10,12 @@ namespace Exiled.Events.EventArgs.Interfaces using API.Features; /// - /// Event args used for all related events. + /// Event args used for all related events. /// public interface IPlayerEvent : IExiledEvent { /// - /// Gets the triggering the event. + /// Gets the triggering the event. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Interfaces/IRagdollEvent.cs b/Exiled.Events/EventArgs/Interfaces/IRagdollEvent.cs index 84147ba835..fe1fd61ada 100644 --- a/Exiled.Events/EventArgs/Interfaces/IRagdollEvent.cs +++ b/Exiled.Events/EventArgs/Interfaces/IRagdollEvent.cs @@ -10,12 +10,12 @@ namespace Exiled.Events.EventArgs.Interfaces using API.Features; /// - /// Event args used for all related events. + /// Event args used for all related events. /// public interface IRagdollEvent : IExiledEvent { /// - /// Gets the triggering the event. + /// Gets the triggering the event. /// public Ragdoll Ragdoll { get; } } diff --git a/Exiled.Events/EventArgs/Interfaces/IRoomEvent.cs b/Exiled.Events/EventArgs/Interfaces/IRoomEvent.cs index aa38d42509..c1bc250e3d 100644 --- a/Exiled.Events/EventArgs/Interfaces/IRoomEvent.cs +++ b/Exiled.Events/EventArgs/Interfaces/IRoomEvent.cs @@ -10,12 +10,12 @@ namespace Exiled.Events.EventArgs.Interfaces using API.Features; /// - /// Event args used for all related events. + /// Event args used for all related events. /// public interface IRoomEvent : IExiledEvent { /// - /// Gets the that is a part of the event. + /// Gets the that is a part of the event. /// public Room Room { get; } } diff --git a/Exiled.Events/EventArgs/Interfaces/IScp0492Event.cs b/Exiled.Events/EventArgs/Interfaces/IScp0492Event.cs index 3a01e27306..65f6edd226 100644 --- a/Exiled.Events/EventArgs/Interfaces/IScp0492Event.cs +++ b/Exiled.Events/EventArgs/Interfaces/IScp0492Event.cs @@ -10,12 +10,12 @@ namespace Exiled.Events.EventArgs.Interfaces using Exiled.API.Features.Roles; /// - /// Event args used for all related events. + /// Event args used for all related events. /// public interface IScp0492Event : IPlayerEvent { /// - /// Gets the triggering the event. + /// Gets the triggering the event. /// public Scp0492Role Scp0492 { get; } } diff --git a/Exiled.Events/EventArgs/Interfaces/IScp049Event.cs b/Exiled.Events/EventArgs/Interfaces/IScp049Event.cs index b397c05e83..29d5e73273 100644 --- a/Exiled.Events/EventArgs/Interfaces/IScp049Event.cs +++ b/Exiled.Events/EventArgs/Interfaces/IScp049Event.cs @@ -10,12 +10,12 @@ namespace Exiled.Events.EventArgs.Interfaces using Exiled.API.Features.Roles; /// - /// Event args used for all related events. + /// Event args used for all related events. /// public interface IScp049Event : IPlayerEvent { /// - /// Gets the triggering the event. + /// Gets the triggering the event. /// public Scp049Role Scp049 { get; } } diff --git a/Exiled.Events/EventArgs/Interfaces/IScp079Event.cs b/Exiled.Events/EventArgs/Interfaces/IScp079Event.cs index df91d55e54..6a2ddae8f6 100644 --- a/Exiled.Events/EventArgs/Interfaces/IScp079Event.cs +++ b/Exiled.Events/EventArgs/Interfaces/IScp079Event.cs @@ -10,12 +10,12 @@ namespace Exiled.Events.EventArgs.Interfaces using Exiled.API.Features.Roles; /// - /// Event args used for all related events. + /// Event args used for all related events. /// public interface IScp079Event : IPlayerEvent { /// - /// Gets the triggering the event. + /// Gets the triggering the event. /// public Scp079Role Scp079 { get; } } diff --git a/Exiled.Events/EventArgs/Interfaces/IScp096Event.cs b/Exiled.Events/EventArgs/Interfaces/IScp096Event.cs index d742c5b8a2..faafdbcb48 100644 --- a/Exiled.Events/EventArgs/Interfaces/IScp096Event.cs +++ b/Exiled.Events/EventArgs/Interfaces/IScp096Event.cs @@ -10,12 +10,12 @@ namespace Exiled.Events.EventArgs.Interfaces using Exiled.API.Features.Roles; /// - /// Event args used for all related events. + /// Event args used for all related events. /// public interface IScp096Event : IPlayerEvent { /// - /// Gets the triggering the event. + /// Gets the triggering the event. /// public Scp096Role Scp096 { get; } } diff --git a/Exiled.Events/EventArgs/Interfaces/IScp106Event.cs b/Exiled.Events/EventArgs/Interfaces/IScp106Event.cs index 32d3971b6c..2fb8751672 100644 --- a/Exiled.Events/EventArgs/Interfaces/IScp106Event.cs +++ b/Exiled.Events/EventArgs/Interfaces/IScp106Event.cs @@ -10,12 +10,12 @@ namespace Exiled.Events.EventArgs.Interfaces using Exiled.API.Features.Roles; /// - /// Event args used for all related events. + /// Event args used for all related events. /// public interface IScp106Event : IPlayerEvent { /// - /// Gets the triggering the event. + /// Gets the triggering the event. /// public Scp106Role Scp106 { get; } } diff --git a/Exiled.Events/EventArgs/Interfaces/IScp173Event.cs b/Exiled.Events/EventArgs/Interfaces/IScp173Event.cs index 7358e66d2d..c9b2f6eb1f 100644 --- a/Exiled.Events/EventArgs/Interfaces/IScp173Event.cs +++ b/Exiled.Events/EventArgs/Interfaces/IScp173Event.cs @@ -10,12 +10,12 @@ namespace Exiled.Events.EventArgs.Interfaces using Exiled.API.Features.Roles; /// - /// Event args used for all related events. + /// Event args used for all related events. /// public interface IScp173Event : IPlayerEvent { /// - /// Gets the triggering the event. + /// Gets the triggering the event. /// public Scp173Role Scp173 { get; } } diff --git a/Exiled.Events/EventArgs/Interfaces/IScp3114Event.cs b/Exiled.Events/EventArgs/Interfaces/IScp3114Event.cs index b9ce041be5..5683a7a7ae 100644 --- a/Exiled.Events/EventArgs/Interfaces/IScp3114Event.cs +++ b/Exiled.Events/EventArgs/Interfaces/IScp3114Event.cs @@ -10,12 +10,12 @@ namespace Exiled.Events.EventArgs.Interfaces using Exiled.API.Features.Roles; /// - /// Event args used for all related events. + /// Event args used for all related events. /// public interface IScp3114Event : IPlayerEvent { /// - /// Gets the triggering the event. + /// Gets the triggering the event. /// public Scp3114Role Scp3114 { get; } } diff --git a/Exiled.Events/EventArgs/Interfaces/IScp939Event.cs b/Exiled.Events/EventArgs/Interfaces/IScp939Event.cs index fd4801ef6b..12aed0e088 100644 --- a/Exiled.Events/EventArgs/Interfaces/IScp939Event.cs +++ b/Exiled.Events/EventArgs/Interfaces/IScp939Event.cs @@ -10,12 +10,12 @@ namespace Exiled.Events.EventArgs.Interfaces using Exiled.API.Features.Roles; /// - /// Event args used for all related events. + /// Event args used for all related events. /// public interface IScp939Event : IPlayerEvent { /// - /// Gets the triggering the event. + /// Gets the triggering the event. /// public Scp939Role Scp939 { get; } } diff --git a/Exiled.Events/EventArgs/Interfaces/ITeslaEvent.cs b/Exiled.Events/EventArgs/Interfaces/ITeslaEvent.cs index b5ff5a6f9c..3f6c95287a 100644 --- a/Exiled.Events/EventArgs/Interfaces/ITeslaEvent.cs +++ b/Exiled.Events/EventArgs/Interfaces/ITeslaEvent.cs @@ -10,12 +10,12 @@ namespace Exiled.Events.EventArgs.Interfaces using API.Features; /// - /// Event args used for all related events. + /// Event args used for all related events. /// public interface ITeslaEvent : IExiledEvent { /// - /// Gets the triggering the event. + /// Gets the triggering the event. /// public TeslaGate Tesla { get; } } diff --git a/Exiled.Events/EventArgs/Interfaces/IUsableEvent.cs b/Exiled.Events/EventArgs/Interfaces/IUsableEvent.cs index 8b8d77ba5e..6c34c16e8a 100644 --- a/Exiled.Events/EventArgs/Interfaces/IUsableEvent.cs +++ b/Exiled.Events/EventArgs/Interfaces/IUsableEvent.cs @@ -10,12 +10,12 @@ namespace Exiled.Events.EventArgs.Interfaces using Exiled.API.Features.Items; /// - /// Event args used for all related events. + /// Event args used for all related events. /// public interface IUsableEvent : IItemEvent { /// - /// Gets the triggering the event. + /// Gets the triggering the event. /// public Usable Usable { get; } } diff --git a/Exiled.Events/EventArgs/Item/ChangingAttachmentsEventArgs.cs b/Exiled.Events/EventArgs/Item/ChangingAttachmentsEventArgs.cs index be50fbd8be..0e1c8fbed3 100644 --- a/Exiled.Events/EventArgs/Item/ChangingAttachmentsEventArgs.cs +++ b/Exiled.Events/EventArgs/Item/ChangingAttachmentsEventArgs.cs @@ -21,22 +21,22 @@ namespace Exiled.Events.EventArgs.Item using InventorySystem.Items.Firearms.Attachments; /// - /// Contains all information before changing item attachments. + /// Contains all information before changing item attachments. /// public class ChangingAttachmentsEventArgs : IPlayerEvent, IDeniableEvent, IFirearmEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// The attachments code. /// - /// + /// /// public ChangingAttachmentsEventArgs( Player player, @@ -54,32 +54,32 @@ public ChangingAttachmentsEventArgs( } /// - /// Gets the old . + /// Gets the old . /// public IEnumerable CurrentAttachmentIdentifiers { get; } /// - /// Gets or sets the new . + /// Gets or sets the new . /// public List NewAttachmentIdentifiers { get; set; } /// - /// Gets the code. + /// Gets the code. /// public uint CurrentCode { get; } /// - /// Gets the code. + /// Gets the code. /// public uint NewCode { get; } /// - /// Gets or sets a value indicating whether or not the attachments can be changed. + /// Gets or sets a value indicating whether or not the attachments can be changed. /// public bool IsAllowed { get; set; } /// - /// Gets the which is being modified. + /// Gets the which is being modified. /// public Firearm Firearm { get; } @@ -87,7 +87,7 @@ public ChangingAttachmentsEventArgs( public Item Item => Firearm; /// - /// Gets the who's changing attachments. + /// Gets the who's changing attachments. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Item/ReceivingPreferenceEventArgs.cs b/Exiled.Events/EventArgs/Item/ReceivingPreferenceEventArgs.cs index 5cef77e0ca..72e04e534a 100644 --- a/Exiled.Events/EventArgs/Item/ReceivingPreferenceEventArgs.cs +++ b/Exiled.Events/EventArgs/Item/ReceivingPreferenceEventArgs.cs @@ -19,27 +19,27 @@ namespace Exiled.Events.EventArgs.Item using Interfaces; /// - /// Contains all information before receiving a preference. + /// Contains all information before receiving a preference. /// public class ReceivingPreferenceEventArgs : IPlayerEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public ReceivingPreferenceEventArgs(Player player, ItemType itemType, uint currentCode, uint newCode, bool isAllowed = true) { @@ -52,27 +52,27 @@ public ReceivingPreferenceEventArgs(Player player, ItemType itemType, uint curre } /// - /// Gets the which is being modified. + /// Gets the which is being modified. /// public FirearmType Item { get; } /// - /// Gets the old []. + /// Gets the old []. /// public IEnumerable CurrentAttachmentIdentifiers { get; } /// - /// Gets or sets the new of . + /// Gets or sets the new of . /// public List NewAttachmentIdentifiers { get; set; } /// - /// Gets the current attachments code. + /// Gets the current attachments code. /// public uint CurrentCode { get; } /// - /// Gets or sets the new attachments code. + /// Gets or sets the new attachments code. /// public uint NewCode { @@ -81,12 +81,12 @@ public uint NewCode } /// - /// Gets or sets a value indicating whether or not the attachments preference is allowed. + /// Gets or sets a value indicating whether or not the attachments preference is allowed. /// public bool IsAllowed { get; set; } /// - /// Gets the who's changing attachments. + /// Gets the who's changing attachments. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Item/UsingRadioPickupBatteryEventArgs.cs b/Exiled.Events/EventArgs/Item/UsingRadioPickupBatteryEventArgs.cs new file mode 100644 index 0000000000..5367b43630 --- /dev/null +++ b/Exiled.Events/EventArgs/Item/UsingRadioPickupBatteryEventArgs.cs @@ -0,0 +1,45 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Events.EventArgs.Item +{ + using Exiled.API.Features.Pickups; + using Exiled.Events.EventArgs.Interfaces; + + /// + /// Contains all information before radio pickup battery drains. + /// + public class UsingRadioPickupBatteryEventArgs : IDeniableEvent, IPickupEvent + { + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// + public UsingRadioPickupBatteryEventArgs(InventorySystem.Items.Radio.RadioPickup pickup, float drain, bool isAllowed = true) + { + RadioPickup = Pickup.Get(pickup).As(); + Drain = drain; + IsAllowed = isAllowed; + } + + /// + public bool IsAllowed { get; set; } + + /// + public Pickup Pickup => RadioPickup; + + /// + public RadioPickup RadioPickup { get; } + + /// + /// Gets or sets the radio percent drain. + /// + public float Drain { get; set; } + } +} \ No newline at end of file diff --git a/Exiled.Events/EventArgs/Map/AnnouncingDecontaminationEventArgs.cs b/Exiled.Events/EventArgs/Map/AnnouncingDecontaminationEventArgs.cs index 56949b40d2..6b13ed6a55 100644 --- a/Exiled.Events/EventArgs/Map/AnnouncingDecontaminationEventArgs.cs +++ b/Exiled.Events/EventArgs/Map/AnnouncingDecontaminationEventArgs.cs @@ -13,18 +13,18 @@ namespace Exiled.Events.EventArgs.Map using static LightContainmentZoneDecontamination.DecontaminationController.DecontaminationPhase; /// - /// Contains all information before C.A.S.S.I.E announces light containment zone decontamination. + /// Contains all information before C.A.S.S.I.E announces light containment zone decontamination. /// public class AnnouncingDecontaminationEventArgs : IExiledEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// public AnnouncingDecontaminationEventArgs(int announcementId, PhaseFunction phaseFunction) { @@ -34,22 +34,22 @@ public AnnouncingDecontaminationEventArgs(int announcementId, PhaseFunction phas } /// - /// Gets the announcement id, from 0 to 6. + /// Gets the announcement id, from 0 to 6. /// public int Id { get; } /// - /// Gets the announcement id, from 0 to 6. + /// Gets the announcement id, from 0 to 6. /// public DecontaminationState State => (DecontaminationState)Id; /// - /// Gets a value indicating whether the action will be. + /// Gets a value indicating whether the action will be. /// public PhaseFunction PhaseFunction { get; } /// - /// Gets a value indicating whether the announcement is going to be global or not. + /// Gets a value indicating whether the announcement is going to be global or not. /// public bool IsGlobal { get; } } diff --git a/Exiled.Events/EventArgs/Map/AnnouncingNtfEntranceEventArgs.cs b/Exiled.Events/EventArgs/Map/AnnouncingNtfEntranceEventArgs.cs index a19357a33d..7f701de084 100644 --- a/Exiled.Events/EventArgs/Map/AnnouncingNtfEntranceEventArgs.cs +++ b/Exiled.Events/EventArgs/Map/AnnouncingNtfEntranceEventArgs.cs @@ -10,24 +10,24 @@ namespace Exiled.Events.EventArgs.Map using Interfaces; /// - /// Contains all information before C.A.S.S.I.E announces the NTF entrance. + /// Contains all information before C.A.S.S.I.E announces the NTF entrance. /// public class AnnouncingNtfEntranceEventArgs : IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public AnnouncingNtfEntranceEventArgs(int scpsLeft, string unitName, int unitNumber, bool isAllowed = true) { @@ -38,22 +38,22 @@ public AnnouncingNtfEntranceEventArgs(int scpsLeft, string unitName, int unitNum } /// - /// Gets or sets the number of SCPs left. + /// Gets or sets the number of SCPs left. /// public int ScpsLeft { get; set; } /// - /// Gets or sets the NTF unit name. + /// Gets or sets the NTF unit name. /// public string UnitName { get; set; } /// - /// Gets or sets the NTF unit number. + /// Gets or sets the NTF unit number. /// public int UnitNumber { get; set; } /// - /// Gets or sets a value indicating whether or not the NTF spawn will be announced by C.A.S.S.I.E. + /// Gets or sets a value indicating whether or not the NTF spawn will be announced by C.A.S.S.I.E. /// public bool IsAllowed { get; set; } } diff --git a/Exiled.Events/EventArgs/Map/AnnouncingScpTerminationEventArgs.cs b/Exiled.Events/EventArgs/Map/AnnouncingScpTerminationEventArgs.cs index 298c2f291c..2636eb26fd 100644 --- a/Exiled.Events/EventArgs/Map/AnnouncingScpTerminationEventArgs.cs +++ b/Exiled.Events/EventArgs/Map/AnnouncingScpTerminationEventArgs.cs @@ -17,21 +17,21 @@ namespace Exiled.Events.EventArgs.Map using DamageHandlerBase = PlayerStatsSystem.DamageHandlerBase; /// - /// Contains all information before C.A.S.S.I.E announces an SCP termination. + /// Contains all information before C.A.S.S.I.E announces an SCP termination. /// public class AnnouncingScpTerminationEventArgs : IAttackerEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public AnnouncingScpTerminationEventArgs(Player scp, DamageHandlerBase damageHandlerBase, bool isAllowed = true) { @@ -44,32 +44,32 @@ public AnnouncingScpTerminationEventArgs(Player scp, DamageHandlerBase damageHan } /// - /// Gets the killed . + /// Gets the killed . /// public Role Role { get; } /// - /// Gets or sets the termination cause. + /// Gets or sets the termination cause. /// public string TerminationCause { get; set; } /// - /// Gets the player the announcement is being played for. + /// Gets the player the announcement is being played for. /// public Player Player { get; } /// - /// Gets the player who killed the SCP. + /// Gets the player who killed the SCP. /// public Player Attacker { get; } /// - /// Gets or sets the . + /// Gets or sets the . /// public CustomDamageHandler DamageHandler { get; set; } /// - /// Gets or sets a value indicating whether or not the SCP termination will be announced by C.A.S.S.I.E. + /// Gets or sets a value indicating whether or not the SCP termination will be announced by C.A.S.S.I.E. /// public bool IsAllowed { get; set; } = true; } diff --git a/Exiled.Events/EventArgs/Map/ChangingIntoGrenadeEventArgs.cs b/Exiled.Events/EventArgs/Map/ChangingIntoGrenadeEventArgs.cs index f29358d4ba..765d38f61b 100644 --- a/Exiled.Events/EventArgs/Map/ChangingIntoGrenadeEventArgs.cs +++ b/Exiled.Events/EventArgs/Map/ChangingIntoGrenadeEventArgs.cs @@ -14,12 +14,12 @@ namespace Exiled.Events.EventArgs.Map using InventorySystem.Items.ThrowableProjectiles; /// - /// Contains all information for when the server is turning a pickup into a live grenade. + /// Contains all information for when the server is turning a pickup into a live grenade. /// public class ChangingIntoGrenadeEventArgs : IDeniableEvent, IPickupEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The being changed. public ChangingIntoGrenadeEventArgs(TimedGrenadePickup pickup) @@ -42,7 +42,7 @@ public ChangingIntoGrenadeEventArgs(TimedGrenadePickup pickup) public ItemType Type { get; set; } /// - /// Gets or sets a value indicating whether the pickup will be changed. + /// Gets or sets a value indicating whether the pickup will be changed. /// public bool IsAllowed { get; set; } = true; } diff --git a/Exiled.Events/EventArgs/Map/DecontaminatingEventArgs.cs b/Exiled.Events/EventArgs/Map/DecontaminatingEventArgs.cs index 588ef4d3db..6bce5e7801 100644 --- a/Exiled.Events/EventArgs/Map/DecontaminatingEventArgs.cs +++ b/Exiled.Events/EventArgs/Map/DecontaminatingEventArgs.cs @@ -10,15 +10,15 @@ namespace Exiled.Events.EventArgs.Map using Interfaces; /// - /// Contains all information before decontaminating the light containment zone. + /// Contains all information before decontaminating the light containment zone. /// public class DecontaminatingEventArgs : IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// public DecontaminatingEventArgs(bool isAllowed = true) { @@ -26,7 +26,7 @@ public DecontaminatingEventArgs(bool isAllowed = true) } /// - /// Gets or sets a value indicating whether or not light containment zone decontamination can begin. + /// Gets or sets a value indicating whether or not light containment zone decontamination can begin. /// public bool IsAllowed { get; set; } } diff --git a/Exiled.Events/EventArgs/Map/ExplodingGrenadeEventArgs.cs b/Exiled.Events/EventArgs/Map/ExplodingGrenadeEventArgs.cs index 2c21cfde45..b8e1fec768 100644 --- a/Exiled.Events/EventArgs/Map/ExplodingGrenadeEventArgs.cs +++ b/Exiled.Events/EventArgs/Map/ExplodingGrenadeEventArgs.cs @@ -23,7 +23,7 @@ namespace Exiled.Events.EventArgs.Map using UnityEngine; /// - /// Contains all information before a grenade explodes. + /// Contains all information before a grenade explodes. /// public class ExplodingGrenadeEventArgs : IPlayerEvent, IDeniableEvent { @@ -67,7 +67,7 @@ public ExplodingGrenadeEventArgs(Footprint thrower, Vector3 position, ExplosionG break; case true: { - if (Server.FriendlyFire || thrower.Hub == Server.Host.ReferenceHub || HitboxIdentity.CheckFriendlyFire(thrower.Role, hub.roleManager.CurrentRole.RoleTypeId)) + if (Server.FriendlyFire || thrower.Hub == Server.Host.ReferenceHub || HitboxIdentity.IsEnemy(thrower.Role, hub.roleManager.CurrentRole.RoleTypeId)) { if (!TargetsToAffect.Contains(player)) TargetsToAffect.Add(player); @@ -80,16 +80,16 @@ public ExplodingGrenadeEventArgs(Footprint thrower, Vector3 position, ExplosionG } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public ExplodingGrenadeEventArgs(Player thrower, EffectGrenade grenade, bool isAllowed = true) { @@ -114,7 +114,7 @@ public ExplodingGrenadeEventArgs(Player thrower, EffectGrenade grenade, bool isA public Vector3 Position { get; } /// - /// Gets the players who could be affected by the grenade, if any, and the damage that be dealt. + /// Gets the players who could be affected by the grenade, if any, and the damage that be dealt. /// public List TargetsToAffect { get; } @@ -124,12 +124,12 @@ public ExplodingGrenadeEventArgs(Player thrower, EffectGrenade grenade, bool isA public EffectGrenadeProjectile Projectile { get; } /// - /// Gets or sets a value indicating whether or not the grenade can be thrown. + /// Gets or sets a value indicating whether or not the grenade can be thrown. /// public bool IsAllowed { get; set; } = true; /// - /// Gets the player who thrown the grenade. + /// Gets the player who thrown the grenade. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Map/FillingLockerEventArgs.cs b/Exiled.Events/EventArgs/Map/FillingLockerEventArgs.cs index 954b419cf0..f50a87182f 100644 --- a/Exiled.Events/EventArgs/Map/FillingLockerEventArgs.cs +++ b/Exiled.Events/EventArgs/Map/FillingLockerEventArgs.cs @@ -15,18 +15,18 @@ namespace Exiled.Events.EventArgs.Map using MapGeneration.Distributors; /// - /// Contains all information before the server spawns an item in locker. + /// Contains all information before the server spawns an item in locker. /// public class FillingLockerEventArgs : IDeniableEvent, IPickupEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// public FillingLockerEventArgs(ItemPickupBase pickupBase, LockerChamber lockerChamber) { @@ -35,17 +35,17 @@ public FillingLockerEventArgs(ItemPickupBase pickupBase, LockerChamber lockerCha } /// - /// Gets a value indicating the item being spawned. + /// Gets a value indicating the item being spawned. /// public Pickup Pickup { get; } /// - /// Gets a value indicating the target locker chamber. + /// Gets a value indicating the target locker chamber. /// public LockerChamber LockerChamber { get; } /// - /// Gets or sets a value indicating whether or not the item can be spawned. + /// Gets or sets a value indicating whether or not the item can be spawned. /// public bool IsAllowed { get; set; } = true; } diff --git a/Exiled.Events/EventArgs/Map/GeneratorActivatingEventArgs.cs b/Exiled.Events/EventArgs/Map/GeneratorActivatingEventArgs.cs index f4e1fca145..aa8fad27ec 100644 --- a/Exiled.Events/EventArgs/Map/GeneratorActivatingEventArgs.cs +++ b/Exiled.Events/EventArgs/Map/GeneratorActivatingEventArgs.cs @@ -14,18 +14,18 @@ namespace Exiled.Events.EventArgs.Map using MapGeneration.Distributors; /// - /// Contains all information after activating a generator. + /// Contains all information after activating a generator. /// public class GeneratorActivatingEventArgs : IGeneratorEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// public GeneratorActivatingEventArgs(Scp079Generator generator, bool isAllowed = true) { @@ -34,12 +34,12 @@ public GeneratorActivatingEventArgs(Scp079Generator generator, bool isAllowed = } /// - /// Gets the generator. + /// Gets the generator. /// public Generator Generator { get; } /// - /// Gets or sets a value indicating whether the generator can be activated or not. + /// Gets or sets a value indicating whether the generator can be activated or not. /// public bool IsAllowed { get; set; } } diff --git a/Exiled.Events/EventArgs/Map/PickupAddedEventArgs.cs b/Exiled.Events/EventArgs/Map/PickupAddedEventArgs.cs index cffd4ecd49..6b1c175234 100644 --- a/Exiled.Events/EventArgs/Map/PickupAddedEventArgs.cs +++ b/Exiled.Events/EventArgs/Map/PickupAddedEventArgs.cs @@ -12,15 +12,15 @@ namespace Exiled.Events.EventArgs.Map using InventorySystem.Items.Pickups; /// - /// Contains all information after the server spawns a pickup. + /// Contains all information after the server spawns a pickup. /// public class PickupAddedEventArgs : IPickupEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// public PickupAddedEventArgs(ItemPickupBase pickupBase) { @@ -28,7 +28,7 @@ public PickupAddedEventArgs(ItemPickupBase pickupBase) } /// - /// Gets a value indicating the pickup being spawned. + /// Gets a value indicating the pickup being spawned. /// public Pickup Pickup { get; } } diff --git a/Exiled.Events/EventArgs/Map/PickupDestroyedEventArgs.cs b/Exiled.Events/EventArgs/Map/PickupDestroyedEventArgs.cs index 751fc5fba8..982073b9a1 100644 --- a/Exiled.Events/EventArgs/Map/PickupDestroyedEventArgs.cs +++ b/Exiled.Events/EventArgs/Map/PickupDestroyedEventArgs.cs @@ -12,15 +12,15 @@ namespace Exiled.Events.EventArgs.Map using InventorySystem.Items.Pickups; /// - /// Contains all information after the server destroys a pickup. + /// Contains all information after the server destroys a pickup. /// public class PickupDestroyedEventArgs : IPickupEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// public PickupDestroyedEventArgs(ItemPickupBase pickupBase) { @@ -28,7 +28,7 @@ public PickupDestroyedEventArgs(ItemPickupBase pickupBase) } /// - /// Gets a value indicating the pickup being destroyed. + /// Gets a value indicating the pickup being destroyed. /// public Pickup Pickup { get; } } diff --git a/Exiled.Events/EventArgs/Map/PlacingBloodEventArgs.cs b/Exiled.Events/EventArgs/Map/PlacingBloodEventArgs.cs index bfe1cedaf8..58a06aeaf4 100644 --- a/Exiled.Events/EventArgs/Map/PlacingBloodEventArgs.cs +++ b/Exiled.Events/EventArgs/Map/PlacingBloodEventArgs.cs @@ -14,24 +14,24 @@ namespace Exiled.Events.EventArgs.Map using UnityEngine; /// - /// Contains all information before placing a blood decal. + /// Contains all information before placing a blood decal. /// public class PlacingBloodEventArgs : IPlayerEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public PlacingBloodEventArgs(Player player, Player target, RaycastHit hit, bool isAllowed = true) { @@ -42,22 +42,22 @@ public PlacingBloodEventArgs(Player player, Player target, RaycastHit hit, bool } /// - /// Gets the who's placing the blood. + /// Gets the who's placing the blood. /// public Player Player { get; } /// - /// Gets the target's instance. + /// Gets the target's instance. /// public Player Target { get; } /// - /// Gets or sets the blood placing position. + /// Gets or sets the blood placing position. /// public Vector3 Position { get; set; } /// - /// Gets or sets a value indicating whether or not the blood can be placed. + /// Gets or sets a value indicating whether or not the blood can be placed. /// public bool IsAllowed { get; set; } } diff --git a/Exiled.Events/EventArgs/Map/PlacingBulletHoleEventArgs.cs b/Exiled.Events/EventArgs/Map/PlacingBulletHoleEventArgs.cs index 6869d87819..8e237af27e 100644 --- a/Exiled.Events/EventArgs/Map/PlacingBulletHoleEventArgs.cs +++ b/Exiled.Events/EventArgs/Map/PlacingBulletHoleEventArgs.cs @@ -14,18 +14,18 @@ namespace Exiled.Events.EventArgs.Map using UnityEngine; /// - /// Contains all information before placing a bullet hole decal. + /// Contains all information before placing a bullet hole decal. /// public class PlacingBulletHoleEventArgs : IPlayerEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// public PlacingBulletHoleEventArgs(Player owner, RaycastHit hit) { @@ -35,22 +35,22 @@ public PlacingBulletHoleEventArgs(Player owner, RaycastHit hit) } /// - /// Gets or sets the decal position. + /// Gets or sets the decal position. /// public Vector3 Position { get; set; } /// - /// Gets or sets the decal rotation. + /// Gets or sets the decal rotation. /// public Quaternion Rotation { get; set; } /// - /// Gets or sets a value indicating whether or not the decal can be placed. + /// Gets or sets a value indicating whether or not the decal can be placed. /// public bool IsAllowed { get; set; } = true; /// - /// Gets the decal owner. + /// Gets the decal owner. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Map/SpawningItemEventArgs.cs b/Exiled.Events/EventArgs/Map/SpawningItemEventArgs.cs index 0cb31843de..7e1ef1cf66 100644 --- a/Exiled.Events/EventArgs/Map/SpawningItemEventArgs.cs +++ b/Exiled.Events/EventArgs/Map/SpawningItemEventArgs.cs @@ -14,21 +14,21 @@ namespace Exiled.Events.EventArgs.Map using InventorySystem.Items.Pickups; /// - /// Contains all information before the server spawns an item. + /// Contains all information before the server spawns an item. /// public class SpawningItemEventArgs : IDeniableEvent, IPickupEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public SpawningItemEventArgs(ItemPickupBase pickupBase, bool shouldInitiallySpawn, DoorVariant door) { @@ -38,26 +38,26 @@ public SpawningItemEventArgs(ItemPickupBase pickupBase, bool shouldInitiallySpaw } /// - /// Gets a value indicating the pickup being spawned. + /// Gets a value indicating the pickup being spawned. /// public Pickup Pickup { get; } /// - /// Gets or sets a value indicating whether or not the item will be initially spawned. + /// Gets or sets a value indicating whether or not the item will be initially spawned. /// public bool ShouldInitiallySpawn { get; set; } /// - /// Gets or sets a value indicating the trigger door for pickup. + /// Gets or sets a value indicating the trigger door for pickup. /// /// - /// Works only when is false. - /// null when is true. + /// Works only when is false. + /// null when is true. /// public Door TriggerDoor { get; set; } /// - /// Gets or sets a value indicating whether or not the item can be spawned. + /// Gets or sets a value indicating whether or not the item can be spawned. /// public bool IsAllowed { get; set; } = true; } diff --git a/Exiled.Events/EventArgs/Map/SpawningTeamVehicleEventArgs.cs b/Exiled.Events/EventArgs/Map/SpawningTeamVehicleEventArgs.cs index c412c6f2ab..6cc821d7ac 100644 --- a/Exiled.Events/EventArgs/Map/SpawningTeamVehicleEventArgs.cs +++ b/Exiled.Events/EventArgs/Map/SpawningTeamVehicleEventArgs.cs @@ -11,18 +11,18 @@ namespace Exiled.Events.EventArgs.Map using Respawning; /// - /// Contains all information before the server spawns a team's respawn vehicle. + /// Contains all information before the server spawns a team's respawn vehicle. /// public class SpawningTeamVehicleEventArgs : IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// The team who the vehicle belongs to. + /// The team who the vehicle belongs to. /// /// - /// + /// /// public SpawningTeamVehicleEventArgs(SpawnableTeamType team, bool isAllowed = true) { @@ -31,12 +31,12 @@ public SpawningTeamVehicleEventArgs(SpawnableTeamType team, bool isAllowed = tru } /// - /// Gets or sets which vehicle should spawn. + /// Gets or sets which vehicle should spawn. /// public SpawnableTeamType Team { get; set; } /// - /// Gets or sets a value indicating whether or not the vehicle can be spawned. + /// Gets or sets a value indicating whether or not the vehicle can be spawned. /// public bool IsAllowed { get; set; } } diff --git a/Exiled.Events/EventArgs/Player/ActivatingGeneratorEventArgs.cs b/Exiled.Events/EventArgs/Player/ActivatingGeneratorEventArgs.cs index 9a7fc1beb7..b3ca6d9ccb 100644 --- a/Exiled.Events/EventArgs/Player/ActivatingGeneratorEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/ActivatingGeneratorEventArgs.cs @@ -14,21 +14,21 @@ namespace Exiled.Events.EventArgs.Player using MapGeneration.Distributors; /// - /// Contains all information before a player filps the switch to a generator. + /// Contains all information before a player filps the switch to a generator. /// public class ActivatingGeneratorEventArgs : IPlayerEvent, IGeneratorEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public ActivatingGeneratorEventArgs(Player player, Scp079Generator generator, bool isAllowed = true) { @@ -38,17 +38,17 @@ public ActivatingGeneratorEventArgs(Player player, Scp079Generator generator, bo } /// - /// Gets or sets a value indicating whether or not the switch can be flipped. + /// Gets or sets a value indicating whether or not the switch can be flipped. /// public bool IsAllowed { get; set; } /// - /// Gets the instance. + /// Gets the instance. /// public Generator Generator { get; } /// - /// Gets the player who's filpping the switch to the generator. + /// Gets the player who's filpping the switch to the generator. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Player/ActivatingWarheadPanelEventArgs.cs b/Exiled.Events/EventArgs/Player/ActivatingWarheadPanelEventArgs.cs index f12af5a357..535dc0ad11 100644 --- a/Exiled.Events/EventArgs/Player/ActivatingWarheadPanelEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/ActivatingWarheadPanelEventArgs.cs @@ -12,18 +12,18 @@ namespace Exiled.Events.EventArgs.Player using Interfaces; /// - /// Contains all information before a player activates the warhead panel. + /// Contains all information before a player activates the warhead panel. /// public class ActivatingWarheadPanelEventArgs : IPlayerEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// public ActivatingWarheadPanelEventArgs(Player player, bool isAllowed = true) { @@ -32,12 +32,12 @@ public ActivatingWarheadPanelEventArgs(Player player, bool isAllowed = true) } /// - /// Gets or sets a value indicating whether or not the warhead can be activated. + /// Gets or sets a value indicating whether or not the warhead can be activated. /// public bool IsAllowed { get; set; } /// - /// Gets the player who's trying to activate the warhead panel. + /// Gets the player who's trying to activate the warhead panel. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Player/ActivatingWorkstationEventArgs.cs b/Exiled.Events/EventArgs/Player/ActivatingWorkstationEventArgs.cs index 8a530dbeb0..db84492c0c 100644 --- a/Exiled.Events/EventArgs/Player/ActivatingWorkstationEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/ActivatingWorkstationEventArgs.cs @@ -16,21 +16,21 @@ namespace Exiled.Events.EventArgs.Player using static InventorySystem.Items.Firearms.Attachments.WorkstationController; /// - /// Contains all information before a player activates a workstation. + /// Contains all information before a player activates a workstation. /// public class ActivatingWorkstationEventArgs : IPlayerEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public ActivatingWorkstationEventArgs(Player player, WorkstationController controller, bool isAllowed = true) { @@ -40,22 +40,22 @@ public ActivatingWorkstationEventArgs(Player player, WorkstationController contr } /// - /// Gets the workstation. + /// Gets the workstation. /// public WorkstationController WorkstationController { get; } /// - /// Gets or sets the workstation status. + /// Gets or sets the workstation status. /// public WorkstationStatus NewStatus { get; set; } = WorkstationStatus.PoweringUp; /// - /// Gets or sets a value indicating whether or not the workstation can be activated. + /// Gets or sets a value indicating whether or not the workstation can be activated. /// public bool IsAllowed { get; set; } /// - /// Gets the player who's trying to activate the workstation. + /// Gets the player who's trying to activate the workstation. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Player/AimingDownSightEventArgs.cs b/Exiled.Events/EventArgs/Player/AimingDownSightEventArgs.cs index 7d3ceb4006..eebbae5a3a 100644 --- a/Exiled.Events/EventArgs/Player/AimingDownSightEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/AimingDownSightEventArgs.cs @@ -13,25 +13,25 @@ namespace Exiled.Events.EventArgs.Player using Interfaces; /// - /// Contains all information when a player aims. + /// Contains all information when a player aims. /// // TODO: remove stupid AdsIn/AdsOut propetry, and let exists only one public class AimingDownSightEventArgs : IPlayerEvent, IFirearmEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public AimingDownSightEventArgs(Player player, Firearm firearm, bool adsIn, bool adsOut) { @@ -42,17 +42,17 @@ public AimingDownSightEventArgs(Player player, Firearm firearm, bool adsIn, bool } /// - /// Gets a value indicating whether or not the player is aiming down sight in. + /// Gets a value indicating whether or not the player is aiming down sight in. /// public bool AdsIn { get; } /// - /// Gets a value indicating whether or not the player is aiming down sight out. + /// Gets a value indicating whether or not the player is aiming down sight out. /// public bool AdsOut { get; } /// - /// Gets the used to trigger the aim action. + /// Gets the used to trigger the aim action. /// public Firearm Firearm { get; } @@ -60,7 +60,7 @@ public AimingDownSightEventArgs(Player player, Firearm firearm, bool adsIn, bool public Item Item => Firearm; /// - /// Gets the player who's triggering the aim action. + /// Gets the player who's triggering the aim action. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Player/BannedEventArgs.cs b/Exiled.Events/EventArgs/Player/BannedEventArgs.cs index 8eb2a7f178..0d55acc865 100644 --- a/Exiled.Events/EventArgs/Player/BannedEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/BannedEventArgs.cs @@ -12,12 +12,12 @@ namespace Exiled.Events.EventArgs.Player using Interfaces; /// - /// Contains all information after banning a player from the server. + /// Contains all information after banning a player from the server. /// public class BannedEventArgs : IPlayerEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// /// @@ -34,27 +34,27 @@ public BannedEventArgs(Player target, Player issuer, BanDetails details, BanHand } /// - /// Gets the banned player. + /// Gets the banned player. /// public Player Target { get; } /// - /// Gets the issuer player. + /// Gets the issuer player. /// public Player Player { get; } /// - /// Gets the ban details. + /// Gets the ban details. /// public BanDetails Details { get; } /// - /// Gets the ban type. + /// Gets the ban type. /// public BanHandler.BanType Type { get; } /// - /// Gets a value indicating whether the ban is forced or not. + /// Gets a value indicating whether the ban is forced or not. /// public bool IsForced { get; } } diff --git a/Exiled.Events/EventArgs/Player/BanningEventArgs.cs b/Exiled.Events/EventArgs/Player/BanningEventArgs.cs index 3010f64841..235deea129 100644 --- a/Exiled.Events/EventArgs/Player/BanningEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/BanningEventArgs.cs @@ -12,14 +12,14 @@ namespace Exiled.Events.EventArgs.Player using API.Features; /// - /// Contains all information before banning a player from the server. + /// Contains all information before banning a player from the server. /// public class BanningEventArgs : KickingEventArgs { private long duration; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The ban target. /// The ban issuer. @@ -34,7 +34,7 @@ public BanningEventArgs(Player target, Player issuer, long duration, string reas } /// - /// Gets or sets the ban duration. + /// Gets or sets the ban duration. /// public long Duration { diff --git a/Exiled.Events/EventArgs/Player/CancelledItemUseEventArgs.cs b/Exiled.Events/EventArgs/Player/CancelledItemUseEventArgs.cs index a393d2dbe1..bd994bbca5 100644 --- a/Exiled.Events/EventArgs/Player/CancelledItemUseEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/CancelledItemUseEventArgs.cs @@ -12,16 +12,16 @@ namespace Exiled.Events.EventArgs.Player using Exiled.Events.EventArgs.Interfaces; /// - /// Contains all information before a player cancels usage of an item. + /// Contains all information before a player cancels usage of an item. /// public class CancelledItemUseEventArgs : IPlayerEvent, IUsableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The player who's stopping the use of an item. /// - /// + /// /// public CancelledItemUseEventArgs(Player player, Item item) { @@ -30,7 +30,7 @@ public CancelledItemUseEventArgs(Player player, Item item) } /// - /// Gets the item that the player cancelling. + /// Gets the item that the player cancelling. /// public Usable Usable { get; } @@ -38,7 +38,7 @@ public CancelledItemUseEventArgs(Player player, Item item) public Item Item => Usable; /// - /// Gets the player who cancelling the item. + /// Gets the player who cancelling the item. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Player/CancellingItemUseEventArgs.cs b/Exiled.Events/EventArgs/Player/CancellingItemUseEventArgs.cs index af94aaf95a..ac07393e72 100644 --- a/Exiled.Events/EventArgs/Player/CancellingItemUseEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/CancellingItemUseEventArgs.cs @@ -13,16 +13,16 @@ namespace Exiled.Events.EventArgs.Player using InventorySystem.Items.Usables; /// - /// Contains all information before a player cancels usage of an item. + /// Contains all information before a player cancels usage of an item. /// public class CancellingItemUseEventArgs : IPlayerEvent, IDeniableEvent, IUsableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The player who's stopping the use of an item. /// - /// + /// /// public CancellingItemUseEventArgs(Player player, UsableItem item) { @@ -31,7 +31,7 @@ public CancellingItemUseEventArgs(Player player, UsableItem item) } /// - /// Gets the item that the player cancelling. + /// Gets the item that the player cancelling. /// public Usable Usable { get; } @@ -39,12 +39,12 @@ public CancellingItemUseEventArgs(Player player, UsableItem item) public Item Item => Usable; /// - /// Gets the player who is cancelling the item. + /// Gets the player who is cancelling the item. /// public Player Player { get; } /// - /// Gets or sets a value indicating whether or not the player can cancelling the use of item. + /// Gets or sets a value indicating whether or not the player can cancelling the use of item. /// public bool IsAllowed { get; set; } = true; } diff --git a/Exiled.Events/EventArgs/Player/ChangedItemEventArgs.cs b/Exiled.Events/EventArgs/Player/ChangedItemEventArgs.cs index cda873d1be..50cd514e58 100644 --- a/Exiled.Events/EventArgs/Player/ChangedItemEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/ChangedItemEventArgs.cs @@ -17,18 +17,18 @@ namespace Exiled.Events.EventArgs.Player using InventorySystem.Items; /// - /// Contains all information after a player's held item changes. + /// Contains all information after a player's held item changes. /// public class ChangedItemEventArgs : IPlayerEvent, IItemEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// public ChangedItemEventArgs(Player player, ItemBase oldItem) { @@ -38,23 +38,23 @@ public ChangedItemEventArgs(Player player, ItemBase oldItem) } /// - /// Gets the previous item. + /// Gets the previous item. /// public Item OldItem { get; } /// - /// Gets the new item. + /// Gets the new item. /// [Obsolete("Use ev.Item instead of this")] public Item NewItem => Item; /// - /// Gets the new item. + /// Gets the new item. /// public Item Item { get; } /// - /// Gets the player who's changed the item. + /// Gets the player who's changed the item. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Player/ChangingGroupEventArgs.cs b/Exiled.Events/EventArgs/Player/ChangingGroupEventArgs.cs index 4783c1f5c0..13ecb5c99e 100644 --- a/Exiled.Events/EventArgs/Player/ChangingGroupEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/ChangingGroupEventArgs.cs @@ -17,16 +17,16 @@ namespace Exiled.Events.EventArgs.Player public class ChangingGroupEventArgs : IPlayerEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public ChangingGroupEventArgs(Player player, UserGroup newGroup, bool isAllowed = true) { @@ -36,17 +36,17 @@ public ChangingGroupEventArgs(Player player, UserGroup newGroup, bool isAllowed } /// - /// Gets or sets the player's new group. + /// Gets or sets the player's new group. /// public UserGroup NewGroup { get; set; } /// - /// Gets or sets a value indicating whether or not the player can change groups. + /// Gets or sets a value indicating whether or not the player can change groups. /// public bool IsAllowed { get; set; } /// - /// Gets the player who's changing his group. + /// Gets the player who's changing his group. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Player/ChangingIntercomMuteStatusEventArgs.cs b/Exiled.Events/EventArgs/Player/ChangingIntercomMuteStatusEventArgs.cs index fb1677847b..dab9f1a702 100644 --- a/Exiled.Events/EventArgs/Player/ChangingIntercomMuteStatusEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/ChangingIntercomMuteStatusEventArgs.cs @@ -11,21 +11,21 @@ namespace Exiled.Events.EventArgs.Player using Exiled.Events.EventArgs.Interfaces; /// - /// Contains all information before a player's intercom mute status is changed. + /// Contains all information before a player's intercom mute status is changed. /// public class ChangingIntercomMuteStatusEventArgs : IPlayerEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public ChangingIntercomMuteStatusEventArgs(Player player, bool isMuted, bool isAllowed = true) { @@ -35,17 +35,17 @@ public ChangingIntercomMuteStatusEventArgs(Player player, bool isMuted, bool isA } /// - /// Gets the player who's being intercom muted/unmuted. + /// Gets the player who's being intercom muted/unmuted. /// public Player Player { get; } /// - /// Gets a value indicating whether the player is being intercom muted or unmuted. + /// Gets a value indicating whether the player is being intercom muted or unmuted. /// public bool IsMuted { get; } /// - /// Gets or sets a value indicating whether or not the player can be intercom muted/unmuted. + /// Gets or sets a value indicating whether or not the player can be intercom muted/unmuted. /// public bool IsAllowed { get; set; } } diff --git a/Exiled.Events/EventArgs/Player/ChangingItemEventArgs.cs b/Exiled.Events/EventArgs/Player/ChangingItemEventArgs.cs index de2d78d049..403f5f7050 100644 --- a/Exiled.Events/EventArgs/Player/ChangingItemEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/ChangingItemEventArgs.cs @@ -17,20 +17,20 @@ namespace Exiled.Events.EventArgs.Player using InventorySystem.Items; /// - /// Contains all information before a player's held item changes. + /// Contains all information before a player's held item changes. /// public class ChangingItemEventArgs : IPlayerEvent, IDeniableEvent, IItemEvent { private Item newItem; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// public ChangingItemEventArgs(Player player, ItemBase newItem) { @@ -39,7 +39,7 @@ public ChangingItemEventArgs(Player player, ItemBase newItem) } /// - /// Gets or sets the new item. + /// Gets or sets the new item. /// public Item Item { @@ -54,12 +54,12 @@ public Item Item } /// - /// Gets or sets a value indicating whether the event is allowed to continue. + /// Gets or sets a value indicating whether the event is allowed to continue. /// public bool IsAllowed { get; set; } = true; /// - /// Gets the player who's changing the item. + /// Gets the player who's changing the item. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Player/ChangingMicroHIDStateEventArgs.cs b/Exiled.Events/EventArgs/Player/ChangingMicroHIDStateEventArgs.cs index f7e0679ecf..4cb941b0a1 100644 --- a/Exiled.Events/EventArgs/Player/ChangingMicroHIDStateEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/ChangingMicroHIDStateEventArgs.cs @@ -15,27 +15,27 @@ namespace Exiled.Events.EventArgs.Player using InventorySystem.Items.MicroHID; /// - /// Contains all information before MicroHID state is changed. + /// Contains all information before MicroHID state is changed. /// public class ChangingMicroHIDStateEventArgs : IPlayerEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public ChangingMicroHIDStateEventArgs(Player player, MicroHIDItem microHID, HidState oldState, HidState newState, bool isAllowed = true) { @@ -47,27 +47,27 @@ public ChangingMicroHIDStateEventArgs(Player player, MicroHIDItem microHID, HidS } /// - /// Gets the MicroHID instance. + /// Gets the MicroHID instance. /// public MicroHid MicroHID { get; } /// - /// Gets the old MicroHID state. + /// Gets the old MicroHID state. /// public HidState OldState { get; } /// - /// Gets or sets the new MicroHID state. + /// Gets or sets the new MicroHID state. /// public HidState NewState { get; set; } /// - /// Gets or sets a value indicating whether the MicroHID state can be changed or not. + /// Gets or sets a value indicating whether the MicroHID state can be changed or not. /// public bool IsAllowed { get; set; } /// - /// Gets the player who's using the MicroHID. + /// Gets the player who's using the MicroHID. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Player/ChangingMoveStateEventArgs.cs b/Exiled.Events/EventArgs/Player/ChangingMoveStateEventArgs.cs index 6bbcd0419b..1c55aa6aaf 100644 --- a/Exiled.Events/EventArgs/Player/ChangingMoveStateEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/ChangingMoveStateEventArgs.cs @@ -16,24 +16,24 @@ namespace Exiled.Events.EventArgs.Player using PlayerRoles.FirstPersonControl; /// - /// Contains all information before changing movement state. + /// Contains all information before changing movement state. /// public class ChangingMoveStateEventArgs : IPlayerEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public ChangingMoveStateEventArgs(Player player, PlayerMovementState oldState, PlayerMovementState newState, bool isAllowed = true) { @@ -45,17 +45,17 @@ public ChangingMoveStateEventArgs(Player player, PlayerMovementState oldState, P } /// - /// Gets the player who's changing the movement state. + /// Gets the player who's changing the movement state. /// public Player Player { get; } /// - /// Gets the old state. + /// Gets the old state. /// public PlayerMovementState OldState { get; } /// - /// Gets or sets the new state. + /// Gets or sets the new state. /// // TODO: remove setter public PlayerMovementState NewState @@ -66,7 +66,7 @@ public PlayerMovementState NewState } /// - /// Gets or sets a value indicating whether the player can change the movement state. + /// Gets or sets a value indicating whether the player can change the movement state. /// // TODO: remove [Obsolete("Property was removed due to desync problems.")] diff --git a/Exiled.Events/EventArgs/Player/ChangingMuteStatusEventArgs.cs b/Exiled.Events/EventArgs/Player/ChangingMuteStatusEventArgs.cs index b1ee372231..11904835a6 100644 --- a/Exiled.Events/EventArgs/Player/ChangingMuteStatusEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/ChangingMuteStatusEventArgs.cs @@ -11,21 +11,21 @@ namespace Exiled.Events.EventArgs.Player using Exiled.Events.EventArgs.Interfaces; /// - /// Contains all information before a player's mute status is changed. + /// Contains all information before a player's mute status is changed. /// public class ChangingMuteStatusEventArgs : IPlayerEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public ChangingMuteStatusEventArgs(Player player, bool isMuted, bool isAllowed = true) { @@ -35,17 +35,17 @@ public ChangingMuteStatusEventArgs(Player player, bool isMuted, bool isAllowed = } /// - /// Gets the player who's being muted/unmuted. + /// Gets the player who's being muted/unmuted. /// public Player Player { get; } /// - /// Gets a value indicating whether the player is being muted or unmuted. + /// Gets a value indicating whether the player is being muted or unmuted. /// public bool IsMuted { get; } /// - /// Gets or sets a value indicating whether or not the player can be muted/unmuted. + /// Gets or sets a value indicating whether or not the player can be muted/unmuted. /// public bool IsAllowed { get; set; } } diff --git a/Exiled.Events/EventArgs/Player/ChangingRadioPresetEventArgs.cs b/Exiled.Events/EventArgs/Player/ChangingRadioPresetEventArgs.cs index f2d97cb33c..651612a0ca 100644 --- a/Exiled.Events/EventArgs/Player/ChangingRadioPresetEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/ChangingRadioPresetEventArgs.cs @@ -16,24 +16,24 @@ namespace Exiled.Events.EventArgs.Player using static InventorySystem.Items.Radio.RadioMessages; /// - /// Contains all information before radio preset is changed. + /// Contains all information before radio preset is changed. /// public class ChangingRadioPresetEventArgs : IPlayerEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public ChangingRadioPresetEventArgs(Player player, RadioRangeLevel oldValue, RadioRangeLevel newValue, bool isAllowed = true) { @@ -44,24 +44,24 @@ public ChangingRadioPresetEventArgs(Player player, RadioRangeLevel oldValue, Rad } /// - /// Gets the old radio preset value. + /// Gets the old radio preset value. /// public RadioRange OldValue { get; } /// - /// Gets or sets the new radio preset value. - /// Client radio graphics won't sync with this value. + /// Gets or sets the new radio preset value. + /// Client radio graphics won't sync with this value. /// public RadioRange NewValue { get; set; } /// - /// Gets or sets a value indicating whether the radio preset can be changed or not. - /// Client radio graphics won't sync with . + /// Gets or sets a value indicating whether the radio preset can be changed or not. + /// Client radio graphics won't sync with . /// public bool IsAllowed { get; set; } /// - /// Gets the player who's using the radio. + /// Gets the player who's using the radio. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Player/ChangingRoleEventArgs.cs b/Exiled.Events/EventArgs/Player/ChangingRoleEventArgs.cs index d12d4e4363..552d70a73b 100644 --- a/Exiled.Events/EventArgs/Player/ChangingRoleEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/ChangingRoleEventArgs.cs @@ -19,26 +19,26 @@ namespace Exiled.Events.EventArgs.Player using PlayerRoles; /// - /// Contains all information before a player's changes. + /// Contains all information before a player's changes. /// public class ChangingRoleEventArgs : IPlayerEvent, IDeniableEvent { private RoleTypeId newRole; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public ChangingRoleEventArgs(Player player, RoleTypeId newRole, RoleChangeReason reason, RoleSpawnFlags spawnFlags) { @@ -58,12 +58,12 @@ public ChangingRoleEventArgs(Player player, RoleTypeId newRole, RoleChangeReason } /// - /// Gets the player whose is changing. + /// Gets the player whose is changing. /// public Player Player { get; } /// - /// Gets or sets the new player's role. + /// Gets or sets the new player's role. /// public RoleTypeId NewRole { @@ -87,17 +87,17 @@ public RoleTypeId NewRole } /// - /// Gets base items that the player will receive. + /// Gets base items that the player will receive. /// public List Items { get; } = ListPool.Pool.Get(); /// - /// Gets the base ammo values for the new role. + /// Gets the base ammo values for the new role. /// public Dictionary Ammo { get; } = DictionaryPool.Pool.Get(); /// - /// Gets or sets a value indicating whether the inventory will be preserved or not. + /// Gets or sets a value indicating whether the inventory will be preserved or not. /// public bool ShouldPreserveInventory { @@ -106,17 +106,17 @@ public bool ShouldPreserveInventory } /// - /// Gets or sets the reason for their class change. + /// Gets or sets the reason for their class change. /// public SpawnReason Reason { get; set; } /// - /// Gets or sets the spawn flags for their class change. + /// Gets or sets the spawn flags for their class change. /// public RoleSpawnFlags SpawnFlags { get; set; } /// - /// Gets or sets a value indicating whether the event can continue. + /// Gets or sets a value indicating whether the event can continue. /// public bool IsAllowed { get; set; } = true; } diff --git a/Exiled.Events/EventArgs/Player/ChangingSpectatedPlayerEventArgs.cs b/Exiled.Events/EventArgs/Player/ChangingSpectatedPlayerEventArgs.cs index 23f5fc2e04..dce1aff91b 100644 --- a/Exiled.Events/EventArgs/Player/ChangingSpectatedPlayerEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/ChangingSpectatedPlayerEventArgs.cs @@ -12,21 +12,21 @@ namespace Exiled.Events.EventArgs.Player using Interfaces; /// - /// Contains all information before a spectator changes the spectated player. + /// Contains all information before a spectator changes the spectated player. /// public class ChangingSpectatedPlayerEventArgs : IPlayerEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public ChangingSpectatedPlayerEventArgs(ReferenceHub player, uint oldTarget, uint newTarget) { @@ -36,17 +36,17 @@ public ChangingSpectatedPlayerEventArgs(ReferenceHub player, uint oldTarget, uin } /// - /// Gets player that was being spectated. + /// Gets player that was being spectated. /// public Player OldTarget { get; } /// - /// Gets the player who's going to be spectated. + /// Gets the player who's going to be spectated. /// public Player NewTarget { get; } /// - /// Gets player that is changing spectated player. + /// Gets player that is changing spectated player. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Player/ClosingGeneratorEventArgs.cs b/Exiled.Events/EventArgs/Player/ClosingGeneratorEventArgs.cs index a8340f7939..0adc72e3f8 100644 --- a/Exiled.Events/EventArgs/Player/ClosingGeneratorEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/ClosingGeneratorEventArgs.cs @@ -12,12 +12,12 @@ namespace Exiled.Events.EventArgs.Player using MapGeneration.Distributors; /// - /// Contains all information before a player closes a generator. + /// Contains all information before a player closes a generator. /// public class ClosingGeneratorEventArgs : IPlayerEvent, IDeniableEvent, IGeneratorEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The player who's closing the generator. /// The instance. @@ -30,17 +30,17 @@ public ClosingGeneratorEventArgs(Player player, Scp079Generator generator, bool } /// - /// Gets or sets a value indicating whether or not the generator door can be closed. + /// Gets or sets a value indicating whether or not the generator door can be closed. /// public bool IsAllowed { get; set; } /// - /// Gets the generator that is being closed. + /// Gets the generator that is being closed. /// public Generator Generator { get; } /// - /// Gets the player who's closing the generator door. + /// Gets the player who's closing the generator door. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Player/DamagingDoorEventArgs.cs b/Exiled.Events/EventArgs/Player/DamagingDoorEventArgs.cs index d875b83767..50926289dc 100644 --- a/Exiled.Events/EventArgs/Player/DamagingDoorEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/DamagingDoorEventArgs.cs @@ -12,19 +12,19 @@ namespace Exiled.Events.EventArgs.Player using Interfaces; /// - /// Contains all information before damage is dealt to a . + /// Contains all information before damage is dealt to a . /// public class DamagingDoorEventArgs : IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// The damage being dealt. /// - /// + /// /// public DamagingDoorEventArgs(DoorVariant door, float damage, DoorDamageType doorDamageType) { @@ -34,22 +34,22 @@ public DamagingDoorEventArgs(DoorVariant door, float damage, DoorDamageType door } /// - /// Gets the object that is damaged. + /// Gets the object that is damaged. /// public Door Door { get; } /// - /// Gets or sets the damage dealt to the door. + /// Gets or sets the damage dealt to the door. /// public float Damage { get; set; } /// - /// Gets or sets a value indicating whether the door can be broken. + /// Gets or sets a value indicating whether the door can be broken. /// public bool IsAllowed { get; set; } = true; /// - /// Gets the dealt to the door. + /// Gets the dealt to the door. /// public DoorDamageType DamageType { get; } } diff --git a/Exiled.Events/EventArgs/Player/DamagingShootingTargetEventArgs.cs b/Exiled.Events/EventArgs/Player/DamagingShootingTargetEventArgs.cs index 698a6cfa80..6bbd5cef07 100644 --- a/Exiled.Events/EventArgs/Player/DamagingShootingTargetEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/DamagingShootingTargetEventArgs.cs @@ -20,33 +20,33 @@ namespace Exiled.Events.EventArgs.Player using UnityEngine; /// - /// Contains all information before a player damages a shooting target. + /// Contains all information before a player damages a shooting target. /// public class DamagingShootingTargetEventArgs : IPlayerEvent, IDeniableEvent, IItemEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public DamagingShootingTargetEventArgs(Player player, float damage, float distance, Vector3 hitLocation, ShootingTarget shootingTarget, DamageHandlerBase damageHandler, bool isAllowed = true) { @@ -61,42 +61,42 @@ public DamagingShootingTargetEventArgs(Player player, float damage, float distan } /// - /// Gets the shooting target which is being damaged. + /// Gets the shooting target which is being damaged. /// public ShootingTargetToy ShootingTarget { get; } /// - /// Gets the . + /// Gets the . /// public AttackerDamageHandler DamageHandler { get; } /// - /// Gets the exact world location the bullet impacted the target. + /// Gets the exact world location the bullet impacted the target. /// public Vector3 HitLocation { get; } /// - /// Gets or sets the damage amount. + /// Gets or sets the damage amount. /// public float Amount { get; set; } /// - /// Gets or sets the distance between the shooter and the shooting target. + /// Gets or sets the distance between the shooter and the shooting target. /// public float Distance { get; set; } /// - /// Gets or sets a value indicating whether or not the target can be damaged. + /// Gets or sets a value indicating whether or not the target can be damaged. /// public bool IsAllowed { get; set; } /// - /// Gets the item which is being used to deal the damage. + /// Gets the item which is being used to deal the damage. /// public Item Item { get; } /// - /// Gets the player who's damaging the shooting target. + /// Gets the player who's damaging the shooting target. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Player/DamagingWindowEventArgs.cs b/Exiled.Events/EventArgs/Player/DamagingWindowEventArgs.cs index 4f92dcb6f3..48396f5016 100644 --- a/Exiled.Events/EventArgs/Player/DamagingWindowEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/DamagingWindowEventArgs.cs @@ -16,19 +16,19 @@ namespace Exiled.Events.EventArgs.Player using DamageHandlerBase = PlayerStatsSystem.DamageHandlerBase; /// - /// Contains all information before damage is dealt to a . + /// Contains all information before damage is dealt to a . /// public class DamagingWindowEventArgs : IPlayerEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// The damage being dealt. /// - /// + /// /// public DamagingWindowEventArgs(BreakableWindow window, float damage, DamageHandlerBase handler) { @@ -39,22 +39,22 @@ public DamagingWindowEventArgs(BreakableWindow window, float damage, DamageHandl } /// - /// Gets the object that is damaged. + /// Gets the object that is damaged. /// public Window Window { get; } /// - /// Gets or sets the damage handler for this event. + /// Gets or sets the damage handler for this event. /// public DamageHandler Handler { get; set; } /// - /// Gets or sets a value indicating whether the window can be broken. + /// Gets or sets a value indicating whether the window can be broken. /// public bool IsAllowed { get; set; } = true; /// - /// Gets the causing the damage. + /// Gets the causing the damage. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Player/DeactivatingWorkstationEventArgs.cs b/Exiled.Events/EventArgs/Player/DeactivatingWorkstationEventArgs.cs index abaafe51c4..fd8b0a281f 100644 --- a/Exiled.Events/EventArgs/Player/DeactivatingWorkstationEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/DeactivatingWorkstationEventArgs.cs @@ -16,18 +16,18 @@ namespace Exiled.Events.EventArgs.Player using static InventorySystem.Items.Firearms.Attachments.WorkstationController; /// - /// Contains all information before deactivating a workstation. + /// Contains all information before deactivating a workstation. /// public class DeactivatingWorkstationEventArgs : IPlayerEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// public DeactivatingWorkstationEventArgs(WorkstationController controller, bool isAllowed = true) { @@ -37,22 +37,22 @@ public DeactivatingWorkstationEventArgs(WorkstationController controller, bool i } /// - /// Gets the last user of the workstation. + /// Gets the last user of the workstation. /// public Player Player { get; } /// - /// Gets the workstation. + /// Gets the workstation. /// public WorkstationController WorkstationController { get; } /// - /// Gets or sets the workstation status. + /// Gets or sets the workstation status. /// public WorkstationStatus NewStatus { get; set; } = WorkstationStatus.PoweringDown; /// - /// Gets or sets a value indicating whether or not the workstation can be deactivated. + /// Gets or sets a value indicating whether or not the workstation can be deactivated. /// public bool IsAllowed { get; set; } } diff --git a/Exiled.Events/EventArgs/Player/DestroyingEventArgs.cs b/Exiled.Events/EventArgs/Player/DestroyingEventArgs.cs index 50a5722c2a..e633ab4913 100644 --- a/Exiled.Events/EventArgs/Player/DestroyingEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/DestroyingEventArgs.cs @@ -12,15 +12,15 @@ namespace Exiled.Events.EventArgs.Player using Interfaces; /// - /// Contains all information before a player's object is destroyed. + /// Contains all information before a player's object is destroyed. /// public class DestroyingEventArgs : IPlayerEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// public DestroyingEventArgs(Player player) { @@ -31,7 +31,7 @@ public DestroyingEventArgs(Player player) } /// - /// Gets the destroying player. + /// Gets the destroying player. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Player/DiedEventArgs.cs b/Exiled.Events/EventArgs/Player/DiedEventArgs.cs index 4ffee7af27..c6606c9b7a 100644 --- a/Exiled.Events/EventArgs/Player/DiedEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/DiedEventArgs.cs @@ -18,19 +18,19 @@ namespace Exiled.Events.EventArgs.Player using DamageHandlerBase = PlayerStatsSystem.DamageHandlerBase; /// - /// Contains all information after a player dies. + /// Contains all information after a player dies. /// public class DiedEventArgs : IPlayerEvent, IAttackerEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// Target's old . /// - /// + /// /// public DiedEventArgs(Player target, RoleTypeId targetOldRole, DamageHandlerBase damageHandler) { @@ -41,22 +41,22 @@ public DiedEventArgs(Player target, RoleTypeId targetOldRole, DamageHandlerBase } /// - /// Gets the old from the killed player. + /// Gets the old from the killed player. /// public RoleTypeId TargetOldRole { get; } /// - /// Gets the dead player. + /// Gets the dead player. /// public Player Player { get; } /// - /// Gets or sets the . + /// Gets or sets the . /// public CustomDamageHandler DamageHandler { get; set; } /// - /// Gets the attacker. + /// Gets the attacker. /// public Player Attacker { get; } } diff --git a/Exiled.Events/EventArgs/Player/DroppedAmmoEventArgs.cs b/Exiled.Events/EventArgs/Player/DroppedAmmoEventArgs.cs index 29a243fd77..68ffac1741 100644 --- a/Exiled.Events/EventArgs/Player/DroppedAmmoEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/DroppedAmmoEventArgs.cs @@ -17,24 +17,24 @@ namespace Exiled.Events.EventArgs.Player using AmmoPickup = API.Features.Pickups.AmmoPickup; /// - /// Contains all information after a player drops ammo. + /// Contains all information after a player drops ammo. /// public class DroppedAmmoEventArgs : IPlayerEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public DroppedAmmoEventArgs(Player player, AmmoType ammoType, ushort amount, List ammoPickups) { @@ -45,22 +45,22 @@ public DroppedAmmoEventArgs(Player player, AmmoType ammoType, ushort amount, Lis } /// - /// Gets the type of dropped ammo. + /// Gets the type of dropped ammo. /// public AmmoType AmmoType { get; } /// - /// Gets the amount of dropped ammo. + /// Gets the amount of dropped ammo. /// public ushort Amount { get; } /// - /// Gets the dropped ammo pickups. + /// Gets the dropped ammo pickups. /// public IEnumerable AmmoPickups { get; } /// - /// Gets the player who dropped the ammo. + /// Gets the player who dropped the ammo. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Player/DroppedItemEventArgs.cs b/Exiled.Events/EventArgs/Player/DroppedItemEventArgs.cs index 9f390afccb..14d298c843 100644 --- a/Exiled.Events/EventArgs/Player/DroppedItemEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/DroppedItemEventArgs.cs @@ -12,21 +12,21 @@ namespace Exiled.Events.EventArgs.Player using Interfaces; /// - /// Contains all information after a player drops an item. + /// Contains all information after a player drops an item. /// public class DroppedItemEventArgs : IPlayerEvent, IPickupEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public DroppedItemEventArgs(Player player, Pickup pickup, bool wasThrown) { @@ -36,7 +36,7 @@ public DroppedItemEventArgs(Player player, Pickup pickup, bool wasThrown) } /// - /// Gets or sets a value indicating whether or not the pickup was thrown. + /// Gets or sets a value indicating whether or not the pickup was thrown. /// public bool WasThrown { get; set; } diff --git a/Exiled.Events/EventArgs/Player/DroppingAmmoEventArgs.cs b/Exiled.Events/EventArgs/Player/DroppingAmmoEventArgs.cs index 1d8ab32978..3a0d0de97f 100644 --- a/Exiled.Events/EventArgs/Player/DroppingAmmoEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/DroppingAmmoEventArgs.cs @@ -15,26 +15,26 @@ namespace Exiled.Events.EventArgs.Player using PlayerRoles; /// - /// Contains all information before a player drops ammo. + /// Contains all information before a player drops ammo. /// public class DroppingAmmoEventArgs : IPlayerEvent, IDeniableEvent { private bool isAllowed = true; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public DroppingAmmoEventArgs(Player player, AmmoType ammoType, ushort amount, bool isAllowed = true) { @@ -45,17 +45,17 @@ public DroppingAmmoEventArgs(Player player, AmmoType ammoType, ushort amount, bo } /// - /// Gets the type of ammo being dropped. + /// Gets the type of ammo being dropped. /// public AmmoType AmmoType { get; } /// - /// Gets or sets the amount of ammo being dropped. + /// Gets or sets the amount of ammo being dropped. /// public ushort Amount { get; set; } /// - /// Gets or sets a value indicating whether or not the ammo can be dropped. + /// Gets or sets a value indicating whether or not the ammo can be dropped. /// public bool IsAllowed { @@ -75,7 +75,7 @@ public bool IsAllowed } /// - /// Gets the player who's dropping the ammo. + /// Gets the player who's dropping the ammo. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Player/DroppingItemEventArgs.cs b/Exiled.Events/EventArgs/Player/DroppingItemEventArgs.cs index 46bcd8dc2f..2173163e7d 100644 --- a/Exiled.Events/EventArgs/Player/DroppingItemEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/DroppingItemEventArgs.cs @@ -17,26 +17,26 @@ namespace Exiled.Events.EventArgs.Player using PlayerRoles; /// - /// Contains all information before a player drops an item. + /// Contains all information before a player drops an item. /// public class DroppingItemEventArgs : IPlayerEvent, IItemEvent, IDeniableEvent { private bool isAllowed = true; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public DroppingItemEventArgs(Player player, ItemBase item, bool isThrown, bool isAllowed = true) { @@ -47,12 +47,12 @@ public DroppingItemEventArgs(Player player, ItemBase item, bool isThrown, bool i } /// - /// Gets or sets a value indicating whether or not the item was thrown. + /// Gets or sets a value indicating whether or not the item was thrown. /// public bool IsThrown { get; set; } /// - /// Gets or sets a value indicating whether or not the item can be dropped. + /// Gets or sets a value indicating whether or not the item can be dropped. /// public bool IsAllowed { @@ -72,12 +72,12 @@ public bool IsAllowed } /// - /// Gets the item to be dropped. + /// Gets the item to be dropped. /// public Item Item { get; } /// - /// Gets the player who's dropping the item. + /// Gets the player who's dropping the item. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Player/DroppingNothingEventArgs.cs b/Exiled.Events/EventArgs/Player/DroppingNothingEventArgs.cs index d4d247c330..758e1578f6 100644 --- a/Exiled.Events/EventArgs/Player/DroppingNothingEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/DroppingNothingEventArgs.cs @@ -12,20 +12,20 @@ namespace Exiled.Events.EventArgs.Player using Interfaces; /// - /// Contains all information before a player drops a null item. + /// Contains all information before a player drops a null item. /// public class DroppingNothingEventArgs : IPlayerEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// public DroppingNothingEventArgs(Player player) => Player = player; /// - /// Gets the player who's dropping the null item. + /// Gets the player who's dropping the null item. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Player/DryfiringWeaponEventArgs.cs b/Exiled.Events/EventArgs/Player/DryfiringWeaponEventArgs.cs index 22e43885e5..85ba867333 100644 --- a/Exiled.Events/EventArgs/Player/DryfiringWeaponEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/DryfiringWeaponEventArgs.cs @@ -13,21 +13,21 @@ namespace Exiled.Events.EventArgs.Player using Interfaces; /// - /// Contains all information before a player's weapon is dryfired. + /// Contains all information before a player's weapon is dryfired. /// public class DryfiringWeaponEventArgs : IPlayerEvent, IFirearmEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public DryfiringWeaponEventArgs(Player player, Firearm firearm, bool isAllowed = true) { @@ -37,12 +37,12 @@ public DryfiringWeaponEventArgs(Player player, Firearm firearm, bool isAllowed = } /// - /// Gets or sets a value indicating whether or not the weapon can be dryfired. + /// Gets or sets a value indicating whether or not the weapon can be dryfired. /// public bool IsAllowed { get; set; } /// - /// Gets the being dryfired. + /// Gets the being dryfired. /// public Firearm Firearm { get; } @@ -50,7 +50,7 @@ public DryfiringWeaponEventArgs(Player player, Firearm firearm, bool isAllowed = public Item Item => Firearm; /// - /// Gets the player who's dryfiring the weapon. + /// Gets the player who's dryfiring the weapon. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Player/DyingEventArgs.cs b/Exiled.Events/EventArgs/Player/DyingEventArgs.cs index 5b6a29f220..1a96627e78 100644 --- a/Exiled.Events/EventArgs/Player/DyingEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/DyingEventArgs.cs @@ -21,18 +21,18 @@ namespace Exiled.Events.EventArgs.Player using DamageHandlerBase = PlayerStatsSystem.DamageHandlerBase; /// - /// Contains all information before a player dies. + /// Contains all information before a player dies. /// public class DyingEventArgs : IAttackerEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// public DyingEventArgs(Player target, DamageHandlerBase damageHandler) { @@ -45,7 +45,7 @@ public DyingEventArgs(Player target, DamageHandlerBase damageHandler) } /// - /// Gets or sets the list of items to be dropped. + /// Gets or sets the list of items to be dropped. /// public List ItemsToDrop { @@ -55,22 +55,22 @@ public List ItemsToDrop } /// - /// Gets the dying player. + /// Gets the dying player. /// public Player Player { get; } /// - /// Gets or sets the . + /// Gets or sets the . /// public CustomDamageHandler DamageHandler { get; set; } /// - /// Gets or sets a value indicating whether or not the player can be killed. + /// Gets or sets a value indicating whether or not the player can be killed. /// public bool IsAllowed { get; set; } = true; /// - /// Gets the killing player. + /// Gets the killing player. /// public Player Attacker { get; } } diff --git a/Exiled.Events/EventArgs/Player/EarningAchievementEventArgs.cs b/Exiled.Events/EventArgs/Player/EarningAchievementEventArgs.cs index c430077922..d44036193c 100644 --- a/Exiled.Events/EventArgs/Player/EarningAchievementEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/EarningAchievementEventArgs.cs @@ -12,21 +12,21 @@ namespace Exiled.Events.EventArgs.Player using Interfaces; /// - /// Contains all information before a player earns an achievement. + /// Contains all information before a player earns an achievement. /// public class EarningAchievementEventArgs : IPlayerEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public EarningAchievementEventArgs(Player player, AchievementName achievementName, bool isAllowed = true) { @@ -36,17 +36,17 @@ public EarningAchievementEventArgs(Player player, AchievementName achievementNam } /// - /// Gets the achievement that will be earned. + /// Gets the achievement that will be earned. /// public AchievementName AchievementName { get; } /// - /// Gets or sets a value indicating whether the achievement will be awarded to the player. + /// Gets or sets a value indicating whether the achievement will be awarded to the player. /// public bool IsAllowed { get; set; } /// - /// Gets the player who earned the achievement. + /// Gets the player who earned the achievement. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Player/EnteringPocketDimensionEventArgs.cs b/Exiled.Events/EventArgs/Player/EnteringPocketDimensionEventArgs.cs index cee8be4967..dc9aa207b6 100644 --- a/Exiled.Events/EventArgs/Player/EnteringPocketDimensionEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/EnteringPocketDimensionEventArgs.cs @@ -12,21 +12,21 @@ namespace Exiled.Events.EventArgs.Player using Interfaces; /// - /// Contains all information before a player enters the pocket dimension. + /// Contains all information before a player enters the pocket dimension. /// public class EnteringPocketDimensionEventArgs : IPlayerEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public EnteringPocketDimensionEventArgs(Player player, Player scp106, bool isAllowed = true) { @@ -36,17 +36,17 @@ public EnteringPocketDimensionEventArgs(Player player, Player scp106, bool isAll } /// - /// Gets the SCP-106 who sent the player to the pocket dimension. + /// Gets the SCP-106 who sent the player to the pocket dimension. /// public Player Scp106 { get; } /// - /// Gets or sets a value indicating whether or not the player can enter the pocket dimension. + /// Gets or sets a value indicating whether or not the player can enter the pocket dimension. /// public bool IsAllowed { get; set; } /// - /// Gets the player who's entering the pocket dimension. + /// Gets the player who's entering the pocket dimension. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Player/EscapingEventArgs.cs b/Exiled.Events/EventArgs/Player/EscapingEventArgs.cs index 3b92597ccb..109a744b12 100644 --- a/Exiled.Events/EventArgs/Player/EscapingEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/EscapingEventArgs.cs @@ -18,21 +18,21 @@ namespace Exiled.Events.EventArgs.Player using Respawning; /// - /// Contains all information before a player escapes. + /// Contains all information before a player escapes. /// public class EscapingEventArgs : IPlayerEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public EscapingEventArgs(Player player, RoleTypeId newRole, EscapeScenario escapeScenario) { @@ -43,19 +43,19 @@ public EscapingEventArgs(Player player, RoleTypeId newRole, EscapeScenario escap } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public EscapingEventArgs(Player player, RoleTypeId newRole, EscapeScenario escapeScenario, KeyValuePair respawnTickets) : this(player, newRole, escapeScenario) @@ -64,22 +64,22 @@ public EscapingEventArgs(Player player, RoleTypeId newRole, EscapeScenario escap } /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// A that will be initialized with. + /// A that will be initialized with. /// /// - /// A that will be initialized with. + /// A that will be initialized with. /// public EscapingEventArgs(Player player, RoleTypeId newRole, EscapeScenario escapeScenario, SpawnableTeamType teamToGrantTickets, float ticketsToGrant) : this(player, newRole, escapeScenario) @@ -89,28 +89,28 @@ public EscapingEventArgs(Player player, RoleTypeId newRole, EscapeScenario escap } /// - /// Gets the player who's escaping. + /// Gets the player who's escaping. /// public Player Player { get; } /// - /// Gets or sets the role that will be assigned when the player escapes. + /// Gets or sets the role that will be assigned when the player escapes. /// public RoleTypeId NewRole { get; set; } /// - /// Gets or sets the EscapeScenario that will represent for this player. + /// Gets or sets the EscapeScenario that will represent for this player. /// public EscapeScenario EscapeScenario { get; set; } /// - /// Gets or sets the RespawnTickets that will represent the amount of tickets granted to a specific after the player escapes. + /// Gets or sets the RespawnTickets that will represent the amount of tickets granted to a specific after the player escapes. /// /// public KeyValuePair RespawnTickets { get; set; } /// - /// Gets or sets a value indicating whether or not the player can escape. + /// Gets or sets a value indicating whether or not the player can escape. /// public bool IsAllowed { get; set; } } diff --git a/Exiled.Events/EventArgs/Player/EscapingPocketDimensionEventArgs.cs b/Exiled.Events/EventArgs/Player/EscapingPocketDimensionEventArgs.cs index 8fd13c0dc3..4848107a6c 100644 --- a/Exiled.Events/EventArgs/Player/EscapingPocketDimensionEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/EscapingPocketDimensionEventArgs.cs @@ -14,18 +14,18 @@ namespace Exiled.Events.EventArgs.Player using UnityEngine; /// - /// Contains all information before a player escapes the pocket dimension. + /// Contains all information before a player escapes the pocket dimension. /// public class EscapingPocketDimensionEventArgs : IPlayerEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// public EscapingPocketDimensionEventArgs(Player player, Vector3 position) { @@ -34,17 +34,17 @@ public EscapingPocketDimensionEventArgs(Player player, Vector3 position) } /// - /// Gets the player who's escaping the pocket dimension. + /// Gets the player who's escaping the pocket dimension. /// public Player Player { get; } /// - /// Gets or sets the position in which the player is going to be teleported to. + /// Gets or sets the position in which the player is going to be teleported to. /// public Vector3 TeleportPosition { get; set; } /// - /// Gets or sets a value indicating whether or not the player can successfully escape the pocket dimension. + /// Gets or sets a value indicating whether or not the player can successfully escape the pocket dimension. /// public bool IsAllowed { get; set; } = true; } diff --git a/Exiled.Events/EventArgs/Player/FailingEscapePocketDimensionEventArgs.cs b/Exiled.Events/EventArgs/Player/FailingEscapePocketDimensionEventArgs.cs index dbf8847097..602cf6fb6a 100644 --- a/Exiled.Events/EventArgs/Player/FailingEscapePocketDimensionEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/FailingEscapePocketDimensionEventArgs.cs @@ -12,21 +12,21 @@ namespace Exiled.Events.EventArgs.Player using Interfaces; /// - /// Contains all information before a player dies from walking through an incorrect exit in the pocket dimension. + /// Contains all information before a player dies from walking through an incorrect exit in the pocket dimension. /// public class FailingEscapePocketDimensionEventArgs : IPlayerEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public FailingEscapePocketDimensionEventArgs(Player player, PocketDimensionTeleport teleporter, bool isAllowed = true) { @@ -36,17 +36,17 @@ public FailingEscapePocketDimensionEventArgs(Player player, PocketDimensionTelep } /// - /// Gets the PocketDimensionTeleport the player walked into. + /// Gets the PocketDimensionTeleport the player walked into. /// public PocketDimensionTeleport Teleporter { get; } /// - /// Gets or sets a value indicating whether or not the player dies by failing the pocket dimension escape. + /// Gets or sets a value indicating whether or not the player dies by failing the pocket dimension escape. /// public bool IsAllowed { get; set; } /// - /// Gets the player who's escaping the pocket dimension. + /// Gets the player who's escaping the pocket dimension. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Player/FlippingCoinEventArgs.cs b/Exiled.Events/EventArgs/Player/FlippingCoinEventArgs.cs index 34afc7a8ef..7622d71b5e 100644 --- a/Exiled.Events/EventArgs/Player/FlippingCoinEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/FlippingCoinEventArgs.cs @@ -13,21 +13,21 @@ namespace Exiled.Events.EventArgs.Player using InventorySystem.Items.Coin; /// - /// Contains all information before a player flips a coin. + /// Contains all information before a player flips a coin. /// public class FlippingCoinEventArgs : IPlayerEvent, IDeniableEvent, IItemEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public FlippingCoinEventArgs(Player player, Coin coin, bool isTails) { @@ -37,7 +37,7 @@ public FlippingCoinEventArgs(Player player, Coin coin, bool isTails) } /// - /// Gets the player who's flipping the coin. + /// Gets the player who's flipping the coin. /// public Player Player { get; } @@ -45,12 +45,12 @@ public FlippingCoinEventArgs(Player player, Coin coin, bool isTails) public Item Item { get; } /// - /// Gets or sets a value indicating whether or not the coin is landing on tails. + /// Gets or sets a value indicating whether or not the coin is landing on tails. /// public bool IsTails { get; set; } /// - /// Gets or sets a value indicating whether or not the coin can be flipped. + /// Gets or sets a value indicating whether or not the coin can be flipped. /// public bool IsAllowed { get; set; } = true; } diff --git a/Exiled.Events/EventArgs/Player/HandcuffingEventArgs.cs b/Exiled.Events/EventArgs/Player/HandcuffingEventArgs.cs index 55902301fe..27a361cda2 100644 --- a/Exiled.Events/EventArgs/Player/HandcuffingEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/HandcuffingEventArgs.cs @@ -12,21 +12,21 @@ namespace Exiled.Events.EventArgs.Player using Interfaces; /// - /// Contains all information before handcuffing a player. + /// Contains all information before handcuffing a player. /// public class HandcuffingEventArgs : IPlayerEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public HandcuffingEventArgs(Player cuffer, Player target, bool isAllowed = true) { @@ -36,17 +36,17 @@ public HandcuffingEventArgs(Player cuffer, Player target, bool isAllowed = true) } /// - /// Gets the player who is getting cuffed. + /// Gets the player who is getting cuffed. /// public Player Target { get; } /// - /// Gets or sets a value indicating whether or not the player can be handcuffed. + /// Gets or sets a value indicating whether or not the player can be handcuffed. /// public bool IsAllowed { get; set; } /// - /// Gets the cuffer player. + /// Gets the cuffer player. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Player/HurtEventArgs.cs b/Exiled.Events/EventArgs/Player/HurtEventArgs.cs index 951254ea64..80cff1c51b 100644 --- a/Exiled.Events/EventArgs/Player/HurtEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/HurtEventArgs.cs @@ -16,21 +16,21 @@ namespace Exiled.Events.EventArgs.Player using DamageHandlerBase = PlayerStatsSystem.DamageHandlerBase; /// - /// Contains all information before a player gets damaged. + /// Contains all information before a player gets damaged. /// public class HurtEventArgs : IAttackerEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public HurtEventArgs(Player target, DamageHandlerBase damageHandler, DamageHandlerBase.HandlerOutput handlerOutput) { @@ -47,12 +47,12 @@ public HurtEventArgs(Player target, DamageHandlerBase damageHandler, DamageHandl public Player Attacker { get; } /// - /// Gets the amount of inflicted damage. + /// Gets the amount of inflicted damage. /// public float Amount => DamageHandler.Damage; /// - /// Gets or sets the action than will be made on the player. + /// Gets or sets the action than will be made on the player. /// public DamageHandlerBase.HandlerOutput HandlerOutput { get; set; } diff --git a/Exiled.Events/EventArgs/Player/HurtingEventArgs.cs b/Exiled.Events/EventArgs/Player/HurtingEventArgs.cs index 326d1ad09e..b5b8912ac3 100644 --- a/Exiled.Events/EventArgs/Player/HurtingEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/HurtingEventArgs.cs @@ -16,18 +16,18 @@ namespace Exiled.Events.EventArgs.Player using DamageHandlerBase = PlayerStatsSystem.DamageHandlerBase; /// - /// Contains all information before a player gets damaged. + /// Contains all information before a player gets damaged. /// public class HurtingEventArgs : IAttackerEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// public HurtingEventArgs(Player target, DamageHandlerBase damageHandler) { @@ -44,7 +44,7 @@ public HurtingEventArgs(Player target, DamageHandlerBase damageHandler) public Player Attacker { get; } /// - /// Gets or sets the amount of inflicted damage. + /// Gets or sets the amount of inflicted damage. /// public float Amount { diff --git a/Exiled.Events/EventArgs/Player/InteractedEventArgs.cs b/Exiled.Events/EventArgs/Player/InteractedEventArgs.cs index d39985d1d9..327d6dd8c7 100644 --- a/Exiled.Events/EventArgs/Player/InteractedEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/InteractedEventArgs.cs @@ -12,15 +12,15 @@ namespace Exiled.Events.EventArgs.Player using Interfaces; /// - /// Contains all information after a player has interacted with an interactable. + /// Contains all information after a player has interacted with an interactable. /// public class InteractedEventArgs : IPlayerEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// public InteractedEventArgs(Player player) { @@ -28,7 +28,7 @@ public InteractedEventArgs(Player player) } /// - /// Gets the player who interacted. + /// Gets the player who interacted. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Player/InteractingDoorEventArgs.cs b/Exiled.Events/EventArgs/Player/InteractingDoorEventArgs.cs index f5991e6111..d56c6c682c 100644 --- a/Exiled.Events/EventArgs/Player/InteractingDoorEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/InteractingDoorEventArgs.cs @@ -13,21 +13,21 @@ namespace Exiled.Events.EventArgs.Player using Interfaces; /// - /// Contains all information before a player interacts with a door. + /// Contains all information before a player interacts with a door. /// public class InteractingDoorEventArgs : IPlayerEvent, IDoorEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public InteractingDoorEventArgs(Player player, DoorVariant door, bool isAllowed = true) { @@ -37,17 +37,17 @@ public InteractingDoorEventArgs(Player player, DoorVariant door, bool isAllowed } /// - /// Gets or sets a value indicating whether or not the player can interact with the door. + /// Gets or sets a value indicating whether or not the player can interact with the door. /// public bool IsAllowed { get; set; } /// - /// Gets or sets the instance. + /// Gets or sets the instance. /// public Door Door { get; set; } /// - /// Gets the player who's interacting with the door. + /// Gets the player who's interacting with the door. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Player/InteractingElevatorEventArgs.cs b/Exiled.Events/EventArgs/Player/InteractingElevatorEventArgs.cs index ebd6138781..7df9b7476d 100644 --- a/Exiled.Events/EventArgs/Player/InteractingElevatorEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/InteractingElevatorEventArgs.cs @@ -15,21 +15,21 @@ namespace Exiled.Events.EventArgs.Player using Lift = API.Features.Lift; /// - /// Contains all information before a player interacts with an elevator. + /// Contains all information before a player interacts with an elevator. /// public class InteractingElevatorEventArgs : IPlayerEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public InteractingElevatorEventArgs(Player player, ElevatorChamber elevator, bool isAllowed = true) { @@ -40,22 +40,22 @@ public InteractingElevatorEventArgs(Player player, ElevatorChamber elevator, boo } /// - /// Gets the instance. + /// Gets the instance. /// public ElevatorChamber Elevator { get; } /// - /// Gets the instance. + /// Gets the instance. /// public Lift Lift { get; } /// - /// Gets or sets a value indicating whether or not the player can interact with the elevator. + /// Gets or sets a value indicating whether or not the player can interact with the elevator. /// public bool IsAllowed { get; set; } /// - /// Gets the player who's interacting with the elevator. + /// Gets the player who's interacting with the elevator. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Player/InteractingLockerEventArgs.cs b/Exiled.Events/EventArgs/Player/InteractingLockerEventArgs.cs index d07fbb8d37..2eec0c06b9 100644 --- a/Exiled.Events/EventArgs/Player/InteractingLockerEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/InteractingLockerEventArgs.cs @@ -14,27 +14,27 @@ namespace Exiled.Events.EventArgs.Player using MapGeneration.Distributors; /// - /// Contains all information before a player interacts with a locker. + /// Contains all information before a player interacts with a locker. /// public class InteractingLockerEventArgs : IPlayerEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public InteractingLockerEventArgs(Player player, Locker locker, LockerChamber lockerChamber, byte chamberId, bool isAllowed) { @@ -46,27 +46,27 @@ public InteractingLockerEventArgs(Player player, Locker locker, LockerChamber lo } /// - /// Gets the instance. + /// Gets the instance. /// public Locker Locker { get; } /// - /// Gets the interacting chamber. + /// Gets the interacting chamber. /// public LockerChamber Chamber { get; } /// - /// Gets the chamber id. + /// Gets the chamber id. /// public byte ChamberId { get; } /// - /// Gets or sets a value indicating whether or not the player can interact with the locker. + /// Gets or sets a value indicating whether or not the player can interact with the locker. /// public bool IsAllowed { get; set; } /// - /// Gets the player who's interacting with the locker. + /// Gets the player who's interacting with the locker. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Player/InteractingShootingTargetEventArgs.cs b/Exiled.Events/EventArgs/Player/InteractingShootingTargetEventArgs.cs index c7824474c7..6f42b451ef 100644 --- a/Exiled.Events/EventArgs/Player/InteractingShootingTargetEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/InteractingShootingTargetEventArgs.cs @@ -20,7 +20,7 @@ namespace Exiled.Events.EventArgs.Player using UnityEngine; /// - /// Contains all information before a player interacts with a shooting target. + /// Contains all information before a player interacts with a shooting target. /// public class InteractingShootingTargetEventArgs : IPlayerEvent, IDeniableEvent { @@ -28,25 +28,25 @@ public class InteractingShootingTargetEventArgs : IPlayerEvent, IDeniableEvent private int maxHp; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public InteractingShootingTargetEventArgs(Player player, ShootingTarget shootingTarget, ShootingTargetButton targetButton, int maxHp, int autoResetTime, bool isAllowed = true) { @@ -59,17 +59,17 @@ public InteractingShootingTargetEventArgs(Player player, ShootingTarget shooting } /// - /// Gets the shooting target being interacted with. + /// Gets the shooting target being interacted with. /// public ShootingTargetToy ShootingTarget { get; } /// - /// Gets the button the player interacted with. + /// Gets the button the player interacted with. /// public ShootingTargetButton TargetButton { get; } /// - /// Gets or sets the new max HP of the target. + /// Gets or sets the new max HP of the target. /// public int NewMaxHp { @@ -83,7 +83,7 @@ public int NewMaxHp } /// - /// Gets or sets the new auto reset time of the target. + /// Gets or sets the new auto reset time of the target. /// public int NewAutoResetTime { @@ -97,12 +97,12 @@ public int NewAutoResetTime } /// - /// Gets or sets a value indicating whether or not the interaction is allowed. + /// Gets or sets a value indicating whether or not the interaction is allowed. /// public bool IsAllowed { get; set; } /// - /// Gets the player interacting with the shooting target. + /// Gets the player interacting with the shooting target. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Player/IntercomSpeakingEventArgs.cs b/Exiled.Events/EventArgs/Player/IntercomSpeakingEventArgs.cs index d604e1d85f..49b605ac05 100644 --- a/Exiled.Events/EventArgs/Player/IntercomSpeakingEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/IntercomSpeakingEventArgs.cs @@ -12,18 +12,18 @@ namespace Exiled.Events.EventArgs.Player using Interfaces; /// - /// Contains all information before a player speaks to the intercom. + /// Contains all information before a player speaks to the intercom. /// public class IntercomSpeakingEventArgs : IPlayerEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// public IntercomSpeakingEventArgs(Player player, bool isAllowed = true) { @@ -32,12 +32,12 @@ public IntercomSpeakingEventArgs(Player player, bool isAllowed = true) } /// - /// Gets the player who's going to speak on the intercom. + /// Gets the player who's going to speak on the intercom. /// public Player Player { get; } /// - /// Gets or sets a value indicating whether or not the player can speak on the intercom. + /// Gets or sets a value indicating whether or not the player can speak on the intercom. /// public bool IsAllowed { get; set; } } diff --git a/Exiled.Events/EventArgs/Player/IssuingMuteEventArgs.cs b/Exiled.Events/EventArgs/Player/IssuingMuteEventArgs.cs index 3e4e909ff3..19cf623e14 100644 --- a/Exiled.Events/EventArgs/Player/IssuingMuteEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/IssuingMuteEventArgs.cs @@ -12,21 +12,21 @@ namespace Exiled.Events.EventArgs.Player using Interfaces; /// - /// Contains all information before muting a player. + /// Contains all information before muting a player. /// public class IssuingMuteEventArgs : IPlayerEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public IssuingMuteEventArgs(Player player, bool isIntercom, bool isAllowed = true) { @@ -36,17 +36,17 @@ public IssuingMuteEventArgs(Player player, bool isIntercom, bool isAllowed = tru } /// - /// Gets the player who's being muted. + /// Gets the player who's being muted. /// public Player Player { get; } /// - /// Gets or sets a value indicating whether the player is being intercom muted or not. + /// Gets or sets a value indicating whether the player is being intercom muted or not. /// public bool IsIntercom { get; set; } /// - /// Gets or sets a value indicating whether or not the player can be muted. + /// Gets or sets a value indicating whether or not the player can be muted. /// public bool IsAllowed { get; set; } } diff --git a/Exiled.Events/EventArgs/Player/JoinedEventArgs.cs b/Exiled.Events/EventArgs/Player/JoinedEventArgs.cs index c9af031343..03782dfd40 100644 --- a/Exiled.Events/EventArgs/Player/JoinedEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/JoinedEventArgs.cs @@ -12,20 +12,20 @@ namespace Exiled.Events.EventArgs.Player using Interfaces; /// - /// Contains all information after a player joins the server. + /// Contains all information after a player joins the server. /// public class JoinedEventArgs : IPlayerEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// public JoinedEventArgs(Player player) => Player = player; /// - /// Gets the joined player. + /// Gets the joined player. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Player/JumpingEventArgs.cs b/Exiled.Events/EventArgs/Player/JumpingEventArgs.cs index c03b5234a1..7717acc0b9 100644 --- a/Exiled.Events/EventArgs/Player/JumpingEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/JumpingEventArgs.cs @@ -14,21 +14,21 @@ namespace Exiled.Events.EventArgs.Player using UnityEngine; /// - /// Contains all information before a player jumps. + /// Contains all information before a player jumps. /// public class JumpingEventArgs : IPlayerEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public JumpingEventArgs(Player player, Vector3 direction, bool isAllowed = true) { @@ -38,17 +38,17 @@ public JumpingEventArgs(Player player, Vector3 direction, bool isAllowed = true) } /// - /// Gets the player who's jumping. + /// Gets the player who's jumping. /// public Player Player { get; } /// - /// Gets or sets the jump direction. + /// Gets or sets the jump direction. /// public Vector3 Direction { get; set; } /// - /// Gets or sets the jump speed. + /// Gets or sets the jump speed. /// public float Speed { @@ -57,7 +57,7 @@ public float Speed } /// - /// Gets or sets a value indicating whether the client data can be synchronized with the server. + /// Gets or sets a value indicating whether the client data can be synchronized with the server. /// public bool IsAllowed { get; set; } } diff --git a/Exiled.Events/EventArgs/Player/KickedEventArgs.cs b/Exiled.Events/EventArgs/Player/KickedEventArgs.cs index b14e0f51be..bf7f0c3be0 100644 --- a/Exiled.Events/EventArgs/Player/KickedEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/KickedEventArgs.cs @@ -12,18 +12,18 @@ namespace Exiled.Events.EventArgs.Player using Interfaces; /// - /// Contains all information after kicking a player from the server. + /// Contains all information after kicking a player from the server. /// public class KickedEventArgs : IPlayerEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// public KickedEventArgs(Player target, string reason) { @@ -32,12 +32,12 @@ public KickedEventArgs(Player target, string reason) } /// - /// Gets the kick reason. + /// Gets the kick reason. /// public string Reason { get; } /// - /// Gets the kicked player. + /// Gets the kicked player. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Player/KickingEventArgs.cs b/Exiled.Events/EventArgs/Player/KickingEventArgs.cs index 6489761640..595ae16947 100644 --- a/Exiled.Events/EventArgs/Player/KickingEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/KickingEventArgs.cs @@ -16,7 +16,7 @@ namespace Exiled.Events.EventArgs.Player using Interfaces; /// - /// Contains all information before kicking a player from the server. + /// Contains all information before kicking a player from the server. /// public class KickingEventArgs : IPlayerEvent, IDeniableEvent { @@ -26,22 +26,22 @@ public class KickingEventArgs : IPlayerEvent, IDeniableEvent private Player target; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public KickingEventArgs(Player target, Player issuer, string reason, string fullMessage, bool isAllowed = true) { @@ -53,7 +53,7 @@ public KickingEventArgs(Player target, Player issuer, string reason, string full } /// - /// Gets or sets the ban target. + /// Gets or sets the ban target. /// public Player Target { @@ -71,12 +71,12 @@ public Player Target } /// - /// Gets or sets the kick reason. + /// Gets or sets the kick reason. /// public string Reason { get; set; } /// - /// Gets or sets the full kick message. + /// Gets or sets the full kick message. /// public string FullMessage { @@ -86,7 +86,7 @@ public string FullMessage } /// - /// Gets or sets a value indicating whether or not action is taken against the target. + /// Gets or sets a value indicating whether or not action is taken against the target. /// public bool IsAllowed { @@ -104,7 +104,7 @@ public bool IsAllowed } /// - /// Gets or sets the ban issuer. + /// Gets or sets the ban issuer. /// public Player Player { @@ -122,7 +122,7 @@ public Player Player } /// - /// Logs the kick, anti-backdoor protection from malicious plugins. + /// Logs the kick, anti-backdoor protection from malicious plugins. /// /// The name of the calling assembly. /// The message to be logged. diff --git a/Exiled.Events/EventArgs/Player/LandingEventArgs.cs b/Exiled.Events/EventArgs/Player/LandingEventArgs.cs index 61b2d8312c..6c980591b2 100644 --- a/Exiled.Events/EventArgs/Player/LandingEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/LandingEventArgs.cs @@ -12,20 +12,20 @@ namespace Exiled.Events.EventArgs.Player using Interfaces; /// - /// Contains all the information after a lands on the ground. + /// Contains all the information after a lands on the ground. /// public class LandingEventArgs : IPlayerEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// public LandingEventArgs(Player player) => Player = player; /// - /// Gets the who's landing. + /// Gets the who's landing. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Player/LocalReportingEventArgs.cs b/Exiled.Events/EventArgs/Player/LocalReportingEventArgs.cs index 0ee4adecde..316be50391 100644 --- a/Exiled.Events/EventArgs/Player/LocalReportingEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/LocalReportingEventArgs.cs @@ -12,24 +12,24 @@ namespace Exiled.Events.EventArgs.Player using Interfaces; /// - /// Contains information before a report is sent to local administrators. + /// Contains information before a report is sent to local administrators. /// public class LocalReportingEventArgs : IPlayerEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public LocalReportingEventArgs(Player issuer, Player target, string reason, bool isAllowed = true) { @@ -40,22 +40,22 @@ public LocalReportingEventArgs(Player issuer, Player target, string reason, bool } /// - /// Gets the reported player. + /// Gets the reported player. /// public Player Target { get; } /// - /// Gets or sets the report reason. + /// Gets or sets the report reason. /// public string Reason { get; set; } /// - /// Gets or sets a value indicating whether the report can be processed or not. + /// Gets or sets a value indicating whether the report can be processed or not. /// public bool IsAllowed { get; set; } /// - /// Gets the reporter. + /// Gets the reporter. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Player/MakingNoiseEventArgs.cs b/Exiled.Events/EventArgs/Player/MakingNoiseEventArgs.cs index e3f6a50b5c..eb7809255f 100644 --- a/Exiled.Events/EventArgs/Player/MakingNoiseEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/MakingNoiseEventArgs.cs @@ -12,7 +12,7 @@ namespace Exiled.Events.EventArgs.Player using Interfaces; /// - /// Contains all information before a player makes noise. + /// Contains all information before a player makes noise. /// public class MakingNoiseEventArgs : IPlayerEvent, IDeniableEvent { @@ -30,12 +30,12 @@ public MakingNoiseEventArgs(Player player, float distance, bool isAllowed = true } /// - /// Gets the player who's making noise. + /// Gets the player who's making noise. /// public Player Player { get; } /// - /// Gets or sets the footsteps distance. + /// Gets or sets the footsteps distance. /// public float Distance { get; set; } diff --git a/Exiled.Events/EventArgs/Player/OpeningGeneratorEventArgs.cs b/Exiled.Events/EventArgs/Player/OpeningGeneratorEventArgs.cs index cf24e48dc6..d208132426 100644 --- a/Exiled.Events/EventArgs/Player/OpeningGeneratorEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/OpeningGeneratorEventArgs.cs @@ -14,21 +14,21 @@ namespace Exiled.Events.EventArgs.Player using MapGeneration.Distributors; /// - /// Contains all information before a player opens a generator. + /// Contains all information before a player opens a generator. /// public class OpeningGeneratorEventArgs : IPlayerEvent, IDeniableEvent, IGeneratorEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public OpeningGeneratorEventArgs(Player player, Scp079Generator generator, bool isAllowed = true) { @@ -38,17 +38,17 @@ public OpeningGeneratorEventArgs(Player player, Scp079Generator generator, bool } /// - /// Gets or sets a value indicating whether or not the generator can be opened. + /// Gets or sets a value indicating whether or not the generator can be opened. /// public bool IsAllowed { get; set; } /// - /// Gets the generator that is opening. + /// Gets the generator that is opening. /// public Generator Generator { get; } /// - /// Gets the player who's opening the generator. + /// Gets the player who's opening the generator. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Player/PickingUpItemEventArgs.cs b/Exiled.Events/EventArgs/Player/PickingUpItemEventArgs.cs index 2d7ace6ff3..200536dd47 100644 --- a/Exiled.Events/EventArgs/Player/PickingUpItemEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/PickingUpItemEventArgs.cs @@ -14,21 +14,21 @@ namespace Exiled.Events.EventArgs.Player using InventorySystem.Items.Pickups; /// - /// Contains all information before a player picks up an item. + /// Contains all information before a player picks up an item. /// public class PickingUpItemEventArgs : IPlayerEvent, IPickupEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public PickingUpItemEventArgs(Player player, ItemPickupBase pickup, bool isAllowed = true) { @@ -38,17 +38,17 @@ public PickingUpItemEventArgs(Player player, ItemPickupBase pickup, bool isAllow } /// - /// Gets or sets a value indicating whether the item can be picked up. + /// Gets or sets a value indicating whether the item can be picked up. /// public bool IsAllowed { get; set; } /// - /// Gets the pickup that's being picked up. + /// Gets the pickup that's being picked up. /// public Pickup Pickup { get; } /// - /// Gets the player who's picking up an item. + /// Gets the player who's picking up an item. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Player/PreAuthenticatingEventArgs.cs b/Exiled.Events/EventArgs/Player/PreAuthenticatingEventArgs.cs index 8fa938b769..0b10296f2a 100644 --- a/Exiled.Events/EventArgs/Player/PreAuthenticatingEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/PreAuthenticatingEventArgs.cs @@ -23,7 +23,7 @@ namespace Exiled.Events.EventArgs.Player #pragma warning disable CS1591 /// - /// Contains all information before pre-authenticating a player. + /// Contains all information before pre-authenticating a player. /// public class PreAuthenticatingEventArgs : IExiledEvent { @@ -61,47 +61,47 @@ public PreAuthenticatingEventArgs( } /// - /// Gets the player's user id. + /// Gets the player's user id. /// public string UserId { get; } /// - /// Gets the player's IP address. + /// Gets the player's IP address. /// public string IpAddress { get; } /// - /// Gets the request's expiration. + /// Gets the request's expiration. /// public long Expiration { get; } /// - /// Gets the flags. + /// Gets the flags. /// public CentralAuthPreauthFlags Flags { get; } /// - /// Gets the player's country. + /// Gets the player's country. /// public string Country { get; } /// - /// Gets the request's signature. + /// Gets the request's signature. /// public byte[] Signature { get; } /// - /// Gets the reader starting position for reading the preauth. + /// Gets the reader starting position for reading the preauth. /// public int ReaderStartPosition { get; } /// - /// Gets the connection request. + /// Gets the connection request. /// public ConnectionRequest Request { get; } /// - /// Gets a value indicating whether the player can be authenticated or not. + /// Gets a value indicating whether the player can be authenticated or not. /// public bool IsAllowed { get; private set; } = true; @@ -170,7 +170,7 @@ public void Reject(RejectionReason reason, bool isForced) => /* /// - /// Delays the connection. + /// Delays the connection. /// /// The delay in seconds. /// Indicates whether the player has to be rejected forcefully or not. @@ -183,14 +183,14 @@ public void Delay(byte seconds, bool isForced) } /// - /// Rejects the player and redirects them to another server port. + /// Rejects the player and redirects them to another server port. /// /// The new server port. /// Indicates whether the player has to be rejected forcefully or not. public void Redirect(ushort port, bool isForced) => Reject(RejectionReason.Redirect, isForced, null, 0, 0, port); /// - /// Rejects a player who's trying to authenticate. + /// Rejects a player who's trying to authenticate. /// /// The ban reason. /// The ban expiration time. @@ -198,7 +198,7 @@ public void Delay(byte seconds, bool isForced) public void RejectBanned(string banReason, DateTime expiration, bool isForced) => Reject(RejectionReason.Banned, isForced, banReason, expiration.Ticks); /// - /// Rejects a player who's trying to authenticate. + /// Rejects a player who's trying to authenticate. /// /// The ban reason. /// The ban expiration time in .NET Ticks. @@ -206,7 +206,7 @@ public void Delay(byte seconds, bool isForced) public void RejectBanned(string banReason, long expiration, bool isForced) => Reject(RejectionReason.Banned, isForced, banReason, expiration); /// - /// Rejects a player who's trying to authenticate. + /// Rejects a player who's trying to authenticate. /// /// The instance. /// Indicates whether the player has to be rejected forcefully or not. @@ -224,14 +224,14 @@ public void Reject(NetDataWriter writer, bool isForced) } /// - /// Rejects a player who's trying to authenticate. + /// Rejects a player who's trying to authenticate. /// /// The custom rejection reason. /// Indicates whether the player has to be rejected forcefully or not. public void Reject(string rejectionReason, bool isForced) => Reject(RejectionReason.Custom, isForced, rejectionReason); /// - /// Rejects a player who's trying to authenticate. + /// Rejects a player who's trying to authenticate. /// /// The rejection reason. /// Indicates whether the player has to be rejected forcefully or not. @@ -280,8 +280,8 @@ public void Reject(RejectionReason rejectionReason, bool isForced, string custom } /// - /// Disallows the connection without sending any reason. Should only be used when the connection has already been - /// terminated by the plugin itself. + /// Disallows the connection without sending any reason. Should only be used when the connection has already been + /// terminated by the plugin itself. /// public void Disallow() => IsAllowed = false; */ diff --git a/Exiled.Events/EventArgs/Player/ReceivingEffectEventArgs.cs b/Exiled.Events/EventArgs/Player/ReceivingEffectEventArgs.cs index 5e8d565715..696f4ff0c1 100644 --- a/Exiled.Events/EventArgs/Player/ReceivingEffectEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/ReceivingEffectEventArgs.cs @@ -14,14 +14,14 @@ namespace Exiled.Events.EventArgs.Player using Interfaces; /// - /// Contains all information before a player receives a . + /// Contains all information before a player receives a . /// public class ReceivingEffectEventArgs : IPlayerEvent, IDeniableEvent { private byte intensity; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// /// @@ -38,23 +38,23 @@ public ReceivingEffectEventArgs(Player player, StatusEffectBase effect, byte int } /// - /// Gets the receiving the effect. + /// Gets the receiving the effect. /// public Player Player { get; } /// - /// Gets the being received. + /// Gets the being received. /// public StatusEffectBase Effect { get; } /// - /// Gets or sets a value indicating how long the effect will last. If its value is 0, then it doesn't always reflect the real effect duration. + /// Gets or sets a value indicating how long the effect will last. If its value is 0, then it doesn't always reflect the real effect duration. /// public float Duration { get; set; } = 0; /// - /// Gets or sets the value of the new intensity of the effect. Setting this to 0 is the same as setting IsAllowed to - /// . + /// Gets or sets the value of the new intensity of the effect. Setting this to 0 is the same as setting IsAllowed to + /// . /// public byte Intensity { @@ -69,12 +69,12 @@ public byte Intensity } /// - /// Gets the value of the intensity of this effect on the player. + /// Gets the value of the intensity of this effect on the player. /// public byte CurrentIntensity { get; } /// - /// Gets or sets a value indicating whether or not the effect will be applied. + /// Gets or sets a value indicating whether or not the effect will be applied. /// public bool IsAllowed { get; set; } = true; } diff --git a/Exiled.Events/EventArgs/Player/ReloadingWeaponEventArgs.cs b/Exiled.Events/EventArgs/Player/ReloadingWeaponEventArgs.cs index b3caa7bb8d..3fa8ba3ecb 100644 --- a/Exiled.Events/EventArgs/Player/ReloadingWeaponEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/ReloadingWeaponEventArgs.cs @@ -13,21 +13,21 @@ namespace Exiled.Events.EventArgs.Player using Interfaces; /// - /// Contains all information before a player's weapon is reloaded. + /// Contains all information before a player's weapon is reloaded. /// public class ReloadingWeaponEventArgs : IPlayerEvent, IFirearmEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public ReloadingWeaponEventArgs(Player player, Firearm firearm, bool isAllowed = true) { @@ -37,12 +37,12 @@ public ReloadingWeaponEventArgs(Player player, Firearm firearm, bool isAllowed = } /// - /// Gets or sets a value indicating whether or not the weapon can be reloaded. + /// Gets or sets a value indicating whether or not the weapon can be reloaded. /// public bool IsAllowed { get; set; } /// - /// Gets the being reloaded. + /// Gets the being reloaded. /// public Firearm Firearm { get; } @@ -50,7 +50,7 @@ public ReloadingWeaponEventArgs(Player player, Firearm firearm, bool isAllowed = public Item Item => Firearm; /// - /// Gets the player who's reloading the weapon. + /// Gets the player who's reloading the weapon. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Player/RemovingHandcuffsEventArgs.cs b/Exiled.Events/EventArgs/Player/RemovingHandcuffsEventArgs.cs index 8fe8c6861d..c6a90a8355 100644 --- a/Exiled.Events/EventArgs/Player/RemovingHandcuffsEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/RemovingHandcuffsEventArgs.cs @@ -11,12 +11,12 @@ namespace Exiled.Events.EventArgs.Player using Exiled.Events.EventArgs.Interfaces; /// - /// Contains all information before freeing a handcuffed player. + /// Contains all information before freeing a handcuffed player. /// public class RemovingHandcuffsEventArgs : IPlayerEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The cuffer player. /// The target player to be uncuffed. @@ -29,17 +29,17 @@ public RemovingHandcuffsEventArgs(Player cuffer, Player target, bool isAllowed = } /// - /// Gets the target player to be cuffed. + /// Gets the target player to be cuffed. /// public Player Target { get; } /// - /// Gets or sets a value indicating whether or not the player can be handcuffed. + /// Gets or sets a value indicating whether or not the player can be handcuffed. /// public bool IsAllowed { get; set; } /// - /// Gets the cuffer player. + /// Gets the cuffer player. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Player/ReservedSlotsCheckEventArgs.cs b/Exiled.Events/EventArgs/Player/ReservedSlotsCheckEventArgs.cs index cba5f7905f..db722959bd 100644 --- a/Exiled.Events/EventArgs/Player/ReservedSlotsCheckEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/ReservedSlotsCheckEventArgs.cs @@ -11,18 +11,18 @@ namespace Exiled.Events.EventArgs.Player using Exiled.Events.EventArgs.Interfaces; /// - /// Contains all information when checking if a player has a reserved slot. + /// Contains all information when checking if a player has a reserved slot. /// public class ReservedSlotsCheckEventArgs : IExiledEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// public ReservedSlotsCheckEventArgs(string userId, bool hasReservedSlot) { @@ -31,17 +31,17 @@ public ReservedSlotsCheckEventArgs(string userId, bool hasReservedSlot) } /// - /// Gets the UserID of the player that is being checked. + /// Gets the UserID of the player that is being checked. /// public string UserId { get; } /// - /// Gets a value indicating whether the player has a reserved slot in the base game system. + /// Gets a value indicating whether the player has a reserved slot in the base game system. /// public bool HasReservedSlot { get; } /// - /// Gets or sets the event result. + /// Gets or sets the event result. /// public ReservedSlotEventResult Result { get; set; } = ReservedSlotEventResult.UseBaseGameSystem; } diff --git a/Exiled.Events/EventArgs/Player/RevokingMuteEventArgs.cs b/Exiled.Events/EventArgs/Player/RevokingMuteEventArgs.cs index 6c7bc09c99..52dd71aef8 100644 --- a/Exiled.Events/EventArgs/Player/RevokingMuteEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/RevokingMuteEventArgs.cs @@ -10,12 +10,12 @@ namespace Exiled.Events.EventArgs.Player using API.Features; /// - /// Contains all information before unmuting a player. + /// Contains all information before unmuting a player. /// public class RevokingMuteEventArgs : IssuingMuteEventArgs { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// /// The player who's being unmuted. diff --git a/Exiled.Events/EventArgs/Player/SearchingPickupEventArgs.cs b/Exiled.Events/EventArgs/Player/SearchingPickupEventArgs.cs index b12aec67c5..6d2366364d 100644 --- a/Exiled.Events/EventArgs/Player/SearchingPickupEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/SearchingPickupEventArgs.cs @@ -15,27 +15,27 @@ namespace Exiled.Events.EventArgs.Player using InventorySystem.Searching; /// - /// Contains all information before a player searches a Pickup. + /// Contains all information before a player searches a Pickup. /// public class SearchingPickupEventArgs : IPlayerEvent, IPickupEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public SearchingPickupEventArgs(Player player, ItemPickupBase pickup, SearchSession searchSession, SearchCompletor searchCompletor, float searchTime) { @@ -48,32 +48,32 @@ public SearchingPickupEventArgs(Player player, ItemPickupBase pickup, SearchSess } /// - /// Gets or sets the SearchSession. + /// Gets or sets the SearchSession. /// public SearchSession SearchSession { get; set; } /// - /// Gets or sets the SearchCompletor. + /// Gets or sets the SearchCompletor. /// public SearchCompletor SearchCompletor { get; set; } /// - /// Gets or sets the Pickup search duration. + /// Gets or sets the Pickup search duration. /// public float SearchTime { get; set; } /// - /// Gets or sets a value indicating whether the Pickup can be searched. + /// Gets or sets a value indicating whether the Pickup can be searched. /// public bool IsAllowed { get; set; } /// - /// Gets the Pickup that is being searched. + /// Gets the Pickup that is being searched. /// public Pickup Pickup { get; } /// - /// Gets the Player who's searching the Pickup. + /// Gets the Player who's searching the Pickup. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Player/SendingAdminChatMessageEventsArgs.cs b/Exiled.Events/EventArgs/Player/SendingAdminChatMessageEventsArgs.cs index 4ff21132d7..ba65b6d791 100644 --- a/Exiled.Events/EventArgs/Player/SendingAdminChatMessageEventsArgs.cs +++ b/Exiled.Events/EventArgs/Player/SendingAdminChatMessageEventsArgs.cs @@ -15,21 +15,21 @@ namespace Exiled.Events.EventArgs.Player using InventorySystem.Searching; /// - /// Contains all information before a player sends a message in AdminChat. + /// Contains all information before a player sends a message in AdminChat. /// public class SendingAdminChatMessageEventsArgs : IPlayerEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public SendingAdminChatMessageEventsArgs(Player player, string message, bool isAllowed) { @@ -39,17 +39,17 @@ public SendingAdminChatMessageEventsArgs(Player player, string message, bool isA } /// - /// Gets or sets a value indicating whether the pickup can be searched. + /// Gets or sets a value indicating whether the pickup can be searched. /// public bool IsAllowed { get; set; } /// - /// Gets or sets the message which is being sent. + /// Gets or sets the message which is being sent. /// public string Message { get; set; } /// - /// Gets the player who's sending the message. + /// Gets the player who's sending the message. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Player/ShootingEventArgs.cs b/Exiled.Events/EventArgs/Player/ShootingEventArgs.cs index 6aa51b108e..9802b83304 100644 --- a/Exiled.Events/EventArgs/Player/ShootingEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/ShootingEventArgs.cs @@ -19,37 +19,39 @@ namespace Exiled.Events.EventArgs.Player using UnityEngine; + using BaseFirearm = InventorySystem.Items.Firearms.Firearm; + /// - /// Contains all information before a player fires a weapon. + /// Contains all information before a player fires a weapon. /// public class ShootingEventArgs : IPlayerEvent, IDeniableEvent, IFirearmEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// - public ShootingEventArgs(Player shooter, Firearm firearm, ShotMessage msg) + public ShootingEventArgs(Player shooter, BaseFirearm firearm, ShotMessage msg) { Player = shooter; - Firearm = firearm; + Firearm = Item.Get(firearm).As(); ShotMessage = msg; } /// - /// Gets the player who's shooting. + /// Gets the player who's shooting. /// public Player Player { get; } /// - /// Gets the target . + /// Gets the target . /// public Firearm Firearm { get; } @@ -57,12 +59,12 @@ public ShootingEventArgs(Player shooter, Firearm firearm, ShotMessage msg) public Item Item => Firearm; /// - /// Gets or sets the for the event. + /// Gets or sets the for the event. /// public ShotMessage ShotMessage { get; set; } /// - /// Gets or sets the position of the shot. + /// Gets or sets the position of the shot. /// public Vector3 ShotPosition { @@ -83,7 +85,7 @@ public Vector3 ShotPosition } /// - /// Gets or sets the netId of the target of the shot. + /// Gets or sets the netId of the target of the shot. /// public uint TargetNetId { @@ -104,7 +106,7 @@ public uint TargetNetId } /// - /// Gets or sets a value indicating whether or not the shot can be fired. + /// Gets or sets a value indicating whether or not the shot can be fired. /// public bool IsAllowed { get; set; } = true; } diff --git a/Exiled.Events/EventArgs/Player/ShotEventArgs.cs b/Exiled.Events/EventArgs/Player/ShotEventArgs.cs index c659a793ee..288d3c3f72 100644 --- a/Exiled.Events/EventArgs/Player/ShotEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/ShotEventArgs.cs @@ -14,25 +14,25 @@ namespace Exiled.Events.EventArgs.Player using UnityEngine; /// - /// Contains all information after a player has fired a weapon. + /// Contains all information after a player has fired a weapon. /// public class ShotEventArgs : IPlayerEvent, IFirearmEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// The hit. /// - /// + /// /// /// - /// + /// /// public ShotEventArgs(Player shooter, Firearm firearm, RaycastHit hit, IDestructible destructible, float damage) { @@ -51,12 +51,12 @@ public ShotEventArgs(Player shooter, Firearm firearm, RaycastHit hit, IDestructi } /// - /// Gets the player who shot. + /// Gets the player who shot. /// public Player Player { get; } /// - /// Gets the firearm used to shoot. + /// Gets the firearm used to shoot. /// public Firearm Firearm { get; } @@ -64,37 +64,37 @@ public ShotEventArgs(Player shooter, Firearm firearm, RaycastHit hit, IDestructi public Item Item => Firearm; /// - /// Gets the hitbox type of the shot. Can be !. + /// Gets the hitbox type of the shot. Can be !. /// public HitboxIdentity Hitbox { get; } /// - /// Gets or sets the inflicted damage. + /// Gets or sets the inflicted damage. /// public float Damage { get; set; } /// - /// Gets the shot distance. + /// Gets the shot distance. /// public float Distance { get; } /// - /// Gets the shot position. + /// Gets the shot position. /// public Vector3 Position { get; } /// - /// Gets the raycast result. + /// Gets the raycast result. /// public RaycastHit RaycastHit { get; } /// - /// Gets the target of the shot. Can be !. + /// Gets the target of the shot. Can be !. /// public Player Target { get; } /// - /// Gets or sets a value indicating whether or not the shot can hurt the target. + /// Gets or sets a value indicating whether or not the shot can hurt the target. /// public bool CanHurt { get; set; } = true; } diff --git a/Exiled.Events/EventArgs/Player/SpawnedEventArgs.cs b/Exiled.Events/EventArgs/Player/SpawnedEventArgs.cs index 268d57796b..094b5406a3 100644 --- a/Exiled.Events/EventArgs/Player/SpawnedEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/SpawnedEventArgs.cs @@ -16,12 +16,12 @@ namespace Exiled.Events.EventArgs.Player using PlayerRoles; /// - /// Contains all information after spawning a player. + /// Contains all information after spawning a player. /// public class SpawnedEventArgs : IPlayerEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// the spawned player. /// the spawned player's old role. @@ -34,22 +34,22 @@ public SpawnedEventArgs(Player player, PlayerRoleBase oldRole) } /// - /// Gets the who spawned. + /// Gets the who spawned. /// public Player Player { get; } /// - /// Gets the player's old role. + /// Gets the player's old role. /// public Role OldRole { get; } /// - /// Gets the reason for their class change. + /// Gets the reason for their class change. /// public SpawnReason Reason { get; } /// - /// Gets the spawn flags for their class change. + /// Gets the spawn flags for their class change. /// public RoleSpawnFlags SpawnFlags { get; } } diff --git a/Exiled.Events/EventArgs/Player/SpawnedRagdollEventArgs.cs b/Exiled.Events/EventArgs/Player/SpawnedRagdollEventArgs.cs index 768cd868e3..497d25e9e2 100644 --- a/Exiled.Events/EventArgs/Player/SpawnedRagdollEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/SpawnedRagdollEventArgs.cs @@ -18,24 +18,24 @@ namespace Exiled.Events.EventArgs.Player using UnityEngine; /// - /// Contains all information after spawning a player ragdoll. + /// Contains all information after spawning a player ragdoll. /// public class SpawnedRagdollEventArgs : IPlayerEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public SpawnedRagdollEventArgs(Player player, Ragdoll ragdoll, RagdollData info, DamageHandlerBase damageHandlerBase) { @@ -46,47 +46,47 @@ public SpawnedRagdollEventArgs(Player player, Ragdoll ragdoll, RagdollData info, } /// - /// Gets the ragdoll's position. + /// Gets the ragdoll's position. /// public Vector3 Position => Info.StartPosition; /// - /// Gets the ragdoll's rotation. + /// Gets the ragdoll's rotation. /// public Quaternion Rotation => Info.StartRotation; /// - /// Gets the ragdoll's . + /// Gets the ragdoll's . /// public RoleTypeId Role => Info.RoleType; /// - /// Gets the ragdoll's creation time. + /// Gets the ragdoll's creation time. /// public double CreationTime => Info.CreationTime; /// - /// Gets the ragdoll's nickname. + /// Gets the ragdoll's nickname. /// public string Nickname => Info.Nickname; /// - /// Gets the ragdoll's . + /// Gets the ragdoll's . /// public RagdollData Info { get; } /// - /// Gets the ragdoll's . + /// Gets the ragdoll's . /// public DamageHandlerBase DamageHandlerBase { get; } /// - /// Gets the spawned . + /// Gets the spawned . /// public Ragdoll Ragdoll { get; } /// - /// Gets the Owner of the ragdoll. + /// Gets the Owner of the ragdoll. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Player/SpawningEventArgs.cs b/Exiled.Events/EventArgs/Player/SpawningEventArgs.cs index 82a59251d9..ab972e705c 100644 --- a/Exiled.Events/EventArgs/Player/SpawningEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/SpawningEventArgs.cs @@ -15,24 +15,24 @@ namespace Exiled.Events.EventArgs.Player using UnityEngine; /// - /// Contains all information before spawning a player. + /// Contains all information before spawning a player. /// public class SpawningEventArgs : IPlayerEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// the spawned player's old role. + /// the spawned player's old role. /// public SpawningEventArgs(Player player, Vector3 position, float rotation, PlayerRoleBase oldRole) { @@ -43,28 +43,28 @@ public SpawningEventArgs(Player player, Vector3 position, float rotation, Player } /// - /// Gets the spawning . + /// Gets the spawning . /// public Player Player { get; } /// - /// Gets or sets the 's spawning position. + /// Gets or sets the 's spawning position. /// /// - /// Position will apply only for . + /// Position will apply only for . /// public Vector3 Position { get; set; } /// - /// Gets or sets the 's spawning rotation. + /// Gets or sets the 's spawning rotation. /// /// - /// Rotation will apply only for . + /// Rotation will apply only for . /// public float HorizontalRotation { get; set; } /// - /// Gets the player's old role. + /// Gets the player's old role. /// public Role OldRole { get; } } diff --git a/Exiled.Events/EventArgs/Player/SpawningRagdollEventArgs.cs b/Exiled.Events/EventArgs/Player/SpawningRagdollEventArgs.cs index 59a60fda54..13e7f25bcf 100644 --- a/Exiled.Events/EventArgs/Player/SpawningRagdollEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/SpawningRagdollEventArgs.cs @@ -18,21 +18,21 @@ namespace Exiled.Events.EventArgs.Player using UnityEngine; /// - /// Contains all information before spawning a player ragdoll. + /// Contains all information before spawning a player ragdoll. /// public class SpawningRagdollEventArgs : IPlayerEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public SpawningRagdollEventArgs(RagdollData info, DamageHandlerBase damageHandlerBase, bool isAllowed = true) { @@ -44,7 +44,7 @@ public SpawningRagdollEventArgs(RagdollData info, DamageHandlerBase damageHandle } /// - /// Gets or sets the spawning position of the ragdoll. + /// Gets or sets the spawning position of the ragdoll. /// public Vector3 Position { @@ -53,7 +53,7 @@ public Vector3 Position } /// - /// Gets or sets the ragdoll's rotation. + /// Gets or sets the ragdoll's rotation. /// public Quaternion Rotation { @@ -62,12 +62,12 @@ public Quaternion Rotation } /// - /// Gets or sets the ragdoll's scale. + /// Gets or sets the ragdoll's scale. /// public Vector3 Scale { get; set; } /// - /// Gets or sets the ragdoll's . + /// Gets or sets the ragdoll's . /// public RoleTypeId Role { @@ -76,12 +76,12 @@ public RoleTypeId Role } /// - /// Gets the ragdoll's creation time. + /// Gets the ragdoll's creation time. /// public double CreationTime => Info.CreationTime; /// - /// Gets or sets the ragdoll's nickname. + /// Gets or sets the ragdoll's nickname. /// public string Nickname { @@ -90,22 +90,22 @@ public string Nickname } /// - /// Gets or sets the ragdoll's . + /// Gets or sets the ragdoll's . /// public RagdollData Info { get; set; } /// - /// Gets or sets the ragdoll's . + /// Gets or sets the ragdoll's . /// public DamageHandlerBase DamageHandlerBase { get; set; } /// - /// Gets or sets a value indicating whether or not the ragdoll can be spawned. + /// Gets or sets a value indicating whether or not the ragdoll can be spawned. /// public bool IsAllowed { get; set; } /// - /// Gets the Owner of the ragdoll. + /// Gets the Owner of the ragdoll. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Player/StoppingGeneratorEventArgs.cs b/Exiled.Events/EventArgs/Player/StoppingGeneratorEventArgs.cs index c96bde94f6..addeb79ad1 100644 --- a/Exiled.Events/EventArgs/Player/StoppingGeneratorEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/StoppingGeneratorEventArgs.cs @@ -12,12 +12,12 @@ namespace Exiled.Events.EventArgs.Player using MapGeneration.Distributors; /// - /// Contains all information before a player turns off a generator. + /// Contains all information before a player turns off a generator. /// public class StoppingGeneratorEventArgs : IPlayerEvent, IGeneratorEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The player who's flipping the switch. /// The instance. @@ -30,17 +30,17 @@ public StoppingGeneratorEventArgs(Player player, Scp079Generator generator, bool } /// - /// Gets or sets a value indicating whether or not the switch can be flipped. + /// Gets or sets a value indicating whether or not the switch can be flipped. /// public bool IsAllowed { get; set; } /// - /// Gets the instance. + /// Gets the instance. /// public Generator Generator { get; } /// - /// Gets the player who's filpping the switch of the generator. + /// Gets the player who's filpping the switch of the generator. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Player/TogglingFlashlightEventArgs.cs b/Exiled.Events/EventArgs/Player/TogglingFlashlightEventArgs.cs index 167d85c689..b8990f85d7 100644 --- a/Exiled.Events/EventArgs/Player/TogglingFlashlightEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/TogglingFlashlightEventArgs.cs @@ -14,23 +14,23 @@ namespace Exiled.Events.EventArgs.Player using InventorySystem.Items.ToggleableLights; /// - /// Contains all information before a player toggles a flashlight. + /// Contains all information before a player toggles a flashlight. /// public class TogglingFlashlightEventArgs : IPlayerEvent, IDeniableEvent, IItemEvent { private readonly bool initialState; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public TogglingFlashlightEventArgs(ReferenceHub hub, ToggleableLightItemBase flashlight, bool newState) { @@ -41,7 +41,7 @@ public TogglingFlashlightEventArgs(ReferenceHub hub, ToggleableLightItemBase fla } /// - /// Gets the being toggled. + /// Gets the being toggled. /// public Flashlight Flashlight { get; } @@ -49,12 +49,12 @@ public TogglingFlashlightEventArgs(ReferenceHub hub, ToggleableLightItemBase fla public Item Item => Flashlight; /// - /// Gets or sets a value indicating whether or not the flashlight should be on. + /// Gets or sets a value indicating whether or not the flashlight should be on. /// public bool NewState { get; set; } /// - /// Gets or sets a value indicating whether or not the player can toggle the flashlight. + /// Gets or sets a value indicating whether or not the player can toggle the flashlight. /// public bool IsAllowed { @@ -63,7 +63,7 @@ public bool IsAllowed } /// - /// Gets the player who's toggling the flashlight. + /// Gets the player who's toggling the flashlight. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Player/TogglingNoClipEventArgs.cs b/Exiled.Events/EventArgs/Player/TogglingNoClipEventArgs.cs index c1921f28e4..ee1b858d83 100644 --- a/Exiled.Events/EventArgs/Player/TogglingNoClipEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/TogglingNoClipEventArgs.cs @@ -12,21 +12,21 @@ namespace Exiled.Events.EventArgs.Player using Interfaces; /// - /// Contains all information before a player toggles noclip. + /// Contains all information before a player toggles noclip. /// public class TogglingNoClipEventArgs : IPlayerEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public TogglingNoClipEventArgs(Player player, bool newValue, bool isAllowed = true) { @@ -36,17 +36,17 @@ public TogglingNoClipEventArgs(Player player, bool newValue, bool isAllowed = tr } /// - /// Gets the player who's toggling noclip. + /// Gets the player who's toggling noclip. /// public Player Player { get; } /// - /// Gets or sets a value indicating whether or not the noclip mode will be enabled or not. + /// Gets or sets a value indicating whether or not the noclip mode will be enabled or not. /// public bool IsEnabled { get; set; } /// - /// Gets or sets a value indicating whether or not the player can toggle noclip. + /// Gets or sets a value indicating whether or not the player can toggle noclip. /// public bool IsAllowed { get; set; } } diff --git a/Exiled.Events/EventArgs/Player/TogglingRadioEventArgs.cs b/Exiled.Events/EventArgs/Player/TogglingRadioEventArgs.cs new file mode 100644 index 0000000000..67db545055 --- /dev/null +++ b/Exiled.Events/EventArgs/Player/TogglingRadioEventArgs.cs @@ -0,0 +1,67 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Events.EventArgs.Player +{ + using API.Features; + + using Exiled.API.Features.Items; + using Interfaces; + using InventorySystem.Items.Radio; + + /// + /// Contains all information before toggling a radio. + /// + public class TogglingRadioEventArgs : IPlayerEvent, IDeniableEvent, IItemEvent + { + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public TogglingRadioEventArgs(Player player, RadioItem radio, bool newState, bool isAllowed = true) + { + Player = player; + Radio = (Radio)Item.Get(radio); + NewState = newState; + IsAllowed = isAllowed; + } + + /// + /// Gets the which is being used. + /// + public Radio Radio { get; } + + /// + public Item Item => Radio; + + /// + /// Gets a value indicating whether the radio is being turned on or off. + /// + public bool NewState { get; } + + /// + /// Gets or sets a value indicating whether the radio can be turned on or off. + /// + public bool IsAllowed { get; set; } + + /// + /// Gets the player who's using the radio. + /// + public Player Player { get; } + } +} diff --git a/Exiled.Events/EventArgs/Player/TogglingWeaponFlashlightEventArgs.cs b/Exiled.Events/EventArgs/Player/TogglingWeaponFlashlightEventArgs.cs index e697ed79e4..1335fe0bb9 100644 --- a/Exiled.Events/EventArgs/Player/TogglingWeaponFlashlightEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/TogglingWeaponFlashlightEventArgs.cs @@ -13,24 +13,24 @@ namespace Exiled.Events.EventArgs.Player using Interfaces; /// - /// Contains all information before a player toggles the weapon's flashlight. + /// Contains all information before a player toggles the weapon's flashlight. /// public class TogglingWeaponFlashlightEventArgs : IPlayerEvent, IFirearmEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public TogglingWeaponFlashlightEventArgs(Player player, Firearm firearm, bool newState, bool isAllowed = true) { @@ -41,17 +41,17 @@ public TogglingWeaponFlashlightEventArgs(Player player, Firearm firearm, bool ne } /// - /// Gets or sets a value indicating whether the new weapon's flashlight state will be enabled. + /// Gets or sets a value indicating whether the new weapon's flashlight state will be enabled. /// public bool NewState { get; set; } /// - /// Gets or sets a value indicating whether or not the weapon's flashlight can be toggled. + /// Gets or sets a value indicating whether or not the weapon's flashlight can be toggled. /// public bool IsAllowed { get; set; } /// - /// Gets the being held. + /// Gets the being held. /// public Firearm Firearm { get; } @@ -59,7 +59,7 @@ public TogglingWeaponFlashlightEventArgs(Player player, Firearm firearm, bool ne public Item Item => Firearm; /// - /// Gets the player who's toggling the weapon's flashlight. + /// Gets the player who's toggling the weapon's flashlight. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Player/TransmittingEventArgs.cs b/Exiled.Events/EventArgs/Player/TransmittingEventArgs.cs index f1f421539c..3a1b3617c2 100644 --- a/Exiled.Events/EventArgs/Player/TransmittingEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/TransmittingEventArgs.cs @@ -7,52 +7,56 @@ namespace Exiled.Events.EventArgs.Player { + using System; + using Exiled.API.Features; using Exiled.Events.EventArgs.Interfaces; using PlayerRoles.Voice; - using VoiceChat; - /// - /// Contains all information regarding the player using the radio. + /// Contains all information regarding the player using the radio. /// public class TransmittingEventArgs : IPlayerEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// + /// + /// + /// /// - public TransmittingEventArgs(Player player, VoiceModuleBase voiceModule) + public TransmittingEventArgs(Player player, VoiceModuleBase voiceModule, bool isAllowed = true) { Player = player; VoiceModule = voiceModule; - IsTransmitting = voiceModule == null ? false : voiceModule.ServerIsSending && voiceModule.CurrentChannel == VoiceChatChannel.Radio; + IsAllowed = isAllowed; } /// - /// Gets the player who's transmitting. + /// Gets the player who's transmitting. /// public Player Player { get; } /// - /// Gets the 's . + /// Gets the 's . /// public VoiceModuleBase VoiceModule { get; } /// - /// Gets a value indicating whether or not the player is transmitting. + /// Gets a value indicating whether or not the player is transmitting. /// - public bool IsTransmitting { get; } + [Obsolete("IsTransmitting is always true.")] + public bool IsTransmitting => true; /// - /// Gets or sets a value indicating whether or not the player can transmit. + /// Gets or sets a value indicating whether or not the player can transmit. /// - public bool IsAllowed { get; set; } = true; + public bool IsAllowed { get; set; } } } \ No newline at end of file diff --git a/Exiled.Events/EventArgs/Player/TriggeringTeslaEventArgs.cs b/Exiled.Events/EventArgs/Player/TriggeringTeslaEventArgs.cs index 26cb1d11f3..ad71df8d1e 100644 --- a/Exiled.Events/EventArgs/Player/TriggeringTeslaEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/TriggeringTeslaEventArgs.cs @@ -12,18 +12,18 @@ namespace Exiled.Events.EventArgs.Player using Interfaces; /// - /// Contains all information before triggering a tesla. + /// Contains all information before triggering a tesla. /// public class TriggeringTeslaEventArgs : IPlayerEvent, ITeslaEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// public TriggeringTeslaEventArgs(Player player, TeslaGate teslaGate) { @@ -34,37 +34,37 @@ public TriggeringTeslaEventArgs(Player player, TeslaGate teslaGate) } /// - /// Gets or sets a value indicating whether or not the player is in hurting range. + /// Gets or sets a value indicating whether or not the player is in hurting range. /// public bool IsInHurtingRange { get; set; } /// - /// Gets or sets a value indicating whether or not the player will cause the tesla going to be idle. + /// Gets or sets a value indicating whether or not the player will cause the tesla going to be idle. /// public bool IsInIdleRange { get; set; } = true; /// - /// Gets or sets a value indicating whether or not the player will cause the tesla going to be activated. + /// Gets or sets a value indicating whether or not the player will cause the tesla going to be activated. /// public bool IsTriggerable { get; set; } /// - /// Gets the player who triggered the tesla. + /// Gets the player who triggered the tesla. /// public Player Player { get; } /// - /// Gets the Tesla. + /// Gets the Tesla. /// public TeslaGate Tesla { get; } /// - /// Gets or sets a value indicating whether or not the player will be detected by the tesla. + /// Gets or sets a value indicating whether or not the player will be detected by the tesla. /// public bool IsAllowed { get; set; } = true; /// - /// Gets or sets a value indicating whether or not the tesla will be deactivated. + /// Gets or sets a value indicating whether or not the tesla will be deactivated. /// public bool DisableTesla { get; set; } } diff --git a/Exiled.Events/EventArgs/Player/UnloadingWeaponEventArgs.cs b/Exiled.Events/EventArgs/Player/UnloadingWeaponEventArgs.cs index 213f15adba..c16b1131f0 100644 --- a/Exiled.Events/EventArgs/Player/UnloadingWeaponEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/UnloadingWeaponEventArgs.cs @@ -13,21 +13,21 @@ namespace Exiled.Events.EventArgs.Player using Interfaces; /// - /// Contains all information before a player's weapon is unloaded. + /// Contains all information before a player's weapon is unloaded. /// public class UnloadingWeaponEventArgs : IPlayerEvent, IFirearmEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public UnloadingWeaponEventArgs(Player player, Firearm firearm, bool isAllowed = true) { @@ -37,12 +37,12 @@ public UnloadingWeaponEventArgs(Player player, Firearm firearm, bool isAllowed = } /// - /// Gets or sets a value indicating whether or not the weapon can be unloaded. + /// Gets or sets a value indicating whether or not the weapon can be unloaded. /// public bool IsAllowed { get; set; } /// - /// Gets the being unloaded. + /// Gets the being unloaded. /// public Firearm Firearm { get; } @@ -50,7 +50,7 @@ public UnloadingWeaponEventArgs(Player player, Firearm firearm, bool isAllowed = public Item Item => Firearm; /// - /// Gets the player who's unloading the weapon. + /// Gets the player who's unloading the weapon. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Player/UnlockingGeneratorEventArgs.cs b/Exiled.Events/EventArgs/Player/UnlockingGeneratorEventArgs.cs index e0a3b01bfb..5a42e30140 100644 --- a/Exiled.Events/EventArgs/Player/UnlockingGeneratorEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/UnlockingGeneratorEventArgs.cs @@ -14,21 +14,21 @@ namespace Exiled.Events.EventArgs.Player using MapGeneration.Distributors; /// - /// Contains all information before a generator is unlocked. + /// Contains all information before a generator is unlocked. /// public class UnlockingGeneratorEventArgs : IPlayerEvent, IGeneratorEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public UnlockingGeneratorEventArgs(Player player, Scp079Generator generator, bool isAllowed = true) { @@ -38,17 +38,17 @@ public UnlockingGeneratorEventArgs(Player player, Scp079Generator generator, boo } /// - /// Gets or sets a value indicating whether or not the generator can be unlocked. + /// Gets or sets a value indicating whether or not the generator can be unlocked. /// public bool IsAllowed { get; set; } /// - /// Gets the generator that is going to be unlocked. + /// Gets the generator that is going to be unlocked. /// public Generator Generator { get; } /// - /// Gets the player who's unlocking the generator. + /// Gets the player who's unlocking the generator. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Player/UsedItemEventArgs.cs b/Exiled.Events/EventArgs/Player/UsedItemEventArgs.cs index 333037c8d8..2618d4a5db 100644 --- a/Exiled.Events/EventArgs/Player/UsedItemEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/UsedItemEventArgs.cs @@ -15,18 +15,18 @@ namespace Exiled.Events.EventArgs.Player using InventorySystem.Items.Usables; /// - /// Contains all information after a player used an item. + /// Contains all information after a player used an item. /// public class UsedItemEventArgs : IPlayerEvent, IUsableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// public UsedItemEventArgs(ReferenceHub player, UsableItem item) { @@ -35,7 +35,7 @@ public UsedItemEventArgs(ReferenceHub player, UsableItem item) } /// - /// Gets the item that the player used. + /// Gets the item that the player used. /// public Usable Usable { get; } @@ -43,7 +43,7 @@ public UsedItemEventArgs(ReferenceHub player, UsableItem item) public Item Item => Usable; /// - /// Gets the player who used the item. + /// Gets the player who used the item. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Player/UsingItemCompletedEventArgs.cs b/Exiled.Events/EventArgs/Player/UsingItemCompletedEventArgs.cs index 00198760e8..a0f86dd041 100644 --- a/Exiled.Events/EventArgs/Player/UsingItemCompletedEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/UsingItemCompletedEventArgs.cs @@ -14,16 +14,16 @@ namespace Exiled.Events.EventArgs.Player using InventorySystem.Items.Usables; /// - /// Contains all information before a player uses an item. + /// Contains all information before a player uses an item. /// public class UsingItemCompletedEventArgs : IPlayerEvent, IDeniableEvent, IUsableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The player who's going to use the item. /// - /// + /// /// public UsingItemCompletedEventArgs(Player player, UsableItem item) { @@ -32,7 +32,7 @@ public UsingItemCompletedEventArgs(Player player, UsableItem item) } /// - /// Gets the item that the player using. + /// Gets the item that the player using. /// public Usable Usable { get; } @@ -40,12 +40,12 @@ public UsingItemCompletedEventArgs(Player player, UsableItem item) public Item Item => Usable; /// - /// Gets the player who using the item. + /// Gets the player who using the item. /// public Player Player { get; } /// - /// Gets or sets a value indicating whether or not the player can use the item. + /// Gets or sets a value indicating whether or not the player can use the item. /// public bool IsAllowed { get; set; } = true; } diff --git a/Exiled.Events/EventArgs/Player/UsingItemEventArgs.cs b/Exiled.Events/EventArgs/Player/UsingItemEventArgs.cs index 999eecf568..708a58f8a9 100644 --- a/Exiled.Events/EventArgs/Player/UsingItemEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/UsingItemEventArgs.cs @@ -14,19 +14,19 @@ namespace Exiled.Events.EventArgs.Player using InventorySystem.Items.Usables; /// - /// Contains all information before a player uses an item. + /// Contains all information before a player uses an item. /// public class UsingItemEventArgs : IPlayerEvent, IDeniableEvent, IUsableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The player who's going to use the item. /// - /// + /// /// /// - /// + /// /// public UsingItemEventArgs(Player player, UsableItem item, float cooldown) { @@ -36,7 +36,7 @@ public UsingItemEventArgs(Player player, UsableItem item, float cooldown) } /// - /// Gets the item that the player using. + /// Gets the item that the player using. /// public Usable Usable { get; } @@ -44,17 +44,17 @@ public UsingItemEventArgs(Player player, UsableItem item, float cooldown) public Item Item => Usable; /// - /// Gets the player who using the item. + /// Gets the player who using the item. /// public Player Player { get; } /// - /// Gets or sets the item cooldown. + /// Gets or sets the item cooldown. /// public float Cooldown { get; set; } /// - /// Gets or sets a value indicating whether or not the player can use the item. + /// Gets or sets a value indicating whether or not the player can use the item. /// public bool IsAllowed { get; set; } = true; } diff --git a/Exiled.Events/EventArgs/Player/UsingMicroHIDEnergyEventArgs.cs b/Exiled.Events/EventArgs/Player/UsingMicroHIDEnergyEventArgs.cs index 353617e2da..d98f014ed8 100644 --- a/Exiled.Events/EventArgs/Player/UsingMicroHIDEnergyEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/UsingMicroHIDEnergyEventArgs.cs @@ -15,27 +15,27 @@ namespace Exiled.Events.EventArgs.Player using InventorySystem.Items.MicroHID; /// - /// Contains all information before MicroHID energy is changed. + /// Contains all information before MicroHID energy is changed. /// public class UsingMicroHIDEnergyEventArgs : IPlayerEvent, IDeniableEvent, IItemEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public UsingMicroHIDEnergyEventArgs(Player player, MicroHIDItem microHIDitem, HidState currentState, float drain, bool isAllowed = true) { @@ -47,7 +47,7 @@ public UsingMicroHIDEnergyEventArgs(Player player, MicroHIDItem microHIDitem, Hi } /// - /// Gets the MicroHID instance. + /// Gets the MicroHID instance. /// public MicroHid MicroHID { get; } @@ -55,22 +55,22 @@ public UsingMicroHIDEnergyEventArgs(Player player, MicroHIDItem microHIDitem, Hi public Item Item => MicroHID; /// - /// Gets the current state of the MicroHID. + /// Gets the current state of the MicroHID. /// public HidState CurrentState { get; } /// - /// Gets or sets the MicroHID energy drain. + /// Gets or sets the MicroHID energy drain. /// public float Drain { get; set; } /// - /// Gets or sets a value indicating whether the MicroHID energy can be changed or not. + /// Gets or sets a value indicating whether the MicroHID energy can be changed or not. /// public bool IsAllowed { get; set; } /// - /// Gets the player who's using the MicroHID. + /// Gets the player who's using the MicroHID. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Player/UsingRadioBatteryEventArgs.cs b/Exiled.Events/EventArgs/Player/UsingRadioBatteryEventArgs.cs index 7b0191a150..90369883f1 100644 --- a/Exiled.Events/EventArgs/Player/UsingRadioBatteryEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/UsingRadioBatteryEventArgs.cs @@ -15,24 +15,24 @@ namespace Exiled.Events.EventArgs.Player using InventorySystem.Items.Radio; /// - /// Contains all information before radio battery charge is changed. + /// Contains all information before radio battery charge is changed. /// public class UsingRadioBatteryEventArgs : IPlayerEvent, IDeniableEvent, IItemEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public UsingRadioBatteryEventArgs(RadioItem radio, Player player, float drain, bool isAllowed = true) { @@ -43,7 +43,7 @@ public UsingRadioBatteryEventArgs(RadioItem radio, Player player, float drain, b } /// - /// Gets the which is being used. + /// Gets the which is being used. /// public Radio Radio { get; } @@ -51,17 +51,17 @@ public UsingRadioBatteryEventArgs(RadioItem radio, Player player, float drain, b public Item Item => Radio; /// - /// Gets or sets the radio battery drain per second. + /// Gets or sets the radio battery drain per second. /// public float Drain { get; set; } /// - /// Gets or sets a value indicating whether the radio battery charge can be changed or not. + /// Gets or sets a value indicating whether the radio battery charge can be changed or not. /// public bool IsAllowed { get; set; } /// - /// Gets the player who's using the radio. + /// Gets the player who's using the radio. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Player/VerifiedEventArgs.cs b/Exiled.Events/EventArgs/Player/VerifiedEventArgs.cs index 626f11b25a..28ae41d509 100644 --- a/Exiled.Events/EventArgs/Player/VerifiedEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/VerifiedEventArgs.cs @@ -12,20 +12,20 @@ namespace Exiled.Events.EventArgs.Player using Interfaces; /// - /// Contains all information after the server verifies a player. + /// Contains all information after the server verifies a player. /// public class VerifiedEventArgs : IPlayerEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// public VerifiedEventArgs(Player player) => Player = player; /// - /// Gets the verified player. + /// Gets the verified player. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Player/VoiceChattingEventArgs.cs b/Exiled.Events/EventArgs/Player/VoiceChattingEventArgs.cs index d838f0a066..3b0e90bb8c 100644 --- a/Exiled.Events/EventArgs/Player/VoiceChattingEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/VoiceChattingEventArgs.cs @@ -15,24 +15,24 @@ namespace Exiled.Events.EventArgs.Player using VoiceChat.Networking; /// - /// Contains all information after a player presses the voicechat key. + /// Contains all information after a player presses the voicechat key. /// public class VoiceChattingEventArgs : IPlayerEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public VoiceChattingEventArgs(Player player, VoiceMessage voiceMessage, VoiceModuleBase voiceModule, bool isAllowed = true) { @@ -43,22 +43,22 @@ public VoiceChattingEventArgs(Player player, VoiceMessage voiceMessage, VoiceMod } /// - /// Gets the player who's voicechatting. + /// Gets the player who's voicechatting. /// public Player Player { get; } /// - /// Gets or sets the 's . + /// Gets or sets the 's . /// public VoiceMessage VoiceMessage { get; set; } /// - /// Gets the 's . + /// Gets the 's . /// public VoiceModuleBase VoiceModule { get; } /// - /// Gets or sets a value indicating whether or not the player can voicechat. + /// Gets or sets a value indicating whether or not the player can voicechat. /// public bool IsAllowed { get; set; } } diff --git a/Exiled.Events/EventArgs/Scp049/ActivatingSenseEventArgs.cs b/Exiled.Events/EventArgs/Scp049/ActivatingSenseEventArgs.cs index f5b3f3eb2d..8a8b719be7 100644 --- a/Exiled.Events/EventArgs/Scp049/ActivatingSenseEventArgs.cs +++ b/Exiled.Events/EventArgs/Scp049/ActivatingSenseEventArgs.cs @@ -16,7 +16,7 @@ namespace Exiled.Events.EventArgs.Scp049 using Scp049Role = API.Features.Roles.Scp049Role; /// - /// Contains all information before SCP-049 good sense of the doctor is activated. + /// Contains all information before SCP-049 good sense of the doctor is activated. /// public class ActivatingSenseEventArgs : IScp049Event, IDeniableEvent { diff --git a/Exiled.Events/EventArgs/Scp049/FinishingRecallEventArgs.cs b/Exiled.Events/EventArgs/Scp049/FinishingRecallEventArgs.cs index e29916155e..e897dbb04a 100644 --- a/Exiled.Events/EventArgs/Scp049/FinishingRecallEventArgs.cs +++ b/Exiled.Events/EventArgs/Scp049/FinishingRecallEventArgs.cs @@ -13,24 +13,24 @@ namespace Exiled.Events.EventArgs.Scp049 using PlayerRoles.Ragdolls; /// - /// Contains all information before SCP-049 finishes reviving a player. + /// Contains all information before SCP-049 finishes reviving a player. /// public class FinishingRecallEventArgs : IScp049Event, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public FinishingRecallEventArgs(Player target, Player scp049, BasicRagdoll ragdoll, bool isAllowed = true) { @@ -45,22 +45,22 @@ public FinishingRecallEventArgs(Player target, Player scp049, BasicRagdoll ragdo public Scp049Role Scp049 { get; } /// - /// Gets the player who is controlling SCP-049. + /// Gets the player who is controlling SCP-049. /// public Player Player { get; } /// - /// Gets the player who's getting revived. + /// Gets the player who's getting revived. /// public Player Target { get; } /// - /// Gets the Ragdoll who's getting revived. + /// Gets the Ragdoll who's getting revived. /// public Ragdoll Ragdoll { get; } /// - /// Gets or sets a value indicating whether or not the player can be revived. + /// Gets or sets a value indicating whether or not the player can be revived. /// public bool IsAllowed { get; set; } } diff --git a/Exiled.Events/EventArgs/Scp0492/ConsumedCorpseEventArgs.cs b/Exiled.Events/EventArgs/Scp0492/ConsumedCorpseEventArgs.cs index ce45ceff26..c3d33374c8 100644 --- a/Exiled.Events/EventArgs/Scp0492/ConsumedCorpseEventArgs.cs +++ b/Exiled.Events/EventArgs/Scp0492/ConsumedCorpseEventArgs.cs @@ -17,7 +17,7 @@ namespace Exiled.Events.EventArgs.Scp0492 using PlayerRoles.Ragdolls; /// - /// Contains all information after zombie consumes RagDolls. + /// Contains all information after zombie consumes RagDolls. /// public class ConsumedCorpseEventArgs : IScp0492Event, IRagdollEvent { @@ -35,7 +35,7 @@ public ConsumedCorpseEventArgs(ReferenceHub player, BasicRagdoll ragDoll) } /// - /// Gets the player who is controlling SCP-049-2. + /// Gets the player who is controlling SCP-049-2. /// public Player Player { get; } @@ -43,12 +43,12 @@ public ConsumedCorpseEventArgs(ReferenceHub player, BasicRagdoll ragDoll) public Scp0492Role Scp0492 { get; } /// - /// Gets the RagDoll to be consumed. + /// Gets the RagDoll to be consumed. /// public Ragdoll Ragdoll { get; } /// - /// Gets or sets a value about how mush heath the Zombie will get. + /// Gets or sets a value about how mush heath the Zombie will get. /// public float ConsumeHeal { get; set; } = ZombieConsumeAbility.ConsumeHeal; } diff --git a/Exiled.Events/EventArgs/Scp0492/ConsumingCorpseEventArgs.cs b/Exiled.Events/EventArgs/Scp0492/ConsumingCorpseEventArgs.cs index 63c07e8cf0..d398e147a5 100644 --- a/Exiled.Events/EventArgs/Scp0492/ConsumingCorpseEventArgs.cs +++ b/Exiled.Events/EventArgs/Scp0492/ConsumingCorpseEventArgs.cs @@ -15,7 +15,7 @@ namespace Exiled.Events.EventArgs.Scp0492 using PlayerRoles.Ragdolls; /// - /// Contains all information before zombie consumes a ragdoll. + /// Contains all information before zombie consumes a ragdoll. /// public class ConsumingCorpseEventArgs : IScp0492Event, IRagdollEvent, IDeniableEvent { @@ -37,7 +37,7 @@ public ConsumingCorpseEventArgs(ReferenceHub player, BasicRagdoll ragDoll, Zombi } /// - /// Gets the player who is controlling SCP-049-2. + /// Gets the player who is controlling SCP-049-2. /// public Player Player { get; } @@ -45,7 +45,7 @@ public ConsumingCorpseEventArgs(ReferenceHub player, BasicRagdoll ragDoll, Zombi public Scp0492Role Scp0492 { get; } /// - /// Gets the ragdoll to be consumed. + /// Gets the ragdoll to be consumed. /// public Ragdoll Ragdoll { get; } @@ -55,7 +55,7 @@ public ConsumingCorpseEventArgs(ReferenceHub player, BasicRagdoll ragDoll, Zombi public ZombieConsumeAbility.ConsumeError ErrorCode { get; set; } /// - /// Gets or sets a value indicating whether 049-2 can consume a corpse. + /// Gets or sets a value indicating whether 049-2 can consume a corpse. /// public bool IsAllowed { diff --git a/Exiled.Events/EventArgs/Scp079/ChangingCameraEventArgs.cs b/Exiled.Events/EventArgs/Scp079/ChangingCameraEventArgs.cs index 496feac804..88e1542430 100644 --- a/Exiled.Events/EventArgs/Scp079/ChangingCameraEventArgs.cs +++ b/Exiled.Events/EventArgs/Scp079/ChangingCameraEventArgs.cs @@ -14,21 +14,21 @@ namespace Exiled.Events.EventArgs.Scp079 using PlayerRoles.PlayableScps.Scp079.Cameras; /// - /// Contains all information before a SCP-079 changes the current camera. + /// Contains all information before a SCP-079 changes the current camera. /// public class ChangingCameraEventArgs : IScp079Event, ICameraEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public ChangingCameraEventArgs(Player player, Scp079Camera camera, float auxiliaryPowerCost) { @@ -40,7 +40,7 @@ public ChangingCameraEventArgs(Player player, Scp079Camera camera, float auxilia } /// - /// Gets the player who is SCP-079. + /// Gets the player who is SCP-079. /// public Player Player { get; } @@ -48,19 +48,19 @@ public ChangingCameraEventArgs(Player player, Scp079Camera camera, float auxilia public Scp079Role Scp079 { get; } /// - /// Gets or sets the amount of auxiliary power that will be required to switch cameras. + /// Gets or sets the amount of auxiliary power that will be required to switch cameras. /// public float AuxiliaryPowerCost { get; set; } /// - /// Gets or sets the camera SCP-079 will be moved to. + /// Gets or sets the camera SCP-079 will be moved to. /// public Camera Camera { get; set; } /// - /// Gets or sets a value indicating whether or not SCP-079 can switch cameras. - /// Defaults to a value describing whether or not SCP-079 has enough auxiliary power to switch. - ///
Can be set to to allow a switch regardless of SCP-079's auxiliary power amount.
+ /// Gets or sets a value indicating whether or not SCP-079 can switch cameras. + /// Defaults to a value describing whether or not SCP-079 has enough auxiliary power to switch. + ///
Can be set to to allow a switch regardless of SCP-079's auxiliary power amount.
///
public bool IsAllowed { get; set; } } diff --git a/Exiled.Events/EventArgs/Scp079/ChangingSpeakerStatusEventArgs.cs b/Exiled.Events/EventArgs/Scp079/ChangingSpeakerStatusEventArgs.cs index e2b90a766c..5b4002366f 100644 --- a/Exiled.Events/EventArgs/Scp079/ChangingSpeakerStatusEventArgs.cs +++ b/Exiled.Events/EventArgs/Scp079/ChangingSpeakerStatusEventArgs.cs @@ -14,18 +14,18 @@ namespace Exiled.Events.EventArgs.Scp079 using Interfaces; /// - /// Contains all information before SCP-079 uses a speaker. + /// Contains all information before SCP-079 uses a speaker. /// public class ChangingSpeakerStatusEventArgs : IScp079Event, IRoomEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// public ChangingSpeakerStatusEventArgs(Player player, bool isAllowed) { @@ -36,7 +36,7 @@ public ChangingSpeakerStatusEventArgs(Player player, bool isAllowed) } /// - /// Gets the player who's controlling SCP-079. + /// Gets the player who's controlling SCP-079. /// public Player Player { get; } @@ -44,12 +44,12 @@ public ChangingSpeakerStatusEventArgs(Player player, bool isAllowed) public Scp079Role Scp079 { get; } /// - /// Gets the room that the speaker is located in. + /// Gets the room that the speaker is located in. /// public Room Room { get; } /// - /// Gets or sets a value indicating whether SCP-079 is able to speak to players. + /// Gets or sets a value indicating whether SCP-079 is able to speak to players. /// public bool IsAllowed { get; set; } } diff --git a/Exiled.Events/EventArgs/Scp079/ElevatorTeleportingEventArgs.cs b/Exiled.Events/EventArgs/Scp079/ElevatorTeleportingEventArgs.cs index 35374315df..55ad118fa5 100644 --- a/Exiled.Events/EventArgs/Scp079/ElevatorTeleportingEventArgs.cs +++ b/Exiled.Events/EventArgs/Scp079/ElevatorTeleportingEventArgs.cs @@ -16,24 +16,24 @@ namespace Exiled.Events.EventArgs.Scp079 using MapGeneration; /// - /// Contains all information before SCP-079 changes rooms via elevator. + /// Contains all information before SCP-079 changes rooms via elevator. /// public class ElevatorTeleportingEventArgs : IScp079Event, IRoomEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public ElevatorTeleportingEventArgs(Player player, RoomIdentifier room, ElevatorDoor elevatorDoor, float auxiliaryPowerCost) { @@ -46,7 +46,7 @@ public ElevatorTeleportingEventArgs(Player player, RoomIdentifier room, Elevator } /// - /// Gets the player who is controlling SCP-079. + /// Gets the player who is controlling SCP-079. /// public Player Player { get; } @@ -54,23 +54,23 @@ public ElevatorTeleportingEventArgs(Player player, RoomIdentifier room, Elevator public Scp079Role Scp079 { get; } /// - /// Gets or sets the amount of auxiliary power required to teleport to an elevator camera. + /// Gets or sets the amount of auxiliary power required to teleport to an elevator camera. /// public float AuxiliaryPowerCost { get; set; } /// - /// Gets SCP-079 is in. + /// Gets SCP-079 is in. /// public Room Room { get; } /// - /// Gets the SCP-079 wants to move. + /// Gets the SCP-079 wants to move. /// public Lift Lift { get; } /// - /// Gets or sets a value indicating whether or not SCP-079 can teleport. - /// Defaults to a describing whether or not SCP-079 has enough auxiliary power to teleport. + /// Gets or sets a value indicating whether or not SCP-079 can teleport. + /// Defaults to a describing whether or not SCP-079 has enough auxiliary power to teleport. /// public bool IsAllowed { get; set; } } diff --git a/Exiled.Events/EventArgs/Scp079/GainingExperienceEventArgs.cs b/Exiled.Events/EventArgs/Scp079/GainingExperienceEventArgs.cs index fc7407d71a..dfeae7760e 100644 --- a/Exiled.Events/EventArgs/Scp079/GainingExperienceEventArgs.cs +++ b/Exiled.Events/EventArgs/Scp079/GainingExperienceEventArgs.cs @@ -15,27 +15,27 @@ namespace Exiled.Events.EventArgs.Scp079 using Scp079Role = API.Features.Roles.Scp079Role; /// - /// Contains all information before SCP-079 gains experience. + /// Contains all information before SCP-079 gains experience. /// public class GainingExperienceEventArgs : IScp079Event, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public GainingExperienceEventArgs(Player player, Scp079HudTranslation gainType, int amount, RoleTypeId roleType, bool isAllowed = true) { @@ -48,28 +48,28 @@ public GainingExperienceEventArgs(Player player, Scp079HudTranslation gainType, } /// - /// Gets or sets the role that was used to gain experience. - /// The RoleType will be when it's not an assisted experience. + /// Gets or sets the role that was used to gain experience. + /// The RoleType will be when it's not an assisted experience. /// public RoleTypeId RoleType { get; set; } /// - /// Gets or sets the experience gain type. + /// Gets or sets the experience gain type. /// public Scp079HudTranslation GainType { get; set; } /// - /// Gets or sets the amount of experience to be gained. + /// Gets or sets the amount of experience to be gained. /// public int Amount { get; set; } /// - /// Gets or sets a value indicating whether or not the experience is successfully granted. + /// Gets or sets a value indicating whether or not the experience is successfully granted. /// public bool IsAllowed { get; set; } /// - /// Gets the player who's controlling SCP-079. + /// Gets the player who's controlling SCP-079. /// public Player Player { get; } diff --git a/Exiled.Events/EventArgs/Scp079/GainingLevelEventArgs.cs b/Exiled.Events/EventArgs/Scp079/GainingLevelEventArgs.cs index 03e5458dc0..8548052b87 100644 --- a/Exiled.Events/EventArgs/Scp079/GainingLevelEventArgs.cs +++ b/Exiled.Events/EventArgs/Scp079/GainingLevelEventArgs.cs @@ -12,21 +12,21 @@ namespace Exiled.Events.EventArgs.Scp079 using Interfaces; /// - /// Contains all information before SCP-079 gains a level. + /// Contains all information before SCP-079 gains a level. /// public class GainingLevelEventArgs : IScp079Event, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public GainingLevelEventArgs(Player player, int newLevel, bool isAllowed = true) { @@ -37,17 +37,17 @@ public GainingLevelEventArgs(Player player, int newLevel, bool isAllowed = true) } /// - /// Gets or sets SCP-079's new level. + /// Gets or sets SCP-079's new level. /// public int NewLevel { get; set; } /// - /// Gets or sets a value indicating whether or not the level is successfully granted. + /// Gets or sets a value indicating whether or not the level is successfully granted. /// public bool IsAllowed { get; set; } /// - /// Gets the player who's controlling SCP-079. + /// Gets the player who's controlling SCP-079. /// public Player Player { get; } diff --git a/Exiled.Events/EventArgs/Scp079/InteractingTeslaEventArgs.cs b/Exiled.Events/EventArgs/Scp079/InteractingTeslaEventArgs.cs index 588f4cb0b8..a22f2d04ab 100644 --- a/Exiled.Events/EventArgs/Scp079/InteractingTeslaEventArgs.cs +++ b/Exiled.Events/EventArgs/Scp079/InteractingTeslaEventArgs.cs @@ -14,21 +14,21 @@ namespace Exiled.Events.EventArgs.Scp079 using TeslaGate = TeslaGate; /// - /// Contains all information before SCP-079 triggers a tesla gate. + /// Contains all information before SCP-079 triggers a tesla gate. /// public class InteractingTeslaEventArgs : IScp079Event, ITeslaEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public InteractingTeslaEventArgs(Player player, TeslaGate teslaGate, float auxiliaryPowerCost) { @@ -40,7 +40,7 @@ public InteractingTeslaEventArgs(Player player, TeslaGate teslaGate, float auxil } /// - /// Gets the player who's controlling SCP-079. + /// Gets the player who's controlling SCP-079. /// public Player Player { get; } @@ -48,17 +48,17 @@ public InteractingTeslaEventArgs(Player player, TeslaGate teslaGate, float auxil public Scp079Role Scp079 { get; } /// - /// Gets the that SCP-079 is triggering. + /// Gets the that SCP-079 is triggering. /// public API.Features.TeslaGate Tesla { get; } /// - /// Gets or sets the amount of auxiliary power required to interact with a tesla gate through SCP-079. + /// Gets or sets the amount of auxiliary power required to interact with a tesla gate through SCP-079. /// public float AuxiliaryPowerCost { get; set; } /// - /// Gets or sets a value indicating whether or not SCP-079 can interact with the tesla gate. + /// Gets or sets a value indicating whether or not SCP-079 can interact with the tesla gate. /// public bool IsAllowed { get; set; } } diff --git a/Exiled.Events/EventArgs/Scp079/LockingDownEventArgs.cs b/Exiled.Events/EventArgs/Scp079/LockingDownEventArgs.cs index 3f1bd09e4f..151b3fd46e 100644 --- a/Exiled.Events/EventArgs/Scp079/LockingDownEventArgs.cs +++ b/Exiled.Events/EventArgs/Scp079/LockingDownEventArgs.cs @@ -14,21 +14,21 @@ namespace Exiled.Events.EventArgs.Scp079 using MapGeneration; /// - /// Contains all information before SCP-079 lockdowns a room. + /// Contains all information before SCP-079 lockdowns a room. /// public class LockingDownEventArgs : IScp079Event, IRoomEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public LockingDownEventArgs(Player player, RoomIdentifier roomIdentifier, float auxiliaryPowerCost) { @@ -40,7 +40,7 @@ public LockingDownEventArgs(Player player, RoomIdentifier roomIdentifier, float } /// - /// Gets the player who's controlling SCP-079. + /// Gets the player who's controlling SCP-079. /// public Player Player { get; } @@ -48,17 +48,17 @@ public LockingDownEventArgs(Player player, RoomIdentifier roomIdentifier, float public Scp079Role Scp079 { get; } /// - /// Gets the of the room that will be locked down. + /// Gets the of the room that will be locked down. /// public Room Room { get; } /// - /// Gets or sets the amount of auxiliary power required to lockdown a room. + /// Gets or sets the amount of auxiliary power required to lockdown a room. /// public float AuxiliaryPowerCost { get; set; } /// - /// Gets or sets a value indicating whether or not SCP-079 can lockdown a room. + /// Gets or sets a value indicating whether or not SCP-079 can lockdown a room. /// public bool IsAllowed { get; set; } } diff --git a/Exiled.Events/EventArgs/Scp079/PingingEventArgs.cs b/Exiled.Events/EventArgs/Scp079/PingingEventArgs.cs index 4ea0b75cc9..50b4b39357 100644 --- a/Exiled.Events/EventArgs/Scp079/PingingEventArgs.cs +++ b/Exiled.Events/EventArgs/Scp079/PingingEventArgs.cs @@ -18,30 +18,30 @@ namespace Exiled.Events.EventArgs.Scp079 using UnityEngine; /// - /// Contains all information before SCP-079 pings a location. + /// Contains all information before SCP-079 pings a location. /// public class PingingEventArgs : IScp079Event, IRoomEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public PingingEventArgs(ReferenceHub hub, RelativePosition position, int powerCost, byte proccesorindex, Vector3 syncNormal, bool isAllowed = true) { @@ -61,22 +61,22 @@ public PingingEventArgs(ReferenceHub hub, RelativePosition position, int powerCo public Vector3 SyncNormal { get; } /// - /// Gets or sets a value indicating whether or not the event is allowed to continue. + /// Gets or sets a value indicating whether or not the event is allowed to continue. /// public bool IsAllowed { get; set; } /// - /// Gets or sets the amount of auxiliary power required for SCP-079 to ping. + /// Gets or sets the amount of auxiliary power required for SCP-079 to ping. /// public float AuxiliaryPowerCost { get; set; } /// - /// Gets or sets a value indicating the type of ping. + /// Gets or sets a value indicating the type of ping. /// public PingType Type { get; set; } /// - /// Gets or sets a value indicating the position of the ping. + /// Gets or sets a value indicating the position of the ping. /// public Vector3 Position { get; set; } @@ -86,7 +86,7 @@ public PingingEventArgs(ReferenceHub hub, RelativePosition position, int powerCo public Room Room { get; } /// - /// Gets the player who's controlling SCP-079. + /// Gets the player who's controlling SCP-079. /// public Player Player { get; } diff --git a/Exiled.Events/EventArgs/Scp079/RecontainedEventArgs.cs b/Exiled.Events/EventArgs/Scp079/RecontainedEventArgs.cs index 6d88fc0f6c..84a2e93ade 100644 --- a/Exiled.Events/EventArgs/Scp079/RecontainedEventArgs.cs +++ b/Exiled.Events/EventArgs/Scp079/RecontainedEventArgs.cs @@ -12,15 +12,15 @@ namespace Exiled.Events.EventArgs.Scp079 using Interfaces; /// - /// Contains information after SCP-079 gets recontained. + /// Contains information after SCP-079 gets recontained. /// public class RecontainedEventArgs : IScp079Event { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// public RecontainedEventArgs(Player player) { @@ -29,7 +29,7 @@ public RecontainedEventArgs(Player player) } /// - /// Gets the player that previously controlled SCP-079. + /// Gets the player that previously controlled SCP-079. /// public Player Player { get; } diff --git a/Exiled.Events/EventArgs/Scp079/RoomBlackoutEventArgs.cs b/Exiled.Events/EventArgs/Scp079/RoomBlackoutEventArgs.cs index 51e1046391..f1f6c85d55 100644 --- a/Exiled.Events/EventArgs/Scp079/RoomBlackoutEventArgs.cs +++ b/Exiled.Events/EventArgs/Scp079/RoomBlackoutEventArgs.cs @@ -14,30 +14,30 @@ namespace Exiled.Events.EventArgs.Scp079 using MapGeneration; /// - /// Contains all information before SCP-079 turns off the lights in a room. + /// Contains all information before SCP-079 turns off the lights in a room. /// public class RoomBlackoutEventArgs : IScp079Event, IRoomEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public RoomBlackoutEventArgs(ReferenceHub player, RoomIdentifier roomIdentifier, float auxiliaryPowerCost, float blackoutduration, float cooldown, bool isAllowed) { @@ -51,7 +51,7 @@ public RoomBlackoutEventArgs(ReferenceHub player, RoomIdentifier roomIdentifier, } /// - /// Gets the player who's controlling SCP-079. + /// Gets the player who's controlling SCP-079. /// public Player Player { get; } @@ -59,27 +59,27 @@ public RoomBlackoutEventArgs(ReferenceHub player, RoomIdentifier roomIdentifier, public API.Features.Roles.Scp079Role Scp079 { get; } /// - /// Gets the room that will be locked down. + /// Gets the room that will be locked down. /// public Room Room { get; } /// - /// Gets or sets the duration of the blackout. + /// Gets or sets the duration of the blackout. /// public float BlackoutDuration { get; set; } /// - /// Gets or sets the amount of auxiliary power required to black out the room. + /// Gets or sets the amount of auxiliary power required to black out the room. /// public float AuxiliaryPowerCost { get; set; } /// - /// Gets or sets the blackout cooldown duration. + /// Gets or sets the blackout cooldown duration. /// public double Cooldown { get; set; } /// - /// Gets or sets a value indicating whether or not SCP-079 can black out the room. + /// Gets or sets a value indicating whether or not SCP-079 can black out the room. /// public bool IsAllowed { get; set; } } diff --git a/Exiled.Events/EventArgs/Scp079/StartingSpeakerEventArgs.cs b/Exiled.Events/EventArgs/Scp079/StartingSpeakerEventArgs.cs index 8c2430a59d..b671e4da1c 100644 --- a/Exiled.Events/EventArgs/Scp079/StartingSpeakerEventArgs.cs +++ b/Exiled.Events/EventArgs/Scp079/StartingSpeakerEventArgs.cs @@ -12,24 +12,24 @@ namespace Exiled.Events.EventArgs.Scp079 using Exiled.Events.EventArgs.Interfaces; /// - /// Contains all information before SCP-079 uses a speaker. + /// Contains all information before SCP-079 uses a speaker. /// public class StartingSpeakerEventArgs : IScp079Event, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public StartingSpeakerEventArgs(Player player, Room room, float auxiliaryPowerCost, bool isAllowed = true) { @@ -41,7 +41,7 @@ public StartingSpeakerEventArgs(Player player, Room room, float auxiliaryPowerCo } /// - /// Gets the player who's controlling SCP-079. + /// Gets the player who's controlling SCP-079. /// public Player Player { get; } @@ -49,17 +49,17 @@ public StartingSpeakerEventArgs(Player player, Room room, float auxiliaryPowerCo public Scp079Role Scp079 { get; } /// - /// Gets the room that the speaker is located in. + /// Gets the room that the speaker is located in. /// public Room Room { get; } /// - /// Gets or sets the amount of auxiliary power required to use a speaker through SCP-079. + /// Gets or sets the amount of auxiliary power required to use a speaker through SCP-079. /// public float AuxiliaryPowerCost { get; set; } /// - /// Gets or sets a value indicating whether or not SCP-079 can use the speaker. + /// Gets or sets a value indicating whether or not SCP-079 can use the speaker. /// public bool IsAllowed { get; set; } } diff --git a/Exiled.Events/EventArgs/Scp079/StoppingSpeakerEventArgs.cs b/Exiled.Events/EventArgs/Scp079/StoppingSpeakerEventArgs.cs index c52fcde3a8..2c69fbc161 100644 --- a/Exiled.Events/EventArgs/Scp079/StoppingSpeakerEventArgs.cs +++ b/Exiled.Events/EventArgs/Scp079/StoppingSpeakerEventArgs.cs @@ -12,21 +12,21 @@ namespace Exiled.Events.EventArgs.Scp079 using Exiled.Events.EventArgs.Interfaces; /// - /// Contains all information before SCP-079 finishes using a speaker. + /// Contains all information before SCP-079 finishes using a speaker. /// public class StoppingSpeakerEventArgs : IScp079Event, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public StoppingSpeakerEventArgs(Player player, Room room, bool isAllowed = true) { @@ -37,7 +37,7 @@ public StoppingSpeakerEventArgs(Player player, Room room, bool isAllowed = true) } /// - /// Gets the player who's controlling SCP-079. + /// Gets the player who's controlling SCP-079. /// public Player Player { get; } @@ -45,12 +45,12 @@ public StoppingSpeakerEventArgs(Player player, Room room, bool isAllowed = true) public Scp079Role Scp079 { get; } /// - /// Gets the room that the speaker is located in. + /// Gets the room that the speaker is located in. /// public Room Room { get; } /// - /// Gets or sets a value indicating whether or not SCP-079 can stop using the speaker. + /// Gets or sets a value indicating whether or not SCP-079 can stop using the speaker. /// public bool IsAllowed { get; set; } } diff --git a/Exiled.Events/EventArgs/Scp079/TriggeringDoorEventArgs.cs b/Exiled.Events/EventArgs/Scp079/TriggeringDoorEventArgs.cs index 0ca724effb..83d9d48496 100644 --- a/Exiled.Events/EventArgs/Scp079/TriggeringDoorEventArgs.cs +++ b/Exiled.Events/EventArgs/Scp079/TriggeringDoorEventArgs.cs @@ -16,21 +16,21 @@ namespace Exiled.Events.EventArgs.Scp079 using Player; /// - /// Contains all information before SCP-079 interacts with a door. + /// Contains all information before SCP-079 interacts with a door. /// public class TriggeringDoorEventArgs : IScp079Event, IDoorEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public TriggeringDoorEventArgs(Player player, DoorVariant door, float auxiliaryPowerCost) { @@ -41,17 +41,17 @@ public TriggeringDoorEventArgs(Player player, DoorVariant door, float auxiliaryP } /// - /// Gets or sets a value indicating whether or not the player can interact with the door. + /// Gets or sets a value indicating whether or not the player can interact with the door. /// public bool IsAllowed { get; set; } = true; /// - /// Gets or sets the instance. + /// Gets or sets the instance. /// public Door Door { get; set; } /// - /// Gets the player who's interacting with the door. + /// Gets the player who's interacting with the door. /// public Player Player { get; } @@ -59,7 +59,7 @@ public TriggeringDoorEventArgs(Player player, DoorVariant door, float auxiliaryP public Scp079Role Scp079 { get; } /// - /// Gets or sets the amount of auxiliary power required to trigger a door through SCP-079. + /// Gets or sets the amount of auxiliary power required to trigger a door through SCP-079. /// public float AuxiliaryPowerCost { get; set; } } diff --git a/Exiled.Events/EventArgs/Scp079/ZoneBlackoutEventArgs.cs b/Exiled.Events/EventArgs/Scp079/ZoneBlackoutEventArgs.cs index e6f7bf3f0d..99adf04f53 100644 --- a/Exiled.Events/EventArgs/Scp079/ZoneBlackoutEventArgs.cs +++ b/Exiled.Events/EventArgs/Scp079/ZoneBlackoutEventArgs.cs @@ -17,30 +17,30 @@ namespace Exiled.Events.EventArgs.Scp079 using Scp079Role = API.Features.Roles.Scp079Role; /// - /// Contains all information before SCP-079 lockdowns a room. + /// Contains all information before SCP-079 lockdowns a room. /// public class ZoneBlackoutEventArgs : IScp079Event, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public ZoneBlackoutEventArgs(ReferenceHub player, FacilityZone zone, float auxiliaryPowerCost, float blackoutduration, float cooldown, Scp079HudTranslation scp079HudTranslation) { @@ -55,27 +55,27 @@ public ZoneBlackoutEventArgs(ReferenceHub player, FacilityZone zone, float auxil } /// - /// Gets the player who's controlling SCP-079. + /// Gets the player who's controlling SCP-079. /// public Player Player { get; } /// - /// Gets the of the room that will be locked down. + /// Gets the of the room that will be locked down. /// public ZoneType Zone { get; } /// - /// Gets the send back to player. + /// Gets the send back to player. /// public Scp079HudTranslation Scp079HudTranslation { get; } /// - /// Gets or sets the amount of auxiliary power required to lockdown a room. + /// Gets or sets the amount of auxiliary power required to lockdown a room. /// public float AuxiliaryPowerCost { get; set; } /// - /// Gets or sets the time of the blackout. + /// Gets or sets the time of the blackout. /// public float BlackoutDuration { get; set; } @@ -85,7 +85,7 @@ public ZoneBlackoutEventArgs(ReferenceHub player, FacilityZone zone, float auxil public float Cooldown { get; set; } /// - /// Gets or sets a value indicating whether or not SCP-079 can lockdown a room. + /// Gets or sets a value indicating whether or not SCP-079 can lockdown a room. /// public bool IsAllowed { get; set; } diff --git a/Exiled.Events/EventArgs/Scp096/AddingTargetEventArgs.cs b/Exiled.Events/EventArgs/Scp096/AddingTargetEventArgs.cs index bfb6c3bf8a..7a21f77f03 100644 --- a/Exiled.Events/EventArgs/Scp096/AddingTargetEventArgs.cs +++ b/Exiled.Events/EventArgs/Scp096/AddingTargetEventArgs.cs @@ -14,24 +14,24 @@ namespace Exiled.Events.EventArgs.Scp096 using Scp096Role = API.Features.Roles.Scp096Role; /// - /// Contains all information before adding a target to SCP-096. + /// Contains all information before adding a target to SCP-096. /// public class AddingTargetEventArgs : IScp096Event, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public AddingTargetEventArgs(Player scp096, Player target, bool isLooking, bool isAllowed = true) { @@ -43,7 +43,7 @@ public AddingTargetEventArgs(Player scp096, Player target, bool isLooking, bool } /// - /// Gets the that is controlling SCP-096. + /// Gets the that is controlling SCP-096. /// public Player Player { get; } @@ -51,17 +51,17 @@ public AddingTargetEventArgs(Player scp096, Player target, bool isLooking, bool public Scp096Role Scp096 { get; } /// - /// Gets the being added as a target. + /// Gets the being added as a target. /// public Player Target { get; } /// - /// Gets a value indicating whether or not the target was being target cause of looking it's face. + /// Gets a value indicating whether or not the target was being target cause of looking it's face. /// public bool IsLooking { get; } /// - /// Gets or sets a value indicating whether or not the target is allowed to be added. + /// Gets or sets a value indicating whether or not the target is allowed to be added. /// public bool IsAllowed { get; set; } } diff --git a/Exiled.Events/EventArgs/Scp096/CalmingDownEventArgs.cs b/Exiled.Events/EventArgs/Scp096/CalmingDownEventArgs.cs index 3d75a231a6..1a6647c685 100644 --- a/Exiled.Events/EventArgs/Scp096/CalmingDownEventArgs.cs +++ b/Exiled.Events/EventArgs/Scp096/CalmingDownEventArgs.cs @@ -12,12 +12,12 @@ namespace Exiled.Events.EventArgs.Scp096 using Exiled.Events.EventArgs.Interfaces; /// - /// Contains all information before SCP-096 calms down. + /// Contains all information before SCP-096 calms down. /// public class CalmingDownEventArgs : IScp096Event, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The player who's controlling SCP-096. /// @@ -34,17 +34,17 @@ public CalmingDownEventArgs(Player player, bool shouldClearEnragedTimeLeft, bool public Scp096Role Scp096 { get; } /// - /// Gets the player who's controlling SCP-096. + /// Gets the player who's controlling SCP-096. /// public Player Player { get; } /// - /// Gets or sets a value indicating whether SCP-096 enrage time left should be cleared or not. + /// Gets or sets a value indicating whether SCP-096 enrage time left should be cleared or not. /// public bool ShouldClearEnragedTimeLeft { get; set; } /// - /// Gets or sets a value indicating whether or not SCP-096 can be enraged. + /// Gets or sets a value indicating whether or not SCP-096 can be enraged. /// public bool IsAllowed { get; set; } } diff --git a/Exiled.Events/EventArgs/Scp096/ChargingEventArgs.cs b/Exiled.Events/EventArgs/Scp096/ChargingEventArgs.cs index 5d26306b22..be040740a1 100644 --- a/Exiled.Events/EventArgs/Scp096/ChargingEventArgs.cs +++ b/Exiled.Events/EventArgs/Scp096/ChargingEventArgs.cs @@ -12,18 +12,18 @@ namespace Exiled.Events.EventArgs.Scp096 using Interfaces; /// - /// Contains all information before SCP-096 charges. + /// Contains all information before SCP-096 charges. /// public class ChargingEventArgs : IScp096Event, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// public ChargingEventArgs(Player player, bool isAllowed = true) { @@ -36,12 +36,12 @@ public ChargingEventArgs(Player player, bool isAllowed = true) public Scp096Role Scp096 { get; } /// - /// Gets the player who is controlling SCP-096. + /// Gets the player who is controlling SCP-096. /// public Player Player { get; } /// - /// Gets or sets a value indicating whether or not SCP-096 can charge. + /// Gets or sets a value indicating whether or not SCP-096 can charge. /// public bool IsAllowed { get; set; } } diff --git a/Exiled.Events/EventArgs/Scp096/EnragingEventArgs.cs b/Exiled.Events/EventArgs/Scp096/EnragingEventArgs.cs index 773140c6f1..001a67cecd 100644 --- a/Exiled.Events/EventArgs/Scp096/EnragingEventArgs.cs +++ b/Exiled.Events/EventArgs/Scp096/EnragingEventArgs.cs @@ -12,21 +12,21 @@ namespace Exiled.Events.EventArgs.Scp096 using Interfaces; /// - /// Contains all information before SCP-096 gets enraged. + /// Contains all information before SCP-096 gets enraged. /// public class EnragingEventArgs : IScp096Event, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public EnragingEventArgs(Player player, float initialDuration, bool isAllowed = true) { @@ -40,17 +40,17 @@ public EnragingEventArgs(Player player, float initialDuration, bool isAllowed = public Scp096Role Scp096 { get; } /// - /// Gets the player who's controlling SCP-096. + /// Gets the player who's controlling SCP-096. /// public Player Player { get; } /// - /// Gets or sets the SCP-096 rage initial duration. + /// Gets or sets the SCP-096 rage initial duration. /// public float InitialDuration { get; set; } /// - /// Gets or sets a value indicating whether or not SCP-096 can be enraged. + /// Gets or sets a value indicating whether or not SCP-096 can be enraged. /// public bool IsAllowed { get; set; } } diff --git a/Exiled.Events/EventArgs/Scp096/StartPryingGateEventArgs.cs b/Exiled.Events/EventArgs/Scp096/StartPryingGateEventArgs.cs index 87243f928d..f40e1e8749 100644 --- a/Exiled.Events/EventArgs/Scp096/StartPryingGateEventArgs.cs +++ b/Exiled.Events/EventArgs/Scp096/StartPryingGateEventArgs.cs @@ -16,21 +16,21 @@ namespace Exiled.Events.EventArgs.Scp096 using Scp096Role = API.Features.Roles.Scp096Role; /// - /// Contains all information before SCP-096 begins prying a gate open. + /// Contains all information before SCP-096 begins prying a gate open. /// public class StartPryingGateEventArgs : IScp096Event, IDeniableEvent, IDoorEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public StartPryingGateEventArgs(Player player, PryableDoor gate, bool isAllowed = true) { @@ -44,22 +44,22 @@ public StartPryingGateEventArgs(Player player, PryableDoor gate, bool isAllowed public Scp096Role Scp096 { get; } /// - /// Gets or Sets a value indicating whether or not the gate can be pried open by SCP-096. + /// Gets or Sets a value indicating whether or not the gate can be pried open by SCP-096. /// public bool IsAllowed { get; set; } /// - /// Gets the to be pried open. + /// Gets the to be pried open. /// public Door Door => Gate; /// - /// Gets the to be pried open. + /// Gets the to be pried open. /// public Gate Gate { get; } /// - /// Gets the player that is controlling SCP-096. + /// Gets the player that is controlling SCP-096. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Scp096/TryingNotToCryEventArgs.cs b/Exiled.Events/EventArgs/Scp096/TryingNotToCryEventArgs.cs index 2dae2e8c62..693bbb3776 100644 --- a/Exiled.Events/EventArgs/Scp096/TryingNotToCryEventArgs.cs +++ b/Exiled.Events/EventArgs/Scp096/TryingNotToCryEventArgs.cs @@ -15,18 +15,18 @@ namespace Exiled.Events.EventArgs.Scp096 using Scp096Role = API.Features.Roles.Scp096Role; /// - /// Contains all information before SCP-096 tries not to cry. + /// Contains all information before SCP-096 tries not to cry. /// public class TryingNotToCryEventArgs : IScp096Event, IDoorEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// public TryingNotToCryEventArgs(Player player, bool isAllowed = true) { @@ -42,23 +42,23 @@ public TryingNotToCryEventArgs(Player player, bool isAllowed = true) public Scp096Role Scp096 { get; } /// - /// Gets the player who is controlling SCP-096. + /// Gets the player who is controlling SCP-096. /// public Player Player { get; } /// - /// Gets the to be cried on. - /// the value can be null + /// Gets the to be cried on. + /// the value can be null /// public Door Door { get; } /// - /// Gets the to be cried on. + /// Gets the to be cried on. /// public GameObject GameObject { get; } /// - /// Gets or sets a value indicating whether or not SCP-096 can try not to cry. + /// Gets or sets a value indicating whether or not SCP-096 can try not to cry. /// public bool IsAllowed { get; set; } } diff --git a/Exiled.Events/EventArgs/Scp106/ExitStalkingEventArgs.cs b/Exiled.Events/EventArgs/Scp106/ExitStalkingEventArgs.cs index 9e04b8656e..c6b44dbf71 100644 --- a/Exiled.Events/EventArgs/Scp106/ExitStalkingEventArgs.cs +++ b/Exiled.Events/EventArgs/Scp106/ExitStalkingEventArgs.cs @@ -16,7 +16,7 @@ namespace Exiled.Events.EventArgs.Scp106 using Scp106Role = API.Features.Roles.Scp106Role; /// - /// Contains all information before SCP-106 use the stalk ability. + /// Contains all information before SCP-106 use the stalk ability. /// public class ExitStalkingEventArgs : IScp106Event, IDeniableEvent { diff --git a/Exiled.Events/EventArgs/Scp106/StalkingEventArgs.cs b/Exiled.Events/EventArgs/Scp106/StalkingEventArgs.cs index 2f0271cdbf..16c94d2350 100644 --- a/Exiled.Events/EventArgs/Scp106/StalkingEventArgs.cs +++ b/Exiled.Events/EventArgs/Scp106/StalkingEventArgs.cs @@ -16,7 +16,7 @@ namespace Exiled.Events.EventArgs.Scp106 using Scp106Role = API.Features.Roles.Scp106Role; /// - /// Contains all information before SCP-106 uses the stalk ability. + /// Contains all information before SCP-106 uses the stalk ability. /// public class StalkingEventArgs : IScp106Event, IDeniableEvent { diff --git a/Exiled.Events/EventArgs/Scp106/TeleportingEventArgs.cs b/Exiled.Events/EventArgs/Scp106/TeleportingEventArgs.cs index c021c704a8..ffc5a10def 100644 --- a/Exiled.Events/EventArgs/Scp106/TeleportingEventArgs.cs +++ b/Exiled.Events/EventArgs/Scp106/TeleportingEventArgs.cs @@ -14,21 +14,21 @@ namespace Exiled.Events.EventArgs.Scp106 using UnityEngine; /// - /// Contains all information before SCP-106 teleports using hunter atlas. + /// Contains all information before SCP-106 teleports using hunter atlas. /// public class TeleportingEventArgs : IScp106Event, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public TeleportingEventArgs(Player player, Vector3 position, bool isAllowed = true) { @@ -39,17 +39,17 @@ public TeleportingEventArgs(Player player, Vector3 position, bool isAllowed = tr } /// - /// Gets or sets the teleporting position. + /// Gets or sets the teleporting position. /// public Vector3 Position { get; set; } /// - /// Gets or sets a value indicating whether or not SCP-106 can teleport using a portal. + /// Gets or sets a value indicating whether or not SCP-106 can teleport using a portal. /// public bool IsAllowed { get; set; } /// - /// Gets the player who's controlling SCP-106. + /// Gets the player who's controlling SCP-106. /// public Player Player { get; } diff --git a/Exiled.Events/EventArgs/Scp173/BlinkingEventArgs.cs b/Exiled.Events/EventArgs/Scp173/BlinkingEventArgs.cs index 5cae027868..5ef166038d 100644 --- a/Exiled.Events/EventArgs/Scp173/BlinkingEventArgs.cs +++ b/Exiled.Events/EventArgs/Scp173/BlinkingEventArgs.cs @@ -20,21 +20,21 @@ namespace Exiled.Events.EventArgs.Scp173 using Scp173Role = API.Features.Roles.Scp173Role; /// - /// Contains all information before a players blink near SCP-173. + /// Contains all information before a players blink near SCP-173. /// public class BlinkingEventArgs : IScp173Event, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public BlinkingEventArgs(Player player, List targets, Vector3 blinkPos) { @@ -46,28 +46,28 @@ public BlinkingEventArgs(Player player, List targets, Vector3 blinkPos) } /// - /// Gets or sets the location the player is blinking to. + /// Gets or sets the location the player is blinking to. /// public Vector3 BlinkPosition { get; set; } /// - /// Gets or sets how long the blink cooldown will last. + /// Gets or sets how long the blink cooldown will last. /// public float BlinkCooldown { get; set; } /// - /// Gets a of players who have triggered SCP-173. + /// Gets a of players who have triggered SCP-173. /// // TODO: convert to ReadOnlyCollection public List Targets { get; } /// - /// Gets or sets a value indicating whether or not the player is allowed to blink. + /// Gets or sets a value indicating whether or not the player is allowed to blink. /// public bool IsAllowed { get; set; } = true; /// - /// Gets the player who controlling SCP-173. + /// Gets the player who controlling SCP-173. /// public Player Player { get; } diff --git a/Exiled.Events/EventArgs/Scp173/BlinkingRequestEventArgs.cs b/Exiled.Events/EventArgs/Scp173/BlinkingRequestEventArgs.cs index dcb3e8a473..3f9df17171 100644 --- a/Exiled.Events/EventArgs/Scp173/BlinkingRequestEventArgs.cs +++ b/Exiled.Events/EventArgs/Scp173/BlinkingRequestEventArgs.cs @@ -20,18 +20,18 @@ namespace Exiled.Events.EventArgs.Scp173 using Scp173Role = API.Features.Roles.Scp173Role; /// - /// Contains all information before server handle SCP-173 blink network message. + /// Contains all information before server handle SCP-173 blink network message. /// public class BlinkingRequestEventArgs : IScp173Event, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// public BlinkingRequestEventArgs(Player player, HashSet targets) { @@ -41,17 +41,17 @@ public BlinkingRequestEventArgs(Player player, HashSet targets) } /// - /// Gets a of players who have triggered SCP-173. + /// Gets a of players who have triggered SCP-173. /// public IReadOnlyCollection Targets { get; } /// - /// Gets or sets a value indicating whether or not the player is allowed to blink. + /// Gets or sets a value indicating whether or not the player is allowed to blink. /// public bool IsAllowed { get; set; } = true; /// - /// Gets the player who controlling SCP-173. + /// Gets the player who controlling SCP-173. /// public Player Player { get; } diff --git a/Exiled.Events/EventArgs/Scp173/PlacingTantrumEventArgs.cs b/Exiled.Events/EventArgs/Scp173/PlacingTantrumEventArgs.cs index e415ac979b..d632310483 100644 --- a/Exiled.Events/EventArgs/Scp173/PlacingTantrumEventArgs.cs +++ b/Exiled.Events/EventArgs/Scp173/PlacingTantrumEventArgs.cs @@ -16,24 +16,24 @@ namespace Exiled.Events.EventArgs.Scp173 using Scp173Role = API.Features.Roles.Scp173Role; /// - /// Contains all information before the tantrum is placed. + /// Contains all information before the tantrum is placed. /// public class PlacingTantrumEventArgs : IScp173Event, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public PlacingTantrumEventArgs(Player player, TantrumEnvironmentalHazard tantrumHazard, AbilityCooldown cooldown, bool isAllowed = true) { @@ -45,27 +45,27 @@ public PlacingTantrumEventArgs(Player player, TantrumEnvironmentalHazard tantrum } /// - /// Gets the player's instance. + /// Gets the player's instance. /// public Scp173Role Scp173 { get; } /// - /// Gets the . + /// Gets the . /// public TantrumEnvironmentalHazard TantrumHazard { get; } /// - /// Gets the tantrum . + /// Gets the tantrum . /// public AbilityCooldown Cooldown { get; } /// - /// Gets or sets a value indicating whether or not the tantrum can be placed. + /// Gets or sets a value indicating whether or not the tantrum can be placed. /// public bool IsAllowed { get; set; } /// - /// Gets the player who's placing the tantrum. + /// Gets the player who's placing the tantrum. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Scp173/UsingBreakneckSpeedsEventArgs.cs b/Exiled.Events/EventArgs/Scp173/UsingBreakneckSpeedsEventArgs.cs index 9b712ae4f6..d8cad06ec5 100644 --- a/Exiled.Events/EventArgs/Scp173/UsingBreakneckSpeedsEventArgs.cs +++ b/Exiled.Events/EventArgs/Scp173/UsingBreakneckSpeedsEventArgs.cs @@ -12,18 +12,18 @@ namespace Exiled.Events.EventArgs.Scp173 using Interfaces; /// - /// Contains all information before an Scp-173 uses breakneck speeds. + /// Contains all information before an Scp-173 uses breakneck speeds. /// public class UsingBreakneckSpeedsEventArgs : IScp173Event, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// public UsingBreakneckSpeedsEventArgs(Player player, bool isAllowed = true) { @@ -33,12 +33,12 @@ public UsingBreakneckSpeedsEventArgs(Player player, bool isAllowed = true) } /// - /// Gets or sets a value indicating whether or not the player can use breakneck speeds. + /// Gets or sets a value indicating whether or not the player can use breakneck speeds. /// public bool IsAllowed { get; set; } /// - /// Gets the player who's using breakneck speeds. + /// Gets the player who's using breakneck speeds. /// public Player Player { get; } diff --git a/Exiled.Events/EventArgs/Scp244/DamagingScp244EventArgs.cs b/Exiled.Events/EventArgs/Scp244/DamagingScp244EventArgs.cs index c6c1a6a87c..88d67262d8 100644 --- a/Exiled.Events/EventArgs/Scp244/DamagingScp244EventArgs.cs +++ b/Exiled.Events/EventArgs/Scp244/DamagingScp244EventArgs.cs @@ -20,19 +20,19 @@ namespace Exiled.Events.EventArgs.Scp244 using DamageHandlerBase = PlayerStatsSystem.DamageHandlerBase; /// - /// Contains all information before damage is dealt to a . + /// Contains all information before damage is dealt to a . /// public class DamagingScp244EventArgs : IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// The damage being dealt. /// - /// + /// /// public DamagingScp244EventArgs(Scp244DeployablePickup scp244, float damage, DamageHandlerBase handler) { @@ -45,17 +45,17 @@ public DamagingScp244EventArgs(Scp244DeployablePickup scp244, float damage, Dama } /// - /// Gets the object that is damaged. + /// Gets the object that is damaged. /// public Scp244Pickup Pickup { get; } /// - /// Gets the Damage handler for this event. + /// Gets the Damage handler for this event. /// public DamageHandler Handler { get; } /// - /// Gets or sets a value indicating whether the can be broken. + /// Gets or sets a value indicating whether the can be broken. /// public bool IsAllowed { get; set; } } diff --git a/Exiled.Events/EventArgs/Scp244/OpeningScp244EventArgs.cs b/Exiled.Events/EventArgs/Scp244/OpeningScp244EventArgs.cs index aecdaaa96e..45e354b0cf 100644 --- a/Exiled.Events/EventArgs/Scp244/OpeningScp244EventArgs.cs +++ b/Exiled.Events/EventArgs/Scp244/OpeningScp244EventArgs.cs @@ -13,15 +13,15 @@ namespace Exiled.Events.EventArgs.Scp244 using InventorySystem.Items.Usables.Scp244; /// - /// Contains all information before a player opens SCP-244. + /// Contains all information before a player opens SCP-244. /// public class OpeningScp244EventArgs : IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// public OpeningScp244EventArgs(Scp244DeployablePickup pickup) { @@ -34,7 +34,7 @@ public OpeningScp244EventArgs(Scp244DeployablePickup pickup) public Scp244Pickup Pickup { get; } /// - /// Gets or sets a value indicating whether or not the player can open SCP-244. + /// Gets or sets a value indicating whether or not the player can open SCP-244. /// public bool IsAllowed { get; set; } = true; } diff --git a/Exiled.Events/EventArgs/Scp244/UsingScp244EventArgs.cs b/Exiled.Events/EventArgs/Scp244/UsingScp244EventArgs.cs index 9277019690..c3077777c6 100644 --- a/Exiled.Events/EventArgs/Scp244/UsingScp244EventArgs.cs +++ b/Exiled.Events/EventArgs/Scp244/UsingScp244EventArgs.cs @@ -15,21 +15,21 @@ namespace Exiled.Events.EventArgs.Scp244 using InventorySystem.Items.Usables.Scp244; /// - /// Contains all information before SCP-244 is used. + /// Contains all information before SCP-244 is used. /// public class UsingScp244EventArgs : IPlayerEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public UsingScp244EventArgs(Scp244Item scp244, Player player, bool isAllowed = true) { @@ -39,17 +39,17 @@ public UsingScp244EventArgs(Scp244Item scp244, Player player, bool isAllowed = t } /// - /// Gets the Scp244 instance. + /// Gets the Scp244 instance. /// public Scp244 Scp244 { get; } /// - /// Gets or sets a value indicating whether the SCP-244 can be used. + /// Gets or sets a value indicating whether the SCP-244 can be used. /// public bool IsAllowed { get; set; } /// - /// Gets the player who's using the SCP-244. + /// Gets the player who's using the SCP-244. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Scp3114/DisguisedEventArgs.cs b/Exiled.Events/EventArgs/Scp3114/DisguisedEventArgs.cs index 2e9a10487a..743246f8a5 100644 --- a/Exiled.Events/EventArgs/Scp3114/DisguisedEventArgs.cs +++ b/Exiled.Events/EventArgs/Scp3114/DisguisedEventArgs.cs @@ -11,27 +11,25 @@ namespace Exiled.Events.EventArgs.Scp3114 using Exiled.API.Features.Roles; using Interfaces; - using PlayerRoles.Ragdolls; - /// - /// Contains all information before SCP-3114 changes its target focus. + /// Contains all information after SCP-3114 disguised. /// public class DisguisedEventArgs : IScp3114Event, IRagdollEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// - public DisguisedEventArgs(ReferenceHub player, DynamicRagdoll ragdoll) + public DisguisedEventArgs(Player player, Ragdoll ragdoll) { - Player = Player.Get(player); + Player = player; Scp3114 = Player.Role.As(); - Ragdoll = Ragdoll.Get(ragdoll); + Ragdoll = ragdoll; } /// diff --git a/Exiled.Events/EventArgs/Scp3114/DisguisingEventArgs.cs b/Exiled.Events/EventArgs/Scp3114/DisguisingEventArgs.cs index 198d9d8c3c..c21878c143 100644 --- a/Exiled.Events/EventArgs/Scp3114/DisguisingEventArgs.cs +++ b/Exiled.Events/EventArgs/Scp3114/DisguisingEventArgs.cs @@ -11,31 +11,33 @@ namespace Exiled.Events.EventArgs.Scp3114 using Exiled.API.Features.Roles; using Interfaces; - using PlayerRoles.Ragdolls; - /// - /// Contains all information before SCP-3114 it's diguised to a new role. + /// Contains all information before SCP-3114 disguises to a new role. /// public class DisguisingEventArgs : IScp3114Event, IDeniableEvent, IRagdollEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// + /// + /// + /// /// - public DisguisingEventArgs(ReferenceHub player, DynamicRagdoll ragdoll) + public DisguisingEventArgs(Player player, Ragdoll ragdoll, bool isAllowed = true) { - Player = Player.Get(player); + Player = player; Scp3114 = Player.Role.As(); - Ragdoll = Ragdoll.Get(ragdoll); + Ragdoll = ragdoll; + IsAllowed = isAllowed; } /// - public bool IsAllowed { get; set; } = true; + public bool IsAllowed { get; set; } /// public Player Player { get; } diff --git a/Exiled.Events/EventArgs/Scp3114/RevealedEventArgs.cs b/Exiled.Events/EventArgs/Scp3114/RevealedEventArgs.cs index 8f88be803f..74866b193e 100644 --- a/Exiled.Events/EventArgs/Scp3114/RevealedEventArgs.cs +++ b/Exiled.Events/EventArgs/Scp3114/RevealedEventArgs.cs @@ -12,20 +12,24 @@ namespace Exiled.Events.EventArgs.Scp3114 using Interfaces; /// - /// Contains all information before SCP-3114 changes its target focus. + /// Contains all information after SCP-3114 reveals. /// public class RevealedEventArgs : IScp3114Event { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// - public RevealedEventArgs(ReferenceHub player) + /// + /// + /// + public RevealedEventArgs(Player player, bool isManualReveal) { - Player = Player.Get(player); + Player = player; Scp3114 = Player.Role.As(); + IsManualReveal = isManualReveal; } /// @@ -33,5 +37,10 @@ public RevealedEventArgs(ReferenceHub player) /// public Scp3114Role Scp3114 { get; } + + /// + /// Gets a value indicating whether the reveal is manual or not. + /// + public bool IsManualReveal { get; } } } \ No newline at end of file diff --git a/Exiled.Events/EventArgs/Scp3114/RevealingEventArgs.cs b/Exiled.Events/EventArgs/Scp3114/RevealingEventArgs.cs index f9efca5b5e..755ae8c0f1 100644 --- a/Exiled.Events/EventArgs/Scp3114/RevealingEventArgs.cs +++ b/Exiled.Events/EventArgs/Scp3114/RevealingEventArgs.cs @@ -12,23 +12,27 @@ namespace Exiled.Events.EventArgs.Scp3114 using Interfaces; /// - /// Contains all information before SCP-3114 changes its target focus. + /// Contains all information before SCP-3114 reveals. /// public class RevealingEventArgs : IScp3114Event, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// + /// + /// + /// /// /// - /// + /// /// - public RevealingEventArgs(ReferenceHub player, bool isAllowed = true) + public RevealingEventArgs(Player player, bool isManualReveal, bool isAllowed = true) { - Player = Player.Get(player); + Player = player; Scp3114 = Player.Role.As(); + IsManualReveal = isManualReveal; IsAllowed = isAllowed; } @@ -40,5 +44,10 @@ public RevealingEventArgs(ReferenceHub player, bool isAllowed = true) /// public Scp3114Role Scp3114 { get; } + + /// + /// Gets a value indicating whether the reveal is manual or not. + /// + public bool IsManualReveal { get; } } } \ No newline at end of file diff --git a/Exiled.Events/EventArgs/Scp3114/TryUseBodyEventArgs.cs b/Exiled.Events/EventArgs/Scp3114/TryUseBodyEventArgs.cs index 7cd8b99bec..997f7b22ba 100644 --- a/Exiled.Events/EventArgs/Scp3114/TryUseBodyEventArgs.cs +++ b/Exiled.Events/EventArgs/Scp3114/TryUseBodyEventArgs.cs @@ -10,30 +10,29 @@ namespace Exiled.Events.EventArgs.Scp3114 using API.Features; using Exiled.API.Features.Roles; using Interfaces; - using PlayerRoles.Ragdolls; /// - /// Contains all information before SCP-3114 changes its target focus. + /// Contains all information before SCP-3114 tries to use a body. /// public class TryUseBodyEventArgs : IScp3114Event, IDeniableEvent, IRagdollEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// - public TryUseBodyEventArgs(ReferenceHub player, BasicRagdoll ragdoll, bool isAllowed = true) + public TryUseBodyEventArgs(Player player, Ragdoll ragdoll, bool isAllowed = true) { - Player = Player.Get(player); + Player = player; Scp3114 = Player.Role.As(); - Ragdoll = Ragdoll.Get(ragdoll); + Ragdoll = ragdoll; IsAllowed = isAllowed; } diff --git a/Exiled.Events/EventArgs/Scp3114/VoiceLinesEventArgs.cs b/Exiled.Events/EventArgs/Scp3114/VoiceLinesEventArgs.cs new file mode 100644 index 0000000000..5871aa947a --- /dev/null +++ b/Exiled.Events/EventArgs/Scp3114/VoiceLinesEventArgs.cs @@ -0,0 +1,55 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Events.EventArgs.Scp3114 +{ + using API.Features; + using Exiled.API.Features.Roles; + using Interfaces; + + using static PlayerRoles.PlayableScps.Scp3114.Scp3114VoiceLines; + + /// + /// Contains all information prior to sending voiceline SCP-3114. + /// + public class VoiceLinesEventArgs : IScp3114Event, IDeniableEvent + { + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public VoiceLinesEventArgs(ReferenceHub player, VoiceLinesDefinition voiceLine, bool isAllowed = true) + { + Player = Player.Get(player); + Scp3114 = Player.Role.As(); + VoiceLine = voiceLine; + IsAllowed = isAllowed; + } + + /// + public Player Player { get; } + + /// + public Scp3114Role Scp3114 { get; } + + /// + /// Gets or sets the . + /// + public VoiceLinesDefinition VoiceLine { get; set; } + + /// + public bool IsAllowed { get; set; } + } +} \ No newline at end of file diff --git a/Exiled.Events/EventArgs/Scp330/DroppingScp330EventArgs.cs b/Exiled.Events/EventArgs/Scp330/DroppingScp330EventArgs.cs index fef8c4fe8d..5aabbd2264 100644 --- a/Exiled.Events/EventArgs/Scp330/DroppingScp330EventArgs.cs +++ b/Exiled.Events/EventArgs/Scp330/DroppingScp330EventArgs.cs @@ -15,21 +15,21 @@ namespace Exiled.Events.EventArgs.Scp330 using InventorySystem.Items.Usables.Scp330; /// - /// Contains all information before a player drops a SCP-330 candy. + /// Contains all information before a player drops a SCP-330 candy. /// public class DroppingScp330EventArgs : IPlayerEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public DroppingScp330EventArgs(Player player, Scp330Bag scp330, CandyKindID candy) { @@ -39,22 +39,22 @@ public DroppingScp330EventArgs(Player player, Scp330Bag scp330, CandyKindID cand } /// - /// Gets or sets a value representing the being picked up. + /// Gets or sets a value representing the being picked up. /// public Scp330 Scp330 { get; set; } /// - /// Gets or sets a value indicating whether or not the type of candy drop. + /// Gets or sets a value indicating whether or not the type of candy drop. /// public CandyKindID Candy { get; set; } /// - /// Gets or sets a value indicating whether or not the player can interact with SCP-330. + /// Gets or sets a value indicating whether or not the player can interact with SCP-330. /// public bool IsAllowed { get; set; } = true; /// - /// Gets the player who's interacting with SCP-330. + /// Gets the player who's interacting with SCP-330. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Scp330/EatenScp330EventArgs.cs b/Exiled.Events/EventArgs/Scp330/EatenScp330EventArgs.cs index cd1b00df5e..3fa09415bd 100644 --- a/Exiled.Events/EventArgs/Scp330/EatenScp330EventArgs.cs +++ b/Exiled.Events/EventArgs/Scp330/EatenScp330EventArgs.cs @@ -14,12 +14,12 @@ namespace Exiled.Events.EventArgs.Scp330 using InventorySystem.Items.Usables.Scp330; /// - /// Contains all information after a player has eaten SCP-330. + /// Contains all information after a player has eaten SCP-330. /// public class EatenScp330EventArgs : IPlayerEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// . /// . @@ -30,12 +30,12 @@ public EatenScp330EventArgs(Player player, ICandy candy) } /// - /// Gets the that was eaten by the player. + /// Gets the that was eaten by the player. /// public ICandy Candy { get; } /// - /// Gets the player who has eaten SCP-330. + /// Gets the player who has eaten SCP-330. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Scp330/EatingScp330EventArgs.cs b/Exiled.Events/EventArgs/Scp330/EatingScp330EventArgs.cs index d31f9d498d..d24a57ad40 100644 --- a/Exiled.Events/EventArgs/Scp330/EatingScp330EventArgs.cs +++ b/Exiled.Events/EventArgs/Scp330/EatingScp330EventArgs.cs @@ -14,12 +14,12 @@ namespace Exiled.Events.EventArgs.Scp330 using InventorySystem.Items.Usables.Scp330; /// - /// Contains all information before a player eats SCP-330. + /// Contains all information before a player eats SCP-330. /// public class EatingScp330EventArgs : IPlayerEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// . /// . @@ -32,17 +32,17 @@ public EatingScp330EventArgs(Player player, ICandy candy, bool isAllowed = true) } /// - /// Gets the that is being eaten by the player. + /// Gets the that is being eaten by the player. /// public ICandy Candy { get; } /// - /// Gets or sets a value indicating whether or not the player can eat SCP-330. + /// Gets or sets a value indicating whether or not the player can eat SCP-330. /// public bool IsAllowed { get; set; } /// - /// Gets the player who's eating SCP-330. + /// Gets the player who's eating SCP-330. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Scp330/InteractingScp330EventArgs.cs b/Exiled.Events/EventArgs/Scp330/InteractingScp330EventArgs.cs index d1dcfff826..30cd0a1ac3 100644 --- a/Exiled.Events/EventArgs/Scp330/InteractingScp330EventArgs.cs +++ b/Exiled.Events/EventArgs/Scp330/InteractingScp330EventArgs.cs @@ -14,18 +14,18 @@ namespace Exiled.Events.EventArgs.Scp330 using InventorySystem.Items.Usables.Scp330; /// - /// Contains all information before a player interacts with SCP-330. + /// Contains all information before a player interacts with SCP-330. /// public class InteractingScp330EventArgs : IPlayerEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// public InteractingScp330EventArgs(Player player, int usage) { @@ -37,7 +37,7 @@ public InteractingScp330EventArgs(Player player, int usage) } /// - /// Gets a value indicating how many times this player has interacted with SCP-330. + /// Gets a value indicating how many times this player has interacted with SCP-330. /// public int UsageCount { get; } @@ -47,17 +47,17 @@ public InteractingScp330EventArgs(Player player, int usage) public CandyKindID Candy { get; set; } /// - /// Gets or sets a value indicating whether the player's hands should get severed. + /// Gets or sets a value indicating whether the player's hands should get severed. /// public bool ShouldSever { get; set; } /// - /// Gets or sets a value indicating whether the player is allowed to interact with SCP-330. + /// Gets or sets a value indicating whether the player is allowed to interact with SCP-330. /// public bool IsAllowed { get; set; } = true; /// - /// Gets the triggering the event. + /// Gets the triggering the event. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Scp914/ActivatingEventArgs.cs b/Exiled.Events/EventArgs/Scp914/ActivatingEventArgs.cs index fb321888cc..6d229acf71 100644 --- a/Exiled.Events/EventArgs/Scp914/ActivatingEventArgs.cs +++ b/Exiled.Events/EventArgs/Scp914/ActivatingEventArgs.cs @@ -12,18 +12,18 @@ namespace Exiled.Events.EventArgs.Scp914 using Interfaces; /// - /// Contains all information before a player activates SCP-914. + /// Contains all information before a player activates SCP-914. /// public class ActivatingEventArgs : IPlayerEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// public ActivatingEventArgs(Player player, bool isAllowed = true) { @@ -32,12 +32,12 @@ public ActivatingEventArgs(Player player, bool isAllowed = true) } /// - /// Gets or sets a value indicating whether or not SCP-914 can be activated. + /// Gets or sets a value indicating whether or not SCP-914 can be activated. /// public bool IsAllowed { get; set; } /// - /// Gets the player who's activating SCP-914. + /// Gets the player who's activating SCP-914. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Scp914/ChangingKnobSettingEventArgs.cs b/Exiled.Events/EventArgs/Scp914/ChangingKnobSettingEventArgs.cs index 4229230879..ae9a250425 100644 --- a/Exiled.Events/EventArgs/Scp914/ChangingKnobSettingEventArgs.cs +++ b/Exiled.Events/EventArgs/Scp914/ChangingKnobSettingEventArgs.cs @@ -14,23 +14,23 @@ namespace Exiled.Events.EventArgs.Scp914 using Interfaces; /// - /// Contains all information before a player changes the SCP-914 knob setting. + /// Contains all information before a player changes the SCP-914 knob setting. /// public class ChangingKnobSettingEventArgs : IPlayerEvent, IDeniableEvent { private Scp914KnobSetting knobSetting; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public ChangingKnobSettingEventArgs(Player player, Scp914KnobSetting knobSetting, bool isAllowed = true) { @@ -40,7 +40,7 @@ public ChangingKnobSettingEventArgs(Player player, Scp914KnobSetting knobSetting } /// - /// Gets or sets the SCP-914 knob setting. + /// Gets or sets the SCP-914 knob setting. /// public Scp914KnobSetting KnobSetting { @@ -49,12 +49,12 @@ public Scp914KnobSetting KnobSetting } /// - /// Gets or sets a value indicating whether or not SCP-914's knob setting can be changed. + /// Gets or sets a value indicating whether or not SCP-914's knob setting can be changed. /// public bool IsAllowed { get; set; } /// - /// Gets the player who's changing the SCP-914 knob setting. + /// Gets the player who's changing the SCP-914 knob setting. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Scp914/UpgradingInventoryItemEventArgs.cs b/Exiled.Events/EventArgs/Scp914/UpgradingInventoryItemEventArgs.cs index 14c7a8941f..8dd471a7fd 100644 --- a/Exiled.Events/EventArgs/Scp914/UpgradingInventoryItemEventArgs.cs +++ b/Exiled.Events/EventArgs/Scp914/UpgradingInventoryItemEventArgs.cs @@ -7,38 +7,36 @@ namespace Exiled.Events.EventArgs.Scp914 { + using System; + using API.Features; using API.Features.Items; - using global::Scp914; - using Interfaces; - using InventorySystem.Items; /// - /// Contains all information before SCP-914 upgrades an item. + /// Contains all information before SCP-914 upgrades an item. /// public class UpgradingInventoryItemEventArgs : IPlayerEvent, IItemEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public UpgradingInventoryItemEventArgs(Player player, ItemBase item, Scp914KnobSetting knobSetting, bool isAllowed = true) { - Scp914 = API.Features.Scp914.Scp914Controller; Player = player; Item = Item.Get(item); KnobSetting = knobSetting; @@ -46,27 +44,28 @@ public UpgradingInventoryItemEventArgs(Player player, ItemBase item, Scp914KnobS } /// - /// Gets the instance. + /// Gets the instance. /// - public Scp914Controller Scp914 { get; } + [Obsolete("Use Scp914::Scp914Controller instead.")] + public Scp914Controller Scp914 => API.Features.Scp914.Scp914Controller; /// - /// Gets or sets SCP-914 working knob setting. + /// Gets or sets SCP-914 working knob setting. /// public Scp914KnobSetting KnobSetting { get; set; } /// - /// Gets or sets a value indicating whether or not the upgrade is successful. + /// Gets or sets a value indicating whether or not the upgrade is successful. /// public bool IsAllowed { get; set; } /// - /// Gets a list of items to be upgraded inside SCP-914. + /// Gets a list of items to be upgraded inside SCP-914. /// public Item Item { get; } /// - /// Gets the who owns the item to be upgraded. + /// Gets the who owns the item to be upgraded. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Scp914/UpgradingPickupEventArgs.cs b/Exiled.Events/EventArgs/Scp914/UpgradingPickupEventArgs.cs index 23e6768a1f..22744d5885 100644 --- a/Exiled.Events/EventArgs/Scp914/UpgradingPickupEventArgs.cs +++ b/Exiled.Events/EventArgs/Scp914/UpgradingPickupEventArgs.cs @@ -7,62 +7,61 @@ namespace Exiled.Events.EventArgs.Scp914 { + using System; + using Exiled.API.Features.Pickups; using Exiled.Events.EventArgs.Interfaces; - using global::Scp914; - using InventorySystem.Items.Pickups; - using UnityEngine; /// - /// Contains all information before SCP-914 upgrades an item. + /// Contains all information before SCP-914 upgrades an item. /// public class UpgradingPickupEventArgs : IPickupEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public UpgradingPickupEventArgs(ItemPickupBase item, Vector3 newPos, Scp914KnobSetting knobSetting) { - Scp914 = API.Features.Scp914.Scp914Controller; Pickup = Pickup.Get(item); OutputPosition = newPos; KnobSetting = knobSetting; } /// - /// Gets a list of items to be upgraded inside SCP-914. + /// Gets a list of items to be upgraded inside SCP-914. /// public Pickup Pickup { get; } /// - /// Gets the instance. + /// Gets the instance. /// - public Scp914Controller Scp914 { get; } + [Obsolete("Use Scp914::Scp914Controller instead.")] + public Scp914Controller Scp914 => API.Features.Scp914.Scp914Controller; /// - /// Gets or sets the position the item will be output to. + /// Gets or sets the position the item will be output to. /// public Vector3 OutputPosition { get; set; } /// - /// Gets or sets SCP-914 working knob setting. + /// Gets or sets SCP-914 working knob setting. /// public Scp914KnobSetting KnobSetting { get; set; } /// - /// Gets or sets a value indicating whether or not the upgrade is successful. + /// Gets or sets a value indicating whether or not the upgrade is successful. /// public bool IsAllowed { get; set; } = true; } diff --git a/Exiled.Events/EventArgs/Scp914/UpgradingPlayerEventArgs.cs b/Exiled.Events/EventArgs/Scp914/UpgradingPlayerEventArgs.cs index 94fd7b730c..41ef533478 100644 --- a/Exiled.Events/EventArgs/Scp914/UpgradingPlayerEventArgs.cs +++ b/Exiled.Events/EventArgs/Scp914/UpgradingPlayerEventArgs.cs @@ -16,23 +16,23 @@ namespace Exiled.Events.EventArgs.Scp914 using UnityEngine; /// - /// Contains all information before SCP-914 upgrades a player. + /// Contains all information before SCP-914 upgrades a player. /// public class UpgradingPlayerEventArgs : IPlayerEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The being upgraded. /// - /// + /// /// /// The being used. /// - /// + /// /// /// - /// + /// /// public UpgradingPlayerEventArgs(Player player, bool upgradeItems, bool heldOnly, Scp914KnobSetting setting, Vector3 moveVector) { @@ -44,32 +44,32 @@ public UpgradingPlayerEventArgs(Player player, bool upgradeItems, bool heldOnly, } /// - /// Gets or sets the location the player will be teleported to. + /// Gets or sets the location the player will be teleported to. /// public Vector3 OutputPosition { get; set; } /// - /// Gets or sets a value indicating whether or not items will be upgraded. + /// Gets or sets a value indicating whether or not items will be upgraded. /// public bool UpgradeItems { get; set; } /// - /// Gets or sets a value indicating whether or not only held items are upgraded. + /// Gets or sets a value indicating whether or not only held items are upgraded. /// public bool HeldOnly { get; set; } /// - /// Gets or sets the being used. + /// Gets or sets the being used. /// public Scp914KnobSetting KnobSetting { get; set; } /// - /// Gets or sets a value indicating whether or not the event can continue. + /// Gets or sets a value indicating whether or not the event can continue. /// public bool IsAllowed { get; set; } = true; /// - /// Gets the player that is being upgraded. + /// Gets the player that is being upgraded. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Scp939/ChangingFocusEventArgs.cs b/Exiled.Events/EventArgs/Scp939/ChangingFocusEventArgs.cs index 0d7e4f3bb4..ec3c29433b 100644 --- a/Exiled.Events/EventArgs/Scp939/ChangingFocusEventArgs.cs +++ b/Exiled.Events/EventArgs/Scp939/ChangingFocusEventArgs.cs @@ -12,21 +12,21 @@ namespace Exiled.Events.EventArgs.Scp939 using Interfaces; /// - /// Contains all information before SCP-939 changes its target focus. + /// Contains all information before SCP-939 changes its target focus. /// public class ChangingFocusEventArgs : IScp939Event, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// The state of the focus. + /// The state of the focus. /// /// - /// + /// /// public ChangingFocusEventArgs(ReferenceHub player, bool state, bool isAllowed = true) { @@ -37,17 +37,17 @@ public ChangingFocusEventArgs(ReferenceHub player, bool state, bool isAllowed = } /// - /// Gets or sets a value indicating whether or not SCP-939 can focus. + /// Gets or sets a value indicating whether or not SCP-939 can focus. /// public bool IsAllowed { get; set; } /// - /// Gets a value indicating whether or not SCP-939 is currently focusing or un-focusing. + /// Gets a value indicating whether or not SCP-939 is currently focusing or un-focusing. /// public bool State { get; } /// - /// Gets the player who's controlling SCP-939. + /// Gets the player who's controlling SCP-939. /// public Player Player { get; } diff --git a/Exiled.Events/EventArgs/Scp939/LungingEventArgs.cs b/Exiled.Events/EventArgs/Scp939/LungingEventArgs.cs index a23ae25ea0..9540051400 100644 --- a/Exiled.Events/EventArgs/Scp939/LungingEventArgs.cs +++ b/Exiled.Events/EventArgs/Scp939/LungingEventArgs.cs @@ -12,15 +12,15 @@ namespace Exiled.Events.EventArgs.Scp939 using Interfaces; /// - /// Contains all information before SCP-939 uses its lunge ability. + /// Contains all information before SCP-939 uses its lunge ability. /// public class LungingEventArgs : IScp939Event { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// public LungingEventArgs(Player player) { @@ -29,7 +29,7 @@ public LungingEventArgs(Player player) } /// - /// Gets the player who's controlling SCP-939. + /// Gets the player who's controlling SCP-939. /// public Player Player { get; } diff --git a/Exiled.Events/EventArgs/Scp939/PlacingAmnesticCloudEventArgs.cs b/Exiled.Events/EventArgs/Scp939/PlacingAmnesticCloudEventArgs.cs index 34ef7041f5..e8b2c72f59 100644 --- a/Exiled.Events/EventArgs/Scp939/PlacingAmnesticCloudEventArgs.cs +++ b/Exiled.Events/EventArgs/Scp939/PlacingAmnesticCloudEventArgs.cs @@ -12,27 +12,27 @@ namespace Exiled.Events.EventArgs.Scp939 using Interfaces; /// - /// Contains all information before SCP-939 uses its amnestic cloud ability. + /// Contains all information before SCP-939 uses its amnestic cloud ability. /// public class PlacingAmnesticCloudEventArgs : IScp939Event, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// Whether or not SCP-939 is attempting to place an amnestic cloud. + /// Whether or not SCP-939 is attempting to place an amnestic cloud. /// /// - /// Whether or not the cooldown is ready. + /// Whether or not the cooldown is ready. /// /// - /// SCP-939's amnestic cloud cooldown. + /// SCP-939's amnestic cloud cooldown. /// /// - /// + /// /// public PlacingAmnesticCloudEventArgs(Player player, bool state, bool isReady, float cooldown, bool isAllowed = true) { @@ -45,27 +45,27 @@ public PlacingAmnesticCloudEventArgs(Player player, bool state, bool isReady, fl } /// - /// Gets or sets a value indicating whether or not SCP-939 can place an amnestic cloud. + /// Gets or sets a value indicating whether or not SCP-939 can place an amnestic cloud. /// public bool IsAllowed { get; set; } /// - /// Gets a value indicating whether or not SCP-939 is ready to place its amnestic cloud. + /// Gets a value indicating whether or not SCP-939 is ready to place its amnestic cloud. /// public bool State { get; } /// - /// Gets or sets a value indicating whether or not SCP-939's amnestic cloud cooldown is ready. + /// Gets or sets a value indicating whether or not SCP-939's amnestic cloud cooldown is ready. /// public bool IsReady { get; set; } /// - /// Gets or sets a value indicating SCP-939's amnestic cloud cooldown. + /// Gets or sets a value indicating SCP-939's amnestic cloud cooldown. /// public float Cooldown { get; set; } /// - /// Gets the player who's controlling SCP-939. + /// Gets the player who's controlling SCP-939. /// public Player Player { get; } diff --git a/Exiled.Events/EventArgs/Scp939/PlayingSoundEventArgs.cs b/Exiled.Events/EventArgs/Scp939/PlayingSoundEventArgs.cs index b3f28a6cf2..7502be5fbf 100644 --- a/Exiled.Events/EventArgs/Scp939/PlayingSoundEventArgs.cs +++ b/Exiled.Events/EventArgs/Scp939/PlayingSoundEventArgs.cs @@ -13,27 +13,27 @@ namespace Exiled.Events.EventArgs.Scp939 using PlayerRoles.PlayableScps.Scp939.Mimicry; /// - /// Contains all information before SCP-939 plays a sound effect. + /// Contains all information before SCP-939 plays a sound effect. /// public class PlayingSoundEventArgs : IScp939Event, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// The sound that is being played. + /// The sound that is being played. /// /// - /// Whether or not SCP-939's environmental mimicry cooldown is ready. + /// Whether or not SCP-939's environmental mimicry cooldown is ready. /// /// - /// The cooldown of the environmental mimicry. + /// The cooldown of the environmental mimicry. /// /// - /// + /// /// public PlayingSoundEventArgs(Player player, EnvMimicrySequence sound, bool isReady, float cooldown, bool isAllowed = true) { @@ -46,28 +46,28 @@ public PlayingSoundEventArgs(Player player, EnvMimicrySequence sound, bool isRea } /// - /// Gets or sets a value indicating whether or not SCP-939 can play the sound. + /// Gets or sets a value indicating whether or not SCP-939 can play the sound. /// /// This will default to if is . In this case, setting it to will override the cooldown. public bool IsAllowed { get; set; } /// - /// Gets the sound being played. + /// Gets the sound being played. /// public EnvMimicrySequence Sound { get; } /// - /// Gets a value indicating whether or not SCP-939's environmental mimicry cooldown is ready. + /// Gets a value indicating whether or not SCP-939's environmental mimicry cooldown is ready. /// public bool IsReady { get; } /// - /// Gets or sets a value indicating SCP-939's environmental mimicry cooldown. + /// Gets or sets a value indicating SCP-939's environmental mimicry cooldown. /// public float Cooldown { get; set; } /// - /// Gets the player who's controlling SCP-939. + /// Gets the player who's controlling SCP-939. /// public Player Player { get; } diff --git a/Exiled.Events/EventArgs/Scp939/PlayingVoiceEventArgs.cs b/Exiled.Events/EventArgs/Scp939/PlayingVoiceEventArgs.cs index cba8a9b257..5b8dfdd374 100644 --- a/Exiled.Events/EventArgs/Scp939/PlayingVoiceEventArgs.cs +++ b/Exiled.Events/EventArgs/Scp939/PlayingVoiceEventArgs.cs @@ -12,18 +12,18 @@ namespace Exiled.Events.EventArgs.Scp939 using Interfaces; /// - /// Contains all information before SCP-939 plays a stolen player's voice. + /// Contains all information before SCP-939 plays a stolen player's voice. /// public class PlayingVoiceEventArgs : IScp939Event, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// The player who's voice was stolen. + /// The player who's voice was stolen. /// public PlayingVoiceEventArgs(ReferenceHub player, ReferenceHub stolen) { @@ -33,17 +33,17 @@ public PlayingVoiceEventArgs(ReferenceHub player, ReferenceHub stolen) } /// - /// Gets or sets a value indicating whether or not SCP-939 can play the stolen voice. + /// Gets or sets a value indicating whether or not SCP-939 can play the stolen voice. /// public bool IsAllowed { get; set; } = true; /// - /// Gets the players who's voice was stolen. + /// Gets the players who's voice was stolen. /// public Player Stolen { get; } /// - /// Gets the player who's controlling SCP-939. + /// Gets the player who's controlling SCP-939. /// public Player Player { get; } diff --git a/Exiled.Events/EventArgs/Scp939/SavingVoiceEventArgs.cs b/Exiled.Events/EventArgs/Scp939/SavingVoiceEventArgs.cs index 08f78eafa9..6f6381430e 100644 --- a/Exiled.Events/EventArgs/Scp939/SavingVoiceEventArgs.cs +++ b/Exiled.Events/EventArgs/Scp939/SavingVoiceEventArgs.cs @@ -12,21 +12,21 @@ namespace Exiled.Events.EventArgs.Scp939 using Interfaces; /// - /// Contains all information before SCP-939 plays a stolen player's voice. + /// Contains all information before SCP-939 plays a stolen player's voice. /// public class SavingVoiceEventArgs : IScp939Event, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// The player who's voice was stolen. + /// The player who's voice was stolen. /// /// - /// + /// /// public SavingVoiceEventArgs(ReferenceHub player, ReferenceHub stolen, bool isAllowed = true) { @@ -37,17 +37,17 @@ public SavingVoiceEventArgs(ReferenceHub player, ReferenceHub stolen, bool isAll } /// - /// Gets or sets a value indicating whether or not SCP-939 can play the stolen voice. + /// Gets or sets a value indicating whether or not SCP-939 can play the stolen voice. /// public bool IsAllowed { get; set; } /// - /// Gets the players who's voice was stolen. + /// Gets the players who's voice was stolen. /// public Player Stolen { get; } /// - /// Gets the player who's controlling SCP-939. + /// Gets the player who's controlling SCP-939. /// public Player Player { get; } diff --git a/Exiled.Events/EventArgs/Scp939/ValidatingVisibilityEventArgs.cs b/Exiled.Events/EventArgs/Scp939/ValidatingVisibilityEventArgs.cs new file mode 100644 index 0000000000..3a2bd2a0ba --- /dev/null +++ b/Exiled.Events/EventArgs/Scp939/ValidatingVisibilityEventArgs.cs @@ -0,0 +1,57 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Events.EventArgs.Scp939 +{ + using API.Features; + using Exiled.API.Features.Roles; + using Interfaces; + + /// + /// Contains all information before SCP-939 sees the player. + /// + public class ValidatingVisibilityEventArgs : IScp939Event, IDeniableEvent + { + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// + /// + /// The target being shown to SCP-939. + /// + /// + /// Whether or not SCP-939 is allowed to view the player. + /// + public ValidatingVisibilityEventArgs(ReferenceHub player, ReferenceHub target, bool isAllowed) + { + Player = Player.Get(player); + Scp939 = Player.Role.As(); + Target = Player.Get(target); + IsAllowed = isAllowed; + } + + /// + /// Gets the player who's being shown to SCP-939. + /// + public Player Target { get; } + + /// + /// Gets the player who's controlling SCP-939. + /// + public Player Player { get; } + + /// + public Scp939Role Scp939 { get; } + + /// + /// Gets or sets a value indicating whether visibility can be validated. + /// + public bool IsAllowed { get; set; } + } +} \ No newline at end of file diff --git a/Exiled.Events/EventArgs/Server/ChoosingStartTeamQueueEventArgs.cs b/Exiled.Events/EventArgs/Server/ChoosingStartTeamQueueEventArgs.cs index a533c10efb..47d0180c8e 100644 --- a/Exiled.Events/EventArgs/Server/ChoosingStartTeamQueueEventArgs.cs +++ b/Exiled.Events/EventArgs/Server/ChoosingStartTeamQueueEventArgs.cs @@ -16,15 +16,15 @@ namespace Exiled.Events.EventArgs.Server using PlayerRoles; /// - /// Contains all information before a spectator changes the spectated player. + /// Contains all information before a spectator changes the spectated player. /// public class ChoosingStartTeamQueueEventArgs : IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// public ChoosingStartTeamQueueEventArgs(string teamRespawnQueue) { @@ -38,17 +38,17 @@ public ChoosingStartTeamQueueEventArgs(string teamRespawnQueue) } /// - /// Gets the TeamRespawnQueue. + /// Gets the TeamRespawnQueue. /// public List TeamRespawnQueue { get; } /// - /// Gets or sets a value indicating whether the event can continue. + /// Gets or sets a value indicating whether the event can continue. /// public bool IsAllowed { get; set; } = true; /// - /// Gets the TeamRespawnQueue in a string value. + /// Gets the TeamRespawnQueue in a string value. /// /// The actual modified TeamRespawnQueue. internal string GetTeamRespawnQueue() diff --git a/Exiled.Events/EventArgs/Server/EndingRoundEventArgs.cs b/Exiled.Events/EventArgs/Server/EndingRoundEventArgs.cs index a9e26d0cb8..d84ecaf7ac 100644 --- a/Exiled.Events/EventArgs/Server/EndingRoundEventArgs.cs +++ b/Exiled.Events/EventArgs/Server/EndingRoundEventArgs.cs @@ -13,24 +13,24 @@ namespace Exiled.Events.EventArgs.Server using Interfaces; /// - /// Contains all information before ending a round. + /// Contains all information before ending a round. /// public class EndingRoundEventArgs : IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public EndingRoundEventArgs(RoundSummary.LeadingTeam leadingTeam, RoundSummary.SumInfo_ClassList classList, bool isAllowed, bool isForceEnded) { @@ -41,27 +41,27 @@ public EndingRoundEventArgs(RoundSummary.LeadingTeam leadingTeam, RoundSummary.S } /// - /// Gets or sets the round summary class list. + /// Gets or sets the round summary class list. /// public RoundSummary.SumInfo_ClassList ClassList { get; set; } /// - /// Gets or sets the leading team. + /// Gets or sets the leading team. /// public LeadingTeam LeadingTeam { get; set; } /// - /// Gets or sets a value indicating whether the round is going to finish or not. + /// Gets or sets a value indicating whether the round is going to finish or not. /// public bool IsRoundEnded { get; set; } // TODO: Obsolete this in Exiled 10 /// - /// Gets or Sets a value indicating whether the round is ended by API call. + /// Gets or Sets a value indicating whether the round is ended by API call. /// public bool IsForceEnded { get; set; } /// - /// Gets or sets a value indicating whether the event can be executed or not. + /// Gets or sets a value indicating whether the event can be executed or not. /// public bool IsAllowed { diff --git a/Exiled.Events/EventArgs/Server/ReportingCheaterEventArgs.cs b/Exiled.Events/EventArgs/Server/ReportingCheaterEventArgs.cs index b805cfad8b..9bed3417e7 100644 --- a/Exiled.Events/EventArgs/Server/ReportingCheaterEventArgs.cs +++ b/Exiled.Events/EventArgs/Server/ReportingCheaterEventArgs.cs @@ -12,27 +12,27 @@ namespace Exiled.Events.EventArgs.Server using Interfaces; /// - /// Contains all information before reporting a cheater. + /// Contains all information before reporting a cheater. /// public class ReportingCheaterEventArgs : IPlayerEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public ReportingCheaterEventArgs(Player issuer, Player target, int serverPort, string reason, bool isAllowed = true) { @@ -44,27 +44,27 @@ public ReportingCheaterEventArgs(Player issuer, Player target, int serverPort, s } /// - /// Gets the targeted player. + /// Gets the targeted player. /// public Player Target { get; } /// - /// Gets the server id. + /// Gets the server id. /// public int ServerPort { get; } /// - /// Gets or sets the report reason. + /// Gets or sets the report reason. /// public string Reason { get; set; } /// - /// Gets or sets a value indicating whether or not the report will be sent. + /// Gets or sets a value indicating whether or not the report will be sent. /// public bool IsAllowed { get; set; } /// - /// Gets the issuing player. + /// Gets the issuing player. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Server/RespawningTeamEventArgs.cs b/Exiled.Events/EventArgs/Server/RespawningTeamEventArgs.cs index 6da3311c4d..0ea3641b53 100644 --- a/Exiled.Events/EventArgs/Server/RespawningTeamEventArgs.cs +++ b/Exiled.Events/EventArgs/Server/RespawningTeamEventArgs.cs @@ -17,8 +17,8 @@ namespace Exiled.Events.EventArgs.Server using Respawning; /// - /// Contains all information before spawning a wave of or - /// . + /// Contains all information before spawning a wave of or + /// . /// public class RespawningTeamEventArgs : IDeniableEvent { @@ -26,19 +26,19 @@ public class RespawningTeamEventArgs : IDeniableEvent private int maximumRespawnAmount; /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public RespawningTeamEventArgs(List players, int maxRespawn, SpawnableTeamType nextKnownTeam, bool isAllowed = true) { @@ -52,12 +52,12 @@ public RespawningTeamEventArgs(List players, int maxRespawn, SpawnableTe } /// - /// Gets the list of players that are going to be respawned. + /// Gets the list of players that are going to be respawned. /// public List Players { get; } /// - /// Gets or sets the maximum amount of respawnable players. + /// Gets or sets the maximum amount of respawnable players. /// public int MaximumRespawnAmount { @@ -75,7 +75,7 @@ public int MaximumRespawnAmount } /// - /// Gets or sets a value indicating what the next respawnable team is. + /// Gets or sets a value indicating what the next respawnable team is. /// public SpawnableTeamType NextKnownTeam { @@ -97,13 +97,13 @@ public SpawnableTeamType NextKnownTeam } /// - /// Gets the current spawnable team. + /// Gets the current spawnable team. /// public SpawnableTeamHandlerBase SpawnableTeam => RespawnManager.SpawnableTeams.TryGetValue(NextKnownTeam, out SpawnableTeamHandlerBase @base) ? @base : null; /// - /// Gets or sets a value indicating whether or not the spawn can occur. + /// Gets or sets a value indicating whether or not the spawn can occur. /// public bool IsAllowed { get; set; } diff --git a/Exiled.Events/EventArgs/Server/RoundEndedEventArgs.cs b/Exiled.Events/EventArgs/Server/RoundEndedEventArgs.cs index cafd5251df..6536962f86 100644 --- a/Exiled.Events/EventArgs/Server/RoundEndedEventArgs.cs +++ b/Exiled.Events/EventArgs/Server/RoundEndedEventArgs.cs @@ -12,21 +12,21 @@ namespace Exiled.Events.EventArgs.Server using Interfaces; /// - /// Contains all information after the end of a round. + /// Contains all information after the end of a round. /// public class RoundEndedEventArgs : IExiledEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public RoundEndedEventArgs(LeadingTeam leadingTeam, RoundSummary.SumInfo_ClassList classList, int timeToRestart) { @@ -36,17 +36,17 @@ public RoundEndedEventArgs(LeadingTeam leadingTeam, RoundSummary.SumInfo_ClassLi } /// - /// Gets the leading team. + /// Gets the leading team. /// public LeadingTeam LeadingTeam { get; } /// - /// Gets or sets the round summary class list. + /// Gets or sets the round summary class list. /// public RoundSummary.SumInfo_ClassList ClassList { get; set; } /// - /// Gets or sets the time to restart the next round. + /// Gets or sets the time to restart the next round. /// public int TimeToRestart { get; set; } } diff --git a/Exiled.Events/EventArgs/Server/SelectingRespawnTeamEventArgs.cs b/Exiled.Events/EventArgs/Server/SelectingRespawnTeamEventArgs.cs new file mode 100644 index 0000000000..3c3b87de57 --- /dev/null +++ b/Exiled.Events/EventArgs/Server/SelectingRespawnTeamEventArgs.cs @@ -0,0 +1,35 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Events.EventArgs.Server +{ + using System; + + using Exiled.API.Features; + using Exiled.Events.EventArgs.Interfaces; + using Respawning; + + /// + /// Contains all information before selecting the team to respawn next. + /// + public class SelectingRespawnTeamEventArgs : IExiledEvent + { + /// + /// Initializes a new instance of the class. + /// + /// The used as the starting value for this event. + public SelectingRespawnTeamEventArgs(SpawnableTeamType type) + { + Team = type; + } + + /// + /// Gets or sets that represents the team chosen to spawn. + /// + public SpawnableTeamType Team { get; set; } + } +} \ No newline at end of file diff --git a/Exiled.Events/EventArgs/Warhead/ChangingLeverStatusEventArgs.cs b/Exiled.Events/EventArgs/Warhead/ChangingLeverStatusEventArgs.cs index e0b7dada79..1caac039f6 100644 --- a/Exiled.Events/EventArgs/Warhead/ChangingLeverStatusEventArgs.cs +++ b/Exiled.Events/EventArgs/Warhead/ChangingLeverStatusEventArgs.cs @@ -12,21 +12,21 @@ namespace Exiled.Events.EventArgs.Warhead using Interfaces; /// - /// Contains all information before a player changes the warhead lever status. + /// Contains all information before a player changes the warhead lever status. /// public class ChangingLeverStatusEventArgs : IPlayerEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// /// - /// + /// /// public ChangingLeverStatusEventArgs(Player player, bool curState, bool isAllowed = true) { @@ -36,17 +36,17 @@ public ChangingLeverStatusEventArgs(Player player, bool curState, bool isAllowed } /// - /// Gets a value indicating whether the lever is enabled. + /// Gets a value indicating whether the lever is enabled. /// public bool CurrentState { get; } /// - /// Gets or sets a value indicating whether or not the lever status will change. + /// Gets or sets a value indicating whether or not the lever status will change. /// public bool IsAllowed { get; set; } /// - /// Gets the player who's changing the warhead status. + /// Gets the player who's changing the warhead status. /// public Player Player { get; } } diff --git a/Exiled.Events/EventArgs/Warhead/DetonatingEventArgs.cs b/Exiled.Events/EventArgs/Warhead/DetonatingEventArgs.cs index 4dd825f940..b6b25bf286 100644 --- a/Exiled.Events/EventArgs/Warhead/DetonatingEventArgs.cs +++ b/Exiled.Events/EventArgs/Warhead/DetonatingEventArgs.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.EventArgs.Warhead using Exiled.Events.EventArgs.Interfaces; /// - /// Contains all information before detonating the warhead. + /// Contains all information before detonating the warhead. /// public class DetonatingEventArgs : IDeniableEvent { diff --git a/Exiled.Events/EventArgs/Warhead/StartingEventArgs.cs b/Exiled.Events/EventArgs/Warhead/StartingEventArgs.cs index 030802121d..be6f6f2fdf 100644 --- a/Exiled.Events/EventArgs/Warhead/StartingEventArgs.cs +++ b/Exiled.Events/EventArgs/Warhead/StartingEventArgs.cs @@ -10,12 +10,12 @@ namespace Exiled.Events.EventArgs.Warhead using Exiled.API.Features; /// - /// Contains all information before starting the warhead. + /// Contains all information before starting the warhead. /// public class StartingEventArgs : StoppingEventArgs { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// The player who's going to start the warhead. /// Indicating whether or not the nuke was set off automatically. @@ -27,7 +27,7 @@ public StartingEventArgs(Player player, bool isAuto, bool isAllowed = true) } /// - /// Gets or sets a value indicating whether or not the nuke was set off automatically. + /// Gets or sets a value indicating whether or not the nuke was set off automatically. /// public bool IsAuto { get; set; } } diff --git a/Exiled.Events/EventArgs/Warhead/StoppingEventArgs.cs b/Exiled.Events/EventArgs/Warhead/StoppingEventArgs.cs index c6c23413a6..57d1dd1bba 100644 --- a/Exiled.Events/EventArgs/Warhead/StoppingEventArgs.cs +++ b/Exiled.Events/EventArgs/Warhead/StoppingEventArgs.cs @@ -12,18 +12,18 @@ namespace Exiled.Events.EventArgs.Warhead using Interfaces; /// - /// Contains all information before stopping the warhead. + /// Contains all information before stopping the warhead. /// public class StoppingEventArgs : IPlayerEvent, IDeniableEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - /// + /// /// /// - /// + /// /// public StoppingEventArgs(Player player, bool isAllowed = true) { @@ -32,12 +32,12 @@ public StoppingEventArgs(Player player, bool isAllowed = true) } /// - /// Gets or sets a value indicating whether or not the warhead can be stopped. + /// Gets or sets a value indicating whether or not the warhead can be stopped. /// public bool IsAllowed { get; set; } /// - /// Gets the player who's going to stop the warhead. + /// Gets the player who's going to stop the warhead. /// public Player Player { get; } } diff --git a/Exiled.Events/Events.cs b/Exiled.Events/Events.cs index af40330c7d..fee31f0c9d 100644 --- a/Exiled.Events/Events.cs +++ b/Exiled.Events/Events.cs @@ -60,7 +60,7 @@ public override void OnEnabled() SceneManager.sceneUnloaded += Handlers.Internal.SceneUnloaded.OnSceneUnloaded; MapGeneration.SeedSynchronizer.OnMapGenerated += Handlers.Internal.MapGenerated.OnMapGenerated; - UsableItemsController.ServerOnUsingCompleted += (hub, usable) => Handlers.Player.OnUsedItem(new(hub, usable)); + UsableItemsController.ServerOnUsingCompleted += Handlers.Internal.Round.OnServerOnUsingCompleted; Handlers.Server.WaitingForPlayers += Handlers.Internal.Round.OnWaitingForPlayers; Handlers.Server.RestartingRound += Handlers.Internal.Round.OnRestartingRound; Handlers.Server.RoundStarted += Handlers.Internal.Round.OnRoundStarted; @@ -91,8 +91,8 @@ public override void OnDisabled() Unpatch(); SceneManager.sceneUnloaded -= Handlers.Internal.SceneUnloaded.OnSceneUnloaded; - MapGeneration.SeedSynchronizer.OnMapGenerated -= Handlers.Map.OnGenerated; - + MapGeneration.SeedSynchronizer.OnMapGenerated -= Handlers.Internal.MapGenerated.OnMapGenerated; + UsableItemsController.ServerOnUsingCompleted -= Handlers.Internal.Round.OnServerOnUsingCompleted; Handlers.Server.WaitingForPlayers -= Handlers.Internal.Round.OnWaitingForPlayers; Handlers.Server.RestartingRound -= Handlers.Internal.Round.OnRestartingRound; Handlers.Server.RoundStarted -= Handlers.Internal.Round.OnRoundStarted; diff --git a/Exiled.Events/Features/Event.cs b/Exiled.Events/Features/Event.cs index 141def259f..c27c657030 100644 --- a/Exiled.Events/Features/Event.cs +++ b/Exiled.Events/Features/Event.cs @@ -13,12 +13,19 @@ namespace Exiled.Events.Features using Exiled.API.Features; using Exiled.Events.EventArgs.Interfaces; + using MEC; /// /// The custom delegate, with empty parameters. /// public delegate void CustomEventHandler(); + /// + /// THe custom delegate, with empty parameters. Holds async events with . + /// + /// of . + public delegate IEnumerator CustomAsyncEventHandler(); + /// /// An implementation of that encapsulates a no-argument event. /// @@ -38,6 +45,8 @@ public Event() private event CustomEventHandler InnerEvent; + private event CustomAsyncEventHandler InnerAsyncEvent; + /// /// Gets a of which contains all the instances. /// @@ -55,6 +64,18 @@ public Event() return @event; } + /// + /// Subscribes a to the inner event, and checks patches if dynamic patching is enabled. + /// + /// The to subscribe the to. + /// The to subscribe to the . + /// The with the handler added to it. + public static Event operator +(Event @event, CustomAsyncEventHandler asyncEventHandler) + { + @event.Subscribe(asyncEventHandler); + return @event; + } + /// /// Unsubscribes a target from the inner event, and checks if unpatching is possible, if dynamic patching is enabled. /// @@ -67,6 +88,18 @@ public Event() return @event; } + /// + /// Unsubscribes a target from the inner event, and checks if unpatching is possible, if dynamic patching is enabled. + /// + /// The the will be unsubscribed from. + /// The that will be unsubscribed from the . + /// The with the handler unsubscribed from it. + public static Event operator -(Event @event, CustomAsyncEventHandler asyncEventHandler) + { + @event.Unsubscribe(asyncEventHandler); + return @event; + } + /// /// Subscribes a target to the inner event if the conditional is true. /// @@ -84,6 +117,23 @@ public void Subscribe(CustomEventHandler handler) InnerEvent += handler; } + /// + /// Subscribes a target to the inner event if the conditional is true. + /// + /// The handler to add. + public void Subscribe(CustomAsyncEventHandler handler) + { + Log.Assert(Events.Instance is not null, $"{nameof(Events.Instance)} is null, please ensure you have exiled_events enabled!"); + + if (Events.Instance.Config.UseDynamicPatching && !patched) + { + Events.Instance.Patcher.Patch(this); + patched = true; + } + + InnerAsyncEvent += handler; + } + /// /// Unsubscribes a target from the inner event if the conditional is true. /// @@ -93,10 +143,26 @@ public void Unsubscribe(CustomEventHandler handler) InnerEvent -= handler; } + /// + /// Unsubscribes a target from the inner event if the conditional is true. + /// + /// The handler to add. + public void Unsubscribe(CustomAsyncEventHandler handler) + { + InnerAsyncEvent -= handler; + } + /// /// Executes all listeners safely. /// public void InvokeSafely() + { + InvokeNormal(); + InvokeAsync(); + } + + /// + internal void InvokeNormal() { if (InnerEvent is null) return; @@ -113,5 +179,24 @@ public void InvokeSafely() } } } + + /// + internal void InvokeAsync() + { + if (InnerAsyncEvent is null) + return; + + foreach (CustomAsyncEventHandler handler in InnerAsyncEvent.GetInvocationList().Cast()) + { + try + { + Timing.RunCoroutine(handler()); + } + catch (Exception ex) + { + Log.Error($"Method \"{handler.Method.Name}\" of the class \"{handler.Method.ReflectedType.FullName}\" caused an exception when handling the event \"{GetType().FullName}\"\n{ex}"); + } + } + } } } diff --git a/Exiled.Events/Features/Event{T}.cs b/Exiled.Events/Features/Event{T}.cs index f8ea5f51fd..8cbd180544 100644 --- a/Exiled.Events/Features/Event{T}.cs +++ b/Exiled.Events/Features/Event{T}.cs @@ -13,6 +13,7 @@ namespace Exiled.Events.Features using Exiled.API.Features; using Exiled.Events.EventArgs.Interfaces; + using MEC; /// /// The custom delegate. @@ -21,6 +22,14 @@ namespace Exiled.Events.Features /// The instance. public delegate void CustomEventHandler(TEventArgs ev); + /// + /// The custom delegate. + /// + /// The type. + /// The instance. + /// of . + public delegate IEnumerator CustomAsyncEventHandler(TEventArgs ev); + /// /// An implementation of the interface that encapsulates an event with arguments. /// @@ -41,6 +50,8 @@ public Event() private event CustomEventHandler InnerEvent; + private event CustomAsyncEventHandler InnerAsyncEvent; + /// /// Gets a of which contains all the instances. /// @@ -58,6 +69,18 @@ public Event() return @event; } + /// + /// Subscribes a to the inner event, and checks patches if dynamic patching is enabled. + /// + /// The to subscribe the to. + /// The to subscribe to the . + /// The with the handler added to it. + public static Event operator +(Event @event, CustomAsyncEventHandler asyncEventHandler) + { + @event.Subscribe(asyncEventHandler); + return @event; + } + /// /// Unsubscribes a target from the inner event and checks if unpatching is possible, if dynamic patching is enabled. /// @@ -70,6 +93,18 @@ public Event() return @event; } + /// + /// Unsubscribes a target from the inner event, and checks if unpatching is possible, if dynamic patching is enabled. + /// + /// The the will be unsubscribed from. + /// The that will be unsubscribed from the . + /// The with the handler unsubscribed from it. + public static Event operator -(Event @event, CustomAsyncEventHandler asyncEventHandler) + { + @event.Unsubscribe(asyncEventHandler); + return @event; + } + /// /// Subscribes a target to the inner event if the conditional is true. /// @@ -87,6 +122,23 @@ public void Subscribe(CustomEventHandler handler) InnerEvent += handler; } + /// + /// Subscribes a target to the inner event if the conditional is true. + /// + /// The handler to add. + public void Subscribe(CustomAsyncEventHandler handler) + { + Log.Assert(Events.Instance is not null, $"{nameof(Events.Instance)} is null, please ensure you have exiled_events enabled!"); + + if (Events.Instance.Config.UseDynamicPatching && !patched) + { + Events.Instance.Patcher.Patch(this); + patched = true; + } + + InnerAsyncEvent += handler; + } + /// /// Unsubscribes a target from the inner event if the conditional is true. /// @@ -96,12 +148,28 @@ public void Unsubscribe(CustomEventHandler handler) InnerEvent -= handler; } + /// + /// Unsubscribes a target from the inner event if the conditional is true. + /// + /// The handler to add. + public void Unsubscribe(CustomAsyncEventHandler handler) + { + InnerAsyncEvent -= handler; + } + /// /// Executes all listeners safely. /// /// The event argument. /// Event or its arg is . public void InvokeSafely(T arg) + { + InvokeNormal(arg); + InvokeAsync(arg); + } + + /// + internal void InvokeNormal(T arg) { if (InnerEvent is null) return; @@ -118,5 +186,24 @@ public void InvokeSafely(T arg) } } } + + /// + internal void InvokeAsync(T arg) + { + if (InnerAsyncEvent is null) + return; + + foreach (CustomAsyncEventHandler handler in InnerAsyncEvent.GetInvocationList().Cast>()) + { + try + { + Timing.RunCoroutine(handler(arg)); + } + catch (Exception ex) + { + Log.Error($"Method \"{handler.Method.Name}\" of the class \"{handler.Method.ReflectedType.FullName}\" caused an exception when handling the event \"{GetType().FullName}\"\n{ex}"); + } + } + } } } diff --git a/Exiled.Events/Handlers/Cassie.cs b/Exiled.Events/Handlers/Cassie.cs index aa2748e851..9d2ca857f1 100644 --- a/Exiled.Events/Handlers/Cassie.cs +++ b/Exiled.Events/Handlers/Cassie.cs @@ -11,7 +11,7 @@ namespace Exiled.Events.Handlers using Exiled.Events.Features; /// - /// Cassie related events. + /// Cassie related events. /// public static class Cassie { @@ -23,7 +23,7 @@ public static class Cassie public static Event SendingCassieMessage { get; set; } = new(); /// - /// Called before sending a cassie message. + /// Called before sending a cassie message. /// /// The instance. public static void OnSendingCassieMessage(SendingCassieMessageEventArgs ev) => SendingCassieMessage.InvokeSafely(ev); diff --git a/Exiled.Events/Handlers/Internal/Round.cs b/Exiled.Events/Handlers/Internal/Round.cs index ac135727ac..5409fa67c9 100644 --- a/Exiled.Events/Handlers/Internal/Round.cs +++ b/Exiled.Events/Handlers/Internal/Round.cs @@ -16,15 +16,18 @@ namespace Exiled.Events.Handlers.Internal using Exiled.Loader.Features; using InventorySystem; - + using InventorySystem.Items.Usables; using PlayerRoles; using PlayerRoles.RoleAssign; /// - /// Handles some round clean-up events and some others related to players. + /// Handles some round clean-up events and some others related to players. /// internal static class Round { + /// + public static void OnServerOnUsingCompleted(ReferenceHub hub, UsableItem usable) => Handlers.Player.OnUsedItem(new (hub, usable)); + /// public static void OnWaitingForPlayers() { diff --git a/Exiled.Events/Handlers/Internal/SceneUnloaded.cs b/Exiled.Events/Handlers/Internal/SceneUnloaded.cs index 4626311b13..9bcb75cc85 100644 --- a/Exiled.Events/Handlers/Internal/SceneUnloaded.cs +++ b/Exiled.Events/Handlers/Internal/SceneUnloaded.cs @@ -15,21 +15,21 @@ namespace Exiled.Events.Handlers.Internal #pragma warning disable SA1313 // Parameter names should begin with lower-case letter /// - /// Handles scene unload event. + /// Handles scene unload event. /// internal static class SceneUnloaded { /// - /// Called once when the server changes the scene. + /// Called once when the server changes the scene. /// /// - /// This fixes the main issue with ghost mode, - /// when it spams with a NRE error. - /// Before that, we were clearing the cache - /// on WaitForPlayers event, but - /// sometimes (ordinally on silent rount restart) - /// the server accepts players' tokens before - /// WaitForPlayers event is called. + /// This fixes the main issue with ghost mode, + /// when it spams with a NRE error. + /// Before that, we were clearing the cache + /// on WaitForPlayers event, but + /// sometimes (ordinally on silent rount restart) + /// the server accepts players' tokens before + /// WaitForPlayers event is called. /// public static void OnSceneUnloaded(Scene _) { diff --git a/Exiled.Events/Handlers/Item.cs b/Exiled.Events/Handlers/Item.cs index 7ce1feee18..540c490223 100644 --- a/Exiled.Events/Handlers/Item.cs +++ b/Exiled.Events/Handlers/Item.cs @@ -14,22 +14,22 @@ namespace Exiled.Events.Handlers using Exiled.Events.Features; /// - /// Item related events. + /// Item related events. /// public static class Item { /// - /// Invoked before the ammo of an firearm are changed. + /// Invoked before the ammo of an firearm are changed. /// public static Event ChangingAmmo { get; set; } = new (); /// - /// Invoked before item attachments are changed. + /// Invoked before item attachments are changed. /// public static Event ChangingAttachments { get; set; } = new(); /// - /// Invoked before receiving a preference. + /// Invoked before receiving a preference. /// public static Event ReceivingPreference { get; set; } = new(); @@ -48,6 +48,11 @@ public static class Item /// public static Event ChargingJailbird { get; set; } = new(); + /// + /// Invoked before a radio pickup is draining battery. + /// + public static Event UsingRadioPickupBattery { get; set; } = new(); + /// /// Called before the ammo of an firearm is changed. /// @@ -55,13 +60,13 @@ public static class Item public static void OnChangingAmmo(ChangingAmmoEventArgs ev) => ChangingAmmo.InvokeSafely(ev); /// - /// Called before item attachments are changed. + /// Called before item attachments are changed. /// /// The instance. public static void OnChangingAttachments(ChangingAttachmentsEventArgs ev) => ChangingAttachments.InvokeSafely(ev); /// - /// Called before receiving a preference. + /// Called before receiving a preference. /// /// The instance. public static void OnReceivingPreference(ReceivingPreferenceEventArgs ev) => ReceivingPreference.InvokeSafely(ev); @@ -83,5 +88,11 @@ public static class Item ///
/// The instance. public static void OnChargingJailbird(ChargingJailbirdEventArgs ev) => ChargingJailbird.InvokeSafely(ev); + + /// + /// Called before radio pickup is draining battery. + /// + /// The instance. + public static void OnUsingRadioPickupBattery(UsingRadioPickupBatteryEventArgs ev) => UsingRadioPickupBattery.InvokeSafely(ev); } } \ No newline at end of file diff --git a/Exiled.Events/Handlers/Player.cs b/Exiled.Events/Handlers/Player.cs index 8830898d29..2bf468a020 100644 --- a/Exiled.Events/Handlers/Player.cs +++ b/Exiled.Events/Handlers/Player.cs @@ -452,6 +452,11 @@ public class Player ///
public static Event TogglingOverwatch { get; set; } = new(); + /// + /// Invoked before turning the on/off. + /// + public static Event TogglingRadio { get; set; } = new(); + /// /// Invoked before a searches a Pickup. /// @@ -905,6 +910,12 @@ public class Player /// The instance. public static void OnTogglingOverwatch(TogglingOverwatchEventArgs ev) => TogglingOverwatch.InvokeSafely(ev); + /// + /// Called before turning the radio on/off. + /// + /// The instance. + public static void OnTogglingRadio(TogglingRadioEventArgs ev) => TogglingRadio.InvokeSafely(ev); + /// /// Called before a searches a Pickup. /// diff --git a/Exiled.Events/Handlers/Scp049.cs b/Exiled.Events/Handlers/Scp049.cs index 9b26e590bd..62f4766dce 100644 --- a/Exiled.Events/Handlers/Scp049.cs +++ b/Exiled.Events/Handlers/Scp049.cs @@ -13,27 +13,27 @@ namespace Exiled.Events.Handlers using Exiled.Events.Features; /// - /// SCP-049 related events. + /// SCP-049 related events. /// public static class Scp049 { /// - /// Invoked before SCP-049 finishes reviving a player. + /// Invoked before SCP-049 finishes reviving a player. /// public static Event FinishingRecall { get; set; } = new(); /// - /// Invoked before SCP-049 begins reviving a player. + /// Invoked before SCP-049 begins reviving a player. /// public static Event StartingRecall { get; set; } = new(); /// - /// Invoked before SCP-049 uses the good sense of the doctor ability. + /// Invoked before SCP-049 uses the good sense of the doctor ability. /// public static Event ActivatingSense { get; set; } = new(); /// - /// Invoked before SCP-049 uses the call ability. + /// Invoked before SCP-049 uses the call ability. /// public static Event SendingCall { get; set; } = new(); @@ -43,25 +43,25 @@ public static class Scp049 public static Event Attacking { get; set; } = new(); /// - /// Called before SCP-049 finishes reviving a player. + /// Called before SCP-049 finishes reviving a player. /// /// The instance. public static void OnFinishingRecall(FinishingRecallEventArgs ev) => FinishingRecall.InvokeSafely(ev); /// - /// Called before SCP-049 starts to revive a player. + /// Called before SCP-049 starts to revive a player. /// /// The instance. public static void OnStartingRecall(StartingRecallEventArgs ev) => StartingRecall.InvokeSafely(ev); /// - /// Called before SCP-049 starts the good sense of the doctor ability. + /// Called before SCP-049 starts the good sense of the doctor ability. /// /// The instance. public static void OnActivatingSense(ActivatingSenseEventArgs ev) => ActivatingSense.InvokeSafely(ev); /// - /// Called before SCP-049 starts the call ability. + /// Called before SCP-049 starts the call ability. /// /// The instance. public static void OnSendingCall(SendingCallEventArgs ev) => SendingCall.InvokeSafely(ev); diff --git a/Exiled.Events/Handlers/Scp079.cs b/Exiled.Events/Handlers/Scp079.cs index 41cc1fd49c..85da2da7e5 100644 --- a/Exiled.Events/Handlers/Scp079.cs +++ b/Exiled.Events/Handlers/Scp079.cs @@ -13,138 +13,138 @@ namespace Exiled.Events.Handlers using Exiled.Events.Features; /// - /// SCP-079 related events. + /// SCP-079 related events. /// public static class Scp079 { /// - /// Invoked before SCP-079 switches cameras. + /// Invoked before SCP-079 switches cameras. /// public static Event ChangingCamera { get; set; } = new(); /// - /// Invoked before gaining experience with SCP-079. + /// Invoked before gaining experience with SCP-079. /// public static Event GainingExperience { get; set; } = new(); /// - /// Invoked before gaining levels with SCP-079. + /// Invoked before gaining levels with SCP-079. /// public static Event GainingLevel { get; set; } = new(); /// - /// Invoked before triggering a tesla with SCP-079. + /// Invoked before triggering a tesla with SCP-079. /// public static Event InteractingTesla { get; set; } = new(); /// - /// Invoked before triggering a door with SCP-079. + /// Invoked before triggering a door with SCP-079. /// public static Event TriggeringDoor { get; set; } = new(); /// - /// Invoked before SCP-079 teleports using an elevator. + /// Invoked before SCP-079 teleports using an elevator. /// public static Event ElevatorTeleporting { get; set; } = new(); /// - /// Invoked before SCP-079 lockdowns a room. + /// Invoked before SCP-079 lockdowns a room. /// public static Event LockingDown { get; set; } = new(); /// - /// Invoked before SCP-079 changes a speaker status. + /// Invoked before SCP-079 changes a speaker status. /// public static Event ChangingSpeakerStatus { get; set; } = new(); /// - /// Invoked after SCP-079 recontainment. + /// Invoked after SCP-079 recontainment. /// public static Event Recontained { get; set; } = new(); /// - /// Invoked before SCP-079 sends a ping. + /// Invoked before SCP-079 sends a ping. /// public static Event Pinging { get; set; } = new(); /// - /// Invoked before SCP-079 turns off the lights in a room. + /// Invoked before SCP-079 turns off the lights in a room. /// public static Event RoomBlackout { get; set; } = new(); /// - /// Invoked before SCP-079 turns off the lights in a zone. + /// Invoked before SCP-079 turns off the lights in a zone. /// public static Event ZoneBlackout { get; set; } = new(); /// - /// Called before SCP-079 switches cameras. + /// Called before SCP-079 switches cameras. /// /// The instance. public static void OnChangingCamera(ChangingCameraEventArgs ev) => ChangingCamera.InvokeSafely(ev); /// - /// Called before gaining experience with SCP-079. + /// Called before gaining experience with SCP-079. /// /// The instance. public static void OnGainingExperience(GainingExperienceEventArgs ev) => GainingExperience.InvokeSafely(ev); /// - /// Called before gaining levels with SCP-079. + /// Called before gaining levels with SCP-079. /// /// The instance. public static void OnGainingLevel(GainingLevelEventArgs ev) => GainingLevel.InvokeSafely(ev); /// - /// Called before triggering a tesla with SCP-079. + /// Called before triggering a tesla with SCP-079. /// /// The instance. public static void OnInteractingTesla(InteractingTeslaEventArgs ev) => InteractingTesla.InvokeSafely(ev); /// - /// Called before interacting with a door with SCP-079. + /// Called before interacting with a door with SCP-079. /// /// The instance. public static void OnTriggeringDoor(TriggeringDoorEventArgs ev) => TriggeringDoor.InvokeSafely(ev); /// - /// Called before SCP-079 teleports using an elevator. + /// Called before SCP-079 teleports using an elevator. /// /// The instance. public static void OnElevatorTeleporting(ElevatorTeleportingEventArgs ev) => ElevatorTeleporting.InvokeSafely(ev); /// - /// Called before SCP-079 lockdowns a room. + /// Called before SCP-079 lockdowns a room. /// /// The instance. public static void OnLockingDown(LockingDownEventArgs ev) => LockingDown.InvokeSafely(ev); /// - /// Called while interacting with a speaker with SCP-079. + /// Called while interacting with a speaker with SCP-079. /// /// The instance. public static void OnChangingSpeakerStatus(ChangingSpeakerStatusEventArgs ev) => ChangingSpeakerStatus.InvokeSafely(ev); /// - /// Called after SCP-079 is recontained. + /// Called after SCP-079 is recontained. /// /// The instance. public static void OnRecontained(RecontainedEventArgs ev) => Recontained.InvokeSafely(ev); /// - /// Called before SCP-079 sends a ping. + /// Called before SCP-079 sends a ping. /// /// The instance. public static void OnPinging(PingingEventArgs ev) => Pinging.InvokeSafely(ev); /// - /// Called before SCP-079 turns off the lights in a room. + /// Called before SCP-079 turns off the lights in a room. /// /// The instance. public static void OnRoomBlackout(RoomBlackoutEventArgs ev) => RoomBlackout.InvokeSafely(ev); /// - /// Called before SCP-079 turns off the lights in a zone. + /// Called before SCP-079 turns off the lights in a zone. /// /// The instance. public static void OnZoneBlackout(ZoneBlackoutEventArgs ev) => ZoneBlackout.InvokeSafely(ev); diff --git a/Exiled.Events/Handlers/Scp096.cs b/Exiled.Events/Handlers/Scp096.cs index 45cae82eb4..60a01b3679 100644 --- a/Exiled.Events/Handlers/Scp096.cs +++ b/Exiled.Events/Handlers/Scp096.cs @@ -13,72 +13,72 @@ namespace Exiled.Events.Handlers using Exiled.Events.Features; /// - /// SCP-096 related events. + /// SCP-096 related events. /// public static class Scp096 { /// - /// Invoked before SCP-096 is enraged. + /// Invoked before SCP-096 is enraged. /// public static Event Enraging { get; set; } = new(); /// - /// Invoked before SCP-096 calms down. + /// Invoked before SCP-096 calms down. /// public static Event CalmingDown { get; set; } = new(); /// - /// Invoked before adding a target to SCP-096. + /// Invoked before adding a target to SCP-096. /// public static Event AddingTarget { get; set; } = new(); /// - /// Invoked before SCP-096 begins prying open a gate. + /// Invoked before SCP-096 begins prying open a gate. /// public static Event StartPryingGate { get; set; } = new(); /// - /// Invoked before SCP-096 begins charging. + /// Invoked before SCP-096 begins charging. /// public static Event Charging { get; set; } = new(); /// - /// Invoked before SCP-096 tries not to cry. + /// Invoked before SCP-096 tries not to cry. /// public static Event TryingNotToCry { get; set; } = new(); /// - /// Called before SCP-096 is enraged. + /// Called before SCP-096 is enraged. /// /// The instance. public static void OnEnraging(EnragingEventArgs ev) => Enraging.InvokeSafely(ev); /// - /// Called before SCP-096 calms down. + /// Called before SCP-096 calms down. /// /// The instance. public static void OnCalmingDown(CalmingDownEventArgs ev) => CalmingDown.InvokeSafely(ev); /// - /// Called before adding a target to SCP-096. + /// Called before adding a target to SCP-096. /// /// The instance. public static void OnAddingTarget(AddingTargetEventArgs ev) => AddingTarget.InvokeSafely(ev); /// - /// Called before SCP-096 begins prying open a gate. + /// Called before SCP-096 begins prying open a gate. /// /// The instance. public static void OnStartPryingGate(StartPryingGateEventArgs ev) => StartPryingGate.InvokeSafely(ev); /// - /// Called before SCP-096 begins charging. + /// Called before SCP-096 begins charging. /// /// The instance. public static void OnCharging(ChargingEventArgs ev) => Charging.InvokeSafely(ev); /// - /// Called before SCP-096 starts trying not to cry. + /// Called before SCP-096 starts trying not to cry. /// /// The instance. public static void OnTryingNotToCry(TryingNotToCryEventArgs ev) => TryingNotToCry.InvokeSafely(ev); diff --git a/Exiled.Events/Handlers/Scp106.cs b/Exiled.Events/Handlers/Scp106.cs index 0ed5972db9..da2645466c 100644 --- a/Exiled.Events/Handlers/Scp106.cs +++ b/Exiled.Events/Handlers/Scp106.cs @@ -13,50 +13,50 @@ namespace Exiled.Events.Handlers using Exiled.Events.Features; /// - /// SCP-106 related events. + /// SCP-106 related events. /// public static class Scp106 { /// - /// Invoked before SCP-106 attacks player. + /// Invoked before SCP-106 attacks player. /// public static Event Attacking { get; set; } = new(); /// - /// Invoked before SCP-106 teleports using the hunter atlas. + /// Invoked before SCP-106 teleports using the hunter atlas. /// public static Event Teleporting { get; set; } = new(); /// - /// Invoked before SCP-106 use the stalk ability. + /// Invoked before SCP-106 use the stalk ability. /// public static Event Stalking { get; set; } = new(); /// - /// Invoked before SCP-106 exit the stalk ability. + /// Invoked before SCP-106 exit the stalk ability. /// public static Event ExitStalking { get; set; } = new(); /// - /// Called before SCP-106 attacks player. + /// Called before SCP-106 attacks player. /// /// The instance. public static void OnAttacking(AttackingEventArgs ev) => Attacking.InvokeSafely(ev); /// - /// Called before SCP-106 teleports using the hunter atlas. + /// Called before SCP-106 teleports using the hunter atlas. /// /// The instance. public static void OnTeleporting(TeleportingEventArgs ev) => Teleporting.InvokeSafely(ev); /// - /// Called before SCP-106 use the stalk ability. + /// Called before SCP-106 use the stalk ability. /// /// The instance. public static void OnStalking(StalkingEventArgs ev) => Stalking.InvokeSafely(ev); /// - /// Called before SCP-106 exit the stalk ability. + /// Called before SCP-106 exit the stalk ability. /// /// The instance. public static void OnExitStalking(ExitStalkingEventArgs ev) => ExitStalking.InvokeSafely(ev); diff --git a/Exiled.Events/Handlers/Scp173.cs b/Exiled.Events/Handlers/Scp173.cs index abb88d66e0..bf844714b9 100644 --- a/Exiled.Events/Handlers/Scp173.cs +++ b/Exiled.Events/Handlers/Scp173.cs @@ -13,50 +13,50 @@ namespace Exiled.Events.Handlers using Exiled.Events.Features; /// - /// SCP-173 related events. + /// SCP-173 related events. /// public static class Scp173 { /// - /// Invoked before players near SCP-173 blink. + /// Invoked before players near SCP-173 blink. /// public static Event Blinking { get; set; } = new(); /// - /// Invoked before server handle SCP-173 blink network message. + /// Invoked before server handle SCP-173 blink network message. /// public static Event BlinkingRequest { get; set; } = new(); /// - /// Invoked before a tantrum is placed. + /// Invoked before a tantrum is placed. /// public static Event PlacingTantrum { get; set; } = new(); /// - /// Invoked before using breakneck speeds. + /// Invoked before using breakneck speeds. /// public static Event UsingBreakneckSpeeds { get; set; } = new(); /// - /// Called before players near SCP-173 blink. + /// Called before players near SCP-173 blink. /// /// The instance. public static void OnBlinking(BlinkingEventArgs ev) => Blinking.InvokeSafely(ev); /// - /// Called before server handle SCP-173 blink network message. + /// Called before server handle SCP-173 blink network message. /// /// The instance. public static void OnBlinkingRequest(BlinkingRequestEventArgs ev) => BlinkingRequest.InvokeSafely(ev); /// - /// Called before a tantrum is placed. + /// Called before a tantrum is placed. /// /// The instance. public static void OnPlacingTantrum(PlacingTantrumEventArgs ev) => PlacingTantrum.InvokeSafely(ev); /// - /// Called before a using breakneck speeds. + /// Called before a using breakneck speeds. /// /// The instance. public static void OnUsingBreakneckSpeeds(UsingBreakneckSpeedsEventArgs ev) => UsingBreakneckSpeeds.InvokeSafely(ev); diff --git a/Exiled.Events/Handlers/Scp244.cs b/Exiled.Events/Handlers/Scp244.cs index 1771762986..f986ba032c 100644 --- a/Exiled.Events/Handlers/Scp244.cs +++ b/Exiled.Events/Handlers/Scp244.cs @@ -13,39 +13,39 @@ namespace Exiled.Events.Handlers using Exiled.Events.Features; /// - /// Scp244 related events. + /// Scp244 related events. /// public static class Scp244 { /// - /// Invoked before using an . + /// Invoked before using an . /// public static Event UsingScp244 { get; set; } = new(); /// - /// Invoked before an Scp244 take damage. + /// Invoked before an Scp244 take damage. /// public static Event DamagingScp244 { get; set; } = new(); /// - /// Invoked before an Scp244 open because the angle was too low. + /// Invoked before an Scp244 open because the angle was too low. /// public static Event OpeningScp244 { get; set; } = new(); /// - /// Called before using a usable item. + /// Called before using a usable item. /// /// The instance. public static void OnUsingScp244(UsingScp244EventArgs ev) => UsingScp244.InvokeSafely(ev); /// - /// Called before an Scp244 take damage. + /// Called before an Scp244 take damage. /// /// The instance. public static void OnDamagingScp244(DamagingScp244EventArgs ev) => DamagingScp244.InvokeSafely(ev); /// - /// Called before Scp244 open because the angle was too low. + /// Called before Scp244 open because the angle was too low. /// /// The instance. public static void OnOpeningScp244(OpeningScp244EventArgs ev) => OpeningScp244.InvokeSafely(ev); diff --git a/Exiled.Events/Handlers/Scp3114.cs b/Exiled.Events/Handlers/Scp3114.cs index 1e85bf7ad5..087957c316 100644 --- a/Exiled.Events/Handlers/Scp3114.cs +++ b/Exiled.Events/Handlers/Scp3114.cs @@ -14,63 +14,74 @@ namespace Exiled.Events.Handlers using Exiled.Events.Features; /// - /// Scp3114 related events. + /// Scp3114 related events. /// public static class Scp3114 { /// - /// Invoked before Disguising. + /// Invoked before disguising. /// public static Event Disguising { get; set; } = new(); /// - /// Invoked before Disguising. + /// Invoked when disguised. /// public static Event Disguised { get; set; } = new(); /// - /// Invoked before Disguising. + /// Invoked before trying to use a body. /// public static Event TryUseBody { get; set; } = new(); /// - /// Invoked before Disguising. + /// Invoked when reveals. /// public static Event Revealed { get; set; } = new(); /// - /// Invoked before Disguising. + /// Invoked before reveals. /// public static Event Revealing { get; set; } = new(); /// - /// Called before diguising to a new Roles. + /// Invoked before sending any SCP-3114 voicelines. + /// + public static Event VoiceLines { get; set; } = new(); + + /// + /// Called before diguising. /// /// The instance. public static void OnDisguising(DisguisingEventArgs ev) => Disguising.InvokeSafely(ev); /// - /// Called before diguising to a new Roles. + /// Called after diguising. /// /// The instance. public static void OnDisguised(DisguisedEventArgs ev) => Disguised.InvokeSafely(ev); /// - /// Called before diguising to a new Roles. + /// Called before trying to use a body. /// /// The instance. public static void OnTryUseBody(TryUseBodyEventArgs ev) => TryUseBody.InvokeSafely(ev); /// - /// Called before diguising to a new Roles. + /// Called after reveals. /// /// The instance. public static void OnRevealed(RevealedEventArgs ev) => Revealed.InvokeSafely(ev); /// - /// Called before diguising to a new Roles. + /// Called before revealing. /// /// The instance. public static void OnRevealing(RevealingEventArgs ev) => Revealing.InvokeSafely(ev); + + /// + /// Called before sending any SCP-3114 voicelines. + /// + /// The instance. + public static void OnVoiceLines(VoiceLinesEventArgs ev) => VoiceLines.InvokeSafely(ev); } } \ No newline at end of file diff --git a/Exiled.Events/Handlers/Scp330.cs b/Exiled.Events/Handlers/Scp330.cs index 19f0534ae2..a5dcd44c98 100644 --- a/Exiled.Events/Handlers/Scp330.cs +++ b/Exiled.Events/Handlers/Scp330.cs @@ -13,50 +13,50 @@ namespace Exiled.Events.Handlers using Exiled.Events.Features; /// - /// Scp330 related events. + /// Scp330 related events. /// public static class Scp330 { /// - /// Invoked before a interacts with SCP-330. + /// Invoked before a interacts with SCP-330. /// public static Event InteractingScp330 { get; set; } = new(); /// - /// Invoked before a drop a SCP-330 candy. + /// Invoked before a drop a SCP-330 candy. /// public static Event DroppingScp330 { get; set; } = new(); /// - /// Invoked before a player eats a candy from SCP-330. + /// Invoked before a player eats a candy from SCP-330. /// public static Event EatingScp330 { get; set; } = new(); /// - /// Invoked after the player has eaten a candy from SCP-330. + /// Invoked after the player has eaten a candy from SCP-330. /// public static Event EatenScp330 { get; set; } = new(); /// - /// Called before a player eats a candy from SCP-330. + /// Called before a player eats a candy from SCP-330. /// /// The instance. public static void OnEatingScp330(EatingScp330EventArgs ev) => EatingScp330.InvokeSafely(ev); /// - /// Called after the player has eaten a candy from SCP-330. + /// Called after the player has eaten a candy from SCP-330. /// /// The instance. public static void OnEatenScp330(EatenScp330EventArgs ev) => EatenScp330.InvokeSafely(ev); /// - /// Called before a interacts with SCP-330. + /// Called before a interacts with SCP-330. /// /// The instance. public static void OnInteractingScp330(InteractingScp330EventArgs ev) => InteractingScp330.InvokeSafely(ev); /// - /// Called before a searches a Pickup. + /// Called before a searches a Pickup. /// /// The instance. public static void OnDroppingScp330(DroppingScp330EventArgs ev) => DroppingScp330.InvokeSafely(ev); diff --git a/Exiled.Events/Handlers/Scp914.cs b/Exiled.Events/Handlers/Scp914.cs index 3417aa7789..77157ef904 100644 --- a/Exiled.Events/Handlers/Scp914.cs +++ b/Exiled.Events/Handlers/Scp914.cs @@ -13,61 +13,61 @@ namespace Exiled.Events.Handlers using Exiled.Events.Features; /// - /// Handles SCP-914 related events. + /// Handles SCP-914 related events. /// public static class Scp914 { /// - /// Invoked before SCP-914 upgrades a Pickup. + /// Invoked before SCP-914 upgrades a Pickup. /// public static Event UpgradingPickup { get; set; } = new(); /// - /// Invoked before SCP-914 upgrades an item in a player's inventory. + /// Invoked before SCP-914 upgrades an item in a player's inventory. /// public static Event UpgradingInventoryItem { get; set; } = new(); /// - /// Invoked before SCP-914 upgrades a player. + /// Invoked before SCP-914 upgrades a player. /// public static Event UpgradingPlayer { get; set; } = new(); /// - /// Invoked before activating the SCP-914 machine. + /// Invoked before activating the SCP-914 machine. /// public static Event Activating { get; set; } = new(); /// - /// Invoked before changing the SCP-914 machine knob setting. + /// Invoked before changing the SCP-914 machine knob setting. /// public static Event ChangingKnobSetting { get; set; } = new(); /// - /// Called before SCP-914 upgrades a item. + /// Called before SCP-914 upgrades a item. /// /// The instance. public static void OnUpgradingPickup(UpgradingPickupEventArgs ev) => UpgradingPickup.InvokeSafely(ev); /// - /// Called before SCP-914 upgrades an item in a player's inventory. + /// Called before SCP-914 upgrades an item in a player's inventory. /// /// The instance. public static void OnUpgradingInventoryItem(UpgradingInventoryItemEventArgs ev) => UpgradingInventoryItem.InvokeSafely(ev); /// - /// Called before SCP-914 upgrades a player. + /// Called before SCP-914 upgrades a player. /// /// The instance. public static void OnUpgradingPlayer(UpgradingPlayerEventArgs ev) => UpgradingPlayer.InvokeSafely(ev); /// - /// Called before activating the SCP-914 machine. + /// Called before activating the SCP-914 machine. /// /// The instance. public static void OnActivating(ActivatingEventArgs ev) => Activating.InvokeSafely(ev); /// - /// Called before changing the SCP-914 machine knob setting. + /// Called before changing the SCP-914 machine knob setting. /// /// The instance. public static void OnChangingKnobSetting(ChangingKnobSettingEventArgs ev) => ChangingKnobSetting.InvokeSafely(ev); diff --git a/Exiled.Events/Handlers/Scp939.cs b/Exiled.Events/Handlers/Scp939.cs index bb93cf51b3..e8c582d36a 100644 --- a/Exiled.Events/Handlers/Scp939.cs +++ b/Exiled.Events/Handlers/Scp939.cs @@ -13,37 +13,37 @@ namespace Exiled.Events.Handlers using Exiled.Events.Features; /// - /// Handles SCP-939 related events. + /// Handles SCP-939 related events. /// public static class Scp939 { /// - /// Invoked before SCP-939 changes its target focus. + /// Invoked before SCP-939 changes its target focus. /// public static Event ChangingFocus { get; set; } = new(); /// - /// Invoked before SCP-939 uses its lunge ability. + /// Invoked before SCP-939 uses its lunge ability. /// public static Event Lunging { get; set; } = new(); /// - /// Invoked before SCP-939 uses its amnestic cloud ability. + /// Invoked before SCP-939 uses its amnestic cloud ability. /// public static Event PlacingAmnesticCloud { get; set; } = new(); /// - /// Invoked before SCP-939 plays a stolen voice. + /// Invoked before SCP-939 plays a stolen voice. /// public static Event PlayingVoice { get; set; } = new(); /// - /// Invoked before SCP-939 will save Human voice. + /// Invoked before SCP-939 will save Human voice. /// public static Event SavingVoice { get; set; } = new(); /// - /// Invoked before SCP-939 plays a sound effect. + /// Invoked before SCP-939 plays a sound effect. /// public static Event PlayingSound { get; set; } = new(); @@ -54,37 +54,42 @@ public static class Scp939 public static Event Clawed { get; set; } = new(); /// - /// Called before SCP-939 changes its target focus. + /// Invoked before validating visibility. + /// + public static Event ValidatingVisibility { get; set; } = new(); + + /// + /// Called before SCP-939 changes its target focus. /// /// The instance. public static void OnChangingFocus(ChangingFocusEventArgs ev) => ChangingFocus.InvokeSafely(ev); /// - /// Called before SCP-939 uses its lunge ability. + /// Called before SCP-939 uses its lunge ability. /// /// The instance. public static void OnLunging(LungingEventArgs ev) => Lunging.InvokeSafely(ev); /// - /// Called before SCP-939 uses its amnestic cloud ability. + /// Called before SCP-939 uses its amnestic cloud ability. /// /// The instance. public static void OnPlacingAmnesticCloud(PlacingAmnesticCloudEventArgs ev) => PlacingAmnesticCloud.InvokeSafely(ev); /// - /// Called before SCP-939 plays a stolen voice. + /// Called before SCP-939 plays a stolen voice. /// /// The instance. public static void OnPlayingVoice(PlayingVoiceEventArgs ev) => PlayingVoice.InvokeSafely(ev); /// - /// Called before SCP-939 plays a stolen voice. + /// Called before SCP-939 plays a stolen voice. /// /// The instance. public static void OnSavingVoice(SavingVoiceEventArgs ev) => SavingVoice.InvokeSafely(ev); /// - /// Called before SCP-939 plays a sound. + /// Called before SCP-939 plays a sound. /// /// The instance. public static void OnPlayingSound(PlayingSoundEventArgs ev) => PlayingSound.InvokeSafely(ev); @@ -94,5 +99,11 @@ public static class Scp939 ///
/// The instance. public static void OnClawed(ClawedEventArgs ev) => Clawed.InvokeSafely(ev); + + /// + /// Called before validating visibility. + /// + /// The instance. + public static void OnValidatingVisibility(ValidatingVisibilityEventArgs ev) => ValidatingVisibility.InvokeSafely(ev); } } \ No newline at end of file diff --git a/Exiled.Events/Handlers/Server.cs b/Exiled.Events/Handlers/Server.cs index ceddc32ada..1b3d0481a9 100644 --- a/Exiled.Events/Handlers/Server.cs +++ b/Exiled.Events/Handlers/Server.cs @@ -68,6 +68,11 @@ public static class Server ///
public static Event ChoosingStartTeamQueue { get; set; } = new(); + /// + /// Invoked before selecting the team that will respawn. + /// + public static Event SelectingRespawnTeam { get; set; } = new(); + /// /// Invoked after the "reload configs" command is ran. /// @@ -184,5 +189,11 @@ public static class Server /// Called after the "reload permissions" command is ran. /// public static void OnReloadedPermissions() => ReloadedPermissions.InvokeSafely(); + + /// + /// Called before selecting the team that will respawn next. + /// + /// The instance. + public static void OnSelectingRespawnTeam(SelectingRespawnTeamEventArgs ev) => SelectingRespawnTeam.InvokeSafely(ev); } } \ No newline at end of file diff --git a/Exiled.Events/Handlers/Warhead.cs b/Exiled.Events/Handlers/Warhead.cs index 9b72b4a24d..8c24061974 100644 --- a/Exiled.Events/Handlers/Warhead.cs +++ b/Exiled.Events/Handlers/Warhead.cs @@ -13,60 +13,60 @@ namespace Exiled.Events.Handlers using Exiled.Events.Features; /// - /// Handles warhead related events. + /// Handles warhead related events. /// public class Warhead { /// - /// Invoked before stopping the warhead. + /// Invoked before stopping the warhead. /// public static Event Stopping { get; set; } = new(); /// - /// Invoked before starting the warhead. + /// Invoked before starting the warhead. /// public static Event Starting { get; set; } = new(); /// - /// Invoked before changing the warhead lever status. + /// Invoked before changing the warhead lever status. /// public static Event ChangingLeverStatus { get; set; } = new(); /// - /// Invoked after the warhead has been detonated. + /// Invoked after the warhead has been detonated. /// public static Event Detonated { get; set; } = new(); /// - /// Invoked before detonating the warhead. + /// Invoked before detonating the warhead. /// public static Event Detonating { get; set; } = new(); /// - /// Called before stopping the warhead. + /// Called before stopping the warhead. /// /// The instance. public static void OnStopping(StoppingEventArgs ev) => Stopping.InvokeSafely(ev); /// - /// Called before starting the warhead. + /// Called before starting the warhead. /// /// The instance. public static void OnStarting(StartingEventArgs ev) => Starting.InvokeSafely(ev); /// - /// Called before changing the warhead lever status. + /// Called before changing the warhead lever status. /// /// The instance. public static void OnChangingLeverStatus(ChangingLeverStatusEventArgs ev) => ChangingLeverStatus.InvokeSafely(ev); /// - /// Called after the warhead has been detonated. + /// Called after the warhead has been detonated. /// public static void OnDetonated() => Detonated.InvokeSafely(); /// - /// Called before detonating the warhead. + /// Called before detonating the warhead. /// /// The instance. public static void OnDetonating(DetonatingEventArgs ev) => Detonating.InvokeSafely(ev); diff --git a/Exiled.Events/Patches/Events/Cassie/SendingCassieMessage.cs b/Exiled.Events/Patches/Events/Cassie/SendingCassieMessage.cs index 127751c7c6..9c49d44972 100644 --- a/Exiled.Events/Patches/Events/Cassie/SendingCassieMessage.cs +++ b/Exiled.Events/Patches/Events/Cassie/SendingCassieMessage.cs @@ -22,8 +22,8 @@ namespace Exiled.Events.Patches.Events.Cassie using static HarmonyLib.AccessTools; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [EventPatch(typeof(Cassie), nameof(Cassie.SendingCassieMessage))] [HarmonyPatch(typeof(RespawnEffectsController), nameof(RespawnEffectsController.PlayCassieAnnouncement))] diff --git a/Exiled.Events/Patches/Events/Item/ChangingAmmo.cs b/Exiled.Events/Patches/Events/Item/ChangingAmmo.cs index 4031bda578..e90d812c2e 100644 --- a/Exiled.Events/Patches/Events/Item/ChangingAmmo.cs +++ b/Exiled.Events/Patches/Events/Item/ChangingAmmo.cs @@ -23,8 +23,8 @@ namespace Exiled.Events.Patches.Events.Item using static HarmonyLib.AccessTools; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [EventPatch(typeof(Item), nameof(Item.ChangingAmmo))] [HarmonyPatch(typeof(Firearm), nameof(Firearm.Status), MethodType.Setter)] diff --git a/Exiled.Events/Patches/Events/Item/ChangingAttachments.cs b/Exiled.Events/Patches/Events/Item/ChangingAttachments.cs index 8a2ab3fd27..3e49274a00 100644 --- a/Exiled.Events/Patches/Events/Item/ChangingAttachments.cs +++ b/Exiled.Events/Patches/Events/Item/ChangingAttachments.cs @@ -25,9 +25,9 @@ namespace Exiled.Events.Patches.Events.Item using static HarmonyLib.AccessTools; /// - /// Patches - /// . - /// Adds the event. + /// Patches + /// . + /// Adds the event. /// [EventPatch(typeof(Handlers.Item), nameof(Handlers.Item.ChangingAttachments))] [HarmonyPatch(typeof(AttachmentsServerHandler), nameof(AttachmentsServerHandler.ServerReceiveChangeRequest))] diff --git a/Exiled.Events/Patches/Events/Item/JailbirdPatch.cs b/Exiled.Events/Patches/Events/Item/JailbirdPatch.cs index fbbeb7a3e1..ec33236e0d 100644 --- a/Exiled.Events/Patches/Events/Item/JailbirdPatch.cs +++ b/Exiled.Events/Patches/Events/Item/JailbirdPatch.cs @@ -21,9 +21,9 @@ namespace Exiled.Events.Patches.Events.Item using static HarmonyLib.AccessTools; /// - /// Patches - /// . - /// Adds the event and . + /// Patches + /// . + /// Adds the event and . /// [EventPatch(typeof(Item), nameof(Item.Swinging))] [EventPatch(typeof(Item), nameof(Item.ChargingJailbird))] diff --git a/Exiled.Events/Patches/Events/Item/ReceivingPreference.cs b/Exiled.Events/Patches/Events/Item/ReceivingPreference.cs index 4efe28feb1..6d845fffa3 100644 --- a/Exiled.Events/Patches/Events/Item/ReceivingPreference.cs +++ b/Exiled.Events/Patches/Events/Item/ReceivingPreference.cs @@ -27,9 +27,9 @@ namespace Exiled.Events.Patches.Events.Item using Player = API.Features.Player; /// - /// Patches - /// . - /// Adds the event. + /// Patches + /// . + /// Adds the event. /// [EventPatch(typeof(Item), nameof(Item.ReceivingPreference))] [HarmonyPatch(typeof(AttachmentsServerHandler), nameof(AttachmentsServerHandler.ServerReceivePreference))] diff --git a/Exiled.Events/Patches/Events/Item/UsingRadioPickupBattery.cs b/Exiled.Events/Patches/Events/Item/UsingRadioPickupBattery.cs new file mode 100644 index 0000000000..d257ff9738 --- /dev/null +++ b/Exiled.Events/Patches/Events/Item/UsingRadioPickupBattery.cs @@ -0,0 +1,79 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Events.Patches.Events.Item +{ + using System.Collections.Generic; + using System.Reflection.Emit; + + using Exiled.API.Features.Pools; + using Exiled.Events.EventArgs.Item; + using HarmonyLib; + using InventorySystem.Items.Radio; + + using static HarmonyLib.AccessTools; + + /// + /// Patches + /// to add event. + /// + [HarmonyPatch(typeof(RadioPickup), nameof(RadioPickup.LateUpdate))] + internal class UsingRadioPickupBattery + { + private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) + { + List newInstructions = ListPool.Pool.Get(instructions); + + LocalBuilder ev = generator.DeclareLocal(typeof(UsingRadioPickupBatteryEventArgs)); + + Label continueLabel = generator.DefineLabel(); + + int index = newInstructions.FindIndex(x => x.opcode == OpCodes.Ldloc_1); + + newInstructions.InsertRange( + index, + new[] + { + // this + new(OpCodes.Ldarg_0), + + // num + new(OpCodes.Ldloc_1), + + // true + new(OpCodes.Ldc_I4_1), + + // UsingRadioPickupBatteryEventArgs ev = new(this, num, true); + new(OpCodes.Newobj, GetDeclaredConstructors(typeof(UsingRadioPickupBatteryEventArgs))[0]), + new(OpCodes.Dup), + new(OpCodes.Dup), + new(OpCodes.Stloc_S, ev.LocalIndex), + + // Handlers.Item.OnUsingRadioPickupBattery(ev); + new(OpCodes.Call, Method(typeof(Handlers.Item), nameof(Handlers.Item.OnUsingRadioPickupBattery))), + + // if (ev.IsAllowed) + // goto continueLabel + new(OpCodes.Callvirt, PropertyGetter(typeof(UsingRadioPickupBatteryEventArgs), nameof(UsingRadioPickupBatteryEventArgs.IsAllowed))), + new(OpCodes.Brtrue_S, continueLabel), + + // return + new(OpCodes.Ret), + + // num = ev.Drain; + new CodeInstruction(OpCodes.Ldloc_S, ev.LocalIndex).WithLabels(continueLabel), + new(OpCodes.Callvirt, PropertyGetter(typeof(UsingRadioPickupBatteryEventArgs), nameof(UsingRadioPickupBatteryEventArgs.Drain))), + new(OpCodes.Stloc_1), + }); + + for (int z = 0; z < newInstructions.Count; z++) + yield return newInstructions[z]; + + ListPool.Pool.Return(newInstructions); + } + } +} \ No newline at end of file diff --git a/Exiled.Events/Patches/Events/Map/AnnouncingDecontamination.cs b/Exiled.Events/Patches/Events/Map/AnnouncingDecontamination.cs index 7ee1b2d1fc..14a78a7676 100644 --- a/Exiled.Events/Patches/Events/Map/AnnouncingDecontamination.cs +++ b/Exiled.Events/Patches/Events/Map/AnnouncingDecontamination.cs @@ -23,8 +23,8 @@ namespace Exiled.Events.Patches.Events.Map using static HarmonyLib.AccessTools; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [EventPatch(typeof(Map), nameof(Map.AnnouncingDecontamination))] [HarmonyPatch(typeof(DecontaminationController), nameof(DecontaminationController.UpdateSpeaker))] diff --git a/Exiled.Events/Patches/Events/Map/AnnouncingNtfEntrance.cs b/Exiled.Events/Patches/Events/Map/AnnouncingNtfEntrance.cs index f0a5c1a917..484516c7f7 100644 --- a/Exiled.Events/Patches/Events/Map/AnnouncingNtfEntrance.cs +++ b/Exiled.Events/Patches/Events/Map/AnnouncingNtfEntrance.cs @@ -24,8 +24,8 @@ namespace Exiled.Events.Patches.Events.Map using static HarmonyLib.AccessTools; /// - /// Patch the . - /// Adds the event. + /// Patch the . + /// Adds the event. /// [EventPatch(typeof(Map), nameof(Map.AnnouncingNtfEntrance))] [HarmonyPatch(typeof(NineTailedFoxNamingRule), nameof(NineTailedFoxNamingRule.PlayEntranceAnnouncement))] diff --git a/Exiled.Events/Patches/Events/Map/AnnouncingScpTermination.cs b/Exiled.Events/Patches/Events/Map/AnnouncingScpTermination.cs index 1963f2b27d..b442452a37 100644 --- a/Exiled.Events/Patches/Events/Map/AnnouncingScpTermination.cs +++ b/Exiled.Events/Patches/Events/Map/AnnouncingScpTermination.cs @@ -23,9 +23,9 @@ namespace Exiled.Events.Patches.Events.Map using Player = API.Features.Player; /// - /// Patches - /// . - /// Adds the event. + /// Patches + /// . + /// Adds the event. /// [EventPatch(typeof(Map), nameof(Map.AnnouncingScpTermination))] [HarmonyPatch(typeof(NineTailedFoxAnnouncer), nameof(NineTailedFoxAnnouncer.AnnounceScpTermination))] diff --git a/Exiled.Events/Patches/Events/Map/BreakingScp2176.cs b/Exiled.Events/Patches/Events/Map/BreakingScp2176.cs index 38c63853d0..9b0c2cb5c5 100644 --- a/Exiled.Events/Patches/Events/Map/BreakingScp2176.cs +++ b/Exiled.Events/Patches/Events/Map/BreakingScp2176.cs @@ -23,8 +23,8 @@ namespace Exiled.Events.Patches.Events.Map using Map = Handlers.Map; /// - /// Patches . - /// Supplements the event. + /// Patches . + /// Supplements the event. /// [EventPatch(typeof(Map), nameof(Map.ExplodingGrenade))] [HarmonyPatch(typeof(Scp2176Projectile), nameof(Scp2176Projectile.ServerShatter))] diff --git a/Exiled.Events/Patches/Events/Map/ChangingIntoGrenade.cs b/Exiled.Events/Patches/Events/Map/ChangingIntoGrenade.cs index 8f5d30e3d5..397fbe7dbc 100644 --- a/Exiled.Events/Patches/Events/Map/ChangingIntoGrenade.cs +++ b/Exiled.Events/Patches/Events/Map/ChangingIntoGrenade.cs @@ -29,8 +29,8 @@ namespace Exiled.Events.Patches.Events.Map using static HarmonyLib.AccessTools; /// - /// Patches . - /// Adds the and events. + /// Patches . + /// Adds the and events. /// [EventPatch(typeof(Map), nameof(Map.ChangingIntoGrenade))] [EventPatch(typeof(Map), nameof(Map.ChangedIntoGrenade))] @@ -118,7 +118,7 @@ private static IEnumerable Transpiler(IEnumerable - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [EventPatch(typeof(Map), nameof(Map.Decontaminating))] [HarmonyPatch(typeof(DecontaminationController), nameof(DecontaminationController.FinishDecontamination))] diff --git a/Exiled.Events/Patches/Events/Map/FillingLocker.cs b/Exiled.Events/Patches/Events/Map/FillingLocker.cs index b1b4c8bccd..8d3a53ace7 100644 --- a/Exiled.Events/Patches/Events/Map/FillingLocker.cs +++ b/Exiled.Events/Patches/Events/Map/FillingLocker.cs @@ -23,8 +23,8 @@ namespace Exiled.Events.Patches.Events.Map using static HarmonyLib.AccessTools; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [EventPatch(typeof(Handlers.Map), nameof(Handlers.Map.FillingLocker))] [HarmonyPatch(typeof(LockerChamber), nameof(LockerChamber.SpawnItem))] diff --git a/Exiled.Events/Patches/Events/Map/GeneratorActivating.cs b/Exiled.Events/Patches/Events/Map/GeneratorActivating.cs index 32f1c23ac4..e483353adb 100644 --- a/Exiled.Events/Patches/Events/Map/GeneratorActivating.cs +++ b/Exiled.Events/Patches/Events/Map/GeneratorActivating.cs @@ -24,8 +24,8 @@ namespace Exiled.Events.Patches.Events.Map using static HarmonyLib.AccessTools; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [EventPatch(typeof(Map), nameof(Map.GeneratorActivating))] [HarmonyPatch(typeof(Scp079Generator), nameof(Scp079Generator.Engaged), MethodType.Setter)] diff --git a/Exiled.Events/Patches/Events/Map/PlacingBulletHole.cs b/Exiled.Events/Patches/Events/Map/PlacingBulletHole.cs index 173267283e..9431ddb4df 100644 --- a/Exiled.Events/Patches/Events/Map/PlacingBulletHole.cs +++ b/Exiled.Events/Patches/Events/Map/PlacingBulletHole.cs @@ -28,8 +28,8 @@ namespace Exiled.Events.Patches.Events.Map using Player = API.Features.Player; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [EventPatch(typeof(Map), nameof(Map.PlacingBulletHole))] [HarmonyPatch(typeof(StandardHitregBase), nameof(StandardHitregBase.PlaceBulletholeDecal))] diff --git a/Exiled.Events/Patches/Events/Map/SpawningItem.cs b/Exiled.Events/Patches/Events/Map/SpawningItem.cs index 62882159c9..ff3cd57626 100644 --- a/Exiled.Events/Patches/Events/Map/SpawningItem.cs +++ b/Exiled.Events/Patches/Events/Map/SpawningItem.cs @@ -24,8 +24,8 @@ namespace Exiled.Events.Patches.Events.Map using static HarmonyLib.AccessTools; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [EventPatch(typeof(Map), nameof(Map.SpawningItem))] [HarmonyPatch(typeof(ItemDistributor), nameof(ItemDistributor.CreatePickup))] diff --git a/Exiled.Events/Patches/Events/Player/ActivatingWarheadPanel.cs b/Exiled.Events/Patches/Events/Player/ActivatingWarheadPanel.cs index ffc7665ea3..4a3d790b19 100644 --- a/Exiled.Events/Patches/Events/Player/ActivatingWarheadPanel.cs +++ b/Exiled.Events/Patches/Events/Player/ActivatingWarheadPanel.cs @@ -22,8 +22,8 @@ namespace Exiled.Events.Patches.Events.Player using static HarmonyLib.AccessTools; /// - /// Patch the . - /// Adds the event. + /// Patch the . + /// Adds the event. /// [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.ActivatingWarheadPanel))] [HarmonyPatch(typeof(PlayerInteract), nameof(PlayerInteract.UserCode_CmdSwitchAWButton))] diff --git a/Exiled.Events/Patches/Events/Player/ActivatingWorkstation.cs b/Exiled.Events/Patches/Events/Player/ActivatingWorkstation.cs index 9eed28a67d..4ee58f8ecd 100644 --- a/Exiled.Events/Patches/Events/Player/ActivatingWorkstation.cs +++ b/Exiled.Events/Patches/Events/Player/ActivatingWorkstation.cs @@ -22,8 +22,8 @@ namespace Exiled.Events.Patches.Events.Player using static HarmonyLib.AccessTools; /// - /// Patch the . - /// Adds the event. + /// Patch the . + /// Adds the event. /// [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.ActivatingWorkstation))] [HarmonyPatch(typeof(WorkstationController), nameof(WorkstationController.ServerInteract))] diff --git a/Exiled.Events/Patches/Events/Player/Banned.cs b/Exiled.Events/Patches/Events/Player/Banned.cs index 8b166e5062..d06cdcf2f2 100644 --- a/Exiled.Events/Patches/Events/Player/Banned.cs +++ b/Exiled.Events/Patches/Events/Player/Banned.cs @@ -20,8 +20,8 @@ namespace Exiled.Events.Patches.Events.Player using static HarmonyLib.AccessTools; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.Banned))] [HarmonyPatch(typeof(BanHandler), nameof(BanHandler.IssueBan))] diff --git a/Exiled.Events/Patches/Events/Player/Banning.cs b/Exiled.Events/Patches/Events/Player/Banning.cs index 177eab623f..9873b079bb 100644 --- a/Exiled.Events/Patches/Events/Player/Banning.cs +++ b/Exiled.Events/Patches/Events/Player/Banning.cs @@ -21,8 +21,8 @@ namespace Exiled.Events.Patches.Events.Player using static HarmonyLib.AccessTools; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.Banning))] [HarmonyPatch(typeof(BanPlayer), nameof(BanPlayer.BanUser), typeof(Footprint), typeof(ICommandSender), typeof(string), typeof(long))] diff --git a/Exiled.Events/Patches/Events/Player/ChangedItem.cs b/Exiled.Events/Patches/Events/Player/ChangedItem.cs index b31f4c54e1..1fe58b8765 100644 --- a/Exiled.Events/Patches/Events/Player/ChangedItem.cs +++ b/Exiled.Events/Patches/Events/Player/ChangedItem.cs @@ -22,8 +22,8 @@ namespace Exiled.Events.Patches.Events.Player using static HarmonyLib.AccessTools; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.ChangedItem))] [HarmonyPatch(typeof(Inventory), nameof(Inventory.CurInstance), MethodType.Setter)] diff --git a/Exiled.Events/Patches/Events/Player/ChangingGroup.cs b/Exiled.Events/Patches/Events/Player/ChangingGroup.cs index 9d53ec16ef..cf179dfc5d 100644 --- a/Exiled.Events/Patches/Events/Player/ChangingGroup.cs +++ b/Exiled.Events/Patches/Events/Player/ChangingGroup.cs @@ -22,8 +22,8 @@ namespace Exiled.Events.Patches.Events.Player using static HarmonyLib.AccessTools; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.ChangingGroup))] [HarmonyPatch(typeof(ServerRoles), nameof(ServerRoles.SetGroup))] diff --git a/Exiled.Events/Patches/Events/Player/ChangingItem.cs b/Exiled.Events/Patches/Events/Player/ChangingItem.cs index f24c1c4aec..323c7c1b17 100644 --- a/Exiled.Events/Patches/Events/Player/ChangingItem.cs +++ b/Exiled.Events/Patches/Events/Player/ChangingItem.cs @@ -24,8 +24,8 @@ namespace Exiled.Events.Patches.Events.Player using static HarmonyLib.AccessTools; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.ChangingItem))] [HarmonyPatch(typeof(Inventory), nameof(Inventory.ServerSelectItem))] diff --git a/Exiled.Events/Patches/Events/Player/ChangingMoveState.cs b/Exiled.Events/Patches/Events/Player/ChangingMoveState.cs index 24f82f790e..61d05c0aa7 100644 --- a/Exiled.Events/Patches/Events/Player/ChangingMoveState.cs +++ b/Exiled.Events/Patches/Events/Player/ChangingMoveState.cs @@ -22,8 +22,8 @@ namespace Exiled.Events.Patches.Events.Player using static HarmonyLib.AccessTools; /// - /// Patches setter. - /// Adds the event. + /// Patches setter. + /// Adds the event. /// [EventPatch(typeof(Player), nameof(Player.ChangingMoveState))] [HarmonyPatch(typeof(FirstPersonMovementModule), nameof(FirstPersonMovementModule.SyncMovementState), MethodType.Setter)] diff --git a/Exiled.Events/Patches/Events/Player/ChangingRadioPreset.cs b/Exiled.Events/Patches/Events/Player/ChangingRadioPreset.cs index c76e77ee36..1199215c81 100644 --- a/Exiled.Events/Patches/Events/Player/ChangingRadioPreset.cs +++ b/Exiled.Events/Patches/Events/Player/ChangingRadioPreset.cs @@ -23,8 +23,8 @@ namespace Exiled.Events.Patches.Events.Player using static HarmonyLib.AccessTools; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.ChangingRadioPreset))] [HarmonyPatch(typeof(RadioItem), nameof(RadioItem.ServerProcessCmd))] diff --git a/Exiled.Events/Patches/Events/Player/ChangingRoleAndSpawned.cs b/Exiled.Events/Patches/Events/Player/ChangingRoleAndSpawned.cs index 9d44bd278e..786842b5bc 100644 --- a/Exiled.Events/Patches/Events/Player/ChangingRoleAndSpawned.cs +++ b/Exiled.Events/Patches/Events/Player/ChangingRoleAndSpawned.cs @@ -31,8 +31,8 @@ namespace Exiled.Events.Patches.Events.Player using Player = Handlers.Player; /// - /// Patches - /// Adds the event. + /// Patches + /// Adds the event. /// [HarmonyPatch(typeof(PlayerRoleManager), nameof(PlayerRoleManager.InitializeNewRole))] internal static class ChangingRoleAndSpawned diff --git a/Exiled.Events/Patches/Events/Player/ChangingSpectatedPlayerPatch.cs b/Exiled.Events/Patches/Events/Player/ChangingSpectatedPlayerPatch.cs index 9a7eeac96b..c7f14f9553 100644 --- a/Exiled.Events/Patches/Events/Player/ChangingSpectatedPlayerPatch.cs +++ b/Exiled.Events/Patches/Events/Player/ChangingSpectatedPlayerPatch.cs @@ -21,8 +21,8 @@ namespace Exiled.Events.Patches.Events.Player using static HarmonyLib.AccessTools; /// - /// Patches setter. - /// Adds the . + /// Patches setter. + /// Adds the . /// [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.ChangingSpectatedPlayer))] [HarmonyPatch(typeof(SpectatorRole), nameof(SpectatorRole.SyncedSpectatedNetId), MethodType.Setter)] diff --git a/Exiled.Events/Patches/Events/Player/DamagingDoor.cs b/Exiled.Events/Patches/Events/Player/DamagingDoor.cs index 154a8bac88..9fb8aa9364 100644 --- a/Exiled.Events/Patches/Events/Player/DamagingDoor.cs +++ b/Exiled.Events/Patches/Events/Player/DamagingDoor.cs @@ -24,8 +24,8 @@ namespace Exiled.Events.Patches.Events.Player using static HarmonyLib.AccessTools; /// - /// Patch the . - /// Adds the event. + /// Patch the . + /// Adds the event. /// [EventPatch(typeof(Player), nameof(Player.DamagingDoor))] [HarmonyPatch(typeof(BreakableDoor), nameof(BreakableDoor.ServerDamage))] diff --git a/Exiled.Events/Patches/Events/Player/DamagingShootingTarget.cs b/Exiled.Events/Patches/Events/Player/DamagingShootingTarget.cs index 5ee191c36e..9b73611eb9 100644 --- a/Exiled.Events/Patches/Events/Player/DamagingShootingTarget.cs +++ b/Exiled.Events/Patches/Events/Player/DamagingShootingTarget.cs @@ -26,8 +26,8 @@ namespace Exiled.Events.Patches.Events.Player using static HarmonyLib.AccessTools; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.DamagingShootingTarget))] [HarmonyPatch(typeof(ShootingTarget), nameof(ShootingTarget.Damage))] diff --git a/Exiled.Events/Patches/Events/Player/DamagingWindow.cs b/Exiled.Events/Patches/Events/Player/DamagingWindow.cs index da47ea73da..fe342e84c3 100644 --- a/Exiled.Events/Patches/Events/Player/DamagingWindow.cs +++ b/Exiled.Events/Patches/Events/Player/DamagingWindow.cs @@ -24,8 +24,8 @@ namespace Exiled.Events.Patches.Events.Player using static HarmonyLib.AccessTools; /// - /// Patch the . - /// Adds the event. + /// Patch the . + /// Adds the event. /// [EventPatch(typeof(Player), nameof(Player.PlayerDamageWindow))] [HarmonyPatch(typeof(BreakableWindow), nameof(BreakableWindow.Damage))] diff --git a/Exiled.Events/Patches/Events/Player/DeactivatingWorkstation.cs b/Exiled.Events/Patches/Events/Player/DeactivatingWorkstation.cs index 4a1cc6da26..eee14bf646 100644 --- a/Exiled.Events/Patches/Events/Player/DeactivatingWorkstation.cs +++ b/Exiled.Events/Patches/Events/Player/DeactivatingWorkstation.cs @@ -23,8 +23,8 @@ namespace Exiled.Events.Patches.Events.Player using static HarmonyLib.AccessTools; /// - /// Patch the . - /// Adds the event. + /// Patch the . + /// Adds the event. /// [EventPatch(typeof(Player), nameof(Player.DeactivatingWorkstation))] [HarmonyPatch(typeof(WorkstationController), nameof(WorkstationController.NetworkStatus), MethodType.Setter)] diff --git a/Exiled.Events/Patches/Events/Player/Destroying.cs b/Exiled.Events/Patches/Events/Player/Destroying.cs index 0c96d0d7c6..ad1d84480c 100644 --- a/Exiled.Events/Patches/Events/Player/Destroying.cs +++ b/Exiled.Events/Patches/Events/Player/Destroying.cs @@ -22,8 +22,8 @@ namespace Exiled.Events.Patches.Events.Player using static HarmonyLib.AccessTools; /// - /// Patch the . - /// Adds the event. + /// Patch the . + /// Adds the event. /// [HarmonyPatch(typeof(ReferenceHub), nameof(ReferenceHub.OnDestroy))] internal static class Destroying diff --git a/Exiled.Events/Patches/Events/Player/DroppingAmmo.cs b/Exiled.Events/Patches/Events/Player/DroppingAmmo.cs index 940a386041..c67b70d030 100644 --- a/Exiled.Events/Patches/Events/Player/DroppingAmmo.cs +++ b/Exiled.Events/Patches/Events/Player/DroppingAmmo.cs @@ -24,8 +24,8 @@ namespace Exiled.Events.Patches.Events.Player using static HarmonyLib.AccessTools; /// - /// Patches . - ///
Adds the and events.
+ /// Patches . + ///
Adds the and events.
///
[EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.DroppingAmmo))] [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.DroppedAmmo))] diff --git a/Exiled.Events/Patches/Events/Player/DroppingItem.cs b/Exiled.Events/Patches/Events/Player/DroppingItem.cs index a522e1a38b..0e03115329 100644 --- a/Exiled.Events/Patches/Events/Player/DroppingItem.cs +++ b/Exiled.Events/Patches/Events/Player/DroppingItem.cs @@ -26,8 +26,8 @@ namespace Exiled.Events.Patches.Events.Player using Player = Handlers.Player; /// - /// Patches . - ///
Adds the , and events.
+ /// Patches . + ///
Adds the , and events.
///
[EventPatch(typeof(Player), nameof(Player.DroppingItem))] [EventPatch(typeof(Player), nameof(Player.DroppingNothing))] diff --git a/Exiled.Events/Patches/Events/Player/DyingAndDied.cs b/Exiled.Events/Patches/Events/Player/DyingAndDied.cs index 15791f9724..ea11377759 100644 --- a/Exiled.Events/Patches/Events/Player/DyingAndDied.cs +++ b/Exiled.Events/Patches/Events/Player/DyingAndDied.cs @@ -25,8 +25,8 @@ namespace Exiled.Events.Patches.Events.Player using static HarmonyLib.AccessTools; /// - /// Patches . - /// Adds the and event. + /// Patches . + /// Adds the and event. /// [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.Dying))] [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.Died))] diff --git a/Exiled.Events/Patches/Events/Player/EarningAchievement.cs b/Exiled.Events/Patches/Events/Player/EarningAchievement.cs index 1ab73c1ce9..a818a39863 100644 --- a/Exiled.Events/Patches/Events/Player/EarningAchievement.cs +++ b/Exiled.Events/Patches/Events/Player/EarningAchievement.cs @@ -24,8 +24,8 @@ namespace Exiled.Events.Patches.Events.Player using static HarmonyLib.AccessTools; /// - /// Patch the . - /// Adds the event. + /// Patch the . + /// Adds the event. /// [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.EarningAchievement))] [HarmonyPatch(typeof(AchievementHandlerBase), nameof(AchievementHandlerBase.ServerAchieve))] diff --git a/Exiled.Events/Patches/Events/Player/EnteringPocketDimension.cs b/Exiled.Events/Patches/Events/Player/EnteringPocketDimension.cs index 2f35679cb8..1dabf6e26e 100644 --- a/Exiled.Events/Patches/Events/Player/EnteringPocketDimension.cs +++ b/Exiled.Events/Patches/Events/Player/EnteringPocketDimension.cs @@ -23,8 +23,8 @@ namespace Exiled.Events.Patches.Events.Player using static HarmonyLib.AccessTools; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.EnteringPocketDimension))] [HarmonyPatch(typeof(Scp106Attack), nameof(Scp106Attack.ServerShoot))] diff --git a/Exiled.Events/Patches/Events/Player/FailingEscapePocketDimension.cs b/Exiled.Events/Patches/Events/Player/FailingEscapePocketDimension.cs index f836e53d0b..f8b08b74a3 100644 --- a/Exiled.Events/Patches/Events/Player/FailingEscapePocketDimension.cs +++ b/Exiled.Events/Patches/Events/Player/FailingEscapePocketDimension.cs @@ -22,8 +22,8 @@ namespace Exiled.Events.Patches.Events.Player using static HarmonyLib.AccessTools; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.FailingEscapePocketDimension))] [HarmonyPatch(typeof(PocketDimensionTeleport), nameof(PocketDimensionTeleport.OnTriggerEnter))] diff --git a/Exiled.Events/Patches/Events/Player/FirearmRequestReceived.cs b/Exiled.Events/Patches/Events/Player/FirearmRequestReceived.cs index d763be3d41..6ebd931f4e 100644 --- a/Exiled.Events/Patches/Events/Player/FirearmRequestReceived.cs +++ b/Exiled.Events/Patches/Events/Player/FirearmRequestReceived.cs @@ -28,10 +28,10 @@ namespace Exiled.Events.Patches.Events.Player using static HarmonyLib.AccessTools; /// - /// Patches . - /// Adds , , - /// , and - /// events. + /// Patches . + /// Adds , , + /// , and + /// events. /// [EventPatch(typeof(Player), nameof(Player.ReloadingWeapon))] [EventPatch(typeof(Player), nameof(Player.UnloadingWeapon))] diff --git a/Exiled.Events/Patches/Events/Player/FlippingCoin.cs b/Exiled.Events/Patches/Events/Player/FlippingCoin.cs index d523022b52..96756f3545 100644 --- a/Exiled.Events/Patches/Events/Player/FlippingCoin.cs +++ b/Exiled.Events/Patches/Events/Player/FlippingCoin.cs @@ -22,9 +22,9 @@ namespace Exiled.Events.Patches.Events.Player using static HarmonyLib.AccessTools; /// - /// Patches - /// . - /// Adds the event. + /// Patches + /// . + /// Adds the event. /// [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.FlippingCoin))] [HarmonyPatch(typeof(Coin), nameof(Coin.ServerProcessCmd))] diff --git a/Exiled.Events/Patches/Events/Player/Hurting.cs b/Exiled.Events/Patches/Events/Player/Hurting.cs index 609b03dff1..73e8ea4a45 100644 --- a/Exiled.Events/Patches/Events/Player/Hurting.cs +++ b/Exiled.Events/Patches/Events/Player/Hurting.cs @@ -26,8 +26,8 @@ namespace Exiled.Events.Patches.Events.Player using Player = API.Features.Player; /// - /// Patches . - /// Adds the event and event. + /// Patches . + /// Adds the event and event. /// [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.Hurting))] [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.Hurt))] diff --git a/Exiled.Events/Patches/Events/Player/Interacted.cs b/Exiled.Events/Patches/Events/Player/Interacted.cs index 6a10abc85b..d6e0d637ef 100644 --- a/Exiled.Events/Patches/Events/Player/Interacted.cs +++ b/Exiled.Events/Patches/Events/Player/Interacted.cs @@ -22,8 +22,8 @@ namespace Exiled.Events.Patches.Events.Player using static HarmonyLib.AccessTools; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.Interacted))] [HarmonyPatch(typeof(PlayerInteract), nameof(PlayerInteract.OnInteract))] diff --git a/Exiled.Events/Patches/Events/Player/InteractingDoor.cs b/Exiled.Events/Patches/Events/Player/InteractingDoor.cs index 8ab8d2c0fa..6f491b8118 100644 --- a/Exiled.Events/Patches/Events/Player/InteractingDoor.cs +++ b/Exiled.Events/Patches/Events/Player/InteractingDoor.cs @@ -22,8 +22,8 @@ namespace Exiled.Events.Patches.Events.Player using static HarmonyLib.AccessTools; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.InteractingDoor))] [HarmonyPatch(typeof(DoorVariant), nameof(DoorVariant.ServerInteract), typeof(ReferenceHub), typeof(byte))] diff --git a/Exiled.Events/Patches/Events/Player/InteractingElevator.cs b/Exiled.Events/Patches/Events/Player/InteractingElevator.cs index f15f4d527e..1889f29dca 100644 --- a/Exiled.Events/Patches/Events/Player/InteractingElevator.cs +++ b/Exiled.Events/Patches/Events/Player/InteractingElevator.cs @@ -24,8 +24,8 @@ namespace Exiled.Events.Patches.Events.Player using static HarmonyLib.AccessTools; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.InteractingElevator))] [HarmonyPatch(typeof(ElevatorManager), nameof(ElevatorManager.ServerReceiveMessage))] diff --git a/Exiled.Events/Patches/Events/Player/InteractingLocker.cs b/Exiled.Events/Patches/Events/Player/InteractingLocker.cs index 083e310b0b..b706f067f9 100644 --- a/Exiled.Events/Patches/Events/Player/InteractingLocker.cs +++ b/Exiled.Events/Patches/Events/Player/InteractingLocker.cs @@ -21,8 +21,8 @@ namespace Exiled.Events.Patches.Events.Player using static HarmonyLib.AccessTools; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.InteractingLocker))] [HarmonyPatch(typeof(Locker), nameof(Locker.ServerInteract))] diff --git a/Exiled.Events/Patches/Events/Player/InteractingShootingTarget.cs b/Exiled.Events/Patches/Events/Player/InteractingShootingTarget.cs index a98188295f..e2cc9661ab 100644 --- a/Exiled.Events/Patches/Events/Player/InteractingShootingTarget.cs +++ b/Exiled.Events/Patches/Events/Player/InteractingShootingTarget.cs @@ -26,8 +26,8 @@ namespace Exiled.Events.Patches.Events.Player using BaseTarget = AdminToys.ShootingTarget; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.InteractingShootingTarget))] [HarmonyPatch(typeof(BaseTarget), nameof(BaseTarget.ServerInteract))] diff --git a/Exiled.Events/Patches/Events/Player/IntercomSpeaking.cs b/Exiled.Events/Patches/Events/Player/IntercomSpeaking.cs index 8c2248195c..5079a776c1 100644 --- a/Exiled.Events/Patches/Events/Player/IntercomSpeaking.cs +++ b/Exiled.Events/Patches/Events/Player/IntercomSpeaking.cs @@ -24,8 +24,8 @@ namespace Exiled.Events.Patches.Events.Player using Player = API.Features.Player; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.IntercomSpeaking))] [HarmonyPatch(typeof(Intercom), nameof(Intercom.Update))] diff --git a/Exiled.Events/Patches/Events/Player/IssuingMute.cs b/Exiled.Events/Patches/Events/Player/IssuingMute.cs index c90fe93b9e..7fd44db040 100644 --- a/Exiled.Events/Patches/Events/Player/IssuingMute.cs +++ b/Exiled.Events/Patches/Events/Player/IssuingMute.cs @@ -22,8 +22,8 @@ namespace Exiled.Events.Patches.Events.Player using static HarmonyLib.AccessTools; /// - /// Patch the . - /// Adds the event. + /// Patch the . + /// Adds the event. /// [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.IssuingMute))] [HarmonyPatch(typeof(VoiceChatMutes), nameof(VoiceChatMutes.IssueLocalMute))] diff --git a/Exiled.Events/Patches/Events/Player/Joined.cs b/Exiled.Events/Patches/Events/Player/Joined.cs index 8b580bd503..639da9e03f 100644 --- a/Exiled.Events/Patches/Events/Player/Joined.cs +++ b/Exiled.Events/Patches/Events/Player/Joined.cs @@ -19,8 +19,8 @@ namespace Exiled.Events.Patches.Events.Player using HarmonyLib; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [HarmonyPatch(typeof(ReferenceHub), nameof(ReferenceHub.Start))] internal static class Joined diff --git a/Exiled.Events/Patches/Events/Player/Jumping.cs b/Exiled.Events/Patches/Events/Player/Jumping.cs index aa6c266c86..460867460e 100644 --- a/Exiled.Events/Patches/Events/Player/Jumping.cs +++ b/Exiled.Events/Patches/Events/Player/Jumping.cs @@ -22,8 +22,8 @@ namespace Exiled.Events.Patches.Events.Player using static HarmonyLib.AccessTools; /// - /// Patches - /// Adds the event. + /// Patches + /// Adds the event. /// [EventPatch(typeof(Player), nameof(Player.Jumping))] [HarmonyPatch(typeof(FpcMotor), nameof(FpcMotor.UpdateGrounded))] diff --git a/Exiled.Events/Patches/Events/Player/Kicked.cs b/Exiled.Events/Patches/Events/Player/Kicked.cs index ebb25c6f1e..b3934543ca 100644 --- a/Exiled.Events/Patches/Events/Player/Kicked.cs +++ b/Exiled.Events/Patches/Events/Player/Kicked.cs @@ -22,8 +22,8 @@ namespace Exiled.Events.Patches.Events.Player using static HarmonyLib.AccessTools; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.Kicked))] [HarmonyPatch(typeof(ServerConsole), nameof(ServerConsole.Disconnect), typeof(GameObject), typeof(string))] diff --git a/Exiled.Events/Patches/Events/Player/Kicking.cs b/Exiled.Events/Patches/Events/Player/Kicking.cs index 68aa9a3d4e..0a9286933b 100644 --- a/Exiled.Events/Patches/Events/Player/Kicking.cs +++ b/Exiled.Events/Patches/Events/Player/Kicking.cs @@ -21,8 +21,8 @@ namespace Exiled.Events.Patches.Events.Player using static HarmonyLib.AccessTools; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.Kicking))] [HarmonyPatch(typeof(BanPlayer), nameof(BanPlayer.KickUser), typeof(ReferenceHub), typeof(ICommandSender), typeof(string))] diff --git a/Exiled.Events/Patches/Events/Player/Landing.cs b/Exiled.Events/Patches/Events/Player/Landing.cs index 21b3b06622..37c745a316 100644 --- a/Exiled.Events/Patches/Events/Player/Landing.cs +++ b/Exiled.Events/Patches/Events/Player/Landing.cs @@ -22,8 +22,8 @@ namespace Exiled.Events.Patches.Events.Player using static HarmonyLib.AccessTools; /// - /// Patches - /// Adds the event. + /// Patches + /// Adds the event. /// [EventPatch(typeof(Player), nameof(Player.Landing))] [HarmonyPatch(typeof(AnimatedCharacterModel), nameof(AnimatedCharacterModel.OnGrounded))] @@ -48,15 +48,9 @@ private static IEnumerable Transpiler(IEnumerable - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [HarmonyPatch(typeof(CustomNetworkManager), nameof(CustomNetworkManager.OnServerDisconnect), typeof(NetworkConnectionToClient))] internal static class Left diff --git a/Exiled.Events/Patches/Events/Player/PickingUp330.cs b/Exiled.Events/Patches/Events/Player/PickingUp330.cs index c6be7d7bf5..ab6dd6bab2 100644 --- a/Exiled.Events/Patches/Events/Player/PickingUp330.cs +++ b/Exiled.Events/Patches/Events/Player/PickingUp330.cs @@ -23,8 +23,8 @@ namespace Exiled.Events.Patches.Events.Player using Player = API.Features.Player; /// - /// Patches the method to add the - /// event. + /// Patches the method to add the + /// event. /// [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.PickingUpItem))] [HarmonyPatch(typeof(Scp330Bag), nameof(Scp330Bag.ServerProcessPickup))] diff --git a/Exiled.Events/Patches/Events/Player/PickingUpAmmo.cs b/Exiled.Events/Patches/Events/Player/PickingUpAmmo.cs index af8784195c..c548bdd6d5 100644 --- a/Exiled.Events/Patches/Events/Player/PickingUpAmmo.cs +++ b/Exiled.Events/Patches/Events/Player/PickingUpAmmo.cs @@ -22,7 +22,7 @@ namespace Exiled.Events.Patches.Events.Player using static HarmonyLib.AccessTools; /// - /// Patches for the event. + /// Patches for the event. /// [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.PickingUpItem))] [HarmonyPatch(typeof(AmmoSearchCompletor), nameof(AmmoSearchCompletor.Complete))] diff --git a/Exiled.Events/Patches/Events/Player/PickingUpArmor.cs b/Exiled.Events/Patches/Events/Player/PickingUpArmor.cs index 85e395ec8a..baccd89d6c 100644 --- a/Exiled.Events/Patches/Events/Player/PickingUpArmor.cs +++ b/Exiled.Events/Patches/Events/Player/PickingUpArmor.cs @@ -22,8 +22,8 @@ namespace Exiled.Events.Patches.Events.Player using static HarmonyLib.AccessTools; /// - /// Patches the method to add the - /// event. + /// Patches the method to add the + /// event. /// [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.PickingUpItem))] [HarmonyPatch(typeof(ArmorSearchCompletor), nameof(ArmorSearchCompletor.Complete))] diff --git a/Exiled.Events/Patches/Events/Player/PickingUpItem.cs b/Exiled.Events/Patches/Events/Player/PickingUpItem.cs index 879cc3196c..78e3611591 100644 --- a/Exiled.Events/Patches/Events/Player/PickingUpItem.cs +++ b/Exiled.Events/Patches/Events/Player/PickingUpItem.cs @@ -23,8 +23,8 @@ namespace Exiled.Events.Patches.Events.Player using static HarmonyLib.AccessTools; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.PickingUpItem))] [HarmonyPatch(typeof(ItemSearchCompletor), nameof(ItemSearchCompletor.Complete))] diff --git a/Exiled.Events/Patches/Events/Player/PickingUpScp244.cs b/Exiled.Events/Patches/Events/Player/PickingUpScp244.cs index 7d5792d91e..13f634563c 100644 --- a/Exiled.Events/Patches/Events/Player/PickingUpScp244.cs +++ b/Exiled.Events/Patches/Events/Player/PickingUpScp244.cs @@ -23,8 +23,8 @@ namespace Exiled.Events.Patches.Events.Player using Player = API.Features.Player; /// - /// Patches to add missing event handler to the - /// . + /// Patches to add missing event handler to the + /// . /// [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.PickingUpItem))] [HarmonyPatch(typeof(Scp244SearchCompletor), nameof(Scp244SearchCompletor.Complete))] diff --git a/Exiled.Events/Patches/Events/Player/ProcessDisarmMessage.cs b/Exiled.Events/Patches/Events/Player/ProcessDisarmMessage.cs index 4c0414ec38..bd83c19e9e 100644 --- a/Exiled.Events/Patches/Events/Player/ProcessDisarmMessage.cs +++ b/Exiled.Events/Patches/Events/Player/ProcessDisarmMessage.cs @@ -25,8 +25,8 @@ namespace Exiled.Events.Patches.Events.Player using static HarmonyLib.AccessTools; /// - /// Patches . - /// Adds the and events. + /// Patches . + /// Adds the and events. /// [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.Handcuffing))] [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.RemovingHandcuffs))] diff --git a/Exiled.Events/Patches/Events/Player/ReservedSlotPatch.cs b/Exiled.Events/Patches/Events/Player/ReservedSlotPatch.cs index f5905d0e6a..4eeba0e171 100644 --- a/Exiled.Events/Patches/Events/Player/ReservedSlotPatch.cs +++ b/Exiled.Events/Patches/Events/Player/ReservedSlotPatch.cs @@ -22,8 +22,8 @@ namespace Exiled.Events.Patches.Events.Player using static HarmonyLib.AccessTools; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [EventPatch(typeof(Player), nameof(Player.ReservedSlot))] [HarmonyPatch(typeof(ReservedSlot), nameof(ReservedSlot.HasReservedSlot))] diff --git a/Exiled.Events/Patches/Events/Player/RevokingMute.cs b/Exiled.Events/Patches/Events/Player/RevokingMute.cs index 11ff0183bf..1fcf9855e1 100644 --- a/Exiled.Events/Patches/Events/Player/RevokingMute.cs +++ b/Exiled.Events/Patches/Events/Player/RevokingMute.cs @@ -22,8 +22,8 @@ namespace Exiled.Events.Patches.Events.Player using static HarmonyLib.AccessTools; /// - /// Patch the . - /// Adds the event. + /// Patch the . + /// Adds the event. /// [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.RevokingMute))] [HarmonyPatch(typeof(VoiceChatMutes), nameof(VoiceChatMutes.RevokeLocalMute))] diff --git a/Exiled.Events/Patches/Events/Player/SearchingPickupEvent.cs b/Exiled.Events/Patches/Events/Player/SearchingPickupEvent.cs index a20a1d7419..9973366af4 100644 --- a/Exiled.Events/Patches/Events/Player/SearchingPickupEvent.cs +++ b/Exiled.Events/Patches/Events/Player/SearchingPickupEvent.cs @@ -23,8 +23,8 @@ namespace Exiled.Events.Patches.Events.Player using static HarmonyLib.AccessTools; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.SearchingPickup))] [HarmonyPatch(typeof(SearchCoordinator), nameof(SearchCoordinator.ReceiveRequestUnsafe))] diff --git a/Exiled.Events/Patches/Events/Player/SendingAdminChatMessage.cs b/Exiled.Events/Patches/Events/Player/SendingAdminChatMessage.cs index 6aa7f5f778..0508de5c28 100644 --- a/Exiled.Events/Patches/Events/Player/SendingAdminChatMessage.cs +++ b/Exiled.Events/Patches/Events/Player/SendingAdminChatMessage.cs @@ -24,8 +24,8 @@ namespace Exiled.Events.Patches.Events.Player using static HarmonyLib.AccessTools; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.SendingAdminChatMessage))] [HarmonyPatch(typeof(CommandProcessor), nameof(CommandProcessor.ProcessAdminChat))] diff --git a/Exiled.Events/Patches/Events/Player/Shooting.cs b/Exiled.Events/Patches/Events/Player/Shooting.cs index ef2bfab3c8..cc54f72fa7 100644 --- a/Exiled.Events/Patches/Events/Player/Shooting.cs +++ b/Exiled.Events/Patches/Events/Player/Shooting.cs @@ -11,24 +11,21 @@ namespace Exiled.Events.Patches.Events.Player using System.Reflection.Emit; using API.Features; - using API.Features.Items; using API.Features.Pools; - using CustomPlayerEffects; - using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Player; using HarmonyLib; - using InventorySystem.Items; using InventorySystem.Items.Firearms.BasicMessages; + using InventorySystem.Items.Firearms.Modules; using static HarmonyLib.AccessTools; /// - /// Patches . - /// Adds the events. + /// Patches . + /// Adds the events. /// [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.Shooting))] [HarmonyPatch(typeof(FirearmBasicMessagesHandler), nameof(FirearmBasicMessagesHandler.ServerShotReceived))] @@ -42,11 +39,9 @@ private static IEnumerable Transpiler(IEnumerable instruction.Calls(Method(typeof(SpawnProtected), nameof(SpawnProtected.CheckPlayer)))) + offset; + int offset = -2; + int index = newInstructions.FindIndex(instruction => instruction.Calls(Method(typeof(IActionModule), nameof(IActionModule.ServerAuthorizeShot)))) + offset; newInstructions.InsertRange( index, @@ -55,29 +50,9 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable - /// Patches . - /// Adds the events. + /// Patches . + /// Adds the events. /// [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.Shot))] [HarmonyPatch(typeof(SingleBulletHitreg), nameof(SingleBulletHitreg.ServerProcessRaycastHit))] @@ -143,8 +143,8 @@ private static IEnumerable Transpiler(IEnumerable - /// Patches . - /// Adds the events. + /// Patches . + /// Adds the events. /// [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.Shot))] [HarmonyPatch(typeof(BuckshotHitreg), nameof(BuckshotHitreg.ShootPellet))] @@ -230,8 +230,8 @@ private static IEnumerable Transpiler(IEnumerable - /// Patches . - /// Adds the events. + /// Patches . + /// Adds the events. /// [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.Shot))] [HarmonyPatch(typeof(DisruptorHitreg), nameof(DisruptorHitreg.ServerPerformShot))] diff --git a/Exiled.Events/Patches/Events/Player/SpawningRagdoll.cs b/Exiled.Events/Patches/Events/Player/SpawningRagdoll.cs index e716dfb451..39f5179cef 100644 --- a/Exiled.Events/Patches/Events/Player/SpawningRagdoll.cs +++ b/Exiled.Events/Patches/Events/Player/SpawningRagdoll.cs @@ -27,8 +27,8 @@ namespace Exiled.Events.Patches.Events.Player using Player = Handlers.Player; /// - /// Patches . - ///
Adds the and events.
+ /// Patches . + ///
Adds the and events.
///
[EventPatch(typeof(Player), nameof(Player.SpawningRagdoll))] [EventPatch(typeof(Player), nameof(Player.SpawnedRagdoll))] diff --git a/Exiled.Events/Patches/Events/Player/ThrowingRequest.cs b/Exiled.Events/Patches/Events/Player/ThrowingRequest.cs index 90afa8d723..2d882562fc 100644 --- a/Exiled.Events/Patches/Events/Player/ThrowingRequest.cs +++ b/Exiled.Events/Patches/Events/Player/ThrowingRequest.cs @@ -22,8 +22,8 @@ namespace Exiled.Events.Patches.Events.Player using static HarmonyLib.AccessTools; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.ThrowingRequest))] [HarmonyPatch(typeof(ThrowableNetworkHandler), nameof(ThrowableNetworkHandler.ServerProcessRequest))] diff --git a/Exiled.Events/Patches/Events/Player/TogglingFlashlight.cs b/Exiled.Events/Patches/Events/Player/TogglingFlashlight.cs index 9fd1328522..becb70fc98 100644 --- a/Exiled.Events/Patches/Events/Player/TogglingFlashlight.cs +++ b/Exiled.Events/Patches/Events/Player/TogglingFlashlight.cs @@ -21,8 +21,8 @@ namespace Exiled.Events.Patches.Events.Player using static HarmonyLib.AccessTools; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.TogglingFlashlight))] [HarmonyPatch(typeof(FlashlightNetworkHandler), nameof(FlashlightNetworkHandler.ServerProcessMessage))] diff --git a/Exiled.Events/Patches/Events/Player/TogglingNoClip.cs b/Exiled.Events/Patches/Events/Player/TogglingNoClip.cs index b541a3dd71..6af54c2c0b 100644 --- a/Exiled.Events/Patches/Events/Player/TogglingNoClip.cs +++ b/Exiled.Events/Patches/Events/Player/TogglingNoClip.cs @@ -25,8 +25,8 @@ namespace Exiled.Events.Patches.Events.Player using static HarmonyLib.AccessTools; /// - /// patches to add the - /// event. + /// patches to add the + /// event. /// [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.TogglingNoClip))] [HarmonyPatch(typeof(FpcNoclipToggleMessage), nameof(FpcNoclipToggleMessage.ProcessMessage))] diff --git a/Exiled.Events/Patches/Events/Player/TogglingRadio.cs b/Exiled.Events/Patches/Events/Player/TogglingRadio.cs new file mode 100644 index 0000000000..a5bc2e9a72 --- /dev/null +++ b/Exiled.Events/Patches/Events/Player/TogglingRadio.cs @@ -0,0 +1,115 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Events.Patches.Events.Player +{ + using System; + using System.Collections.Generic; + using System.Reflection; + using System.Reflection.Emit; + + using Exiled.API.Features.Items; + using Exiled.API.Features.Pools; + using Exiled.Events.Attributes; + using Exiled.Events.EventArgs.Player; + + using HarmonyLib; + + using InventorySystem.Items; + using InventorySystem.Items.Radio; + + using PluginAPI.Events; + + using static HarmonyLib.AccessTools; + + /// + /// Patches . + /// Adds the event. + /// + [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.TogglingRadio))] + [HarmonyPatch(typeof(RadioItem), nameof(RadioItem.ServerProcessCmd))] + internal static class TogglingRadio + { + private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) + { + List newInstructions = ListPool.Pool.Get(instructions); + + Label retLabel = generator.DefineLabel(); + + Predicate match = instruction => instruction.opcode == OpCodes.Newobj && (ConstructorInfo)instruction.operand == GetDeclaredConstructors(typeof(PlayerRadioToggleEvent))[0]; + int offset = -4; + int index = newInstructions.FindIndex(match) + offset; + + newInstructions.InsertRange(index, new[] + { + // Player.Get(this.Hub) + new CodeInstruction(OpCodes.Ldarg_0).MoveLabelsFrom(newInstructions[index]), + new(OpCodes.Call, PropertyGetter(typeof(RadioItem), nameof(RadioItem.Owner))), + new(OpCodes.Call, Method(typeof(API.Features.Player), nameof(API.Features.Player.Get), new[] { typeof(ReferenceHub) })), + + // this + new(OpCodes.Ldarg_0), + + // true + new(OpCodes.Ldc_I4_1), + + // true + new(OpCodes.Ldc_I4_1), + + // TogglingRadioEventArgs ev = new TogglingRadioEventArgs(Player, RadioItem, bool, bool); + new(OpCodes.Newobj, GetDeclaredConstructors(typeof(TogglingRadioEventArgs))[0]), + new(OpCodes.Dup), + + // Handlers.Player.OnTogglingRadio(ev); + new(OpCodes.Call, Method(typeof(Handlers.Player), nameof(Handlers.Player.OnTogglingRadio))), + + // if(!ev.IsAllowed) + // return; + new(OpCodes.Callvirt, PropertyGetter(typeof(TogglingRadioEventArgs), nameof(TogglingRadioEventArgs.IsAllowed))), + new(OpCodes.Brfalse_S, retLabel), + }); + + index = newInstructions.FindLastIndex(match) + offset; + + newInstructions.InsertRange(index, new[] + { + // Player.Get(this.Hub) + new CodeInstruction(OpCodes.Ldarg_0).MoveLabelsFrom(newInstructions[index]), + new(OpCodes.Call, PropertyGetter(typeof(RadioItem), nameof(RadioItem.Owner))), + new(OpCodes.Call, Method(typeof(API.Features.Player), nameof(API.Features.Player.Get), new[] { typeof(ReferenceHub) })), + + // this + new(OpCodes.Ldarg_0), + + // false + new(OpCodes.Ldc_I4_0), + + // true + new(OpCodes.Ldc_I4_1), + + // TogglingRadioEventArgs ev = new TogglingRadioEventArgs(Player, Radio, bool); + new(OpCodes.Newobj, GetDeclaredConstructors(typeof(TogglingRadioEventArgs))[0]), + new(OpCodes.Dup), + + // Handlers.Player.OnTogglingRadio(ev); + new(OpCodes.Call, Method(typeof(Handlers.Player), nameof(Handlers.Player.OnTogglingRadio))), + + // if(!ev.IsAllowed) + // return; + new(OpCodes.Callvirt, PropertyGetter(typeof(TogglingRadioEventArgs), nameof(TogglingRadioEventArgs.IsAllowed))), + new(OpCodes.Brfalse_S, retLabel), + }); + + newInstructions[newInstructions.Count - 1].labels.Add(retLabel); + + foreach (CodeInstruction instruction in newInstructions) + yield return instruction; + + ListPool.Pool.Return(newInstructions); + } + } +} diff --git a/Exiled.Events/Patches/Events/Player/Transmitting.cs b/Exiled.Events/Patches/Events/Player/Transmitting.cs deleted file mode 100644 index 10dcc2a9a3..0000000000 --- a/Exiled.Events/Patches/Events/Player/Transmitting.cs +++ /dev/null @@ -1,80 +0,0 @@ -// ----------------------------------------------------------------------- -// -// Copyright (c) Exiled Team. All rights reserved. -// Licensed under the CC BY-SA 3.0 license. -// -// ----------------------------------------------------------------------- - -namespace Exiled.Events.Patches.Events.Player -{ - using System.Collections.Generic; - using System.Reflection.Emit; - - using API.Features; - using API.Features.Pools; - using Exiled.Events.Attributes; - using Exiled.Events.EventArgs.Player; - - using HarmonyLib; - - using PlayerRoles.Voice; - - using VoiceChat.Playbacks; - - using static HarmonyLib.AccessTools; - - /// - /// Patches . - /// Adds the event. - /// - [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.Transmitting))] - [HarmonyPatch(typeof(PersonalRadioPlayback), nameof(PersonalRadioPlayback.Update))] - internal static class Transmitting - { - private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) - { - List newInstructions = ListPool.Pool.Get(instructions); - - Label retLabel = generator.DefineLabel(); - - const int offset = -2; - int index = newInstructions.FindIndex( - instruction => instruction.Calls(Method(typeof(PersonalRadioPlayback), nameof(PersonalRadioPlayback.IsTransmitting)))) + offset; - - newInstructions.InsertRange( - index, - new[] - { - // this - new CodeInstruction(OpCodes.Ldarg_0).MoveLabelsFrom(newInstructions[index]), - - // HandleTransmitting(PersonalRadioPlayback) - new(OpCodes.Call, Method(typeof(Transmitting), nameof(HandleTransmitting))), - - // return false if not allowed - new(OpCodes.Brfalse_S, retLabel), - }); - - newInstructions[newInstructions.Count - 1].WithLabels(retLabel); - - for (int z = 0; z < newInstructions.Count; z++) - yield return newInstructions[z]; - - ListPool.Pool.Return(newInstructions); - } - - private static bool HandleTransmitting(PersonalRadioPlayback radioPlayback) - { - ReferenceHub hub = radioPlayback._owner; - - if (hub == null || Player.Get(hub) is not Player player || Server.Host.ReferenceHub == hub) - return false; - - TransmittingEventArgs ev = new(player, ((IVoiceRole)player.RoleManager.CurrentRole).VoiceModule); - - Handlers.Player.OnTransmitting(ev); - - return ev.IsAllowed; - } - } -} \ No newline at end of file diff --git a/Exiled.Events/Patches/Events/Player/TriggeringTesla.cs b/Exiled.Events/Patches/Events/Player/TriggeringTesla.cs index a5b9ea2e4e..50f9b285a3 100644 --- a/Exiled.Events/Patches/Events/Player/TriggeringTesla.cs +++ b/Exiled.Events/Patches/Events/Player/TriggeringTesla.cs @@ -22,8 +22,8 @@ namespace Exiled.Events.Patches.Events.Player using BaseTeslaGate = TeslaGate; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [HarmonyPatch(typeof(TeslaGateController), nameof(TeslaGateController.FixedUpdate))] internal static class TriggeringTesla diff --git a/Exiled.Events/Patches/Events/Player/UsingAndCancellingItemUse.cs b/Exiled.Events/Patches/Events/Player/UsingAndCancellingItemUse.cs index af583cde3b..9004441dc8 100644 --- a/Exiled.Events/Patches/Events/Player/UsingAndCancellingItemUse.cs +++ b/Exiled.Events/Patches/Events/Player/UsingAndCancellingItemUse.cs @@ -25,10 +25,10 @@ namespace Exiled.Events.Patches.Events.Player using static HarmonyLib.AccessTools; /// - /// Patches . - /// Adds the event, - /// event and - /// event. + /// Patches . + /// Adds the event, + /// event and + /// event. /// [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.CancellingItemUse))] [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.UsingItem))] diff --git a/Exiled.Events/Patches/Events/Player/UsingItemCompleted.cs b/Exiled.Events/Patches/Events/Player/UsingItemCompleted.cs index e366b55dd5..c884e213c3 100644 --- a/Exiled.Events/Patches/Events/Player/UsingItemCompleted.cs +++ b/Exiled.Events/Patches/Events/Player/UsingItemCompleted.cs @@ -25,8 +25,8 @@ namespace Exiled.Events.Patches.Events.Player #pragma warning disable SA1600 // Elements should be documented /// - /// Patches - /// Adds the event. + /// Patches + /// Adds the event. /// [HarmonyPatch(typeof(UsableItemsController), nameof(UsableItemsController.Update))] internal static class UsingItemCompleted diff --git a/Exiled.Events/Patches/Events/Player/UsingMicroHIDEnergy.cs b/Exiled.Events/Patches/Events/Player/UsingMicroHIDEnergy.cs index 0ae2849afd..c7ca375c0b 100644 --- a/Exiled.Events/Patches/Events/Player/UsingMicroHIDEnergy.cs +++ b/Exiled.Events/Patches/Events/Player/UsingMicroHIDEnergy.cs @@ -24,8 +24,8 @@ namespace Exiled.Events.Patches.Events.Player using static HarmonyLib.AccessTools; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.UsingMicroHIDEnergy))] [HarmonyPatch(typeof(MicroHIDItem), nameof(MicroHIDItem.ExecuteServerside))] diff --git a/Exiled.Events/Patches/Events/Player/UsingRadioBattery.cs b/Exiled.Events/Patches/Events/Player/UsingRadioBattery.cs index c81e2ed362..b4a52b2ebe 100644 --- a/Exiled.Events/Patches/Events/Player/UsingRadioBattery.cs +++ b/Exiled.Events/Patches/Events/Player/UsingRadioBattery.cs @@ -22,8 +22,8 @@ namespace Exiled.Events.Patches.Events.Player using static HarmonyLib.AccessTools; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.UsingRadioBattery))] [HarmonyPatch(typeof(RadioItem), nameof(RadioItem.Update))] diff --git a/Exiled.Events/Patches/Events/Player/Verified.cs b/Exiled.Events/Patches/Events/Player/Verified.cs index e1e5acbc35..585457a438 100644 --- a/Exiled.Events/Patches/Events/Player/Verified.cs +++ b/Exiled.Events/Patches/Events/Player/Verified.cs @@ -19,8 +19,8 @@ namespace Exiled.Events.Patches.Events.Player #pragma warning disable SA1313 // Parameter names should begin with lower-case letter /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [HarmonyPatch(typeof(PlayerAuthenticationManager), nameof(PlayerAuthenticationManager.FinalizeAuthentication))] internal static class Verified diff --git a/Exiled.Events/Patches/Events/Player/VoiceChatting.cs b/Exiled.Events/Patches/Events/Player/VoiceChatting.cs index e26f62f406..875e099b00 100644 --- a/Exiled.Events/Patches/Events/Player/VoiceChatting.cs +++ b/Exiled.Events/Patches/Events/Player/VoiceChatting.cs @@ -21,14 +21,18 @@ namespace Exiled.Events.Patches.Events.Player using PlayerRoles.Voice; + using VoiceChat; using VoiceChat.Networking; using static HarmonyLib.AccessTools; /// - /// patches to add the event. + /// Patches . + /// Adds the event. + /// Adds the event. /// [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.VoiceChatting))] + [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.Transmitting))] [HarmonyPatch(typeof(VoiceTransceiver), nameof(VoiceTransceiver.ServerReceiveMessage))] internal static class VoiceChatting { @@ -38,10 +42,12 @@ private static IEnumerable Transpiler(IEnumerable labels; LocalBuilder ev = generator.DeclareLocal(typeof(VoiceChattingEventArgs)); LocalBuilder player = generator.DeclareLocal(typeof(API.Features.Player)); + LocalBuilder voiceModule = generator.DeclareLocal(typeof(VoiceModuleBase)); const int offset = 3; int index = newInstructions.FindIndex(i => i.Calls(Method(typeof(VoiceModuleBase), nameof(VoiceModuleBase.CheckRateLimit)))) + offset; @@ -77,6 +83,8 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [HarmonyPatch(typeof(Scp049SenseAbility), nameof(Scp049SenseAbility.ServerProcessCmd))] public class ActivatingSense diff --git a/Exiled.Events/Patches/Events/Scp049/FinishingRecall.cs b/Exiled.Events/Patches/Events/Scp049/FinishingRecall.cs index 82e684ed7c..2eab40acc5 100644 --- a/Exiled.Events/Patches/Events/Scp049/FinishingRecall.cs +++ b/Exiled.Events/Patches/Events/Scp049/FinishingRecall.cs @@ -23,8 +23,8 @@ namespace Exiled.Events.Patches.Events.Scp049 using static HarmonyLib.AccessTools; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [EventPatch(typeof(Handlers.Scp049), nameof(Handlers.Scp049.FinishingRecall))] [HarmonyPatch(typeof(Scp049ResurrectAbility), nameof(Scp049ResurrectAbility.ServerComplete))] diff --git a/Exiled.Events/Patches/Events/Scp049/SendingCall.cs b/Exiled.Events/Patches/Events/Scp049/SendingCall.cs index 62e9a454ed..058cc4c2b4 100644 --- a/Exiled.Events/Patches/Events/Scp049/SendingCall.cs +++ b/Exiled.Events/Patches/Events/Scp049/SendingCall.cs @@ -23,8 +23,8 @@ namespace Exiled.Events.Patches.Events.Scp049 using static HarmonyLib.AccessTools; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [HarmonyPatch(typeof(Scp049CallAbility), nameof(Scp049CallAbility.ServerProcessCmd))] public class SendingCall diff --git a/Exiled.Events/Patches/Events/Scp0492/Consumed.cs b/Exiled.Events/Patches/Events/Scp0492/Consumed.cs index dcf7882fb9..6739dce607 100644 --- a/Exiled.Events/Patches/Events/Scp0492/Consumed.cs +++ b/Exiled.Events/Patches/Events/Scp0492/Consumed.cs @@ -25,8 +25,8 @@ namespace Exiled.Events.Patches.Events.Scp0492 using static HarmonyLib.AccessTools; /// - /// Patches - /// to add event. + /// Patches + /// to add event. /// [EventPatch(typeof(Handlers.Scp0492), nameof(Handlers.Scp0492.ConsumedCorpse))] [HarmonyPatch(typeof(ZombieConsumeAbility), nameof(ZombieConsumeAbility.ServerComplete))] diff --git a/Exiled.Events/Patches/Events/Scp0492/Consuming.cs b/Exiled.Events/Patches/Events/Scp0492/Consuming.cs index 67880f590a..0c41900407 100644 --- a/Exiled.Events/Patches/Events/Scp0492/Consuming.cs +++ b/Exiled.Events/Patches/Events/Scp0492/Consuming.cs @@ -24,8 +24,8 @@ namespace Exiled.Events.Patches.Events.Scp0492 using static HarmonyLib.AccessTools; /// - /// Patches - /// to add event. + /// Patches + /// to add event. /// [EventPatch(typeof(Handlers.Scp0492), nameof(Handlers.Scp0492.ConsumingCorpse))] [HarmonyPatch(typeof(ZombieConsumeAbility), nameof(ZombieConsumeAbility.ServerValidateBegin))] @@ -65,7 +65,7 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); diff --git a/Exiled.Events/Patches/Events/Scp079/ChangingCamera.cs b/Exiled.Events/Patches/Events/Scp079/ChangingCamera.cs index a1be3d046f..2af87b7388 100644 --- a/Exiled.Events/Patches/Events/Scp079/ChangingCamera.cs +++ b/Exiled.Events/Patches/Events/Scp079/ChangingCamera.cs @@ -28,8 +28,8 @@ namespace Exiled.Events.Patches.Events.Scp079 using Player = API.Features.Player; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [EventPatch(typeof(Scp079), nameof(Scp079.ChangingCamera))] [HarmonyPatch(typeof(Scp079CurrentCameraSync), nameof(Scp079CurrentCameraSync.ServerProcessCmd))] diff --git a/Exiled.Events/Patches/Events/Scp079/ChangingSpeakerStatusAndVoiceChatting.cs b/Exiled.Events/Patches/Events/Scp079/ChangingSpeakerStatusAndVoiceChatting.cs index e7fb458934..15223b800c 100644 --- a/Exiled.Events/Patches/Events/Scp079/ChangingSpeakerStatusAndVoiceChatting.cs +++ b/Exiled.Events/Patches/Events/Scp079/ChangingSpeakerStatusAndVoiceChatting.cs @@ -25,8 +25,8 @@ namespace Exiled.Events.Patches.Events.Scp079 using Player = API.Features.Player; /// - /// Patches Scp079VoiceModule.ServerIsSending />. - /// Adds the and the events. + /// Patches Scp079VoiceModule.ServerIsSending />. + /// Adds the and the events. /// [EventPatch(typeof(Scp079), nameof(Scp079.ChangingSpeakerStatus))] [EventPatch(typeof(Handlers.Player), nameof(Handlers.Player.VoiceChatting))] diff --git a/Exiled.Events/Patches/Events/Scp079/ElevatorTeleporting.cs b/Exiled.Events/Patches/Events/Scp079/ElevatorTeleporting.cs index 0e3fe6c3b5..d461dbed9a 100644 --- a/Exiled.Events/Patches/Events/Scp079/ElevatorTeleporting.cs +++ b/Exiled.Events/Patches/Events/Scp079/ElevatorTeleporting.cs @@ -28,8 +28,8 @@ namespace Exiled.Events.Patches.Events.Scp079 using Player = API.Features.Player; /// - /// Patches . - /// Adds the event for SCP-079. + /// Patches . + /// Adds the event for SCP-079. /// [EventPatch(typeof(Scp079), nameof(Scp079.ElevatorTeleporting))] [HarmonyPatch(typeof(Scp079ElevatorStateChanger), nameof(Scp079ElevatorStateChanger.ServerProcessCmd))] diff --git a/Exiled.Events/Patches/Events/Scp079/GainingExperience.cs b/Exiled.Events/Patches/Events/Scp079/GainingExperience.cs index 69ea081d4c..fd212ee6fe 100644 --- a/Exiled.Events/Patches/Events/Scp079/GainingExperience.cs +++ b/Exiled.Events/Patches/Events/Scp079/GainingExperience.cs @@ -26,8 +26,8 @@ namespace Exiled.Events.Patches.Events.Scp079 using Player = API.Features.Player; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [EventPatch(typeof(Scp079), nameof(Scp079.GainingExperience))] [HarmonyPatch(typeof(Scp079TierManager), nameof(Scp079TierManager.ServerGrantExperience))] diff --git a/Exiled.Events/Patches/Events/Scp079/GainingLevel.cs b/Exiled.Events/Patches/Events/Scp079/GainingLevel.cs index c9e43bb267..7721bc0035 100644 --- a/Exiled.Events/Patches/Events/Scp079/GainingLevel.cs +++ b/Exiled.Events/Patches/Events/Scp079/GainingLevel.cs @@ -25,8 +25,8 @@ namespace Exiled.Events.Patches.Events.Scp079 using Player = API.Features.Player; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [EventPatch(typeof(Scp079), nameof(Scp079.GainingLevel))] [HarmonyPatch(typeof(Scp079TierManager), nameof(Scp079TierManager.AccessTierIndex), MethodType.Setter)] diff --git a/Exiled.Events/Patches/Events/Scp079/InteractingTesla.cs b/Exiled.Events/Patches/Events/Scp079/InteractingTesla.cs index 7e8d50c7d6..bc44248311 100644 --- a/Exiled.Events/Patches/Events/Scp079/InteractingTesla.cs +++ b/Exiled.Events/Patches/Events/Scp079/InteractingTesla.cs @@ -27,8 +27,8 @@ namespace Exiled.Events.Patches.Events.Scp079 using Player = API.Features.Player; /// - /// Patches . - /// Adds the event for SCP-079. + /// Patches . + /// Adds the event for SCP-079. /// [EventPatch(typeof(Scp079), nameof(Scp079.InteractingTesla))] [HarmonyPatch(typeof(Scp079TeslaAbility), nameof(Scp079TeslaAbility.ServerProcessCmd))] diff --git a/Exiled.Events/Patches/Events/Scp079/LockingDown.cs b/Exiled.Events/Patches/Events/Scp079/LockingDown.cs index 8ce3a75ae0..7626c07c02 100644 --- a/Exiled.Events/Patches/Events/Scp079/LockingDown.cs +++ b/Exiled.Events/Patches/Events/Scp079/LockingDown.cs @@ -28,8 +28,8 @@ namespace Exiled.Events.Patches.Events.Scp079 using Player = API.Features.Player; /// - /// Patches . - /// Adds the event for SCP-079. + /// Patches . + /// Adds the event for SCP-079. /// [EventPatch(typeof(Scp079), nameof(Scp079.LockingDown))] [HarmonyPatch(typeof(Scp079LockdownRoomAbility), nameof(Scp079LockdownRoomAbility.ServerProcessCmd))] diff --git a/Exiled.Events/Patches/Events/Scp079/Pinging.cs b/Exiled.Events/Patches/Events/Scp079/Pinging.cs index 0482093d23..07d885ddea 100644 --- a/Exiled.Events/Patches/Events/Scp079/Pinging.cs +++ b/Exiled.Events/Patches/Events/Scp079/Pinging.cs @@ -25,8 +25,8 @@ namespace Exiled.Events.Patches.Events.Scp079 using static HarmonyLib.AccessTools; /// - /// Patches . - /// Adds the event for SCP-079. + /// Patches . + /// Adds the event for SCP-079. /// [EventPatch(typeof(Handlers.Scp079), nameof(Handlers.Scp079.Pinging))] [HarmonyPatch(typeof(Scp079PingAbility), nameof(Scp079PingAbility.ServerProcessCmd))] diff --git a/Exiled.Events/Patches/Events/Scp079/RoomBlackout.cs b/Exiled.Events/Patches/Events/Scp079/RoomBlackout.cs index b16a11057b..edfd359ea3 100644 --- a/Exiled.Events/Patches/Events/Scp079/RoomBlackout.cs +++ b/Exiled.Events/Patches/Events/Scp079/RoomBlackout.cs @@ -21,8 +21,8 @@ namespace Exiled.Events.Patches.Events.Scp079 using static HarmonyLib.AccessTools; /// - /// Patches . - /// Adds the event for SCP-079. + /// Patches . + /// Adds the event for SCP-079. /// [EventPatch(typeof(Handlers.Scp079), nameof(Handlers.Scp079.RoomBlackout))] [HarmonyPatch(typeof(Scp079BlackoutRoomAbility), nameof(Scp079BlackoutRoomAbility.ServerProcessCmd))] diff --git a/Exiled.Events/Patches/Events/Scp079/TriggeringDoor.cs b/Exiled.Events/Patches/Events/Scp079/TriggeringDoor.cs index 0203fb9903..aa9beb8249 100644 --- a/Exiled.Events/Patches/Events/Scp079/TriggeringDoor.cs +++ b/Exiled.Events/Patches/Events/Scp079/TriggeringDoor.cs @@ -26,8 +26,8 @@ namespace Exiled.Events.Patches.Events.Scp079 using Player = API.Features.Player; /// - /// Patches . - /// Adds the event for SCP-079. + /// Patches . + /// Adds the event for SCP-079. /// [EventPatch(typeof(Scp079), nameof(Scp079.TriggeringDoor))] [HarmonyPatch(typeof(Scp079DoorStateChanger), nameof(Scp079DoorStateChanger.ServerProcessCmd))] diff --git a/Exiled.Events/Patches/Events/Scp079/ZoneBlackout.cs b/Exiled.Events/Patches/Events/Scp079/ZoneBlackout.cs index 8c41a76cf7..f663612db2 100644 --- a/Exiled.Events/Patches/Events/Scp079/ZoneBlackout.cs +++ b/Exiled.Events/Patches/Events/Scp079/ZoneBlackout.cs @@ -24,8 +24,8 @@ namespace Exiled.Events.Patches.Events.Scp079 using static HarmonyLib.AccessTools; /// - /// Patches . - /// Adds the event for SCP-079. + /// Patches . + /// Adds the event for SCP-079. /// [EventPatch(typeof(Handlers.Scp079), nameof(Handlers.Scp079.ZoneBlackout))] [HarmonyPatch(typeof(Scp079BlackoutZoneAbility), nameof(Scp079BlackoutZoneAbility.ServerProcessCmd))] diff --git a/Exiled.Events/Patches/Events/Scp096/AddingTarget.cs b/Exiled.Events/Patches/Events/Scp096/AddingTarget.cs index 361cce571f..408de36295 100644 --- a/Exiled.Events/Patches/Events/Scp096/AddingTarget.cs +++ b/Exiled.Events/Patches/Events/Scp096/AddingTarget.cs @@ -23,8 +23,8 @@ namespace Exiled.Events.Patches.Events.Scp096 using static HarmonyLib.AccessTools; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [EventPatch(typeof(Handlers.Scp096), nameof(Handlers.Scp096.AddingTarget))] [HarmonyPatch(typeof(Scp096TargetsTracker), nameof(Scp096TargetsTracker.AddTarget))] diff --git a/Exiled.Events/Patches/Events/Scp096/CalmingDown.cs b/Exiled.Events/Patches/Events/Scp096/CalmingDown.cs index 06b048722a..484190a49e 100644 --- a/Exiled.Events/Patches/Events/Scp096/CalmingDown.cs +++ b/Exiled.Events/Patches/Events/Scp096/CalmingDown.cs @@ -23,8 +23,8 @@ namespace Exiled.Events.Patches.Events.Scp096 using static HarmonyLib.AccessTools; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [EventPatch(typeof(Handlers.Scp096), nameof(Handlers.Scp096.CalmingDown))] [HarmonyPatch(typeof(Scp096RageManager), nameof(Scp096RageManager.ServerEndEnrage))] diff --git a/Exiled.Events/Patches/Events/Scp096/Charging.cs b/Exiled.Events/Patches/Events/Scp096/Charging.cs index 2b9a928f25..85e799977c 100644 --- a/Exiled.Events/Patches/Events/Scp096/Charging.cs +++ b/Exiled.Events/Patches/Events/Scp096/Charging.cs @@ -25,8 +25,8 @@ namespace Exiled.Events.Patches.Events.Scp096 using static HarmonyLib.AccessTools; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [EventPatch(typeof(Handlers.Scp096), nameof(Handlers.Scp096.Charging))] [HarmonyPatch(typeof(Scp096ChargeAbility), nameof(Scp096ChargeAbility.ServerProcessCmd))] diff --git a/Exiled.Events/Patches/Events/Scp096/Enraging.cs b/Exiled.Events/Patches/Events/Scp096/Enraging.cs index 01a000dfab..5e0154629d 100644 --- a/Exiled.Events/Patches/Events/Scp096/Enraging.cs +++ b/Exiled.Events/Patches/Events/Scp096/Enraging.cs @@ -23,8 +23,8 @@ namespace Exiled.Events.Patches.Events.Scp096 using static HarmonyLib.AccessTools; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [EventPatch(typeof(Handlers.Scp096), nameof(Handlers.Scp096.Enraging))] [HarmonyPatch(typeof(Scp096RageManager), nameof(Scp096RageManager.ServerEnrage))] diff --git a/Exiled.Events/Patches/Events/Scp096/StartPryingGate.cs b/Exiled.Events/Patches/Events/Scp096/StartPryingGate.cs index fff01d98cd..420ef8c44f 100644 --- a/Exiled.Events/Patches/Events/Scp096/StartPryingGate.cs +++ b/Exiled.Events/Patches/Events/Scp096/StartPryingGate.cs @@ -27,8 +27,8 @@ namespace Exiled.Events.Patches.Events.Scp096 using static HarmonyLib.AccessTools; /// - /// Patches the method. - /// Adds the event. + /// Patches the method. + /// Adds the event. /// [EventPatch(typeof(Handlers.Scp096), nameof(Handlers.Scp096.StartPryingGate))] [HarmonyPatch(typeof(Scp096PrygateAbility), nameof(Scp096PrygateAbility.ServerProcessCmd))] diff --git a/Exiled.Events/Patches/Events/Scp096/TryingNotToCry.cs b/Exiled.Events/Patches/Events/Scp096/TryingNotToCry.cs index df3c46dbc8..63c40350fe 100644 --- a/Exiled.Events/Patches/Events/Scp096/TryingNotToCry.cs +++ b/Exiled.Events/Patches/Events/Scp096/TryingNotToCry.cs @@ -25,8 +25,8 @@ namespace Exiled.Events.Patches.Events.Scp096 using static HarmonyLib.AccessTools; /// - /// Patches the method. - /// Adds the event. + /// Patches the method. + /// Adds the event. /// [EventPatch(typeof(Handlers.Scp096), nameof(Handlers.Scp096.TryingNotToCry))] [HarmonyPatch(typeof(Scp096TryNotToCryAbility), nameof(Scp096TryNotToCryAbility.ServerProcessCmd))] diff --git a/Exiled.Events/Patches/Events/Scp106/Teleporting.cs b/Exiled.Events/Patches/Events/Scp106/Teleporting.cs index 47a5b80aac..f5d4aa9a39 100644 --- a/Exiled.Events/Patches/Events/Scp106/Teleporting.cs +++ b/Exiled.Events/Patches/Events/Scp106/Teleporting.cs @@ -23,8 +23,8 @@ namespace Exiled.Events.Patches.Events.Scp106 using Player = API.Features.Player; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [EventPatch(typeof(Scp106), nameof(Scp106.Teleporting))] [HarmonyPatch(typeof(Scp106HuntersAtlasAbility), nameof(Scp106HuntersAtlasAbility.GetSafePosition))] @@ -82,7 +82,7 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); diff --git a/Exiled.Events/Patches/Events/Scp173/Blinking.cs b/Exiled.Events/Patches/Events/Scp173/Blinking.cs index 7fbd374e9e..bb2f1ab61a 100644 --- a/Exiled.Events/Patches/Events/Scp173/Blinking.cs +++ b/Exiled.Events/Patches/Events/Scp173/Blinking.cs @@ -28,8 +28,8 @@ namespace Exiled.Events.Patches.Events.Scp173 using static HarmonyLib.AccessTools; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [EventPatch(typeof(Handlers.Scp173), nameof(Handlers.Scp173.Blinking))] [HarmonyPatch(typeof(Scp173BlinkTimer), nameof(Scp173BlinkTimer.ServerBlink))] diff --git a/Exiled.Events/Patches/Events/Scp173/BlinkingRequest.cs b/Exiled.Events/Patches/Events/Scp173/BlinkingRequest.cs index db62442fe1..942da124eb 100644 --- a/Exiled.Events/Patches/Events/Scp173/BlinkingRequest.cs +++ b/Exiled.Events/Patches/Events/Scp173/BlinkingRequest.cs @@ -25,8 +25,8 @@ namespace Exiled.Events.Patches.Events.Scp173 using static HarmonyLib.AccessTools; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [EventPatch(typeof(Handlers.Scp173), nameof(Handlers.Scp173.BlinkingRequest))] [HarmonyPatch(typeof(Scp173TeleportAbility), nameof(Scp173TeleportAbility.ServerProcessCmd))] diff --git a/Exiled.Events/Patches/Events/Scp173/UsingBreakneckSpeeds.cs b/Exiled.Events/Patches/Events/Scp173/UsingBreakneckSpeeds.cs index af99dfc023..8acf3f6f94 100644 --- a/Exiled.Events/Patches/Events/Scp173/UsingBreakneckSpeeds.cs +++ b/Exiled.Events/Patches/Events/Scp173/UsingBreakneckSpeeds.cs @@ -23,8 +23,8 @@ namespace Exiled.Events.Patches.Events.Scp173 using static HarmonyLib.AccessTools; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [EventPatch(typeof(Handlers.Scp173), nameof(Handlers.Scp173.UsingBreakneckSpeeds))] [HarmonyPatch(typeof(Scp173BreakneckSpeedsAbility), nameof(Scp173BreakneckSpeedsAbility.IsActive), MethodType.Setter)] @@ -50,7 +50,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.Events/Patches/Events/Scp244/DamagingScp244.cs b/Exiled.Events/Patches/Events/Scp244/DamagingScp244.cs index 3cc14e71e4..7bb4a51603 100644 --- a/Exiled.Events/Patches/Events/Scp244/DamagingScp244.cs +++ b/Exiled.Events/Patches/Events/Scp244/DamagingScp244.cs @@ -24,8 +24,8 @@ namespace Exiled.Events.Patches.Events.Scp244 using static HarmonyLib.AccessTools; /// - /// Patches to add missing logic to the - /// . + /// Patches to add missing logic to the + /// . /// [EventPatch(typeof(Scp244), nameof(Scp244.DamagingScp244))] [HarmonyPatch(typeof(Scp244DeployablePickup), nameof(Scp244DeployablePickup.Damage))] diff --git a/Exiled.Events/Patches/Events/Scp244/UpdateScp244.cs b/Exiled.Events/Patches/Events/Scp244/UpdateScp244.cs index bc3d4002a8..2443644675 100644 --- a/Exiled.Events/Patches/Events/Scp244/UpdateScp244.cs +++ b/Exiled.Events/Patches/Events/Scp244/UpdateScp244.cs @@ -24,8 +24,8 @@ namespace Exiled.Events.Patches.Events.Scp244 using static HarmonyLib.AccessTools; /// - /// Patches to add missing event handler to the - /// . + /// Patches to add missing event handler to the + /// . /// [EventPatch(typeof(Scp244), nameof(Scp244.OpeningScp244))] [HarmonyPatch(typeof(Scp244DeployablePickup), nameof(Scp244DeployablePickup.UpdateRange))] diff --git a/Exiled.Events/Patches/Events/Scp244/UsingScp244.cs b/Exiled.Events/Patches/Events/Scp244/UsingScp244.cs index 55e1139173..586d1d4302 100644 --- a/Exiled.Events/Patches/Events/Scp244/UsingScp244.cs +++ b/Exiled.Events/Patches/Events/Scp244/UsingScp244.cs @@ -25,8 +25,8 @@ namespace Exiled.Events.Patches.Events.Scp244 using Player = API.Features.Player; /// - /// Patches to add missing event handler to the - /// . + /// Patches to add missing event handler to the + /// . /// [EventPatch(typeof(Scp244), nameof(Scp244.UsingScp244))] [HarmonyPatch(typeof(Scp244Item), nameof(Scp244Item.ServerOnUsingCompleted))] diff --git a/Exiled.Events/Patches/Events/Scp3114/Disguising.cs b/Exiled.Events/Patches/Events/Scp3114/Disguising.cs index 5c7b9a61bc..3fd2d97d46 100644 --- a/Exiled.Events/Patches/Events/Scp3114/Disguising.cs +++ b/Exiled.Events/Patches/Events/Scp3114/Disguising.cs @@ -7,45 +7,95 @@ namespace Exiled.Events.Patches.Events.Scp3114 { + using System.Collections.Generic; + using System.Reflection.Emit; + + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp3114; using Exiled.Events.Handlers; -#pragma warning disable SA1313 // Parameter names should begin with lower-case letter - using HarmonyLib; - using Mirror; + using PlayerRoles.PlayableScps.Scp3114; - using PlayerRoles.PlayableScps.Subroutines; using PlayerRoles.Ragdolls; + using static HarmonyLib.AccessTools; + /// - /// Patches . - /// Adds the and events. + /// Patches . + /// Adds the and events. /// [EventPatch(typeof(Scp3114), nameof(Scp3114.Disguising))] [EventPatch(typeof(Scp3114), nameof(Scp3114.Disguised))] [HarmonyPatch(typeof(Scp3114Disguise), nameof(Scp3114Disguise.ServerComplete))] internal class Disguising { - private static bool Prefix(Scp3114Disguise __instance) + private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) { - if (__instance.CurRagdoll != null && __instance.CurRagdoll is DynamicRagdoll ragdoll) + List newInstructions = ListPool.Pool.Get(instructions); + + Label retLabel = generator.DefineLabel(); + + LocalBuilder player = generator.DeclareLocal(typeof(API.Features.Player)); + LocalBuilder ragdoll = generator.DeclareLocal(typeof(API.Features.Ragdoll)); + + newInstructions.InsertRange(0, new CodeInstruction[] { - DisguisingEventArgs disguising = new(__instance.Owner, ragdoll); - Scp3114.OnDisguising(disguising); + // Player.Get(this.Owner); + new(OpCodes.Ldarg_0), + new(OpCodes.Callvirt, PropertyGetter(typeof(Scp3114Disguise), nameof(Scp3114Disguise.Owner))), + new(OpCodes.Call, Method(typeof(API.Features.Player), nameof(API.Features.Player.Get), new[] { typeof(ReferenceHub) })), + new(OpCodes.Dup), + new(OpCodes.Stloc_S, player.LocalIndex), + + // Ragdoll.Get(this.CurRagdoll); + new(OpCodes.Ldarg_0), + new(OpCodes.Callvirt, PropertyGetter(typeof(Scp3114Disguise), nameof(Scp3114Disguise.CurRagdoll))), + new(OpCodes.Call, Method(typeof(API.Features.Ragdoll), nameof(API.Features.Ragdoll.Get), new[] { typeof(BasicRagdoll) })), + new(OpCodes.Dup), + new(OpCodes.Stloc_S, ragdoll.LocalIndex), + + // true + new(OpCodes.Ldc_I4_1), + + // DisguisingEventArgs ev = new DisguisingEventArgs(Player, Ragdoll, bool) + new(OpCodes.Newobj, GetDeclaredConstructors(typeof(DisguisingEventArgs))[0]), + new(OpCodes.Dup), + + // Handlers.Scp3114.OnDisguising(ev); + new(OpCodes.Call, Method(typeof(Handlers.Scp3114), nameof(Handlers.Scp3114.OnDisguising))), + + // if (!ev.IsAllowed) + // return; + new(OpCodes.Callvirt, PropertyGetter(typeof(TryUseBodyEventArgs), nameof(TryUseBodyEventArgs.IsAllowed))), + new(OpCodes.Brfalse_S, retLabel), + }); + + const int offset = 0; + int index = newInstructions.FindLastIndex(instruction => instruction.opcode == OpCodes.Ret) + offset; + + newInstructions.InsertRange(index, new CodeInstruction[] + { + // player + new(OpCodes.Ldloc_S, player.LocalIndex), + + // ragdoll + new(OpCodes.Ldloc_S, ragdoll.LocalIndex), + + // DisguisedEventArgs ev = new DisguisedEventArgs(Player, Ragdoll); + new(OpCodes.Newobj, GetDeclaredConstructors(typeof(DisguisedEventArgs))[0]), - if (!disguising.IsAllowed) - return false; + // Handlers.Scp3114.OnDisguised(ev); + new(OpCodes.Call, Method(typeof(Handlers.Scp3114), nameof(Handlers.Scp3114.OnDisguised))), + }); - __instance.CastRole.Disguised = true; - Scp3114RagdollToBonesConverter.ServerConvertNew(__instance.CastRole, ragdoll); + newInstructions[newInstructions.Count - 1].WithLabels(retLabel); - DisguisedEventArgs disguised = new(__instance.Owner, ragdoll); - Scp3114.OnDisguised(disguised); - } + for (int z = 0; z < newInstructions.Count; z++) + yield return newInstructions[z]; - return false; + ListPool.Pool.Return(newInstructions); } } } diff --git a/Exiled.Events/Patches/Events/Scp3114/Revealing.cs b/Exiled.Events/Patches/Events/Scp3114/Revealing.cs index 0d6c479f00..ca8d6988a8 100644 --- a/Exiled.Events/Patches/Events/Scp3114/Revealing.cs +++ b/Exiled.Events/Patches/Events/Scp3114/Revealing.cs @@ -7,79 +7,181 @@ namespace Exiled.Events.Patches.Events.Scp3114 { - using Exiled.Events.Attributes; -#pragma warning disable SA1313 // Parameter names should begin with lower-case letter #pragma warning disable SA1402 // File may only contain a single type + using System.Collections.Generic; + using System.Reflection.Emit; + + using Exiled.API.Features.Pools; + using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp3114; using Exiled.Events.Handlers; using HarmonyLib; - using Mirror; - using PlayerRoles.PlayableScps.Scp3114; + using PlayerRoles.Subroutines; - using static PlayerRoles.PlayableScps.Scp3114.Scp3114Identity; + using static HarmonyLib.AccessTools; /// - /// Patches setter. - /// Adds the and event. + /// Patches setter. + /// Adds the and event. /// [EventPatch(typeof(Scp3114), nameof(Scp3114.Revealed))] [EventPatch(typeof(Scp3114), nameof(Scp3114.Revealing))] [HarmonyPatch(typeof(Scp3114Identity), nameof(Scp3114Identity.Update))] internal class Revealing { - private static bool Prefix(Scp3114Identity __instance) + private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) { - __instance.UpdateWarningAudio(); - if (NetworkServer.active && __instance.CurIdentity.Status == DisguiseStatus.Active && __instance.RemainingDuration.IsReady) + List newInstructions = ListPool.Pool.Get(instructions); + + Label continueLabel = generator.DefineLabel(); + + LocalBuilder player = generator.DeclareLocal(typeof(API.Features.Player)); + + int offset = 1; + int index = newInstructions.FindIndex(instruction => instruction.opcode == OpCodes.Brfalse_S) + offset; + + newInstructions.InsertRange(index, new CodeInstruction[] + { + // Player.Get(this.Owner); + new(OpCodes.Ldarg_0), + new(OpCodes.Callvirt, PropertyGetter(typeof(Scp3114Reveal), nameof(Scp3114Reveal.Owner))), + new(OpCodes.Call, Method(typeof(API.Features.Player), nameof(API.Features.Player.Get), new[] { typeof(ReferenceHub) })), + new(OpCodes.Dup), + new(OpCodes.Stloc_S, player.LocalIndex), + + // false (IsManualReveal) + new(OpCodes.Ldc_I4_0), + + // true + new(OpCodes.Ldc_I4_1), + + // RevealingEventArgs ev = new RevealingEventArgs(Player, bool, bool); + new(OpCodes.Newobj, GetDeclaredConstructors(typeof(RevealingEventArgs))[0]), + new(OpCodes.Dup), + + // Handlers.Scp3114.OnRevealing(ev); + new(OpCodes.Call, Method(typeof(Handlers.Scp3114), nameof(Handlers.Scp3114.OnRevealing))), + + // if (ev.IsAllowed) + // goto continueLabel; + new(OpCodes.Callvirt, PropertyGetter(typeof(RevealingEventArgs), nameof(RevealingEventArgs.IsAllowed))), + new(OpCodes.Brtrue_S, continueLabel), + + // this.RemainingDuration.Trigger(this._disguiseDurationSeconds); + new(OpCodes.Ldarg_0), + new(OpCodes.Ldfld, Field(typeof(Scp3114Identity), nameof(Scp3114Identity.RemainingDuration))), + new(OpCodes.Ldarg_0), + new(OpCodes.Ldfld, Field(typeof(Scp3114Identity), nameof(Scp3114Identity._disguiseDurationSeconds))), + new(OpCodes.Conv_R8), + new(OpCodes.Call, Method(typeof(AbilityCooldown), nameof(AbilityCooldown.Trigger))), + + // this.ServerResendIdentity(); + new(OpCodes.Ldarg_0), + new(OpCodes.Call, Method(typeof(Scp3114Identity), nameof(Scp3114Identity.ServerResendIdentity))), + + // return; + new(OpCodes.Ret), + + new CodeInstruction(OpCodes.Nop).WithLabels(continueLabel), + }); + + offset = 1; + index = newInstructions.FindLastIndex(instruction => instruction.opcode == OpCodes.Call) + offset; + + newInstructions.InsertRange(index, new[] { - RevealingEventArgs revealing = new(__instance.Owner); - Handlers.Scp3114.OnRevealing(revealing); - if (!revealing.IsAllowed) - { - __instance.RemainingDuration.Trigger(__instance._disguiseDurationSeconds); - __instance.ServerResendIdentity(); - return false; - } - - __instance.CurIdentity.Status = DisguiseStatus.None; - __instance.ServerResendIdentity(); - - RevealedEventArgs revealed = new(__instance.Owner); - Handlers.Scp3114.OnRevealed(revealed); - } - - return false; + // player + new CodeInstruction(OpCodes.Ldloc_S, player.LocalIndex), + + // false (IsManualReveal) + new(OpCodes.Ldc_I4_0), + + // RevealedEventArgs ev = new RevealedEventArgs(Player, bool); + new(OpCodes.Newobj, GetDeclaredConstructors(typeof(RevealedEventArgs))[0]), + + // Handlers.Scp3114.OnRevealed(ev); + new(OpCodes.Call, Method(typeof(Handlers.Scp3114), nameof(Handlers.Scp3114.OnRevealed))), + }); + + for (int z = 0; z < newInstructions.Count; z++) + yield return newInstructions[z]; + + ListPool.Pool.Return(newInstructions); } } /// - /// Patches . - /// Adds the and event. + /// Patches . + /// Adds the and event. /// [EventPatch(typeof(Scp3114), nameof(Scp3114.Revealed))] [EventPatch(typeof(Scp3114), nameof(Scp3114.Revealing))] [HarmonyPatch(typeof(Scp3114Reveal), nameof(Scp3114Reveal.ServerProcessCmd))] internal class RevealingKey { - private static bool Prefix(Scp3114Reveal __instance, NetworkReader reader) + private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) { - RevealingEventArgs revealing = new(__instance.Owner); - Handlers.Scp3114.OnRevealing(revealing); + List newInstructions = ListPool.Pool.Get(instructions); + + Label retLabel = generator.DefineLabel(); + + LocalBuilder player = generator.DeclareLocal(typeof(API.Features.Player)); - if (!revealing.IsAllowed) + newInstructions.InsertRange(0, new CodeInstruction[] { - return false; - } + // Player.Get(this.Owner); + new(OpCodes.Ldarg_0), + new(OpCodes.Callvirt, PropertyGetter(typeof(Scp3114Reveal), nameof(Scp3114Reveal.Owner))), + new(OpCodes.Call, Method(typeof(API.Features.Player), nameof(API.Features.Player.Get), new[] { typeof(ReferenceHub) })), + new(OpCodes.Dup), + new(OpCodes.Stloc_S, player.LocalIndex), + + // true (IsManualReveal) + new(OpCodes.Ldc_I4_1), + + // true + new(OpCodes.Ldc_I4_1), + + // RevealingEventArgs ev = new RevealingEventArgs(Player, bool, bool); + new(OpCodes.Newobj, GetDeclaredConstructors(typeof(RevealingEventArgs))[0]), + new(OpCodes.Dup), + + // Handlers.Scp3114.OnRevealing(ev); + new(OpCodes.Call, Method(typeof(Handlers.Scp3114), nameof(Handlers.Scp3114.OnRevealing))), + + // if (!ev.IsAllowed) + // return; + new(OpCodes.Callvirt, PropertyGetter(typeof(RevealingEventArgs), nameof(RevealingEventArgs.IsAllowed))), + new(OpCodes.Brfalse_S, retLabel), + }); + + const int offset = 0; + int index = newInstructions.FindLastIndex(instruction => instruction.opcode == OpCodes.Ret) + offset; + + newInstructions.InsertRange(index, new CodeInstruction[] + { + // player + new(OpCodes.Ldloc_S, player.LocalIndex), + + // true (IsManualReveal) + new(OpCodes.Ldc_I4_1), + + // RevealedEventArgs ev = new RevealedEventArgs(Player, bool); + new(OpCodes.Newobj, GetDeclaredConstructors(typeof(RevealedEventArgs))[0]), + + // Handlers.Scp3114.OnRevealed(ev); + new(OpCodes.Call, Method(typeof(Handlers.Scp3114), nameof(Handlers.Scp3114.OnRevealed))), + }); - __instance.CastRole.Disguised = false; + newInstructions[newInstructions.Count - 1].WithLabels(retLabel); - RevealedEventArgs revealed = new(__instance.Owner); - Handlers.Scp3114.OnRevealed(revealed); + for (int z = 0; z < newInstructions.Count; z++) + yield return newInstructions[z]; - return false; + ListPool.Pool.Return(newInstructions); } } -} +} \ No newline at end of file diff --git a/Exiled.Events/Patches/Events/Scp3114/TryUseBody.cs b/Exiled.Events/Patches/Events/Scp3114/TryUseBody.cs index 7149ab345a..d3b9bc87a7 100644 --- a/Exiled.Events/Patches/Events/Scp3114/TryUseBody.cs +++ b/Exiled.Events/Patches/Events/Scp3114/TryUseBody.cs @@ -7,47 +7,75 @@ namespace Exiled.Events.Patches.Events.Scp3114 { + using System.Collections.Generic; + using System.Reflection.Emit; + + using Exiled.API.Features.Pools; using Exiled.Events.Attributes; using Exiled.Events.EventArgs.Scp3114; using Exiled.Events.Handlers; -#pragma warning disable SA1313 // Parameter names should begin with lower-case letter + using HarmonyLib; + using PlayerRoles.PlayableScps.Scp3114; + using PlayerRoles.Ragdolls; + + using static HarmonyLib.AccessTools; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [EventPatch(typeof(Scp3114), nameof(Scp3114.TryUseBody))] - [HarmonyPatch(typeof(Scp3114Disguise), nameof(Scp3114Disguise.OnProgressSet))] + [HarmonyPatch(typeof(Scp3114Disguise), nameof(Scp3114Disguise.ServerValidateBegin))] internal class TryUseBody { - private static bool Prefix(Scp3114Disguise __instance) + private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) { - Scp3114Identity.StolenIdentity curIdentity = __instance.CastRole.CurIdentity; - if (__instance.IsInProgress) + List newInstructions = ListPool.Pool.Get(instructions); + + Label retLabel = generator.DefineLabel(); + Label continueLabel = generator.DefineLabel(); + + newInstructions.InsertRange(0, new CodeInstruction[] { - TryUseBodyEventArgs ev = new(__instance.Owner, __instance.CurRagdoll, true); - Handlers.Scp3114.OnTryUseBody(ev); + // Player.Get(this.Owner); + new(OpCodes.Ldarg_0), + new(OpCodes.Callvirt, PropertyGetter(typeof(Scp3114Disguise), nameof(Scp3114Disguise.Owner))), + new(OpCodes.Call, Method(typeof(API.Features.Player), nameof(API.Features.Player.Get), new[] { typeof(ReferenceHub) })), - if (!ev.IsAllowed) - return false; + // Ragdoll.Get(this.CurRagdoll); + new(OpCodes.Ldarg_0), + new(OpCodes.Callvirt, PropertyGetter(typeof(Scp3114Disguise), nameof(Scp3114Disguise.CurRagdoll))), + new(OpCodes.Call, Method(typeof(API.Features.Ragdoll), nameof(API.Features.Ragdoll.Get), new[] { typeof(BasicRagdoll) })), - __instance._equipSkinSound.Play(); - curIdentity.Ragdoll = __instance.CurRagdoll; - curIdentity.UnitNameId = __instance._prevUnitIds.TryGetValue(__instance.CurRagdoll, out byte b) ? b : byte.MinValue; - curIdentity.Status = Scp3114Identity.DisguiseStatus.Equipping; - return false; - } + // true + new(OpCodes.Ldc_I4_1), - if (curIdentity.Status == Scp3114Identity.DisguiseStatus.Equipping) - { - __instance._equipSkinSound.Stop(); - curIdentity.Status = Scp3114Identity.DisguiseStatus.None; - __instance.Cooldown.Trigger((double)__instance.Duration); - } + // TryUseBodyEventArgs ev = new TryUseBodyEventArgs(Player, Ragdoll, bool) + new(OpCodes.Newobj, GetDeclaredConstructors(typeof(TryUseBodyEventArgs))[0]), + new(OpCodes.Dup), + + // Handlers.Scp3114.OnTryUseBody(ev); + new(OpCodes.Call, Method(typeof(Handlers.Scp3114), nameof(Handlers.Scp3114.OnTryUseBody))), + + // if (!ev.IsAllowed) + // return (sbyte) Scp3114HudTranslation.RagdollErrorPreviouslyUsed; + // else + // continue; + new(OpCodes.Callvirt, PropertyGetter(typeof(TryUseBodyEventArgs), nameof(TryUseBodyEventArgs.IsAllowed))), + new(OpCodes.Brtrue_S, continueLabel), + new(OpCodes.Ldc_I4_S, (sbyte)Scp3114HudTranslation.RagdollErrorPreviouslyUsed), + new(OpCodes.Ret), + new CodeInstruction(OpCodes.Nop).WithLabels(continueLabel), + }); + + newInstructions[newInstructions.Count - 1].WithLabels(retLabel); + + for (int z = 0; z < newInstructions.Count; z++) + yield return newInstructions[z]; - return false; + ListPool.Pool.Return(newInstructions); } } } diff --git a/Exiled.Events/Patches/Events/Scp3114/VoiceLines.cs b/Exiled.Events/Patches/Events/Scp3114/VoiceLines.cs new file mode 100644 index 0000000000..59983bb993 --- /dev/null +++ b/Exiled.Events/Patches/Events/Scp3114/VoiceLines.cs @@ -0,0 +1,83 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Events.Patches.Events.Scp3114 +{ + using System.Collections.Generic; + using System.Reflection.Emit; + + using Exiled.API.Features.Pools; + using Exiled.Events.Attributes; + using Exiled.Events.EventArgs.Scp3114; + using Exiled.Events.Handlers; + + using HarmonyLib; + + using PlayerRoles.PlayableScps.Scp3114; + + using static HarmonyLib.AccessTools; + + /// + /// Patches . + /// Adds the event. + /// + [EventPatch(typeof(Scp3114), nameof(Scp3114.VoiceLines))] + [HarmonyPatch(typeof(Scp3114VoiceLines), nameof(Scp3114VoiceLines.ServerPlayConditionally))] + internal class VoiceLines + { + private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) + { + List newInstructions = ListPool.Pool.Get(instructions); + + Label returnLabel = generator.DefineLabel(); + + LocalBuilder ev = generator.DeclareLocal(typeof(VoiceLinesEventArgs)); + + int offset = 1; + int index = newInstructions.FindIndex(instruction => instruction.opcode == OpCodes.Blt_S) + offset; + + newInstructions.InsertRange(index, new CodeInstruction[] + { + // this.Owner + new(OpCodes.Ldarg_0), + new(OpCodes.Callvirt, PropertyGetter(typeof(Scp3114VoiceLines), nameof(Scp3114VoiceLines.Owner))), + + // voiceLinesDefinition + new(OpCodes.Ldloc_0), + + // true + new(OpCodes.Ldc_I4_1), + + // VoiceLinesEventArgs ev = new VoiceLinesEventArgs(ReferenceHub, VoiceLinesDefinition, bool); + new(OpCodes.Newobj, GetDeclaredConstructors(typeof(VoiceLinesEventArgs))[0]), + new(OpCodes.Dup), + new(OpCodes.Dup), + new(OpCodes.Stloc_S, ev.LocalIndex), + + // Handlers.Scp3114.OnVoiceLines(ev); + new(OpCodes.Call, Method(typeof(Handlers.Scp3114), nameof(Handlers.Scp3114.OnVoiceLines))), + + // if(!ev.IsAllowed) + // return; + new(OpCodes.Callvirt, PropertyGetter(typeof(VoiceLinesEventArgs), nameof(VoiceLinesEventArgs.IsAllowed))), + new(OpCodes.Brfalse_S, returnLabel), + + // voiceLinesDefinition = ev.VoiceLine; + new(OpCodes.Ldloc_S, ev.LocalIndex), + new(OpCodes.Callvirt, PropertyGetter(typeof(VoiceLinesEventArgs), nameof(VoiceLinesEventArgs.VoiceLine))), + new(OpCodes.Stloc_S, 0), + }); + + newInstructions[newInstructions.Count - 1].labels.Add(returnLabel); + + for (int z = 0; z < newInstructions.Count; z++) + yield return newInstructions[z]; + + ListPool.Pool.Return(newInstructions); + } + } +} \ No newline at end of file diff --git a/Exiled.Events/Patches/Events/Scp330/DroppingCandy.cs b/Exiled.Events/Patches/Events/Scp330/DroppingCandy.cs index 6f1f61e6ca..a4bd131a9b 100644 --- a/Exiled.Events/Patches/Events/Scp330/DroppingCandy.cs +++ b/Exiled.Events/Patches/Events/Scp330/DroppingCandy.cs @@ -28,8 +28,8 @@ namespace Exiled.Events.Patches.Events.Scp330 using Player = API.Features.Player; /// - /// Patches the method to add the - /// event. + /// Patches the method to add the + /// event. /// [EventPatch(typeof(Scp330), nameof(Scp330.DroppingScp330))] [HarmonyPatch(typeof(Scp330NetworkHandler), nameof(Scp330NetworkHandler.ServerSelectMessageReceived))] diff --git a/Exiled.Events/Patches/Events/Scp330/EatingScp330.cs b/Exiled.Events/Patches/Events/Scp330/EatingScp330.cs index d8dd465865..1ad59414d4 100644 --- a/Exiled.Events/Patches/Events/Scp330/EatingScp330.cs +++ b/Exiled.Events/Patches/Events/Scp330/EatingScp330.cs @@ -25,8 +25,8 @@ namespace Exiled.Events.Patches.Events.Scp330 using Player = API.Features.Player; /// - /// Patches . - /// Adds the and event. + /// Patches . + /// Adds the and event. /// [EventPatch(typeof(Scp330), nameof(Scp330.EatingScp330))] [EventPatch(typeof(Scp330), nameof(Scp330.EatenScp330))] diff --git a/Exiled.Events/Patches/Events/Scp330/InteractingScp330.cs b/Exiled.Events/Patches/Events/Scp330/InteractingScp330.cs index 63dc4b93f2..0c43bbadd7 100644 --- a/Exiled.Events/Patches/Events/Scp330/InteractingScp330.cs +++ b/Exiled.Events/Patches/Events/Scp330/InteractingScp330.cs @@ -29,8 +29,8 @@ namespace Exiled.Events.Patches.Events.Scp330 using Player = API.Features.Player; /// - /// Patches the method to add the - /// event. + /// Patches the method to add the + /// event. /// [EventPatch(typeof(Scp330), nameof(Scp330.InteractingScp330))] [HarmonyPatch(typeof(Scp330Interobject), nameof(Scp330Interobject.ServerInteract))] diff --git a/Exiled.Events/Patches/Events/Scp914/InteractingEvents.cs b/Exiled.Events/Patches/Events/Scp914/InteractingEvents.cs index 917eac7a9a..da157c1e86 100644 --- a/Exiled.Events/Patches/Events/Scp914/InteractingEvents.cs +++ b/Exiled.Events/Patches/Events/Scp914/InteractingEvents.cs @@ -24,8 +24,8 @@ namespace Exiled.Events.Patches.Events.Scp914 using Scp914 = Handlers.Scp914; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [EventPatch(typeof(Scp914), nameof(Scp914.Activating))] [HarmonyPatch(typeof(Scp914Controller), nameof(Scp914Controller.ServerInteract))] diff --git a/Exiled.Events/Patches/Events/Scp914/UpgradingItem.cs b/Exiled.Events/Patches/Events/Scp914/UpgradingItem.cs index 7469efb927..300952c334 100644 --- a/Exiled.Events/Patches/Events/Scp914/UpgradingItem.cs +++ b/Exiled.Events/Patches/Events/Scp914/UpgradingItem.cs @@ -23,8 +23,8 @@ namespace Exiled.Events.Patches.Events.Scp914 using static HarmonyLib.AccessTools; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [EventPatch(typeof(Scp914), nameof(Scp914.UpgradingPickup))] [HarmonyPatch(typeof(Scp914Upgrader), nameof(Scp914Upgrader.ProcessPickup))] diff --git a/Exiled.Events/Patches/Events/Scp914/UpgradingPlayer.cs b/Exiled.Events/Patches/Events/Scp914/UpgradingPlayer.cs index fffd2e5e99..a58a4d2a43 100644 --- a/Exiled.Events/Patches/Events/Scp914/UpgradingPlayer.cs +++ b/Exiled.Events/Patches/Events/Scp914/UpgradingPlayer.cs @@ -24,8 +24,8 @@ namespace Exiled.Events.Patches.Events.Scp914 using Scp914 = Handlers.Scp914; /// - /// Patches - /// to add the event. + /// Patches + /// to add the event. /// [EventPatch(typeof(Scp914), nameof(Scp914.UpgradingPlayer))] [HarmonyPatch(typeof(Scp914Upgrader), nameof(Scp914Upgrader.ProcessPlayer))] diff --git a/Exiled.Events/Patches/Events/Scp939/Focus.cs b/Exiled.Events/Patches/Events/Scp939/Focus.cs index 30107ccf99..a4992f2a83 100644 --- a/Exiled.Events/Patches/Events/Scp939/Focus.cs +++ b/Exiled.Events/Patches/Events/Scp939/Focus.cs @@ -23,8 +23,8 @@ namespace Exiled.Events.Patches.Events.Scp939 using static HarmonyLib.AccessTools; /// - /// Patches - /// to add the event. + /// Patches + /// to add the event. /// [EventPatch(typeof(Scp939), nameof(Scp939.ChangingFocus))] [HarmonyPatch(typeof(Scp939FocusKeySync), nameof(Scp939FocusKeySync.ServerProcessCmd))] diff --git a/Exiled.Events/Patches/Events/Scp939/Lunge.cs b/Exiled.Events/Patches/Events/Scp939/Lunge.cs index e19b63ef19..c9f1019af7 100644 --- a/Exiled.Events/Patches/Events/Scp939/Lunge.cs +++ b/Exiled.Events/Patches/Events/Scp939/Lunge.cs @@ -21,8 +21,8 @@ namespace Exiled.Events.Patches.Events.Scp939 using static HarmonyLib.AccessTools; /// - /// Patches - /// to add the event. + /// Patches + /// to add the event. /// [EventPatch(typeof(Scp939), nameof(Scp939.Lunging))] [HarmonyPatch(typeof(Scp939LungeAbility), nameof(Scp939LungeAbility.TriggerLunge))] diff --git a/Exiled.Events/Patches/Events/Scp939/PlacingAmnesticCloud.cs b/Exiled.Events/Patches/Events/Scp939/PlacingAmnesticCloud.cs index 9a6c70e934..e4b8dadaa1 100644 --- a/Exiled.Events/Patches/Events/Scp939/PlacingAmnesticCloud.cs +++ b/Exiled.Events/Patches/Events/Scp939/PlacingAmnesticCloud.cs @@ -23,8 +23,8 @@ namespace Exiled.Events.Patches.Events.Scp939 using static HarmonyLib.AccessTools; /// - /// Patches - /// to add the event. + /// Patches + /// to add the event. /// [EventPatch(typeof(Scp939), nameof(Scp939.PlacingAmnesticCloud))] [HarmonyPatch(typeof(Scp939AmnesticCloudAbility), nameof(Scp939AmnesticCloudAbility.ServerProcessCmd))] diff --git a/Exiled.Events/Patches/Events/Scp939/PlayingSound.cs b/Exiled.Events/Patches/Events/Scp939/PlayingSound.cs index 30bb2da64d..2df21c0cf3 100644 --- a/Exiled.Events/Patches/Events/Scp939/PlayingSound.cs +++ b/Exiled.Events/Patches/Events/Scp939/PlayingSound.cs @@ -24,8 +24,8 @@ namespace Exiled.Events.Patches.Events.Scp939 using static HarmonyLib.AccessTools; /// - /// Patches - /// to add the event. + /// Patches + /// to add the event. /// [EventPatch(typeof(Scp939), nameof(Scp939.PlayingSound))] [HarmonyPatch(typeof(EnvironmentalMimicry), nameof(EnvironmentalMimicry.ServerProcessCmd))] diff --git a/Exiled.Events/Patches/Events/Scp939/PlayingVoice.cs b/Exiled.Events/Patches/Events/Scp939/PlayingVoice.cs index 6ee6ef33a3..84372d0dbb 100644 --- a/Exiled.Events/Patches/Events/Scp939/PlayingVoice.cs +++ b/Exiled.Events/Patches/Events/Scp939/PlayingVoice.cs @@ -24,8 +24,8 @@ namespace Exiled.Events.Patches.Events.Scp939 using static HarmonyLib.AccessTools; /// - /// Patches - /// to add the event. + /// Patches + /// to add the event. /// [EventPatch(typeof(Scp939), nameof(Scp939.PlayingVoice))] [HarmonyPatch(typeof(MimicryRecorder), nameof(MimicryRecorder.ServerProcessCmd))] diff --git a/Exiled.Events/Patches/Events/Scp939/SavingVoice.cs b/Exiled.Events/Patches/Events/Scp939/SavingVoice.cs index 976b2348ca..d0bafe5d0e 100644 --- a/Exiled.Events/Patches/Events/Scp939/SavingVoice.cs +++ b/Exiled.Events/Patches/Events/Scp939/SavingVoice.cs @@ -22,8 +22,8 @@ namespace Exiled.Events.Patches.Events.Scp939 using static HarmonyLib.AccessTools; /// - /// Patches - /// to add the event. + /// Patches + /// to add the event. /// [EventPatch(typeof(Scp939), nameof(Scp939.SavingVoice))] [HarmonyPatch(typeof(MimicryRecorder), nameof(MimicryRecorder.OnAnyPlayerKilled))] diff --git a/Exiled.Events/Patches/Events/Scp939/ValidatingVisibility.cs b/Exiled.Events/Patches/Events/Scp939/ValidatingVisibility.cs new file mode 100644 index 0000000000..bef8d5408b --- /dev/null +++ b/Exiled.Events/Patches/Events/Scp939/ValidatingVisibility.cs @@ -0,0 +1,32 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Events.Patches.Events.Scp939 +{ + #pragma warning disable SA1313 + + using Exiled.Events.Attributes; + using Exiled.Events.EventArgs.Scp939; + using HarmonyLib; + using PlayerRoles.PlayableScps.Scp939; + + /// + /// Patches + /// to add the event. + /// + [EventPatch(typeof(Handlers.Scp939), nameof(Handlers.Scp939.ValidatingVisibility))] + [HarmonyPatch(typeof(Scp939VisibilityController), nameof(Scp939VisibilityController.ValidateVisibility))] + internal class ValidatingVisibility + { + private static void Postfix(Scp939VisibilityController __instance, ReferenceHub hub, ref bool __result) + { + ValidatingVisibilityEventArgs ev = new(__instance.Owner, hub, __result); + Handlers.Scp939.OnValidatingVisibility(ev); + __result = ev.IsAllowed; + } + } +} \ No newline at end of file diff --git a/Exiled.Events/Patches/Events/Server/ChoosingStartTeamQueue.cs b/Exiled.Events/Patches/Events/Server/ChoosingStartTeamQueue.cs index 6d5c41891d..0bbc59c2c7 100644 --- a/Exiled.Events/Patches/Events/Server/ChoosingStartTeamQueue.cs +++ b/Exiled.Events/Patches/Events/Server/ChoosingStartTeamQueue.cs @@ -19,8 +19,8 @@ namespace Exiled.Events.Patches.Events.Server using static HarmonyLib.AccessTools; /// - /// Patches setter. - /// Adds the . + /// Patches setter. + /// Adds the . /// [EventPatch(typeof(Handlers.Server), nameof(Handlers.Server.ChoosingStartTeamQueue))] [HarmonyPatch(typeof(RoleAssigner), nameof(RoleAssigner.OnRoundStarted))] diff --git a/Exiled.Events/Patches/Events/Server/Reporting.cs b/Exiled.Events/Patches/Events/Server/Reporting.cs index 6f58d608a5..bba54c92ed 100644 --- a/Exiled.Events/Patches/Events/Server/Reporting.cs +++ b/Exiled.Events/Patches/Events/Server/Reporting.cs @@ -25,8 +25,8 @@ namespace Exiled.Events.Patches.Events.Server using Player = API.Features.Player; /// - /// Patches CheaterReport.UserCode_CmdReport__UInt32__String__Byte\u005B\u005D__Boolean(uint, string, byte[], bool) />. - /// Adds the and events. + /// Patches CheaterReport.UserCode_CmdReport__UInt32__String__Byte\u005B\u005D__Boolean(uint, string, byte[], bool) />. + /// Adds the and events. /// [EventPatch(typeof(Server), nameof(Server.ReportingCheater))] [EventPatch(typeof(Server), nameof(Server.LocalReporting))] diff --git a/Exiled.Events/Patches/Events/Server/RespawningTeam.cs b/Exiled.Events/Patches/Events/Server/RespawningTeam.cs index e5fec1e42b..a81b42a1eb 100644 --- a/Exiled.Events/Patches/Events/Server/RespawningTeam.cs +++ b/Exiled.Events/Patches/Events/Server/RespawningTeam.cs @@ -25,8 +25,8 @@ namespace Exiled.Events.Patches.Events.Server using Player = API.Features.Player; /// - /// Patch the . - /// Adds the event. + /// Patch the . + /// Adds the event. /// [EventPatch(typeof(Server), nameof(Server.RespawningTeam))] [HarmonyPatch(typeof(RespawnManager), nameof(RespawnManager.Spawn))] diff --git a/Exiled.Events/Patches/Events/Server/RestartingRound.cs b/Exiled.Events/Patches/Events/Server/RestartingRound.cs index 725a740c83..99c3a5e06c 100644 --- a/Exiled.Events/Patches/Events/Server/RestartingRound.cs +++ b/Exiled.Events/Patches/Events/Server/RestartingRound.cs @@ -22,8 +22,8 @@ namespace Exiled.Events.Patches.Events.Server using static HarmonyLib.AccessTools; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [EventPatch(typeof(Handlers.Server), nameof(Handlers.Server.RestartingRound))] [HarmonyPatch(typeof(RoundRestart), nameof(RoundRestart.InitiateRoundRestart))] diff --git a/Exiled.Events/Patches/Events/Server/RoundEnd.cs b/Exiled.Events/Patches/Events/Server/RoundEnd.cs index c73166760b..fff92653a3 100644 --- a/Exiled.Events/Patches/Events/Server/RoundEnd.cs +++ b/Exiled.Events/Patches/Events/Server/RoundEnd.cs @@ -12,21 +12,20 @@ namespace Exiled.Events.Patches.Events.Server using System.Reflection; using System.Reflection.Emit; + using Exiled.API.Features; using Exiled.API.Features.Pools; using Exiled.Events.EventArgs.Server; using HarmonyLib; + using PlayerRoles; using static HarmonyLib.AccessTools; /// - /// Patches . - /// Adds the and event. + /// Patches . + /// Adds the and event. + /// Adds the Propperty. /// - /* TODO: Removed this when NW will have changed ChaosTargetCount == 0 with ChaosTargetCount <= 0 - [EventPatch(typeof(Handlers.Server), nameof(Handlers.Server.EndingRound))] - [EventPatch(typeof(Handlers.Server), nameof(Handlers.Server.RoundEnded))] - */ [HarmonyPatch] internal static class RoundEnd { @@ -46,9 +45,31 @@ private static IEnumerable Transpiler(IEnumerable x.Calls(Method(typeof(PlayerRolesUtils), nameof(PlayerRolesUtils.GetTeam), new Type[] { typeof(ReferenceHub), }))) + offset; + + Label jmp = generator.DefineLabel(); + + // if (Round.IgnoredPlayers.Contains(referencehub) + // goto jmp; + newInstructions.InsertRange( + index, + new CodeInstruction[] + { + new(OpCodes.Call, PropertyGetter(typeof(Round), nameof(Round.IgnoredPlayers))), + new(OpCodes.Ldloc_S, 10), + new(OpCodes.Call, Method(typeof(HashSet), nameof(HashSet.Contains))), + new(OpCodes.Brtrue_S, jmp), + }); + + offset = 4; + index = newInstructions.FindIndex(x => x.Calls(Method(typeof(PlayerRolesUtils), nameof(PlayerRolesUtils.GetTeam), new Type[] { typeof(ReferenceHub), }))) + offset; + + newInstructions[index].labels.Add(jmp); + // Replace ChaosTargetCount == 0 with ChaosTargetCount <= 0 - int offset = 1; - int index = newInstructions.FindIndex(x => x.Calls(PropertyGetter(typeof(RoundSummary), nameof(RoundSummary.ChaosTargetCount)))) + offset; + offset = 1; + index = newInstructions.FindIndex(x => x.Calls(PropertyGetter(typeof(RoundSummary), nameof(RoundSummary.ChaosTargetCount)))) + offset; Label label = (Label)newInstructions[index].operand; newInstructions.RemoveAt(index); @@ -56,8 +77,8 @@ private static IEnumerable Transpiler(IEnumerable +// Copyright (c) Exiled 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.Reflection; + using System.Reflection.Emit; + + using Exiled.API.Features; + using Exiled.API.Features.Pools; + using Exiled.Events.Attributes; + using Exiled.Events.EventArgs.Server; + + using HarmonyLib; + + using Respawning; + + using static HarmonyLib.AccessTools; + + /// + /// Patches to add the event. + /// + [EventPatch(typeof(Handlers.Server), nameof(Handlers.Server.SelectingRespawnTeam))] + [HarmonyPatch(typeof(RespawnManager), nameof(RespawnManager.Update))] + internal static class SelectingRespawnTeam + { + private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) + { + List newInstructions = ListPool.Pool.Get(instructions); + LocalBuilder ev = generator.DeclareLocal(typeof(SelectingRespawnTeamEventArgs)); + + const int offset = 1; + int index = newInstructions.FindLastIndex(i => i.opcode == OpCodes.Stloc_1) + offset; + + newInstructions.InsertRange(index, new[] + { + // SelectingRespawnTeamEventArgs ev = new(dominatingTeam); + new CodeInstruction(OpCodes.Ldloc_1), + new(OpCodes.Newobj, GetDeclaredConstructors(typeof(SelectingRespawnTeamEventArgs))[0]), + new(OpCodes.Dup), + new(OpCodes.Stloc_S, ev), + + // Handlers.Server.OnSelectingRespawnTeam(ev); + new(OpCodes.Call, Method(typeof(Handlers.Server), nameof(Handlers.Server.OnSelectingRespawnTeam))), + + // dominatingTeam = ev.Team; + new(OpCodes.Ldloc, ev), + new CodeInstruction(OpCodes.Callvirt, PropertyGetter(typeof(SelectingRespawnTeamEventArgs), nameof(SelectingRespawnTeamEventArgs.Team))), + new(OpCodes.Stloc_1), + }); + + for (int z = 0; z < newInstructions.Count; z++) + yield return newInstructions[z]; + + ListPool.Pool.Return(newInstructions); + } + } +} \ No newline at end of file diff --git a/Exiled.Events/Patches/Events/Warhead/ChangingLeverStatus.cs b/Exiled.Events/Patches/Events/Warhead/ChangingLeverStatus.cs index b37ae509b0..b03e488692 100644 --- a/Exiled.Events/Patches/Events/Warhead/ChangingLeverStatus.cs +++ b/Exiled.Events/Patches/Events/Warhead/ChangingLeverStatus.cs @@ -22,8 +22,8 @@ namespace Exiled.Events.Patches.Events.Warhead using Warhead = Handlers.Warhead; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [EventPatch(typeof(Warhead), nameof(Warhead.ChangingLeverStatus))] [HarmonyPatch(typeof(PlayerInteract), nameof(PlayerInteract.UserCode_CmdUsePanel__AlphaPanelOperations))] diff --git a/Exiled.Events/Patches/Events/Warhead/Detonation.cs b/Exiled.Events/Patches/Events/Warhead/Detonation.cs index b5cdf09035..016d530872 100644 --- a/Exiled.Events/Patches/Events/Warhead/Detonation.cs +++ b/Exiled.Events/Patches/Events/Warhead/Detonation.cs @@ -19,8 +19,8 @@ namespace Exiled.Events.Patches.Events.Warhead using static HarmonyLib.AccessTools; /// - /// Patches - /// to add and events. + /// Patches + /// to add and events. /// [EventPatch(typeof(Warhead), nameof(Warhead.Detonated))] [EventPatch(typeof(Warhead), nameof(Warhead.Detonating))] diff --git a/Exiled.Events/Patches/Events/Warhead/Starting.cs b/Exiled.Events/Patches/Events/Warhead/Starting.cs index dc52802057..42563ae54a 100644 --- a/Exiled.Events/Patches/Events/Warhead/Starting.cs +++ b/Exiled.Events/Patches/Events/Warhead/Starting.cs @@ -20,8 +20,8 @@ namespace Exiled.Events.Patches.Events.Warhead using static HarmonyLib.AccessTools; /// - /// Patch the . - /// Adds the event. + /// Patch the . + /// Adds the event. /// [EventPatch(typeof(Handlers.Warhead), nameof(Handlers.Warhead.Starting))] [HarmonyPatch(typeof(AlphaWarheadController), nameof(AlphaWarheadController.StartDetonation))] diff --git a/Exiled.Events/Patches/Events/Warhead/Stopping.cs b/Exiled.Events/Patches/Events/Warhead/Stopping.cs index 9999ee162a..a9efe02cb0 100644 --- a/Exiled.Events/Patches/Events/Warhead/Stopping.cs +++ b/Exiled.Events/Patches/Events/Warhead/Stopping.cs @@ -22,8 +22,8 @@ namespace Exiled.Events.Patches.Events.Warhead using Warhead = Handlers.Warhead; /// - /// Patches . - /// Adds the event. + /// Patches . + /// Adds the event. /// [EventPatch(typeof(Warhead), nameof(Warhead.Stopping))] [HarmonyPatch(typeof(AlphaWarheadController), nameof(AlphaWarheadController.CancelDetonation), typeof(ReferenceHub))] diff --git a/Exiled.Events/Patches/Fixes/HurtingFix.cs b/Exiled.Events/Patches/Fixes/HurtingFix.cs index 7d6ee3893e..56f5f2cf09 100644 --- a/Exiled.Events/Patches/Fixes/HurtingFix.cs +++ b/Exiled.Events/Patches/Fixes/HurtingFix.cs @@ -20,7 +20,7 @@ namespace Exiled.Events.Patches.Events.Player using static HarmonyLib.AccessTools; /// - /// Patches . + /// Patches . /// [HarmonyPatch(typeof(CustomNetworkManager), nameof(CustomNetworkManager.OnServerDisconnect), typeof(NetworkConnectionToClient))] internal static class HurtingFix diff --git a/Exiled.Events/Patches/Fixes/Scp3114AttackAhpFix.cs b/Exiled.Events/Patches/Fixes/Scp3114AttackAhpFix.cs new file mode 100644 index 0000000000..2722c59e10 --- /dev/null +++ b/Exiled.Events/Patches/Fixes/Scp3114AttackAhpFix.cs @@ -0,0 +1,44 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Events.Patches.Fixes +{ + using System.Collections.Generic; + using System.Reflection.Emit; + + using API.Features.Pools; + using HarmonyLib; + using PlayerRoles.PlayableScps.Scp3114; + using PlayerRoles.PlayableScps.Subroutines; + + using static HarmonyLib.AccessTools; + + /// + /// Patches the delegate. + /// Fix than Scp3114Slap was giving humeshield even if player was not hit by Scp3114. + /// Bug reported to NW (https://trello.com/c/1AwpM8XE/5814-scp3114-is-able-to-get-humeshield-with-godmod-player). + /// + [HarmonyPatch(typeof(Scp3114Slap), nameof(Scp3114Slap.DamagePlayers))] + internal class Scp3114AttackAhpFix + { + private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) + { + List newInstructions = ListPool.Pool.Get(instructions); + + Label ret = generator.DefineLabel(); + int offset = 1; + int index = newInstructions.FindLastIndex(x => x.operand == (object)Method(typeof(ScpAttackAbilityBase), nameof(ScpAttackAbilityBase.HasAttackResultFlag))) + offset; + newInstructions[index].operand = ret; + + newInstructions[newInstructions.Count - 1].labels.Add(ret); + for (int z = 0; z < newInstructions.Count; z++) + yield return newInstructions[z]; + + ListPool.Pool.Return(newInstructions); + } + } +} diff --git a/Exiled.Events/Patches/Generic/DoorList.cs b/Exiled.Events/Patches/Generic/DoorList.cs index f7d9cbf63f..890f1ce83b 100644 --- a/Exiled.Events/Patches/Generic/DoorList.cs +++ b/Exiled.Events/Patches/Generic/DoorList.cs @@ -9,7 +9,6 @@ namespace Exiled.Events.Patches.Generic { #pragma warning disable SA1313 #pragma warning disable SA1402 - using System; using System.Collections.Generic; using System.Linq; using System.Reflection.Emit; @@ -22,44 +21,20 @@ namespace Exiled.Events.Patches.Generic using HarmonyLib; using Interactables.Interobjects.DoorUtils; - using MapGeneration; - - using UnityEngine; using static HarmonyLib.AccessTools; /// /// Patches . /// - // TODO: transpiler [HarmonyPatch(typeof(DoorVariant), nameof(DoorVariant.RegisterRooms))] internal class DoorList { - private static bool Prefix(DoorVariant __instance) + private static void Postfix(DoorVariant __instance) { - /*EXILED*/ - if (__instance.Rooms != null) - return false; - /*EXILED*/ - - Vector3 position = __instance.transform.position; - int length = 0; - - for (int index = 0; index < 4; ++index) - { - Vector3Int coords = RoomIdUtils.PositionToCoords(position + DoorVariant.WorldDirections[index]); - - if (RoomIdentifier.RoomsByCoordinates.TryGetValue(coords, out RoomIdentifier key) && DoorVariant.DoorsByRoom.GetOrAdd(key, () => new HashSet()).Add(__instance)) - { - DoorVariant.RoomsNonAlloc[length] = key; - ++length; - } - } - - __instance.Rooms = new RoomIdentifier[length]; - Array.Copy(DoorVariant.RoomsNonAlloc, __instance.Rooms, length); + if (Door.DoorVariantToDoor.ContainsKey(__instance)) + return; - /*EXILED*/ List rooms = __instance.Rooms.Select(identifier => Room.RoomIdentifierToRoom[identifier]).ToList(); Door door = Door.Create(__instance, rooms); @@ -78,9 +53,7 @@ private static bool Prefix(DoorVariant __instance) } } - /*EXILED*/ - - return false; + return; } } @@ -90,25 +63,9 @@ private static bool Prefix(DoorVariant __instance) [HarmonyPatch(typeof(DoorVariant), nameof(DoorVariant.OnDestroy))] internal class DoorListRemove { - private static IEnumerable Transpiler(IEnumerable codeInstructions) + private static void Prefix(DoorVariant __instance) { - List newInstructions = ListPool.Pool.Get(codeInstructions); - - // Door.DoorVariantToDoor.Remove(this) - newInstructions.InsertRange( - 0, - new CodeInstruction[] - { - new(OpCodes.Ldsfld, Field(typeof(Door), nameof(Door.DoorVariantToDoor))), - new(OpCodes.Ldarg_0), - new(OpCodes.Callvirt, Method(typeof(Dictionary), nameof(Dictionary.Remove), new[] { typeof(DoorVariant) })), - new(OpCodes.Pop), - }); - - for (int z = 0; z < newInstructions.Count; z++) - yield return newInstructions[z]; - - ListPool.Pool.Return(newInstructions); + Door.DoorVariantToDoor.Remove(__instance); } } } \ No newline at end of file diff --git a/Exiled.Events/Patches/Generic/IndividualFriendlyFire.cs b/Exiled.Events/Patches/Generic/IndividualFriendlyFire.cs index addee3ea8f..1100d39ca1 100644 --- a/Exiled.Events/Patches/Generic/IndividualFriendlyFire.cs +++ b/Exiled.Events/Patches/Generic/IndividualFriendlyFire.cs @@ -89,7 +89,7 @@ public static bool CheckFriendlyFirePlayerRules(Footprint attackerFootprint, Ref // Return false, no custom friendly fire allowed, default to NW logic for FF. No point in processing if FF is enabled across the board. if (Server.FriendlyFire) - return HitboxIdentity.CheckFriendlyFire(attackerFootprint.Role, victimHub.roleManager.CurrentRole.RoleTypeId); + return HitboxIdentity.IsEnemy(attackerFootprint.Role, victimHub.roleManager.CurrentRole.RoleTypeId); // always allow damage from Server.Host if (attackerFootprint.Hub == Server.Host.ReferenceHub) @@ -98,7 +98,7 @@ public static bool CheckFriendlyFirePlayerRules(Footprint attackerFootprint, Ref // Only check friendlyFire if the FootPrint hasn't changed (Fix for Grenade not dealing damage because it's from a dead player) // TODO rework FriendlyFireRule to make it compatible with Footprint if (!attackerFootprint.SameLife(new(attackerFootprint.Hub))) - return HitboxIdentity.CheckFriendlyFire(attackerFootprint.Role, victimHub.roleManager.CurrentRole.RoleTypeId); + return HitboxIdentity.IsEnemy(attackerFootprint.Role, victimHub.roleManager.CurrentRole.RoleTypeId); if (attackerFootprint.Hub is null || victimHub is null) { @@ -170,14 +170,14 @@ public static bool CheckFriendlyFirePlayerRules(Footprint attackerFootprint, Ref Log.Error($"CheckFriendlyFirePlayerRules failed to handle friendly fire because: {ex}"); } - return HitboxIdentity.CheckFriendlyFire(attackerFootprint.Role, victimHub.roleManager.CurrentRole.RoleTypeId); + return HitboxIdentity.IsEnemy(attackerFootprint.Role, victimHub.roleManager.CurrentRole.RoleTypeId); } } /// - /// Patches . + /// Patches . /// - [HarmonyPatch(typeof(HitboxIdentity), nameof(HitboxIdentity.CheckFriendlyFire), typeof(ReferenceHub), typeof(ReferenceHub), typeof(bool))] + [HarmonyPatch(typeof(HitboxIdentity), nameof(HitboxIdentity.IsDamageable), typeof(ReferenceHub), typeof(ReferenceHub))] internal static class HitboxIdentityCheckFriendlyFire { private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) diff --git a/Exiled.Events/Patches/Generic/Scp079Scan.cs b/Exiled.Events/Patches/Generic/Scp079Scan.cs index 760a695c1c..b81c5e7561 100644 --- a/Exiled.Events/Patches/Generic/Scp079Scan.cs +++ b/Exiled.Events/Patches/Generic/Scp079Scan.cs @@ -34,9 +34,6 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable), nameof(HashSet.Contains))), new(OpCodes.Brtrue_S, returnLabel), diff --git a/Exiled.Events/Patches/Generic/Scp173BeingLooked.cs b/Exiled.Events/Patches/Generic/Scp173BeingLooked.cs index 343de298af..6e0e0d0be5 100644 --- a/Exiled.Events/Patches/Generic/Scp173BeingLooked.cs +++ b/Exiled.Events/Patches/Generic/Scp173BeingLooked.cs @@ -7,14 +7,19 @@ namespace Exiled.Events.Patches.Generic { -#pragma warning disable SA1313 + using System.Collections.Generic; + using System.Reflection.Emit; + using API.Features; + using Exiled.API.Features.Pools; using HarmonyLib; using PlayerRoles; using PlayerRoles.PlayableScps.Scp173; + using static HarmonyLib.AccessTools; + using ExiledEvents = Exiled.Events.Events; using Scp173Role = API.Features.Roles.Scp173Role; @@ -24,19 +29,47 @@ namespace Exiled.Events.Patches.Generic [HarmonyPatch(typeof(Scp173ObserversTracker), nameof(Scp173ObserversTracker.UpdateObserver))] internal static class Scp173BeingLooked { - private static bool Prefix(Scp173ObserversTracker __instance, ReferenceHub targetHub, ref int __result) + private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) { - if (Player.Get(targetHub) is Player player && - ((player.Role.Type == RoleTypeId.Tutorial && - !ExiledEvents.Instance.Config.CanTutorialBlockScp173) || - Scp173Role.TurnedPlayers.Contains(player)) && - __instance.IsObservedBy(targetHub, 0.2f)) + List newInstructions = ListPool.Pool.Get(instructions); + + Label continueLabel = generator.DefineLabel(); + Label skipLabel = generator.DefineLabel(); + + newInstructions.InsertRange(0, new CodeInstruction[] { - __result = __instance.Observers.Remove(targetHub) ? -1 : 0; - return false; - } + // if(Scp173BeingLooked.HelpMethod(Scp173BeingLooked, ReferenceHub)) + // return this.Observers.Remove(ReferenceHub) ? -1 : 0; + new(OpCodes.Ldarg_0), + new(OpCodes.Ldarg_1), + new(OpCodes.Call, Method(typeof(Scp173BeingLooked), nameof(HelpMethod))), + + new(OpCodes.Brfalse_S, continueLabel), + + new(OpCodes.Ldarg_0), + new(OpCodes.Ldfld, Field(typeof(Scp173ObserversTracker), nameof(Scp173ObserversTracker.Observers))), + new(OpCodes.Ldarg_1), + new(OpCodes.Callvirt, Method(typeof(HashSet), nameof(HashSet.Remove))), + new(OpCodes.Brtrue_S, skipLabel), + + new(OpCodes.Ldc_I4_0), + new(OpCodes.Ret), - return true; + new CodeInstruction(OpCodes.Ldc_I4_M1).WithLabels(skipLabel), + new(OpCodes.Ret), + + new CodeInstruction(OpCodes.Nop).WithLabels(continueLabel), + }); + + for (int z = 0; z < newInstructions.Count; z++) + yield return newInstructions[z]; + + ListPool.Pool.Return(newInstructions); + } + + private static bool HelpMethod(Scp173ObserversTracker instance, ReferenceHub targetHub) + { + return Player.Get(targetHub) is Player player && ((player.Role.Type == RoleTypeId.Tutorial && !ExiledEvents.Instance.Config.CanTutorialBlockScp173) || Scp173Role.TurnedPlayers.Contains(player)) && instance.IsObservedBy(targetHub, Scp173ObserversTracker.WidthMultiplier); } } } \ No newline at end of file diff --git a/Exiled.Installer/CommandSettings.cs b/Exiled.Installer/CommandSettings.cs index e65fadde43..f8fae601d4 100644 --- a/Exiled.Installer/CommandSettings.cs +++ b/Exiled.Installer/CommandSettings.cs @@ -168,7 +168,7 @@ internal sealed class CommandSettings /// public bool Exit { get; set; } - public async static Task Parse(string[] args) + public static async Task Parse(string[] args) { RootCommand.Handler = CommandHandler.Create(async args => await Program.MainSafe(args).ConfigureAwait(false)); RootCommand.TreatUnmatchedTokensAsErrors = false; diff --git a/Exiled.Installer/Program.cs b/Exiled.Installer/Program.cs index 8446bedc28..506bce5c4b 100644 --- a/Exiled.Installer/Program.cs +++ b/Exiled.Installer/Program.cs @@ -30,12 +30,12 @@ internal enum PathResolution Undefined, /// - /// Absolute path that is routed to AppData. + /// Absolute path that is routed to AppData. /// Absolute, /// - /// Exiled path that is routed to exiled root path. + /// Exiled path that is routed to exiled root path. /// Exiled, } @@ -55,13 +55,13 @@ internal static class Program // Force use of LF because the file uses LF private static readonly Dictionary Markup = Resources.Markup.Trim().Split('\n').ToDictionary(s => s.Split(':')[0], s => s.Split(':', 2)[1]); - private async static Task Main(string[] args) + private static async Task Main(string[] args) { Console.OutputEncoding = new UTF8Encoding(false, false); await CommandSettings.Parse(args).ConfigureAwait(false); } - internal async static Task MainSafe(CommandSettings args) + internal static async Task MainSafe(CommandSettings args) { bool error = false; try @@ -111,10 +111,8 @@ internal async static Task MainSafe(CommandSettings args) Console.WriteLine(Resources.Program_MainSafe_Asset_found_); Console.WriteLine(FormatAsset(exiledAsset)); - using HttpClient httpClient = new() - { - Timeout = TimeSpan.FromSeconds(SecondsWaitForDownload), - }; + using HttpClient httpClient = new(); + httpClient.Timeout = TimeSpan.FromSeconds(SecondsWaitForDownload); httpClient.DefaultRequestHeaders.Add("User-Agent", Header); using HttpResponseMessage downloadResult = await httpClient.GetAsync(exiledAsset.BrowserDownloadUrl).ConfigureAwait(false); @@ -144,12 +142,12 @@ internal async static Task MainSafe(CommandSettings args) Environment.Exit(error ? 1 : 0); } - private async static Task> GetReleases() + private static async Task> GetReleases() { IEnumerable releases = (await GitHubClient.Repository.Release.GetAll(RepoID).ConfigureAwait(false)) .Where( r => Version.TryParse(r.TagName, out Version version) - && (version > VersionLimit)); + && version > VersionLimit); return releases.OrderByDescending(r => r.CreatedAt.Ticks); } @@ -267,7 +265,8 @@ static PathResolution TryParse(string s) { return TryParse(pair.Value); } - else if (!fileInFolder && !isFolder && + + if (!fileInFolder && !isFolder && pair.Key.Equals(fileName, StringComparison.OrdinalIgnoreCase)) { return TryParse(pair.Value); @@ -280,20 +279,27 @@ static PathResolution TryParse(string s) private static Release FindRelease(CommandSettings args, IEnumerable releases) { Console.WriteLine(Resources.Program_TryFindRelease_Trying_to_find_release__); - Version targetVersion = args.TargetVersion is not null ? new Version(args.TargetVersion) : new Version(releases.First().TagName); + Version? targetVersion = args.TargetVersion is not null ? new Version(args.TargetVersion) : null; - foreach (Release r in releases) - { - if (targetVersion != new Version(r.TagName)) - continue; + List enumerable = releases.ToList(); - if (targetVersion.IsPreRelease && !args.PreReleases) - continue; + foreach (Release release in enumerable) + { + if (targetVersion != null) + { + if (targetVersion == new Version(release.TagName)) + return release; + } + else + { + if (release.Prerelease && !args.PreReleases) + continue; - return r; + return release; + } } - return releases.First(); + return enumerable.First(); } } } \ No newline at end of file diff --git a/docs/docs/Plugins/Events.md b/docs/docs/Plugins/Events.md index 23f98ac9d9..1ef3550c6e 100644 --- a/docs/docs/Plugins/Events.md +++ b/docs/docs/Plugins/Events.md @@ -61,4 +61,32 @@ public void OnEnraging(EnragingEventArgs ev) // ev is the arguments for the even { Log.Info(ev.Player.Nickname + " has just been enraged!"); } -``` \ No newline at end of file +``` + +## Async events + +_Async events allow you to seamlessly integrate coroutines and event functionalities. +You can find more information about MEC coroutines [here](https://github.com/Exiled-Team/EXILED#mec-coroutines)._ +```cs +// Base plugin class +// This example assumes a method called "OnEnraging" exists in this class. For best practice, you should create a new class to handle events. +using Exiled.Events; +public override void OnEnabled() +{ + Scp096.Enraging += OnEnraging; // Scp096 is the event handler, while Enraging is the name of the event. The += operator connects this event to the provided method. +} +public override void OnDisabled() +{ + Scp096.Enraging -= OnEnraging; // The -= operator disconnects this event from the provided method. +} +// Some other class +using Sustem.Collections.Generic; + +using Exiled.Events.EventArgs; +using MEC; +public IEnumerator OnEnraging(EnragingEventArgs ev) // ev is the arguments for the event. Every event has a different argument class with different parameters, so make sure to check its documentation. +{ + yield return Timing.WaitForSeconds(1f); + Log.Info(ev.Player.Nickname + " has just been enraged!"); +} +``` diff --git a/docs/docs/Resources/Intro.md b/docs/docs/Resources/Intro.md index b1c46ea131..c502cc02a6 100644 --- a/docs/docs/Resources/Intro.md +++ b/docs/docs/Resources/Intro.md @@ -61,7 +61,7 @@ sidebar_position: 1 | 20 | ChaosRepressor | ChaosInsurgency | ChaosInsurgency | ChaosInsurgency | | 21 | Overwatch | Dead | None | Draw | | 22 | Filmmaker | Dead | None | Draw | -| 23 | Scp3114 | Dead | None | Draw | +| 23 | Scp3114 | SCPs | Scp | Anomalies | ``` @@ -136,7 +136,7 @@ sidebar_position: 1
Ammo -```md title="Latest Updated: 8.2.1.0" +```md title="Latest Updated: 8.7.0.0" [0] None [1] Nato556 [2] Nato762 @@ -151,7 +151,7 @@ sidebar_position: 1
Doors -```md title="Latest Updated: 8.2.1.0" +```md title="Latest Updated: 8.7.0.0" [0] UnknownDoor [1] Scp914Door [2] GR18Inner @@ -220,7 +220,7 @@ sidebar_position: 1
Rooms -```md title="Latest Updated: 8.2.1.0" +```md title="Latest Updated: 8.7.0.0" [0] Unknown [1] LczArmory [2] LczCurve @@ -283,7 +283,7 @@ sidebar_position: 1
Elevators -```md title="Latest Updated: 8.2.1.0" +```md title="Latest Updated: 8.7.0.0" [0] Unknown [1] GateA [2] GateB @@ -299,7 +299,7 @@ sidebar_position: 1
DamageType -```md title="Latest Updated: 8.2.1.0" +```md title="Latest Updated: 8.7.0.0" [0] Unknown [1] Falldown [2] Warhead @@ -343,6 +343,9 @@ sidebar_position: 1 [40] Jailbird [41] Frmg0 [42] A7 +[43] Scp3114 +[44] Strangled +[45] Marshmallow ```
@@ -378,7 +381,8 @@ PlayerStatsSystem::Scp018DamageHandler : AttackerDamageHandler
Effects -```md title="Latest Updated: 8.2.1.0" +```md title="Latest Updated: 8.7.0.0" +[-1] None [0] AmnesiaItems [1] AmnesiaVision [2] Asphyxiated @@ -416,6 +420,10 @@ PlayerStatsSystem::Scp018DamageHandler : AttackerDamageHandler [34] AntiScp207 [35] Scanned [36] PocketCorroding +[37] SilentWalk +[38] Marshmallow +[39] Strangled +[40] Ghostly ```
@@ -424,7 +432,7 @@ PlayerStatsSystem::Scp018DamageHandler : AttackerDamageHandler
Keycard Perms -```md title="Latest Updated: 8.2.1.0" +```md title="Latest Updated: 8.7.0.0" [0] None [1] Checkpoints [2] ExitGates @@ -445,7 +453,7 @@ PlayerStatsSystem::Scp018DamageHandler : AttackerDamageHandler
Lock Type -```md title="Latest Updated: 8.2.1.0" +```md title="Latest Updated: 8.7.0.0" [0] None [1] Regular079 [2] Lockdown079 @@ -480,7 +488,7 @@ PlayerStatsSystem::Scp018DamageHandler : AttackerDamageHandler
Blood -```md title="Latest Updated: 8.2.1.0" +```md title="Latest Updated: 8.7.0.0" [0] Default [1] Scp106 [2] Spreaded @@ -493,7 +501,7 @@ PlayerStatsSystem::Scp018DamageHandler : AttackerDamageHandler
GeneratorState -```md title="Latest Updated: 8.2.1.0" +```md title="Latest Updated: 8.7.0.0" [1] None [2] Unlocked [4] Open @@ -535,7 +543,7 @@ PlayerStatsSystem::Scp018DamageHandler : AttackerDamageHandler
Attachment Names -```md title="Latest Updated: 8.2.1.0" +```md title="Latest Updated: 8.7.0.0" [0] None [1] IronSights [2] DotSight @@ -590,7 +598,7 @@ PlayerStatsSystem::Scp018DamageHandler : AttackerDamageHandler
Spawn Reasons -```md title="Latest Updated: 8.2.1.0" +```md title="Latest Updated: 8.7.0.0" [0] None [1] RoundStart [2] LateJoin From e772b2a95606584c0d99c8c380086d2856bb9422 Mon Sep 17 00:00:00 2001 From: Yamato Date: Wed, 31 Jan 2024 19:46:36 +0100 Subject: [PATCH 062/141] Update doc and SL version --- Exiled.Loader/AutoUpdateFiles.cs | 2 +- docs/docs/Resources/Intro.md | 34 ++++++++++++++++---------------- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/Exiled.Loader/AutoUpdateFiles.cs b/Exiled.Loader/AutoUpdateFiles.cs index c805536603..5caaabb915 100644 --- a/Exiled.Loader/AutoUpdateFiles.cs +++ b/Exiled.Loader/AutoUpdateFiles.cs @@ -17,6 +17,6 @@ public static class AutoUpdateFiles /// /// Gets which SCP: SL version generated Exiled. /// - public static readonly Version RequiredSCPSLVersion = new(13, 3, 0, 1); + public static readonly Version RequiredSCPSLVersion = new(13, 4, 0, 1); } } \ No newline at end of file diff --git a/docs/docs/Resources/Intro.md b/docs/docs/Resources/Intro.md index c502cc02a6..792feb654f 100644 --- a/docs/docs/Resources/Intro.md +++ b/docs/docs/Resources/Intro.md @@ -34,7 +34,7 @@ sidebar_position: 1
Roles -```md title="Latest Updated: 13.3.0.1" +```md title="Latest Updated: 13.4.0.1" | Id | RoleTypeId | Team | Side | LeadingTeam | |-----|----------------|------------------|------------------|-----------------| | -1 | None | Dead | None | Draw | @@ -70,7 +70,7 @@ sidebar_position: 1
Items -```md title="Latest Updated: 13.3.0.1" +```md title="Latest Updated: 13.4.0.1" [-1] None [0] KeycardJanitor [1] KeycardScientist @@ -136,7 +136,7 @@ sidebar_position: 1
Ammo -```md title="Latest Updated: 8.7.0.0" +```md title="Latest Updated: 8.7.1.0" [0] None [1] Nato556 [2] Nato762 @@ -151,7 +151,7 @@ sidebar_position: 1
Doors -```md title="Latest Updated: 8.7.0.0" +```md title="Latest Updated: 8.7.1.0" [0] UnknownDoor [1] Scp914Door [2] GR18Inner @@ -220,7 +220,7 @@ sidebar_position: 1
Rooms -```md title="Latest Updated: 8.7.0.0" +```md title="Latest Updated: 8.7.1.0" [0] Unknown [1] LczArmory [2] LczCurve @@ -283,7 +283,7 @@ sidebar_position: 1
Elevators -```md title="Latest Updated: 8.7.0.0" +```md title="Latest Updated: 8.7.1.0" [0] Unknown [1] GateA [2] GateB @@ -299,7 +299,7 @@ sidebar_position: 1
DamageType -```md title="Latest Updated: 8.7.0.0" +```md title="Latest Updated: 8.7.1.0" [0] Unknown [1] Falldown [2] Warhead @@ -381,7 +381,7 @@ PlayerStatsSystem::Scp018DamageHandler : AttackerDamageHandler
Effects -```md title="Latest Updated: 8.7.0.0" +```md title="Latest Updated: 8.7.1.0" [-1] None [0] AmnesiaItems [1] AmnesiaVision @@ -432,7 +432,7 @@ PlayerStatsSystem::Scp018DamageHandler : AttackerDamageHandler
Keycard Perms -```md title="Latest Updated: 8.7.0.0" +```md title="Latest Updated: 8.7.1.0" [0] None [1] Checkpoints [2] ExitGates @@ -453,7 +453,7 @@ PlayerStatsSystem::Scp018DamageHandler : AttackerDamageHandler
Lock Type -```md title="Latest Updated: 8.7.0.0" +```md title="Latest Updated: 8.7.1.0" [0] None [1] Regular079 [2] Lockdown079 @@ -473,7 +473,7 @@ PlayerStatsSystem::Scp018DamageHandler : AttackerDamageHandler
Structures -```md title="Latest Updated: 13.3.0.1" +```md title="Latest Updated: 13.4.0.1" [0] StandardLocker [1] LargeGunLocker [2] ScpPedestal @@ -488,7 +488,7 @@ PlayerStatsSystem::Scp018DamageHandler : AttackerDamageHandler
Blood -```md title="Latest Updated: 8.7.0.0" +```md title="Latest Updated: 8.7.1.0" [0] Default [1] Scp106 [2] Spreaded @@ -501,7 +501,7 @@ PlayerStatsSystem::Scp018DamageHandler : AttackerDamageHandler
GeneratorState -```md title="Latest Updated: 8.7.0.0" +```md title="Latest Updated: 8.7.1.0" [1] None [2] Unlocked [4] Open @@ -515,7 +515,7 @@ PlayerStatsSystem::Scp018DamageHandler : AttackerDamageHandler
Intercom States -```md title="Latest Updated: 13.3.0.1" +```md title="Latest Updated: 13.4.0.1" [0] Ready [1] Starting [2] InUse @@ -529,7 +529,7 @@ PlayerStatsSystem::Scp018DamageHandler : AttackerDamageHandler
BroadcastFlags -```md title="Latest Updated: 13.3.0.1" +```md title="Latest Updated: 13.4.0.1" [0] Normal [1] Truncated [2] AdminChat @@ -543,7 +543,7 @@ PlayerStatsSystem::Scp018DamageHandler : AttackerDamageHandler
Attachment Names -```md title="Latest Updated: 8.7.0.0" +```md title="Latest Updated: 8.7.1.0" [0] None [1] IronSights [2] DotSight @@ -598,7 +598,7 @@ PlayerStatsSystem::Scp018DamageHandler : AttackerDamageHandler
Spawn Reasons -```md title="Latest Updated: 8.7.0.0" +```md title="Latest Updated: 8.7.1.0" [0] None [1] RoundStart [2] LateJoin From cdf4284514b4fd0e490cbefba205d45324cd8276 Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Wed, 31 Jan 2024 20:41:06 +0100 Subject: [PATCH 063/141] `[Updater]` Added game version check. --- Exiled.Loader/GHApi/Models/Release.cs | 23 +++++++++++++ Exiled.Loader/Updater.cs | 47 ++++++++++++++------------- 2 files changed, 47 insertions(+), 23 deletions(-) diff --git a/Exiled.Loader/GHApi/Models/Release.cs b/Exiled.Loader/GHApi/Models/Release.cs index aabc1aa590..d6ad929111 100644 --- a/Exiled.Loader/GHApi/Models/Release.cs +++ b/Exiled.Loader/GHApi/Models/Release.cs @@ -8,7 +8,9 @@ namespace Exiled.Loader.GHApi.Models { using System; + using System.Net.Http; using System.Runtime.Serialization; + using System.Threading.Tasks; using Utf8Json; @@ -47,6 +49,13 @@ namespace Exiled.Loader.GHApi.Models [DataMember(Name = "assets")] public readonly ReleaseAsset[] Assets; + /// + /// The release's description. + /// + public readonly string Description; + + private const string URL = "https://api.github.com/repos/Exiled-Team/EXILED/releases/tags/"; + /// /// Initializes a new instance of the struct. /// @@ -63,6 +72,20 @@ public Release(int id, string tag_name, bool prerelease, DateTime created_at, Re PreRelease = prerelease; CreatedAt = created_at; Assets = assets; + Description = string.Empty; + + using (HttpClient client = new HttpClient()) + { + HttpResponseMessage response = client.GetAsync(URL + TagName).GetAwaiter().GetResult(); + + if (!response.IsSuccessStatusCode) + return; + + string responseBody = response.Content.ReadAsStringAsync().GetAwaiter().GetResult(); + int startIndex = responseBody.IndexOf("\"body\":") + "\"body\":".Length; + int endIndex = responseBody.IndexOf("\"draft\":") - 2; + Description = responseBody.Substring(startIndex, endIndex - startIndex); + } } } } \ No newline at end of file diff --git a/Exiled.Loader/Updater.cs b/Exiled.Loader/Updater.cs index f5555218f8..7e6453eb7f 100644 --- a/Exiled.Loader/Updater.cs +++ b/Exiled.Loader/Updater.cs @@ -31,7 +31,7 @@ namespace Exiled.Loader /// internal sealed class Updater { - private const long REPOID = 231269519; + private const long REPO_ID = 231269519; private const string INSTALLER_ASSET_NAME_LINUX = "Exiled.Installer-Linux"; private const string INSTALLER_ASSET_NAME_WIN = "Exiled.Installer-Win.exe"; @@ -136,10 +136,10 @@ private HttpClient CreateHttpClient() /// /// Finds an update using the client. /// - /// is the HTTP Client. - /// if the detection was forced. - /// if there is a new version of EXILED. - /// Returns true if there is an update, otherwise false. + /// The HTTP Client. + /// Whether the detection was forced. + /// Whether there is a new version of EXILED. + /// Whether there is an update. private bool FindUpdate(HttpClient client, bool forced, out NewVersion newVersion) { try @@ -148,7 +148,7 @@ private bool FindUpdate(HttpClient client, bool forced, out NewVersion newVersio Log.Info($"Found the smallest version of Exiled - {smallestVersion.Library.GetName().Name}:{smallestVersion.Version}"); - TaggedRelease[] releases = TagReleases(client.GetReleases(REPOID, new GetReleasesSettings(50, 1)).GetAwaiter().GetResult()); + TaggedRelease[] releases = TagReleases(client.GetReleases(REPO_ID, new GetReleasesSettings(50, 1)).GetAwaiter().GetResult()); if (FindRelease(releases, out Release targetRelease, smallestVersion, forced)) { if (!FindAsset(InstallerName, targetRelease, out ReleaseAsset asset)) @@ -158,7 +158,7 @@ private bool FindUpdate(HttpClient client, bool forced, out NewVersion newVersio } else { - Log.Info($"Found asset - Name: {asset.Name} | Size: {asset.Size} Download: {asset.BrowserDownloadUrl}"); + Log.Info($"Found asset - Name: {asset.Name} | Size: {asset.Size} | Download: {asset.BrowserDownloadUrl}"); newVersion = new NewVersion(targetRelease, asset); return true; } @@ -171,7 +171,7 @@ private bool FindUpdate(HttpClient client, bool forced, out NewVersion newVersio } catch (Utf8Json.JsonParsingException) { - Log.Error("Encountered GitHub ratelimit, unable to check and download the latest version of Exiled."); + Log.Error("Encountered GitHub rate limit, unable to check and download the latest version of Exiled."); } catch (Exception ex) { @@ -185,8 +185,8 @@ private bool FindUpdate(HttpClient client, bool forced, out NewVersion newVersio /// /// Updates the client's version of Exiled. /// - /// is the HTTP Client. - /// is the updated version of Exiled. + /// The HTTP Client. + /// The updated version of Exiled. private void Update(HttpClient client, NewVersion newVersion) { try @@ -272,7 +272,7 @@ private void Update(HttpClient client, NewVersion newVersion) /// /// Gets the releases of Exiled. /// - /// gets the array of releases that has been made. + /// Gets the array of releases that has been made. /// The last item in the array, which is the newest version of Exiled. private TaggedRelease[] TagReleases(Release[] releases) { @@ -284,21 +284,22 @@ private TaggedRelease[] TagReleases(Release[] releases) } /// - /// Is able to find the release specificed. + /// Finds the latest release. /// - /// is the list of releases (array). - /// is the most recent release of Exiled. - /// finds the smallest version of the Exiled Library. - /// if this update was forced or not. - /// the if the specific release was found or not. + /// The list of releases (array). + /// The most recent release of Exiled. + /// Finds the smallest version of the Exiled Library. + /// Whether this update was forced or not. + /// Whether the specific release was found. private bool FindRelease(TaggedRelease[] releases, out Release release, ExiledLib smallestVersion, bool forced = false) { bool includePRE = config.ShouldDownloadTestingReleases || ExiledLib.Any(l => l.Version.PreRelease is not null); - + Version gameVersion = new(GameCore.Version.Major, GameCore.Version.Minor, GameCore.Version.Revision); for (int z = 0; z < releases.Length; z++) { TaggedRelease taggedRelease = releases[z]; - if (taggedRelease.Release.PreRelease && !includePRE) + + if (!taggedRelease.Release.Description.Contains($"[Game Version: {gameVersion}]") || (taggedRelease.Release.PreRelease && !includePRE)) continue; if (taggedRelease.Version > smallestVersion.Version || forced) @@ -315,10 +316,10 @@ private bool FindRelease(TaggedRelease[] releases, out Release release, ExiledLi /// /// Finds the specified asset. /// - /// passes in the specified asset name. - /// passes in the release version. - /// is the asset that is tied to the release. - /// if it was able to find the asset or not. + /// Passes in the specified asset name. + /// Passes in the release version. + /// The asset that is tied to the release. + /// Whether it was able to find the asset. private bool FindAsset(string assetName, Release release, out ReleaseAsset asset) { for (int z = 0; z < release.Assets.Length; z++) From a4200bb342a8d4af1a64d366db4559bbebc5d288 Mon Sep 17 00:00:00 2001 From: Yamato <66829532+louis1706@users.noreply.github.com> Date: Fri, 26 Jan 2024 01:05:30 +0100 Subject: [PATCH 064/141] Fix spawning ragdoll event args (#2396) * Update for PostXMAS (#2383) * Update for PostXMAS * WeaponFixFromXMAS * remove var * Fix RegisteringEvent * more var remove * 8.7.0 * Fix SpawningRagdoll - not tested * Not needed Change * Revert useless change --- .../Player/SpawningRagdollEventArgs.cs | 12 ++++++------ .../Patches/Events/Player/SpawningRagdoll.cs | 17 ++++++++++------- 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/Exiled.Events/EventArgs/Player/SpawningRagdollEventArgs.cs b/Exiled.Events/EventArgs/Player/SpawningRagdollEventArgs.cs index 13e7f25bcf..b486a892f5 100644 --- a/Exiled.Events/EventArgs/Player/SpawningRagdollEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/SpawningRagdollEventArgs.cs @@ -28,16 +28,12 @@ public class SpawningRagdollEventArgs : IPlayerEvent, IDeniableEvent /// /// /// - /// - /// - /// /// /// /// - public SpawningRagdollEventArgs(RagdollData info, DamageHandlerBase damageHandlerBase, bool isAllowed = true) + public SpawningRagdollEventArgs(RagdollData info, bool isAllowed = true) { Info = info; - DamageHandlerBase = damageHandlerBase; Player = Player.Get(info.OwnerHub); Scale = Player.Scale; IsAllowed = isAllowed; @@ -97,7 +93,11 @@ public string Nickname /// /// Gets or sets the ragdoll's . /// - public DamageHandlerBase DamageHandlerBase { get; set; } + public DamageHandlerBase DamageHandlerBase + { + get => Info.Handler; + set => Info = new RagdollData(Player.ReferenceHub, value, Role, Position, Rotation, Nickname, CreationTime); + } /// /// Gets or sets a value indicating whether or not the ragdoll can be spawned. diff --git a/Exiled.Events/Patches/Events/Player/SpawningRagdoll.cs b/Exiled.Events/Patches/Events/Player/SpawningRagdoll.cs index 39f5179cef..d4e60b095f 100644 --- a/Exiled.Events/Patches/Events/Player/SpawningRagdoll.cs +++ b/Exiled.Events/Patches/Events/Player/SpawningRagdoll.cs @@ -47,16 +47,16 @@ private static IEnumerable Transpiler(IEnumerable instruction.opcode == OpCodes.Ldloc_1) + offset; + // remove + // "basicRagdoll.NetworkInfo = new RagdollData(owner, handler, transform.localPosition, transform.localRotation);" newInstructions.RemoveRange(index, 7); - index = newInstructions.FindIndex(instruction => instruction.opcode == OpCodes.Ldloc_1); - newInstructions.InsertRange(index, new[] { - // hub + // hub new CodeInstruction(OpCodes.Ldarg_0), // handler @@ -73,9 +73,6 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable Date: Mon, 29 Jan 2024 00:55:33 +0100 Subject: [PATCH 065/141] Fixed a bug with `SearchingPickup` event caused by NWAPI (#2311) * . * Last * Fully modify transpiler * miss retLabel * MoreInfo * . * Update for PostXMAS (#2383) * Update for PostXMAS * WeaponFixFromXMAS * remove var * Fix RegisteringEvent * more var remove * 8.7.0 * Fix * Dumb * Update SearchingPickupEvent.cs * Update SearchingPickupEvent.cs --- .../Player/SearchingPickupEventArgs.cs | 3 +- .../Events/Player/SearchingPickupEvent.cs | 40 ++++++++----------- 2 files changed, 17 insertions(+), 26 deletions(-) diff --git a/Exiled.Events/EventArgs/Player/SearchingPickupEventArgs.cs b/Exiled.Events/EventArgs/Player/SearchingPickupEventArgs.cs index 6d2366364d..58e9f47628 100644 --- a/Exiled.Events/EventArgs/Player/SearchingPickupEventArgs.cs +++ b/Exiled.Events/EventArgs/Player/SearchingPickupEventArgs.cs @@ -44,7 +44,6 @@ public SearchingPickupEventArgs(Player player, ItemPickupBase pickup, SearchSess SearchSession = searchSession; SearchCompletor = searchCompletor; SearchTime = searchTime; - IsAllowed = searchCompletor.ValidateStart(); } /// @@ -65,7 +64,7 @@ public SearchingPickupEventArgs(Player player, ItemPickupBase pickup, SearchSess /// /// Gets or sets a value indicating whether the Pickup can be searched. /// - public bool IsAllowed { get; set; } + public bool IsAllowed { get; set; } = true; /// /// Gets the Pickup that is being searched. diff --git a/Exiled.Events/Patches/Events/Player/SearchingPickupEvent.cs b/Exiled.Events/Patches/Events/Player/SearchingPickupEvent.cs index 9973366af4..70416681ca 100644 --- a/Exiled.Events/Patches/Events/Player/SearchingPickupEvent.cs +++ b/Exiled.Events/Patches/Events/Player/SearchingPickupEvent.cs @@ -34,22 +34,24 @@ private static IEnumerable Transpiler(IEnumerable newInstructions = ListPool.Pool.Get(instructions); - Label allowLabel = generator.DefineLabel(); + Label retLabel = generator.DefineLabel(); LocalBuilder ev = generator.DeclareLocal(typeof(SearchingPickupEventArgs)); int offset = 1; - int index = newInstructions.FindIndex(instruction => instruction.opcode == OpCodes.Stind_Ref) + offset; + int index = newInstructions.FindIndex(instruction => instruction.opcode == OpCodes.Brtrue_S) + offset; - // remove base-game check and `SearchSession body` setter - newInstructions.RemoveRange(index, 14); + newInstructions[index].labels.Add(retLabel); + + offset = 1; + index = newInstructions.FindIndex(instruction => instruction.opcode == OpCodes.Ret) + offset; newInstructions.InsertRange( index, new[] { // Player.Get(Hub) - new(OpCodes.Ldarg_0), + new CodeInstruction(OpCodes.Ldarg_0).MoveLabelsFrom(newInstructions[index]), new(OpCodes.Callvirt, PropertyGetter(typeof(SearchCoordinator), nameof(SearchCoordinator.Hub))), new(OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new[] { typeof(ReferenceHub) })), @@ -82,27 +84,16 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable i.opcode == OpCodes.Stloc_S && i.operand is LocalBuilder { LocalIndex: 4 }) + offset; + // replace "request.Target.SearchTimeForPlayer(this.Hub);" with ev.SearchTime // remove base-game SearchTime setter newInstructions.RemoveRange(index, 5); @@ -134,4 +126,4 @@ private static IEnumerable Transpiler(IEnumerable.Pool.Return(newInstructions); } } -} \ No newline at end of file +} From b9e30371294021e18f02254949214969809a5a44 Mon Sep 17 00:00:00 2001 From: Yamato Date: Wed, 31 Jan 2024 21:16:52 +0100 Subject: [PATCH 066/141] 8.7.3 --- EXILED.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/EXILED.props b/EXILED.props index b33a703792..153e247c7a 100644 --- a/EXILED.props +++ b/EXILED.props @@ -15,7 +15,7 @@ - 8.7.1 + 8.7.3 false From b61dae1bcf6676375752bd163dfdeae9bc6aa8c6 Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Thu, 1 Feb 2024 05:51:14 +0100 Subject: [PATCH 067/141] Added `PreRespawningTeam` event. Made `RespawningTeamEventArgs::MaxWaveSize` and `RespawningTeamEventArgs::NextKnownTeam` properties only `get`. Removed `RespawningTeamEventArgs::SpawnableTeam` property. Made `CustomTeam` a `CustomModule`. Renamed `CustomRole::Chance` to `CustomRole::Probability` and `CustomRole::IsCustomTeamUnit` to `CustomRole::IsTeamUnit` for consistency. Added `CustomRole::TeamOwnership` property, tracking the team the custom role belongs to. `CustomRole::IsScp` property is not `virtual` anymore, it directly evaluates whether the `CustomRole::TeamOwnership` is a `Team::SCPs`. Added `virtual bool CustomTeam::EvaluateConditions` property. Removed `virtual bool CustomTeam::CanSpawnWithoutScps` property. Renamed `CustomTeam::LeadingTeamsToWin` to `TeamsOwnership`. Added `CustomTeam::RequiredTeamToSpawn` and `CustomTeam::RequiredCustomTeamToSpawn` properties. Changed `uint CustomTeam::Size` property to `int CustomTeam::Size`. --- .../API/Features/CustomRoles/CustomRole.cs | 23 ++- .../API/Features/CustomRoles/CustomTeam.cs | 189 ++++++++++-------- .../API/Features/RespawnManager.cs | 160 +++++++++++++++ .../Server/PreRespawningTeamEventArgs.cs | 78 ++++++++ .../Server/RespawningTeamEventArgs.cs | 50 +---- Exiled.Events/Handlers/Server.cs | 37 ++-- .../Patches/Events/Server/RespawningTeam.cs | 85 +++++--- 7 files changed, 446 insertions(+), 176 deletions(-) create mode 100644 Exiled.CustomModules/API/Features/RespawnManager.cs create mode 100644 Exiled.Events/EventArgs/Server/PreRespawningTeamEventArgs.cs diff --git a/Exiled.CustomModules/API/Features/CustomRoles/CustomRole.cs b/Exiled.CustomModules/API/Features/CustomRoles/CustomRole.cs index f07f4c8d01..c2d8900382 100644 --- a/Exiled.CustomModules/API/Features/CustomRoles/CustomRole.cs +++ b/Exiled.CustomModules/API/Features/CustomRoles/CustomRole.cs @@ -81,7 +81,7 @@ public abstract class CustomRole : CustomModule, IAdditiveBehaviour /// Gets a value indicating whether a player can spawn as this based on its assigned probability. /// /// if the probability condition was satisfied; otherwise, . - public bool CanSpawnByProbability => UnityEngine.Random.Range(0, 101) <= Chance; + public bool CanSpawnByProbability => UnityEngine.Random.Range(0, 101) <= Probability; /// /// Gets all instances of this . @@ -98,15 +98,10 @@ public abstract class CustomRole : CustomModule, IAdditiveBehaviour /// public virtual RoleTypeId Role { get; } - /// - /// Gets a value indicating whether the should be considered an SCP. - /// - public virtual bool IsScp { get; } - /// /// Gets the relative spawn chance of the . /// - public virtual int Chance { get; } + public virtual int Probability { get; } /// /// Gets the . @@ -128,6 +123,13 @@ public abstract class CustomRole : CustomModule, IAdditiveBehaviour /// public virtual int MaxInstances => IsScp ? 1 : -1; + /// + /// Gets the team ownership of the . + /// + /// + /// By setting the ownership, the will belong to the specified team. + public virtual Team TeamOwnership { get; } + /// /// Gets the from which to retrieve players for assigning the . /// @@ -141,13 +143,18 @@ public abstract class CustomRole : CustomModule, IAdditiveBehaviour /// /// Gets a value indicating whether the should be treated as a separate team unit. /// - public virtual bool IsCustomTeamUnit { get; } + public virtual bool IsTeamUnit { get; } /// /// Gets a value indicating whether the is registered. /// public virtual bool IsRegistered => Registered.Contains(this); + /// + /// Gets a value indicating whether the should be considered an SCP. + /// + public bool IsScp => TeamOwnership is Team.SCPs; + /// /// Gets a of containing all players owning this . /// diff --git a/Exiled.CustomModules/API/Features/CustomRoles/CustomTeam.cs b/Exiled.CustomModules/API/Features/CustomRoles/CustomTeam.cs index 228dc6b753..59610c709e 100644 --- a/Exiled.CustomModules/API/Features/CustomRoles/CustomTeam.cs +++ b/Exiled.CustomModules/API/Features/CustomRoles/CustomTeam.cs @@ -30,7 +30,7 @@ namespace Exiled.CustomModules.API.Features.CustomRoles ///
It serves as a versatile framework for handling custom team-related functionalities and interactions. ///
/// - public abstract class CustomTeam : TypeCastObject, IEquatable, IEquatable + public abstract class CustomTeam : CustomModule { private static readonly Dictionary PlayersValue = new(); private static readonly List Registered = new(); @@ -56,38 +56,19 @@ public abstract class CustomTeam : TypeCastObject, IEquatable Players => PlayersValue.Keys.ToHashSet(); /// - /// Gets or sets a collection of instances representing all custom role types offered as units. + /// Gets the name of the . /// - /// - /// This property provides access to a curated collection of objects, encapsulating all available custom role types within the context of units. - ///
The collection is designed to be both queried and modified as needed to accommodate dynamic scenarios within the game architecture. - ///
- public virtual IEnumerable Units { get; protected set; } = new Type[] { }; + public override string Name { get; } /// /// Gets or sets the 's id. /// - public virtual uint Id { get; protected set; } - - /// - /// Gets the relative spawn probability of the . - /// - public virtual int Probability { get; } - - /// - /// Gets the which is being spawned from. - /// - public virtual SpawnableTeamType RespawnTeam { get; } - - /// - /// Gets the name of the . - /// - public abstract string Name { get; } + public override uint Id { get; protected set; } /// /// Gets a value indicating whether the is enabled. /// - public virtual bool IsEnabled => true; + public override bool IsEnabled => true; /// /// Gets the display name of the . @@ -111,7 +92,32 @@ public abstract class CustomTeam : TypeCastObject, IEquatable /// The size indicates the maximum number of players that can be part of this . /// - public virtual uint Size { get; } + public virtual int Size { get; } + + /// + /// Gets or sets a collection of instances representing all custom role types offered as units. + /// + /// + /// This property provides access to a curated collection of objects, encapsulating all available custom role types within the context of units. + ///
The collection is designed to be both queried and modified as needed to accommodate dynamic scenarios within the game architecture. + ///
+ public virtual IEnumerable Units { get; protected set; } = new Type[] { }; + + /// + /// Gets the relative spawn probability of the . + /// + public virtual int Probability { get; } + + /// + /// Gets a value indicating whether a player can spawn as this based on its assigned probability. + /// + /// if the probability condition was satisfied; otherwise, . + public bool CanSpawnByProbability => UnityEngine.Random.Range(0, 101) <= Probability; + + /// + /// Gets the which is being spawned from. + /// + public virtual SpawnableTeamType RespawnTeam { get; } /// /// Gets a value indicating whether the is configured to use respawn tickets. @@ -130,12 +136,81 @@ public abstract class CustomTeam : TypeCastObject, IEquatable - /// Gets a value indicating whether the can be spawned even when SCP entities are alive. + /// Gets a value indicating whether the team can spawn given a condition. + /// + public virtual bool EvaluateConditions + { + get + { + IEnumerable list = Player.List.Cast(); + + if (RequiredTeamToSpawn is not Team.Dead) + { + foreach (Pawn pawn in list) + { + if ((!pawn.HasCustomRole || pawn.CustomRole.TeamOwnership != RequiredTeamToSpawn) && pawn.Role.Team != RequiredTeamToSpawn) + continue; + + return true; + } + } + + if (RequiredCustomTeamToSpawn > 0) + { + foreach (Pawn pawn in list) + { + if (!pawn.HasCustomRole || !pawn.CustomRole.IsTeamUnit || pawn.CustomRole.TeamOwnership != RequiredTeamToSpawn) + continue; + + return true; + } + } + + if (RequiredRoleToSpawn is not RoleTypeId.None) + { + foreach (Pawn pawn in list) + { + if (pawn.Role == RequiredRoleToSpawn) + { + if ((RoleExtensions.GetTeam(RequiredRoleToSpawn) is Team.SCPs && !pawn.IsScp) || + (RoleExtensions.GetTeam(RequiredRoleToSpawn) is not Team.SCPs && pawn.IsScp)) + continue; + + return true; + } + } + } + + if (RequiredCustomRoleToSpawn > 0) + { + foreach (Pawn pawn in list) + { + if (!pawn.HasCustomRole || pawn.CustomRole != RequiredCustomRoleToSpawn) + continue; + + return true; + } + } + + return false; + } + } + + /// + /// Gets the required that players must belong to in order to allow the to spawn. + /// + /// + /// This property specifies the required alive team to be eligible for spawning in the . + /// + public virtual Team RequiredTeamToSpawn => Team.Dead; + + /// + /// Gets the required custom team that players must belong to in order to allow the to spawn. /// /// - /// If set to true, the can spawn even when SCP entities are alive. + /// This property specifies the required alive custom team to be eligible for spawning in the . /// - public virtual bool CanSpawnWithoutScps => true; + public virtual uint RequiredCustomTeamToSpawn { get; } /// /// Gets the required that players must have to allow the to spawn. @@ -159,7 +234,7 @@ public abstract class CustomTeam : TypeCastObject, IEquatable /// This property specifies the teams that the must surpass to achieve victory. /// - public virtual Team[] LeadingTeamsToWin => new Team[] { }; + public virtual Team[] TeamsOwnership { get; } = { }; /// /// Gets a value indicating whether the is registered. @@ -185,54 +260,6 @@ public abstract class CustomTeam : TypeCastObject, IEquatable public CustomRole RandomUnit => CustomRole.Get(Units.Random()); - /// - /// Compares two operands: and . - /// - /// The to compare. - /// The to compare. - /// if the values are equal. - public static bool operator ==(CustomTeam left, object right) => left is null ? right is null : left.Equals(right); - - /// - /// Compares two operands: and . - /// - /// The to compare. - /// The to compare. - /// if the values are not equal. - public static bool operator ==(object left, CustomTeam right) => right == left; - - /// - /// Compares two operands: and . - /// - /// The to compare. - /// The to compare. - /// if the values are not equal. - public static bool operator !=(CustomTeam left, object right) => !(left == right); - - /// - /// Compares two operands: and . - /// - /// The left to compare. - /// The right to compare. - /// if the values are not equal. - public static bool operator !=(object left, CustomTeam right) => !(left == right); - - /// - /// Compares two operands: and . - /// - /// The left to compare. - /// The right to compare. - /// if the values are equal. - public static bool operator ==(CustomTeam left, CustomTeam right) => left is null ? right is null : left.Equals(right); - - /// - /// Compares two operands: and . - /// - /// The left to compare. - /// The right to compare. - /// if the values are not equal. - public static bool operator !=(CustomTeam left, CustomTeam right) => !(left.Id == right.Id); - /// /// Tries to get a given the specified id. /// @@ -351,7 +378,7 @@ public static bool TrySpawn(IEnumerable players, uint id) /// The amount of units to be spawned. /// The to be spawned. /// if the was successfully spawned; otherwise, . - public static bool TrySpawn(uint amount, CustomTeam customTeam) + public static bool TrySpawn(int amount, CustomTeam customTeam) { if (customTeam is null) return false; @@ -366,7 +393,7 @@ public static bool TrySpawn(uint amount, CustomTeam customTeam) /// The amount of units to be spawned. /// The specified id. /// if the was successfully spawned; otherwise, . - public static bool TrySpawn(uint amount, uint id) + public static bool TrySpawn(int amount, uint id) { if (TryGet(id, out CustomTeam customTeam)) return false; @@ -526,9 +553,9 @@ public bool Eject(Pawn player) /// Additionally, if the respawn team is of type and a valid is available using , a new unit naming message is sent for NineTailedFox units. /// /// - public void Respawn(uint amount) + public void Respawn(int amount) { - Pawn[] players = Player.Get(Team.Dead).Take((int)amount).Cast().ToArray(); + IEnumerable players = Player.Get(Team.Dead).Take(amount).Cast(); if (players.IsEmpty()) return; diff --git a/Exiled.CustomModules/API/Features/RespawnManager.cs b/Exiled.CustomModules/API/Features/RespawnManager.cs new file mode 100644 index 0000000000..933f7d2299 --- /dev/null +++ b/Exiled.CustomModules/API/Features/RespawnManager.cs @@ -0,0 +1,160 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +using System.Runtime.InteropServices.WindowsRuntime; +using Respawning; + +namespace Exiled.CustomModules.API.Features +{ + using System; + using System.Collections.Generic; + using System.Linq; + + using Exiled.API.Extensions; + using Exiled.API.Features; + using Exiled.API.Features.Attributes; + using Exiled.API.Features.Core; + using Exiled.API.Features.DynamicEvents; + using Exiled.API.Features.Items; + using Exiled.API.Features.Pickups; + using Exiled.CustomModules.API.Features.CustomRoles; + using Exiled.CustomModules.API.Interfaces; + using Exiled.CustomModules.Events.EventArgs.CustomItems; + using Exiled.CustomModules.Events.EventArgs.Tracking; + using Exiled.Events.EventArgs.Map; + using Exiled.Events.EventArgs.Player; + using Exiled.Events.EventArgs.Server; + using HarmonyLib; + using PlayerRoles; + using PlayerRoles.RoleAssign; + + /// + /// The actor which handles all team respawning tasks for roles. + /// + public class RespawnManager : StaticActor + { + private object nextKnownTeam; + + /// + /// Gets or sets the next known team. + /// + public object NextKnownTeam + { + get => nextKnownTeam; + set + { + if (value == nextKnownTeam) + return; + + if (value is SpawnableTeamType spawnableTeamType) + { + nextKnownTeam = value; + return; + } + + if (value is uint id && CustomTeam.TryGet(id, out CustomTeam _)) + { + nextKnownTeam = id; + return; + } + + throw new ArgumentException("NextKnownTeam only accepts SpawnableTeamType and parsed uint."); + } + } + + /// + /// Forces the spawn of a wave of the specified team. + /// + /// The specified team. + public void ForceSpawn(object value) + { + NextKnownTeam = value; + + if (NextKnownTeam is SpawnableTeamType team) + { + Respawning.RespawnManager.Singleton.ForceSpawnTeam(team); + return; + } + + Spawn(); + Respawning.RespawnManager.Singleton.RestartSequence(); + } + + /// + /// Spawns the wave. + /// + public void Spawn() + { + CustomTeam team = CustomTeam.Get((uint)NextKnownTeam); + List toSpawn = Player.Get(Team.Dead).ToList(); + int spawnable = toSpawn.Count; + int maxWaveSize = team.Size; + + if (spawnable > maxWaveSize) + toSpawn.RemoveRange(spawnable, maxWaveSize - spawnable); + + CustomTeam.TrySpawn(toSpawn.Cast(), team); + } + + /// + protected override void SubscribeEvents() + { + base.SubscribeEvents(); + + Exiled.Events.Handlers.Server.SelectingRespawnTeam += OnSelectingRespawnTeam; + Exiled.Events.Handlers.Server.PreRespawningTeam += OnPreRespawningTeam; + Exiled.Events.Handlers.Server.DeployingTeamRole += OnDeployingTeamRole; + } + + /// + protected override void UnsubscribeEvents() + { + base.UnsubscribeEvents(); + + Exiled.Events.Handlers.Server.SelectingRespawnTeam -= OnSelectingRespawnTeam; + Exiled.Events.Handlers.Server.PreRespawningTeam -= OnPreRespawningTeam; + Exiled.Events.Handlers.Server.DeployingTeamRole -= OnDeployingTeamRole; + } + + private void OnSelectingRespawnTeam(SelectingRespawnTeamEventArgs ev) + { + foreach (CustomTeam team in CustomTeam.List) + { + if (!team.EvaluateConditions || !team.CanSpawnByProbability) + continue; + + NextKnownTeam = team.Id; + } + } + + private void OnPreRespawningTeam(PreRespawningTeamEventArgs ev) + { + if (NextKnownTeam is not SpawnableTeamType team) + { + CustomTeam customTeam = CustomTeam.Get((uint)NextKnownTeam); + + if (customTeam.TeamsOwnership.Any(t => t == (ev.NextKnownTeam is SpawnableTeamType.ChaosInsurgency ? Team.ChaosInsurgency : Team.FoundationForces))) + { + ev.MaxWaveSize = customTeam.Size; + return; + } + + ev.IsAllowed = false; + Spawn(); + return; + } + } + + private void OnDeployingTeamRole(DeployingTeamRoleEventArgs ev) + { + if (NextKnownTeam is SpawnableTeamType team) + return; + + ev.Delegate = () => CustomTeam.TrySpawn(ev.Player.Cast(), (uint)NextKnownTeam); + } + } +} \ No newline at end of file diff --git a/Exiled.Events/EventArgs/Server/PreRespawningTeamEventArgs.cs b/Exiled.Events/EventArgs/Server/PreRespawningTeamEventArgs.cs new file mode 100644 index 0000000000..f9383713aa --- /dev/null +++ b/Exiled.Events/EventArgs/Server/PreRespawningTeamEventArgs.cs @@ -0,0 +1,78 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Events.EventArgs.Server +{ + using System.Collections.Generic; + + using Exiled.API.Features; + using Exiled.Events.EventArgs.Interfaces; + + using PlayerRoles; + + using Respawning; + + /// + /// Contains all information before setting up the environment for respawning a wave of or + /// . + /// + public class PreRespawningTeamEventArgs : IDeniableEvent + { + private SpawnableTeamType nextKnownTeam; + private int maxWaveSize; + + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// + /// + public PreRespawningTeamEventArgs(SpawnableTeamHandlerBase spawnableTeamHandler, int maxRespawn, SpawnableTeamType nextKnownTeam, bool isAllowed = true) + { + SpawnableTeamHandler = spawnableTeamHandler; + MaxWaveSize = maxRespawn; + this.nextKnownTeam = nextKnownTeam; + IsAllowed = isAllowed; + } + + /// + /// Gets or sets the . + /// + public SpawnableTeamHandlerBase SpawnableTeamHandler { get; set; } + + /// + /// Gets or sets the maximum amount of respawnable players. + /// + public int MaxWaveSize { get; set; } + + /// + /// Gets or sets a value indicating what the next respawnable team is. + /// + public SpawnableTeamType NextKnownTeam + { + get => nextKnownTeam; + set + { + nextKnownTeam = value; + + if (!RespawnManager.SpawnableTeams.TryGetValue(value, out SpawnableTeamHandlerBase spawnableTeam)) + { + MaxWaveSize = 0; + return; + } + + MaxWaveSize = spawnableTeam.MaxWaveSize; + } + } + + /// + /// Gets or sets a value indicating whether or not the spawn can occur. + /// + public bool IsAllowed { get; set; } + } +} diff --git a/Exiled.Events/EventArgs/Server/RespawningTeamEventArgs.cs b/Exiled.Events/EventArgs/Server/RespawningTeamEventArgs.cs index d07c02b305..52db70eb08 100644 --- a/Exiled.Events/EventArgs/Server/RespawningTeamEventArgs.cs +++ b/Exiled.Events/EventArgs/Server/RespawningTeamEventArgs.cs @@ -36,10 +36,8 @@ public RespawningTeamEventArgs(List players, int maxRespawn, SpawnableTe { Players = players; MaxWaveSize = maxRespawn; - this.nextKnownTeam = nextKnownTeam; SpawnQueue = new(); - SpawnableTeam.GenerateQueue(SpawnQueue, players.Count); IsAllowed = isAllowed; } @@ -49,59 +47,23 @@ public RespawningTeamEventArgs(List players, int maxRespawn, SpawnableTe public List Players { get; } /// - /// Gets or sets the maximum amount of respawnable players. + /// Gets a value the next team to be respawned. /// - public int MaxWaveSize - { - get => maxWaveSize; - set - { - if (value < maxWaveSize) - { - if (Players.Count > value) - Players.RemoveRange(value, Players.Count - value); - } - - maxWaveSize = value; - } - } + public SpawnableTeamType NextKnownTeam { get; } /// - /// Gets or sets a value indicating what the next respawnable team is. + /// Gets the maximum amount of respawnable players. /// - public SpawnableTeamType NextKnownTeam - { - get => nextKnownTeam; - set - { - nextKnownTeam = value; - - if (!RespawnManager.SpawnableTeams.TryGetValue(value, out SpawnableTeamHandlerBase spawnableTeam)) - { - MaxWaveSize = 0; - return; - } - - MaxWaveSize = spawnableTeam.MaxWaveSize; - if (RespawnManager.SpawnableTeams.TryGetValue(nextKnownTeam, out SpawnableTeamHandlerBase @base)) - @base.GenerateQueue(SpawnQueue, Players.Count); - } - } + public int MaxWaveSize { get; } /// - /// Gets the current spawnable team. + /// Gets or sets the RoleTypeId spawn queue. /// - public SpawnableTeamHandlerBase SpawnableTeam - => RespawnManager.SpawnableTeams.TryGetValue(NextKnownTeam, out SpawnableTeamHandlerBase @base) ? @base : null; + public Queue SpawnQueue { get; set; } /// /// Gets or sets a value indicating whether or not the spawn can occur. /// public bool IsAllowed { get; set; } - - /// - /// Gets or sets the RoleTypeId spawn queue. - /// - public Queue SpawnQueue { get; set; } } } diff --git a/Exiled.Events/Handlers/Server.cs b/Exiled.Events/Handlers/Server.cs index 9ee1729aae..8493739a1c 100644 --- a/Exiled.Events/Handlers/Server.cs +++ b/Exiled.Events/Handlers/Server.cs @@ -52,6 +52,11 @@ public static class Server /// public static Event ReportingCheater { get; set; } = new(); + /// + /// Invoked before setting up the environment for respawning a wave of Chaos Insurgency or NTF. + /// + public static Event PreRespawningTeam { get; set; } = new(); + /// /// Invoked before respawning a wave of Chaos Insurgency or NTF. /// @@ -185,12 +190,31 @@ public static class Server /// The instance. public static void OnReportingCheater(ReportingCheaterEventArgs ev) => ReportingCheater.InvokeSafely(ev); + /// + /// Called before selecting the team that will respawn next. + /// + /// The instance. + public static void OnSelectingRespawnTeam(SelectingRespawnTeamEventArgs ev) => SelectingRespawnTeam.InvokeSafely(ev); + + /// + /// Called before setting up the environment for respawning a wave of Chaos Insurgency or NTF. + /// + /// The instance. + public static void OnPreRespawningTeam(PreRespawningTeamEventArgs ev) => PreRespawningTeam.InvokeSafely(ev); + /// /// Called before respawning a wave of Chaos Insurgency or NTF. /// /// The instance. public static void OnRespawningTeam(RespawningTeamEventArgs ev) => RespawningTeam.InvokeSafely(ev); + /// + /// Called after a team has spawned. + /// + /// + /// + public static void OnRespawnedTeam(SpawnableTeamType teamType, List hubs) => RespawnedTeam.InvokeSafely(new RespawnedTeamEventArgs(teamType, hubs)); + /// /// Called before adding an unit name. /// @@ -239,19 +263,6 @@ public static class Server /// public static void OnReloadedPermissions() => ReloadedPermissions.InvokeSafely(); - /// - /// Called before selecting the team that will respawn next. - /// - /// The instance. - public static void OnSelectingRespawnTeam(SelectingRespawnTeamEventArgs ev) => SelectingRespawnTeam.InvokeSafely(ev); - - /// - /// Called after a team has spawned. - /// - /// - /// - public static void OnRespawnedTeam(SpawnableTeamType teamType, List hubs) => RespawnedTeam.InvokeSafely(new RespawnedTeamEventArgs(teamType, hubs)); - /// /// Called before setting up the environment for the assignment of human roles. /// diff --git a/Exiled.Events/Patches/Events/Server/RespawningTeam.cs b/Exiled.Events/Patches/Events/Server/RespawningTeam.cs index f86b1d1bcf..eaf7d06a87 100644 --- a/Exiled.Events/Patches/Events/Server/RespawningTeam.cs +++ b/Exiled.Events/Patches/Events/Server/RespawningTeam.cs @@ -38,12 +38,56 @@ private static IEnumerable Transpiler(IEnumerable newInstructions = ListPool.Pool.Get(instructions); - int offset = -6; - int index = newInstructions.FindIndex(instruction => instruction.Calls(Method(typeof(UnitNamingRule), nameof(UnitNamingRule.TryGetNamingRule)))) + offset; - - LocalBuilder ev = generator.DeclareLocal(typeof(RespawningTeamEventArgs)); + LocalBuilder preRespawningEv = generator.DeclareLocal(typeof(PreRespawningTeamEventArgs)); + LocalBuilder respawningEv = generator.DeclareLocal(typeof(RespawningTeamEventArgs)); + LocalBuilder deployingEv = generator.DeclareLocal(typeof(DeployingTeamRoleEventArgs)); Label continueLabel = generator.DefineLabel(); + Label ret = generator.DefineLabel(); + Label jne = generator.DefineLabel(); + + int offset = -7; + int index = newInstructions.FindIndex(i => i.opcode == OpCodes.Sub) + offset; + + newInstructions.InsertRange(index, new CodeInstruction[] + { + // preRespawningEv = new PreRespawningTeamEventArgs(SpawnableTeamHandlerBase, int, SpawnableTeamType, bool) + // Handlers.Server.OnPreRespawningTeam(preRespawningEv) + new(OpCodes.Ldloc_0), + new(OpCodes.Ldloc_2), + new(OpCodes.Ldarg_0), + new(OpCodes.Ldfld, Field(typeof(RespawnManager), nameof(RespawnManager.NextKnownTeam))), + new(OpCodes.Ldc_I4_1), + new(OpCodes.Newobj, GetDeclaredConstructors(typeof(PreRespawningTeamEventArgs))[0]), + new(OpCodes.Dup), + new(OpCodes.Dup), + new(OpCodes.Stloc_S, preRespawningEv.LocalIndex), + new(OpCodes.Call, Method(typeof(Handlers.Server), nameof(Handlers.Server.OnPreRespawningTeam))), + + // if (!preRespawningEv.IsAllowed) + // goto ret + new(OpCodes.Callvirt, PropertyGetter(typeof(PreRespawningTeamEventArgs), nameof(PreRespawningTeamEventArgs.IsAllowed))), + new(OpCodes.Brfalse_S, ret), + + // SpawnableTeamHandlerBase = preRespawningEv.SpawnableTeamHandler + new(OpCodes.Ldloc_S, preRespawningEv.LocalIndex), + new(OpCodes.Callvirt, PropertyGetter(typeof(PreRespawningTeamEventArgs), nameof(PreRespawningTeamEventArgs.SpawnableTeamHandler))), + new(OpCodes.Stloc_0), + + // this.NextKnownTeam = preRespawningEv.NextKnownTeam + new(OpCodes.Ldarg_0), + new(OpCodes.Ldloc_S, preRespawningEv.LocalIndex), + new(OpCodes.Callvirt, PropertyGetter(typeof(PreRespawningTeamEventArgs), nameof(PreRespawningTeamEventArgs.NextKnownTeam))), + new(OpCodes.Stfld, Field(typeof(RespawnManager), nameof(RespawnManager.NextKnownTeam))), + + // maxWaveSize = preRespawningEv.MaxWaveSize + new(OpCodes.Ldloc_S, preRespawningEv.LocalIndex), + new(OpCodes.Callvirt, PropertyGetter(typeof(PreRespawningTeamEventArgs), nameof(PreRespawningTeamEventArgs.MaxWaveSize))), + new(OpCodes.Stloc_2), + }); + + offset = -6; + index = newInstructions.FindIndex(instruction => instruction.Calls(Method(typeof(UnitNamingRule), nameof(UnitNamingRule.TryGetNamingRule)))) + offset; newInstructions.InsertRange(index, new CodeInstruction[] { @@ -61,40 +105,22 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable i.opcode == OpCodes.Ldc_I4_M1) + offset; - LocalBuilder deployingEv = generator.DeclareLocal(typeof(DeployingTeamRoleEventArgs)); - Label jne = generator.DefineLabel(); - newInstructions.InsertRange(index, new CodeInstruction[] { new(OpCodes.Ldloc_S, 10), @@ -141,6 +164,8 @@ private static IEnumerable Transpiler(IEnumerable Date: Thu, 1 Feb 2024 05:57:44 +0100 Subject: [PATCH 068/141] Changed `virtual SpawnableTeamType CustomTeam::RespawnTeam` property is now `virtual SpawnableTeamType[] CustomTeam::SpawnableFromTeams`. A few fixes. --- .../API/Features/CustomRoles/CustomTeam.cs | 6 +++--- Exiled.CustomModules/API/Features/RespawnManager.cs | 10 +--------- 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/Exiled.CustomModules/API/Features/CustomRoles/CustomTeam.cs b/Exiled.CustomModules/API/Features/CustomRoles/CustomTeam.cs index 59610c709e..54b9f5f518 100644 --- a/Exiled.CustomModules/API/Features/CustomRoles/CustomTeam.cs +++ b/Exiled.CustomModules/API/Features/CustomRoles/CustomTeam.cs @@ -117,7 +117,7 @@ public abstract class CustomTeam : CustomModule /// /// Gets the which is being spawned from. /// - public virtual SpawnableTeamType RespawnTeam { get; } + public virtual SpawnableTeamType[] SpawnableFromTeams { get; } /// /// Gets a value indicating whether the is configured to use respawn tickets. @@ -562,7 +562,7 @@ public void Respawn(int amount) players.ForEach(player => Spawn(player)); - if (RespawnTeam is SpawnableTeamType.NineTailedFox && UnitNamingRule.TryGetNamingRule(SpawnableTeamType.NineTailedFox, out UnitNamingRule rule)) + if (TeamsOwnership.Any(team => team == Team.FoundationForces) && UnitNamingRule.TryGetNamingRule(SpawnableTeamType.NineTailedFox, out UnitNamingRule rule)) UnitNameMessageHandler.SendNew(SpawnableTeamType.NineTailedFox, rule); } @@ -604,7 +604,7 @@ public void Respawn(IEnumerable players, bool keepSize = true) count++; } - if (RespawnTeam is SpawnableTeamType.NineTailedFox && UnitNamingRule.TryGetNamingRule(SpawnableTeamType.NineTailedFox, out UnitNamingRule rule)) + if (TeamsOwnership.Any(team => team == Team.FoundationForces) && UnitNamingRule.TryGetNamingRule(SpawnableTeamType.NineTailedFox, out UnitNamingRule rule)) UnitNameMessageHandler.SendNew(SpawnableTeamType.NineTailedFox, rule); } diff --git a/Exiled.CustomModules/API/Features/RespawnManager.cs b/Exiled.CustomModules/API/Features/RespawnManager.cs index 933f7d2299..45e2d84d23 100644 --- a/Exiled.CustomModules/API/Features/RespawnManager.cs +++ b/Exiled.CustomModules/API/Features/RespawnManager.cs @@ -5,9 +5,6 @@ // // ----------------------------------------------------------------------- -using System.Runtime.InteropServices.WindowsRuntime; -using Respawning; - namespace Exiled.CustomModules.API.Features { using System; @@ -31,6 +28,7 @@ namespace Exiled.CustomModules.API.Features using HarmonyLib; using PlayerRoles; using PlayerRoles.RoleAssign; + using Respawning; /// /// The actor which handles all team respawning tasks for roles. @@ -91,12 +89,6 @@ public void Spawn() { CustomTeam team = CustomTeam.Get((uint)NextKnownTeam); List toSpawn = Player.Get(Team.Dead).ToList(); - int spawnable = toSpawn.Count; - int maxWaveSize = team.Size; - - if (spawnable > maxWaveSize) - toSpawn.RemoveRange(spawnable, maxWaveSize - spawnable); - CustomTeam.TrySpawn(toSpawn.Cast(), team); } From 1532ff3c5ecf6d53b930871a22f172be3e444fde Mon Sep 17 00:00:00 2001 From: Yamato Date: Thu, 1 Feb 2024 11:53:35 +0100 Subject: [PATCH 069/141] Fix SpawningRagdoll Transpiler --- .../Patches/Events/Player/SpawningRagdoll.cs | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/Exiled.Events/Patches/Events/Player/SpawningRagdoll.cs b/Exiled.Events/Patches/Events/Player/SpawningRagdoll.cs index d4e60b095f..08f0d34aa7 100644 --- a/Exiled.Events/Patches/Events/Player/SpawningRagdoll.cs +++ b/Exiled.Events/Patches/Events/Player/SpawningRagdoll.cs @@ -52,8 +52,9 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable instruction.Calls(PropertySetter(typeof(BasicRagdoll), nameof(BasicRagdoll.NetworkInfo)))) + offset; - - newInstructions.InsertRange(index, new CodeInstruction[] - { - // ev.Info - new(OpCodes.Ldloc_S, ev.LocalIndex), - new(OpCodes.Callvirt, PropertyGetter(typeof(SpawningRagdollEventArgs), nameof(SpawningRagdollEventArgs.Info))), + new(OpCodes.Call, PropertySetter(typeof(BasicRagdoll), nameof(BasicRagdoll.NetworkInfo))), // new Vector3() new(OpCodes.Ldloca_S, targetScale.LocalIndex), From 184702c63c0a0e8bcd496c873556b28fa52dd2f9 Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Fri, 2 Feb 2024 04:33:20 +0100 Subject: [PATCH 070/141] Fixed circular dependencies and miscalculated roles from `RoleAssigner`. Added `RoleAssigner::FindAvailableRole`, `RoleAssigner::GetCustomRolesByProbability` and `RoleAssigner::DistributeOrEnqueue` methods. Added support for roles to be assigned before spawning and after the base role was assigned. Added `CustomRole::OverriddenScps` property. Added `CustomRole::EvaluateConditions` property. Added `CustomRole::RequiredTeamToSpawn`, `CustomRole::RequiredRoleToSpawn`,`CustomRole::RequiredCustomTeamToSpawn`, `CustomRole::RequiredCustomRoleToSpawn`. Changed `Team CustomRole::TeamOwnership` to `Team[] CustomRole::TeamsOwnership`. Made `CustomRole::IsScp` a `virtual` assignable property again. --- .../API/Features/CustomRoles/CustomRole.cs | 114 ++++++++- .../API/Features/RoleAssigner.cs | 226 ++++++++++++++---- 2 files changed, 287 insertions(+), 53 deletions(-) diff --git a/Exiled.CustomModules/API/Features/CustomRoles/CustomRole.cs b/Exiled.CustomModules/API/Features/CustomRoles/CustomRole.cs index c2d8900382..81732399b2 100644 --- a/Exiled.CustomModules/API/Features/CustomRoles/CustomRole.cs +++ b/Exiled.CustomModules/API/Features/CustomRoles/CustomRole.cs @@ -103,6 +103,78 @@ public abstract class CustomRole : CustomModule, IAdditiveBehaviour /// public virtual int Probability { get; } + /// + /// Gets a value indicating whether the role can spawn given a condition. + /// + public virtual bool EvaluateConditions + { + get + { + IEnumerable list = Player.List.Cast(); + + if (RequiredTeamToSpawn is not Team.Dead) + { + foreach (Pawn pawn in list) + { + if ((!pawn.HasCustomRole || !pawn.CustomRole.TeamsOwnership.Contains(RequiredTeamToSpawn)) && pawn.Role.Team != RequiredTeamToSpawn) + continue; + + return true; + } + } + + if (RequiredRoleToSpawn is not RoleTypeId.None) + { + foreach (Pawn pawn in list) + { + if (pawn.Role == RequiredRoleToSpawn) + { + if ((RoleExtensions.GetTeam(RequiredRoleToSpawn) is Team.SCPs && !pawn.IsScp) || + (RoleExtensions.GetTeam(RequiredRoleToSpawn) is not Team.SCPs && pawn.IsScp)) + continue; + + return true; + } + } + } + + return (RequiredCustomTeamToSpawn > 0 && CustomTeam.TryGet(RequiredCustomTeamToSpawn, out CustomTeam team) && !team.Owners.IsEmpty()) || + (RequiredCustomRoleToSpawn > 0 && CustomRole.TryGet(RequiredCustomRoleToSpawn, out CustomRole role) && !role.Owners.IsEmpty()); + } + } + + /// + /// Gets the required that players must belong to in order to allow the to spawn. + /// + /// + /// This property specifies the required alive team to be eligible for spawning in the . + /// + public virtual Team RequiredTeamToSpawn => Team.Dead; + + /// + /// Gets the required that players must have to allow the to spawn. + /// + /// + /// This property specifies the required role type for players to be eligible for spawning in the . + /// + public virtual RoleTypeId RequiredRoleToSpawn => RoleTypeId.None; + + /// + /// Gets the required custom team that players must belong to in order to allow the to spawn. + /// + /// + /// This property specifies the required alive custom team to be eligible for spawning in the . + /// + public virtual uint RequiredCustomTeamToSpawn { get; } + + /// + /// Gets the required that players must have to allow the to spawn. + /// + /// + /// This property specifies the required custom role for players to be eligible for spawning in the . + /// + public virtual uint RequiredCustomRoleToSpawn { get; } + /// /// Gets the . /// @@ -124,11 +196,12 @@ public abstract class CustomRole : CustomModule, IAdditiveBehaviour public virtual int MaxInstances => IsScp ? 1 : -1; /// - /// Gets the team ownership of the . + /// Gets the required teams for this to win. /// - /// - /// By setting the ownership, the will belong to the specified team. - public virtual Team TeamOwnership { get; } + /// + /// This property specifies the teams the belongs to. + /// + public virtual Team[] TeamsOwnership { get; } = { }; /// /// Gets the from which to retrieve players for assigning the . @@ -140,6 +213,11 @@ public abstract class CustomRole : CustomModule, IAdditiveBehaviour /// public virtual RoleTypeId AssignFromRole { get; } + /// + /// Gets all roles to override, preventing the specified roles to spawn. + /// + public virtual RoleTypeId[] OverrideScps { get; } + /// /// Gets a value indicating whether the should be treated as a separate team unit. /// @@ -153,7 +231,7 @@ public abstract class CustomRole : CustomModule, IAdditiveBehaviour /// /// Gets a value indicating whether the should be considered an SCP. /// - public bool IsScp => TeamOwnership is Team.SCPs; + public virtual bool IsScp { get; } /// /// Gets a of containing all players owning this . @@ -183,19 +261,41 @@ public static CustomRole Get(Type type) => typeof(CustomRole).IsAssignableFrom(type) ? TypeLookupTable[type] : typeof(RoleBehaviour).IsAssignableFrom(type) ? BehaviourLookupTable[type] : null; + /// + /// Gets all instances based on the predicate. + /// + /// The predicate. + /// All instances matching the predicate. + public static IEnumerable Get(Func predicate) => List.Where(predicate); + + /// + /// Gets all instances belonging to the specified . + /// + /// The specified . + /// All instances belonging to the specified . + public static IEnumerable Get(RoleTypeId role) => List.Where(customRole => customRole.AssignFromRole == role); + + /// + /// Gets all instances belonging to the specified . + /// + /// The specified . + /// All instances belonging to the specified . + public static IEnumerable Get(SpawnableTeamType team) => List.Where(customRole => customRole.AssignFromTeam == team); + /// /// Gets all instances belonging to the specified . /// /// The specified . /// All instances belonging to the specified . - public static IEnumerable Get(Team team) => List.Where(customRole => RoleExtensions.GetTeam(customRole.Role) == team); + public static IEnumerable Get(Team team) => List.Where(customRole => RoleExtensions.GetTeam(customRole.Role) == team || customRole.TeamsOwnership.Contains(team)); /// /// Gets all instances belonging to the specified teams. /// /// The specified teams. /// All instances belonging to the specified teams. - public static IEnumerable Get(IEnumerable teams) => List.Where(customRole => teams.Contains(RoleExtensions.GetTeam(customRole.Role))); + public static IEnumerable Get(IEnumerable teams) => List.Where(customRole => + teams.Contains(RoleExtensions.GetTeam(customRole.Role)) || customRole.TeamsOwnership.Any(to => teams.Contains(to))); /// /// Gets all instances belonging to the specified teams. diff --git a/Exiled.CustomModules/API/Features/RoleAssigner.cs b/Exiled.CustomModules/API/Features/RoleAssigner.cs index c863473f84..0fdcae8cba 100644 --- a/Exiled.CustomModules/API/Features/RoleAssigner.cs +++ b/Exiled.CustomModules/API/Features/RoleAssigner.cs @@ -56,6 +56,28 @@ public class RoleAssigner : StaticActor /// public List EnqueuedHumans { get; protected set; } = new(); + /// + /// Gets or sets all enqueued players. + /// + public List EnqueuedPlayers { get; protected set; } = new(); + + /// + /// Gets or sets the human roles queue. + /// + public Team[] HumanRolesQueue { get; protected set; } = { }; + + /// + /// Gets a filter to retrieve all available human custom roles. + /// + public Func FilterHumans => customRole => + customRole.AssignFromRole is RoleTypeId.None && + (HumanRolesQueue.Contains(RoleExtensions.GetTeam(customRole.Role)) || customRole.TeamsOwnership.Any(to => HumanRolesQueue.Contains(to))); + + /// + /// Gets a filter to retrieve all available SCP custom roles. + /// + public Func FilterScps => customRole => customRole.IsScp && !customRole.IsTeamUnit && customRole.AssignFromRole is RoleTypeId.None; + /// /// Spawns human players based on the provided queue of teams and the length of the queue. /// @@ -63,27 +85,26 @@ public class RoleAssigner : StaticActor /// The length of the queue. public virtual void SpawnHumans(Team[] queue, int queueLength) { + HumanRolesQueue = queue; EnqueuedHumans.Clear(); - IEnumerable customRoles = CustomRole.Get(queue); - List toSpawn = new(); + IEnumerable customRoles = CustomRole.Get(FilterHumans); + List spawnable = GetCustomRolesByProbability(customRoles).ToList(); - foreach (CustomRole role in customRoles) - { - for (int i = 0; i == role.MaxInstances; i++) - { - if (role.AssignFromRole is RoleTypeId.None || !role.CanSpawnByProbability) - continue; + spawnable.ShuffleList(); - toSpawn.AddItem(role.Id); - } - } + IEnumerable hubs = ReferenceHub.AllHubs.Where(PlayerRoles.RoleAssign.RoleAssigner.CheckPlayer) + .Concat(EnqueuedPlayers.Select(player => player.ReferenceHub)); - toSpawn.ShuffleList(); - EnqueuedHumans.AddRange(toSpawn.Cast()); + EnqueuedPlayers.Clear(); - IEnumerable hubs = ReferenceHub.AllHubs.Where(PlayerRoles.RoleAssign.RoleAssigner.CheckPlayer); - int num = hubs.Count() - toSpawn.Count; + if (spawnable.Count > hubs.Count()) + spawnable.RemoveRange(0, spawnable.Count - hubs.Count()); + + EnqueuedHumans.AddRange(spawnable.Cast()); + + // Unless the custom roles are enough to cover the entire queue, some default roles will be selected. + int num = hubs.Count() - spawnable.Count; RoleTypeId[] array = num > 0 ? new RoleTypeId[num] : null; if (array is not null) @@ -99,8 +120,8 @@ public virtual void SpawnHumans(Team[] queue, int queueLength) AssigningHumanRolesDispatcher.InvokeAll(ev); EnqueuedHumans = ev.Roles; - EnqueuedHumans.Where(o => o is uint).ForEach(id => CustomRole.Get((uint)id).Spawn(Player.Get(hubs.Random()).Cast())); - EnqueuedHumans.RemoveAll(o => o is uint); + DistributeOrEnqueue(hubs.ToList(), EnqueuedHumans.Where(o => o is uint).Cast(), FilterHumans); + EnqueuedHumans.RemoveAll(o => o is not RoleTypeId); for (int j = 0; j < num; j++) HumanSpawner.AssignHumanRoleToRandomPlayer((RoleTypeId)EnqueuedHumans[j]); @@ -114,61 +135,147 @@ public virtual void SpawnScps(int targetScpNumber) { EnqueuedScps.Clear(); - IEnumerable customScps = CustomRole.Get(Team.SCPs); - List spawnable = new(); - - foreach (CustomRole scp in customScps) - { - for (int i = 0; i == scp.MaxInstances; i++) - { - if (scp.AssignFromRole is RoleTypeId.None || !scp.CanSpawnByProbability) - continue; - - spawnable.AddItem(scp.Id); - } - } + IEnumerable customScps = CustomRole.Get(FilterScps); + List spawnable = GetCustomRolesByProbability(CustomRole.Get(FilterScps)).ToList(); spawnable.ShuffleList(); if (spawnable.Count > targetScpNumber) spawnable.RemoveRange(0, spawnable.Count - targetScpNumber); - EnqueuedScps.AddRange(customScps); + EnqueuedScps.AddRange(spawnable.Cast()); if (spawnable.Count < targetScpNumber) { for (int i = 0; i < targetScpNumber - spawnable.Count; i++) - EnqueuedScps.Add(ScpSpawner.NextScp); + { + RoleTypeId nextScp = ScpSpawner.NextScp; + if (customScps.Any(scp => scp.OverrideScps.Contains(nextScp))) + continue; + + EnqueuedScps.Add((object)nextScp); + } } int index = 0; List chosenPlayers = ScpPlayerPicker.ChoosePlayers(targetScpNumber); + if (spawnable.Count < targetScpNumber) + EnqueuedPlayers.AddRange(chosenPlayers.Select(rh => Player.Get(rh)).Take(targetScpNumber - spawnable.Count)); + Events.EventArgs.CustomRoles.AssigningScpRolesEventArgs ev = new(chosenPlayers, EnqueuedScps); AssigningScpRolesDispatcher.InvokeAll(ev); EnqueuedScps = ev.Roles; - foreach (object role in EnqueuedScps.ToList()) + List enqueuedScps = EnqueuedScps.Where(role => role is RoleTypeId).Cast().ToList(); + while (enqueuedScps.Count > 0 && chosenPlayers.Count > 0) { - if (role is not uint id) + RoleTypeId scp = enqueuedScps[0]; + enqueuedScps.RemoveAt(0); + ScpSpawner.AssignScp(chosenPlayers, scp, enqueuedScps); + } + + DistributeOrEnqueue(chosenPlayers, EnqueuedScps.Where(o => o is uint).Cast(), FilterScps); + EnqueuedScps.Clear(); + } + + /// + /// Distributes the given roles to all specified players based on a predicate. + /// + /// If a role cannot be assigned due to some circumstances, it will be enqueued until a new role is found. + /// + /// The players to assign the roles to. + /// The roles to be assigned. + /// The predicate. + public void DistributeOrEnqueue(IEnumerable players, List roles, Func predicate) => + DistributeOrEnqueue(players.Select(player => player.ReferenceHub).ToList(), roles, predicate); + + /// + /// Distributes the given roles to all specified players based on a predicate. + /// + /// If a role cannot be assigned due to some circumstances, it will be enqueued until a new role is found. + /// + /// The players to assign the roles to. + /// The roles to be assigned. + /// The predicate. + public virtual void DistributeOrEnqueue(List players, IEnumerable roles, Func predicate) + { + if (roles.IsEmpty()) + return; + + int spawned = 0; + foreach (uint id in roles) + { + if (!CustomRole.TryGet(id, out CustomRole role) || (role.Instances >= role.MaxInstances || !role.EvaluateConditions)) continue; - ReferenceHub chosenPlayer = chosenPlayers[0]; - Pawn pawn = Player.Get(chosenPlayer).Cast(); - CustomRole.Get(id).Spawn(pawn); - EnqueuedScps.Remove(role); - chosenPlayers.RemoveAt(0); - ++index; + ReferenceHub target = players[0]; + CustomRole.TrySpawn(Player.Get(target).Cast(), role); + players.RemoveAt(0); + ++spawned; + } + + if (spawned < roles.Count()) + { + for (int i = spawned; i == roles.Count(); i++) + { + ReferenceHub target = players[0]; + CustomRole.TrySpawn(Player.Get(target).Cast(), FindAvailableRole(predicate)); + players.RemoveAt(0); + } } + } - EnqueuedScps.RemoveAll(o => o is uint); + /// + /// Finds an available based on a predicate. + /// + /// The predicate. + /// The first available . + public CustomRole FindAvailableRole(Func predicate) => + FindAvailableRole(CustomRole.Get(predicate).Shuffle().ToList()); - List enqueuedScps = EnqueuedScps.Cast().ToList(); - while (enqueuedScps.Count > 0 && chosenPlayers.Count > 0) + /// + /// Finds the first available in the specified list. + /// + /// The list of roles to evaluate. + /// The first available . + public CustomRole FindAvailableRole(List toEvaluate) + { + if (toEvaluate.IsEmpty()) { - RoleTypeId scp = enqueuedScps[0]; - enqueuedScps.RemoveAt(0); - ScpSpawner.AssignScp(chosenPlayers, scp, enqueuedScps); + throw new Exception( + "Couldn't find any alternative custom role to assign." + + "Common causes may be circular dependencies into conditions, overridden SCPs or a wrong defined amount of maximum allowed instances."); + } + + CustomRole role = toEvaluate[0]; + + if ((role.IsScp && !role.OverrideScps.IsEmpty()) || role.Instances >= role.MaxInstances || + (role.AssignFromRole is RoleTypeId.None && !role.EvaluateConditions)) + { + toEvaluate.RemoveAt(0); + return FindAvailableRole(toEvaluate); + } + + return role; + } + + /// + /// Gets all custom roles after evaluating their probability. + /// + /// The custom roles to evaluate. + /// All evaluated custom roles. + public virtual IEnumerable GetCustomRolesByProbability(IEnumerable customRoles) + { + foreach (CustomRole customRole in customRoles) + { + for (int i = 0; i == customRole.MaxInstances; i++) + { + if (!customRole.CanSpawnByProbability) + continue; + + yield return customRole.Id; + } } } @@ -179,6 +286,9 @@ protected override void SubscribeEvents() Exiled.Events.Handlers.Server.PreAssigningHumanRoles += OnPreAssigningHumanRoles; Exiled.Events.Handlers.Server.PreAssigningScpRoles += OnPreAssigningScpRoles; + + Exiled.Events.Handlers.Player.ChangingRole += OnChangingRole; + Exiled.Events.Handlers.Player.Spawning += OnSpawning; } /// @@ -188,6 +298,9 @@ protected override void UnsubscribeEvents() Exiled.Events.Handlers.Server.PreAssigningHumanRoles -= OnPreAssigningHumanRoles; Exiled.Events.Handlers.Server.PreAssigningScpRoles -= OnPreAssigningScpRoles; + + Exiled.Events.Handlers.Player.ChangingRole -= OnChangingRole; + Exiled.Events.Handlers.Player.Spawning -= OnSpawning; } private void OnPreAssigningHumanRoles(PreAssigningHumanRolesEventArgs ev) @@ -201,5 +314,26 @@ private void OnPreAssigningScpRoles(PreAssigningScpRolesEventArgs ev) SpawnScps(ev.Amount); ev.IsAllowed = false; } + + private void OnChangingRole(ChangingRoleEventArgs ev) + { + if (!PlayerRoles.RoleAssign.RoleAssigner.CheckPlayer(ev.Player.ReferenceHub)) + return; + + EnqueuedPlayers.Add(ev.Player.Cast()); + } + + private void OnSpawning(SpawningEventArgs ev) + { + if (!EnqueuedPlayers.Contains(ev.Player) || ev.Player.Cast().HasCustomRole) + return; + + CustomRole customRole = FindAvailableRole(role => role.AssignFromRole == ev.Player.Role); + + if (!customRole) + return; + + customRole.ForceSpawn(ev.Player.Cast(), true); + } } } \ No newline at end of file From 0620de94b38b9b6295ebff78f1a959cc1a74ac6d Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Fri, 2 Feb 2024 05:38:41 +0100 Subject: [PATCH 071/141] Added `UseDefaultRespawnManager` and `UseAutomaticModulesLoader` configs. Added the automatic modules loader. --- .../Features/CustomAbilities/CustomAbility.cs | 11 +++++-- .../Features/CustomEscapes/CustomEscape.cs | 11 +++++-- .../CustomGamemodes/CustomGameMode.cs | 11 +++++-- .../API/Features/CustomItems/CustomItem.cs | 18 +++++++++-- .../API/Features/CustomRoles/CustomRole.cs | 18 +++++++++-- Exiled.CustomModules/Config.cs | 18 ++++++++++- Exiled.CustomModules/CustomModules.cs | 30 +++++++++++++++++++ 7 files changed, 106 insertions(+), 11 deletions(-) diff --git a/Exiled.CustomModules/API/Features/CustomAbilities/CustomAbility.cs b/Exiled.CustomModules/API/Features/CustomAbilities/CustomAbility.cs index e5d43b551f..dbed3d7189 100644 --- a/Exiled.CustomModules/API/Features/CustomAbilities/CustomAbility.cs +++ b/Exiled.CustomModules/API/Features/CustomAbilities/CustomAbility.cs @@ -464,10 +464,17 @@ public static void RemoveRange(T entity, IEnumerable ids) /// Enables all the custom abilities present in the assembly. /// /// A of which contains all the enabled custom abilities. - public static IEnumerable> EnableAll() + public static IEnumerable> EnableAll() => EnableAll(Assembly.GetCallingAssembly()); + + /// + /// Enables all the custom abilities present in the assembly. + /// + /// The assembly to enable the abilities from. + /// A of which contains all the enabled custom abilities. + public static IEnumerable> EnableAll(Assembly assembly) { List> customAbilities = new(); - foreach (Type type in Assembly.GetExecutingAssembly().GetTypes()) + foreach (Type type in assembly.GetTypes()) { CustomAbilityAttribute attribute = type.GetCustomAttribute(); if (!typeof(CustomAbility).IsAssignableFrom(type) || attribute is null) diff --git a/Exiled.CustomModules/API/Features/CustomEscapes/CustomEscape.cs b/Exiled.CustomModules/API/Features/CustomEscapes/CustomEscape.cs index 39c93a1483..145d0f8da1 100644 --- a/Exiled.CustomModules/API/Features/CustomEscapes/CustomEscape.cs +++ b/Exiled.CustomModules/API/Features/CustomEscapes/CustomEscape.cs @@ -90,10 +90,17 @@ public abstract class CustomEscape : CustomModule, IAdditiveBehaviour /// Enables all the custom escapes present in the assembly. /// /// A of containing all enabled custom escapes. - public static List EnableAll() + public static List EnableAll() => EnableAll(Assembly.GetCallingAssembly()); + + /// + /// Enables all the custom escapes present in the assembly. + /// + /// The assembly to enable the escapes from. + /// A of containing all enabled custom escapes. + public static List EnableAll(Assembly assembly) { List customEscapes = new(); - foreach (Type type in Assembly.GetCallingAssembly().GetTypes()) + foreach (Type type in assembly.GetTypes()) { CustomEscapeAttribute attribute = type.GetCustomAttribute(); if (!typeof(CustomEscape).IsAssignableFrom(type) || attribute is null) diff --git a/Exiled.CustomModules/API/Features/CustomGamemodes/CustomGameMode.cs b/Exiled.CustomModules/API/Features/CustomGamemodes/CustomGameMode.cs index 3cbbcb80de..dc2298794f 100644 --- a/Exiled.CustomModules/API/Features/CustomGamemodes/CustomGameMode.cs +++ b/Exiled.CustomModules/API/Features/CustomGamemodes/CustomGameMode.cs @@ -153,10 +153,17 @@ public static CustomGameMode Get(Type type) => /// Enables all the custom game modes present in the assembly. /// /// A of containing all enabled custom game modes. - public static List EnableAll() + public static List EnableAll() => EnableAll(Assembly.GetCallingAssembly()); + + /// + /// Enables all the custom game modes present in the assembly. + /// + /// The assembly to enable the game modes from. + /// A of containing all enabled custom game modes. + public static List EnableAll(Assembly assembly) { List customGameModes = new(); - foreach (Type type in Assembly.GetCallingAssembly().GetTypes()) + foreach (Type type in assembly.GetTypes()) { CustomGameModeAttribute attribute = type.GetCustomAttribute(); if (!typeof(CustomGameMode).IsAssignableFrom(type) || attribute is null) diff --git a/Exiled.CustomModules/API/Features/CustomItems/CustomItem.cs b/Exiled.CustomModules/API/Features/CustomItems/CustomItem.cs index 929781c4e0..dbe0d9eab8 100644 --- a/Exiled.CustomModules/API/Features/CustomItems/CustomItem.cs +++ b/Exiled.CustomModules/API/Features/CustomItems/CustomItem.cs @@ -348,10 +348,24 @@ public static bool TryGive(Player player, Type type, bool displayMessage = true) /// must be marked with the to be considered for enabling. If /// a custom item is enabled successfully, it is added to the returned list. /// - public static List EnableAll() + public static List EnableAll() => EnableAll(Assembly.GetCallingAssembly()); + + /// + /// Enables all the custom items present in the assembly. + /// + /// The assembly to enable the items from. + /// + /// A of containing all the enabled custom items. + /// + /// + /// This method dynamically enables all custom items found in the calling assembly. Custom items + /// must be marked with the to be considered for enabling. If + /// a custom item is enabled successfully, it is added to the returned list. + /// + public static List EnableAll(Assembly assembly) { List customItems = new(); - foreach (Type type in Assembly.GetCallingAssembly().GetTypes()) + foreach (Type type in assembly.GetTypes()) { CustomItemAttribute attribute = type.GetCustomAttribute(); if (!typeof(CustomItem).IsAssignableFrom(type) || attribute is null) diff --git a/Exiled.CustomModules/API/Features/CustomRoles/CustomRole.cs b/Exiled.CustomModules/API/Features/CustomRoles/CustomRole.cs index 81732399b2..460ed0596d 100644 --- a/Exiled.CustomModules/API/Features/CustomRoles/CustomRole.cs +++ b/Exiled.CustomModules/API/Features/CustomRoles/CustomRole.cs @@ -555,10 +555,24 @@ public static void Remove(IEnumerable players) /// must be marked with the to be considered for enabling. If /// a custom role is enabled successfully, it is added to the returned list. /// - public static List EnableAll() + public static List EnableAll() => EnableAll(Assembly.GetCallingAssembly()); + + /// + /// Enables all the custom roles present in the assembly. + /// + /// The assembly to enable the roles from. + /// + /// A of containing all the enabled custom roles. + /// + /// + /// This method dynamically enables all custom roles found in the calling assembly. Custom roles + /// must be marked with the to be considered for enabling. If + /// a custom role is enabled successfully, it is added to the returned list. + /// + public static List EnableAll(Assembly assembly) { List customRoles = new(); - foreach (Type type in Assembly.GetCallingAssembly().GetTypes()) + foreach (Type type in assembly.GetTypes()) { CustomRoleAttribute attribute = type.GetCustomAttribute(); if (!typeof(CustomRole).IsAssignableFrom(type) || attribute is null) diff --git a/Exiled.CustomModules/Config.cs b/Exiled.CustomModules/Config.cs index fa602310dd..77a6e93fbd 100644 --- a/Exiled.CustomModules/Config.cs +++ b/Exiled.CustomModules/Config.cs @@ -31,6 +31,22 @@ public class Config : IConfig /// Gets or sets a value indicating whether the built-in role assigner should be used over the base game one. /// [Description("Whether the built-in role assigner should be used over the base game one.")] - public bool UseDefaultRoleAssigner { get; set; } + public bool UseDefaultRoleAssigner { get; set; } = true; + + /// + /// Gets or sets a value indicating whether the built-in respawn manager should be used over the base game one. + /// + [Description("Whether the built-in respawn manager should be used over the base game one.")] + public bool UseDefaultRespawnManager { get; set; } = true; + + /// + /// Gets or sets a value indicating whether the automatic modules loader should be used. + /// + /// It iterates over all existing plugins trying to enable all the modules for each plugin's assembly. + ///
+ /// It negatively affects the performance in case of the presence of a big amount of plugins. + ///
+ [Description("Whether the automatic modules loader should be used")] + public bool UseAutomaticModulesLoader { get; set; } } } \ No newline at end of file diff --git a/Exiled.CustomModules/CustomModules.cs b/Exiled.CustomModules/CustomModules.cs index f0878fb582..5e6c6dda6b 100644 --- a/Exiled.CustomModules/CustomModules.cs +++ b/Exiled.CustomModules/CustomModules.cs @@ -10,7 +10,13 @@ namespace Exiled.CustomModules using Exiled.API.Features; using Exiled.API.Features.Core; using Exiled.API.Features.Core.Generic; + using Exiled.API.Interfaces; using Exiled.CustomModules.API.Features; + using Exiled.CustomModules.API.Features.CustomAbilities; + using Exiled.CustomModules.API.Features.CustomEscapes; + using Exiled.CustomModules.API.Features.CustomGameModes; + using Exiled.CustomModules.API.Features.CustomItems; + using Exiled.CustomModules.API.Features.CustomRoles; using Exiled.CustomModules.EventHandlers; /// @@ -38,9 +44,25 @@ public override void OnEnabled() { Instance = this; + if (Config.UseAutomaticModulesLoader) + { + foreach (IPlugin plugin in Loader.Loader.Plugins) + { + CustomItem.EnableAll(plugin.Assembly); + CustomRole.EnableAll(plugin.Assembly); + CustomAbility.EnableAll(plugin.Assembly); + CustomTeam.EnableAll(plugin.Assembly); + CustomEscape.EnableAll(plugin.Assembly); + CustomGameMode.EnableAll(plugin.Assembly); + } + } + if (Config.UseDefaultRoleAssigner) StaticActor.CreateNewInstance(); + if (Config.UseDefaultRespawnManager) + StaticActor.CreateNewInstance(); + SubscribeEvents(); base.OnEnabled(); @@ -50,6 +72,14 @@ public override void OnEnabled() public override void OnDisabled() { StaticActor.Get()?.Destroy(); + StaticActor.Get()?.Destroy(); + + CustomItem.DisableAll(); + CustomRole.DisableAll(); + CustomAbility.DisableAll(); + CustomTeam.DisableAll(); + CustomEscape.DisableAll(); + CustomGameMode.DisableAll(); UnsubscribeEvents(); From d754c0da231f21e91d850f08627ae98ddf51d18c Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Fri, 2 Feb 2024 05:45:16 +0100 Subject: [PATCH 072/141] The `RespawnManager` now supports partial custom teams. Tickets are now fully supported. Fixed an issue with the NTF Captain being treated and discarded like all default roles. Custom teams are now regulated by both custom and base `RespawnManager`s. Legacy teams, or base game ones, will consume base game tickets, as well as partial custom teams, or dependent custom teams. Full custom teams, or independent custom teams, will consume their own tickets. Added `CustomTeam::NextSequenceTime`, `CustomTeam::MinNextSequenceTime` and `CustomTeam::MaxNextSequenceTime`properties. Changed `IEnumerable CustomTeam::Units` to `IEnumerable CustomTeam::Units`. Added a new overload to `CustomTeam::Get` method. --- .../API/Features/CustomRoles/CustomTeam.cs | 93 ++++++++------ .../API/Features/RespawnManager.cs | 113 +++++++++++++++++- .../API/Features/RoleAssigner.cs | 1 - 3 files changed, 167 insertions(+), 40 deletions(-) diff --git a/Exiled.CustomModules/API/Features/CustomRoles/CustomTeam.cs b/Exiled.CustomModules/API/Features/CustomRoles/CustomTeam.cs index 54b9f5f518..362dd94940 100644 --- a/Exiled.CustomModules/API/Features/CustomRoles/CustomTeam.cs +++ b/Exiled.CustomModules/API/Features/CustomRoles/CustomTeam.cs @@ -16,6 +16,7 @@ namespace Exiled.CustomModules.API.Features.CustomRoles using Exiled.API.Features; using Exiled.API.Features.Core; using Exiled.CustomModules.API.Features.Attributes; + using HarmonyLib; using PlayerRoles; using Respawning; using Respawning.NamingRules; @@ -95,13 +96,30 @@ public abstract class CustomTeam : CustomModule public virtual int Size { get; } /// - /// Gets or sets a collection of instances representing all custom role types offered as units. + /// Gets or sets a collection of ids representing all custom roles offered as units. /// /// - /// This property provides access to a curated collection of objects, encapsulating all available custom role types within the context of units. + /// This property provides access to a curated collection of objects, encapsulating all available custom role within the context of units. ///
The collection is designed to be both queried and modified as needed to accommodate dynamic scenarios within the game architecture. ///
- public virtual IEnumerable Units { get; protected set; } = new Type[] { }; + public virtual IEnumerable Units { get; protected set; } = new uint[] { }; + + /// + /// Gets the amount of time after which any team will be allowed to spawn. + /// + public virtual float NextSequenceTime => UnityEngine.Random.Range( + GameCore.ConfigFile.ServerConfig.GetFloat("minimum_MTF_time_to_spawn", MinNextSequenceTime), + GameCore.ConfigFile.ServerConfig.GetFloat("maximum_MTF_time_to_spawn", MaxNextSequenceTime)); + + /// + /// Gets or sets the minimum amount time after which any team will be allowed to spawn. + /// + public virtual float MinNextSequenceTime { get; set; } = 280f; + + /// + /// Gets or sets the maximum amount time after which any team will be spawned. + /// + public virtual float MaxNextSequenceTime { get; set; } = 350f; /// /// Gets the relative spawn probability of the . @@ -148,18 +166,7 @@ public virtual bool EvaluateConditions { foreach (Pawn pawn in list) { - if ((!pawn.HasCustomRole || pawn.CustomRole.TeamOwnership != RequiredTeamToSpawn) && pawn.Role.Team != RequiredTeamToSpawn) - continue; - - return true; - } - } - - if (RequiredCustomTeamToSpawn > 0) - { - foreach (Pawn pawn in list) - { - if (!pawn.HasCustomRole || !pawn.CustomRole.IsTeamUnit || pawn.CustomRole.TeamOwnership != RequiredTeamToSpawn) + if ((!pawn.HasCustomRole || !pawn.CustomRole.TeamsOwnership.Contains(RequiredTeamToSpawn)) && pawn.Role.Team != RequiredTeamToSpawn) continue; return true; @@ -181,18 +188,8 @@ public virtual bool EvaluateConditions } } - if (RequiredCustomRoleToSpawn > 0) - { - foreach (Pawn pawn in list) - { - if (!pawn.HasCustomRole || pawn.CustomRole != RequiredCustomRoleToSpawn) - continue; - - return true; - } - } - - return false; + return (RequiredCustomTeamToSpawn > 0 && CustomTeam.TryGet(RequiredCustomTeamToSpawn, out CustomTeam team) && !team.Owners.IsEmpty()) || + (RequiredCustomRoleToSpawn > 0 && CustomRole.TryGet(RequiredCustomRoleToSpawn, out CustomRole role) && !role.Owners.IsEmpty()); } } @@ -205,20 +202,20 @@ public virtual bool EvaluateConditions public virtual Team RequiredTeamToSpawn => Team.Dead; /// - /// Gets the required custom team that players must belong to in order to allow the to spawn. + /// Gets the required that players must have to allow the to spawn. /// /// - /// This property specifies the required alive custom team to be eligible for spawning in the . + /// This property specifies the required role type for players to be eligible for spawning in the . /// - public virtual uint RequiredCustomTeamToSpawn { get; } + public virtual RoleTypeId RequiredRoleToSpawn => RoleTypeId.None; /// - /// Gets the required that players must have to allow the to spawn. + /// Gets the required custom team that players must belong to in order to allow the to spawn. /// /// - /// This property specifies the required role type for players to be eligible for spawning in the . + /// This property specifies the required alive custom team to be eligible for spawning in the . /// - public virtual RoleTypeId RequiredRoleToSpawn => RoleTypeId.None; + public virtual uint RequiredCustomTeamToSpawn { get; } /// /// Gets the required that players must have to allow the to spawn. @@ -232,7 +229,7 @@ public virtual bool EvaluateConditions /// Gets the required leading teams for this to win. /// /// - /// This property specifies the teams that the must surpass to achieve victory. + /// This property specifies the teams the belongs to. /// public virtual Team[] TeamsOwnership { get; } = { }; @@ -395,7 +392,7 @@ public static bool TrySpawn(int amount, CustomTeam customTeam) /// if the was successfully spawned; otherwise, . public static bool TrySpawn(int amount, uint id) { - if (TryGet(id, out CustomTeam customTeam)) + if (!TryGet(id, out CustomTeam customTeam)) return false; customTeam.Respawn(amount); @@ -406,10 +403,17 @@ public static bool TrySpawn(int amount, uint id) /// Enables all the custom teams present in the assembly. /// /// A of which contains all the enabled custom teams. - public static IEnumerable EnableAll() + public static IEnumerable EnableAll() => EnableAll(Assembly.GetCallingAssembly()); + + /// + /// Enables all the custom teams present in the assembly. + /// + /// The assembly to enable the teams from. + /// A of which contains all the enabled custom teams. + public static IEnumerable EnableAll(Assembly assembly) { List customTeams = new(); - foreach (Type type in Assembly.GetCallingAssembly().GetTypes()) + foreach (Type type in assembly.GetTypes()) { CustomTeamAttribute attribute = type.GetCustomAttribute(); if (type.BaseType != typeof(CustomTeam) || attribute is null) @@ -444,6 +448,13 @@ public static IEnumerable DisableAll() return customTeams; } + /// + /// Gets all instances based on the predicate. + /// + /// The predicate. + /// All instances matching the predicate. + public static IEnumerable Get(Func predicate) => List.Where(predicate); + /// /// Gets a instance based on the specified id. /// @@ -635,7 +646,10 @@ public void Respawn(IEnumerable players, bool keepSize = true) public void RemoveTickets(uint amount) { if (tickets < amount) + { + tickets = 0; return; + } tickets -= amount; } @@ -660,7 +674,10 @@ internal bool TryRegister(CustomTeamAttribute attribute = null) } if (attribute.Types is not null && !attribute.Types.IsEmpty()) - Units = Units.Concat(attribute.Types); + { + foreach (Type t in attribute.Types) + Units.AddItem(CustomRole.Get(t).Id); + } } CustomTeam duplicate = Registered.FirstOrDefault(x => x.Id == Id || x.Name == Name); diff --git a/Exiled.CustomModules/API/Features/RespawnManager.cs b/Exiled.CustomModules/API/Features/RespawnManager.cs index 45e2d84d23..1da229fad5 100644 --- a/Exiled.CustomModules/API/Features/RespawnManager.cs +++ b/Exiled.CustomModules/API/Features/RespawnManager.cs @@ -15,9 +15,11 @@ namespace Exiled.CustomModules.API.Features using Exiled.API.Features; using Exiled.API.Features.Attributes; using Exiled.API.Features.Core; + using Exiled.API.Features.Core.Generic.Pools; using Exiled.API.Features.DynamicEvents; using Exiled.API.Features.Items; using Exiled.API.Features.Pickups; + using Exiled.CustomModules.API.Enums; using Exiled.CustomModules.API.Features.CustomRoles; using Exiled.CustomModules.API.Interfaces; using Exiled.CustomModules.Events.EventArgs.CustomItems; @@ -64,6 +66,21 @@ public object NextKnownTeam } } + /// + /// Gets or sets the previous spawned team. + /// + public object PreviousKnownTeam { get; protected set; } + + /// + /// Gets all teams' tickets. + /// + public Dictionary> AllTickets { get; } = new(); + + /// + /// Gets all enqueued roles. + /// + public List EnqueuedRoles { get; } + /// /// Forces the spawn of a wave of the specified team. /// @@ -92,14 +109,31 @@ public void Spawn() CustomTeam.TrySpawn(toSpawn.Cast(), team); } + /// + protected override void PostInitialize_Static() + { + foreach (CustomTeam team in CustomTeam.Get(t => t.UseTickets)) + AllTickets[team.Id] = () => team.Tickets; + } + + /// + protected override void EndPlay_Static() + { + AllTickets.Clear(); + EnqueuedRoles.Clear(); + } + /// protected override void SubscribeEvents() { base.SubscribeEvents(); + Exiled.Events.Handlers.Server.RestartedRespawnSequence += OnRestartedRespawnSequence; Exiled.Events.Handlers.Server.SelectingRespawnTeam += OnSelectingRespawnTeam; Exiled.Events.Handlers.Server.PreRespawningTeam += OnPreRespawningTeam; + Exiled.Events.Handlers.Server.RespawningTeam += OnRespawningTeam; Exiled.Events.Handlers.Server.DeployingTeamRole += OnDeployingTeamRole; + Exiled.Events.Handlers.Server.RespawnedTeam += OnRespawnedTeam; } /// @@ -107,28 +141,49 @@ protected override void UnsubscribeEvents() { base.UnsubscribeEvents(); + Exiled.Events.Handlers.Server.RestartedRespawnSequence -= OnRestartedRespawnSequence; Exiled.Events.Handlers.Server.SelectingRespawnTeam -= OnSelectingRespawnTeam; Exiled.Events.Handlers.Server.PreRespawningTeam -= OnPreRespawningTeam; + Exiled.Events.Handlers.Server.RespawningTeam -= OnRespawningTeam; Exiled.Events.Handlers.Server.DeployingTeamRole -= OnDeployingTeamRole; + Exiled.Events.Handlers.Server.RespawnedTeam -= OnRespawnedTeam; + } + + private void OnRestartedRespawnSequence(RestartedRespawnSequenceEventArgs ev) + { + if (PreviousKnownTeam is not uint id || !CustomTeam.TryGet(id, out CustomTeam team)) + return; + + ev.TimeForNextSequence = team.NextSequenceTime; } private void OnSelectingRespawnTeam(SelectingRespawnTeamEventArgs ev) { + NextKnownTeam = null; foreach (CustomTeam team in CustomTeam.List) { if (!team.EvaluateConditions || !team.CanSpawnByProbability) continue; NextKnownTeam = team.Id; + return; } + + if (NextKnownTeam is null) + NextKnownTeam = ev.Team; } private void OnPreRespawningTeam(PreRespawningTeamEventArgs ev) { + PreviousKnownTeam = NextKnownTeam; + if (NextKnownTeam is not SpawnableTeamType team) { CustomTeam customTeam = CustomTeam.Get((uint)NextKnownTeam); + if (!customTeam) + return; + if (customTeam.TeamsOwnership.Any(t => t == (ev.NextKnownTeam is SpawnableTeamType.ChaosInsurgency ? Team.ChaosInsurgency : Team.FoundationForces))) { ev.MaxWaveSize = customTeam.Size; @@ -137,16 +192,72 @@ private void OnPreRespawningTeam(PreRespawningTeamEventArgs ev) ev.IsAllowed = false; Spawn(); + Respawning.RespawnManager.Singleton.RestartSequence(); return; } } + private void OnRespawningTeam(RespawningTeamEventArgs ev) + { + if (NextKnownTeam is not SpawnableTeamType team) + return; + + foreach (CustomRole customRole in CustomRole.List) + { + if (!customRole.IsTeamUnit || customRole.AssignFromTeam != team || !customRole.EvaluateConditions) + continue; + + for (int i = customRole.Instances; i <= customRole.Instances; i++) + { + if (!customRole.CanSpawnByProbability) + continue; + + EnqueuedRoles.Add(customRole.Id); + } + } + + EnqueuedRoles.AddRange(ev.SpawnQueue.Cast()); + + object captain = EnqueuedRoles.FirstOrDefault(role => role is RoleTypeId rId && rId is RoleTypeId.NtfCaptain); + + if (captain is not null) + EnqueuedRoles.Remove(captain); + + EnqueuedRoles.RemoveRange(ev.SpawnQueue.Count - 1, EnqueuedRoles.Count - ev.SpawnQueue.Count); + + if (captain is not null) + { + EnqueuedRoles.Add(captain); + captain = null; + } + } + private void OnDeployingTeamRole(DeployingTeamRoleEventArgs ev) { if (NextKnownTeam is SpawnableTeamType team) - return; + { + object role = EnqueuedRoles.Random(); + + if (role is not uint) + { + EnqueuedRoles.Remove(role); + return; + } + + ev.Delegate = () => + { + CustomRole customRole = CustomRole.Get((uint)role); + CustomRole.TrySpawn(ev.Player.Cast(), customRole); + EnqueuedRoles.Remove(role); + }; + } ev.Delegate = () => CustomTeam.TrySpawn(ev.Player.Cast(), (uint)NextKnownTeam); } + + private void OnRespawnedTeam(RespawnedTeamEventArgs ev) + { + EnqueuedRoles.Clear(); + } } } \ No newline at end of file diff --git a/Exiled.CustomModules/API/Features/RoleAssigner.cs b/Exiled.CustomModules/API/Features/RoleAssigner.cs index 0fdcae8cba..a5c901850f 100644 --- a/Exiled.CustomModules/API/Features/RoleAssigner.cs +++ b/Exiled.CustomModules/API/Features/RoleAssigner.cs @@ -157,7 +157,6 @@ public virtual void SpawnScps(int targetScpNumber) } } - int index = 0; List chosenPlayers = ScpPlayerPicker.ChoosePlayers(targetScpNumber); if (spawnable.Count < targetScpNumber) From 9ff02157889035e17081891912cbb229f5a8f8df Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Fri, 2 Feb 2024 05:46:51 +0100 Subject: [PATCH 073/141] Fixed custom team tickets being ignored durign the selection of the next known team. --- Exiled.CustomModules/API/Features/RespawnManager.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Exiled.CustomModules/API/Features/RespawnManager.cs b/Exiled.CustomModules/API/Features/RespawnManager.cs index 1da229fad5..aea799bc16 100644 --- a/Exiled.CustomModules/API/Features/RespawnManager.cs +++ b/Exiled.CustomModules/API/Features/RespawnManager.cs @@ -162,7 +162,7 @@ private void OnSelectingRespawnTeam(SelectingRespawnTeamEventArgs ev) NextKnownTeam = null; foreach (CustomTeam team in CustomTeam.List) { - if (!team.EvaluateConditions || !team.CanSpawnByProbability) + if ((team.UseTickets && team.Tickets <= 0) || !team.EvaluateConditions || !team.CanSpawnByProbability) continue; NextKnownTeam = team.Id; From 476c5b9857c30b4ad123532e30acfb48a1db4c6e Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Fri, 2 Feb 2024 05:49:03 +0100 Subject: [PATCH 074/141] Use built-in `Pawn` functions --- Exiled.CustomModules/API/Features/RespawnManager.cs | 2 +- Exiled.CustomModules/API/Features/RoleAssigner.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Exiled.CustomModules/API/Features/RespawnManager.cs b/Exiled.CustomModules/API/Features/RespawnManager.cs index aea799bc16..fb11ac7ba2 100644 --- a/Exiled.CustomModules/API/Features/RespawnManager.cs +++ b/Exiled.CustomModules/API/Features/RespawnManager.cs @@ -247,7 +247,7 @@ private void OnDeployingTeamRole(DeployingTeamRoleEventArgs ev) ev.Delegate = () => { CustomRole customRole = CustomRole.Get((uint)role); - CustomRole.TrySpawn(ev.Player.Cast(), customRole); + ev.Player.Cast().SetRole(customRole); EnqueuedRoles.Remove(role); }; } diff --git a/Exiled.CustomModules/API/Features/RoleAssigner.cs b/Exiled.CustomModules/API/Features/RoleAssigner.cs index a5c901850f..0e4e38ea6d 100644 --- a/Exiled.CustomModules/API/Features/RoleAssigner.cs +++ b/Exiled.CustomModules/API/Features/RoleAssigner.cs @@ -209,7 +209,7 @@ public virtual void DistributeOrEnqueue(List players, IEnumerable< continue; ReferenceHub target = players[0]; - CustomRole.TrySpawn(Player.Get(target).Cast(), role); + Player.Get(target).Cast().SetRole(role); players.RemoveAt(0); ++spawned; } @@ -219,7 +219,7 @@ public virtual void DistributeOrEnqueue(List players, IEnumerable< for (int i = spawned; i == roles.Count(); i++) { ReferenceHub target = players[0]; - CustomRole.TrySpawn(Player.Get(target).Cast(), FindAvailableRole(predicate)); + Player.Get(target).Cast().SetRole(FindAvailableRole(predicate)); players.RemoveAt(0); } } From 643e4ce3de234985249f551d9b38372351f418a4 Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Fri, 2 Feb 2024 05:59:23 +0100 Subject: [PATCH 075/141] Renamed `CustomTeam::TrySpawn` to `CustomTeam::TryRespawn`, regarding overloads accepting `CustomTeam` as parameter. Added `bool isForced` parameter to all `Respawn`-related methods. --- .../API/Features/CustomRoles/CustomTeam.cs | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/Exiled.CustomModules/API/Features/CustomRoles/CustomTeam.cs b/Exiled.CustomModules/API/Features/CustomRoles/CustomTeam.cs index 362dd94940..4c90bb3c02 100644 --- a/Exiled.CustomModules/API/Features/CustomRoles/CustomTeam.cs +++ b/Exiled.CustomModules/API/Features/CustomRoles/CustomTeam.cs @@ -285,8 +285,9 @@ public virtual bool EvaluateConditions /// Tries to spawn the specified . /// /// The to be spawned. + /// Forces the respawn wave regardless any conditions, including tickets. /// if the was successfully spawned; otherwise, . - public static bool TrySpawn(CustomTeam customTeam) + public static bool TryRespawn(CustomTeam customTeam, bool isForced = false) { if (!Player.Get(p => p.IsDead).Any() || customTeam is null) return false; @@ -299,8 +300,9 @@ public static bool TrySpawn(CustomTeam customTeam) /// Tries to spawn a given the specified id. /// /// The specified id. + /// Forces the respawn wave regardless any conditions, including tickets. /// if the was successfully spawned; otherwise, . - public static bool TrySpawn(uint id) + public static bool TryRespawn(uint id, bool isForced = false) { if (!Player.Get(p => p.IsDead).Any() || TryGet(id, out CustomTeam customTeam)) return false; @@ -314,8 +316,9 @@ public static bool TrySpawn(uint id) /// /// The to be spawned. /// The unit to be assigned. + /// Forces the respawn wave regardless any conditions, including tickets. /// if the player was successfully spawned; otherwise, . - public static bool TrySpawn(Pawn player, CustomTeam customTeam) + public static bool TrySpawn(Pawn player, CustomTeam customTeam, bool isForced = false) { if (customTeam is null) return false; @@ -555,6 +558,7 @@ public bool Eject(Pawn player) /// Forces a respawn wave by spawning the specified amount of units. /// /// The number of units to be spawned. + /// Forces the respawn wave regardless any conditions, including tickets. /// /// If the provided is less than or equal to zero, no respawn action is taken. /// @@ -564,8 +568,11 @@ public bool Eject(Pawn player) /// Additionally, if the respawn team is of type and a valid is available using , a new unit naming message is sent for NineTailedFox units. /// /// - public void Respawn(int amount) + public void Respawn(int amount, bool isForced = false) { + if ((UseTickets && tickets <= 0) && !isForced) + return; + IEnumerable players = Player.Get(Team.Dead).Take(amount).Cast(); if (players.IsEmpty()) @@ -582,6 +589,7 @@ public void Respawn(int amount) /// /// The collection of players to be spawned. /// A value indicating whether the team size should remain the same as the specified collection. + /// Forces the respawn wave regardless any conditions, including tickets. /// /// If the provided collection of is null or empty, no respawn action is taken. /// @@ -594,9 +602,9 @@ public void Respawn(int amount) /// Additionally, if the respawn team is of type and a valid is available using , a new unit naming message is sent for NineTailedFox units. /// /// - public void Respawn(IEnumerable players, bool keepSize = true) + public void Respawn(IEnumerable players, bool keepSize = true, bool isForced = false) { - if (players is null || players.IsEmpty()) + if (((UseTickets && tickets <= 0) && !isForced) || players is null || players.IsEmpty()) return; if (UseTickets && tickets > 0) @@ -622,10 +630,11 @@ public void Respawn(IEnumerable players, bool keepSize = true) /// /// Forces a respawn wave, spawning players up to the specified team size. /// + /// Forces the respawn wave regardless any conditions, including tickets. /// /// This method triggers a respawn wave, spawning players up to the current team size limit. /// - public void Respawn() => Respawn(Size); + public void Respawn(bool isForced = false) => Respawn(Size, isForced); /// /// Adds respawn tickets to the current instance. From 3497c208adb4190c2647ce160638718dedefeb7c Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Sat, 3 Feb 2024 00:36:46 +0100 Subject: [PATCH 076/141] Fixed invalid cast exceptions and a few warnings --- Exiled.API/Features/Player.cs | 13 ++--- .../Features/Inventory/IInventorySettings.cs | 5 ++ .../Features/Inventory/InventoryManager.cs | 8 ++- Exiled.CustomModules/API/Features/Pawn.cs | 51 ++++++++++++++----- .../Server/PreRespawningTeamEventArgs.cs | 1 - 5 files changed, 53 insertions(+), 25 deletions(-) diff --git a/Exiled.API/Features/Player.cs b/Exiled.API/Features/Player.cs index be2c886111..c0c2b6feb2 100644 --- a/Exiled.API/Features/Player.cs +++ b/Exiled.API/Features/Player.cs @@ -164,7 +164,7 @@ public ReferenceHub ReferenceHub get => referenceHub; private set { - referenceHub = value ?? throw new NullReferenceException("Player's ReferenceHub cannot be null!"); + referenceHub = value ? value : throw new NullReferenceException("Player's ReferenceHub cannot be null!"); GameObject = value.gameObject; HintDisplay = value.hints; Inventory = value.inventory; @@ -981,7 +981,7 @@ public string GroupName /// /// Gets the current zone the player is in. /// - public ZoneType Zone => CurrentRoom?.Zone ?? ZoneType.Unspecified; + public ZoneType Zone => CurrentRoom ? CurrentRoom.Zone : ZoneType.Unspecified; /// /// Gets the current the player is in. Can be . @@ -1069,7 +1069,7 @@ public bool BadgeHidden /// /// Gets a value indicating whether or not the player is in the pocket dimension. /// - public bool IsInPocketDimension => CurrentRoom?.Type is RoomType.Pocket; + public bool IsInPocketDimension => CurrentRoom && CurrentRoom.Type is RoomType.Pocket; /// /// Gets or sets a value indicating whether or not the player should use stamina system. @@ -1978,12 +1978,7 @@ public bool RemoveItem(Item item, bool destroy = true) /// The serial to remove. /// Whether or not to destroy the item. /// A value indicating whether or not the was removed. - public bool RemoveItem(ushort serial, bool destroy = true) - { - if (Items.SingleOrDefault(item => item.Serial == serial) is not Item item) - return false; - return RemoveItem(item, destroy); - } + public bool RemoveItem(ushort serial, bool destroy = true) => Items.SingleOrDefault(item => item.Serial == serial) is Item item && RemoveItem(item, destroy); /// /// Removes an from the player's inventory. diff --git a/Exiled.CustomModules/API/Features/Inventory/IInventorySettings.cs b/Exiled.CustomModules/API/Features/Inventory/IInventorySettings.cs index 6ea61753aa..4d2f1b263c 100644 --- a/Exiled.CustomModules/API/Features/Inventory/IInventorySettings.cs +++ b/Exiled.CustomModules/API/Features/Inventory/IInventorySettings.cs @@ -30,5 +30,10 @@ public interface IInventorySettings /// Gets or sets the ammo box settings to be applied. /// public abstract Dictionary AmmoBox { get; set; } + + /// + /// Gets or sets the custom ammo box settings to be applied. + /// + public abstract Dictionary CustomAmmoBox { get; set; } } } \ No newline at end of file diff --git a/Exiled.CustomModules/API/Features/Inventory/InventoryManager.cs b/Exiled.CustomModules/API/Features/Inventory/InventoryManager.cs index fd63c0ad3d..5af8df102a 100644 --- a/Exiled.CustomModules/API/Features/Inventory/InventoryManager.cs +++ b/Exiled.CustomModules/API/Features/Inventory/InventoryManager.cs @@ -29,14 +29,17 @@ public InventoryManager() /// The list of items to be given. /// The list of custom items to be given. /// The ammo box settings to be applied. + /// The custom ammo box settings to be applied. public InventoryManager( List inventory, List customItems, - Dictionary ammoBox) + Dictionary ammoBox, + Dictionary customAmmoBox) { Items = inventory; CustomItems = customItems; AmmoBox = ammoBox; + CustomAmmoBox = customAmmoBox; } /// @@ -48,6 +51,9 @@ public InventoryManager( /// public Dictionary AmmoBox { get; set; } = new(); + /// + public Dictionary CustomAmmoBox { get; set; } = new(); + /// /// Gets or sets the probability associated with this inventory slot. ///
Useful for inventory tweaks involving one or more probability values.
diff --git a/Exiled.CustomModules/API/Features/Pawn.cs b/Exiled.CustomModules/API/Features/Pawn.cs index 0a1704d8d1..4f1c23517e 100644 --- a/Exiled.CustomModules/API/Features/Pawn.cs +++ b/Exiled.CustomModules/API/Features/Pawn.cs @@ -304,24 +304,39 @@ public bool TryGetCustomAbility(out T customAbility) where T : PlayerAbility => CustomAbilities.FirstOrDefault(ability => ability.GetType() == typeof(T)).Is(out customAbility); /// - /// Add a of the specified type to the pawn's inventory. + /// Add an or of the specified type to the pawn's inventory. /// - /// The item to be added. + /// The item to be added. /// if the item has been given to the pawn; otherwise, . - public bool AddItem(object customItem) + public bool AddItem(object item) { if (IsInventoryFull) return false; - try - { - uint value = (uint)customItem; - CustomItem.TryGive(this, value); - return true; - } - catch + switch (item) { - return customItem is CustomItem instance && CustomItem.TryGive(this, instance.Id); + case Item baseItem: + AddItem(baseItem); + return true; + case ItemType itemType: + AddItem(itemType); + return true; + case string name: + CustomItem.TryGive(this, name); + return true; + case CustomItem instance when CustomItem.TryGive(this, instance.Id): + return true; + default: + try + { + uint value = (uint)item; + CustomItem.TryGive(this, value); + return true; + } + catch + { + throw new ArgumentException("Item is not of a supported type."); + } } } @@ -354,14 +369,22 @@ public void SetRole(object role, bool preservePlayerPosition = false) if (role is uint id) CustomRole.Spawn(this, id, preservePlayerPosition); - throw new ArgumentException("The type of the role instance is not compatible with RoleTypeId or uint."); + try + { + uint uuId = (uint)role; + CustomRole.Spawn(this, uuId, preservePlayerPosition); + } + catch + { + throw new ArgumentException("The type of the role instance is not compatible with RoleTypeId or uint."); + } } /// /// Safely drops an item. /// /// The item to be dropped. - public void SafeDropItem(Item item) + public new void DropItem(Item item) { if (TryGetCustomItem(out CustomItem customItem)) { @@ -370,7 +393,7 @@ public void SafeDropItem(Item item) return; } - DropItem(item); + base.DropItem(item); } /// diff --git a/Exiled.Events/EventArgs/Server/PreRespawningTeamEventArgs.cs b/Exiled.Events/EventArgs/Server/PreRespawningTeamEventArgs.cs index f9383713aa..c565e98724 100644 --- a/Exiled.Events/EventArgs/Server/PreRespawningTeamEventArgs.cs +++ b/Exiled.Events/EventArgs/Server/PreRespawningTeamEventArgs.cs @@ -23,7 +23,6 @@ namespace Exiled.Events.EventArgs.Server public class PreRespawningTeamEventArgs : IDeniableEvent { private SpawnableTeamType nextKnownTeam; - private int maxWaveSize; /// /// Initializes a new instance of the class. From 94a9e13bdfea780db22a4fcf925be8564c6b05ed Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Sat, 3 Feb 2024 01:55:36 +0100 Subject: [PATCH 077/141] Added `Get(object)` and `TryGet(object, ref CustomModule)` overloads for all custom modules. --- .../API/Enums/UUCustomAbilityType.cs | 22 ++++ .../{UUCustomItem.cs => UUCustomItemType.cs} | 6 +- .../Features/CustomAbilities/CustomAbility.cs | 9 ++ .../Features/CustomEscapes/CustomEscape.cs | 107 ++++++++++-------- .../API/Features/CustomItems/CustomItem.cs | 17 +++ .../API/Features/CustomRoles/CustomRole.cs | 17 +++ .../API/Features/CustomRoles/CustomTeam.cs | 72 +++++++----- 7 files changed, 173 insertions(+), 77 deletions(-) create mode 100644 Exiled.CustomModules/API/Enums/UUCustomAbilityType.cs rename Exiled.CustomModules/API/Enums/{UUCustomItem.cs => UUCustomItemType.cs} (72%) diff --git a/Exiled.CustomModules/API/Enums/UUCustomAbilityType.cs b/Exiled.CustomModules/API/Enums/UUCustomAbilityType.cs new file mode 100644 index 0000000000..2e20a993b2 --- /dev/null +++ b/Exiled.CustomModules/API/Enums/UUCustomAbilityType.cs @@ -0,0 +1,22 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.CustomModules.API.Enums +{ + using Exiled.API.Features.Core.Generic; + + /// + /// Represents the base enum class for all available custom abilities. + /// + public class UUCustomAbilityType : UniqueUnmanagedEnumClass + { + /// + /// Represents an invalid custom ability. + /// + public static readonly UUCustomAbilityType None = new(); + } +} diff --git a/Exiled.CustomModules/API/Enums/UUCustomItem.cs b/Exiled.CustomModules/API/Enums/UUCustomItemType.cs similarity index 72% rename from Exiled.CustomModules/API/Enums/UUCustomItem.cs rename to Exiled.CustomModules/API/Enums/UUCustomItemType.cs index 6cb72112aa..49af1efb86 100644 --- a/Exiled.CustomModules/API/Enums/UUCustomItem.cs +++ b/Exiled.CustomModules/API/Enums/UUCustomItemType.cs @@ -1,5 +1,5 @@ // ----------------------------------------------------------------------- -// +// // Copyright (c) Exiled Team. All rights reserved. // Licensed under the CC BY-SA 3.0 license. // @@ -12,11 +12,11 @@ namespace Exiled.CustomModules.API.Enums /// /// Represents the base enum class for all available custom items. /// - public class UUCustomItem : UniqueUnmanagedEnumClass + public class UUCustomItemType : UniqueUnmanagedEnumClass { /// /// Represents an invalid custom item. /// - public static readonly UUCustomItem None = new(); + public static readonly UUCustomItemType None = new(); } } diff --git a/Exiled.CustomModules/API/Features/CustomAbilities/CustomAbility.cs b/Exiled.CustomModules/API/Features/CustomAbilities/CustomAbility.cs index dbed3d7189..9e6e64950d 100644 --- a/Exiled.CustomModules/API/Features/CustomAbilities/CustomAbility.cs +++ b/Exiled.CustomModules/API/Features/CustomAbilities/CustomAbility.cs @@ -5,6 +5,8 @@ // // ----------------------------------------------------------------------- +using Exiled.CustomModules.API.Enums; + namespace Exiled.CustomModules.API.Features.CustomAbilities { using System; @@ -142,6 +144,13 @@ public abstract class CustomAbility : CustomModule, ICustomAbility /// protected Type ReflectedGenericType => reflectedGenericType ??= GetType().GetGenericArguments()[0]; + /// + /// Gets a based on the provided id or . + /// + /// The id or of the custom ability. + /// The with the specified id, or if no ability is found. + public static CustomAbility Get(object id) => id is uint or UUCustomAbilityType ? Get((uint)id) : null; + /// /// Gets a given the specified id. /// diff --git a/Exiled.CustomModules/API/Features/CustomEscapes/CustomEscape.cs b/Exiled.CustomModules/API/Features/CustomEscapes/CustomEscape.cs index 145d0f8da1..b1ba66f78c 100644 --- a/Exiled.CustomModules/API/Features/CustomEscapes/CustomEscape.cs +++ b/Exiled.CustomModules/API/Features/CustomEscapes/CustomEscape.cs @@ -87,53 +87,11 @@ public abstract class CustomEscape : CustomModule, IAdditiveBehaviour public virtual List Settings { get; } = new() { EscapeSettings.Default, }; /// - /// Enables all the custom escapes present in the assembly. - /// - /// A of containing all enabled custom escapes. - public static List EnableAll() => EnableAll(Assembly.GetCallingAssembly()); - - /// - /// Enables all the custom escapes present in the assembly. - /// - /// The assembly to enable the escapes from. - /// A of containing all enabled custom escapes. - public static List EnableAll(Assembly assembly) - { - List customEscapes = new(); - foreach (Type type in assembly.GetTypes()) - { - CustomEscapeAttribute attribute = type.GetCustomAttribute(); - if (!typeof(CustomEscape).IsAssignableFrom(type) || attribute is null) - continue; - - CustomEscape customEscape = Activator.CreateInstance(type) as CustomEscape; - - if (!customEscape.IsEnabled) - continue; - - if (customEscape.TryRegister(attribute)) - customEscapes.Add(customEscape); - } - - if (customEscapes.Count() != List.Count()) - Log.Info($"{customEscapes.Count()} custom escapes have been successfully registered!"); - - return customEscapes; - } - - /// - /// Disables all the custom escapes present in the assembly. + /// Gets a based on the provided id or . /// - /// A of containing all disabled custom escapes. - public static List DisableAll() - { - List customEscapes = new(); - customEscapes.AddRange(List.Where(customEscape => customEscape.TryUnregister())); - - Log.Info($"{customEscapes.Count()} custom escapes have been successfully unregistered!"); - - return customEscapes; - } + /// The id or of the custom escape. + /// The with the specified id, or if no escape is found. + public static CustomEscape Get(object id) => id is uint or UUCustomEscapeType ? Get((uint)id) : null; /// /// Gets a given the specified . @@ -172,6 +130,14 @@ public static CustomEscape Get(Type type) => /// The matching the search or if not registered. public static CustomEscape Get(Player player) => PlayersValue.TryGetValue(player, out CustomEscape customEscape) ? customEscape : default; + /// + /// Attempts to retrieve a based on the provided id or . + /// + /// The id or of the custom escape. + /// When this method returns, contains the associated with the specified id, if the id was found; otherwise, . + /// if a was found; otherwise, . + public static bool TryGet(object id, out CustomEscape customEscape) => customEscape = Get(id); + /// /// Tries to get a given the specified . /// @@ -204,6 +170,55 @@ public static CustomEscape Get(Type type) => /// if a was found; otherwise, . public static bool TryGet(Type type, out CustomEscape customEscape) => customEscape = Get(type.GetType()); + /// + /// Enables all the custom escapes present in the assembly. + /// + /// A of containing all enabled custom escapes. + public static List EnableAll() => EnableAll(Assembly.GetCallingAssembly()); + + /// + /// Enables all the custom escapes present in the assembly. + /// + /// The assembly to enable the escapes from. + /// A of containing all enabled custom escapes. + public static List EnableAll(Assembly assembly) + { + List customEscapes = new(); + foreach (Type type in assembly.GetTypes()) + { + CustomEscapeAttribute attribute = type.GetCustomAttribute(); + if (!typeof(CustomEscape).IsAssignableFrom(type) || attribute is null) + continue; + + CustomEscape customEscape = Activator.CreateInstance(type) as CustomEscape; + + if (!customEscape.IsEnabled) + continue; + + if (customEscape.TryRegister(attribute)) + customEscapes.Add(customEscape); + } + + if (customEscapes.Count() != List.Count()) + Log.Info($"{customEscapes.Count()} custom escapes have been successfully registered!"); + + return customEscapes; + } + + /// + /// Disables all the custom escapes present in the assembly. + /// + /// A of containing all disabled custom escapes. + public static List DisableAll() + { + List customEscapes = new(); + customEscapes.AddRange(List.Where(customEscape => customEscape.TryUnregister())); + + Log.Info($"{customEscapes.Count()} custom escapes have been successfully unregistered!"); + + return customEscapes; + } + /// /// Attaches a with the specified to the specified . /// diff --git a/Exiled.CustomModules/API/Features/CustomItems/CustomItem.cs b/Exiled.CustomModules/API/Features/CustomItems/CustomItem.cs index dbe0d9eab8..780916b230 100644 --- a/Exiled.CustomModules/API/Features/CustomItems/CustomItem.cs +++ b/Exiled.CustomModules/API/Features/CustomItems/CustomItem.cs @@ -5,6 +5,8 @@ // // ----------------------------------------------------------------------- +using Exiled.CustomModules.API.Enums; + namespace Exiled.CustomModules.API.Features.CustomItems { using System; @@ -126,6 +128,13 @@ public abstract class CustomItem : CustomModule, IAdditiveBehaviour /// public IEnumerable Items => ItemsValue.Where(x => x.Value.Id == Id).Select(x => x.Key); + /// + /// Gets a based on the provided id or . + /// + /// The id or of the custom item. + /// The with the specified id, or if no item is found. + public static CustomItem Get(object id) => id is uint or UUCustomItemType ? Get((uint)id) : null; + /// /// Retrieves a instance based on the specified custom item id. /// @@ -189,6 +198,14 @@ public static CustomItem Get(Pickup item) return customItem; } + /// + /// Attempts to retrieve a based on the provided id or . + /// + /// The id or of the custom item. + /// When this method returns, contains the associated with the specified id, if the id was found; otherwise, . + /// if a was found; otherwise, . + public static bool TryGet(object id, out CustomItem customItem) => customItem = Get(id); + /// /// Tries to retrieve a instance based on the specified custom item id. /// diff --git a/Exiled.CustomModules/API/Features/CustomRoles/CustomRole.cs b/Exiled.CustomModules/API/Features/CustomRoles/CustomRole.cs index 460ed0596d..f6fea56346 100644 --- a/Exiled.CustomModules/API/Features/CustomRoles/CustomRole.cs +++ b/Exiled.CustomModules/API/Features/CustomRoles/CustomRole.cs @@ -17,6 +17,7 @@ namespace Exiled.CustomModules.API.Features.CustomRoles using Exiled.API.Features; using Exiled.API.Features.Core; using Exiled.API.Features.Core.Interfaces; + using Exiled.CustomModules.API.Enums; using Exiled.CustomModules.API.Features.Attributes; using Exiled.CustomModules.API.Features.CustomEscapes; using MEC; @@ -238,6 +239,13 @@ public virtual bool EvaluateConditions /// public IEnumerable Owners => Player.Get(x => TryGet(x.Cast(), out CustomRole customRole) && customRole.Id == Id).Cast(); + /// + /// Gets a based on the provided id or . + /// + /// The id or of the custom role. + /// The with the specified id, or if no role is found. + public static CustomRole Get(object id) => id is uint or UUCustomRoleType ? Get((uint)id) : null; + /// /// Gets a given the specified id. /// @@ -319,6 +327,15 @@ public static CustomRole Get() /// The matching the search or if not registered. public static CustomRole Get(Pawn player) => PlayersValue.TryGetValue(player, out CustomRole customRole) ? customRole : default; + + /// + /// Attempts to retrieve a based on the provided id or . + /// + /// The id or of the custom role. + /// When this method returns, contains the associated with the specified id, if the id was found; otherwise, . + /// if a was found; otherwise, . + public static bool TryGet(object id, out CustomRole customRole) => customRole = Get(id); + /// /// Tries to get a given the specified id. /// diff --git a/Exiled.CustomModules/API/Features/CustomRoles/CustomTeam.cs b/Exiled.CustomModules/API/Features/CustomRoles/CustomTeam.cs index 4c90bb3c02..7ab00efd10 100644 --- a/Exiled.CustomModules/API/Features/CustomRoles/CustomTeam.cs +++ b/Exiled.CustomModules/API/Features/CustomRoles/CustomTeam.cs @@ -15,6 +15,7 @@ namespace Exiled.CustomModules.API.Features.CustomRoles using Exiled.API.Extensions; using Exiled.API.Features; using Exiled.API.Features.Core; + using Exiled.CustomModules.API.Enums; using Exiled.CustomModules.API.Features.Attributes; using HarmonyLib; using PlayerRoles; @@ -257,6 +258,49 @@ public virtual bool EvaluateConditions /// public CustomRole RandomUnit => CustomRole.Get(Units.Random()); + /// + /// Gets all instances based on the predicate. + /// + /// The predicate. + /// All instances matching the predicate. + public static IEnumerable Get(Func predicate) => List.Where(predicate); + + /// + /// Gets a based on the provided id or . + /// + /// The id or of the custom team. + /// The with the specified id, or if no team is found. + public static CustomTeam Get(object id) => id is uint or UUCustomTeamType ? Get((uint)id) : null; + + /// + /// Gets a instance based on the specified id. + /// + /// The id to check. + /// The matching the search, or if not registered. + public static CustomTeam Get(uint id) => IdLookupTable[id]; + + /// + /// Gets a instance based on the specified name. + /// + /// The specified name. + /// The matching the search, or if not registered. + public static CustomTeam Get(string name) => NameLookupTable[name]; + + /// + /// Gets a instance associated with a specific . + /// + /// The to check. + /// The matching the search, or if not registered. + public static CustomTeam Get(Player player) => !PlayersValue.TryGetValue(player, out CustomTeam customTeam) ? null : customTeam; + + /// + /// Attempts to retrieve a based on the provided id or . + /// + /// The id or of the custom team. + /// When this method returns, contains the associated with the specified id, if the id was found; otherwise, . + /// if a was found; otherwise, . + public static bool TryGet(object id, out CustomTeam customTeam) => customTeam = Get(id); + /// /// Tries to get a given the specified id. /// @@ -451,34 +495,6 @@ public static IEnumerable DisableAll() return customTeams; } - /// - /// Gets all instances based on the predicate. - /// - /// The predicate. - /// All instances matching the predicate. - public static IEnumerable Get(Func predicate) => List.Where(predicate); - - /// - /// Gets a instance based on the specified id. - /// - /// The id to check. - /// The matching the search, or if not registered. - public static CustomTeam Get(uint id) => IdLookupTable[id]; - - /// - /// Gets a instance based on the specified name. - /// - /// The specified name. - /// The matching the search, or if not registered. - public static CustomTeam Get(string name) => NameLookupTable[name]; - - /// - /// Gets a instance associated with a specific . - /// - /// The to check. - /// The matching the search, or if not registered. - public static CustomTeam Get(Player player) => !PlayersValue.TryGetValue(player, out CustomTeam customTeam) ? null : customTeam; - /// /// Determines whether the provided id is equal to the current object. /// From 8a07cce1901994282d907bf0a2a52025c6175697 Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Sat, 3 Feb 2024 04:24:12 +0100 Subject: [PATCH 078/141] Added `TDynamicEventDispatcher::Unbind(object, Action)` and `TDynamicEventDispatcher::Unbind(object, Action)` overloads. --- .../DynamicEvents/DynamicEventDispatcher.cs | 13 +++++++++++++ .../DynamicEvents/TDynamicEventDispatcher.cs | 13 +++++++++++++ 2 files changed, 26 insertions(+) diff --git a/Exiled.API/Features/DynamicEvents/DynamicEventDispatcher.cs b/Exiled.API/Features/DynamicEvents/DynamicEventDispatcher.cs index 11ca0d27ed..9a2a99351b 100644 --- a/Exiled.API/Features/DynamicEvents/DynamicEventDispatcher.cs +++ b/Exiled.API/Features/DynamicEvents/DynamicEventDispatcher.cs @@ -142,6 +142,19 @@ public virtual void Bind(object obj, Action del) /// The listener instance. public virtual void Unbind(object obj) => boundDelegates.Remove(obj); + /// + /// Unbinds a listener from the event dispatcher. + /// + /// The listener instance. + /// The delegate to be unbound. + public virtual void Unbind(object obj, Action del) + { + if (!boundDelegates.ContainsKey(obj)) + return; + + boundDelegates[obj].Remove(del); + } + /// /// Invokes the delegates from the specified listener. /// diff --git a/Exiled.API/Features/DynamicEvents/TDynamicEventDispatcher.cs b/Exiled.API/Features/DynamicEvents/TDynamicEventDispatcher.cs index f0c971d1ba..778d815454 100644 --- a/Exiled.API/Features/DynamicEvents/TDynamicEventDispatcher.cs +++ b/Exiled.API/Features/DynamicEvents/TDynamicEventDispatcher.cs @@ -143,6 +143,19 @@ public virtual void Bind(object obj, Action del) /// The listener instance. public virtual void Unbind(object obj) => boundDelegates.Remove(obj); + /// + /// Unbinds a listener from the event dispatcher. + /// + /// The listener instance. + /// The delegate to be unbound. + public virtual void Unbind(object obj, Action del) + { + if (!boundDelegates.ContainsKey(obj)) + return; + + boundDelegates[obj].Remove(del); + } + /// /// Invokes the delegates from the specified listener. /// From ea51154e1302723a15c6c35501eb5b4bc1bfa018 Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Sat, 3 Feb 2024 04:24:52 +0100 Subject: [PATCH 079/141] Added `Role::Random(bool, IEnumerable)` method. Added `Role::RandomHuman` and `Role::RandomScp` properties. --- Exiled.API/Features/Roles/Role.cs | 39 ++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/Exiled.API/Features/Roles/Role.cs b/Exiled.API/Features/Roles/Role.cs index 7787908f1a..fb3585ec41 100644 --- a/Exiled.API/Features/Roles/Role.cs +++ b/Exiled.API/Features/Roles/Role.cs @@ -8,18 +8,18 @@ namespace Exiled.API.Features.Roles { using System; + using System.Collections.Generic; + using System.Linq; 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 YamlDotNet.Serialization.TypeInspectors; using FilmmakerGameRole = PlayerRoles.Filmmaker.FilmmakerRole; using HumanGameRole = PlayerRoles.HumanRole; @@ -50,6 +50,16 @@ protected Role(PlayerRoleBase baseRole) Base = baseRole; } + /// + /// Gets a random human . + /// + public static RoleTypeId RandomHuman => Enum.GetValues(typeof(RoleTypeId)).ToArray().Shuffle().FirstOrDefault(role => role.IsHuman()); + + /// + /// Gets a random human . + /// + public static RoleTypeId RandomScp => Enum.GetValues(typeof(RoleTypeId)).ToArray().Shuffle().FirstOrDefault(role => RoleExtensions.GetTeam(role) == Team.SCPs); + /// public override GameObject GameObject => Base.gameObject; @@ -178,6 +188,29 @@ protected Role(PlayerRoleBase baseRole) /// if the values are not equal. public static bool operator !=(RoleTypeId type, Role role) => role != type; + /// + /// Gets a random . + /// + /// Specifies whether non-playable roles should be included. + /// An optional collection of role types to exclude. + /// A random . + public static RoleTypeId Random(bool includeNonPlayableRoles = false, IEnumerable except = null) + { + RoleTypeId[] roles = Enum.GetValues(typeof(RoleTypeId)).ToArray(); + + if (!includeNonPlayableRoles) + { + IEnumerable exceptRoles = roles.Except(new RoleTypeId[] { RoleTypeId.Filmmaker, RoleTypeId.None, RoleTypeId.Overwatch, RoleTypeId.Spectator }); + + if (except is not null) + exceptRoles = exceptRoles.Except(except); + + return exceptRoles.Shuffle().First(); + } + + return includeNonPlayableRoles && except is not null ? roles.Except(except).Shuffle().First() : roles.Shuffle().First(); + } + /// public override bool Equals(object obj) => base.Equals(obj); From 11d9b74c2c75ebbaa1674b11499ee56838d0fbc2 Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Sat, 3 Feb 2024 04:25:01 +0100 Subject: [PATCH 080/141] blank lines? --- Exiled.CustomModules/API/Features/CustomRoles/CustomRole.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Exiled.CustomModules/API/Features/CustomRoles/CustomRole.cs b/Exiled.CustomModules/API/Features/CustomRoles/CustomRole.cs index f6fea56346..57c18c3a95 100644 --- a/Exiled.CustomModules/API/Features/CustomRoles/CustomRole.cs +++ b/Exiled.CustomModules/API/Features/CustomRoles/CustomRole.cs @@ -327,7 +327,6 @@ public static CustomRole Get() /// The matching the search or if not registered. public static CustomRole Get(Pawn player) => PlayersValue.TryGetValue(player, out CustomRole customRole) ? customRole : default; - /// /// Attempts to retrieve a based on the provided id or . /// From fe9c531aa6e39a920de5303fa8ea6b225b4b0240 Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Sat, 3 Feb 2024 04:47:05 +0100 Subject: [PATCH 081/141] Added `SelectingCustomTeamRespawn` event. Renamed `AssigningHumanCustomRolesEventArgs` and `AssigningScpCustomRolesEventArgs`. --- .../API/Features/RespawnManager.cs | 13 +++- .../API/Features/RoleAssigner.cs | 14 +++-- ... => AssigningHumanCustomRolesEventArgs.cs} | 8 +-- ...cs => AssigningScpCustomRolesEventArgs.cs} | 8 +-- .../SelectingCustomTeamRespawnEventArgs.cs | 62 +++++++++++++++++++ 5 files changed, 90 insertions(+), 15 deletions(-) rename Exiled.CustomModules/Events/EventArgs/CustomRoles/{AssigningHumanRolesEventArgs.cs => AssigningHumanCustomRolesEventArgs.cs} (76%) rename Exiled.CustomModules/Events/EventArgs/CustomRoles/{AssigningScpRolesEventArgs.cs => AssigningScpCustomRolesEventArgs.cs} (81%) create mode 100644 Exiled.CustomModules/Events/EventArgs/CustomRoles/SelectingCustomTeamRespawnEventArgs.cs diff --git a/Exiled.CustomModules/API/Features/RespawnManager.cs b/Exiled.CustomModules/API/Features/RespawnManager.cs index fb11ac7ba2..fca52f033f 100644 --- a/Exiled.CustomModules/API/Features/RespawnManager.cs +++ b/Exiled.CustomModules/API/Features/RespawnManager.cs @@ -5,6 +5,8 @@ // // ----------------------------------------------------------------------- +using Exiled.CustomModules.Events.EventArgs.CustomRoles; + namespace Exiled.CustomModules.API.Features { using System; @@ -39,6 +41,12 @@ public class RespawnManager : StaticActor { private object nextKnownTeam; + /// + /// Gets the which handles all delegates to be fired when selecting the next known team. + /// + [DynamicEventDispatcher] + public static TDynamicEventDispatcher SelectingCustomTeamRespawnDispatcher { get; private set; } + /// /// Gets or sets the next known team. /// @@ -165,7 +173,10 @@ private void OnSelectingRespawnTeam(SelectingRespawnTeamEventArgs ev) if ((team.UseTickets && team.Tickets <= 0) || !team.EvaluateConditions || !team.CanSpawnByProbability) continue; - NextKnownTeam = team.Id; + SelectingCustomTeamRespawnEventArgs @event = new((object)team.Id); + SelectingCustomTeamRespawnDispatcher.InvokeAll(@event); + + NextKnownTeam = @event.Team; return; } diff --git a/Exiled.CustomModules/API/Features/RoleAssigner.cs b/Exiled.CustomModules/API/Features/RoleAssigner.cs index 0e4e38ea6d..61dc0f8145 100644 --- a/Exiled.CustomModules/API/Features/RoleAssigner.cs +++ b/Exiled.CustomModules/API/Features/RoleAssigner.cs @@ -5,6 +5,8 @@ // // ----------------------------------------------------------------------- +using Exiled.CustomModules.Events.EventArgs.CustomRoles; + namespace Exiled.CustomModules.API.Features { using System; @@ -38,13 +40,13 @@ public class RoleAssigner : StaticActor /// Gets the which handles all the delegates fired before assigning human roles. ///
[DynamicEventDispatcher] - public TDynamicEventDispatcher AssigningHumanRolesDispatcher { get; private set; } + public TDynamicEventDispatcher AssigningHumanCustomRolesDispatcher { get; private set; } /// /// Gets the which handles all the delegates fired before assigning SCP roles. /// [DynamicEventDispatcher] - public TDynamicEventDispatcher AssigningScpRolesDispatcher { get; private set; } + public TDynamicEventDispatcher AssigningScpCustomRolesDispatcher { get; private set; } /// /// Gets or sets all enqueued SCPs. @@ -116,8 +118,8 @@ public virtual void SpawnHumans(Team[] queue, int queueLength) EnqueuedHumans.AddRange(array.Cast()); } - Events.EventArgs.CustomRoles.AssigningHumanRolesEventArgs ev = new(EnqueuedHumans); - AssigningHumanRolesDispatcher.InvokeAll(ev); + Events.EventArgs.CustomRoles.AssigningHumanCustomRolesEventArgs ev = new(EnqueuedHumans); + AssigningHumanCustomRolesDispatcher.InvokeAll(ev); EnqueuedHumans = ev.Roles; DistributeOrEnqueue(hubs.ToList(), EnqueuedHumans.Where(o => o is uint).Cast(), FilterHumans); @@ -162,8 +164,8 @@ public virtual void SpawnScps(int targetScpNumber) if (spawnable.Count < targetScpNumber) EnqueuedPlayers.AddRange(chosenPlayers.Select(rh => Player.Get(rh)).Take(targetScpNumber - spawnable.Count)); - Events.EventArgs.CustomRoles.AssigningScpRolesEventArgs ev = new(chosenPlayers, EnqueuedScps); - AssigningScpRolesDispatcher.InvokeAll(ev); + Events.EventArgs.CustomRoles.AssigningScpCustomRolesEventArgs ev = new(chosenPlayers, EnqueuedScps); + AssigningScpCustomRolesDispatcher.InvokeAll(ev); EnqueuedScps = ev.Roles; List enqueuedScps = EnqueuedScps.Where(role => role is RoleTypeId).Cast().ToList(); diff --git a/Exiled.CustomModules/Events/EventArgs/CustomRoles/AssigningHumanRolesEventArgs.cs b/Exiled.CustomModules/Events/EventArgs/CustomRoles/AssigningHumanCustomRolesEventArgs.cs similarity index 76% rename from Exiled.CustomModules/Events/EventArgs/CustomRoles/AssigningHumanRolesEventArgs.cs rename to Exiled.CustomModules/Events/EventArgs/CustomRoles/AssigningHumanCustomRolesEventArgs.cs index aea680502f..ac5b2ee84d 100644 --- a/Exiled.CustomModules/Events/EventArgs/CustomRoles/AssigningHumanRolesEventArgs.cs +++ b/Exiled.CustomModules/Events/EventArgs/CustomRoles/AssigningHumanCustomRolesEventArgs.cs @@ -1,5 +1,5 @@ // ----------------------------------------------------------------------- -// +// // Copyright (c) Exiled Team. All rights reserved. // Licensed under the CC BY-SA 3.0 license. // @@ -16,13 +16,13 @@ namespace Exiled.CustomModules.Events.EventArgs.CustomRoles /// /// Contains all information before assigning human roles. /// - public class AssigningHumanRolesEventArgs : IExiledEvent + public class AssigningHumanCustomRolesEventArgs : IExiledEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// - public AssigningHumanRolesEventArgs(List roles) => Roles = roles; + public AssigningHumanCustomRolesEventArgs(List roles) => Roles = roles; /// /// Gets or sets all roles to be assigned. diff --git a/Exiled.CustomModules/Events/EventArgs/CustomRoles/AssigningScpRolesEventArgs.cs b/Exiled.CustomModules/Events/EventArgs/CustomRoles/AssigningScpCustomRolesEventArgs.cs similarity index 81% rename from Exiled.CustomModules/Events/EventArgs/CustomRoles/AssigningScpRolesEventArgs.cs rename to Exiled.CustomModules/Events/EventArgs/CustomRoles/AssigningScpCustomRolesEventArgs.cs index 68a0c8c925..6f1ed74caa 100644 --- a/Exiled.CustomModules/Events/EventArgs/CustomRoles/AssigningScpRolesEventArgs.cs +++ b/Exiled.CustomModules/Events/EventArgs/CustomRoles/AssigningScpCustomRolesEventArgs.cs @@ -1,5 +1,5 @@ // ----------------------------------------------------------------------- -// +// // Copyright (c) Exiled Team. All rights reserved. // Licensed under the CC BY-SA 3.0 license. // @@ -19,14 +19,14 @@ namespace Exiled.CustomModules.Events.EventArgs.CustomRoles /// /// Contains all information before assigning SCP roles. /// - public class AssigningScpRolesEventArgs : IExiledEvent + public class AssigningScpCustomRolesEventArgs : IExiledEvent { /// - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// /// /// - public AssigningScpRolesEventArgs(List chosenPlayers, List enqueuedScps) + public AssigningScpCustomRolesEventArgs(List chosenPlayers, List enqueuedScps) { Players = Player.Get(chosenPlayers).ToList(); Roles = enqueuedScps; diff --git a/Exiled.CustomModules/Events/EventArgs/CustomRoles/SelectingCustomTeamRespawnEventArgs.cs b/Exiled.CustomModules/Events/EventArgs/CustomRoles/SelectingCustomTeamRespawnEventArgs.cs new file mode 100644 index 0000000000..613976ebc3 --- /dev/null +++ b/Exiled.CustomModules/Events/EventArgs/CustomRoles/SelectingCustomTeamRespawnEventArgs.cs @@ -0,0 +1,62 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.CustomModules.Events.EventArgs.CustomRoles +{ + using System.Collections.Generic; + using System.Linq; + + using API.Enums; + using API.Features; + using Exiled.API.Features; + using Exiled.CustomModules.API.Features.CustomRoles; + using Exiled.Events.EventArgs.Interfaces; + using PlayerRoles; + using Respawning; + + /// + /// Contains all information before selecting the next known team. + /// + public class SelectingCustomTeamRespawnEventArgs : IExiledEvent + { + private object team; + + /// + /// Initializes a new instance of the class. + /// + /// + public SelectingCustomTeamRespawnEventArgs(object team) + { + this.team = team; + } + + /// + /// Gets or sets the next known team. + /// + public object Team + { + get => team; + set + { + if (value == team) + return; + + if (value is SpawnableTeamType teamType) + { + team = (object)teamType; + return; + } + + if (CustomTeam.TryGet(value, out CustomTeam customTeam)) + { + team = (object)customTeam.Id; + return; + } + } + } + } +} \ No newline at end of file From 4d813a1dea19bb56550754c6b24a0bbd1e137ae4 Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Sat, 3 Feb 2024 06:30:55 +0100 Subject: [PATCH 082/141] Added automatic game modes. Added missing `CustomGameMode` module implementations. Added `MathExtensions`. Renamed `CommonExtensions` to `AnimationCurveExtensions`. Added `UUGameModeType`. Renamed `DefaultTickRate` constant to `DEFAULT_TICK_RATE`. Fixed `RespawnManager::SelectingCustomTeamRespawnDispatcher` being not accessible. --- .../Extensions/AnimationCurveExtensions.cs | 48 +++ Exiled.API/Extensions/CommonExtensions.cs | 67 ---- Exiled.API/Extensions/MathExtensions.cs | 52 +++ .../Features/Core/Components/TickComponent.cs | 6 +- Exiled.API/Features/Core/EActor.cs | 6 +- .../API/Enums/UUGameModeType.cs | 22 ++ .../CustomGamemodes/GameModeSettings.cs | 28 +- .../API/Features/CustomGamemodes/GameState.cs | 297 +++++++++++++++++- .../API/Features/CustomGamemodes/World.cs | 130 ++++++++ .../API/Features/RespawnManager.cs | 5 +- 10 files changed, 572 insertions(+), 89 deletions(-) create mode 100644 Exiled.API/Extensions/AnimationCurveExtensions.cs delete mode 100644 Exiled.API/Extensions/CommonExtensions.cs create mode 100644 Exiled.API/Extensions/MathExtensions.cs create mode 100644 Exiled.CustomModules/API/Enums/UUGameModeType.cs diff --git a/Exiled.API/Extensions/AnimationCurveExtensions.cs b/Exiled.API/Extensions/AnimationCurveExtensions.cs new file mode 100644 index 0000000000..a94e75556f --- /dev/null +++ b/Exiled.API/Extensions/AnimationCurveExtensions.cs @@ -0,0 +1,48 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.API.Extensions +{ + using System; + using System.Collections.Generic; + + using UnityEngine; + + /// + /// A set of extensions for animation curves. + /// + public static class AnimationCurveExtensions + { + /// + /// Modify the curve with the amount used. + /// + /// The AnimationCurve to modify. + /// The multiplier number. + /// The new modified curve. + public static AnimationCurve Multiply(this AnimationCurve curve, float amount) + { + for (int i = 0; i < curve.length; i++) + curve.keys[i].value *= amount; + + return curve; + } + + /// + /// Modify the curve with the amount used. + /// + /// The AnimationCurve to modify. + /// The add number. + /// The new modified curve. + public static AnimationCurve Add(this AnimationCurve curve, float amount) + { + for (int i = 0; i < curve.length; i++) + curve.keys[i].value += amount; + + return curve; + } + } +} \ No newline at end of file diff --git a/Exiled.API/Extensions/CommonExtensions.cs b/Exiled.API/Extensions/CommonExtensions.cs deleted file mode 100644 index 49945467ec..0000000000 --- a/Exiled.API/Extensions/CommonExtensions.cs +++ /dev/null @@ -1,67 +0,0 @@ -// ----------------------------------------------------------------------- -// -// Copyright (c) Exiled Team. All rights reserved. -// Licensed under the CC BY-SA 3.0 license. -// -// ----------------------------------------------------------------------- - -namespace Exiled.API.Extensions -{ - using System; - using System.Collections.Generic; - - using UnityEngine; - - /// - /// A set of extensions for common things. - /// - public static class CommonExtensions - { - /// - /// Gets a random value from an . - /// - /// to be used to get a random value. - /// Type of elements. - /// Returns a random value from . - [Obsolete("Use CollectionExtensions::Random(IEnumerable, Func) instead.", true)] - public static T GetRandomValue(this IEnumerable enumerable) => CollectionExtensions.Random(enumerable); - - /// - /// Gets a random value from an that matches the provided condition. - /// - /// to be used to get a random value. - /// Type of elements. - /// The condition to require. - /// Returns a random value from . - [Obsolete("Use CollectionExtensions::Random(IEnumerable, Func) instead.", true)] - public static T GetRandomValue(this IEnumerable enumerable, Func condition) => CollectionExtensions.Random(enumerable, condition); - - /// - /// Modify the curve with the amount used. - /// - /// The AnimationCurve to modify. - /// The multiplier number. - /// The new modfied curve. - public static AnimationCurve Multiply(this AnimationCurve curve, float amount) - { - for (int i = 0; i < curve.length; i++) - curve.keys[i].value *= amount; - - return curve; - } - - /// - /// Modify the curve with the amount used. - /// - /// The AnimationCurve to mofify. - /// The add number. - /// The new modfied curve. - public static AnimationCurve Add(this AnimationCurve curve, float amount) - { - for (int i = 0; i < curve.length; i++) - curve.keys[i].value += amount; - - return curve; - } - } -} \ No newline at end of file diff --git a/Exiled.API/Extensions/MathExtensions.cs b/Exiled.API/Extensions/MathExtensions.cs new file mode 100644 index 0000000000..980fac0267 --- /dev/null +++ b/Exiled.API/Extensions/MathExtensions.cs @@ -0,0 +1,52 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.API.Extensions +{ + using System; + using System.Collections.Generic; + + using UnityEngine; + + /// + /// A set of extensions for mathematical operations. + /// + public static class MathExtensions + { + /// + /// Evaluates a probability. + /// + /// The probability to evaluate. + /// if the probability occurred, otherwise . + public static bool EvaluateProbability(this int probability) => UnityEngine.Random.Range(0, 101) <= probability; + + /// + /// Evaluates a probability. + /// + /// The probability to evaluate. + /// The minimum value to include in the range. + /// The maximum value to include in the range. + /// if the probability occurred, otherwise . + public static bool EvaluateProbability(this int probability, int minInclusive = 0, int maxInclusive = 100) => UnityEngine.Random.Range(minInclusive, ++maxInclusive) <= probability; + + /// + /// Evaluates a probability. + /// + /// The probability to evaluate. + /// if the probability occurred, otherwise . + public static bool EvaluateProbability(this float probability) => UnityEngine.Random.Range(0f, 100f) <= probability; + + /// + /// Evaluates a probability. + /// + /// The probability to evaluate. + /// The minimum value to include in the range. + /// The maximum value to include in the range. + /// if the probability occurred, otherwise . + public static bool EvaluateProbability(this float probability, float minInclusive = 0f, float maxInclusive = 100f) => UnityEngine.Random.Range(minInclusive, maxInclusive) <= probability; + } +} \ No newline at end of file diff --git a/Exiled.API/Features/Core/Components/TickComponent.cs b/Exiled.API/Features/Core/Components/TickComponent.cs index d84a1f3d83..7e65d93a3b 100644 --- a/Exiled.API/Features/Core/Components/TickComponent.cs +++ b/Exiled.API/Features/Core/Components/TickComponent.cs @@ -23,7 +23,9 @@ public sealed class TickComponent : EObject /// /// The default fixed tick rate (60 per second). /// - public const float DefaultFixedTickRate = 0.016f; +#pragma warning disable SA1310 + public const float DEFAULT_FIXED_TICK_RATE = 0.016f; +#pragma warning restore SA1310 private readonly HashSet boundHandles; private readonly CoroutineHandle executeAllHandle; @@ -43,7 +45,7 @@ internal TickComponent() /// /// Gets or sets the current tick rate. /// - public float TickRate { get; set; } = DefaultFixedTickRate; + public float TickRate { get; set; } = DEFAULT_FIXED_TICK_RATE; /// /// Gets or sets a value indicating whether the can tick. diff --git a/Exiled.API/Features/Core/EActor.cs b/Exiled.API/Features/Core/EActor.cs index 8f76c999ef..032f24dfcd 100644 --- a/Exiled.API/Features/Core/EActor.cs +++ b/Exiled.API/Features/Core/EActor.cs @@ -28,7 +28,9 @@ public abstract class EActor : EObject, IEntity, IWorldSpace /// /// The default fixed tick rate. /// - public const float DefaultFixedTickRate = TickComponent.DefaultFixedTickRate; +#pragma warning disable SA1310 + public const float DEFAULT_FIXED_TICK_RATE = TickComponent.DEFAULT_FIXED_TICK_RATE; +#pragma warning restore SA1310 private readonly HashSet componentsInChildren = HashSetPool.Pool.Get(); private CoroutineHandle serverTick; @@ -43,7 +45,7 @@ protected EActor() { IsEditable = true; CanEverTick = true; - fixedTickRate = DefaultFixedTickRate; + fixedTickRate = DEFAULT_FIXED_TICK_RATE; PostInitialize(); Timing.CallDelayed(fixedTickRate, () => OnBeginPlay()); Timing.CallDelayed(fixedTickRate * 2, () => serverTick = Timing.RunCoroutine(ServerTick())); diff --git a/Exiled.CustomModules/API/Enums/UUGameModeType.cs b/Exiled.CustomModules/API/Enums/UUGameModeType.cs new file mode 100644 index 0000000000..38836bc4c3 --- /dev/null +++ b/Exiled.CustomModules/API/Enums/UUGameModeType.cs @@ -0,0 +1,22 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.CustomModules.API.Enums +{ + using Exiled.API.Features.Core.Generic; + + /// + /// Represents the base enum class for all available custom teams. + /// + public class UUGameModeType : UniqueUnmanagedEnumClass + { + /// + /// Represents an invalid custom game mode. + /// + public static readonly UUGameModeType None = new(); + } +} \ No newline at end of file diff --git a/Exiled.CustomModules/API/Features/CustomGamemodes/GameModeSettings.cs b/Exiled.CustomModules/API/Features/CustomGamemodes/GameModeSettings.cs index 3ee846de45..d994390f08 100644 --- a/Exiled.CustomModules/API/Features/CustomGamemodes/GameModeSettings.cs +++ b/Exiled.CustomModules/API/Features/CustomGamemodes/GameModeSettings.cs @@ -21,6 +21,26 @@ namespace Exiled.CustomModules.API.Features.CustomGameModes /// public class GameModeSettings : TypeCastObject, IAdditiveProperty { + /// + /// Gets or sets a value indicating whether the game mode operates in automatic mode. + /// + /// + /// In automatic mode, the behavior of the game mode is managed automatically by the . + ///
+ /// The game mode will start automatically if the specified probability condition is met and the minimum player requirement () is satisfied. + ///
+ public virtual bool Automatic { get; set; } + + /// + /// Gets or sets the probability condition for automatic game mode activation. + /// + /// + /// This property specifies the probability condition that determines whether the game mode will start automatically. + ///
+ /// If the specified probability condition is met and the minimum player requirement () is satisfied, the game mode will activate automatically. + ///
+ public virtual float AutomaticProbability { get; set; } + /// /// Gets or sets the minimum amount of players to start the game mode. /// @@ -129,7 +149,7 @@ public class GameModeSettings : TypeCastObject, IAdditivePrope ///
/// It's highly recommended to not use it along with . /// - public virtual UUCustomRoleType[] SpawnableCustomRoles { get; set; } + public virtual uint[] SpawnableCustomRoles { get; set; } /// /// Gets or sets a [] containing all spawnable teams. @@ -147,7 +167,7 @@ public class GameModeSettings : TypeCastObject, IAdditivePrope ///
/// It's highly recommended to not use it along with . ///
- public virtual UUCustomTeamType[] SpawnableCustomTeams { get; set; } + public virtual uint[] SpawnableCustomTeams { get; set; } /// /// Gets or sets a [] containing all non spawnable roles. @@ -165,7 +185,7 @@ public class GameModeSettings : TypeCastObject, IAdditivePrope ///
/// It's highly recommended to not use it along with . ///
- public virtual UUCustomRoleType[] NonSpawnableCustomRoles { get; set; } + public virtual uint[] NonSpawnableCustomRoles { get; set; } /// /// Gets or sets a [] containing all non spawnable custom teams. @@ -183,6 +203,6 @@ public class GameModeSettings : TypeCastObject, IAdditivePrope ///
/// It's highly recommended to not use it along with . ///
- public virtual UUCustomTeamType[] NonSpawnableCustomTeams { get; set; } + public virtual uint[] NonSpawnableCustomTeams { get; set; } } } \ No newline at end of file diff --git a/Exiled.CustomModules/API/Features/CustomGamemodes/GameState.cs b/Exiled.CustomModules/API/Features/CustomGamemodes/GameState.cs index 09b9e60123..0b402d3f30 100644 --- a/Exiled.CustomModules/API/Features/CustomGamemodes/GameState.cs +++ b/Exiled.CustomModules/API/Features/CustomGamemodes/GameState.cs @@ -9,21 +9,27 @@ namespace Exiled.CustomModules.API.Features.CustomGameModes { using System; using System.Collections.Generic; + using System.Diagnostics; using System.Linq; using System.Reflection; + using System.Runtime.InteropServices.WindowsRuntime; using Exiled.API.Enums; + using Exiled.API.Extensions; using Exiled.API.Features; using Exiled.API.Features.Core; using Exiled.API.Features.Core.Interfaces; using Exiled.API.Features.Doors; + using Exiled.API.Features.Roles; using Exiled.CustomModules.API.Enums; + using Exiled.CustomModules.API.Features.CustomRoles; + using Exiled.CustomModules.Events.EventArgs.CustomRoles; using Exiled.Events.EventArgs.Player; using Exiled.Events.EventArgs.Server; - using GameCore; using Interactables.Interobjects.DoorUtils; using LightContainmentZoneDecontamination; + using PlayerRoles; using Respawning; using UnityStandardAssets.CinematicEffects; using Utils.Networking; @@ -128,9 +134,14 @@ public virtual void AdjustAdditivePipe() /// A value indicating whether the should be started regardless any conditions. public virtual void Start(bool isForced = false) { + if (!typeof(World).IsAssignableFrom(new StackTrace().GetFrame(1)?.GetMethod()?.DeclaringType)) + throw new Exception("Only the World can start a GameState."); + if (!isForced && PlayerCount < Settings.MinimumPlayers) return; + World.Get().RunningGameMode = CustomGameMode.Get(this).Id; + foreach (PlayerState ps in PlayerStates) ps.Deploy(); } @@ -141,11 +152,16 @@ public virtual void Start(bool isForced = false) /// A value indicating whether the should be ended regardless any conditions. public virtual void End(bool isForced = false) { - if (isForced || CanBeEnded) - { - foreach (PlayerState ps in PlayerStates) - ps.Destroy(); - } + if (!typeof(GameState).IsAssignableFrom(new StackTrace().GetFrame(1)?.GetMethod()?.DeclaringType)) + throw new Exception("Only the World can end a GameState."); + + if (!isForced && !CanBeEnded) + return; + + World.Get().RunningGameMode = UUGameModeType.None; + + foreach (PlayerState ps in PlayerStates) + ps.Destroy(); } /// @@ -190,12 +206,28 @@ protected override void OnBeginPlay() Lift.LockAll(Settings.LockedElevators); } + /// + protected override void OnEndPlay() + { + base.OnEndPlay(); + + Door.UnlockAll(); + Lift.UnlockAll(); + } + /// protected override void SubscribeEvents() { base.SubscribeEvents(); - Exiled.Events.Handlers.Server.EndingRound += OnEndingRound; + StaticActor.Get().AssigningHumanCustomRolesDispatcher.Bind(this, OnAssigningCustomHumanRolesInternal); + StaticActor.Get().AssigningScpCustomRolesDispatcher.Bind(this, OnAssigningCustomScpRolesInternal); + + StaticActor.Get().SelectingCustomTeamRespawnDispatcher.Bind(this, OnSelectingCustomTeamRespawnInternal); + + Exiled.Events.Handlers.Server.AssigningHumanRoles += OnAssigningHumanRolesInternal; + Exiled.Events.Handlers.Server.AssigningScpRoles += OnAssigningScpRolesInternal; + Exiled.Events.Handlers.Server.EndingRound += OnEndingRoundInternal; Exiled.Events.Handlers.Server.RespawningTeam += OnRespawningTeamInternal; Exiled.Events.Handlers.Server.RespawnedTeam += OnRespawnedTeamInternal; @@ -209,7 +241,12 @@ protected override void UnsubscribeEvents() { base.UnsubscribeEvents(); - Exiled.Events.Handlers.Server.EndingRound -= OnEndingRound; + StaticActor.Get().AssigningHumanCustomRolesDispatcher.Unbind(this); + StaticActor.Get().SelectingCustomTeamRespawnDispatcher.Unbind(this); + + Exiled.Events.Handlers.Server.AssigningHumanRoles -= OnAssigningHumanRolesInternal; + Exiled.Events.Handlers.Server.AssigningScpRoles -= OnAssigningScpRolesInternal; + Exiled.Events.Handlers.Server.EndingRound -= OnEndingRoundInternal; Exiled.Events.Handlers.Server.RespawningTeam -= OnRespawningTeamInternal; Exiled.Events.Handlers.Server.RespawnedTeam -= OnRespawnedTeamInternal; @@ -218,7 +255,187 @@ protected override void UnsubscribeEvents() Exiled.Events.Handlers.Player.Destroying -= OnDestroyingInternal; } - private void OnEndingRound(EndingRoundEventArgs ev) + private void OnAssigningHumanRolesInternal(AssigningHumanRolesEventArgs ev) + { + if (!Settings.SpawnableRoles.IsEmpty()) + { + IEnumerable roles = ev.Roles.Where(role => Settings.SpawnableRoles.Contains(role)); + int amount = roles.Count(); + if (amount < ev.Roles.Length) + { + List newRoles = new(); + + for (int i = 0; i < amount; i++) + newRoles.Add(Role.Random(false, Settings.SpawnableRoles.Except(ev.Roles))); + + ev.Roles = roles.Concat(newRoles).ToArray(); + } + + return; + } + + if (!Settings.NonSpawnableRoles.IsEmpty()) + { + IEnumerable roles = ev.Roles.Where(role => !Settings.NonSpawnableRoles.Contains(role)); + int amount = roles.Count(); + if (amount < ev.Roles.Length) + { + List newRoles = new(); + + for (int i = 0; i < amount; i++) + newRoles.Add(Role.Random(false, Settings.NonSpawnableRoles)); + + ev.Roles = roles.Concat(newRoles).ToArray(); + } + } + } + + private void OnAssigningScpRolesInternal(AssigningScpRolesEventArgs ev) + { + if (!Settings.SpawnableRoles.IsEmpty()) + { + IEnumerable roles = ev.Roles.Where(role => Settings.SpawnableRoles.Contains(role)); + int amount = roles.Count(); + if (amount < ev.Roles.Count) + { + List newRoles = new(); + + for (int i = 0; i < amount; i++) + newRoles.Add(Role.Random(false, Settings.SpawnableRoles.Except(ev.Roles))); + + ev.Roles = roles.Concat(newRoles).ToList(); + } + + return; + } + + if (!Settings.NonSpawnableRoles.IsEmpty()) + { + IEnumerable roles = ev.Roles.Where(role => !Settings.NonSpawnableRoles.Contains(role)); + int amount = roles.Count(); + if (amount < ev.Roles.Count) + { + List newRoles = new(); + + for (int i = 0; i < amount; i++) + newRoles.Add(Role.Random(false, Settings.NonSpawnableRoles)); + + ev.Roles = roles.Concat(newRoles).ToList(); + } + } + } + + private void OnAssigningCustomHumanRolesInternal(Events.EventArgs.CustomRoles.AssigningHumanCustomRolesEventArgs ev) + { + if (!Settings.SpawnableCustomRoles.IsEmpty()) + { + List customRoles = new(); + foreach (object role in ev.Roles) + { + if (!CustomRole.TryGet(role, out CustomRole cr) || !Settings.SpawnableCustomRoles.Contains(cr.Id)) + continue; + + customRoles.Add(cr.Id); + } + + ev.Roles.RemoveAll(o => CustomRole.TryGet(o, out CustomRole cr) && !Settings.SpawnableCustomRoles.Contains(cr.Id)); + + int amount = customRoles.Count(); + if (amount < (ev.Roles.Count - customRoles.Count)) + { + List newRoles = new(); + + for (int i = 0; i < amount; i++) + newRoles.Add(CustomRole.Get(role => !role.IsScp && !role.IsTeamUnit).Random().Id); + + ev.Roles = ev.Roles.Where(role => role is not RoleTypeId).Cast().Concat(newRoles.Cast()).ToList(); + } + + return; + } + + if (!Settings.NonSpawnableCustomRoles.IsEmpty()) + { + List customRoles = new(); + foreach (object role in ev.Roles) + { + if (!CustomRole.TryGet(role, out CustomRole cr) || Settings.NonSpawnableCustomRoles.Contains(cr.Id)) + continue; + + customRoles.Add(cr.Id); + } + + ev.Roles.RemoveAll(o => CustomRole.TryGet(o, out CustomRole cr) && Settings.NonSpawnableCustomRoles.Contains(cr.Id)); + + int amount = customRoles.Count(); + if (amount < (ev.Roles.Count - customRoles.Count)) + { + List newRoles = new(); + + for (int i = 0; i < amount; i++) + newRoles.Add(CustomRole.Get(role => !role.IsScp && !role.IsTeamUnit).Random().Id); + + ev.Roles = ev.Roles.Where(role => role is not RoleTypeId).Cast().Concat(newRoles.Cast()).ToList(); + } + } + } + + private void OnAssigningCustomScpRolesInternal(Events.EventArgs.CustomRoles.AssigningScpCustomRolesEventArgs ev) + { + if (!Settings.SpawnableCustomRoles.IsEmpty()) + { + List customRoles = new(); + foreach (object role in ev.Roles) + { + if (!CustomRole.TryGet(role, out CustomRole cr) || !Settings.SpawnableCustomRoles.Contains(cr.Id)) + continue; + + customRoles.Add(cr.Id); + } + + ev.Roles.RemoveAll(o => CustomRole.TryGet(o, out CustomRole cr) && !Settings.SpawnableCustomRoles.Contains(cr.Id)); + + int amount = customRoles.Count(); + if (amount < (ev.Roles.Count - customRoles.Count)) + { + List newRoles = new(); + + for (int i = 0; i < amount; i++) + newRoles.Add(CustomRole.Get(role => !role.IsScp && !role.IsTeamUnit).Random().Id); + + ev.Roles = ev.Roles.Where(role => role is not RoleTypeId).Cast().Concat(newRoles.Cast()).ToList(); + } + + return; + } + + if (!Settings.NonSpawnableCustomRoles.IsEmpty()) + { + List customRoles = new(); + foreach (object role in ev.Roles) + { + if (!CustomRole.TryGet(role, out CustomRole cr) || Settings.NonSpawnableCustomRoles.Contains(cr.Id)) + continue; + + customRoles.Add(cr.Id); + } + + ev.Roles.RemoveAll(o => CustomRole.TryGet(o, out CustomRole cr) && Settings.NonSpawnableCustomRoles.Contains(cr.Id)); + + int amount = customRoles.Count(); + if (amount < (ev.Roles.Count - customRoles.Count)) + { + List newRoles = new(); + + for (int i = 0; i < amount; i++) + newRoles.Add(CustomRole.Get(role => role.IsScp && !role.IsTeamUnit).Random().Id); + + ev.Roles = ev.Roles.Where(role => role is not RoleTypeId).Cast().Concat(newRoles.Cast()).ToList(); + } + } + } + + private void OnEndingRoundInternal(EndingRoundEventArgs ev) { if (!Settings.UseCustomEndingConditions || !EvaluateEndingConditions()) return; @@ -226,10 +443,68 @@ private void OnEndingRound(EndingRoundEventArgs ev) ev.IsAllowed = true; } + private void OnSelectingRespawnTeamInternal(SelectingRespawnTeamEventArgs ev) + { + if (!Settings.SpawnableTeams.IsEmpty() && Settings.SpawnableTeams.Contains(ev.Team)) + { + if (ev.Team is SpawnableTeamType.ChaosInsurgency && !Settings.SpawnableTeams.Contains(SpawnableTeamType.NineTailedFox)) + { + ev.Team = SpawnableTeamType.NineTailedFox; + return; + } + + if (ev.Team is SpawnableTeamType.NineTailedFox && !Settings.SpawnableTeams.Contains(SpawnableTeamType.ChaosInsurgency)) + { + ev.Team = SpawnableTeamType.ChaosInsurgency; + return; + } + + ev.Team = SpawnableTeamType.None; + return; + } + + if (!Settings.NonSpawnableTeams.IsEmpty() && Settings.NonSpawnableTeams.Contains(ev.Team)) + { + if (ev.Team is SpawnableTeamType.ChaosInsurgency && !Settings.NonSpawnableTeams.Contains(SpawnableTeamType.NineTailedFox)) + { + ev.Team = SpawnableTeamType.NineTailedFox; + return; + } + + if (ev.Team is SpawnableTeamType.NineTailedFox && !Settings.NonSpawnableTeams.Contains(SpawnableTeamType.ChaosInsurgency)) + { + ev.Team = SpawnableTeamType.ChaosInsurgency; + return; + } + + ev.Team = SpawnableTeamType.None; + } + } + + private void OnSelectingCustomTeamRespawnInternal(SelectingCustomTeamRespawnEventArgs ev) + { + if (!CustomTeam.TryGet(ev.Team, out CustomTeam team)) + return; + + if (!Settings.SpawnableCustomTeams.IsEmpty() && Settings.SpawnableCustomTeams.Contains(team.Id)) + { + CustomTeam newTeam = CustomTeam.Get(t => Settings.SpawnableCustomTeams.Contains(t.Id)).Shuffle().FirstOrDefault(); + ev.Team = newTeam ? newTeam.Id : SpawnableTeamType.None; + return; + } + + if (!Settings.NonSpawnableCustomTeams.IsEmpty() && Settings.NonSpawnableCustomTeams.Contains(team.Id)) + { + CustomTeam newTeam = CustomTeam.Get(t => !Settings.NonSpawnableCustomTeams.Contains(t.Id)).Shuffle().FirstOrDefault(); + ev.Team = newTeam ? newTeam.Id : SpawnableTeamType.None; + } + } + private void OnRespawningTeamInternal(RespawningTeamEventArgs ev) { - ev.IsAllowed = (!Settings.SpawnableTeams.IsEmpty() && !Settings.SpawnableTeams.Contains(ev.NextKnownTeam)) || - (!Settings.NonSpawnableTeams.IsEmpty() && Settings.NonSpawnableTeams.Contains(ev.NextKnownTeam)); + if ((!Settings.SpawnableTeams.IsEmpty() && !Settings.SpawnableTeams.Contains(ev.NextKnownTeam)) || + (!Settings.NonSpawnableTeams.IsEmpty() && Settings.NonSpawnableTeams.Contains(ev.NextKnownTeam))) + ev.IsAllowed = false; } private void OnRespawnedTeamInternal(RespawnedTeamEventArgs ev) diff --git a/Exiled.CustomModules/API/Features/CustomGamemodes/World.cs b/Exiled.CustomModules/API/Features/CustomGamemodes/World.cs index d4f52b9440..1834bce4f8 100644 --- a/Exiled.CustomModules/API/Features/CustomGamemodes/World.cs +++ b/Exiled.CustomModules/API/Features/CustomGamemodes/World.cs @@ -7,6 +7,9 @@ namespace Exiled.CustomModules.API.Features.CustomGameModes { + using System.Collections.Generic; + + using Exiled.API.Extensions; using Exiled.API.Features.Core.Generic; using Exiled.CustomModules.API.Enums; using MEC; @@ -19,13 +22,111 @@ namespace Exiled.CustomModules.API.Features.CustomGameModes /// public class World : StaticActor { + /// + /// The default dequeue rate. + /// +#pragma warning disable SA1310 + public const float DEFAULT_DEQUEUE_RATE = 4f; +#pragma warning restore SA1310 + private GameState gameState; + private CustomGameMode enqueuedGameMode; + private CoroutineHandle queueHandle; /// /// Gets the . /// public GameState GameState => gameState ??= GetComponent(); + /// + /// Gets or sets the dequeue rate, expressed in seconds. + /// + /// If enqueued, the game mode will be continuously evaluated until it starts or the enqueued game mode changes. + ///
+ /// The defines the delay between each evaluation check. + ///
+ /// + public float DequeueRate { get; set; } = DEFAULT_DEQUEUE_RATE; + + /// + /// Gets the enqueued game mode. + /// + public uint EnqueuedGameMode => enqueuedGameMode.Id; + + /// + /// Gets or sets the running game mode. + /// + public uint RunningGameMode { get; protected internal set; } + + /// + /// Enqueues a custom game mode for execution. + /// + /// The custom game mode to enqueue. + /// Whether to continuously enqueue the game mode. + public virtual void EnqueueGameMode(CustomGameMode customGameMode, bool continuously = false) + { + if (!customGameMode) + return; + + if (queueHandle.IsRunning) + Timing.KillCoroutines(queueHandle); + + enqueuedGameMode = customGameMode; + queueHandle = Timing.RunCoroutine(DequeueGameMode()); + } + + /// + /// Enqueues a custom game mode by its ID for execution. + /// + /// The ID of the custom game mode to enqueue. + /// Whether to continuously enqueue the game mode. + public virtual void EnqueueGameMode(object id, bool continuously = false) + { + if (!CustomGameMode.TryGet(id, out CustomGameMode gameMode)) + return; + + EnqueueGameMode(gameMode, continuously); + } + + /// + /// Clears the current game mode queue. + /// + public virtual void ClearQueue() + { + if (!enqueuedGameMode) + return; + + enqueuedGameMode = null; + } + + /// + /// Starts the execution of the enqueued game mode. + /// + /// The custom game mode to start. + /// Whether to force-start the game mode. + public virtual void Start(CustomGameMode customGameMode, bool isForced = false) + { + if (!isForced && customGameMode.Settings.MinimumPlayers < Server.PlayerCount) + return; + + AddComponent(enqueuedGameMode.GameState); + GameState.Start(isForced); + } + + /// + protected override void PostInitialize_Static() + { + if (enqueuedGameMode) + return; + + IEnumerable auto = CustomGameMode.Get(mode => mode.CanStartAuto); + + if (auto.IsEmpty()) + return; + + enqueuedGameMode = auto.Random(); + } + /// protected override void Tick() { @@ -39,5 +140,34 @@ protected override void Tick() CanEverTick = false; } + + /// + protected override void EndPlay_Static() + { + Timing.KillCoroutines(queueHandle); + } + + private void OnRoundStarted() + { + EnqueueGameMode(enqueuedGameMode); + } + + private IEnumerator DequeueGameMode() + { + for (; ;) + { + if (!enqueuedGameMode) + yield break; + + if (enqueuedGameMode.Settings.MinimumPlayers < Server.PlayerCount) + { + yield return Timing.WaitForSeconds(DequeueRate); + continue; + } + + Start(enqueuedGameMode, true); + ClearQueue(); + } + } } } \ No newline at end of file diff --git a/Exiled.CustomModules/API/Features/RespawnManager.cs b/Exiled.CustomModules/API/Features/RespawnManager.cs index fca52f033f..cdfc8e847a 100644 --- a/Exiled.CustomModules/API/Features/RespawnManager.cs +++ b/Exiled.CustomModules/API/Features/RespawnManager.cs @@ -5,8 +5,6 @@ // // ----------------------------------------------------------------------- -using Exiled.CustomModules.Events.EventArgs.CustomRoles; - namespace Exiled.CustomModules.API.Features { using System; @@ -25,6 +23,7 @@ namespace Exiled.CustomModules.API.Features using Exiled.CustomModules.API.Features.CustomRoles; using Exiled.CustomModules.API.Interfaces; using Exiled.CustomModules.Events.EventArgs.CustomItems; + using Exiled.CustomModules.Events.EventArgs.CustomRoles; using Exiled.CustomModules.Events.EventArgs.Tracking; using Exiled.Events.EventArgs.Map; using Exiled.Events.EventArgs.Player; @@ -45,7 +44,7 @@ public class RespawnManager : StaticActor /// Gets the which handles all delegates to be fired when selecting the next known team. /// [DynamicEventDispatcher] - public static TDynamicEventDispatcher SelectingCustomTeamRespawnDispatcher { get; private set; } + public TDynamicEventDispatcher SelectingCustomTeamRespawnDispatcher { get; private set; } /// /// Gets or sets the next known team. From 783883a546e595a6ad5921aa5dbed02533cd983a Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Sat, 3 Feb 2024 06:31:19 +0100 Subject: [PATCH 083/141] Added `ModuleType` enum. --- Exiled.CustomModules/API/Enums/ModuleType.cs | 45 ++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 Exiled.CustomModules/API/Enums/ModuleType.cs diff --git a/Exiled.CustomModules/API/Enums/ModuleType.cs b/Exiled.CustomModules/API/Enums/ModuleType.cs new file mode 100644 index 0000000000..2118cffa80 --- /dev/null +++ b/Exiled.CustomModules/API/Enums/ModuleType.cs @@ -0,0 +1,45 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.CustomModules.API.Enums +{ + /// + /// Enumerates the available module types. + /// + public enum ModuleType + { + /// + /// Custom items module. + /// + CustomItems, + + /// + /// Custom abilities module. + /// + CustomAbilities, + + /// + /// Custom escapes module. + /// + CustomEscapes, + + /// + /// Custom roles module. + /// + CustomRoles, + + /// + /// Custom teams module. + /// + CustomTeams, + + /// + /// Custom game modes module. + /// + CustomGameModes, + } +} \ No newline at end of file From 3cda8bf55fd0252ce1eb2500a427471aaefe36a2 Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Sat, 3 Feb 2024 06:31:42 +0100 Subject: [PATCH 084/141] Added `Config::Modules` property to allow independent module loading. --- Exiled.CustomModules/Config.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Exiled.CustomModules/Config.cs b/Exiled.CustomModules/Config.cs index 77a6e93fbd..207538ee47 100644 --- a/Exiled.CustomModules/Config.cs +++ b/Exiled.CustomModules/Config.cs @@ -10,6 +10,7 @@ namespace Exiled.CustomModules using System.ComponentModel; using Exiled.API.Interfaces; + using Exiled.CustomModules.API.Enums; /// /// The plugin's config. @@ -46,7 +47,15 @@ public class Config : IConfig ///
/// It negatively affects the performance in case of the presence of a big amount of plugins. ///
- [Description("Whether the automatic modules loader should be used")] + [Description("Whether the automatic modules loader should be used.")] public bool UseAutomaticModulesLoader { get; set; } + + /// + /// Gets or sets all modules to be loaded. + /// + [Description("The modules to be loaded.")] + public ModuleType[] Modules { get; set; } = new ModuleType[] + { + }; } } \ No newline at end of file From 8d627f4159fc9d17816f07b3ce370e20f3e72ce3 Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Sat, 3 Feb 2024 06:39:45 +0100 Subject: [PATCH 085/141] Added `UUCustomItemType` support. --- Exiled.CustomModules/API/Features/CustomItems/CustomItem.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Exiled.CustomModules/API/Features/CustomItems/CustomItem.cs b/Exiled.CustomModules/API/Features/CustomItems/CustomItem.cs index 780916b230..e7661a5d19 100644 --- a/Exiled.CustomModules/API/Features/CustomItems/CustomItem.cs +++ b/Exiled.CustomModules/API/Features/CustomItems/CustomItem.cs @@ -5,8 +5,6 @@ // // ----------------------------------------------------------------------- -using Exiled.CustomModules.API.Enums; - namespace Exiled.CustomModules.API.Features.CustomItems { using System; @@ -22,6 +20,7 @@ namespace Exiled.CustomModules.API.Features.CustomItems using Exiled.API.Features.Items; using Exiled.API.Features.Pickups; using Exiled.API.Features.Spawn; + using Exiled.CustomModules.API.Enums; using Exiled.CustomModules.API.Features.Attributes; using Exiled.CustomModules.API.Features.CustomEscapes; using Exiled.CustomModules.API.Features.CustomItems.Items; From 42a62e619af9570458708a5ea4aab6bde11d0dd5 Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Sat, 3 Feb 2024 06:43:19 +0100 Subject: [PATCH 086/141] Context: `CustomGameMode` class Added `CanStartAuto`, `GameState` and `PlayerStates` properties. Added a new overload to `Get(object)` method. Added a new overload to `Get(Func)` method. Added a new overload to `TryGet(object, ref CustomGameMode)` method. Added a check before loading the game mode in order to make sure a single `GameState` is defined, and at least one `PlayerState` is defined. --- .../CustomGamemodes/CustomGameMode.cs | 53 ++++++++++++++++++- 1 file changed, 52 insertions(+), 1 deletion(-) diff --git a/Exiled.CustomModules/API/Features/CustomGamemodes/CustomGameMode.cs b/Exiled.CustomModules/API/Features/CustomGamemodes/CustomGameMode.cs index dc2298794f..c07d3a1dea 100644 --- a/Exiled.CustomModules/API/Features/CustomGamemodes/CustomGameMode.cs +++ b/Exiled.CustomModules/API/Features/CustomGamemodes/CustomGameMode.cs @@ -16,7 +16,9 @@ namespace Exiled.CustomModules.API.Features.CustomGameModes using Exiled.API.Features; using Exiled.API.Features.Core; using Exiled.API.Features.Core.Interfaces; + using Exiled.CustomModules.API.Enums; using Exiled.CustomModules.API.Features.Attributes; + using Unity.Collections.LowLevel.Unsafe; /// /// Represents a custom game mode in the system, derived from and implementing . @@ -88,6 +90,40 @@ public abstract class CustomGameMode : CustomModule, IAdditiveBehaviours /// public virtual GameModeSettings Settings { get; } + /// + /// Gets a value indicating whether the game mode can start automatically based on the configured probability, if automatic. + /// + /// if the game mode can start automatically; otherwise, . + public bool CanStartAuto => Settings.Automatic && Settings.AutomaticProbability.EvaluateProbability(); + + /// + /// Gets the type of the game state. + /// + /// The custom game mode. + /// The type of the game state if found; otherwise, . + public Type GameState => BehaviourComponents.FirstOrDefault(comp => typeof(GameState).IsAssignableFrom(comp)); + + /// + /// Gets the types of the player states. + /// + /// The custom game mode. + /// The types of the player states if found; otherwise, empty. + public IEnumerable PlayerStates => BehaviourComponents.Where(comp => typeof(PlayerState).IsAssignableFrom(comp)); + + /// + /// Gets all instances based on the predicate. + /// + /// The predicate. + /// All instances matching the predicate. + public static IEnumerable Get(Func predicate) => List.Where(predicate); + + /// + /// Gets a based on the provided id or . + /// + /// The id or of the custom game mode. + /// The with the specified id, or if no game mode is found. + public static CustomGameMode Get(object id) => id is uint or UUGameModeType ? Get((uint)id) : null; + /// /// Gets a given the specified . /// @@ -125,6 +161,14 @@ public static CustomGameMode Get(Type type) => /// The matching the search or if not found. public static CustomGameMode Get(PlayerState playerState) => Get(playerState.GetType()); + /// + /// Attempts to retrieve a based on the provided id or . + /// + /// The id or of the custom game mode. + /// When this method returns, contains the associated with the specified id, if the id was found; otherwise, . + /// if a was found; otherwise, . + public static bool TryGet(object id, out CustomGameMode customGameMode) => customGameMode = Get(id); + /// /// Tries to get a given the specified . /// @@ -174,6 +218,13 @@ public static List EnableAll(Assembly assembly) if (!customGameMode.IsEnabled) continue; + if (customGameMode.BehaviourComponents.Count(comp => typeof(GameState).IsAssignableFrom(comp)) != 1 || customGameMode.PlayerStates.Count() <= 0) + { + Log.Error($"Failed to load the custom game mode.\n" + + $"The game mode \"{customGameMode.Name}\" should have exactly one GameState component and at least one PlayerState component defined."); + continue; + } + if (customGameMode.TryRegister(attribute)) customGameModes.Add(customGameMode); } @@ -191,7 +242,7 @@ public static List EnableAll(Assembly assembly) public static List DisableAll() { List customGameModes = new(); - customGameModes.AddRange(List.Where(customGamemode => customGamemode.TryUnregister())); + customGameModes.AddRange(List.Where(customGameMode => customGameMode.TryUnregister())); Log.Info($"{customGameModes.Count()} custom game modes have been successfully unregistered!"); From 8e1ef0aefec38c493c222c1732427b7e4efefc65 Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Sat, 3 Feb 2024 06:45:35 +0100 Subject: [PATCH 087/141] Added independent module loading. --- Exiled.CustomModules/CustomModules.cs | 34 ++++++++++++++++++--------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/Exiled.CustomModules/CustomModules.cs b/Exiled.CustomModules/CustomModules.cs index 5e6c6dda6b..0228c5d54c 100644 --- a/Exiled.CustomModules/CustomModules.cs +++ b/Exiled.CustomModules/CustomModules.cs @@ -7,10 +7,15 @@ namespace Exiled.CustomModules { + using System; + using System.Collections.Generic; + using System.Reflection; + using Exiled.API.Features; using Exiled.API.Features.Core; using Exiled.API.Features.Core.Generic; using Exiled.API.Interfaces; + using Exiled.CustomModules.API.Enums; using Exiled.CustomModules.API.Features; using Exiled.CustomModules.API.Features.CustomAbilities; using Exiled.CustomModules.API.Features.CustomEscapes; @@ -24,6 +29,16 @@ namespace Exiled.CustomModules ///
public class CustomModules : Plugin { + private static readonly Dictionary> ModulesLoader = new() + { + { ModuleType.CustomItems, asm => CustomItem.EnableAll(asm) }, + { ModuleType.CustomRoles, asm => CustomRole.EnableAll(asm) }, + { ModuleType.CustomAbilities, asm => CustomAbility.EnableAll(asm) }, + { ModuleType.CustomTeams, asm => CustomTeam.EnableAll(asm) }, + { ModuleType.CustomEscapes, asm => CustomEscape.EnableAll(asm) }, + { ModuleType.CustomGameModes, asm => CustomGameMode.EnableAll(asm) }, + }; + /// /// Gets a static reference to the plugin's instance. /// @@ -46,23 +61,19 @@ public override void OnEnabled() if (Config.UseAutomaticModulesLoader) { - foreach (IPlugin plugin in Loader.Loader.Plugins) - { - CustomItem.EnableAll(plugin.Assembly); - CustomRole.EnableAll(plugin.Assembly); - CustomAbility.EnableAll(plugin.Assembly); - CustomTeam.EnableAll(plugin.Assembly); - CustomEscape.EnableAll(plugin.Assembly); - CustomGameMode.EnableAll(plugin.Assembly); - } + foreach (IPlugin plugin in Exiled.Loader.Loader.Plugins) + Config.Modules.ForEach(module => ModulesLoader[module](plugin.Assembly)); } - if (Config.UseDefaultRoleAssigner) + if (Config.Modules.Contains(ModuleType.CustomRoles) && Config.UseDefaultRoleAssigner) StaticActor.CreateNewInstance(); - if (Config.UseDefaultRespawnManager) + if (Config.Modules.Contains(ModuleType.CustomTeams) && Config.UseDefaultRespawnManager) StaticActor.CreateNewInstance(); + if (Config.Modules.Contains(ModuleType.CustomGameModes)) + World.CreateNewInstance(); + SubscribeEvents(); base.OnEnabled(); @@ -73,6 +84,7 @@ public override void OnDisabled() { StaticActor.Get()?.Destroy(); StaticActor.Get()?.Destroy(); + World.Get().Destroy(); CustomItem.DisableAll(); CustomRole.DisableAll(); From 518df2aa0a4e1efd571fbfc665614763354442ac Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Sat, 3 Feb 2024 06:46:00 +0100 Subject: [PATCH 088/141] Minor changes --- .../Patches/{CustomItems => }/PlayerInventorySee.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename Exiled.CustomModules/Patches/{CustomItems => }/PlayerInventorySee.cs (98%) diff --git a/Exiled.CustomModules/Patches/CustomItems/PlayerInventorySee.cs b/Exiled.CustomModules/Patches/PlayerInventorySee.cs similarity index 98% rename from Exiled.CustomModules/Patches/CustomItems/PlayerInventorySee.cs rename to Exiled.CustomModules/Patches/PlayerInventorySee.cs index 0ece532bc1..bf9fa03cc7 100644 --- a/Exiled.CustomModules/Patches/CustomItems/PlayerInventorySee.cs +++ b/Exiled.CustomModules/Patches/PlayerInventorySee.cs @@ -5,7 +5,7 @@ // // ----------------------------------------------------------------------- -namespace Exiled.CustomModules.Patches.CustomItems +namespace Exiled.CustomModules.Patches { using System.Collections.Generic; using System.Reflection; From 71a0b51be622d7e44f1a8145078e22afa2c4558f Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Sat, 3 Feb 2024 06:49:23 +0100 Subject: [PATCH 089/141] Added `ItemTracker`, `PickupTracker` and `AbilityTracker` to loaded modules. --- .../API/Features/CustomAbilities/AbilityTracker.cs | 4 +--- .../API/Features/CustomAbilities/CustomAbility.cs | 3 +-- Exiled.CustomModules/CustomModules.cs | 11 +++++++++++ 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Exiled.CustomModules/API/Features/CustomAbilities/AbilityTracker.cs b/Exiled.CustomModules/API/Features/CustomAbilities/AbilityTracker.cs index 011d97f8fe..b14508264b 100644 --- a/Exiled.CustomModules/API/Features/CustomAbilities/AbilityTracker.cs +++ b/Exiled.CustomModules/API/Features/CustomAbilities/AbilityTracker.cs @@ -5,10 +5,8 @@ // // ----------------------------------------------------------------------- -namespace Exiled.CustomModules.API.Features +namespace Exiled.CustomModules.API.Features.CustomAbilities { - using Exiled.CustomModules.API.Features.CustomAbilities; - /// /// The actor which handles all tracking-related tasks for item abilities. /// diff --git a/Exiled.CustomModules/API/Features/CustomAbilities/CustomAbility.cs b/Exiled.CustomModules/API/Features/CustomAbilities/CustomAbility.cs index 9e6e64950d..522e451344 100644 --- a/Exiled.CustomModules/API/Features/CustomAbilities/CustomAbility.cs +++ b/Exiled.CustomModules/API/Features/CustomAbilities/CustomAbility.cs @@ -5,8 +5,6 @@ // // ----------------------------------------------------------------------- -using Exiled.CustomModules.API.Enums; - namespace Exiled.CustomModules.API.Features.CustomAbilities { using System; @@ -20,6 +18,7 @@ namespace Exiled.CustomModules.API.Features.CustomAbilities using Exiled.API.Features.Core; using Exiled.API.Features.Core.Interfaces; using Exiled.API.Features.DynamicEvents; + using Exiled.CustomModules.API.Enums; using Exiled.CustomModules.API.Features.Attributes; using Exiled.CustomModules.API.Features.CustomAbilities.Settings; using Exiled.CustomModules.API.Features.CustomEscapes; diff --git a/Exiled.CustomModules/CustomModules.cs b/Exiled.CustomModules/CustomModules.cs index 0228c5d54c..a6b307dffe 100644 --- a/Exiled.CustomModules/CustomModules.cs +++ b/Exiled.CustomModules/CustomModules.cs @@ -21,6 +21,8 @@ namespace Exiled.CustomModules using Exiled.CustomModules.API.Features.CustomEscapes; using Exiled.CustomModules.API.Features.CustomGameModes; using Exiled.CustomModules.API.Features.CustomItems; + using Exiled.CustomModules.API.Features.CustomItems.Items; + using Exiled.CustomModules.API.Features.CustomItems.Pickups; using Exiled.CustomModules.API.Features.CustomRoles; using Exiled.CustomModules.EventHandlers; @@ -74,6 +76,15 @@ public override void OnEnabled() if (Config.Modules.Contains(ModuleType.CustomGameModes)) World.CreateNewInstance(); + if (Config.Modules.Contains(ModuleType.CustomAbilities)) + StaticActor.CreateNewInstance(); + + if (Config.Modules.Contains(ModuleType.CustomItems)) + { + StaticActor.CreateNewInstance(); + StaticActor.CreateNewInstance(); + } + SubscribeEvents(); base.OnEnabled(); From 1e68a18d152190d3a88826907311b4ac9d127751 Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Sat, 3 Feb 2024 06:50:48 +0100 Subject: [PATCH 090/141] `AbilityTracker`, `ItemTracker` and `PickupTracker` now gets unloaded correctly. --- Exiled.CustomModules/CustomModules.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Exiled.CustomModules/CustomModules.cs b/Exiled.CustomModules/CustomModules.cs index a6b307dffe..e36d4b429e 100644 --- a/Exiled.CustomModules/CustomModules.cs +++ b/Exiled.CustomModules/CustomModules.cs @@ -93,9 +93,13 @@ public override void OnEnabled() /// public override void OnDisabled() { + World.Get().Destroy(); + StaticActor.Get()?.Destroy(); StaticActor.Get()?.Destroy(); - World.Get().Destroy(); + StaticActor.Get()?.Destroy(); + StaticActor.Get()?.Destroy(); + StaticActor.Get()?.Destroy(); CustomItem.DisableAll(); CustomRole.DisableAll(); From c5b2ff772021cdb590148dee89787ef611f2e12d Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Sat, 3 Feb 2024 07:26:03 +0100 Subject: [PATCH 091/141] Added new `IEntity` methods for removing components. --- Exiled.API/Features/Core/EActor.cs | 143 +++++++++++++++++- Exiled.API/Features/Core/GameEntity.cs | 143 +++++++++++++++++- .../Features/Core/Interfaces/IEntity.cs | 80 ++++++++++ 3 files changed, 364 insertions(+), 2 deletions(-) diff --git a/Exiled.API/Features/Core/EActor.cs b/Exiled.API/Features/Core/EActor.cs index 032f24dfcd..aec70bcb0d 100644 --- a/Exiled.API/Features/Core/EActor.cs +++ b/Exiled.API/Features/Core/EActor.cs @@ -11,12 +11,12 @@ namespace Exiled.API.Features.Core using System.Collections.Generic; using System.Linq; + using Exiled.API.Extensions; using Exiled.API.Features.Core.Components; using Exiled.API.Features.Core.Generic.Pools; using Exiled.API.Features.Core.Interfaces; using Exiled.API.Features.DynamicEvents; using Exiled.API.Interfaces; - using MEC; using UnityEngine; @@ -257,6 +257,147 @@ public IEnumerable AddComponents(IEnumerable types) yield return AddComponent(type); } + /// + public T RemoveComponent(string name = "") + where T : EActor + { + T comp = null; + + if (string.IsNullOrEmpty(name)) + { + if (!TryGetComponent(out comp)) + return null; + + comp.Base = null; + componentsInChildren.Remove(comp); + return comp; + } + + foreach (EActor actor in GetComponents()) + { + if (actor.Name != name) + continue; + + comp = actor.Cast(); + } + + return comp; + } + + /// + public T RemoveComponent(EActor actor, string name = "") + where T : EActor + { + T comp = null; + + if (string.IsNullOrEmpty(name)) + { + if (!TryGetComponent(out comp) || comp != actor) + return null; + + comp.Base = null; + componentsInChildren.Remove(comp); + return comp; + } + + foreach (EActor component in GetComponents()) + { + if (component.Name != name && component == actor) + continue; + + comp = component.Cast(); + } + + return comp; + } + + /// + public EActor RemoveComponent(Type type, string name = "") + { + EActor comp = null; + + if (string.IsNullOrEmpty(name)) + { + if (!TryGetComponent(type, out comp)) + return null; + + comp.Base = null; + componentsInChildren.Remove(comp); + return comp; + } + + foreach (EActor actor in GetComponents(type)) + { + if (actor.Name != name) + continue; + + comp = actor; + } + + return comp; + } + + /// + public EActor RemoveComponent(EActor actor, string name = "") + { + if (!componentsInChildren.Contains(actor)) + return null; + + if (string.IsNullOrEmpty(name)) + { + actor.Base = null; + componentsInChildren.Remove(actor); + return actor; + } + + foreach (EActor component in componentsInChildren) + { + if (component != actor || actor.Name != name) + continue; + + actor = component; + } + + return actor; + } + + /// + public IEnumerable RemoveComponentOfType(string name = "") + where T : EActor + { + IEnumerable components = GetComponents(); + + foreach (T comp in components) + RemoveComponent(comp, name); + + return components; + } + + /// + public IEnumerable RemoveComponentOfType(Type type, string name = "") + { + IEnumerable components = GetComponents(type); + + foreach (EActor comp in components) + RemoveComponent(comp, name); + + return components; + } + + /// + public void RemoveComponents(IEnumerable types) => types.ForEach(type => RemoveComponent(type)); + + /// + public void RemoveComponents(IEnumerable actors) => actors.ForEach(actor => RemoveComponent(actor)); + + /// + public void RemoveComponents(IEnumerable actors) + where T : EActor => actors.ForEach(actor => RemoveComponent(actor)); + + /// + public void RemoveComponents(IEnumerable types) + where T : EActor => types.ForEach(type => RemoveComponent(type)); + /// public EActor GetComponent(Type type) => ComponentsInChildren.FirstOrDefault(comp => type == comp.GetType()); diff --git a/Exiled.API/Features/Core/GameEntity.cs b/Exiled.API/Features/Core/GameEntity.cs index 769c08a306..25588656f0 100644 --- a/Exiled.API/Features/Core/GameEntity.cs +++ b/Exiled.API/Features/Core/GameEntity.cs @@ -11,8 +11,8 @@ namespace Exiled.API.Features.Core using System.Collections.Generic; using System.Linq; + using Exiled.API.Extensions; using Exiled.API.Features.Core.Interfaces; - using UnityEngine; /// @@ -129,6 +129,147 @@ public IEnumerable AddComponents(IEnumerable types) yield return AddComponent(type); } + /// + public T RemoveComponent(string name = "") + where T : EActor + { + T comp = null; + + if (string.IsNullOrEmpty(name)) + { + if (!TryGetComponent(out comp)) + return null; + + comp.Base = null; + componentsInChildren.Remove(comp); + return comp; + } + + foreach (EActor actor in GetComponents()) + { + if (actor.Name != name) + continue; + + comp = actor.Cast(); + } + + return comp; + } + + /// + public T RemoveComponent(EActor actor, string name = "") + where T : EActor + { + T comp = null; + + if (string.IsNullOrEmpty(name)) + { + if (!TryGetComponent(out comp) || comp != actor) + return null; + + comp.Base = null; + componentsInChildren.Remove(comp); + return comp; + } + + foreach (EActor component in GetComponents()) + { + if (component.Name != name && component == actor) + continue; + + comp = component.Cast(); + } + + return comp; + } + + /// + public EActor RemoveComponent(Type type, string name = "") + { + EActor comp = null; + + if (string.IsNullOrEmpty(name)) + { + if (!TryGetComponent(type, out comp)) + return null; + + comp.Base = null; + componentsInChildren.Remove(comp); + return comp; + } + + foreach (EActor actor in GetComponents(type)) + { + if (actor.Name != name) + continue; + + comp = actor; + } + + return comp; + } + + /// + public EActor RemoveComponent(EActor actor, string name = "") + { + if (!componentsInChildren.Contains(actor)) + return null; + + if (string.IsNullOrEmpty(name)) + { + actor.Base = null; + componentsInChildren.Remove(actor); + return actor; + } + + foreach (EActor component in componentsInChildren) + { + if (component != actor || actor.Name != name) + continue; + + actor = component; + } + + return actor; + } + + /// + public IEnumerable RemoveComponentOfType(string name = "") + where T : EActor + { + IEnumerable components = GetComponents(); + + foreach (T comp in components) + RemoveComponent(comp, name); + + return components; + } + + /// + public IEnumerable RemoveComponentOfType(Type type, string name = "") + { + IEnumerable components = GetComponents(type); + + foreach (EActor comp in components) + RemoveComponent(comp, name); + + return components; + } + + /// + public void RemoveComponents(IEnumerable types) => types.ForEach(type => RemoveComponent(type)); + + /// + public void RemoveComponents(IEnumerable actors) => actors.ForEach(actor => RemoveComponent(actor)); + + /// + public void RemoveComponents(IEnumerable actors) + where T : EActor => actors.ForEach(actor => RemoveComponent(actor)); + + /// + public void RemoveComponents(IEnumerable types) + where T : EActor => types.ForEach(type => RemoveComponent(type)); + /// public T GetComponent() where T : EActor => componentsInChildren.FirstOrDefault(comp => typeof(T) == comp.GetType()).Cast(); diff --git a/Exiled.API/Features/Core/Interfaces/IEntity.cs b/Exiled.API/Features/Core/Interfaces/IEntity.cs index 0b3e7beedc..aee4dadee8 100644 --- a/Exiled.API/Features/Core/Interfaces/IEntity.cs +++ b/Exiled.API/Features/Core/Interfaces/IEntity.cs @@ -97,6 +97,86 @@ public abstract IEnumerable AddComponents(IEnumerable actors) public abstract IEnumerable AddComponents(IEnumerable types) where T : EActor; + /// + /// Removes a component from the . + /// + /// The to be removed. + /// The name of the component. + /// The removed component. + public abstract T RemoveComponent(string name = "") + where T : EActor; + + /// + /// Removes a component from the . + /// + /// The cast type. + /// The to be removed. + /// The name of the component. + /// The removed component. + public abstract T RemoveComponent(EActor actor, string name = "") + where T : EActor; + + /// + /// Removes a component from the . + /// + /// The of the to be removed. + /// The name of the component. + /// The removed component. + public abstract EActor RemoveComponent(Type type, string name = ""); + + /// + /// Removes a component from the . + /// + /// The to be removed. + /// The name of the component. + /// The removed component. + public abstract EActor RemoveComponent(EActor actor, string name = ""); + + /// + /// Removes all components of the specified type from the . + /// + /// The type to be removed. + /// The name of the component. + /// The removed components. + public abstract IEnumerable RemoveComponentOfType(string name = "") + where T : EActor; + + /// + /// Removes all components of the specified type from the . + /// + /// The of the to be removed. + /// The name of the component. + /// The removed components. + public abstract IEnumerable RemoveComponentOfType(Type type, string name = ""); + + /// + /// Removes multiple components from the . + /// + /// The collection of representing the components to be removed. + public abstract void RemoveComponents(IEnumerable types); + + /// + /// Removes multiple components from the . + /// + /// The collection of instances to be removed. + public abstract void RemoveComponents(IEnumerable actors); + + /// + /// Removes multiple components from the . + /// + /// The type to be removed. + /// The collection of instances to be removed. + public abstract void RemoveComponents(IEnumerable actors) + where T : EActor; + + /// + /// Removes multiple components from the . + /// + /// The type to be removed. + /// The collection of representing the components to be removed. + public abstract void RemoveComponents(IEnumerable types) + where T : EActor; + /// /// Gets a component from the . /// From 433cea96316bf3b104201726fd71f860c30bb303 Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Sat, 3 Feb 2024 07:26:39 +0100 Subject: [PATCH 092/141] Added `StaticActor::Base` will be now initialized, if possible, to `Server::Host::GameObject`. --- Exiled.API/Features/Core/Generic/StaticActor.cs | 4 ++++ Exiled.API/Features/Core/StaticActor.cs | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/Exiled.API/Features/Core/Generic/StaticActor.cs b/Exiled.API/Features/Core/Generic/StaticActor.cs index 90019ede23..917658b1e3 100644 --- a/Exiled.API/Features/Core/Generic/StaticActor.cs +++ b/Exiled.API/Features/Core/Generic/StaticActor.cs @@ -61,6 +61,10 @@ public static T CreateNewInstance() { EObject @object = CreateDefaultSubobject(); @object.Name = "__" + typeof(T).Name + " (StaticActor)"; + + if (Server.Host.GameObject) + @object.Base = Server.Host.GameObject; + return @object.Cast(); } diff --git a/Exiled.API/Features/Core/StaticActor.cs b/Exiled.API/Features/Core/StaticActor.cs index b47b48841d..93860a2ef5 100644 --- a/Exiled.API/Features/Core/StaticActor.cs +++ b/Exiled.API/Features/Core/StaticActor.cs @@ -56,6 +56,10 @@ public static StaticActor CreateNewInstance(Type type) { EObject @object = CreateDefaultSubobject(type); @object.Name = "__" + type.Name + " (StaticActor)"; + + if (Server.Host.GameObject) + @object.Base = Server.Host.GameObject; + return @object.Cast(); } From 489554da5529f7f9f30850089bfd40a6dbb0e2a5 Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Sat, 3 Feb 2024 07:27:21 +0100 Subject: [PATCH 093/141] `World` now removes and destroys the previous game mode before starting a new one. --- Exiled.CustomModules/API/Features/CustomGamemodes/World.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Exiled.CustomModules/API/Features/CustomGamemodes/World.cs b/Exiled.CustomModules/API/Features/CustomGamemodes/World.cs index 1834bce4f8..520dc65069 100644 --- a/Exiled.CustomModules/API/Features/CustomGamemodes/World.cs +++ b/Exiled.CustomModules/API/Features/CustomGamemodes/World.cs @@ -109,6 +109,9 @@ public virtual void Start(CustomGameMode customGameMode, bool isForced = false) if (!isForced && customGameMode.Settings.MinimumPlayers < Server.PlayerCount) return; + if (GameState) + RemoveComponent(GameState).Destroy(); + AddComponent(enqueuedGameMode.GameState); GameState.Start(isForced); } From ac7e1389b33bb33004ada5533eaca2cffa9938f8 Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Sat, 3 Feb 2024 07:30:05 +0100 Subject: [PATCH 094/141] `World::ClearQueue` hotfix --- Exiled.CustomModules/API/Features/CustomGamemodes/World.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Exiled.CustomModules/API/Features/CustomGamemodes/World.cs b/Exiled.CustomModules/API/Features/CustomGamemodes/World.cs index 520dc65069..1b47bcbc08 100644 --- a/Exiled.CustomModules/API/Features/CustomGamemodes/World.cs +++ b/Exiled.CustomModules/API/Features/CustomGamemodes/World.cs @@ -5,6 +5,8 @@ // // ----------------------------------------------------------------------- +using Exiled.API.Features.Core; + namespace Exiled.CustomModules.API.Features.CustomGameModes { using System.Collections.Generic; @@ -96,6 +98,9 @@ public virtual void ClearQueue() if (!enqueuedGameMode) return; + if (TryGetComponent(enqueuedGameMode.GameState, out EActor comp)) + comp.Destroy(); + enqueuedGameMode = null; } From fffad51191478a62be98c7cb9bb7530ec12c6605 Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Sat, 3 Feb 2024 07:31:47 +0100 Subject: [PATCH 095/141] Mad using --- Exiled.CustomModules/API/Features/CustomGamemodes/World.cs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Exiled.CustomModules/API/Features/CustomGamemodes/World.cs b/Exiled.CustomModules/API/Features/CustomGamemodes/World.cs index 1b47bcbc08..6bcc6d8f77 100644 --- a/Exiled.CustomModules/API/Features/CustomGamemodes/World.cs +++ b/Exiled.CustomModules/API/Features/CustomGamemodes/World.cs @@ -5,13 +5,12 @@ // // ----------------------------------------------------------------------- -using Exiled.API.Features.Core; - namespace Exiled.CustomModules.API.Features.CustomGameModes { using System.Collections.Generic; using Exiled.API.Extensions; + using Exiled.API.Features.Core; using Exiled.API.Features.Core.Generic; using Exiled.CustomModules.API.Enums; using MEC; From 4b3bc55d7fb5917168cf5e9e9321950ccde77bbb Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Sat, 3 Feb 2024 07:40:53 +0100 Subject: [PATCH 096/141] Added a check to all module's `EnableAll` method. --- .../API/Features/CustomAbilities/CustomAbility.cs | 3 +++ .../API/Features/CustomEscapes/CustomEscape.cs | 3 +++ .../API/Features/CustomGamemodes/CustomGameMode.cs | 3 +++ Exiled.CustomModules/API/Features/CustomItems/CustomItem.cs | 3 +++ Exiled.CustomModules/API/Features/CustomRoles/CustomRole.cs | 3 +++ Exiled.CustomModules/API/Features/CustomRoles/CustomTeam.cs | 3 +++ 6 files changed, 18 insertions(+) diff --git a/Exiled.CustomModules/API/Features/CustomAbilities/CustomAbility.cs b/Exiled.CustomModules/API/Features/CustomAbilities/CustomAbility.cs index 522e451344..cfe1e55cc4 100644 --- a/Exiled.CustomModules/API/Features/CustomAbilities/CustomAbility.cs +++ b/Exiled.CustomModules/API/Features/CustomAbilities/CustomAbility.cs @@ -481,6 +481,9 @@ public static void RemoveRange(T entity, IEnumerable ids) /// A of which contains all the enabled custom abilities. public static IEnumerable> EnableAll(Assembly assembly) { + if (!CustomModules.Instance.Config.Modules.Contains(ModuleType.CustomAbilities)) + throw new Exception("ModuleType::CustomAbilities must be enabled in order to load any custom abilities"); + List> customAbilities = new(); foreach (Type type in assembly.GetTypes()) { diff --git a/Exiled.CustomModules/API/Features/CustomEscapes/CustomEscape.cs b/Exiled.CustomModules/API/Features/CustomEscapes/CustomEscape.cs index b1ba66f78c..21287bb716 100644 --- a/Exiled.CustomModules/API/Features/CustomEscapes/CustomEscape.cs +++ b/Exiled.CustomModules/API/Features/CustomEscapes/CustomEscape.cs @@ -183,6 +183,9 @@ public static CustomEscape Get(Type type) => /// A of containing all enabled custom escapes. public static List EnableAll(Assembly assembly) { + if (!CustomModules.Instance.Config.Modules.Contains(ModuleType.CustomEscapes)) + throw new Exception("ModuleType::CustomEscapes must be enabled in order to load any custom escapes"); + List customEscapes = new(); foreach (Type type in assembly.GetTypes()) { diff --git a/Exiled.CustomModules/API/Features/CustomGamemodes/CustomGameMode.cs b/Exiled.CustomModules/API/Features/CustomGamemodes/CustomGameMode.cs index c07d3a1dea..4c5e797c99 100644 --- a/Exiled.CustomModules/API/Features/CustomGamemodes/CustomGameMode.cs +++ b/Exiled.CustomModules/API/Features/CustomGamemodes/CustomGameMode.cs @@ -206,6 +206,9 @@ public static CustomGameMode Get(Type type) => /// A of containing all enabled custom game modes. public static List EnableAll(Assembly assembly) { + if (!CustomModules.Instance.Config.Modules.Contains(ModuleType.CustomGameModes)) + throw new Exception("ModuleType::CustomGameModes must be enabled in order to load any custom game modes"); + List customGameModes = new(); foreach (Type type in assembly.GetTypes()) { diff --git a/Exiled.CustomModules/API/Features/CustomItems/CustomItem.cs b/Exiled.CustomModules/API/Features/CustomItems/CustomItem.cs index e7661a5d19..abb6dad8f8 100644 --- a/Exiled.CustomModules/API/Features/CustomItems/CustomItem.cs +++ b/Exiled.CustomModules/API/Features/CustomItems/CustomItem.cs @@ -380,6 +380,9 @@ public static bool TryGive(Player player, Type type, bool displayMessage = true) /// public static List EnableAll(Assembly assembly) { + if (!CustomModules.Instance.Config.Modules.Contains(ModuleType.CustomItems)) + throw new Exception("ModuleType::CustomItems must be enabled in order to load any custom items"); + List customItems = new(); foreach (Type type in assembly.GetTypes()) { diff --git a/Exiled.CustomModules/API/Features/CustomRoles/CustomRole.cs b/Exiled.CustomModules/API/Features/CustomRoles/CustomRole.cs index 57c18c3a95..8eb6e676fa 100644 --- a/Exiled.CustomModules/API/Features/CustomRoles/CustomRole.cs +++ b/Exiled.CustomModules/API/Features/CustomRoles/CustomRole.cs @@ -587,6 +587,9 @@ public static void Remove(IEnumerable players) /// public static List EnableAll(Assembly assembly) { + if (!CustomModules.Instance.Config.Modules.Contains(ModuleType.CustomRoles)) + throw new Exception("ModuleType::CustomRoles must be enabled in order to load any custom roles"); + List customRoles = new(); foreach (Type type in assembly.GetTypes()) { diff --git a/Exiled.CustomModules/API/Features/CustomRoles/CustomTeam.cs b/Exiled.CustomModules/API/Features/CustomRoles/CustomTeam.cs index 7ab00efd10..1b0ac86a32 100644 --- a/Exiled.CustomModules/API/Features/CustomRoles/CustomTeam.cs +++ b/Exiled.CustomModules/API/Features/CustomRoles/CustomTeam.cs @@ -459,6 +459,9 @@ public static bool TrySpawn(int amount, uint id) /// A of which contains all the enabled custom teams. public static IEnumerable EnableAll(Assembly assembly) { + if (!CustomModules.Instance.Config.Modules.Contains(ModuleType.CustomTeams)) + throw new Exception("ModuleType::CustomTeams must be enabled in order to load any custom teams"); + List customTeams = new(); foreach (Type type in assembly.GetTypes()) { From fa21abb99f6780a10f5bd315add5553c92efee32 Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Sat, 3 Feb 2024 08:27:38 +0100 Subject: [PATCH 097/141] Added `ChangingCustomRole` event. --- .../API/Features/CustomRoles/CustomRole.cs | 84 +++++++++++++++++-- .../API/Features/CustomRoles/CustomTeam.cs | 5 +- .../ChangingCustomRoleEventArgs.cs | 50 +++++++++++ 3 files changed, 130 insertions(+), 9 deletions(-) create mode 100644 Exiled.CustomModules/Events/EventArgs/CustomRoles/ChangingCustomRoleEventArgs.cs diff --git a/Exiled.CustomModules/API/Features/CustomRoles/CustomRole.cs b/Exiled.CustomModules/API/Features/CustomRoles/CustomRole.cs index 8eb6e676fa..9d8327c7ed 100644 --- a/Exiled.CustomModules/API/Features/CustomRoles/CustomRole.cs +++ b/Exiled.CustomModules/API/Features/CustomRoles/CustomRole.cs @@ -15,11 +15,14 @@ namespace Exiled.CustomModules.API.Features.CustomRoles using Exiled.API.Enums; using Exiled.API.Extensions; using Exiled.API.Features; + using Exiled.API.Features.Attributes; using Exiled.API.Features.Core; using Exiled.API.Features.Core.Interfaces; + using Exiled.API.Features.DynamicEvents; using Exiled.CustomModules.API.Enums; using Exiled.CustomModules.API.Features.Attributes; using Exiled.CustomModules.API.Features.CustomEscapes; + using Exiled.CustomModules.Events.EventArgs.CustomRoles; using MEC; using PlayerRoles; using Respawning; @@ -43,6 +46,12 @@ public abstract class CustomRole : CustomModule, IAdditiveBehaviour private static readonly Dictionary IdLookupTable = new(); private static readonly Dictionary NameLookupTable = new(); + /// + /// Gets or sets the which handles all delegates to be fired before a player changes role. + /// + [DynamicEventDispatcher] + public static TDynamicEventDispatcher ChangingCustomRoleDispatcher { get; protected set; } + /// /// Gets a which contains all registered 's. /// @@ -649,12 +658,32 @@ public bool Spawn(Pawn player) if (player.IsAlive) return false; - player.AddComponent(BehaviourComponent); - PlayersValue.Remove(player); - PlayersValue.Add(player, this); - Instances += 1; + ChangingCustomRoleEventArgs ev = new(player, Id); + ChangingCustomRoleDispatcher.InvokeAll(ev); - return true; + if (!ev.IsAllowed) + return false; + + player = ev.Player.Cast(); + if (ev.Role is RoleTypeId rId) + { + player.SetRole(rId); + return true; + } + + if (!CustomRole.TryGet(ev.Role, out CustomRole role)) + return false; + + if (role.Id == Id) + { + player.AddComponent(BehaviourComponent); + PlayersValue.Remove(player); + PlayersValue.Add(player, this); + Instances += 1; + return true; + } + + return role.Spawn(player); } /// @@ -680,6 +709,28 @@ public bool Spawn(Pawn player) /// public void ForceSpawn(Pawn player) { + ChangingCustomRoleEventArgs ev = new(player, Id); + ChangingCustomRoleDispatcher.InvokeAll(ev); + + if (!ev.IsAllowed) + return; + + player = ev.Player.Cast(); + if (ev.Role is RoleTypeId rId) + { + player.SetRole(rId); + return; + } + + if (!CustomRole.TryGet(ev.Role, out CustomRole role)) + return; + + if (role.Id != Id) + { + role.ForceSpawn(player); + return; + } + Remove(player); PlayersValue.Add(player, this); @@ -705,6 +756,28 @@ public void ForceSpawn(Pawn player) /// public void ForceSpawn(Pawn player, bool preservePosition) { + ChangingCustomRoleEventArgs ev = new(player, Id); + ChangingCustomRoleDispatcher.InvokeAll(ev); + + if (!ev.IsAllowed) + return; + + player = ev.Player.Cast(); + if (ev.Role is RoleTypeId rId) + { + player.SetRole(rId); + return; + } + + if (!CustomRole.TryGet(ev.Role, out CustomRole role)) + return; + + if (role.Id != Id) + { + role.ForceSpawn(player, preservePosition); + return; + } + PlayersValue.Remove(player); PlayersValue.Add(player, this); @@ -754,6 +827,7 @@ public void ForceSpawn(Pawn player, bool preservePosition) /// public bool Eject(Pawn player) { + Round.IgnoredPlayers.Remove(player); PlayersValue.Remove(player); Instances -= 1; diff --git a/Exiled.CustomModules/API/Features/CustomRoles/CustomTeam.cs b/Exiled.CustomModules/API/Features/CustomRoles/CustomTeam.cs index 1b0ac86a32..3ce45a322d 100644 --- a/Exiled.CustomModules/API/Features/CustomRoles/CustomTeam.cs +++ b/Exiled.CustomModules/API/Features/CustomRoles/CustomTeam.cs @@ -227,11 +227,8 @@ public virtual bool EvaluateConditions public virtual uint RequiredCustomRoleToSpawn { get; } /// - /// Gets the required leading teams for this to win. + /// Gets the teams the belongs to. /// - /// - /// This property specifies the teams the belongs to. - /// public virtual Team[] TeamsOwnership { get; } = { }; /// diff --git a/Exiled.CustomModules/Events/EventArgs/CustomRoles/ChangingCustomRoleEventArgs.cs b/Exiled.CustomModules/Events/EventArgs/CustomRoles/ChangingCustomRoleEventArgs.cs new file mode 100644 index 0000000000..1d08e0d43f --- /dev/null +++ b/Exiled.CustomModules/Events/EventArgs/CustomRoles/ChangingCustomRoleEventArgs.cs @@ -0,0 +1,50 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.CustomModules.Events.EventArgs.CustomRoles +{ + using System.Collections.Generic; + + using API.Enums; + using Exiled.API.Features; + using Exiled.CustomModules.API.Features; + using Exiled.Events.EventArgs.Interfaces; + using PlayerRoles; + + /// + /// Contains all information before a player changes role to a custom role. + /// + public class ChangingCustomRoleEventArgs : IExiledEvent, IPlayerEvent, IDeniableEvent + { + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// + public ChangingCustomRoleEventArgs(Player player, object role, bool isAllowed = true) + { + } + + /// + /// Gets or sets the player who's changing role. + /// + public Player Player { get; set; } + + /// + /// Gets or sets the role to be changed to. + /// + /// Supports both roles and custom roles. + /// + public object Role { get; set; } + + /// + /// Gets or sets a value indicating whether the player can change role. + /// + public bool IsAllowed { get; set; } + } +} \ No newline at end of file From 64bf1876ed8f3125834a023ac42b0c111e4261d2 Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Sat, 3 Feb 2024 08:29:24 +0100 Subject: [PATCH 098/141] Missing `cctor` init --- .../EventArgs/CustomRoles/ChangingCustomRoleEventArgs.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Exiled.CustomModules/Events/EventArgs/CustomRoles/ChangingCustomRoleEventArgs.cs b/Exiled.CustomModules/Events/EventArgs/CustomRoles/ChangingCustomRoleEventArgs.cs index 1d08e0d43f..edcfe38ff3 100644 --- a/Exiled.CustomModules/Events/EventArgs/CustomRoles/ChangingCustomRoleEventArgs.cs +++ b/Exiled.CustomModules/Events/EventArgs/CustomRoles/ChangingCustomRoleEventArgs.cs @@ -28,6 +28,9 @@ public class ChangingCustomRoleEventArgs : IExiledEvent, IPlayerEvent, IDeniable /// public ChangingCustomRoleEventArgs(Player player, object role, bool isAllowed = true) { + Player = player; + Role = role; + IsAllowed = isAllowed; } /// From bd0894b9550fd48de7a631e335adcb4d94fcbef2 Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Sat, 3 Feb 2024 09:25:11 +0100 Subject: [PATCH 099/141] Added `ChangedCustomRole` event. --- .../API/Features/CustomRoles/CustomRole.cs | 48 ++++++++++++++----- .../CustomRoles/ChangedCustomRoleEventArgs.cs | 44 +++++++++++++++++ 2 files changed, 81 insertions(+), 11 deletions(-) create mode 100644 Exiled.CustomModules/Events/EventArgs/CustomRoles/ChangedCustomRoleEventArgs.cs diff --git a/Exiled.CustomModules/API/Features/CustomRoles/CustomRole.cs b/Exiled.CustomModules/API/Features/CustomRoles/CustomRole.cs index 9d8327c7ed..43f279d5fa 100644 --- a/Exiled.CustomModules/API/Features/CustomRoles/CustomRole.cs +++ b/Exiled.CustomModules/API/Features/CustomRoles/CustomRole.cs @@ -52,6 +52,12 @@ public abstract class CustomRole : CustomModule, IAdditiveBehaviour [DynamicEventDispatcher] public static TDynamicEventDispatcher ChangingCustomRoleDispatcher { get; protected set; } + /// + /// Gets or sets the which handles all delegates to be fired after a player changes role. + /// + [DynamicEventDispatcher] + public static TDynamicEventDispatcher ChangedCustomRoleDispatcher { get; protected set; } + /// /// Gets a which contains all registered 's. /// @@ -674,16 +680,20 @@ public bool Spawn(Pawn player) if (!CustomRole.TryGet(ev.Role, out CustomRole role)) return false; - if (role.Id == Id) - { - player.AddComponent(BehaviourComponent); - PlayersValue.Remove(player); - PlayersValue.Add(player, this); - Instances += 1; - return true; - } + if (role.Id != Id) + return role.Spawn(player); + + object prevRole = player.CustomRole ? player.CustomRole.Id : player.Role.Type; + player.AddComponent(BehaviourComponent); + PlayersValue.Remove(player); + PlayersValue.Add(player, this); + Instances += 1; + + ChangedCustomRoleEventArgs @event = new(player, prevRole); + ChangedCustomRoleDispatcher.InvokeAll(@event); + + return true; - return role.Spawn(player); } /// @@ -731,17 +741,25 @@ public void ForceSpawn(Pawn player) return; } + object prevRole = player.CustomRole ? player.CustomRole.Id : player.Role.Type; Remove(player); PlayersValue.Add(player, this); if (!player.IsAlive) { ForceSpawn_Internal(player, false); + ChangedCustomRoleEventArgs @event = new(player, prevRole); + ChangedCustomRoleDispatcher.InvokeAll(@event); return; } player.Role.Set(RoleTypeId.Spectator, SpawnReason.Respawn); - Timing.CallDelayed(0.1f, () => ForceSpawn_Internal(player, false)); + Timing.CallDelayed(0.1f, () => + { + ForceSpawn_Internal(player, false); + ChangedCustomRoleEventArgs @event = new(player, prevRole); + ChangedCustomRoleDispatcher.InvokeAll(@event); + }); } /// @@ -778,17 +796,25 @@ public void ForceSpawn(Pawn player, bool preservePosition) return; } + object prevRole = player.CustomRole ? player.CustomRole.Id : player.Role.Type; PlayersValue.Remove(player); PlayersValue.Add(player, this); if (!player.IsAlive) { ForceSpawn_Internal(player, preservePosition); + ChangedCustomRoleEventArgs @event = new(player, prevRole); + ChangedCustomRoleDispatcher.InvokeAll(@event); return; } player.Role.Set(RoleTypeId.Spectator, SpawnReason.Respawn); - Timing.CallDelayed(0.1f, () => ForceSpawn_Internal(player, preservePosition)); + Timing.CallDelayed(0.1f, () => + { + ForceSpawn_Internal(player, preservePosition); + ChangedCustomRoleEventArgs @event = new(player, prevRole); + ChangedCustomRoleDispatcher.InvokeAll(@event); + }); } /// diff --git a/Exiled.CustomModules/Events/EventArgs/CustomRoles/ChangedCustomRoleEventArgs.cs b/Exiled.CustomModules/Events/EventArgs/CustomRoles/ChangedCustomRoleEventArgs.cs new file mode 100644 index 0000000000..3a3e20ac66 --- /dev/null +++ b/Exiled.CustomModules/Events/EventArgs/CustomRoles/ChangedCustomRoleEventArgs.cs @@ -0,0 +1,44 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.CustomModules.Events.EventArgs.CustomRoles +{ + using System.Collections.Generic; + + using API.Enums; + using Exiled.API.Features; + using Exiled.CustomModules.API.Features; + using Exiled.Events.EventArgs.Interfaces; + using PlayerRoles; + + /// + /// Contains all information after a player changes role to a custom role. + /// + public class ChangedCustomRoleEventArgs : IExiledEvent, IPlayerEvent + { + /// + /// Initializes a new instance of the class. + /// + /// + /// + public ChangedCustomRoleEventArgs(Player player, object role) + { + Player = player; + Role = role; + } + + /// + /// Gets the player who changed role. + /// + public Player Player { get; } + + /// + /// Gets the previous role. + /// + public object Role { get; } + } +} \ No newline at end of file From 0bbf653376fe600cc8eb33a387d7dab28365f923 Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Sat, 3 Feb 2024 09:25:24 +0100 Subject: [PATCH 100/141] Added `CustomModules::IsModuleLoaded(ModuleType)` method. --- Exiled.CustomModules/CustomModules.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Exiled.CustomModules/CustomModules.cs b/Exiled.CustomModules/CustomModules.cs index e36d4b429e..ff49af8f4f 100644 --- a/Exiled.CustomModules/CustomModules.cs +++ b/Exiled.CustomModules/CustomModules.cs @@ -56,6 +56,13 @@ public class CustomModules : Plugin /// internal ServerHandler ServerHandler { get; private set; } + /// + /// Gets a value indicating whether the specified module is loaded. + /// + /// The module to check. + /// if the module is loaded; otherwise, . + public static bool IsModuleLoaded(ModuleType module) => Instance.Config.Modules.Contains(module); + /// public override void OnEnabled() { From 0f1983b7b2a195dcb0c85e26e8f5efc69e1d6e85 Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Sat, 3 Feb 2024 09:25:38 +0100 Subject: [PATCH 101/141] Added `SummaryInfo` struct. --- .../API/Features/CustomRoles/SummaryInfo.cs | 111 ++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 Exiled.CustomModules/API/Features/CustomRoles/SummaryInfo.cs diff --git a/Exiled.CustomModules/API/Features/CustomRoles/SummaryInfo.cs b/Exiled.CustomModules/API/Features/CustomRoles/SummaryInfo.cs new file mode 100644 index 0000000000..6c3b952fd0 --- /dev/null +++ b/Exiled.CustomModules/API/Features/CustomRoles/SummaryInfo.cs @@ -0,0 +1,111 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.CustomModules.API.Features.CustomRoles +{ + using System.Collections.Generic; + + using Exiled.API.Enums; + using Exiled.API.Extensions; + using Exiled.API.Features; + using Exiled.API.Features.Core; + using Exiled.API.Features.Core.Interfaces; + using Exiled.API.Features.Roles; + using Exiled.API.Features.Spawn; + using PlayerRoles; + + /// + /// A tool to easily manage summary info. + /// + public struct SummaryInfo + { + /// + /// The foundation forces. + /// + public int FoundationForces; + + /// + /// The Chaos Insurgency forces. + /// + public int ChaosInsurgency; + + /// + /// The anomalies. + /// + public int Anomalies; + + /// + /// The neutral forces. + /// + public int Neutral; + + /// + /// Gets the current summary. + /// + /// The current summary. + public static SummaryInfo GetSummary() + { + SummaryInfo summary = new(); + + foreach (Player alive in Player.List) + { + if (alive is not Pawn pawn || Round.IgnoredPlayers.Contains(alive)) + continue; + + switch (RoleExtensions.GetTeam(alive.Role.Type)) + { + case Team.Scientists: + case Team.FoundationForces: + ++summary.FoundationForces; + break; + case Team.ClassD: + case Team.ChaosInsurgency: + ++summary.ChaosInsurgency; + break; + case Team.SCPs: + ++summary.Anomalies; + break; + default: + ++summary.Neutral; + break; + } + } + + return summary; + } + + /// + /// Updates the summary. + /// + public void Update() + { + foreach (Player alive in Player.List) + { + if (alive is not Pawn pawn || Round.IgnoredPlayers.Contains(alive)) + continue; + + switch (RoleExtensions.GetTeam(alive.Role.Type)) + { + case Team.Scientists: + case Team.FoundationForces: + ++FoundationForces; + break; + case Team.ClassD: + case Team.ChaosInsurgency: + ++ChaosInsurgency; + break; + case Team.SCPs: + ++Anomalies; + break; + default: + ++Neutral; + break; + } + } + } + } +} \ No newline at end of file From 1128fb2d7210820f77ca73a57eff79309d2bf4ea Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Sat, 3 Feb 2024 09:25:56 +0100 Subject: [PATCH 102/141] Added `bool RoleBehaviour::EvaluateEndingConditions` method. --- .../API/Features/CustomRoles/RoleBehaviour.cs | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/Exiled.CustomModules/API/Features/CustomRoles/RoleBehaviour.cs b/Exiled.CustomModules/API/Features/CustomRoles/RoleBehaviour.cs index d575f9a2f2..46640d99bb 100644 --- a/Exiled.CustomModules/API/Features/CustomRoles/RoleBehaviour.cs +++ b/Exiled.CustomModules/API/Features/CustomRoles/RoleBehaviour.cs @@ -182,6 +182,42 @@ protected virtual RoleTypeId FakeAppearance /// if the specified is ignored; otherwise, . public bool IsDamageIgnored(DamageType damageType) => Settings.IgnoredDamageTypes.Contains(damageType); + /// + /// Evaluates the specified conditions affecting the round's ending conditions. + /// + /// The corresponding evaluation. + public virtual bool EvaluateEndingConditions() + { + if (CustomRole.TeamsOwnership.Length == 1) + return true; + + SummaryInfo summaryInfo = World.Get().SummaryInfo; + + if (CustomRole.TeamsOwnership.Contains(Team.SCPs) && summaryInfo.FoundationForces <= 0 && summaryInfo.ChaosInsurgency <= 0) + return true; + + if (CustomRole.TeamsOwnership.Any(team => team is Team.ClassD or Team.ChaosInsurgency) && summaryInfo.FoundationForces <= 0 && summaryInfo.Anomalies <= 0) + return true; + + if (CustomRole.TeamsOwnership.Any(team => team is Team.FoundationForces or Team.Scientists) && summaryInfo.ChaosInsurgency <= 0 && summaryInfo.Anomalies <= 0) + return true; + + if (CustomRole.TeamsOwnership.IsEmpty()) + { + int uniqueFaction = 0; + if (summaryInfo.FoundationForces > 0) + ++uniqueFaction; + if (summaryInfo.ChaosInsurgency > 0) + ++uniqueFaction; + if (summaryInfo.Anomalies > 0) + ++uniqueFaction; + + return uniqueFaction <= 1; + } + + return false; + } + /// public virtual void AdjustAdditivePipe() { From 068cd759f8b6aa446906aabc95831a17be63b2cb Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Sat, 3 Feb 2024 09:26:13 +0100 Subject: [PATCH 103/141] Implemented custom ending conditions to `World`. --- .../Features/{CustomGamemodes => }/World.cs | 97 ++++++++++++++++++- 1 file changed, 95 insertions(+), 2 deletions(-) rename Exiled.CustomModules/API/Features/{CustomGamemodes => }/World.cs (63%) diff --git a/Exiled.CustomModules/API/Features/CustomGamemodes/World.cs b/Exiled.CustomModules/API/Features/World.cs similarity index 63% rename from Exiled.CustomModules/API/Features/CustomGamemodes/World.cs rename to Exiled.CustomModules/API/Features/World.cs index 6bcc6d8f77..522f399909 100644 --- a/Exiled.CustomModules/API/Features/CustomGamemodes/World.cs +++ b/Exiled.CustomModules/API/Features/World.cs @@ -5,16 +5,21 @@ // // ----------------------------------------------------------------------- -namespace Exiled.CustomModules.API.Features.CustomGameModes +namespace Exiled.CustomModules.API.Features { using System.Collections.Generic; + using System.Linq; using Exiled.API.Extensions; + using Exiled.API.Features; using Exiled.API.Features.Core; using Exiled.API.Features.Core.Generic; using Exiled.CustomModules.API.Enums; + using Exiled.CustomModules.API.Features.CustomGameModes; + using Exiled.CustomModules.API.Features.CustomRoles; + using Exiled.CustomModules.Events.EventArgs.CustomRoles; + using Exiled.Events.EventArgs.Server; using MEC; - using PluginAPI.Core; using Server = Exiled.API.Features.Server; @@ -33,15 +38,20 @@ public class World : StaticActor private GameState gameState; private CustomGameMode enqueuedGameMode; private CoroutineHandle queueHandle; + private SummaryInfo summaryInfo; /// /// Gets the . + /// + /// Requires to be enabled. /// public GameState GameState => gameState ??= GetComponent(); /// /// Gets or sets the dequeue rate, expressed in seconds. /// + /// Requires to be enabled. + /// /// If enqueued, the game mode will be continuously evaluated until it starts or the enqueued game mode changes. ///
/// The defines the delay between each evaluation check. @@ -51,16 +61,34 @@ public class World : StaticActor /// /// Gets the enqueued game mode. + /// + /// Requires to be enabled. /// public uint EnqueuedGameMode => enqueuedGameMode.Id; /// /// Gets or sets the running game mode. + /// + /// Requires to be enabled. /// public uint RunningGameMode { get; protected internal set; } + /// + /// Gets the current summary info. + /// + public SummaryInfo SummaryInfo + { + get + { + summaryInfo.Update(); + return summaryInfo; + } + } + /// /// Enqueues a custom game mode for execution. + /// + /// Requires to be enabled. /// /// The custom game mode to enqueue. /// Whether to continuously enqueue the game mode. @@ -78,6 +106,8 @@ public virtual void EnqueueGameMode(CustomGameMode customGameMode, bool continuo /// /// Enqueues a custom game mode by its ID for execution. + /// + /// Requires to be enabled. /// /// The ID of the custom game mode to enqueue. /// Whether to continuously enqueue the game mode. @@ -91,6 +121,8 @@ public virtual void EnqueueGameMode(object id, bool continuously = false) /// /// Clears the current game mode queue. + /// + /// Requires to be enabled. /// public virtual void ClearQueue() { @@ -105,6 +137,8 @@ public virtual void ClearQueue() /// /// Starts the execution of the enqueued game mode. + /// + /// Requires to be enabled. /// /// The custom game mode to start. /// Whether to force-start the game mode. @@ -154,11 +188,70 @@ protected override void EndPlay_Static() Timing.KillCoroutines(queueHandle); } + /// + protected override void SubscribeEvents() + { + base.SubscribeEvents(); + + if (CustomModules.IsModuleLoaded(ModuleType.CustomRoles)) + { + CustomRole.ChangedCustomRoleDispatcher.Bind(this, OnChangedCustomRole); + + Exiled.Events.Handlers.Server.EndingRound += OnEndingRound; + } + + if (CustomModules.IsModuleLoaded(ModuleType.CustomGameModes)) + { + Exiled.Events.Handlers.Server.RoundStarted += OnRoundStarted; + } + } + + /// + protected override void UnsubscribeEvents() + { + base.UnsubscribeEvents(); + + if (CustomModules.IsModuleLoaded(ModuleType.CustomRoles)) + { + CustomRole.ChangedCustomRoleDispatcher.Unbind(this); + + Exiled.Events.Handlers.Server.EndingRound -= OnEndingRound; + } + + if (CustomModules.IsModuleLoaded(ModuleType.CustomGameModes)) + { + Exiled.Events.Handlers.Server.RoundStarted -= OnRoundStarted; + } + } + private void OnRoundStarted() { EnqueueGameMode(enqueuedGameMode); } + private void OnEndingRound(EndingRoundEventArgs ev) + { + if (!ev.IsAllowed) + return; + + foreach (CustomRole role in CustomRole.Get(cr => cr.TeamsOwnership.Length != 1 && cr.Instances > 1)) + { + if (role.Owners.First().RoleBehaviour.EvaluateEndingConditions()) + continue; + + ev.IsAllowed = false; + return; + } + } + + private void OnChangedCustomRole(ChangedCustomRoleEventArgs ev) + { + if (!CustomRole.TryGet(ev.Role, out CustomRole role) || role.TeamsOwnership.Count() == 1) + return; + + Round.IgnoredPlayers.Add(ev.Player); + } + private IEnumerator DequeueGameMode() { for (; ;) From d1971e517e7a15e0af974a487a498fa942b5f68e Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Sat, 3 Feb 2024 09:26:44 +0100 Subject: [PATCH 104/141] Fixed `RespawningTeamEventArgs` not initializing some values. --- Exiled.Events/EventArgs/Server/RespawningTeamEventArgs.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Exiled.Events/EventArgs/Server/RespawningTeamEventArgs.cs b/Exiled.Events/EventArgs/Server/RespawningTeamEventArgs.cs index 52db70eb08..b1b250c6b9 100644 --- a/Exiled.Events/EventArgs/Server/RespawningTeamEventArgs.cs +++ b/Exiled.Events/EventArgs/Server/RespawningTeamEventArgs.cs @@ -22,9 +22,6 @@ namespace Exiled.Events.EventArgs.Server ///
public class RespawningTeamEventArgs : IDeniableEvent { - private SpawnableTeamType nextKnownTeam; - private int maxWaveSize; - /// /// Initializes a new instance of the class. /// @@ -36,7 +33,7 @@ public RespawningTeamEventArgs(List players, int maxRespawn, SpawnableTe { Players = players; MaxWaveSize = maxRespawn; - this.nextKnownTeam = nextKnownTeam; + NextKnownTeam = nextKnownTeam; SpawnQueue = new(); IsAllowed = isAllowed; } From 364f19c0f205ae2302730fe5daec91f6e3d710aa Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Sat, 3 Feb 2024 09:32:45 +0100 Subject: [PATCH 105/141] Performance optimizations and some clean up. --- Exiled.API/Features/EConfig.cs | 51 ++++++++++--------- Exiled.API/Features/Ragdoll.cs | 4 +- Exiled.API/Features/Room.cs | 23 +++++---- Exiled.API/Features/Round.cs | 2 +- Exiled.API/Features/Toys/Light.cs | 13 ++--- Exiled.API/Features/Toys/Primitive.cs | 21 ++++---- Exiled.API/Features/Toys/ShootingTargetToy.cs | 7 +-- .../Generics/VirtualPlugin.cs | 5 +- Exiled.API/Features/Window.cs | 2 +- .../CustomGamemodes/CustomGameMode.cs | 6 +-- .../API/Features/CustomRoles/CustomRole.cs | 1 - .../API/Features/RoleAssigner.cs | 3 +- 12 files changed, 73 insertions(+), 65 deletions(-) diff --git a/Exiled.API/Features/EConfig.cs b/Exiled.API/Features/EConfig.cs index 2f51f87221..0480d107d3 100644 --- a/Exiled.API/Features/EConfig.cs +++ b/Exiled.API/Features/EConfig.cs @@ -102,7 +102,7 @@ public sealed class EConfig : TypeCastObject /// /// Gets the absolute path. /// - public string? AbsolutePath => Path.Combine(Paths.Configs, Path.Combine(Folder, Name)); + public string? AbsolutePath => Folder is not null && Name is not null ? Path.Combine(Paths.Configs, Path.Combine(Folder, Name)) : null; /// /// Gets a instance given the specified type . @@ -126,7 +126,7 @@ public sealed class EConfig : TypeCastObject /// /// The folder of the config to look for. /// The corresponding instance or if not found. - public static EConfig Get(string folder) => List.FirstOrDefault(cfg => cfg.Folder == folder); + public static EConfig Get(string folder) => List.FirstOrDefault(cfg => cfg.Folder == folder) ?? throw new InvalidOperationException(); /// /// Generates a new config of type . @@ -175,7 +175,7 @@ public static void LoadAll() if (attribute is null) return null; - ConstructorInfo constructor = type.GetConstructor(Type.EmptyTypes); + ConstructorInfo? constructor = type.GetConstructor(Type.EmptyTypes); if (constructor is not null) { config = constructor.Invoke(null)!; @@ -227,26 +227,29 @@ public static void LoadAll() if (!wrapper!.Name!.Contains(".yml")) wrapper.Name += ".yml"; - string path = Path.Combine(Paths.Configs, wrapper.Folder); - if (attribute.IsParent) + if (wrapper.Folder is not null) { - if (!Directory.Exists(Path.Combine(path))) - Directory.CreateDirectory(path); + string path = Path.Combine(Paths.Configs, wrapper.Folder); + if (attribute.IsParent) + { + if (!Directory.Exists(Path.Combine(path))) + Directory.CreateDirectory(path); - Load(wrapper, wrapper.AbsolutePath!); - wrapper!.data!.Add(wrapper); - MainConfigsValue.Add(wrapper); + Load(wrapper, wrapper.AbsolutePath!); + wrapper!.data!.Add(wrapper); + MainConfigsValue.Add(wrapper); - Dictionary localCache = new(Cache); - foreach (KeyValuePair elem in localCache) - LoadFromCache(elem.Key); + Dictionary localCache = new(Cache); + foreach (KeyValuePair elem in localCache) + LoadFromCache(elem.Key); - return wrapper; - } + return wrapper; + } - Cache.Add(wrapper, wrapper.AbsolutePath!); - if (!Directory.Exists(path) || !MainConfigsValue.Any(cfg => cfg.Folder == wrapper.Folder)) - return wrapper; + Cache.Add(wrapper, wrapper.AbsolutePath!); + if (!Directory.Exists(path) || !MainConfigsValue.Any(cfg => cfg.Folder == wrapper.Folder)) + return wrapper; + } LoadFromCache(wrapper); @@ -303,12 +306,12 @@ public static void Load(EConfig config, string? path = null) path ??= config.AbsolutePath; if (File.Exists(path)) { - config.Base = Deserializer.Deserialize(File.ReadAllText(path), config.Base!.GetType())!; + config.Base = Deserializer.Deserialize(File.ReadAllText(path ?? throw new ArgumentNullException(nameof(path))), config.Base!.GetType())!; File.WriteAllText(path, Serializer.Serialize(config.Base!)); return; } - File.WriteAllText(path, Serializer.Serialize(config.Base!)); + File.WriteAllText(path ?? throw new ArgumentNullException(nameof(path)), Serializer.Serialize(config.Base!)); } /// @@ -345,12 +348,14 @@ public void Write(string name, object value) return; string? path = GetPath(); - PropertyInfo propertyInfo = param.Base!.GetType().GetProperty(name); + PropertyInfo? propertyInfo = param.Base!.GetType().GetProperty(name); if (propertyInfo is not null) { propertyInfo.SetValue(param, value); - File.WriteAllText(path, Serializer.Serialize(param)); - this.CopyProperties(Deserializer.Deserialize(File.ReadAllText(path), GetType())); + File.WriteAllText(path ?? throw new InvalidOperationException(), Serializer.Serialize(param)); + + if (path is not null) + this.CopyProperties(Deserializer.Deserialize(File.ReadAllText(path), GetType())); } } } diff --git a/Exiled.API/Features/Ragdoll.cs b/Exiled.API/Features/Ragdoll.cs index cf9ab43f5b..52bd892aa9 100644 --- a/Exiled.API/Features/Ragdoll.cs +++ b/Exiled.API/Features/Ragdoll.cs @@ -321,7 +321,7 @@ public static bool TryCreate(RagdollData networkInfo, out Ragdoll ragdoll) /// The optional owner of the ragdoll. /// The ragdoll. public static bool TryCreate(RoleTypeId roleType, string name, DamageHandlerBase damageHandler, out Ragdoll ragdoll, Player owner = null) - => TryCreate(new(owner?.ReferenceHub ?? Server.Host.ReferenceHub, damageHandler, roleType, default, default, name, NetworkTime.time), out ragdoll); + => TryCreate(new(owner?.ReferenceHub ? owner?.ReferenceHub : Server.Host.ReferenceHub, damageHandler, roleType, default, default, name, NetworkTime.time), out ragdoll); /// /// Creates a new ragdoll. @@ -361,7 +361,7 @@ public static Ragdoll CreateAndSpawn(RagdollData networkInfo) /// The optional owner of the ragdoll. /// The ragdoll. public static Ragdoll CreateAndSpawn(RoleTypeId roleType, string name, DamageHandlerBase damageHandler, Vector3 position, Quaternion rotation, Player owner = null) - => CreateAndSpawn(new(owner?.ReferenceHub ?? Server.Host.ReferenceHub, damageHandler, roleType, position, rotation, name, NetworkTime.time)); + => CreateAndSpawn(new(owner?.ReferenceHub ? owner?.ReferenceHub : Server.Host.ReferenceHub, damageHandler, roleType, position, rotation, name, NetworkTime.time)); /// /// Creates and spawns a new ragdoll. diff --git a/Exiled.API/Features/Room.cs b/Exiled.API/Features/Room.cs index 0a26b8d559..c3a06d774a 100644 --- a/Exiled.API/Features/Room.cs +++ b/Exiled.API/Features/Room.cs @@ -168,7 +168,7 @@ public bool AreLightsOff /// /// Gets the FlickerableLightController's NetworkIdentity. /// - public NetworkIdentity RoomLightControllerNetIdentity => RoomLightController?.netIdentity; + public NetworkIdentity RoomLightControllerNetIdentity => RoomLightController ? RoomLightController.netIdentity : null; /// /// Gets the room's FlickerableLightController. @@ -283,7 +283,7 @@ public static Room FindParentRoom(GameObject objectInRoom) } // Finally, try for objects that aren't children, like players and pickups. - return room ?? Get(objectInRoom.transform.position) ?? default; + return room ? room : Get(objectInRoom.transform.position) ?? default; } /// @@ -465,14 +465,19 @@ private static ZoneType FindZone(GameObject gameObject) { Transform transform = gameObject.transform; - return transform.parent?.name.RemoveBracketsOnEndOfName() switch + if (transform && transform.parent) { - "HeavyRooms" => ZoneType.HeavyContainment, - "LightRooms" => ZoneType.LightContainment, - "EntranceRooms" => ZoneType.Entrance, - "HCZ_EZ_Checkpoint" => ZoneType.HeavyContainment | ZoneType.Entrance, - _ => transform.position.y > 900 ? ZoneType.Surface : ZoneType.Unspecified, - }; + return transform.parent.name.RemoveBracketsOnEndOfName() switch + { + "HeavyRooms" => ZoneType.HeavyContainment, + "LightRooms" => ZoneType.LightContainment, + "EntranceRooms" => ZoneType.Entrance, + "HCZ_EZ_Checkpoint" => ZoneType.HeavyContainment | ZoneType.Entrance, + _ => transform.position.y > 900 ? ZoneType.Surface : ZoneType.Unspecified, + }; + } + + return ZoneType.Unspecified; } private void InternalCreate() diff --git a/Exiled.API/Features/Round.cs b/Exiled.API/Features/Round.cs index 7f811a56be..72ad72649c 100644 --- a/Exiled.API/Features/Round.cs +++ b/Exiled.API/Features/Round.cs @@ -44,7 +44,7 @@ public static class Round /// /// Gets a value indicating whether the round is started or not. /// - public static bool IsStarted => ReferenceHub.LocalHub?.characterClassManager.RoundStarted ?? false; + public static bool IsStarted => ReferenceHub.LocalHub && ReferenceHub.LocalHub.characterClassManager.RoundStarted; /// /// Gets a value indicating whether the round in progress or not. diff --git a/Exiled.API/Features/Toys/Light.cs b/Exiled.API/Features/Toys/Light.cs index b88f4eb428..903a5c5c1a 100644 --- a/Exiled.API/Features/Toys/Light.cs +++ b/Exiled.API/Features/Toys/Light.cs @@ -80,9 +80,9 @@ public bool ShadowEmission /// The scale of the . /// Whether the should be initially spawned. /// 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 = null, Vector3? rotation = null, Vector3? scale = null, bool spawn = true) + => Create(position, rotation, scale, spawn, null); + /// /// Creates a new . /// @@ -96,9 +96,10 @@ public static Light Create(Vector3? position /*= null*/, Vector3? rotation /*= n { Light light = new(UnityEngine.Object.Instantiate(ToysHelper.LightBaseObject)); - light.Base.transform.position = position ?? Vector3.zero; - light.Base.transform.eulerAngles = rotation ?? Vector3.zero; - light.Base.transform.localScale = scale ?? Vector3.one; + Transform transform = light.Base.transform; + transform.position = position ?? Vector3.zero; + transform.eulerAngles = rotation ?? Vector3.zero; + transform.localScale = scale ?? Vector3.one; if (spawn) light.Spawn(); diff --git a/Exiled.API/Features/Toys/Primitive.cs b/Exiled.API/Features/Toys/Primitive.cs index ddb95da330..486fafecac 100644 --- a/Exiled.API/Features/Toys/Primitive.cs +++ b/Exiled.API/Features/Toys/Primitive.cs @@ -111,9 +111,10 @@ public static Primitive Create(Vector3? position /*= null*/, Vector3? rotation / { Primitive primitive = new(Object.Instantiate(ToysHelper.PrimitiveBaseObject)); - primitive.Base.transform.position = position ?? Vector3.zero; - primitive.Base.transform.eulerAngles = rotation ?? Vector3.zero; - primitive.Base.transform.localScale = scale ?? Vector3.one; + Transform transform = primitive.Base.transform; + transform.position = position ?? Vector3.zero; + transform.eulerAngles = rotation ?? Vector3.zero; + transform.localScale = scale ?? Vector3.one; if (spawn) primitive.Spawn(); @@ -138,9 +139,10 @@ public static Primitive Create(PrimitiveType primitiveType /*= PrimitiveType.Sph { Primitive primitive = new(Object.Instantiate(ToysHelper.PrimitiveBaseObject)); - primitive.Base.transform.position = position ?? Vector3.zero; - primitive.Base.transform.eulerAngles = rotation ?? Vector3.zero; - primitive.Base.transform.localScale = scale ?? Vector3.one; + Transform transform = primitive.Base.transform; + transform.position = position ?? Vector3.zero; + transform.eulerAngles = rotation ?? Vector3.zero; + transform.localScale = scale ?? Vector3.one; if (spawn) primitive.Spawn(); @@ -161,9 +163,10 @@ public static Primitive Create(PrimitiveSettings primitiveSettings) { Primitive primitive = new(Object.Instantiate(ToysHelper.PrimitiveBaseObject)); - primitive.Base.transform.position = primitiveSettings.Position; - primitive.Base.transform.eulerAngles = primitiveSettings.Rotation; - primitive.Base.transform.localScale = primitiveSettings.Scale; + Transform transform = primitive.Base.transform; + transform.position = primitiveSettings.Position; + transform.eulerAngles = primitiveSettings.Rotation; + transform.localScale = primitiveSettings.Scale; if (primitiveSettings.Spawn) primitive.Spawn(); diff --git a/Exiled.API/Features/Toys/ShootingTargetToy.cs b/Exiled.API/Features/Toys/ShootingTargetToy.cs index 9f8408a18a..054b58bfae 100644 --- a/Exiled.API/Features/Toys/ShootingTargetToy.cs +++ b/Exiled.API/Features/Toys/ShootingTargetToy.cs @@ -177,9 +177,10 @@ public static ShootingTargetToy Create(ShootingTargetType type, Vector3? positio } } - shootingTargetToy.Base.transform.position = position ?? Vector3.zero; - shootingTargetToy.Base.transform.eulerAngles = rotation ?? Vector3.zero; - shootingTargetToy.Base.transform.localScale = scale ?? Vector3.one; + Transform transform = shootingTargetToy.Base.transform; + transform.position = position ?? Vector3.zero; + transform.eulerAngles = rotation ?? Vector3.zero; + transform.localScale = scale ?? Vector3.one; if (spawn) shootingTargetToy.Spawn(); diff --git a/Exiled.API/Features/VirtualAssemblies/Generics/VirtualPlugin.cs b/Exiled.API/Features/VirtualAssemblies/Generics/VirtualPlugin.cs index 361048cc89..4a7161943f 100644 --- a/Exiled.API/Features/VirtualAssemblies/Generics/VirtualPlugin.cs +++ b/Exiled.API/Features/VirtualAssemblies/Generics/VirtualPlugin.cs @@ -5,11 +5,8 @@ // // ----------------------------------------------------------------------- -namespace Exiled.API.Features.VirtualAssemblies +namespace Exiled.API.Features.VirtualAssemblies.Generics { - using Exiled.API.Features; - using Exiled.API.Interfaces; - /// /// The type of the plugin's config. public abstract class VirtualPlugin : VirtualPlugin diff --git a/Exiled.API/Features/Window.cs b/Exiled.API/Features/Window.cs index e4ebdaa097..1e0c3377b7 100644 --- a/Exiled.API/Features/Window.cs +++ b/Exiled.API/Features/Window.cs @@ -215,7 +215,7 @@ public void DamageWindow(float amount, DamageHandlerBase handler) /// A string containing Window-related data. public override string ToString() => $"{Type} ({Health}) [{IsBroken}] *{DisableScpDamage}*"; - private GlassType GetGlassType() => Room?.Type switch + private GlassType GetGlassType() => !Room ? GlassType.Unknown : Room.Type switch { RoomType.Lcz330 => GlassType.Scp330, RoomType.LczGlassBox => GlassType.GR18, diff --git a/Exiled.CustomModules/API/Features/CustomGamemodes/CustomGameMode.cs b/Exiled.CustomModules/API/Features/CustomGamemodes/CustomGameMode.cs index 4c5e797c99..cfcbffa54e 100644 --- a/Exiled.CustomModules/API/Features/CustomGamemodes/CustomGameMode.cs +++ b/Exiled.CustomModules/API/Features/CustomGamemodes/CustomGameMode.cs @@ -99,14 +99,12 @@ public abstract class CustomGameMode : CustomModule, IAdditiveBehaviours /// /// Gets the type of the game state. /// - /// The custom game mode. /// The type of the game state if found; otherwise, . public Type GameState => BehaviourComponents.FirstOrDefault(comp => typeof(GameState).IsAssignableFrom(comp)); /// /// Gets the types of the player states. /// - /// The custom game mode. /// The types of the player states if found; otherwise, empty. public IEnumerable PlayerStates => BehaviourComponents.Where(comp => typeof(PlayerState).IsAssignableFrom(comp)); @@ -162,9 +160,9 @@ public static CustomGameMode Get(Type type) => public static CustomGameMode Get(PlayerState playerState) => Get(playerState.GetType()); /// - /// Attempts to retrieve a based on the provided id or . + /// Attempts to retrieve a based on the provided id or . /// - /// The id or of the custom game mode. + /// The id or of the custom game mode. /// When this method returns, contains the associated with the specified id, if the id was found; otherwise, . /// if a was found; otherwise, . public static bool TryGet(object id, out CustomGameMode customGameMode) => customGameMode = Get(id); diff --git a/Exiled.CustomModules/API/Features/CustomRoles/CustomRole.cs b/Exiled.CustomModules/API/Features/CustomRoles/CustomRole.cs index 43f279d5fa..b70a0710f1 100644 --- a/Exiled.CustomModules/API/Features/CustomRoles/CustomRole.cs +++ b/Exiled.CustomModules/API/Features/CustomRoles/CustomRole.cs @@ -693,7 +693,6 @@ public bool Spawn(Pawn player) ChangedCustomRoleDispatcher.InvokeAll(@event); return true; - } /// diff --git a/Exiled.CustomModules/API/Features/RoleAssigner.cs b/Exiled.CustomModules/API/Features/RoleAssigner.cs index 61dc0f8145..bc56dfed5a 100644 --- a/Exiled.CustomModules/API/Features/RoleAssigner.cs +++ b/Exiled.CustomModules/API/Features/RoleAssigner.cs @@ -5,8 +5,6 @@ // // ----------------------------------------------------------------------- -using Exiled.CustomModules.Events.EventArgs.CustomRoles; - namespace Exiled.CustomModules.API.Features { using System; @@ -23,6 +21,7 @@ namespace Exiled.CustomModules.API.Features using Exiled.CustomModules.API.Features.CustomRoles; using Exiled.CustomModules.API.Interfaces; using Exiled.CustomModules.Events.EventArgs.CustomItems; + using Exiled.CustomModules.Events.EventArgs.CustomRoles; using Exiled.CustomModules.Events.EventArgs.Tracking; using Exiled.Events.EventArgs.Map; using Exiled.Events.EventArgs.Player; From c8cea3ec8abc48dc82c47347e0c6cfd5453f8730 Mon Sep 17 00:00:00 2001 From: Yamato <66829532+louis1706@users.noreply.github.com> Date: Sat, 3 Feb 2024 19:13:25 +0100 Subject: [PATCH 106/141] Add `respawn_target_multiplier` field to base game configs. (#2421) * AddRespawnTargetMultiplierConfig * Fix --- .../AddRespawnTargetMultiplierConfig.cs | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 Exiled.Events/Patches/Generic/AddRespawnTargetMultiplierConfig.cs diff --git a/Exiled.Events/Patches/Generic/AddRespawnTargetMultiplierConfig.cs b/Exiled.Events/Patches/Generic/AddRespawnTargetMultiplierConfig.cs new file mode 100644 index 0000000000..79c7bf6382 --- /dev/null +++ b/Exiled.Events/Patches/Generic/AddRespawnTargetMultiplierConfig.cs @@ -0,0 +1,54 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Events.Patches.Generic.Scp079API +{ + using System.Collections.Generic; + using System.Reflection.Emit; + + using API.Features.Pools; + using HarmonyLib; + + using static HarmonyLib.AccessTools; + + using Scp049Role = API.Features.Roles.Scp049Role; + + /// + /// Patches . + /// Adds the as NW config. + /// + [HarmonyPatch(typeof(RoundSummary), nameof(RoundSummary.ServerOnRespawned))] + internal class AddRespawnTargetMultiplierConfig + { + private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) + { + List newInstructions = ListPool.Pool.Get(instructions); + + // replace "this.ChaosTargetCount += (int)((double)respawnedPlayers.Count * 0.75);" + // with " this.ChaosTargetCount += (int)((double)respawnedPlayers.Count * ConfigFile.ServerConfig.GetDouble("respawn_target_multiplier", 0.75);" + int offset = 0; + int index = newInstructions.FindIndex(instruction => instruction.opcode == OpCodes.Ldc_R8) + offset; + newInstructions.RemoveAt(index); + + newInstructions.InsertRange( + index, + new CodeInstruction[] + { + // ConfigFile.ServerConfig.GetDouble("respawn_target_multiplier", 0.75); + new(OpCodes.Ldsfld, Field(typeof(GameCore.ConfigFile), nameof(GameCore.ConfigFile.ServerConfig))), + new(OpCodes.Ldstr, "respawn_target_multiplier"), + new(OpCodes.Ldc_R8, RoundSummary.RespawnTargetMultiplier), + new(OpCodes.Call, Method(typeof(YamlConfig), nameof(YamlConfig.GetDouble))), + }); + + for (int z = 0; z < newInstructions.Count; z++) + yield return newInstructions[z]; + + ListPool.Pool.Return(newInstructions); + } + } +} \ No newline at end of file From 36346373ed3448a4fd69df18bae4ad2c2e0dcbcc Mon Sep 17 00:00:00 2001 From: Yamato <66829532+louis1706@users.noreply.github.com> Date: Sat, 3 Feb 2024 19:13:35 +0100 Subject: [PATCH 107/141] Fixed open doors getting easily broke by Scp096. (#2422) * NWFixScp096BreakingDoor * Update Exiled.Events/Patches/Fixes/NWFixScp096BreakingDoor.cs Co-authored-by: Nao <60253860+NaoUnderscore@users.noreply.github.com> --------- Co-authored-by: Nao <60253860+NaoUnderscore@users.noreply.github.com> --- .../Patches/Fixes/NWFixScp096BreakingDoor.cs | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 Exiled.Events/Patches/Fixes/NWFixScp096BreakingDoor.cs diff --git a/Exiled.Events/Patches/Fixes/NWFixScp096BreakingDoor.cs b/Exiled.Events/Patches/Fixes/NWFixScp096BreakingDoor.cs new file mode 100644 index 0000000000..4b294f9535 --- /dev/null +++ b/Exiled.Events/Patches/Fixes/NWFixScp096BreakingDoor.cs @@ -0,0 +1,55 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Events.Patches.Fixes +{ + using System.Collections.Generic; + using System.Reflection.Emit; + + using API.Features.Pools; + using HarmonyLib; + using Interactables.Interobjects; + using Interactables.Interobjects.DoorUtils; + using PlayerRoles.PlayableScps.Scp096; + using UnityEngine; + + using static HarmonyLib.AccessTools; + + /// + /// Patches the delegate. + /// Fixes open doors getting easily broke. + /// Bug reported to NW (https://trello.com/c/6Nz7Isjm/4637-scp096-easily-breaking-opened-doors). + /// + [HarmonyPatch(typeof(Scp096HitHandler), nameof(Scp096HitHandler.CheckDoorHit))] + internal class NWFixScp096BreakingDoor + { + private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) + { + List newInstructions = ListPool.Pool.Get(instructions); + + Label ret = generator.DefineLabel(); + int offset = -4; + int index = newInstructions.FindIndex(x => x.operand == (object)Method(typeof(IDamageableDoor), nameof(IDamageableDoor.ServerDamage))) + offset; + + newInstructions.InsertRange(index, new[] + { + new CodeInstruction(OpCodes.Ldloc_0).MoveLabelsFrom(newInstructions[index]), + new(OpCodes.Call, Method(typeof(NWFixScp096BreakingDoor), nameof(IsFullyOpen))), + new(OpCodes.Brtrue_S, ret), + }); + + newInstructions[newInstructions.Count - 1].labels.Add(ret); + + for (int z = 0; z < newInstructions.Count; z++) + yield return newInstructions[z]; + + ListPool.Pool.Return(newInstructions); + } + + private static bool IsFullyOpen(IDamageableDoor damageableDoor) => damageableDoor is BreakableDoor breakableDoor && breakableDoor.GetExactState() is 1; + } +} From f31e1891db47c1f50651606af7884262a6adc914 Mon Sep 17 00:00:00 2001 From: Yamato <66829532+louis1706@users.noreply.github.com> Date: Sat, 3 Feb 2024 19:13:41 +0100 Subject: [PATCH 108/141] Fixed `team_respawn_queue` field config not behaving as expected. (#2423) * NW FIX team_respawn_queue * Better ChaosRoleType --- Exiled.Events/Handlers/Internal/MapGenerated.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Exiled.Events/Handlers/Internal/MapGenerated.cs b/Exiled.Events/Handlers/Internal/MapGenerated.cs index d4bd8d037a..2c9fc1ba45 100644 --- a/Exiled.Events/Handlers/Internal/MapGenerated.cs +++ b/Exiled.Events/Handlers/Internal/MapGenerated.cs @@ -47,6 +47,11 @@ public static void OnMapGenerated() { Map.ClearCache(); + // TODO: Fix For (https://trello.com/c/cUwpZDLs/5003-config-teamrespawnqueue-in-configgameplay-is-not-working-as-expected) + PlayerRoles.RoleAssign.HumanSpawner.Handlers[PlayerRoles.Team.ChaosInsurgency] = new PlayerRoles.RoleAssign.OneRoleHumanSpawner(PlayerRoles.RoleTypeId.ChaosConscript); + PlayerRoles.RoleAssign.HumanSpawner.Handlers[PlayerRoles.Team.OtherAlive] = new PlayerRoles.RoleAssign.OneRoleHumanSpawner(PlayerRoles.RoleTypeId.Tutorial); + PlayerRoles.RoleAssign.HumanSpawner.Handlers[PlayerRoles.Team.Dead] = new PlayerRoles.RoleAssign.OneRoleHumanSpawner(PlayerRoles.RoleTypeId.Spectator); + GenerateAttachments(); Timing.CallDelayed(1, GenerateCache); } From e07f969dfbd2598b44a4fc08cbd7e401fed65dfa Mon Sep 17 00:00:00 2001 From: Yamato <66829532+louis1706@users.noreply.github.com> Date: Sat, 3 Feb 2024 19:15:40 +0100 Subject: [PATCH 109/141] Fix Scp049RespawningOverwatch (#2424) --- Exiled.Events/EventArgs/Scp049/FinishingRecallEventArgs.cs | 2 +- Exiled.Events/Patches/Events/Scp049/FinishingRecall.cs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Exiled.Events/EventArgs/Scp049/FinishingRecallEventArgs.cs b/Exiled.Events/EventArgs/Scp049/FinishingRecallEventArgs.cs index e897dbb04a..e2c2c0728c 100644 --- a/Exiled.Events/EventArgs/Scp049/FinishingRecallEventArgs.cs +++ b/Exiled.Events/EventArgs/Scp049/FinishingRecallEventArgs.cs @@ -38,7 +38,7 @@ public FinishingRecallEventArgs(Player target, Player scp049, BasicRagdoll ragdo Scp049 = Player.Role.As(); Target = target; Ragdoll = Ragdoll.Get(ragdoll); - IsAllowed = isAllowed; + IsAllowed = isAllowed && Target.Role is SpectatorRole spectatorRole && spectatorRole.IsReadyToRespawn; } /// diff --git a/Exiled.Events/Patches/Events/Scp049/FinishingRecall.cs b/Exiled.Events/Patches/Events/Scp049/FinishingRecall.cs index 2eab40acc5..d1458e0fd2 100644 --- a/Exiled.Events/Patches/Events/Scp049/FinishingRecall.cs +++ b/Exiled.Events/Patches/Events/Scp049/FinishingRecall.cs @@ -25,8 +25,11 @@ namespace Exiled.Events.Patches.Events.Scp049 /// /// Patches . /// Adds the event. + /// Fix bug than Overwatch can get force respawn by Scp049 + /// Bug reported to NW https://trello.com/c/V0uHP2eV/5745-overwatch-overwatch-can-get-respawned-by-scp-049. + /// The fix is directly inside the . /// - [EventPatch(typeof(Handlers.Scp049), nameof(Handlers.Scp049.FinishingRecall))] + // [EventPatch(typeof(Handlers.Scp049), nameof(Handlers.Scp049.FinishingRecall))] [HarmonyPatch(typeof(Scp049ResurrectAbility), nameof(Scp049ResurrectAbility.ServerComplete))] internal static class FinishingRecall { From 8499a2da6d60bad462bde5a0d7cc09d72f7da167 Mon Sep 17 00:00:00 2001 From: Yamato <66829532+louis1706@users.noreply.github.com> Date: Sat, 3 Feb 2024 19:16:08 +0100 Subject: [PATCH 110/141] FixPrimitive (#2426) --- Exiled.API/Features/Toys/Primitive.cs | 1 + Exiled.API/Structs/PrimitiveSettings.cs | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Exiled.API/Features/Toys/Primitive.cs b/Exiled.API/Features/Toys/Primitive.cs index b27db955da..22f9c3d41c 100644 --- a/Exiled.API/Features/Toys/Primitive.cs +++ b/Exiled.API/Features/Toys/Primitive.cs @@ -171,6 +171,7 @@ public static Primitive Create(PrimitiveSettings primitiveSettings) primitive.AdminToyBase.NetworkScale = primitive.AdminToyBase.transform.localScale; primitive.Base.NetworkPrimitiveType = primitiveSettings.PrimitiveType; primitive.Color = primitiveSettings.Color; + primitive.IsStatic = primitiveSettings.IsStatic; return primitive; } diff --git a/Exiled.API/Structs/PrimitiveSettings.cs b/Exiled.API/Structs/PrimitiveSettings.cs index 933b0c81d6..418d0c512e 100644 --- a/Exiled.API/Structs/PrimitiveSettings.cs +++ b/Exiled.API/Structs/PrimitiveSettings.cs @@ -51,7 +51,7 @@ public PrimitiveSettings(PrimitiveType primitiveType, Color color, Vector3 posit Position = position; Rotation = rotation; Scale = scale; - Spawn = spawn; + Spawn = spawn; IsStatic = false; } From 6a51ea3baa92bf167d4014a651bf31e13f9d5018 Mon Sep 17 00:00:00 2001 From: FUTURE <69786695+FUTURE-SL@users.noreply.github.com> Date: Sat, 3 Feb 2024 21:17:17 +0300 Subject: [PATCH 111/141] [NW Bug] Sync lights after player rejoin (#2413) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Defined new API structure. * Changed `CustomRoles` to `CustomModules`. * A few more adjustments * Implemented `Additive Properties`. * Docs * Docs and typos * Added generic `CustomEscape` and `CustomRole` * Added `CustomTeam` and `CollectionExtensions`. Made some methods obsolete on `CommonExtensions`. * Fixed build errors * Removed parsers, added namespaces. Added `ITypeCast` interface. Added `NullableObject` class. Added `TypeCastMono` component. Removed all custom `implicit operator bool` implementations in favor of using `NullableObject`. Made some adjustments to `CustomRoles`. * Changes to `Exiled::API::Features::Core`. Added `GameEntity`. Removed `EBehaviour`. Made some changes and additions to custom APIs. Added a new `CustomAbility` API draft. Made some optimizations. * Add doc, Fix bug, code simplification (#2335) * Add doc, Fix bug, code simplification * TypeCastObject & TypeCastMono rewrite Cast * `GameEntity` is dominating * Update APIs to latest SL version (#2353) * Update halloween.yml * Rename halloween.yml to xmas.yml * Xmas update (#2339) * Update RoundEnd.cs (#2341) * Lots of new API (#2342) * lots of new new effects 956 559 * final * fix * idk * Scp956Target * Snowed * doc --------- Co-authored-by: Yamato * DamageHandler and Flamingo (#2343) * DamageHandler and Flamingo * Update ItemExtension * Missing Scp1507Damage * Missing Item API * Snow pile (#2346) * snow pile * list fix --------- Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> * SCP-1507 (#2340) * scp-1507 * minor changes * added role * new * IHumeShieldRole * . --------- Co-authored-by: Yamato Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> * CustomWeaponFix (#2349) * CustomWeaponFix * Fix * More features and events for SCP-1507 (#2348) * scp-1507 * minor changes * added role * new * IHumeShieldRole * . * lots of new * still something new * Update Scp1507Role.cs * Update Scp1507Role.cs --------- Co-authored-by: Yamato Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> * SCP-2536 (#2344) * base 2536 * ev * trying fix * fix + new ev * WhitelistedTeams * doc change --------- Co-authored-by: Yamato Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> * 8.4.4-beta.1 * Fix nuget deps * ooops (#2351) * Fix CustomItem * Fixing scp that can attack each other (#2352) * Fixing scp that can attack each other * Update IndividualFriendlyFire.cs * bump --------- Co-authored-by: Misaka-ZeroTwo <45165615+Misaka-ZeroTwo@users.noreply.github.com> Co-authored-by: VALERA771 <72030575+VALERA771@users.noreply.github.com> Co-authored-by: Yamato Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> Co-authored-by: Bolton <48883340+BoltonDev@users.noreply.github.com> Co-authored-by: Nao * Updated to latest SL version. Added `CustomAbility`, `CustomPlayerAbility`, `CustomItemAbility` and `CustomPickupAbility` API. Fixed namespaces. Fixed `CustomAbility` not able to find any abilities due to faulty type check. Various changes to docs, mainly fixed and improvements. * Docs fixes * `using` statements cleanup * Removed unused files and configs * Fetch upstream (#2357) * Update halloween.yml * Rename halloween.yml to xmas.yml * Xmas update (#2339) * Update RoundEnd.cs (#2341) * Lots of new API (#2342) * lots of new new effects 956 559 * final * fix * idk * Scp956Target * Snowed * doc --------- Co-authored-by: Yamato * DamageHandler and Flamingo (#2343) * DamageHandler and Flamingo * Update ItemExtension * Missing Scp1507Damage * Missing Item API * Snow pile (#2346) * snow pile * list fix --------- Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> * SCP-1507 (#2340) * scp-1507 * minor changes * added role * new * IHumeShieldRole * . --------- Co-authored-by: Yamato Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> * CustomWeaponFix (#2349) * CustomWeaponFix * Fix * More features and events for SCP-1507 (#2348) * scp-1507 * minor changes * added role * new * IHumeShieldRole * . * lots of new * still something new * Update Scp1507Role.cs * Update Scp1507Role.cs --------- Co-authored-by: Yamato Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> * SCP-2536 (#2344) * base 2536 * ev * trying fix * fix + new ev * WhitelistedTeams * doc change --------- Co-authored-by: Yamato Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> * 8.4.4-beta.1 * Fix nuget deps * ooops (#2351) * Fix CustomItem * Fixing scp that can attack each other (#2352) * Fixing scp that can attack each other * Update IndividualFriendlyFire.cs * bump * SpawnReason::ItemUsage * Fix CustomItem::OnReloading(ev) * - (#2354) Co-authored-by: Nao <60253860+NaoUnderscore@users.noreply.github.com> * SpawnReasons::Vocalize (#2355) * Update SpawnReason.cs Added new SpawnReason for SCP-1507 * Update SpawnReason.cs --------- Co-authored-by: Nao <60253860+NaoUnderscore@users.noreply.github.com> * Removed SpawnReason::Vocalize (#2356) They pointed out to me that nw doesn't use "Vocalize" but uses "Revived" --------- Co-authored-by: Misaka-ZeroTwo <45165615+Misaka-ZeroTwo@users.noreply.github.com> Co-authored-by: VALERA771 <72030575+VALERA771@users.noreply.github.com> Co-authored-by: Yamato Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> Co-authored-by: Bolton <48883340+BoltonDev@users.noreply.github.com> Co-authored-by: Nao Co-authored-by: INZI <98975836+InziDeveloperMode@users.noreply.github.com> * Re-organized namespaces. Updated to latest xmas-2023 version. Fixed `Disguising` patch. Added `AbilityBehaviourBase`, `LevelAbilityBehaviour` and `UnlockableAbilityBehaviour`. * Fixed design issues. * fix typo * Finalized `CustomModules.API.Features.CustomAbilities`. Finalized `CustomModules.API.Features.PlayerAbilities`. * Useless multicasts * quicc fix * Design changes. Added `ActiveAbility` and `PassiveAbility`. * Made some changes to naming style * Added `OnReady` method. Made some minor changes to logs. * Added a draft for item abilities. Pickup abilities WIP. Added a few more `GetComponent` methods to `IEntity`. Made some docs fixes. * Added two more overloads to `CollectionExtensions::AddRange` methods. Added two more overloads to `IEntity::AddComponent` methods. Added `IEntity::AddComponents` method and 4 more overloads. Renamed `ItemTrackerActor` to `ItemTracker` and moved it to `CustomModules::Features` namespace. Finalized custom item and pickup abilities. * Added some `ItemTracker` events and re-organized the already existing ones. * Custom item draft, small change (#2366) Co-authored-by: Nao <60253860+NaoUnderscore@users.noreply.github.com> * Added `CustomItem` API draft. Made some docs fixes and changes. Made some critical fixes. * Made `UUEscapeScenarioType` unique. * Added `Updates.md` * Added `Pawn::TryGetCustomRole`. Added `Pawn::TryGetCustomItem`. Added `Pawn::TryGetCustomAbility`. Added `CustomAbility::Equals` and relative compare operators. Minor docs fixes. * Moved all `object` params to `uint` for `Get` and `TryGet` methods for all custom modules. Added `CustomTeamAttribute(uint, params Type[])`. Various docs fixes. * Fixed critical bugs on `CustomRole` API. Added fast iteration and cached values to speed up the process of retrieving custom roles from those values. * Added fast iteration and cached values to speed up the process of retrieving custom escapes from those values. Added `CollectionExtensions::TryAdd` method with two overloads. * - Added `EObject::IsDestroying`. - Added all references on behaviours classes to their main custom module class. - Implemented fast iteration and cached values to optimize the process of retrieving custom abilities and teams from those values. - Introduced `CustomEscape::Attach` and `CustomEscape::Detach` static methods with four overloads each, relying on instance methods. - Redesigned the behavior of `OnEndPlay` when a behavior gets destroyed, without exposing any fields from their main class. * - Introduced the `ICustomAbility` interface. - Added the `RoleBehaviour::CustomTeam` property. - Implemented custom ability events (`Adding`, `Added`, `Removing`, and `Removed`) in the `CustomAbility` class. - Redesigned and optimized the `Pawn::CustomAbilities` and `Pawn::AbilityBehaviours`. - Transformed `EscapingEventArgs` into interfaces, specifically `IPlayerEvent` and `IDeniableEvent`. - Optimized and enhanced the `IEntity::GetComponents` methods. * Some fixes and fast iteration on `CustomItem`. * Made some fixes to configs and pipes. * ## Added - `TextDisplay` class. - `CustomItem` class. - `ItemBehaviour` class. - `ItemSettings` class. - `ItemTracker` class. - `FirearmBehaviour` class. - `FirearmSettings` class. - `SemiAutomaticFirearmBehaviour` class. - `RepNotify` class. - `ReplicatedRef` class. - `ReplicatedProperty` class. - `TrackerBase` class. - `ITrackableInterface` interface. - `IRepNotify` interface. - `IItemBehaviour` interface. - `TextChannelType` enum. - `FiringMode` enum. - `ICustomItemEvent` interface. - `ICustomPickupEvent` interface. - `Pawn::HasCustomItem` method. - `Pawn::HasCustomAbility` method. - `Pawn::CurrentCustomItem` property. - `ReplicatingReferenceEventArgs` event. - A bool parameter to `Log::Debug` named "traceMethod" to log the method from which it has been called. - Some custom item events. - A transpiler to support `PlayerInventoryCommand` using custom items. ## Fixed - Some bugs from the old `CustomItem` API. ## Removed - Setter for `Firearm::FireRate` property. - Old `CustomItem` API. * Re-added ` EObject::CreateDefaultSubobject(Type, GameObject, string)` * Fixed `ReplicatingReferenceDispatcher` being null. * MInor spelling mistake * Re-worked `KeypressActivator`. Removed `KeypressActivator`. Added `ProcessingActionEventArgs` event. Added `InputBinding` class. Added `KeypressInputComponent` class. Moved it to `Exiled::API`. * Style * Renamed `KeypressInputComponent` to `InputActionComponent`. Added `KeypressInputComponent` class. Made some changes to accessors on `InputActionComponent`'s members. Added an implicit conversion from `Action` to `DynamicDelegate`. Changed `DynamicDelegate InputBinding::Action` to `Action InputBinding::Action`. * Added custom armors and grenades. Renamed `CollisionHandler` to `EffectGrenadeCollision`. * Added custom pickups. Added custom ammos. Added custom grenades. Added custom ammos. Added custom armors. Added `Settings` class. Added `PickupTracker` class. Added `Pawn::AddAmmo(uint, ushort)` method. * Added support for `ItemType` and custom ammo behaviours for custom firearms. Added `Player::RemoveItem(ItemType, bool, bool)` overload. Added `Player::RemoveAmmo(AmmoType, ushort)` method. Added `Pawn::GetAmmo(uint)` method. Added `Pawn::RemoveAmmo(uint, ushort)` method. Added `Pawn::SetAmmo(uint, ushort)` method. * Added `AddingItem` and `RemovingItem` events. * Docs fix * Added `AbilityInputComponent`. Converted all hints and broadcasts to `TextDisplay`. Made some changes and fixes to `CustomAbility` API. Changed some namespaces. Split `AbilitySettings` into four (4) different configs: `AbilitySetting`, `ActiveAbilitySettings`, `LevelAbilitySettings`, `UnlockableAbilitySettings`. Added `ISelectableAbility` interface. `ISelectableAbility` has been implemented on all player abilities. It adds two methods: `Select` and `Unselect`, allowing the `Pawn` to mark and store a selected ability using `Pawn::SelectedAbilityBehaviour` added property. It also adds two properties: `IsSelectable` and `IsSelected`. Where `IsSelected` is `only-get`, `IsSelectable` is `get-set` instead, and it can define whether the ability should be treated as an ability handled by `AbilityInputComponent`, if present. * Custom configs and moved serialization to API * Added `VirtualAssemblies`. Renamed `Exiled::API::Features::Config` to ``Exiled::API::Features::EConfig`. Added three (3) events for `Virtual Plugins`: `Disabling`, `Enabling`, `Reloading`. * Revert "Fetch upstream (#2357)" This reverts commit 33edca94155598e1e64d8b25af0577fb562c4711. * Push Revert XMAS * Made some additions, changes, fixed and adjustments to custom firearms. Added `FirearmSettings::` `OverrideReload`, `MaxAmmo` and `ChamberSize` properties. Added `ChangingAttachment` event handler to `FirearmBehaviour`. Added `FirearmBehaviour::ReplicatedClip` replicated property. Added `FirearmBehaviour::ReplicatedMaxAmmo` replicated property. Fixed a `Reloading` bug which doesn't allow to reload in case of non-custom ammo types. `OverrideReload` will now state whether the firearm should use a custom logic to reload, including shooting and how it behaves in case of other events such as `ChangingAttachments` or `UnloadingWeapon`. `OverrideReload` may be an `unsafe` option which does allow to have full control over the firearm's behaviour, leading to some issues if not used correctly. * Added `OnUnloading` and `OnChangingAttachments` exposed events to `FirearmBehaviour`. * Typo * Fixed `GrenadeBehaviour` build errors. Added support for `Pawn` class as base `Player` class. * `[Exiled::API]` (Addition) New `Firearm` properties: `BaseDamage`, `MaxRange`, `Stats`. Added `Firearm::GetDamageAtDistance(float distance)` method. (#2385) * new firearm features * Update Exiled.API/Features/Items/Firearm.cs * Update Exiled.API/Features/Items/Firearm.cs * Update Exiled.API/Features/Items/Firearm.cs * Update Exiled.API/Features/Items/Firearm.cs * Update Exiled.API/Features/Items/Firearm.cs * Update Exiled.API/Features/Items/Firearm.cs * Update Exiled.API/Features/Items/Firearm.cs --------- Co-authored-by: Nao <60253860+NaoUnderscore@users.noreply.github.com> * feat(events): implement EventExceptionLogger to capture event exceptions (#2207) Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> * NPCs fixes by Joker * Added `Strangling` event by Joker * Added `ItemExtensions::GetPickupBase(ItemType)` method by Joker * Removed `MirrorExtensions::SetRoomLightIntensityForTargetOnly` method * No more `var` * Fixed `Generator::set_IsOpen` by Joker * Fixed `Scp244` by Joker * Typo and NPCs fixes by Joker * Fixed `Pickup::IsSpawned` and some `Player` methods. * Re-added `Scp3114Ragdoll` and fixed `Ragdoll` by Joker * Design choices I guess? * `Verified` patch to transpiler by Joker * Fixed `DroppingCandy` event * Fixed `Pickup::IsSpawned` * `[Exiled::Events]` Added `Server::RespawnedTeam` event (#2386) * new ev * Update Exiled.Events/EventArgs/Server/RespawnedTeamEventArgs.cs * Update Exiled.Events/EventArgs/Server/RespawnedTeamEventArgs.cs * Update Exiled.Events/Handlers/Server.cs * Update Exiled.Events/Handlers/Server.cs --------- Co-authored-by: Nao <60253860+NaoUnderscore@users.noreply.github.com> * Added `CustomGameModes` draft. Added `GameState` and `PlayerState` classes. Added `IAdditiveBehaviours` interface. Added `CustomModule`, now all custom modules inherit from `CustomModule`. Some docs fixes. * Added `World` `StaticActor`. Added `GameState` and `PlayerState` drafts. `Round::IgnoredPlayers` is now a `HashSet`. Removed obsolete method `Server::RunCommand(string, CommandSender)`. * [Exiled.API] (Change) Modify Door.DoorLockType setter (#2392) * i hate this method * DoorLockType * Added `DefaultPlayerClassAttribute`. Now `Player` derived classes will be automatically used as base `Player` class if marked with `DefaultPlayerClassAttribute` enforcing the type authority, or just by inheriting from `Player` class. * Fix Doc (#2271) * Revert "API Enhancements and Refinements: `Exiled.CustomModules`" (#2405) * Merge master to dev? (#2408) * v8.4.3 (#2305) * TR Localization (#2388) Added Turkish Support for README Localizations * forgor to translate MEC (#2391) yes * Update README.md * Update README-Русский.md * Update README-中文.md * Update README-ES.md * Update README-PL.md * Update README-BR.md * Update README-IT.md * Update README-CS.md * Update README-DK.md * Update README-TR.md * better turkish (#2393) updated --------- Co-authored-by: Misaka-ZeroTwo <45165615+Misaka-ZeroTwo@users.noreply.github.com> Co-authored-by: 1EnesBaturKaza <156574288+1EnesBaturKaza@users.noreply.github.com> Co-authored-by: Dogy <157377508+RealDogy@users.noreply.github.com> * Revert "Merge master to dev?" (#2411) * Update with SL 13.3 * 8.7.1 * [NW Bug] Sync lights after player rejoin * Update Round.cs --------- Co-authored-by: Nao Co-authored-by: Valentin Arthur Thomas <64769541+warquys@users.noreply.github.com> Co-authored-by: Nao <60253860+NaoUnderscore@users.noreply.github.com> Co-authored-by: Misaka-ZeroTwo <45165615+Misaka-ZeroTwo@users.noreply.github.com> Co-authored-by: VALERA771 <72030575+VALERA771@users.noreply.github.com> Co-authored-by: Yamato Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> Co-authored-by: Bolton <48883340+BoltonDev@users.noreply.github.com> Co-authored-by: INZI <98975836+InziDeveloperMode@users.noreply.github.com> Co-authored-by: Leonard Timofeev Co-authored-by: Nameless <85962933+Misfiy@users.noreply.github.com> Co-authored-by: Naounderscore Co-authored-by: 1EnesBaturKaza <156574288+1EnesBaturKaza@users.noreply.github.com> Co-authored-by: Dogy <157377508+RealDogy@users.noreply.github.com> --- Exiled.Events/Handlers/Internal/Round.cs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/Exiled.Events/Handlers/Internal/Round.cs b/Exiled.Events/Handlers/Internal/Round.cs index 5409fa67c9..400eb044c8 100644 --- a/Exiled.Events/Handlers/Internal/Round.cs +++ b/Exiled.Events/Handlers/Internal/Round.cs @@ -7,14 +7,16 @@ namespace Exiled.Events.Handlers.Internal { + using System.Linq; + using CentralAuth; + using Exiled.API.Extensions; using Exiled.API.Features; using Exiled.API.Features.Roles; using Exiled.Events.EventArgs.Player; using Exiled.Events.EventArgs.Scp049; using Exiled.Loader; using Exiled.Loader.Features; - using InventorySystem; using InventorySystem.Items.Usables; using PlayerRoles; @@ -83,6 +85,13 @@ public static void OnActivatingSense(ActivatingSenseEventArgs ev) public static void OnVerified(VerifiedEventArgs ev) { RoleAssigner.CheckLateJoin(ev.Player.ReferenceHub, ClientInstanceMode.ReadyClient); + + // TODO: Remove if this has been fixed for https://trello.com/c/CzPD304L/5983-networking-blackout-is-not-synchronized-for-the-new-players + foreach (Room room in Room.List.Where(current => current.AreLightsOff)) + { + ev.Player.SendFakeSyncVar(room.RoomLightControllerNetIdentity, typeof(RoomLightController), nameof(RoomLightController.NetworkLightsEnabled), true); + ev.Player.SendFakeSyncVar(room.RoomLightControllerNetIdentity, typeof(RoomLightController), nameof(RoomLightController.NetworkLightsEnabled), false); + } } } } From dc4e5260f23b8d4ddfd0298efbfddaefdf0dc24c Mon Sep 17 00:00:00 2001 From: VALERA771 <72030575+VALERA771@users.noreply.github.com> Date: Sat, 3 Feb 2024 21:21:18 +0300 Subject: [PATCH 112/141] `[Exiled::CustomModules]`, `[Exiled::API]`, `[Exiled::Events]` additions (#2390) * lots of features * new tracking logic * tracking changes --------- Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> --- Exiled.API/Features/Items/Scp330.cs | 18 +++ Exiled.API/Features/Player.cs | 13 ++ .../CustomItems/Items/Candies/BaseCandy.cs | 38 +++++ .../Items/Candies/CandyBehaviour.cs | 148 ++++++++++++++++++ .../Items/Candies/CandySettings.cs | 70 +++++++++ .../Items/Candies/Patches/DroppingCandy.cs | 57 +++++++ .../API/Features/TrackerBase.cs | 32 ++-- .../EventArgs/Scp330/EatingScp330EventArgs.cs | 4 +- .../Patches/Events/Scp330/EatingScp330.cs | 9 ++ 9 files changed, 371 insertions(+), 18 deletions(-) create mode 100644 Exiled.CustomModules/API/Features/CustomItems/Items/Candies/BaseCandy.cs create mode 100644 Exiled.CustomModules/API/Features/CustomItems/Items/Candies/CandyBehaviour.cs create mode 100644 Exiled.CustomModules/API/Features/CustomItems/Items/Candies/CandySettings.cs create mode 100644 Exiled.CustomModules/API/Features/CustomItems/Items/Candies/Patches/DroppingCandy.cs diff --git a/Exiled.API/Features/Items/Scp330.cs b/Exiled.API/Features/Items/Scp330.cs index d0a7e3b9c8..4dbd946058 100644 --- a/Exiled.API/Features/Items/Scp330.cs +++ b/Exiled.API/Features/Items/Scp330.cs @@ -87,6 +87,24 @@ internal Scp330() /// public CandyKindID ExposedType { get; set; } = CandyKindID.None; + /// + /// Gets or sets a index in of current selected candy. + /// + public int SelectedCandyId + { + get => Base.SelectedCandyId; + set + { + Base.SelectedCandyId = value; + Base.Owner.connectionToClient.Send(new SelectScp330Message + { + CandyID = value, + Drop = false, + Serial = Serial, + }); + } + } + /// /// Adds a specific candy to the bag. /// diff --git a/Exiled.API/Features/Player.cs b/Exiled.API/Features/Player.cs index c0c2b6feb2..668de9ca2d 100644 --- a/Exiled.API/Features/Player.cs +++ b/Exiled.API/Features/Player.cs @@ -1790,6 +1790,19 @@ public bool TryGetItem(ushort serial, out Item item) return item != null; } + /// + /// Tries to get an items from a player's inventory. + /// + /// The predicate to satisfy. + /// The found. + /// if the item is found, otherwise. + public bool TryGetItems(Func predicate, out IEnumerable items) + { + items = Items.Where(predicate); + + return items.Count() != 0; + } + /// /// Sets the player's rank. /// diff --git a/Exiled.CustomModules/API/Features/CustomItems/Items/Candies/BaseCandy.cs b/Exiled.CustomModules/API/Features/CustomItems/Items/Candies/BaseCandy.cs new file mode 100644 index 0000000000..e46f9ef99e --- /dev/null +++ b/Exiled.CustomModules/API/Features/CustomItems/Items/Candies/BaseCandy.cs @@ -0,0 +1,38 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.CustomModules.API.Features.CustomItems.Items.Candies +{ + using Exiled.API.Features; + using InventorySystem.Items.Usables.Scp330; + + /// + /// A class that convert custom candy to base game candy. + /// + internal class BaseCandy : ICandy + { + private CandySettings settings; + + /// + /// Initializes a new instance of the class. + /// + /// The that will be encapsulated. + internal BaseCandy(CandySettings settings) + { + this.settings = settings; + } + + /// + public CandyKindID Kind => settings.CandyType; + + /// + public float SpawnChanceWeight => settings.Weight / 100; + + /// + public void ServerApplyEffects(ReferenceHub hub) => settings.ApplyEffects(Player.Get(hub).Cast()); + } +} \ No newline at end of file diff --git a/Exiled.CustomModules/API/Features/CustomItems/Items/Candies/CandyBehaviour.cs b/Exiled.CustomModules/API/Features/CustomItems/Items/Candies/CandyBehaviour.cs new file mode 100644 index 0000000000..df33c23b27 --- /dev/null +++ b/Exiled.CustomModules/API/Features/CustomItems/Items/Candies/CandyBehaviour.cs @@ -0,0 +1,148 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.CustomModules.API.Features.CustomItems.Items.Candies +{ + using System.Collections.Generic; + using System.Linq; + + using Exiled.API.Features; + using Exiled.API.Features.Core; + using Exiled.API.Features.Core.Generics; + using Exiled.API.Features.Items; + using Exiled.Events.EventArgs.Scp330; + using UnityEngine; + + /// + /// Represents the base class for custom candies behaviors. + /// + /// + /// This class extends . + ///
It provides a foundation for creating custom behaviors associated with in-game candies. + ///
+ public abstract class CandyBehaviour : ItemBehaviour + { + /// + /// Gets or sets a hash set with all tracked indexes in . + /// + public HashSet TrackedCandies { get; protected set; } + + /// + public CandySettings CandySettings => Settings.Cast(); + + /// + public Scp330 Scp330 => Owner.Cast(); + + /// + protected override void PostInitialize() + { + base.PostInitialize(); + + if (Owner is not Scp330 _) + { + Log.Debug($"{CustomItem.Name} is not a Scp330 bag!", true); + Destroy(); + } + + if (Settings is not CandySettings _) + { + Log.Debug($"{CustomItem.Name} settings is not suitable for candies!", true); + Destroy(); + } + + CandySettings.SelectedText = new($"Custom candies in this bag:\n{string.Join("\n", TrackedCandies.Select(x => x++))}"); + TrackedCandies = new(); + } + + /// + protected override void OnDestroyed() + { + base.OnDestroyed(); + + TrackedCandies.Clear(); + } + + /// + protected override bool Check(Item owner) => base.Check(owner) && owner.Is(out Scp330 scp330) && TrackedCandies.Contains(scp330.SelectedCandyId); + + /// + protected override void SubscribeEvents() + { + base.SubscribeEvents(); + + Exiled.Events.Handlers.Scp330.EatingScp330 += OnInternalEatingCandy; + Exiled.Events.Handlers.Scp330.InteractingScp330 += OnInternalInteracting; + } + + /// + protected override void UnsubscribeEvents() + { + base.UnsubscribeEvents(); + + Exiled.Events.Handlers.Scp330.EatingScp330 -= OnInternalEatingCandy; + Exiled.Events.Handlers.Scp330.InteractingScp330 -= OnInternalInteracting; + } + + /// + protected override void OnAcquired(Player player, Item item, bool displayMessage = true) + { + base.OnAcquired(player, item, displayMessage); + + if (Scp330.Candies.Count == 0) + { + TrackedCandies.Add(Scp330.Candies.Count); + Scp330.AddCandy(CandySettings.CandyType); + } + else + { + TrackedCandies.Add(Scp330.Candies.Count - 1); + } + } + + /// + /// Fired when player is eating custom candy. + /// + /// The event instance. + protected virtual void OnEatingCandy(EatingScp330EventArgs ev) + { + } + + /// + /// Fired when player interacts with SCP-330 and gets a custom candy. + /// + /// The event instance. + protected virtual void OnInteracting(InteractingScp330EventArgs ev) + { + } + + /// + private protected void OnInternalEatingCandy(EatingScp330EventArgs ev) + { + if (!ev.Player.TryGetItems(x => x.Type == ItemType.SCP330, out IEnumerable items) || !items.Single().Is(out Scp330 scp330) || !Check(scp330)) + return; + + ev.Candy = new BaseCandy(CandySettings); + ev.Player.ShowTextDisplay(CandySettings.EatenCustomCandyMessage); + + OnEatingCandy(ev); + } + + /// + private protected void OnInternalInteracting(InteractingScp330EventArgs ev) + { + if (ev.Candy != CandySettings.CandyType || Random.value * 100 >= CandySettings.Weight || !ev.Player.TryGetItems(x => x.Type == ItemType.SCP330, out IEnumerable items) || !items.Single().Is(out Scp330 scp330)) + return; + + TrackedCandies.Add(scp330.SelectedCandyId); + StaticActor.Get().AddOrTrack(scp330); + scp330.AddComponent(); + ev.Player.ShowTextDisplay(CandySettings.ReceiveCustomCandyMessage); + + OnInteracting(ev); + } + } +} \ No newline at end of file diff --git a/Exiled.CustomModules/API/Features/CustomItems/Items/Candies/CandySettings.cs b/Exiled.CustomModules/API/Features/CustomItems/Items/Candies/CandySettings.cs new file mode 100644 index 0000000000..e49eb85fea --- /dev/null +++ b/Exiled.CustomModules/API/Features/CustomItems/Items/Candies/CandySettings.cs @@ -0,0 +1,70 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.CustomModules.API.Features.CustomItems.Items.Candies +{ + using System; + + using Exiled.API.Enums; + using Exiled.API.Features; + using InventorySystem.Items.Usables.Scp330; + using UnityEngine; + + /// + /// A tool to easily setup candies. + /// + public class CandySettings : ItemSettings + { + /// + public override ItemType ItemType + { + get => base.ItemType; + set + { + if (value != ItemType.SCP330) + throw new ArgumentOutOfRangeException(nameof(Type), value, "ItemType must be ItemType.SCP330"); + + base.ItemType = value; + } + } + + /// + /// Gets or sets a of a custom candy. + /// + public virtual CandyKindID CandyType { get; set; } + + /// + /// Gets or sets chance that player would get a custom candy. + /// + public override float Weight + { + get => base.Weight; + set => base.Weight = Mathf.Clamp(value, 0, 100); + } + + /// + /// Gets or sets the that will be displayed when player ate custom candy.. + /// + public virtual TextDisplay EatenCustomCandyMessage { get; set; } = new("You have eaten a custom candy. Let's see what effect you will get...", 5, true, TextChannelType.Hint); + + /// + /// Gets or sets a that will be displayed when player has received custom candy. + /// + public virtual TextDisplay ReceiveCustomCandyMessage { get; set; } = new("You have received a custom candy!", 5, true, TextChannelType.Hint); + + /// + public override TextDisplay SelectedText { get; set; } + + /// + /// Applies effect to player. + /// + /// Player to apply effects. + public virtual void ApplyEffects(Pawn player) + { + } + } +} \ No newline at end of file diff --git a/Exiled.CustomModules/API/Features/CustomItems/Items/Candies/Patches/DroppingCandy.cs b/Exiled.CustomModules/API/Features/CustomItems/Items/Candies/Patches/DroppingCandy.cs new file mode 100644 index 0000000000..770621be9f --- /dev/null +++ b/Exiled.CustomModules/API/Features/CustomItems/Items/Candies/Patches/DroppingCandy.cs @@ -0,0 +1,57 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.CustomModules.API.Features.CustomItems.Items.Candies.Patches +{ + using System.Collections.Generic; + using System.Reflection.Emit; + + using Exiled.API.Features.Items; + using Exiled.API.Features.Pools; + using HarmonyLib; + using InventorySystem.Items; + using InventorySystem.Items.Usables.Scp330; + + using static HarmonyLib.AccessTools; + + /// + /// Patches to add custom candies tracking-removing logic. + /// + [HarmonyPatch(typeof(Scp330NetworkHandler), nameof(Scp330NetworkHandler.ServerSelectMessageReceived))] + internal class DroppingCandy + { + private static IEnumerable Transpiler(IEnumerable instructions) + { + List newInstructions = ListPool.Pool.Get(instructions); + + int index = newInstructions.FindIndex(x => x.opcode == OpCodes.Ldloca_S); + + newInstructions.InsertRange( + index, + new[] + { + // DropCandy(Item, SelectScp330Message); + new CodeInstruction(OpCodes.Ldloc_1).MoveLabelsFrom(newInstructions[index]), + new(OpCodes.Call, Method(typeof(Item), nameof(Item.Get), new[] { typeof(ItemBase) })), + new(OpCodes.Ldarg_1), + new(OpCodes.Call, Method(typeof(DroppingCandy), nameof(DropCandy))), + }); + + for (int z = 0; z < newInstructions.Count; z++) + yield return newInstructions[z]; + } + + private static void DropCandy(Item item, SelectScp330Message msg) + { + if (!item.Is(out Scp330 _) || !CustomItem.TryGet(item, out CustomItem customItem) + || customItem.BehaviourComponent != typeof(CandyBehaviour) || !item.TryGetComponent(out CandyBehaviour candyBehaviour)) + return; + + candyBehaviour.TrackedCandies.Remove(msg.CandyID); + } + } +} \ No newline at end of file diff --git a/Exiled.CustomModules/API/Features/TrackerBase.cs b/Exiled.CustomModules/API/Features/TrackerBase.cs index 18e4b9b4b0..2433c94285 100644 --- a/Exiled.CustomModules/API/Features/TrackerBase.cs +++ b/Exiled.CustomModules/API/Features/TrackerBase.cs @@ -30,52 +30,52 @@ public class TrackerBase : StaticActor where T : ITrackable { /// - /// Gets the which handles all the delegates fired when an item is added. + /// Gets or sets the which handles all the delegates fired when an item is added. /// [DynamicEventDispatcher] - public TDynamicEventDispatcher ItemAddedDispatcher { get; private set; } + public TDynamicEventDispatcher ItemAddedDispatcher { get; set; } /// - /// Gets the which handles all the delegates fired when an item is removed. + /// Gets or sets the which handles all the delegates fired when an item is removed. /// [DynamicEventDispatcher] - public TDynamicEventDispatcher ItemRemovedDispatcher { get; private set; } + public TDynamicEventDispatcher ItemRemovedDispatcher { get; set; } /// - /// Gets the which handles all the delegates fired when an item is restored. + /// Gets or sets the which handles all the delegates fired when an item is restored. /// [DynamicEventDispatcher] - public TDynamicEventDispatcher ItemRestoredDispatcher { get; private set; } + public TDynamicEventDispatcher ItemRestoredDispatcher { get; set; } /// - /// Gets the which handles all the delegates fired when an item tracking is modified. + /// Gets or sets the which handles all the delegates fired when an item tracking is modified. /// [DynamicEventDispatcher] - public TDynamicEventDispatcher ItemTrackingModifiedDispatcher { get; private set; } + public TDynamicEventDispatcher ItemTrackingModifiedDispatcher { get; set; } /// - /// Gets the which handles all the delegates fired when a pickup is added. + /// Gets or sets the which handles all the delegates fired when a pickup is added. /// [DynamicEventDispatcher] - public TDynamicEventDispatcher PickupAddedDispatcher { get; private set; } + public TDynamicEventDispatcher PickupAddedDispatcher { get; set; } /// - /// Gets the which handles all the delegates fired when a pickup is removed. + /// Gets or sets the which handles all the delegates fired when a pickup is removed. /// [DynamicEventDispatcher] - public TDynamicEventDispatcher PickupRemovedDispatcher { get; private set; } + public TDynamicEventDispatcher PickupRemovedDispatcher { get; set; } /// - /// Gets the which handles all the delegates fired when a pickup is restored. + /// Gets or sets the which handles all the delegates fired when a pickup is restored. /// [DynamicEventDispatcher] - public TDynamicEventDispatcher PickupRestoredDispatcher { get; private set; } + public TDynamicEventDispatcher PickupRestoredDispatcher { get; set; } /// - /// Gets the which handles all the delegates fired when a pickup tracking is modified. + /// Gets or sets the which handles all the delegates fired when a pickup tracking is modified. /// [DynamicEventDispatcher] - public TDynamicEventDispatcher PickupTrackingModifiedDispatcher { get; private set; } + public TDynamicEventDispatcher PickupTrackingModifiedDispatcher { get; set; } /// /// Gets a containing all serials and their corresponding items. diff --git a/Exiled.Events/EventArgs/Scp330/EatingScp330EventArgs.cs b/Exiled.Events/EventArgs/Scp330/EatingScp330EventArgs.cs index d24a57ad40..bd56a64369 100644 --- a/Exiled.Events/EventArgs/Scp330/EatingScp330EventArgs.cs +++ b/Exiled.Events/EventArgs/Scp330/EatingScp330EventArgs.cs @@ -32,9 +32,9 @@ public EatingScp330EventArgs(Player player, ICandy candy, bool isAllowed = true) } /// - /// Gets the that is being eaten by the player. + /// Gets or sets the that is being eaten by the player. /// - public ICandy Candy { get; } + public ICandy Candy { get; set; } /// /// Gets or sets a value indicating whether or not the player can eat SCP-330. diff --git a/Exiled.Events/Patches/Events/Scp330/EatingScp330.cs b/Exiled.Events/Patches/Events/Scp330/EatingScp330.cs index 63cffa7358..1c9df069a3 100644 --- a/Exiled.Events/Patches/Events/Scp330/EatingScp330.cs +++ b/Exiled.Events/Patches/Events/Scp330/EatingScp330.cs @@ -42,6 +42,8 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable Date: Sat, 3 Feb 2024 21:21:29 +0300 Subject: [PATCH 113/141] fixes (#2420) --- Exiled.Events/Patches/Events/Player/Joined.cs | 2 +- Exiled.Events/Patches/Events/Server/RestartingRound.cs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Exiled.Events/Patches/Events/Player/Joined.cs b/Exiled.Events/Patches/Events/Player/Joined.cs index e69b5216a9..35c942de4d 100644 --- a/Exiled.Events/Patches/Events/Player/Joined.cs +++ b/Exiled.Events/Patches/Events/Player/Joined.cs @@ -32,7 +32,7 @@ internal static void CallEvent(ReferenceHub hub, out Player player) #if DEBUG Log.Debug("Creating new player object"); #endif - player = Activator.CreateInstance(Player.DEFAULT_PLAYER_CLASS, false, hub) as Player; + player = Activator.CreateInstance(Player.DEFAULT_PLAYER_CLASS, args: hub) as Player; #if DEBUG Log.Debug($"Object exists {player is not null}"); Log.Debug($"Creating player object for {hub.nicknameSync.Network_displayName}"); diff --git a/Exiled.Events/Patches/Events/Server/RestartingRound.cs b/Exiled.Events/Patches/Events/Server/RestartingRound.cs index 5e9548a076..341bd19eaf 100644 --- a/Exiled.Events/Patches/Events/Server/RestartingRound.cs +++ b/Exiled.Events/Patches/Events/Server/RestartingRound.cs @@ -42,7 +42,8 @@ private static IEnumerable Transpiler(IEnumerable Date: Sat, 3 Feb 2024 19:47:47 +0100 Subject: [PATCH 114/141] Fix custom `Candy` API. --- .../CustomItems/Items/Candies/BaseCandy.cs | 14 ++++++-- .../Items/Candies/CandyBehaviour.cs | 35 ++++++++++++------- .../Items/Candies/CandySettings.cs | 12 ++----- .../Items/Candies/Patches/DroppingCandy.cs | 2 +- 4 files changed, 37 insertions(+), 26 deletions(-) diff --git a/Exiled.CustomModules/API/Features/CustomItems/Items/Candies/BaseCandy.cs b/Exiled.CustomModules/API/Features/CustomItems/Items/Candies/BaseCandy.cs index e46f9ef99e..d06da0e36a 100644 --- a/Exiled.CustomModules/API/Features/CustomItems/Items/Candies/BaseCandy.cs +++ b/Exiled.CustomModules/API/Features/CustomItems/Items/Candies/BaseCandy.cs @@ -7,11 +7,13 @@ namespace Exiled.CustomModules.API.Features.CustomItems.Items.Candies { + using System; + using Exiled.API.Features; using InventorySystem.Items.Usables.Scp330; /// - /// A class that convert custom candy to base game candy. + /// A class that converts custom candy to base game candy. /// internal class BaseCandy : ICandy { @@ -21,7 +23,8 @@ internal class BaseCandy : ICandy /// Initializes a new instance of the class. /// /// The that will be encapsulated. - internal BaseCandy(CandySettings settings) + /// The delegate to be passed to . + internal BaseCandy(CandySettings settings, Action applyEffectsDelegate) { this.settings = settings; } @@ -32,7 +35,12 @@ internal BaseCandy(CandySettings settings) /// public float SpawnChanceWeight => settings.Weight / 100; + /// + /// Gets the delegate to be passed to . + /// + public Action ApplyEffects { get; } + /// - public void ServerApplyEffects(ReferenceHub hub) => settings.ApplyEffects(Player.Get(hub).Cast()); + public void ServerApplyEffects(ReferenceHub hub) => ApplyEffects(Player.Get(hub).Cast()); } } \ No newline at end of file diff --git a/Exiled.CustomModules/API/Features/CustomItems/Items/Candies/CandyBehaviour.cs b/Exiled.CustomModules/API/Features/CustomItems/Items/Candies/CandyBehaviour.cs index df33c23b27..a4e5ab7fd1 100644 --- a/Exiled.CustomModules/API/Features/CustomItems/Items/Candies/CandyBehaviour.cs +++ b/Exiled.CustomModules/API/Features/CustomItems/Items/Candies/CandyBehaviour.cs @@ -12,7 +12,8 @@ namespace Exiled.CustomModules.API.Features.CustomItems.Items.Candies using Exiled.API.Features; using Exiled.API.Features.Core; - using Exiled.API.Features.Core.Generics; + using Exiled.API.Features.Core.Behaviours; + using Exiled.API.Features.Core.Generic; using Exiled.API.Features.Items; using Exiled.Events.EventArgs.Scp330; using UnityEngine; @@ -27,16 +28,24 @@ namespace Exiled.CustomModules.API.Features.CustomItems.Items.Candies public abstract class CandyBehaviour : ItemBehaviour { /// - /// Gets or sets a hash set with all tracked indexes in . + /// Gets or sets a containing all tracked indexes in . /// public HashSet TrackedCandies { get; protected set; } /// public CandySettings CandySettings => Settings.Cast(); - /// + /// . public Scp330 Scp330 => Owner.Cast(); + /// + /// Applies effect to player. + /// + /// The player to apply effects to. + public virtual void ApplyEffects(Pawn player) + { + } + /// protected override void PostInitialize() { @@ -74,8 +83,8 @@ protected override void SubscribeEvents() { base.SubscribeEvents(); - Exiled.Events.Handlers.Scp330.EatingScp330 += OnInternalEatingCandy; - Exiled.Events.Handlers.Scp330.InteractingScp330 += OnInternalInteracting; + Exiled.Events.Handlers.Scp330.EatingScp330 += OnEatingScp330Internal; + Exiled.Events.Handlers.Scp330.InteractingScp330 += OnInteractingScp330Internal; } /// @@ -83,8 +92,8 @@ protected override void UnsubscribeEvents() { base.UnsubscribeEvents(); - Exiled.Events.Handlers.Scp330.EatingScp330 -= OnInternalEatingCandy; - Exiled.Events.Handlers.Scp330.InteractingScp330 -= OnInternalInteracting; + Exiled.Events.Handlers.Scp330.EatingScp330 -= OnEatingScp330Internal; + Exiled.Events.Handlers.Scp330.InteractingScp330 -= OnInteractingScp330Internal; } /// @@ -120,27 +129,29 @@ protected virtual void OnInteracting(InteractingScp330EventArgs ev) } /// - private protected void OnInternalEatingCandy(EatingScp330EventArgs ev) + private protected void OnEatingScp330Internal(EatingScp330EventArgs ev) { if (!ev.Player.TryGetItems(x => x.Type == ItemType.SCP330, out IEnumerable items) || !items.Single().Is(out Scp330 scp330) || !Check(scp330)) return; - ev.Candy = new BaseCandy(CandySettings); + ev.Candy = new BaseCandy(CandySettings, ApplyEffects); ev.Player.ShowTextDisplay(CandySettings.EatenCustomCandyMessage); OnEatingCandy(ev); } /// - private protected void OnInternalInteracting(InteractingScp330EventArgs ev) + private protected void OnInteractingScp330Internal(InteractingScp330EventArgs ev) { - if (ev.Candy != CandySettings.CandyType || Random.value * 100 >= CandySettings.Weight || !ev.Player.TryGetItems(x => x.Type == ItemType.SCP330, out IEnumerable items) || !items.Single().Is(out Scp330 scp330)) + if (ev.Candy != CandySettings.CandyType || Random.value * 100 >= CandySettings.Weight || + !ev.Player.TryGetItems(x => x.Type == ItemType.SCP330, out IEnumerable items) || + !items.Single().Is(out Scp330 scp330)) return; TrackedCandies.Add(scp330.SelectedCandyId); StaticActor.Get().AddOrTrack(scp330); scp330.AddComponent(); - ev.Player.ShowTextDisplay(CandySettings.ReceiveCustomCandyMessage); + ev.Player.ShowTextDisplay(CandySettings.ReceivedCustomCandyMessage); OnInteracting(ev); } diff --git a/Exiled.CustomModules/API/Features/CustomItems/Items/Candies/CandySettings.cs b/Exiled.CustomModules/API/Features/CustomItems/Items/Candies/CandySettings.cs index e49eb85fea..cb50373280 100644 --- a/Exiled.CustomModules/API/Features/CustomItems/Items/Candies/CandySettings.cs +++ b/Exiled.CustomModules/API/Features/CustomItems/Items/Candies/CandySettings.cs @@ -49,22 +49,14 @@ public override float Weight /// /// Gets or sets the that will be displayed when player ate custom candy.. /// - public virtual TextDisplay EatenCustomCandyMessage { get; set; } = new("You have eaten a custom candy. Let's see what effect you will get...", 5, true, TextChannelType.Hint); + public virtual TextDisplay EatenCustomCandyMessage { get; set; } /// /// Gets or sets a that will be displayed when player has received custom candy. /// - public virtual TextDisplay ReceiveCustomCandyMessage { get; set; } = new("You have received a custom candy!", 5, true, TextChannelType.Hint); + public virtual TextDisplay ReceivedCustomCandyMessage { get; set; } /// public override TextDisplay SelectedText { get; set; } - - /// - /// Applies effect to player. - /// - /// Player to apply effects. - public virtual void ApplyEffects(Pawn player) - { - } } } \ No newline at end of file diff --git a/Exiled.CustomModules/API/Features/CustomItems/Items/Candies/Patches/DroppingCandy.cs b/Exiled.CustomModules/API/Features/CustomItems/Items/Candies/Patches/DroppingCandy.cs index 770621be9f..07e79e68ee 100644 --- a/Exiled.CustomModules/API/Features/CustomItems/Items/Candies/Patches/DroppingCandy.cs +++ b/Exiled.CustomModules/API/Features/CustomItems/Items/Candies/Patches/DroppingCandy.cs @@ -10,8 +10,8 @@ namespace Exiled.CustomModules.API.Features.CustomItems.Items.Candies.Patches using System.Collections.Generic; using System.Reflection.Emit; + using Exiled.API.Features.Core.Generic.Pools; using Exiled.API.Features.Items; - using Exiled.API.Features.Pools; using HarmonyLib; using InventorySystem.Items; using InventorySystem.Items.Usables.Scp330; From b4c707c593468548535e1a3046dd79c0d5377e72 Mon Sep 17 00:00:00 2001 From: CreepycatsTTV <68137105+creepycats@users.noreply.github.com> Date: Sat, 3 Feb 2024 13:53:04 -0500 Subject: [PATCH 115/141] Add Player.Loudness (Mic Volume/Loudness) (#2364) * Add Player.Loudness * Player.Loudness Transpiler * Change Documentation Player.Loudness Co-authored-by: VALERA771 <72030575+VALERA771@users.noreply.github.com> * Change Documentation Again Player.Loudness oops. * Label Changes PlayerVolume.cs * PlayerVolume Label Removal * Fix Transpiler for Player.Loudness * Remove unnecessary null check Player.Loudness * Fix Stylecop * Simplify Loudness Float Co-authored-by: Nao <60253860+NaoUnderscore@users.noreply.github.com> * I am reta (Remove the stupid from Loudness) --------- Co-authored-by: VALERA771 <72030575+VALERA771@users.noreply.github.com> Co-authored-by: Nao <60253860+NaoUnderscore@users.noreply.github.com> --- Exiled.API/Features/Player.cs | 5 + Exiled.Events/Patches/Generic/PlayerVolume.cs | 136 ++++++++++++++++++ 2 files changed, 141 insertions(+) create mode 100644 Exiled.Events/Patches/Generic/PlayerVolume.cs diff --git a/Exiled.API/Features/Player.cs b/Exiled.API/Features/Player.cs index 668de9ca2d..475e1a5681 100644 --- a/Exiled.API/Features/Player.cs +++ b/Exiled.API/Features/Player.cs @@ -782,6 +782,11 @@ public bool IsIntercomMuted /// public bool IsSpeaking => VoiceModule != null && VoiceModule.IsSpeaking; + /// + /// Gets the loudness of a player when speaking. + /// + public float Loudness => !IsSpeaking || VoiceModule is not StandardVoiceModule standardModule ? 0f : standardModule.GlobalPlayback.Loudness; + /// /// Gets the player's voice color. /// diff --git a/Exiled.Events/Patches/Generic/PlayerVolume.cs b/Exiled.Events/Patches/Generic/PlayerVolume.cs new file mode 100644 index 0000000000..3649c6be3b --- /dev/null +++ b/Exiled.Events/Patches/Generic/PlayerVolume.cs @@ -0,0 +1,136 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Events.Patches.Generic +{ + using System.Collections.Generic; + using System.Linq; + using System.Reflection.Emit; + + using API.Features; + using API.Features.Pools; + + using HarmonyLib; + + using PlayerRoles.Voice; + using UnityEngine; + using VoiceChat; + using VoiceChat.Codec; + using VoiceChat.Networking; + using VoiceChat.Playbacks; + + using static HarmonyLib.AccessTools; + + /// + /// Patches . + /// Implements , using and . + /// + [HarmonyPatch(typeof(VoiceTransceiver), nameof(VoiceTransceiver.ServerReceiveMessage))] + internal static class PlayerVolume + { + private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) + { + List newInstructions = Exiled.API.Features.Pools.ListPool.Pool.Get(instructions); + + Label skip = generator.DefineLabel(); + Label loopcheck = generator.DefineLabel(); + Label loopstart = generator.DefineLabel(); + + LocalBuilder plr = generator.DeclareLocal(typeof(Player)); + LocalBuilder svm = generator.DeclareLocal(typeof(StandardVoiceModule)); + LocalBuilder decoded = generator.DeclareLocal(typeof(float[])); + LocalBuilder pos = generator.DeclareLocal(typeof(int)); + + const int offset = 8; + int index = newInstructions.FindIndex(i => i.Calls(Method(typeof(VoiceModuleBase), nameof(VoiceModuleBase.ValidateSend), new[] { typeof(VoiceChatChannel) }))) + offset; + + newInstructions.InsertRange(index, new List() + { + // Player plr = Player.Get(msg.Speaker) + new(OpCodes.Ldarg_1), + new(OpCodes.Ldfld, Field(typeof(VoiceMessage), nameof(VoiceMessage.Speaker))), + new(OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new[] { typeof(ReferenceHub) })), + new(OpCodes.Stloc_S, plr), + + // if (plr.VoiceModule is StandardVoiceModule svm) + new(OpCodes.Ldloc_S, plr), + new(OpCodes.Callvirt, PropertyGetter(typeof(Player), nameof(Player.VoiceModule))), + new(OpCodes.Isinst, typeof(StandardVoiceModule)), + new(OpCodes.Stloc_S, svm), + new(OpCodes.Ldloc_S, svm), + new(OpCodes.Brfalse_S, skip), + + // float[] decoded = new float[48000] + new(OpCodes.Ldc_I4, 48000), + new(OpCodes.Newarr, typeof(float)), + new(OpCodes.Stloc_S, decoded), + + // plr.VoiceModule.Decoder.Decode(msg.Data, msg.DataLength, decoded); + new(OpCodes.Ldloc_S, plr), + new(OpCodes.Callvirt, PropertyGetter(typeof(Player), nameof(Player.VoiceModule))), + new(OpCodes.Callvirt, PropertyGetter(typeof(VoiceModuleBase), nameof(VoiceModuleBase.Decoder))), + new(OpCodes.Ldarg_1), + new(OpCodes.Ldfld, Field(typeof(VoiceMessage), nameof(VoiceMessage.Data))), + new(OpCodes.Ldarg_1), + new(OpCodes.Ldfld, Field(typeof(VoiceMessage), nameof(VoiceMessage.DataLength))), + new(OpCodes.Ldloc_S, decoded), + new(OpCodes.Callvirt, Method(typeof(OpusDecoder), nameof(OpusDecoder.Decode), new[] { typeof(byte[]), typeof(int), typeof(float[]) })), + new(OpCodes.Pop), + + // for (int i = 0; i < array.Length; i++) + new(OpCodes.Ldc_I4_0), + new(OpCodes.Stloc_S, pos), + + // decoded[i] = Mathf.Abs(decoded[i]) + new(OpCodes.Br_S, loopcheck), + + // loop start + new CodeInstruction(OpCodes.Nop).WithLabels(loopstart), + new(OpCodes.Ldloc_S, decoded), + new(OpCodes.Ldloc_S, pos), + new(OpCodes.Ldloc_S, decoded), + new(OpCodes.Ldloc_S, pos), + new(OpCodes.Ldelem_R4), + new(OpCodes.Call, Method(typeof(Mathf), nameof(Mathf.Abs), new[] { typeof(float) })), + new(OpCodes.Stelem_R4), + + // i++ + new(OpCodes.Ldloc_S, pos), + new(OpCodes.Ldc_I4_1), + new(OpCodes.Add), + new(OpCodes.Stloc_S, pos), + + // i < array.Length + new CodeInstruction(OpCodes.Nop).WithLabels(loopcheck), + new(OpCodes.Ldloc_S, pos), + new(OpCodes.Ldloc_S, decoded), + new(OpCodes.Ldlen), + new(OpCodes.Conv_I4), + new(OpCodes.Blt_S, loopstart), + + // end loop -> standardVoiceModule.GlobalPlayback.Loudness = array.Sum() / (float)msg.DataLength; + new(OpCodes.Ldloc_S, svm), + new(OpCodes.Ldfld, Field(typeof(StandardVoiceModule), nameof(StandardVoiceModule.GlobalPlayback))), + new(OpCodes.Ldloc_S, decoded), + new(OpCodes.Call, Method(typeof(Enumerable), nameof(Enumerable.Sum), new[] { typeof(IEnumerable) })), + new(OpCodes.Ldarg_1), + new(OpCodes.Ldfld, Field(typeof(VoiceMessage), nameof(VoiceMessage.DataLength))), + new(OpCodes.Conv_R4), + new(OpCodes.Div), + new(OpCodes.Callvirt, PropertySetter(typeof(VoiceChatPlaybackBase), nameof(VoiceChatPlaybackBase.Loudness))), + + // skip + new CodeInstruction(OpCodes.Nop).WithLabels(skip), + }); + + for (int z = 0; z < newInstructions.Count; z++) + yield return newInstructions[z]; + + ListPool.Pool.Return(newInstructions); + } + } +} From f62395946498c58acba33829312c20f0873abede Mon Sep 17 00:00:00 2001 From: sky <99112969+skyyt15@users.noreply.github.com> Date: Sat, 3 Feb 2024 19:53:11 +0100 Subject: [PATCH 116/141] `[Exiled::Events]` Adding `AddingObserver` and `RemovingObserver` events for Scp173 (#2384) * adding AddingObserver event and RemovingObserver event for Scp173 (again) the adding observer is triggered when a user just saw scp 173. for example, if ev.IsAllowed is set to false and the user is the only one who can saw scp173, the peanut can keep moving (it will be not added in the Observers list) an example when the ev.IsAllowed is set to false ![image](https://github.com/Exiled-Team/EXILED/assets/99112969/35454fc1-938a-4c89-bc63-deb0d4dbfbf1) he RemovingObserver is the same as the AddingObserver event but there is no a IsAllowed parameter (it's weird in this situation) and it's trigger when the player no longer saw scp173. special thanks to Bolton who help me to find stupid IL errors special thing to yamato: i have compile this xmas-2023 version in release build :trollface: edit: ho i forgot to tell: i have build all change and tested the events with a different plugin in my personnal server * comment fixing fixing nao change requested (comment lines) * fixing build error - change `Exiled.API.Features.Pools` using to `Exiled.API.Features.Core.Generic.Pools` --------- Co-authored-by: Nao <60253860+NaoUnderscore@users.noreply.github.com> --- .../Scp173/AddingObserverEventArgs.cs | 51 ++++++++ .../Scp173/RemoveObserverEventArgs.cs | 44 +++++++ Exiled.Events/Handlers/Scp173.cs | 22 ++++ .../Patches/Events/Scp173/Observers.cs | 116 ++++++++++++++++++ 4 files changed, 233 insertions(+) create mode 100644 Exiled.Events/EventArgs/Scp173/AddingObserverEventArgs.cs create mode 100644 Exiled.Events/EventArgs/Scp173/RemoveObserverEventArgs.cs create mode 100644 Exiled.Events/Patches/Events/Scp173/Observers.cs diff --git a/Exiled.Events/EventArgs/Scp173/AddingObserverEventArgs.cs b/Exiled.Events/EventArgs/Scp173/AddingObserverEventArgs.cs new file mode 100644 index 0000000000..c33a327bf3 --- /dev/null +++ b/Exiled.Events/EventArgs/Scp173/AddingObserverEventArgs.cs @@ -0,0 +1,51 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Events.EventArgs.Scp173 +{ + using API.Features; + using Exiled.API.Features.Roles; + using Interfaces; + + /// + /// Contains all information before a player sees SCP-173. + /// + public class AddingObserverEventArgs : IScp173Event, IDeniableEvent + { + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// + public AddingObserverEventArgs(Player player, Player target, bool isAllowed = true) + { + Scp173 = player.Role.As(); + Player = player; + Target = target; + IsAllowed = isAllowed; + } + + /// + public Scp173Role Scp173 { get; } + + /// + /// Gets the target who has looked at SCP-173. + /// + public Player Target { get; } + + /// + /// Gets the player who's controlling SCP-173. + /// + public Player Player { get; } + + /// + /// Gets or sets a value indicating whether the player can be added as an observer. + /// + public bool IsAllowed { get; set; } + } +} \ No newline at end of file diff --git a/Exiled.Events/EventArgs/Scp173/RemoveObserverEventArgs.cs b/Exiled.Events/EventArgs/Scp173/RemoveObserverEventArgs.cs new file mode 100644 index 0000000000..a044f50f64 --- /dev/null +++ b/Exiled.Events/EventArgs/Scp173/RemoveObserverEventArgs.cs @@ -0,0 +1,44 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Events.EventArgs.Scp173 +{ + using API.Features; + using Exiled.API.Features.Roles; + using Interfaces; + + /// + /// Contains all information after a player stops looking at SCP-173. + /// + public class RemoveObserverEventArgs : IScp173Event + { + /// + /// Initializes a new instance of the class. + /// + /// + /// + public RemoveObserverEventArgs(Player player, Player target) + { + Scp173 = player.Role.As(); + Player = player; + Target = target; + } + + /// + public Scp173Role Scp173 { get; } + + /// + /// Gets the player who's controlling SCP-173. + /// + public Player Player { get; } + + /// + /// Gets the target who no longer sees SCP-173. + /// + public Player Target { get; } + } +} \ No newline at end of file diff --git a/Exiled.Events/Handlers/Scp173.cs b/Exiled.Events/Handlers/Scp173.cs index bf844714b9..a3d69e8ef4 100644 --- a/Exiled.Events/Handlers/Scp173.cs +++ b/Exiled.Events/Handlers/Scp173.cs @@ -37,6 +37,16 @@ public static class Scp173 ///
public static Event UsingBreakneckSpeeds { get; set; } = new(); + /// + /// Invoked before a player starts looking at SCP-173. + /// + public static Event AddingObserver { get; set; } = new(); + + /// + /// Invoked after a player stops looking at SCP-173. + /// + public static Event RemoveObserver { get; set; } = new(); + /// /// Called before players near SCP-173 blink. /// @@ -60,5 +70,17 @@ public static class Scp173 ///
/// The instance. public static void OnUsingBreakneckSpeeds(UsingBreakneckSpeedsEventArgs ev) => UsingBreakneckSpeeds.InvokeSafely(ev); + + /// + /// Called before player starts looking at SCP-173. + /// + /// The instance. + public static void OnAddingObserver(AddingObserverEventArgs ev) => AddingObserver.InvokeSafely(ev); + + /// + /// Called after a player stops looking at SCP-173. + /// + /// The instance. + public static void OnRemoveObserver(RemoveObserverEventArgs ev) => RemoveObserver.InvokeSafely(ev); } } \ No newline at end of file diff --git a/Exiled.Events/Patches/Events/Scp173/Observers.cs b/Exiled.Events/Patches/Events/Scp173/Observers.cs new file mode 100644 index 0000000000..c32b121a6a --- /dev/null +++ b/Exiled.Events/Patches/Events/Scp173/Observers.cs @@ -0,0 +1,116 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Events.Patches.Events.Scp173 +{ + using System.Collections.Generic; + using System.Reflection.Emit; + + using API.Features; + using Attributes; + using Exiled.API.Features.Core.Generic.Pools; + using Exiled.Events.EventArgs.Scp173; + using HarmonyLib; + using PlayerRoles.PlayableScps.Scp173; + using PlayerRoles.Subroutines; + + using static HarmonyLib.AccessTools; + + /// + /// Patches . + /// Adds the event. + /// + [EventPatch(typeof(Handlers.Scp173), nameof(Handlers.Scp173.AddingObserver))] + [HarmonyPatch(typeof(Scp173ObserversTracker), nameof(Scp173ObserversTracker.UpdateObserver))] + internal static class Observers + { + private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) + { + List newInstructions = ListPool.Pool.Get(instructions); + + // AddingObserver patch + Label returnLabel = generator.DefineLabel(); + LocalBuilder ev = generator.DeclareLocal(typeof(AddingObserverEventArgs)); + + int index = newInstructions.FindIndex(x => x.Calls(Method(typeof(HashSet), nameof(HashSet.Add)))) + 2; + newInstructions[index].labels.Add(returnLabel); + + newInstructions.InsertRange(index, new CodeInstruction[] + { + // Player.Get(Owner); + new(OpCodes.Ldarg_0), + new(OpCodes.Callvirt, PropertyGetter(typeof(StandardSubroutine), nameof(StandardSubroutine.Owner))), + new(OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new[] { typeof(ReferenceHub) })), + + // Player.Get(ply); + new(OpCodes.Ldarg_1), + new(OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new[] { typeof(ReferenceHub) })), + + // true + new(OpCodes.Ldc_I4_1), + + // AddingObserverEventArgs ev = new(Player.Get(Owner), Player.Get(ply), true); + new(OpCodes.Newobj, GetDeclaredConstructors(typeof(AddingObserverEventArgs))[0]), + new(OpCodes.Stloc, ev), + + // Scp173.OnAddingObserver(ev); + new(OpCodes.Ldloc, ev), + new(OpCodes.Call, Method(typeof(Handlers.Scp173), nameof(Handlers.Scp173.OnAddingObserver))), + + // if (!ev.IsAllowed) + new(OpCodes.Ldloc, ev), + new(OpCodes.Callvirt, + PropertyGetter(typeof(AddingObserverEventArgs), nameof(AddingObserverEventArgs.IsAllowed))), + new(OpCodes.Brtrue_S, returnLabel), + + // Observers.Remove(ply); + new(OpCodes.Ldarg_0), + new(OpCodes.Ldfld, Field(typeof(Scp173ObserversTracker), nameof(Scp173ObserversTracker.Observers))), + new(OpCodes.Ldarg_1), + new(OpCodes.Callvirt, Method(typeof(HashSet), nameof(HashSet.Remove))), + new(OpCodes.Pop), + + // return 0; + new(OpCodes.Ldc_I4_0), + new(OpCodes.Ret), + }); + + // RemoveObserver patch + int index2 = newInstructions.FindLastIndex(x => x.Calls(Method(typeof(HashSet), nameof(HashSet.Remove)))) + 2; + + LocalBuilder ev2 = generator.DeclareLocal(typeof(RemoveObserverEventArgs)); + + newInstructions.InsertRange(index2, new CodeInstruction[] + { + // Player.Get(Owner); + new(OpCodes.Ldarg_0), + new(OpCodes.Callvirt, + PropertyGetter(typeof(StandardSubroutine), nameof(StandardSubroutine.Owner))), + new(OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new[] { typeof(ReferenceHub) })), + + // Player.Get(ply); + new(OpCodes.Ldarg_1), + new(OpCodes.Call, Method(typeof(Player), nameof(Player.Get), new[] { typeof(ReferenceHub) })), + + // new RemoveObserverEventArgs(Player.Get(Owner), Player.Get(ply)); + new(OpCodes.Newobj, GetDeclaredConstructors(typeof(RemoveObserverEventArgs))[0]), + new(OpCodes.Stloc, ev2), + + // Scp173.OnRemovingObserver(new RemoveObserverEventArgs(Player.Get(Owner), Player.Get(ply))); + new(OpCodes.Ldloc, ev2), + new(OpCodes.Call, Method(typeof(Handlers.Scp173), nameof(Handlers.Scp173.OnRemoveObserver))), + }); + + for (int z = 0; z < newInstructions.Count; z++) + { + yield return newInstructions[z]; + } + + ListPool.Pool.Return(newInstructions); + } + } +} \ No newline at end of file From 34790e27d2c466e9c7f6c357cec6bf6e2ca3b34a Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Sat, 3 Feb 2024 19:55:18 +0100 Subject: [PATCH 117/141] Fix build errors --- Exiled.Events/Patches/Generic/PlayerVolume.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Exiled.Events/Patches/Generic/PlayerVolume.cs b/Exiled.Events/Patches/Generic/PlayerVolume.cs index 3649c6be3b..fd7cf8730d 100644 --- a/Exiled.Events/Patches/Generic/PlayerVolume.cs +++ b/Exiled.Events/Patches/Generic/PlayerVolume.cs @@ -12,7 +12,7 @@ namespace Exiled.Events.Patches.Generic using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using HarmonyLib; @@ -34,11 +34,11 @@ internal static class PlayerVolume { private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) { - List newInstructions = Exiled.API.Features.Pools.ListPool.Pool.Get(instructions); + List newInstructions = ListPool.Pool.Get(instructions); Label skip = generator.DefineLabel(); - Label loopcheck = generator.DefineLabel(); - Label loopstart = generator.DefineLabel(); + Label loopCheck = generator.DefineLabel(); + Label loopStart = generator.DefineLabel(); LocalBuilder plr = generator.DeclareLocal(typeof(Player)); LocalBuilder svm = generator.DeclareLocal(typeof(StandardVoiceModule)); @@ -84,12 +84,12 @@ private static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable standardVoiceModule.GlobalPlayback.Loudness = array.Sum() / (float)msg.DataLength; new(OpCodes.Ldloc_S, svm), From 91b6b4dcb50e0acbd01b8159845e9ba4450c52c7 Mon Sep 17 00:00:00 2001 From: CreepycatsTTV <68137105+creepycats@users.noreply.github.com> Date: Sat, 3 Feb 2024 13:58:20 -0500 Subject: [PATCH 118/141] Allow `ID_Dedicated`/`null` for `Npc.UserId` Parameter. Additional functionality: - `Npc.LookAt` - `Npc.ShootWeapon` - `Npc.SetAimDownSight` - `Player.UnloadWeapon` - `Player.ToggleWeaponFlashlight` (#2297) * NPC Features + VSR Use "ID_Dedicated" to ensure an NPC is VSR Compliant Added Multiple Functions for NPC characters to Look at Points, and use a Held Firearm * Fix VSR-Compliant Tweak, allow Null UserID as Alternative * Slight Changes, Simplification, IDestructible * Weapon Functions to Bools, Rename Functions for Clarity * Fix Using, Documentation, Remove ReloadWeapon Fixed some formatting of Documentation and Usings Removed the ReloadWeapon Function from NPC.cs as Player.cs has it already. * Add LookAt shortcut override, add Lerping * Move Weapon Functions, LookAt Function to Player.cs from NPC.cs * Fix & Replace ADS, Look and Shoot back to NPC * String.Empty * Wow, Thanks Github, Totally Wanted That Checked Revert Project File * Change Player to NPC in Documentation * Switch to ushort.MaxValue * Rewrite LookAt At the request of Yamato, I looked to simplify the LookAt script. Now combined a lot of stuff into just a few lines, reduced math and use of Mathf.Repeat. Works just as well as it did before. * NPC? Hardly know her... Just reverted a line of the documentation, thats it --------- Co-authored-by: Nao <60253860+NaoUnderscore@users.noreply.github.com> --- Exiled.API/Features/Npc.cs | 120 ++++++++++++++++++++++++++++++++-- Exiled.API/Features/Player.cs | 36 +++++++++- 2 files changed, 148 insertions(+), 8 deletions(-) diff --git a/Exiled.API/Features/Npc.cs b/Exiled.API/Features/Npc.cs index a272fd3445..66e43baf78 100644 --- a/Exiled.API/Features/Npc.cs +++ b/Exiled.API/Features/Npc.cs @@ -13,21 +13,24 @@ namespace Exiled.API.Features using System.Linq; using System.Reflection; + using CentralAuth; using CommandSystem; using Exiled.API.Enums; using Exiled.API.Features.Components; - + using Exiled.API.Features.Roles; using Footprinting; - + using InventorySystem.Items.Firearms.BasicMessages; + using InventorySystem.Items.Firearms.Modules; using MEC; - using Mirror; using PlayerRoles; - + using PlayerRoles.FirstPersonControl; + using RelativePositioning; using UnityEngine; + using Firearm = Items.Firearm; using Object = UnityEngine.Object; /// @@ -137,7 +140,7 @@ public static Npc Spawn(string name, RoleTypeId role, int id = 0, string userId Npc npc = new(newObject) { - IsVerified = true, + IsVerified = userId != PlayerAuthenticationManager.DedicatedId && userId != null, IsNPC = true, }; @@ -161,7 +164,22 @@ public static Npc Spawn(string name, RoleTypeId role, int id = 0, string userId try { - npc.ReferenceHub.authManager.UserId = string.IsNullOrEmpty(userId) ? $"Dummy@localhost" : userId; + if (userId == PlayerAuthenticationManager.DedicatedId) + { + npc.ReferenceHub.authManager.SyncedUserId = userId; + try + { + npc.ReferenceHub.authManager.InstanceMode = ClientInstanceMode.DedicatedServer; + } + catch (Exception e) + { + Log.Debug($"Ignore: {e}"); + } + } + else + { + npc.ReferenceHub.authManager.UserId = userId == string.Empty ? $"Dummy@localhost" : userId; + } } catch (Exception e) { @@ -193,5 +211,95 @@ public void Destroy() Dictionary.Remove(GameObject); Object.Destroy(GameObject); } + + /// + /// Forces the NPC to look in the specified rotation. + /// + /// The position to look at. + public void LookAt(Vector3 position) + { + if (Role is FpcRole fpc) + { + Vector3 direction = position - Position; + Quaternion quat = Quaternion.LookRotation(direction, Vector3.up); + LookAt(quat); + } + } + + /// + /// Forces the NPC to look in the specified rotation. + /// + /// The rotation to look towards. + public void LookAt(Quaternion rotation) + { + if (Role is not FpcRole fpc) + return; + + if (rotation.eulerAngles.z != 0f) + rotation = Quaternion.LookRotation(rotation * Vector3.forward, Vector3.up); + + Vector2 angles = new Vector2(-rotation.eulerAngles.x, rotation.eulerAngles.y); + + ushort hor = (ushort)Mathf.RoundToInt(Mathf.Repeat(angles.y, 360f) * (ushort.MaxValue / 360f)); + ushort vert = (ushort)Mathf.RoundToInt(Mathf.Clamp(Mathf.Repeat(angles.x + 90f, 360f) - 2f, 0f, 176f) * (ushort.MaxValue / 176f)); + + fpc.FirstPersonController.FpcModule.MouseLook.ApplySyncValues(hor, vert); + } + + /// + /// Forces the NPC to shoot their current . + /// + /// if the weapon shot request is received. Returns otherwise, or if the player is not an or is not holding a . + public bool ShootWeapon() + { + if (CurrentItem is not Firearm firearm) + return false; + + if (!firearm.Base.ActionModule.ServerAuthorizeShot()) + return false; + + ShotMessage message = new ShotMessage() + { + ShooterCameraRotation = CameraTransform.rotation, + ShooterPosition = new RelativePosition(Transform.position), + ShooterWeaponSerial = CurrentItem.Serial, + TargetNetId = 0, + TargetPosition = default, + TargetRotation = Quaternion.identity, + }; + + Physics.Raycast(CameraTransform.position, CameraTransform.forward, out RaycastHit hit, firearm.Base.BaseStats.MaxDistance(), StandardHitregBase.HitregMask); + + if (hit.transform && hit.collider.TryGetComponent(out IDestructible destructible) && destructible != null) + { + message.TargetNetId = destructible.NetworkId; + message.TargetPosition = new RelativePosition(hit.transform.position); + message.TargetRotation = hit.transform.rotation; + } + else if (hit.transform) + { + message.TargetPosition = new RelativePosition(hit.transform.position); + message.TargetRotation = hit.transform.rotation; + } + + FirearmBasicMessagesHandler.ServerShotReceived(ReferenceHub.connectionToClient, message); + return true; + } + + /// + /// Sets the NPC's current status for Aiming Down Sights. + /// + /// Should the player be aiming down sights. + /// if the weapon Aim Down Sights request is received. Returns otherwise, or if the player is not an or is not holding a . + public bool SetAimDownSight(bool shouldADS) + { + if (CurrentItem is Firearm firearm) + { + FirearmBasicMessagesHandler.ServerRequestReceived(ReferenceHub.connectionToClient, new RequestMessage(firearm.Serial, shouldADS ? RequestType.AdsIn : RequestType.AdsOut)); + return true; + } + + return false; + } } } diff --git a/Exiled.API/Features/Player.cs b/Exiled.API/Features/Player.cs index 475e1a5681..ed2d06d737 100644 --- a/Exiled.API/Features/Player.cs +++ b/Exiled.API/Features/Player.cs @@ -1767,7 +1767,7 @@ public void TrySetCustomRoleFriendlyFire(string roleTypeId, Dictionary CustomRoleFriendlyFireMultiplier.Remove(role); /// - /// Forces the player to reload their current weapon. + /// Forces the player to reload their current . /// /// if firearm was successfully reloaded. Otherwise, . public bool ReloadWeapon() @@ -1775,13 +1775,45 @@ public bool ReloadWeapon() if (CurrentItem is Firearm firearm) { bool result = firearm.Base.AmmoManagerModule.ServerTryReload(); - Connection.Send(new RequestMessage(firearm.Serial, RequestType.Reload)); + if (result) + Connection.Send(new RequestMessage(firearm.Serial, RequestType.Reload)); return result; } return false; } + /// + /// Forces the player to unload their current . + /// + /// if the weapon unload request is received. Returns otherwise, or if the player is not an or is not holding a . + public bool UnloadWeapon() + { + if (CurrentItem is Firearm firearm) + { + bool result = firearm.Base.AmmoManagerModule.ServerTryUnload(); + if (result) + Connection.Send(new RequestMessage(firearm.Serial, RequestType.Unload)); + return result; + } + + return true; + } + + /// + /// Forces the player to toggle the Flashlight Attachment on their current . + /// + /// if the weapon flashlight toggle request is received. Returns otherwise, or if the player is not an or is not holding a . + public bool ToggleWeaponFlashlight() + { + if (RoleManager.CurrentRole is not IFpcRole fpc || CurrentItem is not Firearm firearm) + return false; + + bool oldCheck = firearm.FlashlightEnabled; // Temporary Solution + FirearmBasicMessagesHandler.ServerRequestReceived(ReferenceHub.connectionToClient, new RequestMessage(firearm.Serial, RequestType.ToggleFlashlight)); + return oldCheck != firearm.FlashlightEnabled; + } + /// /// Tries to get an item from a player's inventory. /// From 880dbef388cac12e79babf6da223405dd067b7a4 Mon Sep 17 00:00:00 2001 From: Rue <135553058+Ruemena@users.noreply.github.com> Date: Sat, 3 Feb 2024 13:03:01 -0600 Subject: [PATCH 119/141] add TargetOffset (#2114) * add * Rename TargetOffset.cs to TargetOffset.cs * Update TargetOffset.cs * Update Round.cs * Update Round.cs * Update Exiled.API/Features/Round.cs Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> * Update Round.cs * Nao Request * Fix spacing --------- Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> --- Exiled.API/Features/Round.cs | 20 ++++++- Exiled.Events/Patches/Generic/TargetOffset.cs | 54 +++++++++++++++++++ 2 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 Exiled.Events/Patches/Generic/TargetOffset.cs diff --git a/Exiled.API/Features/Round.cs b/Exiled.API/Features/Round.cs index 72ad72649c..c32b863e38 100644 --- a/Exiled.API/Features/Round.cs +++ b/Exiled.API/Features/Round.cs @@ -11,7 +11,7 @@ namespace Exiled.API.Features using System.Collections.Generic; using Enums; - + using Exiled.API.Extensions; using GameCore; using PlayerRoles; @@ -23,6 +23,8 @@ namespace Exiled.API.Features /// public static class Round { + private static int targetOffset; + /// /// Gets a list of players who will be ignored from determining round end. /// @@ -183,6 +185,22 @@ public static IEnumerable AliveSides } } + /// + /// Gets or sets a visual offset applied to the target counter for SCPs. + /// + public static int TargetOffset + { + get => targetOffset; + set + { + targetOffset = value; + foreach (Player player in Player.List) + { + player.SendFakeSyncVar(RoundSummary.singleton.netIdentity, typeof(RoundSummary), nameof(RoundSummary.Network_chaosTargetCount), RoundSummary.singleton._chaosTargetCount + TargetOffset); + } + } + } + /// /// Restarts the round with custom settings. /// diff --git a/Exiled.Events/Patches/Generic/TargetOffset.cs b/Exiled.Events/Patches/Generic/TargetOffset.cs new file mode 100644 index 0000000000..3940b89a34 --- /dev/null +++ b/Exiled.Events/Patches/Generic/TargetOffset.cs @@ -0,0 +1,54 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Events.Patches.Generic +{ + using System.Collections.Generic; + using System.Reflection; + using System.Reflection.Emit; + + using API.Features; + using API.Features.Pools; + + using HarmonyLib; + using Mirror; + + using static HarmonyLib.AccessTools; + + /// + /// Patches . + /// + [HarmonyPatch(typeof(RoundSummary), nameof(RoundSummary.SerializeSyncVars), typeof(NetworkWriter), typeof(bool))] + internal static class TargetOffset + { + private static IEnumerable Transpiler(IEnumerable instructions, ILGenerator generator) + { + static bool IsField(CodeInstruction instruction) => instruction.opcode == OpCodes.Ldfld + && (FieldInfo)instruction.operand == Field(typeof(RoundSummary), nameof(RoundSummary._chaosTargetCount)); + + List newInstructions = ListPool.Pool.Get(instructions); + + CodeInstruction[] addInstructions = new CodeInstruction[] + { + new(OpCodes.Call, PropertyGetter(typeof(Round), nameof(Round.TargetOffset))), + new(OpCodes.Add), + }; + + int offset = 1; + int index = newInstructions.FindIndex(IsField) + offset; + newInstructions.InsertRange(index, addInstructions); + + index = newInstructions.FindLastIndex(IsField) + offset; + newInstructions.InsertRange(index, addInstructions); + + for (int z = 0; z < newInstructions.Count; z++) + yield return newInstructions[z]; + + ListPool.Pool.Return(newInstructions); + } + } +} From d9d98b9bf412cf31f969fa7d3586b636b229120e Mon Sep 17 00:00:00 2001 From: VALERA771 <72030575+VALERA771@users.noreply.github.com> Date: Sat, 3 Feb 2024 22:04:56 +0300 Subject: [PATCH 120/141] Update `YamlDotNet` version. (#2239) * new yamldotnet * oops * resolving conflicts day 1 * update --------- Co-authored-by: Yamato <66829532+louis1706@users.noreply.github.com> --- EXILED.props | 1 + Exiled.API/Exiled.API.csproj | 1 + Exiled.API/Features/EConfig.cs | 1 + Exiled.Loader/Exiled.Loader.csproj | 1 - 4 files changed, 3 insertions(+), 1 deletion(-) diff --git a/EXILED.props b/EXILED.props index 153e247c7a..ebc138a0f3 100644 --- a/EXILED.props +++ b/EXILED.props @@ -22,6 +22,7 @@ 2.2.2 1.1.118 2.0.2 + 13.7.1 Copyright © $(Authors) 2020 - $([System.DateTime]::Now.ToString("yyyy")) Git diff --git a/Exiled.API/Exiled.API.csproj b/Exiled.API/Exiled.API.csproj index 8488ce823d..19a95ee8e6 100644 --- a/Exiled.API/Exiled.API.csproj +++ b/Exiled.API/Exiled.API.csproj @@ -23,6 +23,7 @@ + diff --git a/Exiled.API/Features/EConfig.cs b/Exiled.API/Features/EConfig.cs index 0480d107d3..f77b2f4487 100644 --- a/Exiled.API/Features/EConfig.cs +++ b/Exiled.API/Features/EConfig.cs @@ -70,6 +70,7 @@ public sealed class EConfig : TypeCastObject .WithTypeConverter(new AttachmentIdentifiersConverter()) .WithNamingConvention(UnderscoredNamingConvention.Instance) .WithNodeDeserializer(inner => new ValidatingNodeDeserializer(inner), deserializer => deserializer.InsteadOf()) + .WithDuplicateKeyChecking() .IgnoreFields() .IgnoreUnmatchedProperties() .Build(); diff --git a/Exiled.Loader/Exiled.Loader.csproj b/Exiled.Loader/Exiled.Loader.csproj index 4a48187e26..3113c83351 100644 --- a/Exiled.Loader/Exiled.Loader.csproj +++ b/Exiled.Loader/Exiled.Loader.csproj @@ -30,7 +30,6 @@ - From 469561be997a5efcf72c72ae7dd9ecad026ffce7 Mon Sep 17 00:00:00 2001 From: Nao <60253860+NaoUnderscore@users.noreply.github.com> Date: Sat, 3 Feb 2024 20:27:52 +0100 Subject: [PATCH 121/141] fake appearance (#2428) Co-authored-by: Vladislav-CS --- Exiled.API/Features/Roles/FpcRole.cs | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/Exiled.API/Features/Roles/FpcRole.cs b/Exiled.API/Features/Roles/FpcRole.cs index c436dad4e2..2ff81a6261 100644 --- a/Exiled.API/Features/Roles/FpcRole.cs +++ b/Exiled.API/Features/Roles/FpcRole.cs @@ -10,6 +10,7 @@ namespace Exiled.API.Features.Roles using System.Collections.Generic; using Exiled.API.Features.Core.Generic.Pools; + using Exiled.API.Extensions; using PlayerRoles; using PlayerRoles.FirstPersonControl; @@ -25,6 +26,7 @@ namespace Exiled.API.Features.Roles public abstract class FpcRole : Role { private bool isUsingStamina = true; + private RoleTypeId fakeAppearance; /// /// Initializes a new instance of the class. @@ -218,6 +220,23 @@ public bool IsNoclipEnabled set => Owner.ReferenceHub.playerStats.GetModule().SetFlag(AdminFlags.Noclip, value); } + /// + /// Gets or sets a value indicating the fake appearance of the player. + /// + public RoleTypeId? FakeAppearance + { + get => fakeAppearance; + set + { + fakeAppearance = value; + + if (value.HasValue) + Owner.ChangeAppearance(value.Value); + else + Owner.ChangeAppearance(Owner.Role.Type, skipJump: true); + } + } + /// /// Resets the 's stamina. /// From d321463a0fac2f9292dab3c74deb9c1c8672574c Mon Sep 17 00:00:00 2001 From: Nao <60253860+NaoUnderscore@users.noreply.github.com> Date: Sat, 3 Feb 2024 20:29:47 +0100 Subject: [PATCH 122/141] Revert "fake appearance (#2428)" (#2429) This reverts commit 469561be997a5efcf72c72ae7dd9ecad026ffce7. --- Exiled.API/Features/Roles/FpcRole.cs | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/Exiled.API/Features/Roles/FpcRole.cs b/Exiled.API/Features/Roles/FpcRole.cs index 2ff81a6261..c436dad4e2 100644 --- a/Exiled.API/Features/Roles/FpcRole.cs +++ b/Exiled.API/Features/Roles/FpcRole.cs @@ -10,7 +10,6 @@ namespace Exiled.API.Features.Roles using System.Collections.Generic; using Exiled.API.Features.Core.Generic.Pools; - using Exiled.API.Extensions; using PlayerRoles; using PlayerRoles.FirstPersonControl; @@ -26,7 +25,6 @@ namespace Exiled.API.Features.Roles public abstract class FpcRole : Role { private bool isUsingStamina = true; - private RoleTypeId fakeAppearance; /// /// Initializes a new instance of the class. @@ -220,23 +218,6 @@ public bool IsNoclipEnabled set => Owner.ReferenceHub.playerStats.GetModule().SetFlag(AdminFlags.Noclip, value); } - /// - /// Gets or sets a value indicating the fake appearance of the player. - /// - public RoleTypeId? FakeAppearance - { - get => fakeAppearance; - set - { - fakeAppearance = value; - - if (value.HasValue) - Owner.ChangeAppearance(value.Value); - else - Owner.ChangeAppearance(Owner.Role.Type, skipJump: true); - } - } - /// /// Resets the 's stamina. /// From ff1b2560afe509dac6d6935a5f8c96d0a1eabb02 Mon Sep 17 00:00:00 2001 From: Vladislav-CS Date: Sat, 3 Feb 2024 22:36:21 +0300 Subject: [PATCH 123/141] Fake apperance (#2430) * fake appearance * forgot to add * bruh --------- Co-authored-by: Nao <60253860+NaoUnderscore@users.noreply.github.com> --- Exiled.API/Features/Roles/FpcRole.cs | 19 +++++++++++++++++++ Exiled.Events/Handlers/Internal/Round.cs | 7 +++++++ 2 files changed, 26 insertions(+) diff --git a/Exiled.API/Features/Roles/FpcRole.cs b/Exiled.API/Features/Roles/FpcRole.cs index c436dad4e2..2ff81a6261 100644 --- a/Exiled.API/Features/Roles/FpcRole.cs +++ b/Exiled.API/Features/Roles/FpcRole.cs @@ -10,6 +10,7 @@ namespace Exiled.API.Features.Roles using System.Collections.Generic; using Exiled.API.Features.Core.Generic.Pools; + using Exiled.API.Extensions; using PlayerRoles; using PlayerRoles.FirstPersonControl; @@ -25,6 +26,7 @@ namespace Exiled.API.Features.Roles public abstract class FpcRole : Role { private bool isUsingStamina = true; + private RoleTypeId fakeAppearance; /// /// Initializes a new instance of the class. @@ -218,6 +220,23 @@ public bool IsNoclipEnabled set => Owner.ReferenceHub.playerStats.GetModule().SetFlag(AdminFlags.Noclip, value); } + /// + /// Gets or sets a value indicating the fake appearance of the player. + /// + public RoleTypeId? FakeAppearance + { + get => fakeAppearance; + set + { + fakeAppearance = value; + + if (value.HasValue) + Owner.ChangeAppearance(value.Value); + else + Owner.ChangeAppearance(Owner.Role.Type, skipJump: true); + } + } + /// /// Resets the 's stamina. /// diff --git a/Exiled.Events/Handlers/Internal/Round.cs b/Exiled.Events/Handlers/Internal/Round.cs index 48ddc98546..8b0740f850 100644 --- a/Exiled.Events/Handlers/Internal/Round.cs +++ b/Exiled.Events/Handlers/Internal/Round.cs @@ -8,6 +8,7 @@ namespace Exiled.Events.Handlers.Internal { using CentralAuth; + using Exiled.API.Extensions; using Exiled.API.Features; using Exiled.API.Features.Roles; using Exiled.Events.EventArgs.Player; @@ -83,6 +84,12 @@ public static void OnActivatingSense(ActivatingSenseEventArgs ev) public static void OnVerified(VerifiedEventArgs ev) { RoleAssigner.CheckLateJoin(ev.Player.ReferenceHub, ClientInstanceMode.ReadyClient); + + foreach (Player player in Player.List) + { + if (player.Role is FpcRole { FakeAppearance: not null } fpcRole) + player.ChangeAppearance(fpcRole.FakeAppearance.Value, new[] { ev.Player }); + } } } } From 0bc802060b063c0a2c4f78039a4bce3d4544676b Mon Sep 17 00:00:00 2001 From: Nameless <85962933+Misfiy@users.noreply.github.com> Date: Sat, 3 Feb 2024 20:36:35 +0100 Subject: [PATCH 124/141] [Exiled.API] [Addition] Player -> GetNear & GetFar (#2427) * GetNear & GetFar * fix * rename it --- Exiled.API/Features/Player.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/Exiled.API/Features/Player.cs b/Exiled.API/Features/Player.cs index ed2d06d737..8a8db0c518 100644 --- a/Exiled.API/Features/Player.cs +++ b/Exiled.API/Features/Player.cs @@ -1176,6 +1176,22 @@ public bool IsSpawnProtected /// A of which contains elements that satisfy the condition. public static IEnumerable Get(Func predicate) => List.Where(predicate); + /// + /// Get all players near the . + /// + /// The to compare. + /// The max distance the player can be from the to be included. + /// The filtered . + public static IEnumerable GetNearestPlayer(Vector3 vector, float distance) => List.Where(p => Vector3.Distance(vector, p.Position) <= distance); + + /// + /// Get all players that have a further distance than the distance. + /// + /// The to compare. + /// The minimum distance the player can be from the to be included. + /// The filtered . + public static IEnumerable GetFarthestPlayers(Vector3 vector, float distance) => List.Where(p => Vector3.Distance(vector, p.Position) >= distance); + /// /// Gets the belonging to the , if any. /// From e74f37ab0aa967de79cbbc265713222d830923d1 Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Sat, 3 Feb 2024 20:38:36 +0100 Subject: [PATCH 125/141] Fix build errors --- Exiled.API/Features/Roles/FpcRole.cs | 7 ++----- Exiled.Events/Patches/Generic/TargetOffset.cs | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/Exiled.API/Features/Roles/FpcRole.cs b/Exiled.API/Features/Roles/FpcRole.cs index 2ff81a6261..443423776c 100644 --- a/Exiled.API/Features/Roles/FpcRole.cs +++ b/Exiled.API/Features/Roles/FpcRole.cs @@ -9,15 +9,12 @@ namespace Exiled.API.Features.Roles { using System.Collections.Generic; - using Exiled.API.Features.Core.Generic.Pools; using Exiled.API.Extensions; - + using Exiled.API.Features.Core.Generic.Pools; using PlayerRoles; using PlayerRoles.FirstPersonControl; - using PlayerStatsSystem; using RelativePositioning; - using UnityEngine; /// @@ -228,7 +225,7 @@ public RoleTypeId? FakeAppearance get => fakeAppearance; set { - fakeAppearance = value; + fakeAppearance = value.Value; if (value.HasValue) Owner.ChangeAppearance(value.Value); diff --git a/Exiled.Events/Patches/Generic/TargetOffset.cs b/Exiled.Events/Patches/Generic/TargetOffset.cs index 3940b89a34..a3435ff42e 100644 --- a/Exiled.Events/Patches/Generic/TargetOffset.cs +++ b/Exiled.Events/Patches/Generic/TargetOffset.cs @@ -12,7 +12,7 @@ namespace Exiled.Events.Patches.Generic using System.Reflection.Emit; using API.Features; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using HarmonyLib; using Mirror; From 70b3a9305f7b86fbb294dfd09d43f87737a20164 Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Sat, 3 Feb 2024 20:46:07 +0100 Subject: [PATCH 126/141] Fix typo --- Exiled.API/Features/Player.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Exiled.API/Features/Player.cs b/Exiled.API/Features/Player.cs index 8a8db0c518..c7ea3b3cf8 100644 --- a/Exiled.API/Features/Player.cs +++ b/Exiled.API/Features/Player.cs @@ -1182,7 +1182,7 @@ public bool IsSpawnProtected /// The to compare. /// The max distance the player can be from the to be included. /// The filtered . - public static IEnumerable GetNearestPlayer(Vector3 vector, float distance) => List.Where(p => Vector3.Distance(vector, p.Position) <= distance); + public static IEnumerable GetNearestPlayers(Vector3 vector, float distance) => List.Where(p => Vector3.Distance(vector, p.Position) <= distance); /// /// Get all players that have a further distance than the distance. From b8a011b32886c0b4666299a88d20138b2f86b8ca Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Sat, 3 Feb 2024 20:58:14 +0100 Subject: [PATCH 127/141] Added new methods for distance evaluation to `Player` class --- Exiled.API/Features/Player.cs | 28 ++++++++++++++++++++++------ 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/Exiled.API/Features/Player.cs b/Exiled.API/Features/Player.cs index c7ea3b3cf8..4711514d85 100644 --- a/Exiled.API/Features/Player.cs +++ b/Exiled.API/Features/Player.cs @@ -1177,19 +1177,35 @@ public bool IsSpawnProtected public static IEnumerable Get(Func predicate) => List.Where(predicate); /// - /// Get all players near the . + /// Gets the nearest player to the specified within the given distance. /// /// The to compare. - /// The max distance the player can be from the to be included. - /// The filtered . + /// The maximum distance the player can be from the to be included. + /// The nearest within the specified distance, or if no player is found. + public static Player GetNearestPlayer(Vector3 vector, float distance) => GetNearestPlayers(vector, distance).OrderBy(p => Vector3.Distance(vector, p.Position)).FirstOrDefault(); + + /// + /// Gets all players near the specified within the given distance. + /// + /// The to compare. + /// The maximum distance the player can be from the to be included. + /// The filtered collection of objects. public static IEnumerable GetNearestPlayers(Vector3 vector, float distance) => List.Where(p => Vector3.Distance(vector, p.Position) <= distance); /// - /// Get all players that have a further distance than the distance. + /// Gets the farthest player from the specified within the given distance. /// /// The to compare. - /// The minimum distance the player can be from the to be included. - /// The filtered . + /// The minimum distance the player can be from the to be included. + /// The farthest from the specified within the given distance, or if no player is found. + public static Player GetFarthestPlayer(Vector3 vector, float distance) => GetFarthestPlayers(vector, distance).OrderByDescending(p => Vector3.Distance(vector, p.Position)).FirstOrDefault(); + + /// + /// Gets all players that have a distance greater than the specified distance from the given . + /// + /// The to compare. + /// The minimum distance the player can be from the to be included. + /// The filtered collection of objects. public static IEnumerable GetFarthestPlayers(Vector3 vector, float distance) => List.Where(p => Vector3.Distance(vector, p.Position) >= distance); /// From ed0c6b335c9d71fc1a1574f3fe07ba008e2ab6d9 Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Sat, 3 Feb 2024 20:59:34 +0100 Subject: [PATCH 128/141] Fix build errors --- Exiled.Events/Handlers/Internal/Round.cs | 2 +- Exiled.Events/Patches/Fixes/NWFixScp096BreakingDoor.cs | 2 +- .../Patches/Generic/AddRespawnTargetMultiplierConfig.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Exiled.Events/Handlers/Internal/Round.cs b/Exiled.Events/Handlers/Internal/Round.cs index ce3c5d73ae..0d95bc2884 100644 --- a/Exiled.Events/Handlers/Internal/Round.cs +++ b/Exiled.Events/Handlers/Internal/Round.cs @@ -90,7 +90,7 @@ public static void OnVerified(VerifiedEventArgs ev) { if (player.Role is FpcRole { FakeAppearance: not null } fpcRole) player.ChangeAppearance(fpcRole.FakeAppearance.Value, new[] { ev.Player }); - } + } // TODO: Remove if this has been fixed for https://trello.com/c/CzPD304L/5983-networking-blackout-is-not-synchronized-for-the-new-players foreach (Room room in Room.List.Where(current => current.AreLightsOff)) diff --git a/Exiled.Events/Patches/Fixes/NWFixScp096BreakingDoor.cs b/Exiled.Events/Patches/Fixes/NWFixScp096BreakingDoor.cs index 4b294f9535..366a531d74 100644 --- a/Exiled.Events/Patches/Fixes/NWFixScp096BreakingDoor.cs +++ b/Exiled.Events/Patches/Fixes/NWFixScp096BreakingDoor.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Fixes using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using HarmonyLib; using Interactables.Interobjects; using Interactables.Interobjects.DoorUtils; diff --git a/Exiled.Events/Patches/Generic/AddRespawnTargetMultiplierConfig.cs b/Exiled.Events/Patches/Generic/AddRespawnTargetMultiplierConfig.cs index 79c7bf6382..0054fd3a30 100644 --- a/Exiled.Events/Patches/Generic/AddRespawnTargetMultiplierConfig.cs +++ b/Exiled.Events/Patches/Generic/AddRespawnTargetMultiplierConfig.cs @@ -10,7 +10,7 @@ namespace Exiled.Events.Patches.Generic.Scp079API using System.Collections.Generic; using System.Reflection.Emit; - using API.Features.Pools; + using API.Features.Core.Generic.Pools; using HarmonyLib; using static HarmonyLib.AccessTools; From 70ba0d3d517fcfd331cecb25b8ee0b419e98455c Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Sat, 3 Feb 2024 21:00:33 +0100 Subject: [PATCH 129/141] typos --- .../Features/CustomEscapes/{Generics => Generic}/CustomEscape.cs | 0 .../API/Features/CustomItems/{Generics => Generic}/CustomItem.cs | 0 .../API/Features/CustomRoles/{Generics => Generic}/CustomRole.cs | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename Exiled.CustomModules/API/Features/CustomEscapes/{Generics => Generic}/CustomEscape.cs (100%) rename Exiled.CustomModules/API/Features/CustomItems/{Generics => Generic}/CustomItem.cs (100%) rename Exiled.CustomModules/API/Features/CustomRoles/{Generics => Generic}/CustomRole.cs (100%) diff --git a/Exiled.CustomModules/API/Features/CustomEscapes/Generics/CustomEscape.cs b/Exiled.CustomModules/API/Features/CustomEscapes/Generic/CustomEscape.cs similarity index 100% rename from Exiled.CustomModules/API/Features/CustomEscapes/Generics/CustomEscape.cs rename to Exiled.CustomModules/API/Features/CustomEscapes/Generic/CustomEscape.cs diff --git a/Exiled.CustomModules/API/Features/CustomItems/Generics/CustomItem.cs b/Exiled.CustomModules/API/Features/CustomItems/Generic/CustomItem.cs similarity index 100% rename from Exiled.CustomModules/API/Features/CustomItems/Generics/CustomItem.cs rename to Exiled.CustomModules/API/Features/CustomItems/Generic/CustomItem.cs diff --git a/Exiled.CustomModules/API/Features/CustomRoles/Generics/CustomRole.cs b/Exiled.CustomModules/API/Features/CustomRoles/Generic/CustomRole.cs similarity index 100% rename from Exiled.CustomModules/API/Features/CustomRoles/Generics/CustomRole.cs rename to Exiled.CustomModules/API/Features/CustomRoles/Generic/CustomRole.cs From 7af90f62631a2e1d5bdda3b413e3bc96ac0dbb16 Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Sat, 3 Feb 2024 21:20:15 +0100 Subject: [PATCH 130/141] Added `GameEntity::activeInstances` --- Exiled.API/Features/Camera.cs | 1 + Exiled.API/Features/Core/GameEntity.cs | 11 +++++++++++ Exiled.API/Features/Doors/Door.cs | 1 + Exiled.API/Features/Effect.cs | 1 + Exiled.API/Features/Generator.cs | 1 + Exiled.API/Features/Hazards/Hazard.cs | 1 + Exiled.API/Features/Items/Item.cs | 1 + Exiled.API/Features/Lift.cs | 1 + Exiled.API/Features/Pickups/Pickup.cs | 2 ++ Exiled.API/Features/Player.cs | 2 ++ Exiled.API/Features/Ragdoll.cs | 1 + Exiled.API/Features/Roles/Role.cs | 1 + Exiled.API/Features/TeslaGate.cs | 1 + Exiled.API/Features/Toys/AdminToy.cs | 1 + Exiled.API/Features/Window.cs | 1 + 15 files changed, 27 insertions(+) diff --git a/Exiled.API/Features/Camera.cs b/Exiled.API/Features/Camera.cs index 89a7ca6964..88d9527304 100644 --- a/Exiled.API/Features/Camera.cs +++ b/Exiled.API/Features/Camera.cs @@ -134,6 +134,7 @@ public class Camera : GameEntity, IWrapper, IWorldSpace /// /// The base camera. internal Camera(Scp079Camera camera079) + : base() { Base = camera079; Camera079ToCamera.Add(camera079, this); diff --git a/Exiled.API/Features/Core/GameEntity.cs b/Exiled.API/Features/Core/GameEntity.cs index 25588656f0..1178e3b837 100644 --- a/Exiled.API/Features/Core/GameEntity.cs +++ b/Exiled.API/Features/Core/GameEntity.cs @@ -21,6 +21,17 @@ namespace Exiled.API.Features.Core public abstract class GameEntity : TypeCastObject, IEntity { private readonly HashSet componentsInChildren = new(); + private readonly HashSet activeInstances = new(); + + /// + /// Initializes a new instance of the class. + /// + protected GameEntity() => activeInstances.Add(this); + + /// + /// Finalizes an instance of the class. + /// + ~GameEntity() => activeInstances.Remove(this); /// public IReadOnlyCollection ComponentsInChildren => componentsInChildren; diff --git a/Exiled.API/Features/Doors/Door.cs b/Exiled.API/Features/Doors/Door.cs index d298d7c76a..bc08194aee 100644 --- a/Exiled.API/Features/Doors/Door.cs +++ b/Exiled.API/Features/Doors/Door.cs @@ -46,6 +46,7 @@ public class Door : GameEntity, IWrapper, IWorldSpace /// The base for this door. /// The of 's for this door. internal Door(DoorVariant door, List rooms) + : base() { Base = door; diff --git a/Exiled.API/Features/Effect.cs b/Exiled.API/Features/Effect.cs index 884ce71d84..b0401d740a 100644 --- a/Exiled.API/Features/Effect.cs +++ b/Exiled.API/Features/Effect.cs @@ -31,6 +31,7 @@ public Effect() /// /// Get all the information of the effect>. public Effect(StatusEffectBase statusEffectBase) + : base() { if (!statusEffectBase.TryGetEffectType(out EffectType effect)) Log.Error($"EffectType not found please report to Exiled BugReport : {statusEffectBase}"); diff --git a/Exiled.API/Features/Generator.cs b/Exiled.API/Features/Generator.cs index d9fbc76fa8..c92160aee5 100644 --- a/Exiled.API/Features/Generator.cs +++ b/Exiled.API/Features/Generator.cs @@ -35,6 +35,7 @@ public class Generator : GameEntity, IWrapper, IWorldSpace /// /// The . internal Generator(Scp079Generator scp079Generator) + : base() { Base = scp079Generator; Scp079GeneratorToGenerator.Add(scp079Generator, this); diff --git a/Exiled.API/Features/Hazards/Hazard.cs b/Exiled.API/Features/Hazards/Hazard.cs index c3b1a9f979..4c385fc675 100644 --- a/Exiled.API/Features/Hazards/Hazard.cs +++ b/Exiled.API/Features/Hazards/Hazard.cs @@ -32,6 +32,7 @@ public class Hazard : GameEntity, IWrapper /// /// The instance. public Hazard(EnvironmentalHazard hazard) + : base() { Base = hazard; diff --git a/Exiled.API/Features/Items/Item.cs b/Exiled.API/Features/Items/Item.cs index db7e112cfd..c6cc2ec8ae 100644 --- a/Exiled.API/Features/Items/Item.cs +++ b/Exiled.API/Features/Items/Item.cs @@ -48,6 +48,7 @@ public class Item : GameEntity, IWrapper /// /// The to encapsulate. public Item(ItemBase itemBase) + : base() { Base = itemBase; BaseToItem.Add(itemBase, this); diff --git a/Exiled.API/Features/Lift.cs b/Exiled.API/Features/Lift.cs index 91c70877ea..614f2bbca9 100644 --- a/Exiled.API/Features/Lift.cs +++ b/Exiled.API/Features/Lift.cs @@ -47,6 +47,7 @@ public class Lift : GameEntity, IWrapper, IWorldSpace /// /// The to wrap. internal Lift(ElevatorChamber elevator) + : base() { Base = elevator; ElevatorChamberToLift.Add(elevator, this); diff --git a/Exiled.API/Features/Pickups/Pickup.cs b/Exiled.API/Features/Pickups/Pickup.cs index ef703986a4..99fd35d9a6 100644 --- a/Exiled.API/Features/Pickups/Pickup.cs +++ b/Exiled.API/Features/Pickups/Pickup.cs @@ -56,6 +56,7 @@ public class Pickup : GameEntity, IWrapper, IWorldSpace /// Created only for properly work. /// internal Pickup() + : base() { } @@ -64,6 +65,7 @@ internal Pickup() /// /// The base class. internal Pickup(ItemPickupBase pickupBase) + : base() { Base = pickupBase; diff --git a/Exiled.API/Features/Player.cs b/Exiled.API/Features/Player.cs index 4711514d85..4d1ee22012 100644 --- a/Exiled.API/Features/Player.cs +++ b/Exiled.API/Features/Player.cs @@ -100,6 +100,7 @@ public class Player : GameEntity, IWorldSpace /// /// The of the player to be encapsulated. public Player(ReferenceHub referenceHub) + : base() { ReferenceHub = referenceHub; Items = ItemsValue.AsReadOnly(); @@ -110,6 +111,7 @@ public Player(ReferenceHub referenceHub) /// /// The of the player. public Player(GameObject gameObject) + : base() { ReferenceHub = ReferenceHub.GetHub(gameObject); Items = ItemsValue.AsReadOnly(); diff --git a/Exiled.API/Features/Ragdoll.cs b/Exiled.API/Features/Ragdoll.cs index 52bd892aa9..34bb372106 100644 --- a/Exiled.API/Features/Ragdoll.cs +++ b/Exiled.API/Features/Ragdoll.cs @@ -49,6 +49,7 @@ public class Ragdoll : GameEntity, IWrapper, IWorldSpace /// /// The encapsulated . internal Ragdoll(BasicRagdoll ragdoll) + : base() { Base = ragdoll; BasicRagdollToRagdoll.Add(ragdoll, this); diff --git a/Exiled.API/Features/Roles/Role.cs b/Exiled.API/Features/Roles/Role.cs index fb3585ec41..a7d38bdabc 100644 --- a/Exiled.API/Features/Roles/Role.cs +++ b/Exiled.API/Features/Roles/Role.cs @@ -43,6 +43,7 @@ public abstract class Role : GameEntity, IWrapper /// /// the base . protected Role(PlayerRoleBase baseRole) + : base() { if (baseRole.TryGetOwner(out ReferenceHub hub)) Owner = Player.Get(hub); diff --git a/Exiled.API/Features/TeslaGate.cs b/Exiled.API/Features/TeslaGate.cs index 222d9b6760..142c6542f7 100644 --- a/Exiled.API/Features/TeslaGate.cs +++ b/Exiled.API/Features/TeslaGate.cs @@ -40,6 +40,7 @@ public class TeslaGate : GameEntity, IWrapper, IWorldSpace /// The instance. /// The for this tesla. internal TeslaGate(BaseTeslaGate baseTeslaGate, Room room) + : base() { Base = baseTeslaGate; BaseTeslaGateToTeslaGate.Add(baseTeslaGate, this); diff --git a/Exiled.API/Features/Toys/AdminToy.cs b/Exiled.API/Features/Toys/AdminToy.cs index 7931867485..241bdd042c 100644 --- a/Exiled.API/Features/Toys/AdminToy.cs +++ b/Exiled.API/Features/Toys/AdminToy.cs @@ -30,6 +30,7 @@ public abstract class AdminToy : GameEntity, IWorldSpace /// The to be wrapped. /// The of the object. internal AdminToy(AdminToyBase toyAdminToyBase, AdminToyType type) + : base() { AdminToyBase = toyAdminToyBase; ToyType = type; diff --git a/Exiled.API/Features/Window.cs b/Exiled.API/Features/Window.cs index 1e0c3377b7..7b5f179edd 100644 --- a/Exiled.API/Features/Window.cs +++ b/Exiled.API/Features/Window.cs @@ -34,6 +34,7 @@ public class Window : GameEntity, IWrapper, IWorldSpace /// The base for this door. /// The for this window. internal Window(BreakableWindow window, Room room) + : base() { BreakableWindowToWindow.Add(window, this); Base = window; From ea8889a14a4cb8bc0c316ac300dda27cbc089223 Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Sat, 3 Feb 2024 21:23:30 +0100 Subject: [PATCH 131/141] Added `GameEntity::List` --- Exiled.API/Features/Core/GameEntity.cs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Exiled.API/Features/Core/GameEntity.cs b/Exiled.API/Features/Core/GameEntity.cs index 1178e3b837..f0a7d632cc 100644 --- a/Exiled.API/Features/Core/GameEntity.cs +++ b/Exiled.API/Features/Core/GameEntity.cs @@ -20,18 +20,25 @@ namespace Exiled.API.Features.Core /// public abstract class GameEntity : TypeCastObject, IEntity { + private static readonly HashSet ActiveInstances = new(); private readonly HashSet componentsInChildren = new(); - private readonly HashSet activeInstances = new(); /// /// Initializes a new instance of the class. /// - protected GameEntity() => activeInstances.Add(this); + protected GameEntity() => ActiveInstances.Add(this); /// /// Finalizes an instance of the class. /// - ~GameEntity() => activeInstances.Remove(this); + ~GameEntity() => ActiveInstances.Remove(this); + + /// + /// Gets all active instances. + /// + /// This collection should be used sparingly and only if circumstances require it, due to its potentially large size. + /// + public HashSet List => ActiveInstances; /// public IReadOnlyCollection ComponentsInChildren => componentsInChildren; From c235f92d691d49dc999cace421bb09ca12ae003e Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Sat, 3 Feb 2024 21:28:57 +0100 Subject: [PATCH 132/141] Added some distance evaluation method to `GameEntity` --- Exiled.API/Features/Core/GameEntity.cs | 40 +++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/Exiled.API/Features/Core/GameEntity.cs b/Exiled.API/Features/Core/GameEntity.cs index f0a7d632cc..efc7a1e431 100644 --- a/Exiled.API/Features/Core/GameEntity.cs +++ b/Exiled.API/Features/Core/GameEntity.cs @@ -38,7 +38,7 @@ public abstract class GameEntity : TypeCastObject, IEntity /// /// This collection should be used sparingly and only if circumstances require it, due to its potentially large size. /// - public HashSet List => ActiveInstances; + public static HashSet List => ActiveInstances; /// public IReadOnlyCollection ComponentsInChildren => componentsInChildren; @@ -48,6 +48,44 @@ public abstract class GameEntity : TypeCastObject, IEntity /// public virtual GameObject GameObject { get; protected set; } + /// + /// Gets the nearest game entity to the specified within the given distance. + /// + /// The to compare. + /// The maximum distance the game entity can be from the to be included. + /// + /// The nearest within the specified distance, or if no game + /// entity is found. + /// + public static GameEntity GetNearestEntity(Vector3 vector, float distance) => GetNearestEntities(vector, distance).OrderBy(p => Vector3.Distance(vector, p.GameObject.transform.position)).FirstOrDefault(); + + /// + /// Gets all game entities near the specified within the given distance. + /// + /// The to compare. + /// The maximum distance the game entity can be from the to be included. + /// The filtered collection of objects. + public static IEnumerable GetNearestEntities(Vector3 vector, float distance) => List.Where(p => p.GameObject.transform && Vector3.Distance(vector, p.GameObject.transform.position) <= distance); + + /// + /// Gets the farthest game entity from the specified within the given distance. + /// + /// The to compare. + /// The minimum distance the game entity can be from the to be included. + /// + /// The farthest from the specified within the given + /// distance, or if no game entity is found. + /// + public static GameEntity GetFarthestEntity(Vector3 vector, float distance) => GetFarthestEntities(vector, distance).OrderByDescending(p => Vector3.Distance(vector, p.GameObject.transform.position)).FirstOrDefault(); + + /// + /// Gets all game entities that have a distance greater than the specified distance from the given . + /// + /// The to compare. + /// The minimum distance the game entity can be from the to be included. + /// The filtered collection of objects. + public static IEnumerable GetFarthestEntities(Vector3 vector, float distance) => List.Where(p => p.GameObject.transform && Vector3.Distance(vector, p.GameObject.transform.position) >= distance); + /// public T AddComponent(string name = "") where T : EActor From d9ed33b75f3c180ea9ccc3987fb8fe56150af2f7 Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Sat, 3 Feb 2024 21:40:57 +0100 Subject: [PATCH 133/141] `new` momento --- Exiled.API/Features/Camera.cs | 2 +- Exiled.API/Features/Doors/Door.cs | 2 +- Exiled.API/Features/Generator.cs | 2 +- Exiled.API/Features/Hazards/Hazard.cs | 2 +- Exiled.API/Features/Items/Item.cs | 2 +- Exiled.API/Features/Lift.cs | 2 +- Exiled.API/Features/Pickups/Pickup.cs | 2 +- Exiled.API/Features/Player.cs | 2 +- Exiled.API/Features/Ragdoll.cs | 2 +- Exiled.API/Features/TeslaGate.cs | 2 +- Exiled.API/Features/Window.cs | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/Exiled.API/Features/Camera.cs b/Exiled.API/Features/Camera.cs index 88d9527304..4428b92af5 100644 --- a/Exiled.API/Features/Camera.cs +++ b/Exiled.API/Features/Camera.cs @@ -148,7 +148,7 @@ internal Camera(Scp079Camera camera079) /// /// Gets a of which contains all the instances. /// - public static IReadOnlyCollection List => Camera079ToCamera.Values; + public static new IReadOnlyCollection List => Camera079ToCamera.Values; /// /// Gets a random . diff --git a/Exiled.API/Features/Doors/Door.cs b/Exiled.API/Features/Doors/Door.cs index bc08194aee..09c29caf70 100644 --- a/Exiled.API/Features/Doors/Door.cs +++ b/Exiled.API/Features/Doors/Door.cs @@ -67,7 +67,7 @@ internal Door(DoorVariant door, List rooms) /// /// Gets a of which contains all the instances. /// - public static IReadOnlyCollection List => DoorVariantToDoor.Values; + public static new IReadOnlyCollection List => DoorVariantToDoor.Values; /// /// Gets the base-game corresponding with this door. diff --git a/Exiled.API/Features/Generator.cs b/Exiled.API/Features/Generator.cs index c92160aee5..20718b71f0 100644 --- a/Exiled.API/Features/Generator.cs +++ b/Exiled.API/Features/Generator.cs @@ -44,7 +44,7 @@ internal Generator(Scp079Generator scp079Generator) /// /// Gets a of which contains all the instances. /// - public static IReadOnlyCollection List => Scp079GeneratorToGenerator.Values; + public static new IReadOnlyCollection List => Scp079GeneratorToGenerator.Values; /// /// Gets the base . diff --git a/Exiled.API/Features/Hazards/Hazard.cs b/Exiled.API/Features/Hazards/Hazard.cs index 4c385fc675..a15b06cd4b 100644 --- a/Exiled.API/Features/Hazards/Hazard.cs +++ b/Exiled.API/Features/Hazards/Hazard.cs @@ -42,7 +42,7 @@ public Hazard(EnvironmentalHazard hazard) /// /// Gets the list of all hazards. /// - public static IReadOnlyCollection List => EnvironmentalHazardToHazard.Values; + public static new IReadOnlyCollection List => EnvironmentalHazardToHazard.Values; /// /// Gets the . diff --git a/Exiled.API/Features/Items/Item.cs b/Exiled.API/Features/Items/Item.cs index c6cc2ec8ae..eb0a4c542d 100644 --- a/Exiled.API/Features/Items/Item.cs +++ b/Exiled.API/Features/Items/Item.cs @@ -79,7 +79,7 @@ internal Item(ItemType type) /// /// Gets a list of all 's on the server. /// - public static IEnumerable List => BaseToItem.Values; + public static new IEnumerable List => BaseToItem.Values; /// /// Gets or sets the unique serial number for the item. diff --git a/Exiled.API/Features/Lift.cs b/Exiled.API/Features/Lift.cs index 614f2bbca9..336f15a889 100644 --- a/Exiled.API/Features/Lift.cs +++ b/Exiled.API/Features/Lift.cs @@ -63,7 +63,7 @@ internal Lift(ElevatorChamber elevator) /// /// Gets a of which contains all the instances. /// - public static IReadOnlyCollection List => ElevatorChamberToLift.Values; + public static new IReadOnlyCollection List => ElevatorChamberToLift.Values; /// /// Gets a random . diff --git a/Exiled.API/Features/Pickups/Pickup.cs b/Exiled.API/Features/Pickups/Pickup.cs index 99fd35d9a6..589b17d7bd 100644 --- a/Exiled.API/Features/Pickups/Pickup.cs +++ b/Exiled.API/Features/Pickups/Pickup.cs @@ -106,7 +106,7 @@ internal Pickup(ItemType type) /// /// Gets a of which contains all the instances. /// - public static IEnumerable List => BaseToPickup.Values; + public static new IEnumerable List => BaseToPickup.Values; /// /// Gets the of the Pickup. diff --git a/Exiled.API/Features/Player.cs b/Exiled.API/Features/Player.cs index 4d1ee22012..8e195b174d 100644 --- a/Exiled.API/Features/Player.cs +++ b/Exiled.API/Features/Player.cs @@ -135,7 +135,7 @@ public Player(GameObject gameObject) /// /// Gets a list of all 's on the server. /// - public static IReadOnlyCollection List => Dictionary.Values; + public static new IReadOnlyCollection List => Dictionary.Values; /// /// Gets a containing cached and their user ids. diff --git a/Exiled.API/Features/Ragdoll.cs b/Exiled.API/Features/Ragdoll.cs index 34bb372106..f128206208 100644 --- a/Exiled.API/Features/Ragdoll.cs +++ b/Exiled.API/Features/Ragdoll.cs @@ -58,7 +58,7 @@ internal Ragdoll(BasicRagdoll ragdoll) /// /// Gets a of which contains all the instances. /// - public static IReadOnlyCollection List => BasicRagdollToRagdoll.Values; + public static new IReadOnlyCollection List => BasicRagdollToRagdoll.Values; /// /// Gets or sets the s clean up time. diff --git a/Exiled.API/Features/TeslaGate.cs b/Exiled.API/Features/TeslaGate.cs index 142c6542f7..4499f79764 100644 --- a/Exiled.API/Features/TeslaGate.cs +++ b/Exiled.API/Features/TeslaGate.cs @@ -50,7 +50,7 @@ internal TeslaGate(BaseTeslaGate baseTeslaGate, Room room) /// /// Gets a of which contains all the instances. /// - public static IReadOnlyCollection List => BaseTeslaGateToTeslaGate.Values; + public static new IReadOnlyCollection List => BaseTeslaGateToTeslaGate.Values; /// /// Gets or sets a of which contains all the players ignored by tesla gates. diff --git a/Exiled.API/Features/Window.cs b/Exiled.API/Features/Window.cs index 7b5f179edd..11f618a470 100644 --- a/Exiled.API/Features/Window.cs +++ b/Exiled.API/Features/Window.cs @@ -49,7 +49,7 @@ internal Window(BreakableWindow window, Room room) /// /// Gets a of which contains all the instances. /// - public static IReadOnlyCollection List => BreakableWindowToWindow.Values; + public static new IReadOnlyCollection List => BreakableWindowToWindow.Values; /// /// Gets the base-game for this window. From 8fe891011db5d3773de0963fd0c4fc953106edd6 Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Sat, 3 Feb 2024 22:14:21 +0100 Subject: [PATCH 134/141] Made `Room` a `GameEntity`. --- Exiled.API/Features/Camera.cs | 9 +- Exiled.API/Features/Core/GameEntity.cs | 33 ++++++- Exiled.API/Features/Doors/Door.cs | 19 ++-- Exiled.API/Features/Generator.cs | 9 +- Exiled.API/Features/Hazards/Hazard.cs | 2 +- Exiled.API/Features/Lift.cs | 17 ++-- Exiled.API/Features/Pickups/Pickup.cs | 11 +-- Exiled.API/Features/Player.cs | 39 ++++---- Exiled.API/Features/Ragdoll.cs | 19 ++-- Exiled.API/Features/Room.cs | 110 ++++++++++------------ Exiled.API/Features/TeslaGate.cs | 9 +- Exiled.API/Features/Toys/AdminToy.cs | 22 +---- Exiled.API/Features/Window.cs | 20 +--- Exiled.Events/Handlers/Internal/Round.cs | 2 +- Exiled.Events/Patches/Generic/RoomList.cs | 4 +- 15 files changed, 140 insertions(+), 185 deletions(-) diff --git a/Exiled.API/Features/Camera.cs b/Exiled.API/Features/Camera.cs index 4428b92af5..9b1e793ec6 100644 --- a/Exiled.API/Features/Camera.cs +++ b/Exiled.API/Features/Camera.cs @@ -166,11 +166,6 @@ internal Camera(Scp079Camera camera079) /// public Scp079Camera Base { get; } - /// - /// Gets the camera's . - /// - public Transform Transform => Base.transform; - /// /// Gets the camera's name. /// @@ -199,12 +194,12 @@ internal Camera(Scp079Camera camera079) /// /// Gets the camera's position. /// - public Vector3 Position => Base.Position; + public override Vector3 Position => Base.Position; /// /// Gets or sets the camera's rotation. /// - public Quaternion Rotation + public override Quaternion Rotation { get => Base._cameraAnchor.rotation; set => Base._cameraAnchor.rotation = value; diff --git a/Exiled.API/Features/Core/GameEntity.cs b/Exiled.API/Features/Core/GameEntity.cs index efc7a1e431..38f3d290a0 100644 --- a/Exiled.API/Features/Core/GameEntity.cs +++ b/Exiled.API/Features/Core/GameEntity.cs @@ -13,13 +13,21 @@ namespace Exiled.API.Features.Core using Exiled.API.Extensions; using Exiled.API.Features.Core.Interfaces; + using Exiled.API.Interfaces; using UnityEngine; /// /// The base class which defines in-game entities. /// - public abstract class GameEntity : TypeCastObject, IEntity + public abstract class GameEntity : TypeCastObject, IEntity, IWorldSpace { + /// + /// The room's transform. + /// +#pragma warning disable SA1401 + protected Transform transform; +#pragma warning restore SA1401 + private static readonly HashSet ActiveInstances = new(); private readonly HashSet componentsInChildren = new(); @@ -48,6 +56,29 @@ public abstract class GameEntity : TypeCastObject, IEntity /// public virtual GameObject GameObject { get; protected set; } + /// + /// Gets the . + /// + public virtual Transform Transform => transform ? transform : transform = GameObject.transform; + + /// + /// Gets or sets the position. + /// + public virtual Vector3 Position + { + get => Transform.position; + set => Transform.position = value; + } + + /// + /// Gets or sets the rotation. + /// + public virtual Quaternion Rotation + { + get => Transform.rotation; + set => Transform.rotation = value; + } + /// /// Gets the nearest game entity to the specified within the given distance. /// diff --git a/Exiled.API/Features/Doors/Door.cs b/Exiled.API/Features/Doors/Door.cs index 09c29caf70..a3172e2900 100644 --- a/Exiled.API/Features/Doors/Door.cs +++ b/Exiled.API/Features/Doors/Door.cs @@ -79,11 +79,6 @@ internal Door(DoorVariant door, List rooms) /// public override GameObject GameObject => Base.gameObject; - /// - /// Gets the door's . - /// - public Transform Transform => Base.transform; - /// /// Gets the door's . /// @@ -186,13 +181,13 @@ public KeycardPermissions KeycardPermissions /// /// Gets or sets the door's position. /// - public Vector3 Position + public override Vector3 Position { - get => GameObject.transform.position; + get => Transform.position; set { NetworkServer.UnSpawn(GameObject); - GameObject.transform.position = value; + Transform.position = value; NetworkServer.Spawn(GameObject); } } @@ -255,13 +250,13 @@ public DoorPermissions RequiredPermissions /// /// Gets or sets the door's rotation. /// - public Quaternion Rotation + public override Quaternion Rotation { - get => GameObject.transform.rotation; + get => Transform.rotation; set { NetworkServer.UnSpawn(GameObject); - GameObject.transform.rotation = value; + Transform.rotation = value; NetworkServer.Spawn(GameObject); } } @@ -275,7 +270,7 @@ public Vector3 Scale set { NetworkServer.UnSpawn(GameObject); - GameObject.transform.localScale = value; + Transform.localScale = value; NetworkServer.Spawn(GameObject); } } diff --git a/Exiled.API/Features/Generator.cs b/Exiled.API/Features/Generator.cs index 20718b71f0..3a05f1b115 100644 --- a/Exiled.API/Features/Generator.cs +++ b/Exiled.API/Features/Generator.cs @@ -56,11 +56,6 @@ internal Generator(Scp079Generator scp079Generator) /// public override GameObject GameObject => Base.gameObject; - /// - /// Gets the of the generator. - /// - public Transform Transform => Base.transform; - /// /// Gets the generator's . /// @@ -205,12 +200,12 @@ public Player LastActivator /// /// Gets the generator position. /// - public Vector3 Position => Base.transform.position; + public override Vector3 Position => Transform.position; /// /// Gets the generator rotation. /// - public Quaternion Rotation => Base.transform.rotation; + public override Quaternion Rotation => Transform.rotation; /// /// Gets or sets the required permissions to interact with the generator. diff --git a/Exiled.API/Features/Hazards/Hazard.cs b/Exiled.API/Features/Hazards/Hazard.cs index a15b06cd4b..82d49810fe 100644 --- a/Exiled.API/Features/Hazards/Hazard.cs +++ b/Exiled.API/Features/Hazards/Hazard.cs @@ -105,7 +105,7 @@ public Vector3 PositionOffset /// /// Gets or sets the position. /// - public Vector3 Position + public override Vector3 Position { get => Base.SourcePosition; set => Base.SourcePosition = value; diff --git a/Exiled.API/Features/Lift.cs b/Exiled.API/Features/Lift.cs index 336f15a889..8ecfa0805a 100644 --- a/Exiled.API/Features/Lift.cs +++ b/Exiled.API/Features/Lift.cs @@ -91,11 +91,6 @@ internal Lift(ElevatorChamber elevator) /// public override GameObject GameObject => Base.gameObject; - /// - /// Gets the lift's . - /// - public Transform Transform => Base.transform; - /// /// Gets or sets the lift's status. /// @@ -186,19 +181,19 @@ public float AnimationTime /// /// Gets or sets the lift's position. /// - public Vector3 Position + public override Vector3 Position { - get => Base.transform.position; - set => Base.transform.position = value; + get => Transform.position; + set => Transform.position = value; } /// /// Gets or sets the lift's rotation. /// - public Quaternion Rotation + public override Quaternion Rotation { - get => Base.transform.rotation; - set => Base.transform.rotation = value; + get => Transform.rotation; + set => Transform.rotation = value; } /// diff --git a/Exiled.API/Features/Pickups/Pickup.cs b/Exiled.API/Features/Pickups/Pickup.cs index 589b17d7bd..00586f5e87 100644 --- a/Exiled.API/Features/Pickups/Pickup.cs +++ b/Exiled.API/Features/Pickups/Pickup.cs @@ -113,11 +113,6 @@ internal Pickup(ItemType type) /// public override GameObject GameObject => GameObject; - /// - /// Gets the of the Pickup. - /// - public Transform Transform => Base.transform; - /// /// Gets the of the Pickup. /// @@ -265,7 +260,7 @@ public bool InUse /// Gets or sets the pickup position. /// /// - public Vector3 Position + public override Vector3 Position { get => Base.Position; set => Base.Position = value; @@ -276,7 +271,7 @@ public Vector3 Position /// public RelativePosition RelativePosition { - get => new(Room.transform.TransformPoint(Position)); + get => new(Room.Transform.TransformPoint(Position)); set => Position = value.Position; } @@ -284,7 +279,7 @@ public RelativePosition RelativePosition /// Gets or sets the pickup rotation. /// /// - public Quaternion Rotation + public override Quaternion Rotation { get => Base.Rotation; set => Base.Rotation = value; diff --git a/Exiled.API/Features/Player.cs b/Exiled.API/Features/Player.cs index 8e195b174d..685fe4a42e 100644 --- a/Exiled.API/Features/Player.cs +++ b/Exiled.API/Features/Player.cs @@ -75,7 +75,7 @@ namespace Exiled.API.Features /// Represents the in-game player, by encapsulating a . /// [DefaultPlayerClass] - public class Player : GameEntity, IWorldSpace + public class Player : GameEntity { #pragma warning disable SA1401 #pragma warning disable SA1310 @@ -189,7 +189,7 @@ private set /// /// Gets the 's . /// - public Transform Transform => ReferenceHub.transform; + public override Transform Transform => ReferenceHub.transform; /// /// Gets the hint currently watched by the player. @@ -504,7 +504,7 @@ public Player Cuffer /// /// /// - public Vector3 Position + public override Vector3 Position { get => Transform.position; set => ReferenceHub.TryOverridePosition(value, Vector3.zero); @@ -524,7 +524,7 @@ public RelativePosition RelativePosition /// Gets or sets the player's rotation. /// /// Returns the direction the player is looking at. - public Quaternion Rotation + public override Quaternion Rotation { get => Transform.rotation; set => ReferenceHub.TryOverridePosition(Position, value.eulerAngles); @@ -3397,6 +3397,12 @@ public void Teleport(object obj, Vector3 offset) { switch (obj) { + case Role role: + if (role.Owner is not null) + Teleport(role.Owner.Position + offset); + else + Log.Warn($"{nameof(Teleport)}: {Assembly.GetCallingAssembly().GetName().Name}: Invalid role teleport (role is missing Owner)."); + break; case TeslaGate teslaGate: Teleport( teslaGate.Position + offset + Vector3.up + @@ -3404,6 +3410,15 @@ public void Teleport(object obj, Vector3 offset) ? new Vector3(3, 0, 0) : new Vector3(0, 0, 3))); break; + case Item item: + if (item.Owner is not null) + Teleport(item.Owner.Position + offset); + else + Log.Warn($"{nameof(Teleport)}: {Assembly.GetCallingAssembly().GetName().Name}: Invalid item teleport (item is missing Owner)."); + break; + case GameEntity entity: + Teleport(entity.Position + Vector3.up + offset); + break; case IPosition positionObject: Teleport(positionObject.Position + Vector3.up + offset); break; @@ -3425,12 +3440,6 @@ public void Teleport(object obj, Vector3 offset) case Scp914Controller scp914: Teleport(scp914._knobTransform.position + Vector3.up + offset); break; - case Role role: - if (role.Owner is not null) - Teleport(role.Owner.Position + offset); - else - Log.Warn($"{nameof(Teleport)}: {Assembly.GetCallingAssembly().GetName().Name}: Invalid role teleport (role is missing Owner)."); - break; case Locker locker: Teleport(locker.transform.position + Vector3.up + offset); break; @@ -3440,12 +3449,6 @@ public void Teleport(object obj, Vector3 offset) case ElevatorChamber elevator: Teleport(elevator.transform.position + Vector3.up + offset); break; - case Item item: - if (item.Owner is not null) - Teleport(item.Owner.Position + offset); - else - Log.Warn($"{nameof(Teleport)}: {Assembly.GetCallingAssembly().GetName().Name}: Invalid item teleport (item is missing Owner)."); - break; // Unity case Vector3 v3: // I wouldn't be surprised if someone calls this method with a Vector3. @@ -3513,7 +3516,7 @@ public void RandomTeleport(IEnumerable types) /// /// Get the time cooldown on this ItemType. /// - /// The itemtypes to choose for getting cooldown. + /// The items to choose for getting cooldown. /// Return the time in seconds of the cooldowns. public float GetCooldownItem(ItemType itemType) => UsableItemsController.GetHandler(ReferenceHub).PersonalCooldowns.TryGetValue(itemType, out float value) ? value : -1; @@ -3522,7 +3525,7 @@ public float GetCooldownItem(ItemType itemType) /// Set the time cooldown on this ItemType. /// /// The times for the cooldown. - /// The itemtypes to choose for being cooldown. + /// The items to choose for being cooldown. public void SetCooldownItem(float time, ItemType itemType) => UsableItemsController.GetHandler(ReferenceHub).PersonalCooldowns[itemType] = Time.timeSinceLevelLoad + time; diff --git a/Exiled.API/Features/Ragdoll.cs b/Exiled.API/Features/Ragdoll.cs index f128206208..3100b7bb58 100644 --- a/Exiled.API/Features/Ragdoll.cs +++ b/Exiled.API/Features/Ragdoll.cs @@ -84,11 +84,6 @@ public static int FreezeTime /// public override GameObject GameObject => Base.gameObject; - /// - /// Gets the of the ragdoll. - /// - public Transform Transform => Base.transform; - /// /// Gets or sets the ragdoll's . /// @@ -221,14 +216,14 @@ public bool IsConsumed /// /// Gets or sets the ragdoll's position. /// - public Vector3 Position + public override Vector3 Position { - get => Base.transform.position; + get => Transform.position; set { NetworkServer.UnSpawn(GameObject); - Base.transform.position = value; + Transform.position = value; NetworkServer.Spawn(GameObject); } @@ -237,14 +232,14 @@ public Vector3 Position /// /// Gets or sets the ragdoll's rotation. /// - public Quaternion Rotation + public override Quaternion Rotation { get => Base.transform.rotation; set { NetworkServer.UnSpawn(GameObject); - Base.transform.rotation = value; + Transform.rotation = value; NetworkServer.Spawn(GameObject); } @@ -255,12 +250,12 @@ public Quaternion Rotation /// public Vector3 Scale { - get => Base.transform.localScale; + get => Transform.localScale; set { NetworkServer.UnSpawn(GameObject); - Base.transform.localScale = value; + Transform.localScale = value; NetworkServer.Spawn(GameObject); } diff --git a/Exiled.API/Features/Room.cs b/Exiled.API/Features/Room.cs index c3a06d774a..da1885ad8c 100644 --- a/Exiled.API/Features/Room.cs +++ b/Exiled.API/Features/Room.cs @@ -13,6 +13,7 @@ namespace Exiled.API.Features using Enums; using Exiled.API.Extensions; + using Exiled.API.Features.Core; using Exiled.API.Features.Doors; using Exiled.API.Features.Pickups; using Exiled.API.Interfaces; @@ -27,42 +28,80 @@ namespace Exiled.API.Features /// /// The in-game room. /// - public class Room : MonoBehaviour, IWorldSpace + public class Room : GameEntity, IWorldSpace { /// /// A containing all known s and their corresponding . /// internal static readonly Dictionary RoomIdentifierToRoom = new(250); + private GameObject gameObject; + /// - /// Gets a of which contains all the instances. + /// Initializes a new instance of the class. /// - public static IReadOnlyCollection List => RoomIdentifierToRoom.Values; + /// The room's . + internal Room(GameObject go) + { + gameObject = go; + + Identifier = gameObject.GetComponent(); + RoomIdentifierToRoom.Add(Identifier, this); + + Zone = FindZone(gameObject); +#if Debug + if (Type is RoomType.Unknown) + Log.Error($"[ZONETYPE UNKNOWN] {this}"); +#endif + Type = FindType(gameObject); +#if Debug + if (Type is RoomType.Unknown) + Log.Error($"[ROOMTYPE UNKNOWN] {this}"); +#endif + + RoomLightControllersValue.AddRange(gameObject.GetComponentsInChildren()); + + RoomLightControllers = RoomLightControllersValue.AsReadOnly(); + + GameObject.GetComponentsInChildren().ForEach(component => + { + Window window = new(component, this); + window.Room.WindowsValue.Add(window); + }); + + if (GameObject.GetComponentInChildren() is global::TeslaGate tesla) + TeslaGate = new TeslaGate(tesla, this); + + Windows = WindowsValue.AsReadOnly(); + Doors = DoorsValue.AsReadOnly(); + Speakers = SpeakersValue.AsReadOnly(); + Cameras = CamerasValue.AsReadOnly(); + } /// - /// Gets the name. + /// Gets a of which contains all the instances. /// - public string Name => name; + public static new IReadOnlyCollection List => RoomIdentifierToRoom.Values; /// /// Gets the . /// - public GameObject GameObject => gameObject; + public override GameObject GameObject => gameObject; /// - /// Gets the . + /// Gets the name. /// - public Transform Transform => transform; + public string Name => GameObject.name; /// - /// Gets the position. + /// Gets the 's position. /// - public Vector3 Position => transform.position; + public override Vector3 Position => Transform.position; /// - /// Gets the rotation. + /// Gets the 's rotation. /// - public Quaternion Rotation => transform.rotation; + public override Quaternion Rotation => Transform.rotation; /// /// Gets the in which the room is located. @@ -385,16 +424,6 @@ public void UnlockAll() /// A string containing Room-related data. public override string ToString() => $"{Type} ({Zone}) [{Doors.Count}] *{Cameras.Count}* |{TeslaGate != null}|"; - /// - /// Factory method to create and add a component to a Transform. - /// We can add parameters to be set privately here. - /// - /// The Game Object to attach the Room component to. - internal static void CreateComponent(GameObject roomGameObject) - { - roomGameObject.AddComponent().InternalCreate(); - } - private static RoomType FindType(GameObject gameObject) { // Try to remove brackets if they exist. @@ -479,42 +508,5 @@ private static ZoneType FindZone(GameObject gameObject) return ZoneType.Unspecified; } - - private void InternalCreate() - { - Identifier = gameObject.GetComponent(); - RoomIdentifierToRoom.Add(Identifier, this); - - Zone = FindZone(gameObject); -#if Debug - if (Type is RoomType.Unknown) - Log.Error($"[ZONETYPE UNKNOWN] {this}"); -#endif - Type = FindType(gameObject); -#if Debug - if (Type is RoomType.Unknown) - Log.Error($"[ROOMTYPE UNKNOWN] {this}"); -#endif - - RoomLightControllersValue.AddRange(gameObject.GetComponentsInChildren()); - - RoomLightControllers = RoomLightControllersValue.AsReadOnly(); - - GetComponentsInChildren().ForEach(component => - { - Window window = new(component, this); - window.Room.WindowsValue.Add(window); - }); - - if (GetComponentInChildren() is global::TeslaGate tesla) - { - TeslaGate = new TeslaGate(tesla, this); - } - - Windows = WindowsValue.AsReadOnly(); - Doors = DoorsValue.AsReadOnly(); - Speakers = SpeakersValue.AsReadOnly(); - Cameras = CamerasValue.AsReadOnly(); - } } } diff --git a/Exiled.API/Features/TeslaGate.cs b/Exiled.API/Features/TeslaGate.cs index 4499f79764..174455cbd0 100644 --- a/Exiled.API/Features/TeslaGate.cs +++ b/Exiled.API/Features/TeslaGate.cs @@ -77,20 +77,15 @@ internal TeslaGate(BaseTeslaGate baseTeslaGate, Room room) /// public override GameObject GameObject => Base.gameObject; - /// - /// Gets the tesla gate's . - /// - public Transform Transform => Base.transform; - /// /// Gets the tesla gate's position. /// - public Vector3 Position => Transform.position; + public override Vector3 Position => Transform.position; /// /// Gets the tesla gate's rotation. /// - public Quaternion Rotation => Quaternion.Euler(Base.localRotation); + public override Quaternion Rotation => Quaternion.Euler(Base.localRotation); /// /// Gets the tesla gate's which is located in. diff --git a/Exiled.API/Features/Toys/AdminToy.cs b/Exiled.API/Features/Toys/AdminToy.cs index 241bdd042c..67a2101efd 100644 --- a/Exiled.API/Features/Toys/AdminToy.cs +++ b/Exiled.API/Features/Toys/AdminToy.cs @@ -69,31 +69,13 @@ public Footprint Footprint set => AdminToyBase.SpawnerFootprint = value; } - /// - /// Gets or sets the position of the toy. - /// - public Vector3 Position - { - get => AdminToyBase.transform.position; - set => AdminToyBase.transform.position = value; - } - - /// - /// Gets or sets the rotation of the toy. - /// - public Quaternion Rotation - { - get => AdminToyBase.transform.rotation; - set => AdminToyBase.transform.rotation = value; - } - /// /// Gets or sets the scale of the toy. /// public Vector3 Scale { - get => AdminToyBase.transform.localScale; - set => AdminToyBase.transform.localScale = value; + get => Transform.localScale; + set => Transform.localScale = value; } /// diff --git a/Exiled.API/Features/Window.cs b/Exiled.API/Features/Window.cs index 11f618a470..829b2c725f 100644 --- a/Exiled.API/Features/Window.cs +++ b/Exiled.API/Features/Window.cs @@ -64,7 +64,7 @@ internal Window(BreakableWindow window, Room room) /// /// Gets the window's . /// - public Transform Transform => Base._transform; + public override Transform Transform => Base._transform; /// /// Gets the the window is in. @@ -81,15 +81,6 @@ internal Window(BreakableWindow window, Room room) /// public ZoneType Zone => Room.Zone; - /// - /// Gets or sets the window's position. - /// - public Vector3 Position - { - get => GameObject.transform.position; - set => GameObject.transform.position = value; - } - /// /// Gets a value indicating whether or not this window is breakable. /// @@ -113,15 +104,6 @@ public float Health set => Base.health = value; } - /// - /// Gets or sets the window's rotation. - /// - public Quaternion Rotation - { - get => GameObject.transform.rotation; - set => GameObject.transform.rotation = value; - } - /// /// Gets or sets a value indicating whether or not this window can be broken by SCP. /// diff --git a/Exiled.Events/Handlers/Internal/Round.cs b/Exiled.Events/Handlers/Internal/Round.cs index 0d95bc2884..3c17fbd58b 100644 --- a/Exiled.Events/Handlers/Internal/Round.cs +++ b/Exiled.Events/Handlers/Internal/Round.cs @@ -93,7 +93,7 @@ public static void OnVerified(VerifiedEventArgs ev) } // TODO: Remove if this has been fixed for https://trello.com/c/CzPD304L/5983-networking-blackout-is-not-synchronized-for-the-new-players - foreach (Room room in Room.List.Where(current => current.AreLightsOff)) + foreach (Room room in Room.Get(current => current.AreLightsOff)) { ev.Player.SendFakeSyncVar(room.RoomLightControllerNetIdentity, typeof(RoomLightController), nameof(RoomLightController.NetworkLightsEnabled), true); ev.Player.SendFakeSyncVar(room.RoomLightControllerNetIdentity, typeof(RoomLightController), nameof(RoomLightController.NetworkLightsEnabled), false); diff --git a/Exiled.Events/Patches/Generic/RoomList.cs b/Exiled.Events/Patches/Generic/RoomList.cs index 1bfed91b91..934452bd7e 100644 --- a/Exiled.Events/Patches/Generic/RoomList.cs +++ b/Exiled.Events/Patches/Generic/RoomList.cs @@ -37,14 +37,14 @@ private static IEnumerable Transpiler(IEnumerable i.Calls(Method(typeof(RoomIdUtils), nameof(RoomIdUtils.PositionToCoords)))) + offset; - // Room.CreateComponent(gameObject); + // new Room(gameObject) newInstructions.InsertRange( index, new CodeInstruction[] { new CodeInstruction(OpCodes.Ldarg_0).MoveLabelsFrom(newInstructions[index]), new(OpCodes.Callvirt, PropertyGetter(typeof(Component), nameof(Component.gameObject))), - new(OpCodes.Call, Method(typeof(Room), nameof(Room.CreateComponent))), + new(OpCodes.Newobj, GetDeclaredConstructors(typeof(Room))[0]), }); for (int z = 0; z < newInstructions.Count; z++) From 67b2d28825d71c834e63fe6bb91c7171f03ed0da Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Sat, 3 Feb 2024 22:16:43 +0100 Subject: [PATCH 135/141] Priority check --- Exiled.API/Features/Player.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Exiled.API/Features/Player.cs b/Exiled.API/Features/Player.cs index 685fe4a42e..44c2f1e976 100644 --- a/Exiled.API/Features/Player.cs +++ b/Exiled.API/Features/Player.cs @@ -3397,12 +3397,6 @@ public void Teleport(object obj, Vector3 offset) { switch (obj) { - case Role role: - if (role.Owner is not null) - Teleport(role.Owner.Position + offset); - else - Log.Warn($"{nameof(Teleport)}: {Assembly.GetCallingAssembly().GetName().Name}: Invalid role teleport (role is missing Owner)."); - break; case TeslaGate teslaGate: Teleport( teslaGate.Position + offset + Vector3.up + @@ -3410,6 +3404,12 @@ public void Teleport(object obj, Vector3 offset) ? new Vector3(3, 0, 0) : new Vector3(0, 0, 3))); break; + case Role role: + if (role.Owner is not null) + Teleport(role.Owner.Position + offset); + else + Log.Warn($"{nameof(Teleport)}: {Assembly.GetCallingAssembly().GetName().Name}: Invalid role teleport (role is missing Owner)."); + break; case Item item: if (item.Owner is not null) Teleport(item.Owner.Position + offset); From 7c44eadefa7489a85fafd24013a0b9608f344d64 Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Sat, 3 Feb 2024 22:33:44 +0100 Subject: [PATCH 136/141] Added `Random` method and/or property to game entities. --- Exiled.API/Features/Camera.cs | 4 +-- Exiled.API/Features/Generator.cs | 9 ++++-- Exiled.API/Features/Pickups/Pickup.cs | 8 +++++ Exiled.API/Features/Player.cs | 46 +++++++++++++++------------ Exiled.API/Features/Ragdoll.cs | 6 ++++ Exiled.API/Features/TeslaGate.cs | 9 ++++++ Exiled.API/Features/Window.cs | 7 ++++ 7 files changed, 65 insertions(+), 24 deletions(-) diff --git a/Exiled.API/Features/Camera.cs b/Exiled.API/Features/Camera.cs index 9b1e793ec6..35dc53ee75 100644 --- a/Exiled.API/Features/Camera.cs +++ b/Exiled.API/Features/Camera.cs @@ -151,9 +151,9 @@ internal Camera(Scp079Camera camera079) public static new IReadOnlyCollection List => Camera079ToCamera.Values; /// - /// Gets a random . + /// Gets a randomly selected . /// - /// object. + /// A randomly selected object. public static Camera Random => List.Random(); /// diff --git a/Exiled.API/Features/Generator.cs b/Exiled.API/Features/Generator.cs index 3a05f1b115..beb9b1b3ad 100644 --- a/Exiled.API/Features/Generator.cs +++ b/Exiled.API/Features/Generator.cs @@ -12,11 +12,10 @@ namespace Exiled.API.Features using System.Linq; using Enums; + using Exiled.API.Extensions; using Exiled.API.Features.Core; using Exiled.API.Interfaces; - using MapGeneration.Distributors; - using UnityEngine; /// @@ -46,6 +45,12 @@ internal Generator(Scp079Generator scp079Generator) /// public static new IReadOnlyCollection List => Scp079GeneratorToGenerator.Values; + /// + /// Gets a randomly selected . + /// + /// A randomly selected object. + public static Generator Random => List.Random(); + /// /// Gets the base . /// diff --git a/Exiled.API/Features/Pickups/Pickup.cs b/Exiled.API/Features/Pickups/Pickup.cs index 00586f5e87..3de52de9fd 100644 --- a/Exiled.API/Features/Pickups/Pickup.cs +++ b/Exiled.API/Features/Pickups/Pickup.cs @@ -5,6 +5,8 @@ // // ----------------------------------------------------------------------- +using Exiled.API.Extensions; + namespace Exiled.API.Features.Pickups { using System; @@ -108,6 +110,12 @@ internal Pickup(ItemType type) /// public static new IEnumerable List => BaseToPickup.Values; + /// + /// Gets a randomly selected . + /// + /// A randomly selected object. + public static Pickup Random => BaseToPickup.Random().Value; + /// /// Gets the of the Pickup. /// diff --git a/Exiled.API/Features/Player.cs b/Exiled.API/Features/Player.cs index 44c2f1e976..a303a77720 100644 --- a/Exiled.API/Features/Player.cs +++ b/Exiled.API/Features/Player.cs @@ -142,6 +142,12 @@ public Player(GameObject gameObject) /// public static Dictionary UserIdsCache { get; } = new(20); + /// + /// Gets a randomly selected . + /// + /// A randomly selected object. + public static Player Random => List.Random(); + /// /// Gets or sets a containing cached and their FF multiplier. This is for non-unique roles. /// @@ -3475,16 +3481,16 @@ public void RandomTeleport(Type type) { object randomObject = type.Name switch { - nameof(Camera) => Camera.List.Random(), + nameof(Camera) => Camera.Random, nameof(Door) => Door.Random(), - nameof(Room) => Room.List.Random(), - nameof(TeslaGate) => TeslaGate.List.Random(), - nameof(Player) => Dictionary.Values.Random(), - nameof(Pickup) => Pickup.BaseToPickup.Random().Value, - nameof(Ragdoll) => Ragdoll.List.Random(), + nameof(Room) => Room.Random(), + nameof(TeslaGate) => TeslaGate.Random, + nameof(Player) => Random, + nameof(Pickup) => Pickup.Random, + nameof(Ragdoll) => Ragdoll.Random, nameof(Locker) => Map.GetRandomLocker(), - nameof(Generator) => Generator.List.Random(), - nameof(Window) => Window.List.Random(), + nameof(Generator) => Generator.Random, + nameof(Window) => Window.Random, nameof(Scp914) => Scp914.Scp914Controller, nameof(LockerChamber) => Map.GetRandomLocker().Chambers.Random(), _ => null, @@ -3514,37 +3520,37 @@ public void RandomTeleport(IEnumerable types) public void RandomTeleport() => RandomTeleport(typeof(T)); /// - /// Get the time cooldown on this ItemType. + /// Retrieves the cooldown time for the specified ItemType. /// - /// The items to choose for getting cooldown. - /// Return the time in seconds of the cooldowns. + /// The ItemType to retrieve the cooldown for. + /// The cooldown time in seconds, or -1 if not found. public float GetCooldownItem(ItemType itemType) => UsableItemsController.GetHandler(ReferenceHub).PersonalCooldowns.TryGetValue(itemType, out float value) ? value : -1; /// - /// Set the time cooldown on this ItemType. + /// Sets the cooldown time for the specified ItemType. /// - /// The times for the cooldown. - /// The items to choose for being cooldown. + /// The cooldown time in seconds. + /// The ItemType to set the cooldown for. public void SetCooldownItem(float time, ItemType itemType) => UsableItemsController.GetHandler(ReferenceHub).PersonalCooldowns[itemType] = Time.timeSinceLevelLoad + time; /// - /// Explode the player. + /// Triggers an explosion for the player. /// public void Explode() => ExplosionUtils.ServerExplode(ReferenceHub); /// - /// Explode the player. + /// Triggers an explosion for the player. /// - /// The projectile that will create the explosion. - /// The Player that will causing the explosion. + /// The type of projectile causing the explosion. + /// The player triggering the explosion. public void Explode(ProjectileType projectileType, Player attacker = null) => Map.Explode(Position, projectileType, attacker); /// - /// Spawn projectile effect on the player. + /// Spawns an explosion effect for the player. /// - /// The projectile that will create the effect. + /// The type of projectile creating the effect. public void ExplodeEffect(ProjectileType projectileType) => Map.ExplodeEffect(Position, projectileType); /// diff --git a/Exiled.API/Features/Ragdoll.cs b/Exiled.API/Features/Ragdoll.cs index 3100b7bb58..89c4ede2b7 100644 --- a/Exiled.API/Features/Ragdoll.cs +++ b/Exiled.API/Features/Ragdoll.cs @@ -69,6 +69,12 @@ public static int FreezeTime set => RagdollManager.FreezeTime = value; } + /// + /// Gets a randomly selected . + /// + /// A randomly selected object. + public static Ragdoll Random => List.Random(); + /// /// Gets a value indicating whether or not the clean up event can be executed. /// diff --git a/Exiled.API/Features/TeslaGate.cs b/Exiled.API/Features/TeslaGate.cs index 174455cbd0..f63fc942d7 100644 --- a/Exiled.API/Features/TeslaGate.cs +++ b/Exiled.API/Features/TeslaGate.cs @@ -5,6 +5,9 @@ // // ----------------------------------------------------------------------- +using Exiled.API.Extensions; +using MapGeneration; + namespace Exiled.API.Features { using System; @@ -67,6 +70,12 @@ internal TeslaGate(BaseTeslaGate baseTeslaGate, Room room) /// public static List IgnoredTeams { get; set; } = new(); + /// + /// Gets a randomly selected . + /// + /// A randomly selected object. + public static TeslaGate Random => List.Random(); + /// /// Gets the base . /// diff --git a/Exiled.API/Features/Window.cs b/Exiled.API/Features/Window.cs index 829b2c725f..a1819c9f57 100644 --- a/Exiled.API/Features/Window.cs +++ b/Exiled.API/Features/Window.cs @@ -13,6 +13,7 @@ namespace Exiled.API.Features using DamageHandlers; using Enums; + using Exiled.API.Extensions; using Exiled.API.Features.Core; using Exiled.API.Features.Doors; using Exiled.API.Interfaces; @@ -51,6 +52,12 @@ internal Window(BreakableWindow window, Room room) /// public static new IReadOnlyCollection List => BreakableWindowToWindow.Values; + /// + /// Gets a randomly selected . + /// + /// A randomly selected object. + public static Window Random => List.Random(); + /// /// Gets the base-game for this window. /// From a4b64b21ef7b954851068fdf163c3d8c1fbb5a62 Mon Sep 17 00:00:00 2001 From: Yamato <66829532+louis1706@users.noreply.github.com> Date: Sat, 3 Feb 2024 22:36:24 +0100 Subject: [PATCH 137/141] Optimise (#2431) --- Exiled.API/Features/Core/GameEntity.cs | 8 ++++---- Exiled.API/Features/Player.cs | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Exiled.API/Features/Core/GameEntity.cs b/Exiled.API/Features/Core/GameEntity.cs index 38f3d290a0..4085c423ff 100644 --- a/Exiled.API/Features/Core/GameEntity.cs +++ b/Exiled.API/Features/Core/GameEntity.cs @@ -88,7 +88,7 @@ public virtual Quaternion Rotation /// The nearest within the specified distance, or if no game /// entity is found. /// - public static GameEntity GetNearestEntity(Vector3 vector, float distance) => GetNearestEntities(vector, distance).OrderBy(p => Vector3.Distance(vector, p.GameObject.transform.position)).FirstOrDefault(); + public static GameEntity GetNearestEntity(Vector3 vector, float distance) => GetNearestEntities(vector, distance).OrderBy(p => (vector - p.GameObject.transform.position).sqrMagnitude).FirstOrDefault(); /// /// Gets all game entities near the specified within the given distance. @@ -96,7 +96,7 @@ public virtual Quaternion Rotation /// The to compare. /// The maximum distance the game entity can be from the to be included. /// The filtered collection of objects. - public static IEnumerable GetNearestEntities(Vector3 vector, float distance) => List.Where(p => p.GameObject.transform && Vector3.Distance(vector, p.GameObject.transform.position) <= distance); + public static IEnumerable GetNearestEntities(Vector3 vector, float distance) => List.Where(p => p.GameObject.transform && (vector - p.GameObject.transform.position).sqrMagnitude <= distance * distance); /// /// Gets the farthest game entity from the specified within the given distance. @@ -107,7 +107,7 @@ public virtual Quaternion Rotation /// The farthest from the specified within the given /// distance, or if no game entity is found. /// - public static GameEntity GetFarthestEntity(Vector3 vector, float distance) => GetFarthestEntities(vector, distance).OrderByDescending(p => Vector3.Distance(vector, p.GameObject.transform.position)).FirstOrDefault(); + public static GameEntity GetFarthestEntity(Vector3 vector, float distance) => GetFarthestEntities(vector, distance).OrderByDescending(p => (vector - p.GameObject.transform.position).sqrMagnitude).FirstOrDefault(); /// /// Gets all game entities that have a distance greater than the specified distance from the given . @@ -115,7 +115,7 @@ public virtual Quaternion Rotation /// The to compare. /// The minimum distance the game entity can be from the to be included. /// The filtered collection of objects. - public static IEnumerable GetFarthestEntities(Vector3 vector, float distance) => List.Where(p => p.GameObject.transform && Vector3.Distance(vector, p.GameObject.transform.position) >= distance); + public static IEnumerable GetFarthestEntities(Vector3 vector, float distance) => List.Where(p => p.GameObject.transform && (vector - p.GameObject.transform.position).sqrMagnitude >= distance * distance); /// public T AddComponent(string name = "") diff --git a/Exiled.API/Features/Player.cs b/Exiled.API/Features/Player.cs index a303a77720..b5cef00276 100644 --- a/Exiled.API/Features/Player.cs +++ b/Exiled.API/Features/Player.cs @@ -1190,7 +1190,7 @@ public bool IsSpawnProtected /// The to compare. /// The maximum distance the player can be from the to be included. /// The nearest within the specified distance, or if no player is found. - public static Player GetNearestPlayer(Vector3 vector, float distance) => GetNearestPlayers(vector, distance).OrderBy(p => Vector3.Distance(vector, p.Position)).FirstOrDefault(); + public static Player GetNearestPlayer(Vector3 vector, float distance) => GetNearestPlayers(vector, distance).OrderBy(p => (vector - p.Position).sqrMagnitude).FirstOrDefault(); /// /// Gets all players near the specified within the given distance. @@ -1198,7 +1198,7 @@ public bool IsSpawnProtected /// The to compare. /// The maximum distance the player can be from the to be included. /// The filtered collection of objects. - public static IEnumerable GetNearestPlayers(Vector3 vector, float distance) => List.Where(p => Vector3.Distance(vector, p.Position) <= distance); + public static IEnumerable GetNearestPlayers(Vector3 vector, float distance) => List.Where(p => (vector - p.Position).sqrMagnitude <= distance * distance); /// /// Gets the farthest player from the specified within the given distance. @@ -1206,7 +1206,7 @@ public bool IsSpawnProtected /// The to compare. /// The minimum distance the player can be from the to be included. /// The farthest from the specified within the given distance, or if no player is found. - public static Player GetFarthestPlayer(Vector3 vector, float distance) => GetFarthestPlayers(vector, distance).OrderByDescending(p => Vector3.Distance(vector, p.Position)).FirstOrDefault(); + public static Player GetFarthestPlayer(Vector3 vector, float distance) => GetFarthestPlayers(vector, distance).OrderByDescending(p => (vector - p.Position).sqrMagnitude).FirstOrDefault(); /// /// Gets all players that have a distance greater than the specified distance from the given . @@ -1214,7 +1214,7 @@ public bool IsSpawnProtected /// The to compare. /// The minimum distance the player can be from the to be included. /// The filtered collection of objects. - public static IEnumerable GetFarthestPlayers(Vector3 vector, float distance) => List.Where(p => Vector3.Distance(vector, p.Position) >= distance); + public static IEnumerable GetFarthestPlayers(Vector3 vector, float distance) => List.Where(p => (vector - p.Position).sqrMagnitude >= distance * distance); /// /// Gets the belonging to the , if any. From a10f8cd0ff44fc825ecdf3131b326dc6774717c9 Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Sat, 3 Feb 2024 22:39:47 +0100 Subject: [PATCH 138/141] Typo --- Exiled.API/Features/Player.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Exiled.API/Features/Player.cs b/Exiled.API/Features/Player.cs index a303a77720..0e256a9192 100644 --- a/Exiled.API/Features/Player.cs +++ b/Exiled.API/Features/Player.cs @@ -2337,7 +2337,7 @@ public void Ban(int duration, string reason, Player issuer = null) public void UnMute(bool isIntercom = false) => VoiceChatMutes.RevokeLocalMute(UserId, isIntercom); /// - /// Blink the player's tag. + /// Blinks the player's tag. /// /// Used to wait. public IEnumerator BlinkTag() From e77d6a2e6795da9f0a49e3766519c07a66867307 Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Sat, 3 Feb 2024 22:44:47 +0100 Subject: [PATCH 139/141] Fix warnings --- Exiled.API/Features/Pickups/Pickup.cs | 6 +----- Exiled.API/Features/TeslaGate.cs | 9 ++------- 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/Exiled.API/Features/Pickups/Pickup.cs b/Exiled.API/Features/Pickups/Pickup.cs index 3de52de9fd..7d35f9ec56 100644 --- a/Exiled.API/Features/Pickups/Pickup.cs +++ b/Exiled.API/Features/Pickups/Pickup.cs @@ -5,24 +5,21 @@ // // ----------------------------------------------------------------------- -using Exiled.API.Extensions; - namespace Exiled.API.Features.Pickups { using System; using System.Collections.Generic; using System.Linq; + using Exiled.API.Extensions; using Exiled.API.Features.Core; using Exiled.API.Features.Pickups.Projectiles; using Exiled.API.Interfaces; - using InventorySystem; using InventorySystem.Items; using InventorySystem.Items.Pickups; using InventorySystem.Items.ThrowableProjectiles; using InventorySystem.Items.Usables.Scp244; - using Mirror; using RelativePositioning; using UnityEngine; @@ -38,7 +35,6 @@ namespace Exiled.API.Features.Pickups using BaseScp1576Pickup = InventorySystem.Items.Usables.Scp1576.Scp1576Pickup; using BaseScp2176Projectile = InventorySystem.Items.ThrowableProjectiles.Scp2176Projectile; using BaseScp330Pickup = InventorySystem.Items.Usables.Scp330.Scp330Pickup; - using Object = UnityEngine.Object; /// diff --git a/Exiled.API/Features/TeslaGate.cs b/Exiled.API/Features/TeslaGate.cs index f63fc942d7..239369af3a 100644 --- a/Exiled.API/Features/TeslaGate.cs +++ b/Exiled.API/Features/TeslaGate.cs @@ -5,24 +5,19 @@ // // ----------------------------------------------------------------------- -using Exiled.API.Extensions; -using MapGeneration; - namespace Exiled.API.Features { using System; using System.Collections.Generic; using System.Linq; + using Exiled.API.Extensions; using Exiled.API.Features.Core; using Exiled.API.Interfaces; - using Hazards; - + using MapGeneration; using MEC; - using PlayerRoles; - using UnityEngine; using BaseTeslaGate = global::TeslaGate; From 0348dbbb1cf77f767189e55ff0311f91b2d2a363 Mon Sep 17 00:00:00 2001 From: Snivy Films <120346554+SnivyFilms@users.noreply.github.com> Date: Sat, 3 Feb 2024 16:46:15 -0500 Subject: [PATCH 140/141] `[Exiled.Events]` Added `PlacingPickupIntoPocketDimension` event. (#2256) * Added 106 Pocket Dimension pickup handler * FixEvent * ShouldWarning -> ShouldWarn * patch * Did what Nao did because I follow orders blindly without questioning * I am blind but these changes has been made to appease the great and holy Nao * I am incredibly blind * I need glasses --------- Co-authored-by: Snivy FIlms <120346554+NikkiGardiner1@users.noreply.github.com> Co-authored-by: louis1706 Co-authored-by: Nameless <85962933+Misfiy@users.noreply.github.com> --- ...acingPickupIntoPocketDimensionEventArgs.cs | 83 +++++++++++++++++++ Exiled.Events/Handlers/Map.cs | 11 +++ .../Map/PlacingPickupIntoPocketDimension.cs | 44 ++++++++++ 3 files changed, 138 insertions(+) create mode 100644 Exiled.Events/EventArgs/Map/PlacingPickupIntoPocketDimensionEventArgs.cs create mode 100644 Exiled.Events/Patches/Events/Map/PlacingPickupIntoPocketDimension.cs diff --git a/Exiled.Events/EventArgs/Map/PlacingPickupIntoPocketDimensionEventArgs.cs b/Exiled.Events/EventArgs/Map/PlacingPickupIntoPocketDimensionEventArgs.cs new file mode 100644 index 0000000000..f975da50a8 --- /dev/null +++ b/Exiled.Events/EventArgs/Map/PlacingPickupIntoPocketDimensionEventArgs.cs @@ -0,0 +1,83 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +namespace Exiled.Events.EventArgs.Map +{ + using Exiled.API.Features.Pickups; + using Exiled.Events.EventArgs.Interfaces; + using InventorySystem.Items.Pickups; + + using UnityEngine; + + using static PlayerRoles.PlayableScps.Scp106.Scp106PocketItemManager; + + /// + /// Contains information about items in the pocket dimension. + /// + public class PlacingPickupIntoPocketDimensionEventArgs : IDeniableEvent, IPickupEvent + { + /// + /// Initializes a new instance of the class. + /// + /// + /// + /// + public PlacingPickupIntoPocketDimensionEventArgs(ItemPickupBase pickupBase, PocketItem pocketItem, bool isAllowed) + { + Pickup = Pickup.Get(pickupBase); + PocketItem = pocketItem; + IsAllowed = isAllowed; + } + + /// + public Pickup Pickup { get; } + + /// + /// Gets the value of the PocketItem. + /// + public PocketItem PocketItem { get; } + + /// + /// Gets or sets a value indicating when the Pickup will be dropped onto the map. + /// + public double DropTime + { + get => PocketItem.TriggerTime; + set => PocketItem.TriggerTime = value; + } + + /// + /// Gets or sets a value indicating whether the pickup should be removed from the Pocket Dimension. + /// + public bool ShouldRemove + { + get => PocketItem.Remove; + set => PocketItem.Remove = value; + } + + /// + /// Gets or sets a value indicating whether the warning sound for the pickup should be sent. + /// + public bool ShouldWarn + { + get => !PocketItem.WarningSent; + set => PocketItem.WarningSent = !value; + } + + /// + /// Gets or sets the location where the pickup will drop onto the map. + /// + public Vector3 Position + { + get => PocketItem.DropPosition.Position; + set => PocketItem.DropPosition = new(value); + } + + /// + public bool IsAllowed { get; set; } + } +} \ No newline at end of file diff --git a/Exiled.Events/Handlers/Map.cs b/Exiled.Events/Handlers/Map.cs index f6d2e3b786..6f824f3f10 100644 --- a/Exiled.Events/Handlers/Map.cs +++ b/Exiled.Events/Handlers/Map.cs @@ -105,6 +105,11 @@ public static class Map /// public static Event SpawningTeamVehicle { get; set; } = new(); + /// + /// Invoked before an item is placed in the pocket dimension. + /// + public static Event PlacingPickupIntoPocketDimension { get; set; } = new(); + /// /// Called before placing a decal. /// @@ -205,5 +210,11 @@ public static class Map /// /// The instance. public static void OnSpawningTeamVehicle(SpawningTeamVehicleEventArgs ev) => SpawningTeamVehicle.InvokeSafely(ev); + + /// + /// Called before an item is dropped in the pocket dimension. + /// + /// The instnace. + public static void OnPlacingPickupIntoPocketDimension(PlacingPickupIntoPocketDimensionEventArgs ev) => PlacingPickupIntoPocketDimension.InvokeSafely(ev); } } \ No newline at end of file diff --git a/Exiled.Events/Patches/Events/Map/PlacingPickupIntoPocketDimension.cs b/Exiled.Events/Patches/Events/Map/PlacingPickupIntoPocketDimension.cs new file mode 100644 index 0000000000..56d698dbc3 --- /dev/null +++ b/Exiled.Events/Patches/Events/Map/PlacingPickupIntoPocketDimension.cs @@ -0,0 +1,44 @@ +// ----------------------------------------------------------------------- +// +// Copyright (c) Exiled Team. All rights reserved. +// Licensed under the CC BY-SA 3.0 license. +// +// ----------------------------------------------------------------------- + +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; + + /// + /// Patches + /// Adds the event. + /// + [EventPatch(typeof(Map), nameof(Map.PlacingPickupIntoPocketDimension))] + [HarmonyPatch(typeof(Scp106PocketItemManager), nameof(Scp106PocketItemManager.OnAdded))] + internal static class PlacingPickupIntoPocketDimension + { + private static void Postfix(ItemPickupBase ipb) + { + if (TrackedItems.TryGetValue(ipb, out PocketItem pocketItem)) + { + PlacingPickupIntoPocketDimensionEventArgs ev = new(ipb, pocketItem, true); + Map.OnPlacingPickupIntoPocketDimension(ev); + + if (!ev.IsAllowed) + { + TrackedItems.Remove(ipb); + } + } + } + } +} From 1dac1eff8ec51d73e21228135e5e381acecd630c Mon Sep 17 00:00:00 2001 From: NaoUnderscore Date: Sat, 3 Feb 2024 23:29:51 +0100 Subject: [PATCH 141/141] Typos --- Exiled.API/Features/DynamicEvents/DynamicEventDispatcher.cs | 2 +- Exiled.API/Features/DynamicEvents/TDynamicEventDispatcher.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Exiled.API/Features/DynamicEvents/DynamicEventDispatcher.cs b/Exiled.API/Features/DynamicEvents/DynamicEventDispatcher.cs index 9a2a99351b..39d2e6df34 100644 --- a/Exiled.API/Features/DynamicEvents/DynamicEventDispatcher.cs +++ b/Exiled.API/Features/DynamicEvents/DynamicEventDispatcher.cs @@ -42,7 +42,7 @@ public DynamicEventDispatcher() /// This indexer allows access to bound listeners using an reference. /// /// The listener to look for. - /// The obund listener corresponding to the specified reference. + /// The bound listener corresponding to the specified reference. public KeyValuePair> this[object @object] => boundDelegates.FirstOrDefault(kvp => kvp.Key == @object); /// diff --git a/Exiled.API/Features/DynamicEvents/TDynamicEventDispatcher.cs b/Exiled.API/Features/DynamicEvents/TDynamicEventDispatcher.cs index 778d815454..70ec8b0fa6 100644 --- a/Exiled.API/Features/DynamicEvents/TDynamicEventDispatcher.cs +++ b/Exiled.API/Features/DynamicEvents/TDynamicEventDispatcher.cs @@ -43,7 +43,7 @@ public TDynamicEventDispatcher() /// This indexer allows access to bound listeners using an reference. /// /// The listener to look for. - /// The obund listener corresponding to the specified reference. + /// The bound listener corresponding to the specified reference. public KeyValuePair>> this[object @object] => boundDelegates.FirstOrDefault(kvp => kvp.Key == @object); ///