Skip to content

Commit 93644ab

Browse files
Update SetDoorMaxHealthMethod.cs
1 parent 6f1c868 commit 93644ab

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed
Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,25 @@
1-
using Interactables.Interobjects.DoorUtils;
2-
using LabApi.Features.Wrappers;
1+
using LabApi.Features.Wrappers;
32
using SER.ArgumentSystem.Arguments;
43
using SER.ArgumentSystem.BaseArguments;
54
using SER.MethodSystem.BaseMethods;
65

76
namespace SER.MethodSystem.Methods.DoorMethods;
7+
88
public class SetDoorMaxHealthMethod : SynchronousMethod
99
{
1010
public override string Description => "Sets max health for specified doors if possible";
1111

1212
public override Argument[] ExpectedArguments =>
1313
[
1414
new DoorsArgument("doors"),
15-
new FloatArgument("maxhealth")
15+
new FloatArgument("max health")
1616
];
1717

1818
public override void Execute()
1919
{
20-
float MaxHP = Args.GetFloat("maxhealth");
2120
Door[] doors = Args.GetDoors("doors");
22-
foreach (Door door in doors)
23-
{
24-
if (door is BreakableDoor brek)
25-
{
26-
brek.MaxHealth = MaxHP;
27-
}
28-
}
21+
float maxHp = Args.GetFloat("max health");
22+
23+
doors.OfType<Door, BreakableDoor>().ForEach(door => door.MaxHealth = maxHp);
2924
}
3025
}

0 commit comments

Comments
 (0)