File tree Expand file tree Collapse file tree
MethodSystem/Methods/AdminToyPropertyMethods Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -160,6 +160,11 @@ public Door GetDoor(string argName)
160160 return GetValue < Door , DoorArgument > ( argName ) ;
161161 }
162162
163+ public TimeSpan ? GetNullableDuration ( string argName )
164+ {
165+ return GetValueNullableStruct < TimeSpan , DurationArgument > ( argName ) ;
166+ }
167+
163168 public TimeSpan GetDuration ( string argName )
164169 {
165170 return GetValue < TimeSpan , DurationArgument > ( argName ) ;
Original file line number Diff line number Diff line change 1+ using AdminToys ;
2+ using JetBrains . Annotations ;
3+ using LabApi . Features . Wrappers ;
4+ using SER . Code . ArgumentSystem . Arguments ;
5+ using SER . Code . ArgumentSystem . BaseArguments ;
6+ using SER . Code . MethodSystem . BaseMethods . Synchronous ;
7+
8+ namespace SER . Code . MethodSystem . Methods . AdminToyPropertyMethods ;
9+
10+ [ UsedImplicitly ]
11+ public class SetInteractablePropertiesMethod : SynchronousMethod
12+ {
13+ public override string Description => "Sets properties of an Interactable Toy." ;
14+
15+ public override Argument [ ] ExpectedArguments { get ; } =
16+ [
17+ new ReferenceArgument < InteractableToy > ( "toy" ) ,
18+ new EnumArgument < InvisibleInteractableToy . ColliderShape > ( "shape" )
19+ {
20+ DefaultValue = new ( null , "not changing" )
21+ } ,
22+ new DurationArgument ( "interaction duration" )
23+ {
24+ DefaultValue = new ( null , "not changing" )
25+ } ,
26+ new BoolArgument ( "is locked" )
27+ {
28+ DefaultValue = new ( null , "not changing" )
29+ }
30+ ] ;
31+
32+ public override void Execute ( )
33+ {
34+ var toy = Args . GetReference < InteractableToy > ( "toy" ) ;
35+ if ( Args . GetNullableEnum < InvisibleInteractableToy . ColliderShape > ( "shape" ) is { } shape )
36+ toy . Shape = shape ;
37+ if ( Args . GetNullableDuration ( "interaction duration" ) is { } duration )
38+ toy . InteractionDuration = ( float ) duration . TotalSeconds ;
39+ if ( Args . GetNullableBool ( "is locked" ) is { } locked )
40+ toy . IsLocked = locked ;
41+ }
42+ }
You can’t perform that action at this time.
0 commit comments