diff --git a/BetterDoggie/BetterDoggie.cs b/BetterDoggie/BetterDoggie.cs index 6512f4a..dec4a83 100644 --- a/BetterDoggie/BetterDoggie.cs +++ b/BetterDoggie/BetterDoggie.cs @@ -22,32 +22,22 @@ public override void OnEnabled() { Singleton = this; - RegisterEvents(); + PlayerEvents.ChangingRole += EventHandlers.OnChangingRoles; + PlayerEvents.Hurting += EventHandlers.OnHurtingPlayer; + PlayerEvents.InteractingDoor += EventHandlers.OnInteractingDoor; base.OnEnabled(); } public override void OnDisabled() { - UnRegisterEvents(); + PlayerEvents.ChangingRole -= EventHandlers.OnChangingRoles; + PlayerEvents.Hurting -= EventHandlers.OnHurtingPlayer; + PlayerEvents.InteractingDoor -= EventHandlers.OnInteractingDoor; Singleton = null; base.OnDisabled(); } - - private static void RegisterEvents() - { - PlayerEvents.ChangingRole += EventHandlers.OnChangingRoles; - PlayerEvents.Hurting += EventHandlers.OnHurtingPlayer; - PlayerEvents.InteractingDoor += EventHandlers.OnInteractingDoor; - } - - private static void UnRegisterEvents() - { - PlayerEvents.ChangingRole -= EventHandlers.OnChangingRoles; - PlayerEvents.Hurting -= EventHandlers.OnHurtingPlayer; - PlayerEvents.InteractingDoor -= EventHandlers.OnInteractingDoor; - } } } \ No newline at end of file diff --git a/BetterDoggie/Config.cs b/BetterDoggie/Config.cs index 3469dc9..2897c75 100644 --- a/BetterDoggie/Config.cs +++ b/BetterDoggie/Config.cs @@ -12,9 +12,6 @@ public class Config : IConfig [Description("The size the 939 will be sized to.")] public Vector3 DoggieScale { get; set; } = new Vector3(.85f, .85f, .85f); - [Description("The speed boost that the dog should get. (Default is 7)")] - public float DogSpeed { get; set; } = 9f; - [Description("The base amount of damage 939 will do.")] public float BaseDamage { get; set; } = 40f; @@ -23,7 +20,8 @@ public class Config : IConfig [Description("Message to send to players when they spawn as 939")] public string SpawnMessage { get; set; } = - "You have spawned as an upgraded SCP-939! You run faster but slow down when you attack!"; + "You have spawned as an upgraded SCP-939! You run faster but slow down when you attack! " + + "You can also bust down doors and pry gates when your Hume shield is below 50!"; [Description("Can 939 bust open doors and gates if it is below a certain AHP?")] public bool EnableDogDoorBusting { get; set; } = true; diff --git a/BetterDoggie/EventHandlers.cs b/BetterDoggie/EventHandlers.cs index de5866d..9e77d31 100644 --- a/BetterDoggie/EventHandlers.cs +++ b/BetterDoggie/EventHandlers.cs @@ -1,12 +1,12 @@ namespace BetterDoggie { - using Exiled.API.Extensions; - using Exiled.Events.EventArgs; - using CustomPlayerEffects; - using MEC; using System; + using Exiled.API.Features; + using Exiled.Events.EventArgs; using Interactables.Interobjects; using Interactables.Interobjects.DoorUtils; + using CustomPlayerEffects; + using MEC; public static class EventHandlers { @@ -20,9 +20,7 @@ public static void OnChangingRoles(ChangingRoleEventArgs ev) ev.Player.Broadcast(8, BetterDoggie.Singleton.Config.SpawnMessage); ev.Player.Scale = BetterDoggie.Singleton.Config.DoggieScale; - ev.Player.ChangeWalkingSpeed(BetterDoggie.Singleton.Config.DogSpeed); - // 2 is the default difference in walk and run speed - ev.Player.ChangeRunningSpeed(BetterDoggie.Singleton.Config.DogSpeed + 2); + ev.Player.EnableEffect(); }); } @@ -36,12 +34,12 @@ public static void OnHurtingPlayer(HurtingEventArgs ev) ev.IsAllowed = false; return; } - - + // 600 Is the maximum hume shield of 939 ev.Amount = BetterDoggie.Singleton.Config.BaseDamage + Math.Abs(ev.Attacker.ArtificialHealth - 600) / 600 * BetterDoggie.Singleton.Config.MaxDamageBoost; - + ev.Attacker.EnableEffect(3f, true); + ev.Attacker.ChangeEffectIntensity(2); } public static void OnInteractingDoor(InteractingDoorEventArgs ev) @@ -56,7 +54,7 @@ public static void OnInteractingDoor(InteractingDoorEventArgs ev) BustDoor(ev.Door.Base, ev.Player); } - private static void BustDoor(DoorVariant door, Exiled.API.Features.Player ply) + private static void BustDoor(DoorVariant door, Player ply) { if (door is IDamageableDoor damage) damage.IsDestroyed = true; @@ -64,8 +62,8 @@ private static void BustDoor(DoorVariant door, Exiled.API.Features.Player ply) if (door is PryableDoor pryableDoor) pryableDoor.TryPryGate(); - ply.EnableEffect(2, true); ply.ChangeEffectIntensity(2); + Timing.CallDelayed(2f, () => ply.ChangeEffectIntensity(1)); } } } \ No newline at end of file