Skip to content
This repository has been archived by the owner on Sep 4, 2023. It is now read-only.

Commit

Permalink
release
Browse files Browse the repository at this point in the history
  • Loading branch information
Parkeymon committed Nov 22, 2021
1 parent 5b7ed32 commit 6aa7b99
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 32 deletions.
22 changes: 6 additions & 16 deletions BetterDoggie/BetterDoggie.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
6 changes: 2 additions & 4 deletions BetterDoggie/Config.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -23,7 +20,8 @@ public class Config : IConfig

[Description("Message to send to players when they spawn as 939")]
public string SpawnMessage { get; set; } =
"<color=orange>You have spawned as an <color=red>upgraded</color> SCP-939! You run <color=red>faster</color> but slow down when you attack!</color>";
"<color=orange>You have spawned as an <color=red>upgraded</color> SCP-939! You run <color=red>faster</color> but slow down when you attack! " +
"You can also bust down doors and pry gates when your Hume shield is below 50!</color>";

[Description("Can 939 bust open doors and gates if it is below a certain AHP?")]
public bool EnableDogDoorBusting { get; set; } = true;
Expand Down
22 changes: 10 additions & 12 deletions BetterDoggie/EventHandlers.cs
Original file line number Diff line number Diff line change
@@ -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
{
Expand All @@ -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<Scp207>();
});
}

Expand All @@ -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<SinkHole>(3f, true);
ev.Attacker.ChangeEffectIntensity<SinkHole>(2);
}

public static void OnInteractingDoor(InteractingDoorEventArgs ev)
Expand All @@ -56,16 +54,16 @@ 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;

if (door is PryableDoor pryableDoor)
pryableDoor.TryPryGate();

ply.EnableEffect<Scp207>(2, true);
ply.ChangeEffectIntensity<Scp207>(2);
Timing.CallDelayed(2f, () => ply.ChangeEffectIntensity<Scp207>(1));
}
}
}

0 comments on commit 6aa7b99

Please sign in to comment.