File tree Expand file tree Collapse file tree 1 file changed +6
-11
lines changed
MethodSystem/Methods/DoorMethods Expand file tree Collapse file tree 1 file changed +6
-11
lines changed Original file line number Diff line number Diff line change 1- using Interactables . Interobjects . DoorUtils ;
2- using LabApi . Features . Wrappers ;
1+ using LabApi . Features . Wrappers ;
32using SER . ArgumentSystem . Arguments ;
43using SER . ArgumentSystem . BaseArguments ;
54using SER . MethodSystem . BaseMethods ;
65
76namespace SER . MethodSystem . Methods . DoorMethods ;
7+
88public 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}
You can’t perform that action at this time.
0 commit comments