Skip to content

Commit

Permalink
Funny features and Fix Exiled8
Browse files Browse the repository at this point in the history
  • Loading branch information
louis1706 committed Sep 1, 2023
1 parent fd58a68 commit 6f20fe7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
23 changes: 13 additions & 10 deletions EventHandlers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
using InventorySystem.Configs;
using Exiled.API.Extensions;
using Exiled.Events.EventArgs.Item;
using Exiled.API.Features.Doors;
using BreakableDoor = Exiled.API.Features.Doors.BreakableDoor;

namespace FacilityManagement
{
Expand Down Expand Up @@ -167,12 +169,12 @@ public void CustomDoor()
{
foreach (Door door in Door.List)
{
if (door.Base is CheckpointDoor checkpoint)
if (door is Exiled.API.Features.Doors.CheckpointDoor checkpoint)
{
foreach (DoorVariant checpointdoor in checkpoint._subDoors)
foreach (Door checpointdoor in checkpoint.Subdoors)
{
Log.Info(Door.Get(checpointdoor));
CustomDoorSet(Door.Get(checpointdoor), door.Type);
Log.Info(checpointdoor);
CustomDoorSet(checpointdoor, door.Type);
}
continue;
}
Expand All @@ -183,21 +185,22 @@ public void CustomDoorSet(Door door, DoorType type)
{
if (plugin.Config.CustomDoors.TryGetValue(type, out DoorBuild doorBuild))
{
BreakableDoor breakabledoor = door.As<BreakableDoor>();
if (FacilityManagement.Singleton.Config.Debug)
{
string Debug = $"[CustomDoor] : {type}\n";
Debug += $"Health: {door.Health} => {doorBuild.Health.Value}\n";
Debug += $"IgnoredDamageTypes: {door.IgnoredDamageTypes} => {doorBuild.DamageTypeIgnored}\n\n";
Debug += $"Health: {(breakabledoor is null ? "Nan" : breakabledoor.Health)} => {doorBuild.Health.Value}\n";
Debug += $"IgnoredDamageTypes: {(breakabledoor is null ? "Nan" : breakabledoor.IgnoredDamage)} => {doorBuild.DamageTypeIgnored}\n\n";
Debug += $"RequiredPermissions: {door.RequiredPermissions.RequiredPermissions} => {doorBuild.RequiredPermission}\n\n";
Debug += $"RequireAllPermission: {door.RequiredPermissions.RequireAll} => {doorBuild.RequireAllPermission}\n\n";
Log.Debug(Debug);
return;
}

if (doorBuild.Health is not null)
door.Health = doorBuild.Health.Value;
if (doorBuild.DamageTypeIgnored is not null)
door.IgnoredDamageTypes = doorBuild.DamageTypeIgnored.Value;
if (doorBuild.Health is not null && breakabledoor is not null)
breakabledoor.Health = doorBuild.Health.Value;
if (doorBuild.DamageTypeIgnored is not null && breakabledoor is not null)
breakabledoor.IgnoredDamage = doorBuild.DamageTypeIgnored.Value;
if (doorBuild.RequiredPermission is not null)
door.RequiredPermissions.RequiredPermissions = doorBuild.RequiredPermission.Value;
if (doorBuild.RequireAllPermission is not null)
Expand Down
2 changes: 1 addition & 1 deletion Patches/RAUtilsAddon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ where ply.nicknameSync.MyNick.Equals(name)
}
else
{
if (args.At(startindex).Length > 0 && char.IsDigit(args.At(startindex)[0]))
if (args.At(startindex).Length > 0)
{
string[] array = args.At(startindex).Split('.');
for (int i = 0; i < array.Length; i++)
Expand Down

0 comments on commit 6f20fe7

Please sign in to comment.