diff --git a/Exiled.API/Features/Items/Scp244.cs b/Exiled.API/Features/Items/Scp244.cs index 2d41dce073..af79e9f337 100644 --- a/Exiled.API/Features/Items/Scp244.cs +++ b/Exiled.API/Features/Items/Scp244.cs @@ -54,6 +54,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 +102,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 +112,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/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.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/Patches/Events/Scp173/UsingBreakneckSpeeds.cs b/Exiled.Events/Patches/Events/Scp173/UsingBreakneckSpeeds.cs index bbc6f51d92..8acf3f6f94 100644 --- a/Exiled.Events/Patches/Events/Scp173/UsingBreakneckSpeeds.cs +++ b/Exiled.Events/Patches/Events/Scp173/UsingBreakneckSpeeds.cs @@ -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/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!"); +} +```