-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathPryGateMethod.cs
More file actions
45 lines (36 loc) · 1.38 KB
/
PryGateMethod.cs
File metadata and controls
45 lines (36 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using JetBrains.Annotations;
using LabApi.Features.Wrappers;
using MapGeneration.Distributors;
using SER.Code.ArgumentSystem.Arguments;
using SER.Code.ArgumentSystem.BaseArguments;
using SER.Code.MethodSystem.BaseMethods.Synchronous;
namespace SER.Code.MethodSystem.Methods.DoorMethods;
[UsedImplicitly]
public class PryGateMethod : SynchronousMethod
{
public override string Description => "Pries a gate.";
public override Argument[] ExpectedArguments =>
[
new DoorArgument("gate"),
new BoolArgument("should play effects")
{
DefaultValue = new(false, "does not play button effects"),
Description = "Whether to play gate button effects when pried."
}
];
public override void Execute()
{
var door = Args.GetDoor("gate");
var playEffects = Args.GetBool("should play effects");
if (door is not Gate gate) return;
if (gate.IsOpened || gate.ExactState != 0f || gate.Base.IsBeingPried) return;
if (playEffects)
{
gate.PlayPermissionDeniedAnimation();
gate.PlayLockBypassDeniedSound();
}
// Spawn pickups in case a player goes through the gate. This should not duplicate pickups if the gate gets opened properly later.
SpawnablesDistributorBase.ServerSpawnForAllDoor(gate.Base);
gate.Pry();
}
}