Skip to content

Commit 9bf18b3

Browse files
Update BreakDoorMethod.cs
1 parent 43434ae commit 9bf18b3

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed
Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
using Interactables.Interobjects.DoorUtils;
1+
using System.Linq;
2+
using Interactables.Interobjects.DoorUtils;
23
using LabApi.Features.Wrappers;
34
using SER.ArgumentSystem.Arguments;
45
using SER.ArgumentSystem.BaseArguments;
56
using SER.MethodSystem.BaseMethods;
67

78
namespace SER.MethodSystem.Methods.DoorMethods;
9+
810
internal class BreakDoorMethod : SynchronousMethod
911
{
1012
public override string Description => "Breaks specified doors if possible (for example, you can't destroy Gate B, but you can destroy normal HCZ doors)";
@@ -13,9 +15,9 @@ internal class BreakDoorMethod : SynchronousMethod
1315
[
1416
new DoorsArgument("doors")
1517
{
16-
Description="Doors to break"
18+
Description = "Doors to break"
1719
},
18-
new EnumArgument<DoorDamageType>("doordamagetype")
20+
new EnumArgument<DoorDamageType>("damage type")
1921
{
2022
DefaultValue = DoorDamageType.ServerCommand,
2123
Description = "Type of damage to be applied on doors"
@@ -25,12 +27,11 @@ internal class BreakDoorMethod : SynchronousMethod
2527
public override void Execute()
2628
{
2729
Door[] doors = Args.GetDoors("doors");
28-
foreach(Door door in doors)
30+
var damageType = Args.GetEnum<DoorDamageType>("damage type");
31+
32+
foreach (BreakableDoor door in doors.OfType<BreakableDoor>())
2933
{
30-
if(door is BreakableDoor Brek)
31-
{
32-
Brek.TryBreak();
33-
}
34+
door.TryBreak(damageType);
3435
}
3536
}
3637
}

0 commit comments

Comments
 (0)